@@ -162,8 +162,8 @@ function processFile(filePath) {
162
162
) ;
163
163
164
164
const functions = [ ] ;
165
- const category = path . basename ( path . dirname ( filePath ) ) === 'utils'
166
- ? 'utility'
165
+ const category = path . basename ( path . dirname ( filePath ) ) === 'utils'
166
+ ? 'utility'
167
167
: path . basename ( filePath , path . extname ( filePath ) ) ;
168
168
169
169
function visit ( node ) {
@@ -175,7 +175,7 @@ function processFile(filePath) {
175
175
176
176
if ( hasExportModifier ) {
177
177
const functionName = node . name . getText ( sourceFile ) ;
178
-
178
+
179
179
// Skip ignored functions
180
180
if ( CONFIG . ignoredFunctions . includes ( functionName ) ) {
181
181
return ;
@@ -228,12 +228,12 @@ function processFile(filePath) {
228
228
229
229
if ( hasExportModifier ) {
230
230
node . declarationList . declarations . forEach ( declaration => {
231
- if ( declaration . initializer &&
232
- ( ts . isArrowFunction ( declaration . initializer ) ||
233
- ts . isFunctionExpression ( declaration . initializer ) ) ) {
234
-
231
+ if ( declaration . initializer &&
232
+ ( ts . isArrowFunction ( declaration . initializer ) ||
233
+ ts . isFunctionExpression ( declaration . initializer ) ) ) {
234
+
235
235
const functionName = declaration . name . getText ( sourceFile ) ;
236
-
236
+
237
237
// Skip ignored functions
238
238
if ( CONFIG . ignoredFunctions . includes ( functionName ) ) {
239
239
return ;
@@ -316,7 +316,7 @@ function processConstants(filePath) {
316
316
node . declarationList . declarations . forEach ( declaration => {
317
317
if ( declaration . initializer ) {
318
318
const constantName = declaration . name . getText ( sourceFile ) ;
319
-
319
+
320
320
// Get JSDoc comment
321
321
const jsDocNodes = ts . getJSDocCommentsAndTags ( declaration ) ;
322
322
let jsDocText = '' ;
@@ -327,14 +327,14 @@ function processConstants(filePath) {
327
327
}
328
328
329
329
const jsDoc = parseJSDoc ( jsDocText ) ;
330
-
330
+
331
331
// Try to get the actual value structure
332
332
let value = 'Object' ;
333
333
let preview = '' ;
334
-
334
+
335
335
try {
336
336
const valueText = declaration . initializer . getText ( sourceFile ) ;
337
-
337
+
338
338
// Simple preview generation
339
339
if ( valueText . includes ( '{' ) && valueText . includes ( '}' ) ) {
340
340
const keys = valueText . match ( / ( \w + ) : / g) ;
@@ -373,22 +373,22 @@ function processConstants(filePath) {
373
373
// Process all files in a directory
374
374
function processDirectory ( dirPath ) {
375
375
const functions = [ ] ;
376
-
376
+
377
377
if ( ! fs . existsSync ( dirPath ) ) {
378
378
console . warn ( `Directory not found: ${ dirPath } ` ) ;
379
379
return functions ;
380
380
}
381
381
382
382
const files = fs . readdirSync ( dirPath ) ;
383
-
383
+
384
384
files . forEach ( file => {
385
385
if ( CONFIG . ignoredFiles . includes ( file ) ) {
386
386
return ;
387
387
}
388
388
389
389
const filePath = path . join ( dirPath , file ) ;
390
390
const stat = fs . statSync ( filePath ) ;
391
-
391
+
392
392
if ( stat . isFile ( ) && ( file . endsWith ( '.ts' ) || file . endsWith ( '.js' ) ) ) {
393
393
console . log ( `Processing ${ filePath } ...` ) ;
394
394
try {
@@ -406,7 +406,7 @@ function processDirectory(dirPath) {
406
406
// Main function
407
407
function main ( ) {
408
408
console . log ( 'Extracting function documentation...\n' ) ;
409
-
409
+
410
410
let allFunctions = [ ] ;
411
411
let allConstants = [ ] ;
412
412
@@ -454,7 +454,7 @@ const packageInfo = ${JSON.stringify({
454
454
repository : packageJson . repository ,
455
455
homepage : packageJson . homepage ,
456
456
bugs : packageJson . bugs
457
- } , null , 2 ) } ;
457
+ } , null , 2 ) } ;
458
458
459
459
// Export for use in documentation
460
460
if (typeof module !== 'undefined' && module.exports) {
@@ -469,16 +469,16 @@ if (typeof module !== 'undefined' && module.exports) {
469
469
470
470
// Write output file
471
471
fs . writeFileSync ( CONFIG . outputFile , output , 'utf-8' ) ;
472
-
472
+
473
473
console . log ( `\n✅ Generated documentation for ${ allFunctions . length } functions and ${ allConstants . length } constants` ) ;
474
474
console . log ( `📁 Output written to ${ CONFIG . outputFile } ` ) ;
475
-
475
+
476
476
// Summary by category
477
477
const categoryCounts = { } ;
478
478
allFunctions . forEach ( func => {
479
479
categoryCounts [ func . category ] = ( categoryCounts [ func . category ] || 0 ) + 1 ;
480
480
} ) ;
481
-
481
+
482
482
console . log ( '\nFunctions by category:' ) ;
483
483
Object . entries ( categoryCounts )
484
484
. sort ( ( [ a ] , [ b ] ) => a . localeCompare ( b ) )
0 commit comments