svelte-docinfo 0.5.0 → 0.5.1

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.
@@ -1266,7 +1266,7 @@ export declare const AnalyzeResultJson: z.ZodObject<{
1266
1266
  see: "see";
1267
1267
  nodocs: "nodocs";
1268
1268
  }>;
1269
- functionName: z.ZodString;
1269
+ functionName: z.ZodOptional<z.ZodString>;
1270
1270
  file: z.ZodString;
1271
1271
  line: z.ZodOptional<z.ZodNumber>;
1272
1272
  column: z.ZodOptional<z.ZodNumber>;
@@ -354,19 +354,23 @@ export declare const DuplicateCommentDiagnostic: z.ZodObject<{
354
354
  }, z.core.$strict>;
355
355
  export type DuplicateCommentDiagnostic = z.infer<typeof DuplicateCommentDiagnostic>;
356
356
  /**
357
- * Symbol-scope JSDoc tag (`@example`, `@deprecated`, `@since`, `@see`,
358
- * `@throws`, `@mutates`, `@default`, `@nodocs`) found on a non-primary overload
359
- * signature.
357
+ * A JSDoc tag found somewhere it has no effect.
360
358
  *
361
- * Symbol-scope tags describe the function as a whole, not individual
362
- * signatures. The primary signature's JSDoc feeds the parent declaration's
363
- * symbol-level extraction; tags on non-primary overload signatures are
364
- * silently dropped from output. This diagnostic surfaces them so authors
365
- * can move them to the primary signature.
359
+ * Two contexts emit this:
366
360
  *
367
- * `@default` and `@nodocs` are included here even though overloads never
368
- * carry a `defaultValue` or per-overload exclusion: their presence on a
369
- * non-primary signature is always a misplacement.
361
+ * - **Non-primary overload signature** — symbol-scope tags (`@example`,
362
+ * `@deprecated`, `@since`, `@see`, `@throws`, `@mutates`, `@default`,
363
+ * `@nodocs`) describe the function as a whole, not individual signatures.
364
+ * The primary signature's JSDoc feeds the parent declaration's symbol-level
365
+ * extraction; tags on non-primary overload signatures are silently dropped
366
+ * from output. This diagnostic surfaces them so authors can move them to
367
+ * the primary signature. `@default` and `@nodocs` are included even though
368
+ * overloads never carry a `defaultValue` or per-overload exclusion: their
369
+ * presence on a non-primary signature is always a misplacement.
370
+ * - **Module comment** — `@nodocs` has no module-level meaning (it applies to
371
+ * declarations and export statements); in a `@module` comment the tag does
372
+ * nothing except remain verbatim in `moduleComment` text. To omit a module
373
+ * from analysis, use `exclude` patterns instead.
370
374
  */
