jsdoczoom 0.4.15 → 0.4.17
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/dist/drilldown.js +24 -1
- package/dist/jsdoc-parser.js +3 -3
- package/package.json +1 -1
- package/types/jsdoc-parser.d.ts +4 -1
package/dist/drilldown.js
CHANGED
|
@@ -335,12 +335,35 @@ export async function drilldown(
|
|
|
335
335
|
truncated,
|
|
336
336
|
};
|
|
337
337
|
}
|
|
338
|
-
// Single file path — errors are fatal
|
|
338
|
+
// Single file path — errors are fatal
|
|
339
339
|
const filePath = files[0];
|
|
340
340
|
const content = await readFile(filePath, "utf-8");
|
|
341
341
|
const info = await processWithCache(config, "drilldown", content, () =>
|
|
342
342
|
parseFileSummaries(filePath),
|
|
343
343
|
);
|
|
344
|
+
// Barrel transition: when a barrel with a summary is targeted directly
|
|
345
|
+
// at depth >= 3, apply the same transition as the glob pipeline —
|
|
346
|
+
// barrel disappears and children appear at depth - 2.
|
|
347
|
+
if (isBarrel(filePath) && info.summary !== null) {
|
|
348
|
+
let barrelEffectiveDepth = depth;
|
|
349
|
+
if (barrelEffectiveDepth === 2 && info.description === null) {
|
|
350
|
+
barrelEffectiveDepth = 3;
|
|
351
|
+
}
|
|
352
|
+
if (barrelEffectiveDepth >= 3) {
|
|
353
|
+
const children = getBarrelChildren(filePath, cwd);
|
|
354
|
+
const childDepth = barrelEffectiveDepth - 2;
|
|
355
|
+
const results = await collectSafeResults(
|
|
356
|
+
children,
|
|
357
|
+
childDepth,
|
|
358
|
+
cwd,
|
|
359
|
+
config,
|
|
360
|
+
);
|
|
361
|
+
const sorted = results.sort((a, b) =>
|
|
362
|
+
sortKey(a).localeCompare(sortKey(b)),
|
|
363
|
+
);
|
|
364
|
+
return { items: sorted, truncated: false };
|
|
365
|
+
}
|
|
366
|
+
}
|
|
344
367
|
const effectiveDepth = computeEffectiveDepth(depth, info);
|
|
345
368
|
const typeDeclarations = await computeTypeDeclarationsIfNeeded(
|
|
346
369
|
content,
|
package/dist/jsdoc-parser.js
CHANGED
|
@@ -17,9 +17,9 @@ import { appendText, DESCRIPTION_TAGS } from "./types.js";
|
|
|
17
17
|
* Returns the raw JSDoc text without the leading `/**` and trailing `*/` delimiters,
|
|
18
18
|
* or null if no file-level JSDoc is found.
|
|
19
19
|
*/
|
|
20
|
-
export function extractFileJsdoc(sourceText) {
|
|
20
|
+
export function extractFileJsdoc(sourceText, fileName = "input.tsx") {
|
|
21
21
|
const sourceFile = ts.createSourceFile(
|
|
22
|
-
|
|
22
|
+
fileName,
|
|
23
23
|
sourceText,
|
|
24
24
|
ts.ScriptTarget.Latest,
|
|
25
25
|
true,
|
|
@@ -222,7 +222,7 @@ export function parseFileSummaries(filePath) {
|
|
|
222
222
|
} catch {
|
|
223
223
|
throw new JsdocError("FILE_NOT_FOUND", `File not found: ${filePath}`);
|
|
224
224
|
}
|
|
225
|
-
const jsdocText = extractFileJsdoc(sourceText);
|
|
225
|
+
const jsdocText = extractFileJsdoc(sourceText, filePath);
|
|
226
226
|
if (jsdocText === null) {
|
|
227
227
|
return {
|
|
228
228
|
path: filePath,
|
package/package.json
CHANGED
package/types/jsdoc-parser.d.ts
CHANGED
|
@@ -14,7 +14,10 @@ import { type ParsedFileInfo } from "./types.js";
|
|
|
14
14
|
* Returns the raw JSDoc text without the leading `/**` and trailing `*/` delimiters,
|
|
15
15
|
* or null if no file-level JSDoc is found.
|
|
16
16
|
*/
|
|
17
|
-
export declare function extractFileJsdoc(
|
|
17
|
+
export declare function extractFileJsdoc(
|
|
18
|
+
sourceText: string,
|
|
19
|
+
fileName?: string,
|
|
20
|
+
): string | null;
|
|
18
21
|
/**
|
|
19
22
|
* Parse a TypeScript file and extract its summary and description from file-level JSDoc.
|
|
20
23
|
*
|