svelte-docinfo 0.5.0 → 0.5.2
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/analyze-core.d.ts +1 -1
- package/dist/analyze-core.js +2 -2
- package/dist/declaration-helpers.js +4 -4
- package/dist/dep-resolver.d.ts +6 -2
- package/dist/dep-resolver.d.ts.map +1 -1
- package/dist/dep-resolver.js +18 -8
- package/dist/diagnostics.d.ts +20 -13
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/diagnostics.js +24 -17
- package/dist/exports.js +4 -4
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -9
- package/dist/postprocess.d.ts +12 -8
- package/dist/postprocess.d.ts.map +1 -1
- package/dist/postprocess.js +23 -11
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +10 -6
- package/dist/source-config.d.ts.map +1 -1
- package/dist/source-config.js +3 -2
- package/dist/svelte.d.ts.map +1 -1
- package/dist/svelte.js +16 -13
- package/dist/tsdoc.d.ts +10 -11
- package/dist/tsdoc.d.ts.map +1 -1
- package/dist/tsdoc.js +29 -14
- package/dist/types.js +2 -2
- package/dist/typescript-exports.d.ts +14 -0
- package/dist/typescript-exports.d.ts.map +1 -1
- package/dist/typescript-exports.js +30 -5
- package/dist/vite.js +4 -4
- package/package.json +2 -2
package/dist/analyze-core.d.ts
CHANGED
|
@@ -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>;
|
package/dist/analyze-core.js
CHANGED
|
@@ -91,7 +91,7 @@ const dispatchOnDuplicates = (mode, duplicates, log) => {
|
|
|
91
91
|
}
|
|
92
92
|
mode(duplicates, errorLog);
|
|
93
93
|
};
|
|
94
|
-
//
|
|
94
|
+
// Result types
|
|
95
95
|
/**
|
|
96
96
|
* Result of `analyze`, `analyzeFromFiles`, and `AnalysisSession.query`.
|
|
97
97
|
*
|
|
@@ -154,7 +154,7 @@ const toModuleJson = (raw) => {
|
|
|
154
154
|
...(raw.moduleComment ? { moduleComment: raw.moduleComment } : {}),
|
|
155
155
|
});
|
|
156
156
|
};
|
|
157
|
-
//
|
|
157
|
+
// Module dispatch
|
|
158
158
|
/**
|
|
159
159
|
* Analyze a single non-Svelte source file and extract module metadata.
|
|
160
160
|
*
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @module
|
|
10
10
|
*/
|
|
11
|
-
//
|
|
11
|
+
// Serialization
|
|
12
12
|
/**
|
|
13
13
|
* JSON replacer that strips Zod default values for compact serialization.
|
|
14
14
|
*
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
* ```
|
|
45
45
|
*/
|
|
46
46
|
export const compactReplacer = (_key, value) => (Array.isArray(value) && value.length === 0) || value === false ? undefined : value;
|
|
47
|
-
//
|
|
47
|
+
// Display Helpers
|
|
48
48
|
/**
|
|
49
49
|
* Format declaration or member name with generic parameters for display.
|
|
50
50
|
*
|
|
@@ -133,7 +133,7 @@ const pascalCaseFromModulePath = (modulePath) => {
|
|
|
133
133
|
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
134
134
|
.join('');
|
|
135
135
|
};
|
|
136
|
-
//
|
|
136
|
+
// Type Reference Helpers
|
|
137
137
|
/**
|
|
138
138
|
* Escape special regex characters in a string.
|
|
139
139
|
*/
|
|
@@ -218,7 +218,7 @@ export const findTypeReferences = (typeString, declarationNames) => {
|
|
|
218
218
|
}
|
|
219
219
|
return refs;
|
|
220
220
|
};
|
|
221
|
-
//
|
|
221
|
+
// Narrowed Declaration Types
|
|
222
222
|
/**
|
|
223
223
|
* Narrow a declaration by kind for type-safe field access.
|
|
224
224
|
*
|
package/dist/dep-resolver.d.ts
CHANGED
|
@@ -134,8 +134,12 @@ export declare const isNodeBuiltin: (specifier: string) => boolean;
|
|
|
134
134
|
* resolver instance share the cache scope (correct, since resolver state is
|
|
135
135
|
* shared too).
|
|
136
136
|
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
137
|
+
* `ts.resolveModuleName` cannot resolve real `.svelte` files (no compiler
|
|
138
|
+
* option teaches it the extension), so relative and absolute `.svelte`
|
|
139
|
+
* specifiers — with or without the extension written — fall back to manual
|
|
140
|
+
* filesystem resolution against `fromFile`. Non-relative `.svelte` specifiers
|
|
141
|
+
* (tsconfig `paths` aliases, package subpaths) stay unresolved; supply a
|
|
142
|
+
* custom `resolveImport` for those setups.
|
|
139
143
|
*
|
|
140
144
|
* @param compilerOptions - parsed tsconfig (from `loadTsconfig`)
|
|
141
145
|
* @param projectRoot - absolute project root for the module-resolution cache
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dep-resolver.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/dep-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;
|
|
1
|
+
{"version":3,"file":"dep-resolver.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/dep-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAIH,OAAO,EAAE,MAAM,YAAY,CAAC;AAK5B;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GAAG,CAC7B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,KACZ,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;AAE5C;;;;;;;;;GASG;AACH,MAAM,WAAW,cAAc;IAC9B,uEAAuE;IACvE,OAAO,EAAE,eAAe,CAAC;IACzB;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,aAAa,GAAG,eAAe,GAAG,cAAc,CAAC;AAE7D;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,GAClC,OAAO,aAAa,GAAG,SAAS,KAC9B,cAAc,GAAG,SAC6E,CAAC;AAElG;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,QAAa,OAAO,CAAC,IAAI,CAErD,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,UAAU,GAAI,SAAS,MAAM,EAAE,QAAQ,MAAM,KAAG,KAAK,CAAC,MAAM,CAOxE,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,GAAI,WAAW,MAAM,KAAG,OAA+B,CAAC;AAElF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,qBAAqB,GACjC,iBAAiB,EAAE,CAAC,eAAe,EACnC,aAAa,MAAM,KACjB,cAsBF,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB,GAC7B,eAAe,eAAe,EAC9B,WAAU,MAAM,GAAG,MAA0B,KAC3C,cAGD,CAAC;AAEH;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,EAAE,cAG5B,CAAC"}
|
package/dist/dep-resolver.js
CHANGED
|
@@ -27,8 +27,10 @@
|
|
|
27
27
|
* @module
|
|
28
28
|
*/
|
|
29
29
|
import { isBuiltin } from 'node:module';
|
|
30
|
+
import { dirname, isAbsolute, resolve as resolvePath } from 'node:path';
|
|
30
31
|
import ts from 'typescript';
|
|
31
32
|
import { init as esModuleLexerInit, parse as esModuleLexerParse } from 'es-module-lexer';
|
|
33
|
+
import { toPosixPath } from './paths.js';
|
|
32
34
|
/**
|
|
33
35
|
* Normalize the public `ResolveImport` union to an `ImportResolver`.
|
|
34
36
|
*
|
|
@@ -92,8 +94,12 @@ export const isNodeBuiltin = (specifier) => isBuiltin(specifier);
|
|
|
92
94
|
* resolver instance share the cache scope (correct, since resolver state is
|
|
93
95
|
* shared too).
|
|
94
96
|
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
+
* `ts.resolveModuleName` cannot resolve real `.svelte` files (no compiler
|
|
98
|
+
* option teaches it the extension), so relative and absolute `.svelte`
|
|
99
|
+
* specifiers — with or without the extension written — fall back to manual
|
|
100
|
+
* filesystem resolution against `fromFile`. Non-relative `.svelte` specifiers
|
|
101
|
+
* (tsconfig `paths` aliases, package subpaths) stay unresolved; supply a
|
|
102
|
+
* custom `resolveImport` for those setups.
|
|
97
103
|
*
|
|
98
104
|
* @param compilerOptions - parsed tsconfig (from `loadTsconfig`)
|
|
99
105
|
* @param projectRoot - absolute project root for the module-resolution cache
|
|
@@ -104,12 +110,16 @@ export const createDefaultResolver = (compilerOptions, projectRoot) => {
|
|
|
104
110
|
const result = ts.resolveModuleName(specifier, fromFile, compilerOptions, ts.sys, cache);
|
|
105
111
|
if (result.resolvedModule)
|
|
106
112
|
return result.resolvedModule.resolvedFileName;
|
|
107
|
-
//
|
|
108
|
-
//
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
+
// ts.resolveModuleName never resolves real .svelte files — no compiler
|
|
114
|
+
// option teaches it the extension — so resolve relative/absolute
|
|
115
|
+
// specifiers manually, appending .svelte when it isn't written.
|
|
116
|
+
if (specifier.startsWith('./') || specifier.startsWith('../') || isAbsolute(specifier)) {
|
|
117
|
+
const withExt = specifier.endsWith('.svelte') ? specifier : specifier + '.svelte';
|
|
118
|
+
const candidate = isAbsolute(withExt) ? withExt : resolvePath(dirname(fromFile), withExt);
|
|
119
|
+
// posixified for parity with ts.resolveModuleName, which always
|
|
120
|
+
// returns forward-slash paths
|
|
121
|
+
if (ts.sys.fileExists(candidate))
|
|
122
|
+
return toPosixPath(candidate);
|
|
113
123
|
}
|
|
114
124
|
return null;
|
|
115
125
|
};
|
package/dist/diagnostics.d.ts
CHANGED
|
@@ -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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
368
|
-
*
|
|
369
|
-
*
|
|
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
|
-
/**
|
|
384
|
-
|
|
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,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAEhF;;GAEG;AACH,eAAO,MAAM,2BAA2B;IAGvC,sCAAsC;;IAr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,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"}
|
package/dist/diagnostics.js
CHANGED
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
* @module
|
|
59
59
|
*/
|
|
60
60
|
import { z } from 'zod';
|
|
61
|
-
//
|
|
61
|
+
// Severity
|
|
62
62
|
/**
|
|
63
63
|
* Diagnostic severity levels.
|
|
64
64
|
*
|
|
@@ -66,7 +66,7 @@ import { z } from 'zod';
|
|
|
66
66
|
* - `'warning'` — partial success, something seems off but analysis continued
|
|
67
67
|
*/
|
|
68
68
|
export const DiagnosticSeverity = z.enum(['error', 'warning']);
|
|
69
|
-
//
|
|
69
|
+
// Kind
|
|
70
70
|
/**
|
|
71
71
|
* Discriminant for `Diagnostic` variant types.
|
|
72
72
|
*/
|
|
@@ -86,7 +86,7 @@ export const DiagnosticKind = z.enum([
|
|
|
86
86
|
'transform_failed',
|
|
87
87
|
'resolver_failed',
|
|
88
88
|
]);
|
|
89
|
-
//
|
|
89
|
+
// Variants
|
|
90
90
|
/**
|
|
91
91
|
* Base diagnostic fields shared by every variant.
|
|
92
92
|
*
|
|
@@ -205,19 +205,23 @@ export const DuplicateCommentDiagnostic = z.strictObject({
|
|
|
205
205
|
commentType: z.enum(['module_comment', 'doc_comment']),
|
|
206
206
|
});
|
|
207
207
|
/**
|
|
208
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
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
|
-
/**
|
|
237
|
-
|
|
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.
|
|
@@ -332,7 +339,7 @@ export const Diagnostic = z.discriminatedUnion('kind', [
|
|
|
332
339
|
TransformFailedDiagnostic,
|
|
333
340
|
ResolverFailedDiagnostic,
|
|
334
341
|
]);
|
|
335
|
-
//
|
|
342
|
+
// Helpers
|
|
336
343
|
/**
|
|
337
344
|
* Check if any error-severity diagnostics were collected.
|
|
338
345
|
*/
|
package/dist/exports.js
CHANGED
|
@@ -14,10 +14,10 @@ import { join, relative, resolve } from 'node:path';
|
|
|
14
14
|
import { glob } from 'tinyglobby';
|
|
15
15
|
import { toPosixPath } from './paths.js';
|
|
16
16
|
import { MAX_FILE_CONCURRENCY, map_concurrent } from './concurrency.js';
|
|
17
|
-
//
|
|
17
|
+
// Condition priority
|
|
18
18
|
/** Priority order for selecting the condition to use for source mapping. */
|
|
19
19
|
const CONDITION_PRIORITY = ['svelte', 'default', 'import', 'require'];
|
|
20
|
-
//
|
|
20
|
+
// Parsing
|
|
21
21
|
/**
|
|
22
22
|
* Read and parse the exports field from package.json.
|
|
23
23
|
*
|
|
@@ -85,7 +85,7 @@ const flattenConditions = (value, prefix) => {
|
|
|
85
85
|
}
|
|
86
86
|
return null;
|
|
87
87
|
};
|
|
88
|
-
//
|
|
88
|
+
// Source mapping
|
|
89
89
|
/**
|
|
90
90
|
* Map a dist file path to its source file path.
|
|
91
91
|
*
|
|
@@ -131,7 +131,7 @@ export const mapDistToSource = (distPath, condition, options) => {
|
|
|
131
131
|
}
|
|
132
132
|
return sourceBase;
|
|
133
133
|
};
|
|
134
|
-
//
|
|
134
|
+
// Discovery
|
|
135
135
|
/**
|
|
136
136
|
* Select the best condition for source mapping from an export entry.
|
|
137
137
|
*/
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAC,OAAO,EAAE,gBAAgB,EAAC,MAAM,cAAc,CAAC;AACvD,YAAY,EAAC,cAAc,EAAE,uBAAuB,EAAC,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAC,iBAAiB,EAAE,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AACvE,YAAY,EAAC,qBAAqB,EAAE,YAAY,EAAE,oBAAoB,EAAC,MAAM,mBAAmB,CAAC;AACjG,OAAO,EAAC,qBAAqB,EAAC,MAAM,cAAc,CAAC;AACnD,YAAY,EACX,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,aAAa,EACb,cAAc,EACd,YAAY,GACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,sBAAsB,EAAC,MAAM,mBAAmB,CAAC;AACzD,YAAY,EAAC,cAAc,EAAE,aAAa,EAAE,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAItF,OAAO,EACN,eAAe,EACf,mBAAmB,EACnB,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,UAAU,EACV,uBAAuB,EACvB,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,wBAAwB,EACxB,sBAAsB,EACtB,wBAAwB,EACxB,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,UAAU,GACV,MAAM,YAAY,CAAC;AAIpB,OAAO,EACN,cAAc,EACd,cAAc,EACd,eAAe,EACf,MAAM,EACN,kBAAkB,EAClB,0BAA0B,GAC1B,MAAM,0BAA0B,CAAC;AAIlC,YAAY,EAAC,cAAc,EAAE,YAAY,EAAC,MAAM,aAAa,CAAC;AAI9D,OAAO,EAAC,mBAAmB,EAAE,sBAAsB,EAAC,MAAM,oBAAoB,CAAC;AAC/E,YAAY,EAAC,mBAAmB,EAAE,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;AAInF,OAAO,EACN,cAAc,EACd,cAAc,EACd,uBAAuB,EACvB,oBAAoB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAC,oBAAoB,EAAE,aAAa,EAAE,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AAI9F,OAAO,EAAC,qBAAqB,EAAC,MAAM,YAAY,CAAC;AAIjD,OAAO,EAAC,mBAAmB,EAAC,MAAM,gBAAgB,CAAC;AACnD,YAAY,EACX,SAAS,EACT,0BAA0B,EAC1B,yBAAyB,GACzB,MAAM,gBAAgB,CAAC;AAIxB,OAAO,EACN,SAAS,EACT,WAAW,EACX,QAAQ,EACR,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,UAAU,GACV,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAC,WAAW,EAAC,MAAM,UAAU,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -7,24 +7,23 @@
|
|
|
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';
|
|
14
13
|
export { throwOnDuplicates, AnalyzeResultJson } from './analyze-core.js';
|
|
15
14
|
export { createAnalysisSession } from './session.js';
|
|
16
15
|
export { normalizeResolveImport } from './dep-resolver.js';
|
|
17
|
-
//
|
|
16
|
+
// Types (Zod schemas + TypeScript interfaces)
|
|
18
17
|
export { DeclarationKind, DeclarationModifier, MemberKind, Reactivity, GenericParamJson, ParameterJson, ComponentPropJson, OverloadJson, FunctionMemberJson, VariableMemberJson, ConstructorMemberJson, MemberJson, FunctionDeclarationJson, ClassDeclarationJson, InterfaceDeclarationJson, TypeDeclarationJson, VariableDeclarationJson, EnumDeclarationJson, ComponentDeclarationJson, SnippetDeclarationJson, NamespaceDeclarationJson, DeclarationJson, ReExportJson, ExternalReExportJson, ModuleJson, } from './types.js';
|
|
19
|
-
//
|
|
18
|
+
// Declaration helpers
|
|
20
19
|
export { getDisplayName, generateImport, compactReplacer, isKind, findTypeReferences, buildTypeReferencePatterns, } from './declaration-helpers.js';
|
|
21
|
-
//
|
|
20
|
+
// Source options
|
|
22
21
|
export { createSourceOptions, DEFAULT_SOURCE_OPTIONS } from './source-config.js';
|
|
23
|
-
//
|
|
22
|
+
// Post-processing
|
|
24
23
|
export { findDuplicates, mergeReExports, resolveComponentAliases, resolveExportSurface, } from './postprocess.js';
|
|
25
|
-
//
|
|
24
|
+
// File system constants
|
|
26
25
|
export { deriveIncludePatterns } from './files.js';
|
|
27
|
-
//
|
|
26
|
+
// File discovery
|
|
28
27
|
export { discoverSourceFiles } from './discovery.js';
|
|
29
|
-
//
|
|
28
|
+
// Diagnostics
|
|
30
29
|
export { hasErrors, hasWarnings, errorsOf, warningsOf, byKind, formatDiagnostic, DiagnosticSeverity, DiagnosticKind, Diagnostic, } from './diagnostics.js';
|
package/dist/postprocess.d.ts
CHANGED
|
@@ -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
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
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
|
-
*
|
|
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` (
|
|
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,eAA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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,CAAC,CAAA;CAAC,CAwD7D,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,GAAG,EAAE,aAAa,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,CAAC;IACtD,4EAA4E;IAC5E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,YAAY,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"}
|
package/dist/postprocess.js
CHANGED
|
@@ -133,18 +133,30 @@ export const findDuplicates = (modules) => {
|
|
|
133
133
|
return duplicates;
|
|
134
134
|
};
|
|
135
135
|
/**
|
|
136
|
-
*
|
|
136
|
+
* Case-insensitive string comparator for deterministic output ordering.
|
|
137
137
|
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
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) =>
|
|
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
|
-
*
|
|
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
|
};
|
package/dist/session.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAIN,KAAK,8BAA8B,EACnC,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,UAAU,CAAC;AAE1C,OAAO,EAEN,KAAK,aAAa,EAMlB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAChD,OAAO,EAAC,KAAK,mBAAmB,EAAmC,MAAM,oBAAoB,CAAC;AAG9F,OAAO,EAGN,iBAAiB,EACjB,KAAK,YAAY,EACjB,MAAM,mBAAmB,CAAC;AAG3B;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC9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;;;;GAcG;AACH,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CACnD,8BAA8B,EAC9B,aAAa,GAAG,cAAc,CAC9B;IACA;;;;;;;;;OASG;IACH,aAAa,EAAE,mBAAmB,CAAC;IACnC;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,kDAAkD;IAClD,GAAG,CAAC,EAAE,WAAW,CAAC;CAClB;AA+FD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,qBAAqB,GAAI,SAAS,sBAAsB,KAAG,eAsdvE,CAAC"}
|
package/dist/session.js
CHANGED
|
@@ -133,7 +133,7 @@ export const createAnalysisSession = (options) => {
|
|
|
133
133
|
return sessionDefaultResolver;
|
|
134
134
|
return getDefaultResolver();
|
|
135
135
|
};
|
|
136
|
-
//
|
|
136
|
+
// Phase 1: sync per-file transform/lex
|
|
137
137
|
// `resolver` is `null` when the entire batch is pre-resolved — phase 1
|
|
138
138
|
// needs no resolver identity in that case, and skipping `pickResolver`
|
|
139
139
|
// avoids constructing the lazy default for fully pre-resolved consumers.
|
|
@@ -231,7 +231,7 @@ export const createAnalysisSession = (options) => {
|
|
|
231
231
|
preResolvedDeps: usePreResolved ? preResolvedDeps : undefined,
|
|
232
232
|
};
|
|
233
233
|
};
|
|
234
|
-
//
|
|
234
|
+
// Phase 3: serial per-file LS push + entry write
|
|
235
235
|
const phase3 = (pending, resolved) => {
|
|
236
236
|
if (pending.cacheHit) {
|
|
237
237
|
// Cached SetFileResult: same diagnostics array reference, changed: false.
|
|
@@ -247,13 +247,16 @@ export const createAnalysisSession = (options) => {
|
|
|
247
247
|
// Build `unfilteredDeps` from one of two sources:
|
|
248
248
|
// pre-resolved → caller's `file.dependencies`, posixified + filtered
|
|
249
249
|
// lex+resolve → resolver task outputs, already posixified, filtered
|
|
250
|
-
|
|
250
|
+
// The Set dedupes in first-occurrence order — multiple statements
|
|
251
|
+
// importing the same module (or a duplicate caller-declared edge) are
|
|
252
|
+
// one edge.
|
|
253
|
+
const depSet = new Set();
|
|
251
254
|
if (pending.preResolvedDeps !== undefined) {
|
|
252
255
|
for (const raw of pending.preResolvedDeps) {
|
|
253
256
|
const posix = toPosixPath(raw);
|
|
254
257
|
if (!isSource(posix, sourceOptions))
|
|
255
258
|
continue;
|
|
256
|
-
|
|
259
|
+
depSet.add(posix);
|
|
257
260
|
}
|
|
258
261
|
}
|
|
259
262
|
else {
|
|
@@ -262,9 +265,10 @@ export const createAnalysisSession = (options) => {
|
|
|
262
265
|
continue;
|
|
263
266
|
if (!isSource(r, sourceOptions))
|
|
264
267
|
continue;
|
|
265
|
-
|
|
268
|
+
depSet.add(r);
|
|
266
269
|
}
|
|
267
270
|
}
|
|
271
|
+
const unfilteredDeps = [...depSet];
|
|
268
272
|
// Build a mode-specific entry. The discriminator (`mode`) tags which
|
|
269
273
|
// cache-key field to read on the next ingest: `resolverIdentity` for
|
|
270
274
|
// lex+resolve, `preResolvedDepsSnapshot` for pre-resolved. Snapshot
|
|
@@ -310,7 +314,7 @@ export const createAnalysisSession = (options) => {
|
|
|
310
314
|
}
|
|
311
315
|
return { changed: true, diagnostics: [...pending.ingestDiagnostics] };
|
|
312
316
|
};
|
|
313
|
-
//
|
|
317
|
+
// setFiles: orchestrate three phases
|
|
314
318
|
const setFiles = async (files, opts) => {
|
|
315
319
|
await ensureLexerReady();
|
|
316
320
|
// Resolver gating: pick one only if any file in the batch lacks
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"source-config.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/source-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,EAAC,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AO,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"}
|
package/dist/source-config.js
CHANGED
|
@@ -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
|
};
|
package/dist/svelte.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/svelte.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAC,QAAQ,EAAsB,MAAM,2BAA2B,CAAC;AAGxE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,KAAK,EAA2C,kBAAkB,EAAC,MAAM,YAAY,CAAC;AAC7F,OAAO,KAAK,EAGX,cAAc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AAM,wBAAwB,GAAI,cAAc,MAAM,KAAG,MAAM,GAAG,SA0BxE,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,GAAI,eAAe,MAAM,KAAG,MAAM,GAAG,SAU3E,CAAC;AAyPF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAAI,YAAY,MAAM,KAAG,OAExD,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,wBAAwB,GACpC,aAAa,EAAE,CAAC,IAAI,EACpB,SAAS,EAAE,CAAC,WAAW,KACrB,KAAK,CAAC,kBAAkB,CAqB1B,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,GAAI,YAAY,MAAM,KAAG,OAKxD,CAAC;AAEF;;;;;;GAMG;AACH,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
|
|
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
|
|
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)
|
|
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
|
-
//
|
|
331
|
+
// (`parseComment` filters module-level `@module` blocks)
|
|
331
332
|
if (ts.isVariableStatement(node) || ts.isVariableDeclaration(node)) {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
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
|
|
@@ -465,7 +464,7 @@ const extractPropsMetadata = (virtualSource) => {
|
|
|
465
464
|
visit(virtualSource);
|
|
466
465
|
return { bindableProps, propsDefaults, propsTypeName };
|
|
467
466
|
};
|
|
468
|
-
//
|
|
467
|
+
// Snippet Detection
|
|
469
468
|
/**
|
|
470
469
|
* Check if a type string represents a `Snippet` type.
|
|
471
470
|
*
|
|
@@ -536,7 +535,7 @@ export const synthesizeSnippetTypeSignature = (parameters) => {
|
|
|
536
535
|
const inner = parameters.map((p) => `${p.name}: ${p.type}`).join(', ');
|
|
537
536
|
return `Snippet<[${inner}]>`;
|
|
538
537
|
};
|
|
539
|
-
//
|
|
538
|
+
// Checker-Backed Analysis
|
|
540
539
|
/**
|
|
541
540
|
* Check if a symbol name is an internal svelte2tsx identifier.
|
|
542
541
|
*
|
|
@@ -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
|
*
|
package/dist/tsdoc.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsdoc.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/tsdoc.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tsdoc.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/tsdoc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,KAAK,EAAC,oBAAoB,EAAE,eAAe,EAAC,MAAM,wBAAwB,CAAC;AAElF;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IAClC,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oCAAoC;IACpC,MAAM,CAAC,EAAE,KAAK,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAC,CAAC,CAAC;IACrD,qCAAqC;IACrC,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACzB,8CAA8C;IAC9C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,sCAAsC;IACtC,OAAO,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACxB,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uFAAuF;IACvF,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,iEAAiE;IACjE,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB;AAgCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,YAAY,GACxB,MAAM,EAAE,CAAC,IAAI,EACb,YAAY,EAAE,CAAC,UAAU,KACvB,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
|
*
|
package/dist/types.js
CHANGED
|
@@ -304,7 +304,7 @@ const functionLikeFields = {
|
|
|
304
304
|
...callableFields,
|
|
305
305
|
...returnFields,
|
|
306
306
|
};
|
|
307
|
-
//
|
|
307
|
+
// MemberJson Variants
|
|
308
308
|
/**
|
|
309
309
|
* A function member (method, call signature, method signature).
|
|
310
310
|
* Has `parameters`, `returnType`, `returnDescription`, `overloads`.
|
|
@@ -380,7 +380,7 @@ export const ConstructorMemberJson = z.strictObject({
|
|
|
380
380
|
* Nesting is exactly one level deep — members never contain their own members.
|
|
381
381
|
*/
|
|
382
382
|
export const MemberJson = z.discriminatedUnion('kind', [FunctionMemberJson, VariableMemberJson, ConstructorMemberJson]);
|
|
383
|
-
//
|
|
383
|
+
// DeclarationJson Variants
|
|
384
384
|
/** Top-level-only fields shared by all `DeclarationJson` variants. */
|
|
385
385
|
const declarationTopLevelFields = {
|
|
386
386
|
/**
|
|
@@ -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,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B,CAAC;AAC5B,OAAO,EAAC,KAAK,cAAc,EAAuB,MAAM,yBAAyB,CAAC;AAMlF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,uBAAuB,GACnC,gBAAgB,cAAc,GAAG;IAAC,UAAU,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CAAC,EACrE,cAAc,EAAE,CAAC,UAAU,EAC3B,YAAY,MAAM,EAClB,SAAS,EAAE,CAAC,WAAW,EACvB,SAAS,mBAAmB,EAC5B,aAAa,KAAK,CAAC,UAAU,CAAC,KAC5B,cAyBF,CAAC;AA+QF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,cAAc,GAC1B,YAAY,EAAE,CAAC,UAAU,EACzB,SAAS,EAAE,CAAC,WAAW,EACvB,SAAS,mBAAmB,EAC5B,aAAa,KAAK,CAAC,UAAU,CAAC,KAC5B,qBA4UF,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB,GAC9B,QAAQ,EAAE,CAAC,MAAM,EACjB,YAAY,EAAE,CAAC,UAAU,EACzB,SAAS,EAAE,CAAC,WAAW,EACvB,aAAa,KAAK,CAAC,UAAU,CAAC,EAC9B,gBAAgB,cAAc,KAC5B,mBA+CF,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,oBAAoB,GAAI,YAAY,EAAE,CAAC,UAAU,KAAG,MAAM,GAAG,SAqCzE,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uBAAuB,GACnC,eAAe,MAAM,GAAG,SAAS,EACjC,MAAM,MAAM,EACZ,aAAa,KAAK,CAAC,UAAU,CAAC,KAC5B,IAUF,CAAC"}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* @module
|
|
13
13
|
*/
|
|
14
14
|
import ts from 'typescript';
|
|
15
|
-
import { parseComment, applyToDeclaration, cleanComment
|
|
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 —
|
|
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
|
-
|
|
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/dist/vite.js
CHANGED
|
@@ -71,7 +71,7 @@ const svelteDocinfo = (options = {}) => {
|
|
|
71
71
|
// runs at cold start). Tracked here because the session has no concept of
|
|
72
72
|
// "discovery" — it ingests files the plugin hands to it.
|
|
73
73
|
let discoveryDiagnostics = [];
|
|
74
|
-
//
|
|
74
|
+
// Resolver wiring
|
|
75
75
|
// Dev resolver: server.pluginContainer.resolveId. Stable identity across
|
|
76
76
|
// the dev session — cache hits work across HMR cycles.
|
|
77
77
|
const viteDevResolver = {
|
|
@@ -86,7 +86,7 @@ const svelteDocinfo = (options = {}) => {
|
|
|
86
86
|
},
|
|
87
87
|
identity: VITE_DEV_IDENTITY,
|
|
88
88
|
};
|
|
89
|
-
//
|
|
89
|
+
// In-flight analysis tracking
|
|
90
90
|
// Initial analysis runs once in buildStart; HMR flushes run on debounce.
|
|
91
91
|
// `load()` awaits both so we never serve stale JSON to a freshly-importing
|
|
92
92
|
// module.
|
|
@@ -182,7 +182,7 @@ const svelteDocinfo = (options = {}) => {
|
|
|
182
182
|
log.error(`[svelte-docinfo] ${message}`);
|
|
183
183
|
};
|
|
184
184
|
const isWatchedFile = (file) => isSource(file, resolvedSourceOptions);
|
|
185
|
-
//
|
|
185
|
+
// Initial analysis (cold start in buildStart)
|
|
186
186
|
const runInitialAnalysis = async () => {
|
|
187
187
|
if (!session)
|
|
188
188
|
return;
|
|
@@ -198,7 +198,7 @@ const svelteDocinfo = (options = {}) => {
|
|
|
198
198
|
const result = session.query({ onDuplicates, log: logger ?? undefined });
|
|
199
199
|
updateOutputFromQuery(result.modules, result.diagnostics);
|
|
200
200
|
};
|
|
201
|
-
//
|
|
201
|
+
// HMR flush: drain pendingChanges via setFiles + query
|
|
202
202
|
const flushBatch = async () => {
|
|
203
203
|
if (initialPromise)
|
|
204
204
|
await initialPromise;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-docinfo",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "static analysis for TypeScript and Svelte",
|
|
5
5
|
"glyph": "📜",
|
|
6
6
|
"logo": "logo.svg",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@fuzdev/blake3_wasm": "^0.1.1",
|
|
54
54
|
"@fuzdev/fuz_code": "^0.46.0",
|
|
55
55
|
"@fuzdev/fuz_css": "^0.62.0",
|
|
56
|
-
"@fuzdev/fuz_ui": "^0.
|
|
56
|
+
"@fuzdev/fuz_ui": "^0.203.1",
|
|
57
57
|
"@fuzdev/fuz_util": "^0.65.1",
|
|
58
58
|
"@fuzdev/gro": "^0.204.0",
|
|
59
59
|
"@ryanatkn/eslint-config": "^0.12.1",
|