371
375
  export declare const MisplacedTagDiagnostic: z.ZodObject<{
372
376
  /** The tag name without the `@` prefix (e.g., `'example'`, `'deprecated'`). */
@@ -380,8 +384,11 @@ export declare const MisplacedTagDiagnostic: z.ZodObject<{
380
384
  see: "see";
381
385
  nodocs: "nodocs";
382
386
  }>;
383
- /** Name of the function or method whose overload carries the misplaced tag. */
384
- functionName: z.ZodString;
387
+ /**
388
+ * Name of the function or method whose overload carries the misplaced tag.
389
+ * Absent for module-comment misplacements (no enclosing symbol).
390
+ */
391
+ functionName: z.ZodOptional<z.ZodString>;
385
392
  /**
386
393
  * File path relative to project root (no leading slash, no `./` prefix).
387
394
  *
@@ -1 +1 @@
1
- {"version":3,"file":"diagnostics.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/diagnostics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAItB;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;;;EAA+B,CAAC;AAC/D,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAIpE;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;EAezB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAiC5D;;GAEG;AACH,eAAO,MAAM,wBAAwB;IAGpC,2DAA2D;;IA1B3D;;;;;;;;;OASG;;IAEH,6DAA6D;;IAE7D,+DAA+D;;IAE/D,+CAA+C;;;;;;;kBAa9C,CAAC;AACH,M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wBAAwB;CAC/B,EACD,MAAM,CAgBL,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAIpD;;GAEG;AACH,eAAO,MAAM,SAAS,GAAI,aAAa,KAAK,CAAC,UAAU,CAAC,KAAG,OACX,CAAC;AAEjD;;GAEG;AACH,eAAO,MAAM,WAAW,GAAI,aAAa,KAAK,CAAC,UAAU,CAAC,KAAG,OACX,CAAC;AAEnD;;GAEG;AACH,eAAO,MAAM,QAAQ,GAAI,aAAa,KAAK,CAAC,UAAU,CAAC,KAAG,KAAK,CAAC,UAAU,CACxB,CAAC;AAEnD;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,aAAa,KAAK,CAAC,UAAU,CAAC,KAAG,KAAK,CAAC,UAAU,CACxB,CAAC;AAErD;;GAEG;AACH,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS,cAAc,EAC9C,aAAa,KAAK,CAAC,UAAU,CAAC,EAC9B,MAAM,CAAC,KACL,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE;IAAC,IAAI,EAAE,CAAC,CAAA;CAAC,CAAC,CAC6C,CAAC;AAErF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,gBAAgB,GAAI,YAAY,UAAU,KAAG,MAMzD,CAAC"}
@@ -205,19 +205,23 @@ export const DuplicateCommentDiagnostic = z.strictObject({
205
205
  commentType: z.enum(['module_comment', 'doc_comment']),
206
206
  });
207
207
  /**
208
- * Symbol-scope JSDoc tag (`@example`, `@deprecated`, `@since`, `@see`,
209
- * `@throws`, `@mutates`, `@default`, `@nodocs`) found on a non-primary overload
210
- * signature.
208
+ * A JSDoc tag found somewhere it has no effect.
211
209
  *
212
- * Symbol-scope tags describe the function as a whole, not individual
213
- * signatures. The primary signature's JSDoc feeds the parent declaration's
214
- * symbol-level extraction; tags on non-primary overload signatures are
215
- * silently dropped from output. This diagnostic surfaces them so authors
216
- * can move them to the primary signature.
210
+ * Two contexts emit this:
217
211
  *
218
- * `@default` and `@nodocs` are included here even though overloads never
219
- * carry a `defaultValue` or per-overload exclusion: their presence on a
220
- * non-primary signature is always a misplacement.
212
+ * - **Non-primary overload signature** — symbol-scope tags (`@example`,
213
+ * `@deprecated`, `@since`, `@see`, `@throws`, `@mutates`, `@default`,
214
+ * `@nodocs`) describe the function as a whole, not individual signatures.
215
+ * The primary signature's JSDoc feeds the parent declaration's symbol-level
216
+ * extraction; tags on non-primary overload signatures are silently dropped
217
+ * from output. This diagnostic surfaces them so authors can move them to
218
+ * the primary signature. `@default` and `@nodocs` are included even though
219
+ * overloads never carry a `defaultValue` or per-overload exclusion: their
220
+ * presence on a non-primary signature is always a misplacement.
221
+ * - **Module comment** — `@nodocs` has no module-level meaning (it applies to
222
+ * declarations and export statements); in a `@module` comment the tag does
223
+ * nothing except remain verbatim in `moduleComment` text. To omit a module
224
+ * from analysis, use `exclude` patterns instead.
221
225
  */
222
226
  export const MisplacedTagDiagnostic = z.strictObject({
223
227
  kind: z.literal('misplaced_tag'),
@@ -233,8 +237,11 @@ export const MisplacedTagDiagnostic = z.strictObject({
233
237
  'default',
234
238
  'nodocs',
235
239
  ]),
236
- /** Name of the function or method whose overload carries the misplaced tag. */
237
- functionName: z.string(),
240
+ /**
241
+ * Name of the function or method whose overload carries the misplaced tag.
242
+ * Absent for module-comment misplacements (no enclosing symbol).
243
+ */
244
+ functionName: z.string().optional(),
238
245
  });
239
246
  /**
240
247
  * `@param` tag references a name that doesn't match any actual parameter.
package/dist/index.d.ts CHANGED
@@ -7,7 +7,6 @@
7
7
  * Svelte analysis internals, or TSDoc parsing utilities.
8
8
  *
9
9
  * @module
10
- * @nodocs
11
10
  */
12
11
  export { analyze, analyzeFromFiles } from './analyze.js';
13
12
  export type { AnalyzeOptions, AnalyzeFromFilesOptions } from './analyze.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/index.ts"],"names":[],"mappings":"AA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@ -7,7 +7,6 @@
7
7
  * Svelte analysis internals, or TSDoc parsing utilities.
8
8
  *
9
9
  * @module
10
- * @nodocs
11
10
  */
12
11
  // ── Core entry points ───────────────────────────────────────────────────────
13
12
  export { analyze, analyzeFromFiles } from './analyze.js';
@@ -54,18 +54,22 @@ export interface DuplicateDeclaration {
54
54
  */
55
55
  export declare const findDuplicates: (modules: Array<ModuleJson>) => Map<string, Array<DuplicateDeclaration>>;
56
56
  /**
57
- * Code-unit string comparator for deterministic output ordering.
58
- *
59
- * Unlike `localeCompare` (host-locale/ICU-dependent, so byte-identical input
60
- * can serialize in different orders on different machines), code-unit order is
61
- * environment-independent — and it matches the default `Array.prototype.sort`
62
- * used for `alsoExportedFrom`, `dependencies`, and `dependents`.
57
+ * Case-insensitive string comparator for deterministic output ordering.
58
+ *
59
+ * Case-folded comparison first (so `Analyze` and `analyze` sort together
60
+ * instead of all uppercase before all lowercase), then a code-unit tiebreak —
61
+ * so equal-ignoring-case strings still compare unequal and the result is an
62
+ * exact total order. Unlike `localeCompare` (host-locale/ICU-dependent, so
63
+ * byte-identical input can serialize in different orders on different
64
+ * machines), both passes use Unicode default mappings only and are
65
+ * environment-independent. All output ordering goes through this comparator —
66
+ * never bare `localeCompare` or default `Array.prototype.sort`.
63
67
  */
64
68
  export declare const compareStrings: (a: string, b: string) => number;
65
69
  /**
66
70
  * Sort modules alphabetically by path for deterministic output and cleaner diffs.
67
71
  *
68
- * Code-unit order (`compareStrings`) so the output is environment-independent.
72
+ * Case-insensitive order (`compareStrings`) so the output is environment-independent.
69
73
  *
70
74
  * @param modules - the modules to sort
71
75
  * @returns a new sorted array (does not mutate input)
@@ -182,7 +186,7 @@ export interface ExportSurfaceEntry {
182
186
  * A module's resolved export surface — see `resolveExportSurface`.
183
187
  */
184
188
  export interface ExportSurface {
185
- /** Surface entries, sorted by `name` (code-unit order). */
189
+ /** Surface entries, sorted by `name` (case-insensitive order, `compareStrings`). */
186
190
  entries: Array<ExportSurfaceEntry>;
187
191
  /**
188
192
  * Star targets (own or transitive) absent from the analyzed set — their
@@ -1 +1 @@
1
- {"version":3,"file":"postprocess.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/postprocess.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAA2B,eAAe,EAAE,UAAU,EAAC,MAAM,YAAY,CAAC;AACtF,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAuBhD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC,qCAAqC;IACrC,WAAW,EAAE,eAAe,CAAC;IAC7B,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAC;CACf;AA6CD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,cAAc,GAC1B,SAAS,KAAK,CAAC,UAAU,CAAC,KACxB,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAwCzC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,KAAG,MAAsC,CAAC;AAE7F;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,GAAI,SAAS,KAAK,CAAC,UAAU,CAAC,KAAG,KAAK,CAAC,UAAU,CAExE,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,cAAc,GAAI,SAAS,KAAK,CAAC,UAAU,CAAC,KAAG,IAmC3D,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,uBAAuB,GAAI,SAAS,KAAK,CAAC,UAAU,CAAC,KAAG,IAoDpE,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,iBAAiB,GAC7B,OAAO,aAAa,CAAC,cAAc,CAAC,KAClC,KAAK,CAAC,cAAc,GAAG;IAAC,UAAU,CAAC,EAAE,aAAa,CAAC,MAAM,CA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Y,CAAC,EAAE,MAAM,CAAC;IACtB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B,oFAAoF;IACpF,OAAO,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACnC;;;OAGG;IACH,qBAAqB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACrC;;;OAGG;IACH,mBAAmB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACnC;AAcD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,oBAAoB,GAChC,SAAS,KAAK,CAAC,UAAU,CAAC,EAC1B,MAAM,MAAM,KACV,aAAa,GAAG,IA+IlB,CAAC"}
@@ -133,18 +133,30 @@ export const findDuplicates = (modules) => {
133
133
  return duplicates;
134
134
  };
135
135
  /**
136
- * Code-unit string comparator for deterministic output ordering.
136
+ * Case-insensitive string comparator for deterministic output ordering.
137
137
  *
138
- * Unlike `localeCompare` (host-locale/ICU-dependent, so byte-identical input
139
- * can serialize in different orders on different machines), code-unit order is
140
- * environment-independent — and it matches the default `Array.prototype.sort`
141
- * used for `alsoExportedFrom`, `dependencies`, and `dependents`.
138
+ * Case-folded comparison first (so `Analyze` and `analyze` sort together
139
+ * instead of all uppercase before all lowercase), then a code-unit tiebreak —
140
+ * so equal-ignoring-case strings still compare unequal and the result is an
141
+ * exact total order. Unlike `localeCompare` (host-locale/ICU-dependent, so
142
+ * byte-identical input can serialize in different orders on different
143
+ * machines), both passes use Unicode default mappings only and are
144
+ * environment-independent. All output ordering goes through this comparator —
145
+ * never bare `localeCompare` or default `Array.prototype.sort`.
142
146
  */
143
- export const compareStrings = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
147
+ export const compareStrings = (a, b) => {
148
+ const af = a.toLowerCase();
149
+ const bf = b.toLowerCase();
150
+ if (af < bf)
151
+ return -1;
152
+ if (af > bf)
153
+ return 1;
154
+ return a < b ? -1 : a > b ? 1 : 0;
155
+ };
144
156
  /**
145
157
  * Sort modules alphabetically by path for deterministic output and cleaner diffs.
146
158
  *
147
- * Code-unit order (`compareStrings`) so the output is environment-independent.
159
+ * Case-insensitive order (`compareStrings`) so the output is environment-independent.
148
160
  *
149
161
  * @param modules - the modules to sort
150
162
  * @returns a new sorted array (does not mutate input)
@@ -216,7 +228,7 @@ export const mergeReExports = (modules) => {
216
228
  const merged = new Set(declaration.alsoExportedFrom);
217
229
  for (const reExporter of reExporters)
218
230
  merged.add(reExporter);
219
- declaration.alsoExportedFrom = Array.from(merged).sort();
231
+ declaration.alsoExportedFrom = Array.from(merged).sort(compareStrings);
220
232
  }
221
233
  }
222
234
  }
@@ -362,7 +374,7 @@ export const computeDependents = (files) => {
362
374
  return file;
363
375
  }
364
376
  // Sort for deterministic output
365
- const dependents = Array.from(computed).sort();
377
+ const dependents = Array.from(computed).sort(compareStrings);
366
378
  return {
367
379
  ...file,
368
380
  dependents,
@@ -547,7 +559,7 @@ export const resolveExportSurface = (modules, path) => {
547
559
  entries: Array.from(resolved.entries.values())
548
560
  .map(({ entry }) => entry)
549
561
  .sort((a, b) => compareStrings(a.name, b.name)),
550
- unresolvedStarExports: Array.from(resolved.unresolvedStars).sort(),
551
- externalStarExports: Array.from(resolved.externalStars).sort(),
562
+ unresolvedStarExports: Array.from(resolved.unresolvedStars).sort(compareStrings),
563
+ externalStarExports: Array.from(resolved.externalStars).sort(compareStrings),
552
564
  };
553
565
  };
@@ -1 +1 @@
1
- {"version":3,"file":"source-config.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/source-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,EAAC,KAAK,YAAY,EAAE,KAAK,cAAc,EAAqB,MAAM,aAAa,CAAC;AAGvF;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,mBAAmB;IACnC;;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;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,sBAAsB,GAAI,SAAS,mBAAmB,KAAG,mBAmDrE,CAAC;AA+BF;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,GAAI,SAAS,mBAAmB,KAAG,MAQ5D,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,WAAW,GAAI,UAAU,MAAM,EAAE,SAAS,mBAAmB,KAAG,MAgB5E,CAAC;AAwBF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,QAAQ,GAAI,MAAM,MAAM,EAAE,SAAS,mBAAmB,KAAG,OAwBrE,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,mBAAmB,GAC/B,YAAY,cAAc,GAAG;IAAC,UAAU,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CAAC,EACjE,SAAS,mBAAmB,KAC1B;IAAC,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAAC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;CA2BzD,CAAC"}
@@ -14,6 +14,7 @@ import { resolve, relative } from 'node:path';
14
14
  import picomatch from 'picomatch';
15
15
  import { getDefaultAnalyzer } from './source.js';
16
16
  import { toPosixPath } from './paths.js';
17
+ import { compareStrings } from './postprocess.js';
17
18
  /**
18
19
  * Default partial options for standard SvelteKit library structure.
19
20
  *
@@ -350,7 +351,7 @@ export const extractDependencies = (sourceFile, options) => {
350
351
  }
351
352
  }
352
353
  // Sort for deterministic output
353
- dependencies.sort();
354
- dependents.sort();
354
+ dependencies.sort(compareStrings);
355
+ dependents.sort(compareStrings);
355
356
  return { dependencies, dependents };
356
357
  };
@@ -1 +1 @@
1
- {"version":3,"file":"svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/svelte.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;G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,eAAO,MAAM,8BAA8B,GAAI,YAAY,KAAK,CAAC,kBAAkB,CAAC,KAAG,MAGtF,CAAC;AA8NF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,mBAAmB,GAC/B,YAAY,cAAc,GAAG;IAAC,UAAU,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CAAC,EACjE,YAAY,MAAM,EAClB,SAAS,EAAE,CAAC,WAAW,EACvB,SAAS,mBAAmB,EAC5B,aAAa,KAAK,CAAC,UAAU,CAAC,EAC9B,SAAS,EAAE,CAAC,OAAO,EACnB,aAAa,iBAAiB,KAC5B,cAAc,GAAG,SAyQnB,CAAC"}
package/dist/svelte.js CHANGED
@@ -26,10 +26,10 @@ import { TraceMap, originalPositionFor } from '@jridgewell/trace-mapping';
26
26
  import { VERSION } from 'svelte/compiler';
27
27
  import { svelte2tsx } from 'svelte2tsx';
28
28
  import ts from 'typescript';
29
- import { parseComment, applyToDeclaration, hasModuleTag } from './tsdoc.js';
29
+ import { parseComment, applyToDeclaration } from './tsdoc.js';
30
30
  import { createIsExternalFile } from './typescript-program.js';
31
31
  import { parseGenericParam, filterExternalProperties } from './typescript-extract-shared.js';
32
- import { extractModuleComment, analyzeExports } from './typescript-exports.js';
32
+ import { extractModuleComment, analyzeExports, warnModuleCommentNodocs, } from './typescript-exports.js';
33
33
  import { getComponentName, SVELTE_VIRTUAL_SUFFIX } from './source.js';
34
34
  import { extractDependencies } from './source-config.js';
35
35
  import {} from './diagnostics.js';
@@ -298,9 +298,10 @@ const hasScriptDocComment = (scriptContent) => {
298
298
  if (!scriptContent)
299
299
  return false;
300
300
  const sourceFile = ts.createSourceFile('script.ts', scriptContent, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
301
- // Walk statements looking for a non-@module JSDoc comment
301
+ // Walk statements looking for a JSDoc comment (`parseComment` filters
302
+ // `@module` blocks, so module comments don't count)
302
303
  for (const statement of sourceFile.statements) {
303
- if (ts.isVariableStatement(statement) && !hasModuleTag(statement)) {
304
+ if (ts.isVariableStatement(statement)) {
304
305
  const tsdoc = parseComment(statement, sourceFile);
305
306
  if (tsdoc)
306
307
  return true;
@@ -327,14 +328,12 @@ const extractComponentTsdoc = (sourceFile) => {
327
328
  }
328
329
  // Check for JSDoc on VariableStatement or VariableDeclaration
329
330
  // Component-level JSDoc is attached to these node types
330
- // Skip @module comments — those are module-level, not component-level
331
+ // (`parseComment` filters module-level `@module` blocks)
331
332
  if (ts.isVariableStatement(node) || ts.isVariableDeclaration(node)) {
332
- if (!hasModuleTag(node)) {
333
- const tsdoc = parseComment(node, sourceFile);
334
- if (tsdoc) {
335
- foundTsdoc = tsdoc;
336
- return;
337
- }
333
+ const tsdoc = parseComment(node, sourceFile);
334
+ if (tsdoc) {
335
+ foundTsdoc = tsdoc;
336
+ return;
338
337
  }
339
338
  }
340
339
  // Continue searching child nodes
@@ -906,6 +905,10 @@ export const analyzeSvelteModule = (sourceFile, modulePath, checker, options, di
906
905
  : undefined;
907
906
  const htmlModuleComment = extractHtmlModuleComment(sourceFile.content);
908
907
  const moduleComment = instanceModuleComment ?? scriptModuleComment ?? htmlModuleComment;
908
+ // @nodocs has no module-level meaning — warn per misplaced comment. The
909
+ // <script module> source is covered by analyzeExports on the virtual above.
910
+ warnModuleCommentNodocs(instanceModuleComment, modulePath, diagnostics);
911
+ warnModuleCommentNodocs(htmlModuleComment, modulePath, diagnostics);
909
912
  // Warn if multiple @module sources exist
910
913
  const moduleCommentSources = [
911
914
  instanceModuleComment,
package/dist/tsdoc.d.ts CHANGED
@@ -31,6 +31,10 @@
31
31
  *
32
32
  * ## Behavioral notes
33
33
  *
34
+ * JSDoc blocks tagged `@module` are excluded from `parseComment` entirely (text
35
+ * and tags) — module comments attach to the file's first statement in the AST
36
+ * and are owned by `extractModuleComment` instead.
37
+ *
34
38
  * Due to TS Compiler API limitations:
35
39
  * - TS API includes dash separator in `@param` tag text; we strip the leading `- ` as it's syntax, not content
36
40
  * - `@throws` tags have `{Type}` stripped by TS API; fallback regex extracts first word as error type
@@ -92,9 +96,14 @@ export interface TsdocParsedComment {
92
96
  * - `@mutates` - mutation documentation (non-standard)
93
97
  * - `@nodocs` - exclusion flag (non-standard)
94
98
  *
99
+ * JSDoc blocks tagged `@module` are excluded entirely (text and tags): a module
100
+ * comment attaches to the file's first statement in the AST, and without the
101
+ * filter it would read as that statement's own docs. `extractModuleComment`
102
+ * (`typescript-exports.ts`) owns module comments.
103
+ *
95
104
  * @param node - the TypeScript node to extract JSDoc from
96
105
  * @param sourceFile - source file (used for extracting full `@see` tag text)
97
- * @returns parsed comment with structured metadata, or undefined if no JSDoc found
106
+ * @returns parsed comment with structured metadata, or undefined if no JSDoc found (or only `@module` blocks)
98
107
  *
99
108
  * @example
100
109
  * ```ts
@@ -117,16 +126,6 @@ export declare const parseComment: (node: ts.Node, sourceFile: ts.SourceFile) =>
117
126
  * @mutates declaration - adds docComment, deprecatedMessage, examples, seeAlso, throws, since, mutates, defaultValue fields
118
127
  */
119
128
  export declare const applyToDeclaration: (declaration: DeclarationJsonBuild | MemberJsonBuild, tsdoc: TsdocParsedComment | undefined) => void;
120
- /**
121
- * Check if a TypeScript node has a `@module` JSDoc tag.
122
- *
123
- * Used to prevent `@module` comments from leaking into declaration `docComment` fields.
124
- * Module-level comments are extracted separately by `extractModuleComment`.
125
- *
126
- * @param node - the TypeScript node to check
127
- * @returns true if any JSDoc tag on the node is `@module`
128
- */
129
- export declare const hasModuleTag: (node: ts.Node) => boolean;
130
129
  /**
131
130
  * Clean raw JSDoc comment text by removing comment markers and leading asterisks.
132
131
  *
@@ -1 +1 @@
1
- {"version":3,"file":"tsdoc.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/tsdoc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,KAAK,EAAC,oBAAoB,EAAE,eAAe,EAAC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,kBAAkB,GAAG,SA4GvB,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,GAC9B,aAAa,oBAAoB,GAAG,eAAe,EACnD,OAAO,kBAAkB,GAAG,SAAS,KACnC,IAgCF,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY,GAAI,aAAa,MAAM,KAAG,MAAM,GAAG,SAW3D,CAAC"}
package/dist/tsdoc.js CHANGED
@@ -31,6 +31,10 @@
31
31
  *
32
32
  * ## Behavioral notes
33
33
  *
34
+ * JSDoc blocks tagged `@module` are excluded from `parseComment` entirely (text
35
+ * and tags) — module comments attach to the file's first statement in the AST
36
+ * and are owned by `extractModuleComment` instead.
37
+ *
34
38
  * Due to TS Compiler API limitations:
35
39
  * - TS API includes dash separator in `@param` tag text; we strip the leading `- ` as it's syntax, not content
36
40
  * - `@throws` tags have `{Type}` stripped by TS API; fallback regex extracts first word as error type
@@ -51,6 +55,22 @@ import ts from 'typescript';
51
55
  * @returns cleaned text with leading `- ` removed if present
52
56
  */
53
57
  const cleanTagDescription = (text) => text.trim().replace(/^-\s+/, '');
58
+ /**
59
+ * Whether a JSDoc block is a module-level comment (carries a `@module` tag).
60
+ */
61
+ const isModuleJsdocBlock = (jsdoc) => jsdoc.tags?.some((tag) => tag.tagName.text === 'module') ?? false;
62
+ /**
63
+ * Whether a JSDoc node or tag belongs to a module-level (`@module`) block.
64
+ *
65
+ * A module comment physically precedes the file's first statement, so the AST
66
+ * attaches it to that statement's JSDoc — without this filter the module
67
+ * comment (including tags like `@nodocs`) would read as the statement's own
68
+ * docs. Per-block, so a statement's own JSDoc below a module comment still
69
+ * applies. `extractModuleComment` owns module-comment extraction.
70
+ */
71
+ const belongsToModuleBlock = (node) => ts.isJSDoc(node)
72
+ ? isModuleJsdocBlock(node)
73
+ : ts.isJSDoc(node.parent) && isModuleJsdocBlock(node.parent);
54
74
  /**
55
75
  * Parse JSDoc comment from a TypeScript node.
56
76
  *
@@ -67,9 +87,14 @@ const cleanTagDescription = (text) => text.trim().replace(/^-\s+/, '');
67
87
  * - `@mutates` - mutation documentation (non-standard)
68
88
  * - `@nodocs` - exclusion flag (non-standard)
69
89
  *
90
+ * JSDoc blocks tagged `@module` are excluded entirely (text and tags): a module
91
+ * comment attaches to the file's first statement in the AST, and without the
92
+ * filter it would read as that statement's own docs. `extractModuleComment`
93
+ * (`typescript-exports.ts`) owns module comments.
94
+ *
70
95
  * @param node - the TypeScript node to extract JSDoc from
71
96
  * @param sourceFile - source file (used for extracting full `@see` tag text)
72
- * @returns parsed comment with structured metadata, or undefined if no JSDoc found
97
+ * @returns parsed comment with structured metadata, or undefined if no JSDoc found (or only `@module` blocks)
73
98
  *
74
99
  * @example
75
100
  * ```ts
@@ -81,7 +106,7 @@ const cleanTagDescription = (text) => text.trim().replace(/^-\s+/, '');
81
106
  * ```
82
107
  */
83
108
  export const parseComment = (node, sourceFile) => {
84
- const tsdocComments = ts.getJSDocCommentsAndTags(node);
109
+ const tsdocComments = ts.getJSDocCommentsAndTags(node).filter((c) => !belongsToModuleBlock(c));
85
110
  if (tsdocComments.length === 0)
86
111
  return undefined;
87
112
  let fullText = '';
@@ -109,8 +134,8 @@ export const parseComment = (node, sourceFile) => {
109
134
  fullText += text + '\n';
110
135
  }
111
136
  }
112
- // Extract tags
113
- const tags = ts.getJSDocTags(node);
137
+ // Extract tags (module-block tags filtered like their text above)
138
+ const tags = ts.getJSDocTags(node).filter((tag) => !belongsToModuleBlock(tag));
114
139
  for (const tag of tags) {
115
140
  const tagText = typeof tag.comment === 'string' ? tag.comment : tag.comment?.map((c) => c.text).join('');
116
141
  const tagName = tag.tagName.text;
@@ -233,16 +258,6 @@ export const applyToDeclaration = (declaration, tsdoc) => {
233
258
  declaration.defaultValue = tsdoc.defaultValue;
234
259
  }
235
260
  };
236
- /**
237
- * Check if a TypeScript node has a `@module` JSDoc tag.
238
- *
239
- * Used to prevent `@module` comments from leaking into declaration `docComment` fields.
240
- * Module-level comments are extracted separately by `extractModuleComment`.
241
- *
242
- * @param node - the TypeScript node to check
243
- * @returns true if any JSDoc tag on the node is `@module`
244
- */
245
- export const hasModuleTag = (node) => ts.getJSDocTags(node).some((tag) => tag.tagName.text === 'module');
246
261
  /**
247
262
  * Clean raw JSDoc comment text by removing comment markers and leading asterisks.
248
263
  *
@@ -90,4 +90,18 @@ export declare const analyzeDeclaration: (symbol: ts.Symbol, sourceFile: ts.Sour
90
90
  * @see {@link https://typedoc.org/documents/Tags._module.html|TypeDoc @module documentation}
91
91
  */
92
92
  export declare const extractModuleComment: (sourceFile: ts.SourceFile) => string | undefined;
93
+ /**
94
+ * Warn when a module comment carries `@nodocs`.
95
+ *
96
+ * The tag has no module-level meaning — it applies to declarations and export
97
+ * statements — so its presence in a `@module` comment is always author
98
+ * confusion: it does nothing except remain verbatim in `moduleComment` text.
99
+ * Same line-start detection as `extractModuleComment`'s `@module` test, so a
100
+ * backticked or mid-prose mention doesn't trigger.
101
+ *
102
+ * @internal Shared by `analyzeExports` (TS files and Svelte `<script module>`
103
+ * virtuals) and `analyzeSvelteModule` (instance-script and HTML module
104
+ * comments, which `analyzeExports` never sees).
105
+ */
106
+ export declare const warnModuleCommentNodocs: (moduleComment: string | undefined, file: string, diagnostics: Array<Diagnostic>) => void;
93
107
  //# sourceMappingURL=typescript-exports.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"typescript-exports.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/typescript-exports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,KAAK,EACX,mBAAmB,EACnB,cAAc,EACd,qBAAqB,EAErB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EACN,KAAK,cAAc,EAInB,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,KAAK,mBAAmB,EAIxB,MAAM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anComment, hasModuleTag } from './tsdoc.js';
15
+ import { parseComment, applyToDeclaration, cleanComment } from './tsdoc.js';
16
16
  import { stripVirtualSuffix, SVELTE_VIRTUAL_SUFFIX, getComponentName, } from './source.js';
17
17
  import { extractDependencies, extractPath, isSource, } from './source-config.js';
18
18
  import { createIsExternalFile } from './typescript-program.js';
@@ -297,6 +297,7 @@ export const analyzeExports = (sourceFile, checker, options, diagnostics) => {
297
297
  // Normalize virtual paths once (e.g., Foo.svelte.__svelte2tsx__.ts → Foo.svelte)
298
298
  // so re-export tracking matches real module paths
299
299
  const currentFileName = stripVirtualSuffix(sourceFile.fileName);
300
+ warnModuleCommentNodocs(moduleComment, currentFileName, diagnostics);
300
301
  // 1-based line of a node in this file. Virtual coordinates for Svelte
301
302
  // `<script module>` sources — remapped in `analyzeSvelteModule`.
302
303
  const lineOf = (node) => sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + 1;
@@ -605,12 +606,12 @@ export const analyzeDeclaration = (symbol, sourceFile, checker, diagnostics, isE
605
606
  if (!declNode) {
606
607
  return { declaration: result, nodocs: false };
607
608
  }
608
- // Extract TSDoc — skip @module comments (handled by extractModuleComment)
609
+ // Extract TSDoc — `parseComment` filters `@module` blocks (handled by
610
+ // `extractModuleComment`), so a first declaration under a module comment
611
+ // keeps its own JSDoc
609
612
  const tsdoc = parseComment(declNode, sourceFile);
610
613
  const nodocs = tsdoc?.nodocs ?? false;
611
- if (!hasModuleTag(declNode)) {
612
- applyToDeclaration(result, tsdoc);
613
- }
614
+ applyToDeclaration(result, tsdoc);
614
615
  // Extract source line
615
616
  const start = declNode.getStart(sourceFile);
616
617
  const startPos = sourceFile.getLineAndCharacterOfPosition(start);
@@ -680,6 +681,30 @@ export const extractModuleComment = (sourceFile) => {
680
681
  }
681
682
  return undefined;
682
683
  };
684
+ /**
685
+ * Warn when a module comment carries `@nodocs`.
686
+ *
687
+ * The tag has no module-level meaning — it applies to declarations and export
688
+ * statements — so its presence in a `@module` comment is always author
689
+ * confusion: it does nothing except remain verbatim in `moduleComment` text.
690
+ * Same line-start detection as `extractModuleComment`'s `@module` test, so a
691
+ * backticked or mid-prose mention doesn't trigger.
692
+ *
693
+ * @internal Shared by `analyzeExports` (TS files and Svelte `<script module>`
694
+ * virtuals) and `analyzeSvelteModule` (instance-script and HTML module
695
+ * comments, which `analyzeExports` never sees).
696
+ */
697
+ export const warnModuleCommentNodocs = (moduleComment, file, diagnostics) => {
698
+ if (!moduleComment || !/(?:^|\n)@nodocs\b/.test(moduleComment))
699
+ return;
700
+ diagnostics.push({
701
+ kind: 'misplaced_tag',
702
+ file,
703
+ message: '@nodocs in a module comment has no effect — it applies to declarations and export statements; to omit a module from analysis, use exclude patterns',
704
+ severity: 'warning',
705
+ tagName: 'nodocs',
706
+ });
707
+ };
683
708
  /**
684
709
  * Strip `@module` tag line from comment text.
685
710
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-docinfo",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "static analysis for TypeScript and Svelte",
5
5
  "glyph": "📜",
6
6
  "logo": "logo.svg",