@avelonjs/cli 0.8.2 → 0.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/docs-check.ts +13 -3
package/package.json
CHANGED
package/src/docs-check.ts
CHANGED
|
@@ -327,6 +327,7 @@ async function collectFromFile(
|
|
|
327
327
|
root: string,
|
|
328
328
|
names: Set<string>,
|
|
329
329
|
seen: Set<string>,
|
|
330
|
+
includeDefault = true,
|
|
330
331
|
): Promise<void> {
|
|
331
332
|
if (seen.has(file)) return
|
|
332
333
|
seen.add(file)
|
|
@@ -346,7 +347,7 @@ async function collectFromFile(
|
|
|
346
347
|
? resolveRelative(file, root, moduleSpecifier.text)
|
|
347
348
|
: undefined
|
|
348
349
|
if (statement.exportClause === undefined) {
|
|
349
|
-
if (resolved !== undefined) await collectFromFile(resolved, root, names, seen)
|
|
350
|
+
if (resolved !== undefined) await collectFromFile(resolved, root, names, seen, false)
|
|
350
351
|
continue
|
|
351
352
|
}
|
|
352
353
|
if (ts.isNamespaceExport(statement.exportClause)) {
|
|
@@ -354,18 +355,22 @@ async function collectFromFile(
|
|
|
354
355
|
continue
|
|
355
356
|
}
|
|
356
357
|
for (const element of statement.exportClause.elements) {
|
|
357
|
-
names.add(element.name.text)
|
|
358
|
+
if (includeDefault || element.name.text !== 'default') names.add(element.name.text)
|
|
358
359
|
}
|
|
359
360
|
continue
|
|
360
361
|
}
|
|
361
362
|
if (ts.isExportAssignment(statement)) {
|
|
362
|
-
names.add('default')
|
|
363
|
+
if (includeDefault) names.add('default')
|
|
363
364
|
continue
|
|
364
365
|
}
|
|
365
366
|
const mods = ts.canHaveModifiers(statement) ? ts.getModifiers(statement) : undefined
|
|
366
367
|
const exported =
|
|
367
368
|
mods?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword) === true
|
|
368
369
|
if (!exported) continue
|
|
370
|
+
if (mods?.some((modifier) => modifier.kind === ts.SyntaxKind.DefaultKeyword)) {
|
|
371
|
+
if (includeDefault) names.add('default')
|
|
372
|
+
continue
|
|
373
|
+
}
|
|
369
374
|
if (ts.isFunctionDeclaration(statement) && statement.name !== undefined) {
|
|
370
375
|
names.add(statement.name.text)
|
|
371
376
|
continue
|
|
@@ -393,7 +398,12 @@ async function collectFromFile(
|
|
|
393
398
|
function resolveRelative(fromFile: string, root: string, specifier: string): string | undefined {
|
|
394
399
|
if (!specifier.startsWith('.')) return undefined
|
|
395
400
|
const base = join(dirname(fromFile), specifier)
|
|
401
|
+
const sourceBase = base.replace(/\.[cm]?jsx?$/, '')
|
|
402
|
+
const extension = extname(base)
|
|
403
|
+
const sourceExtensions =
|
|
404
|
+
extension === '.mjs' ? ['.mts'] : extension === '.cjs' ? ['.cts'] : ['.ts', '.tsx']
|
|
396
405
|
const candidates = [
|
|
406
|
+
...(sourceBase === base ? [] : sourceExtensions.map((suffix) => `${sourceBase}${suffix}`)),
|
|
397
407
|
base,
|
|
398
408
|
`${base}.ts`,
|
|
399
409
|
`${base}.tsx`,
|