svelte-docinfo 0.4.1 → 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.
- package/README.md +21 -12
- package/dist/analyze-core.d.ts +20 -13
- package/dist/analyze-core.d.ts.map +1 -1
- package/dist/analyze-core.js +40 -17
- package/dist/declaration-build.d.ts +16 -19
- package/dist/declaration-build.d.ts.map +1 -1
- package/dist/diagnostics.d.ts +20 -13
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/diagnostics.js +20 -13
- package/dist/index.d.ts +3 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -3
- package/dist/postprocess.d.ts +122 -28
- package/dist/postprocess.d.ts.map +1 -1
- package/dist/postprocess.js +293 -33
- 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 +61 -14
- package/dist/tsdoc.d.ts +10 -11
- package/dist/tsdoc.d.ts.map +1 -1
- package/dist/tsdoc.js +29 -14
- package/dist/types.d.ts +145 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +115 -1
- package/dist/typescript-exports.d.ts +17 -1
- package/dist/typescript-exports.d.ts.map +1 -1
- package/dist/typescript-exports.js +267 -163
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -5,17 +5,17 @@
|
|
|
5
5
|
> static analysis for TypeScript and Svelte 📜
|
|
6
6
|
> [**svelte-docinfo.fuz.dev**](https://svelte-docinfo.fuz.dev/)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
svelte-docinfo extracts JSON describing the exports
|
|
9
9
|
of TypeScript and Svelte modules for open-ended use cases
|
|
10
10
|
like docs, code search, and dev tools.
|
|
11
11
|
It uses
|
|
12
12
|
[svelte2tsx](https://github.com/sveltejs/language-tools/tree/master/packages/svelte2tsx)
|
|
13
|
-
and the TypeScript compiler API to resolve types, track exports, and extract semantic details.
|
|
13
|
+
and the TypeScript compiler API to resolve types, track exports+imports, and extract semantic details.
|
|
14
14
|
It includes a Vite plugin, CLI, and programmatic API
|
|
15
15
|
in the [npm package](https://www.npmjs.com/package/svelte-docinfo).
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
npm
|
|
18
|
+
npm i -D svelte-docinfo
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
- [Quick start](#quick-start)
|
|
@@ -27,11 +27,6 @@ npm install svelte-docinfo -D
|
|
|
27
27
|
- [Credits](#credits)
|
|
28
28
|
- [License](#license)
|
|
29
29
|
|
|
30
|
-
Dependencies are minimal and the tool's scope is limited to data, not presentation.
|
|
31
|
-
The [docs website](https://svelte-docinfo.fuz.dev/docs/api)
|
|
32
|
-
for svelte-docinfo is made using itself
|
|
33
|
-
and [fuz_ui](https://github.com/fuzdev/fuz_ui) components.
|
|
34
|
-
|
|
35
30
|
svelte-docinfo is largely inspired by [`sveld`](https://github.com/carbon-design-system/sveld),
|
|
36
31
|
but instead of AST-only inspection it uses the TypeScript compiler API for richer information,
|
|
37
32
|
and also analyzes TypeScript modules.
|
|
@@ -42,6 +37,11 @@ but you may find gaps and flaws -- please open issues for bugs
|
|
|
42
37
|
and [discussions](https://github.com/fuzdev/svelte-docinfo/discussions)
|
|
43
38
|
for everything else!
|
|
44
39
|
|
|
40
|
+
Dependencies are minimal and the tool's scope is limited to data, not presentation.
|
|
41
|
+
The [docs website](https://svelte-docinfo.fuz.dev/docs/api)
|
|
42
|
+
for svelte-docinfo is made using itself
|
|
43
|
+
and [fuz_ui](https://github.com/fuzdev/fuz_ui) components.
|
|
44
|
+
|
|
45
45
|
**AI disclosure:** the code and docs beyond the intro
|
|
46
46
|
were mostly written by Claude Code with uneven human guidance.
|
|
47
47
|
The first release took 5 months of intermittent work and ~500 manual commits.
|
|
@@ -174,7 +174,11 @@ All three produce the same JSON shape:
|
|
|
174
174
|
}
|
|
175
175
|
```
|
|
176
176
|
|
|
177
|
-
For
|
|
177
|
+
For examples of source input paired with the exact JSON `svelte-docinfo` emits:
|
|
178
|
+
|
|
179
|
+
- see svelte-docinfo's own source code's extracted JSON at
|
|
180
|
+
[svelte-docinfo.fuz.dev/demo/extraction](https://svelte-docinfo.fuz.dev/demo/extraction)
|
|
181
|
+
- browse the [test fixtures](https://github.com/fuzdev/svelte-docinfo/tree/main/src/test/fixtures)
|
|
178
182
|
|
|
179
183
|
## Vite plugin
|
|
180
184
|
|
|
@@ -314,14 +318,19 @@ See the [API docs](https://svelte-docinfo.fuz.dev/docs/api) for the full referen
|
|
|
314
318
|
- **Enums**: regular and const, with member values and per-member JSDoc
|
|
315
319
|
- **Function overloads**: all public overload signatures with per-overload JSDoc
|
|
316
320
|
- **Dependency graphs**: tracks imports between modules and computes dependents
|
|
317
|
-
- **Re-export tracking**: `alsoExportedFrom` arrays, `aliasOf` for renames, `starExports` for `export * from './x'`
|
|
321
|
+
- **Re-export tracking**: `alsoExportedFrom` arrays on canonical declarations plus the forward view `ModuleJson.reExports` (so barrels are self-describing), `aliasOf` for renames, `starExports` for `export * from './x'`, and `externalReExports`/`externalStarExports` for direct re-exports from packages — with `resolveExportSurface()` to combine them all into a module's full export surface using ES star semantics
|
|
318
322
|
- **Namespace re-exports**: `export * as ns from './x'` synthesized as `kind: 'namespace'`
|
|
319
323
|
- **Source locations**: file and line for every declaration
|
|
320
324
|
- **Build-tool agnostic**: works with any source: file system, build pipeline, or in-memory
|
|
321
325
|
- **Diagnostic collection**: accumulates warnings and errors without halting; `partial: true` flags incomplete declarations
|
|
322
326
|
|
|
323
|
-
Known gaps:
|
|
324
|
-
|
|
327
|
+
Known gaps:
|
|
328
|
+
|
|
329
|
+
- context tracking (transitive detection of common patterns seems tractable)
|
|
330
|
+
- standalone `namespace Foo {}` declarations and decorators are not yet supported
|
|
331
|
+
- Svelte 4 legacy features (slots, events, `$restProps`) are out of scope — Svelte 5 snippets and callback props replace most of them
|
|
332
|
+
|
|
333
|
+
[Issues](https://github.com/fuzdev/svelte-docinfo/issues) for bugs and
|
|
325
334
|
[discussions](https://github.com/fuzdev/svelte-docinfo/discussions) are welcome!
|
|
326
335
|
|
|
327
336
|
## Documentation
|
package/dist/analyze-core.d.ts
CHANGED
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
import ts from 'typescript';
|
|
29
29
|
import { z } from 'zod';
|
|
30
30
|
import { ModuleJson, type ModuleJsonInput } from './types.js';
|
|
31
|
-
import type { ReExportInfo } from './declaration-build.js';
|
|
32
31
|
import { Diagnostic } from './diagnostics.js';
|
|
33
32
|
import type { AnalysisLog } from './log.js';
|
|
34
33
|
import { type SvelteVirtualFile } from './svelte.js';
|
|
@@ -1145,6 +1144,20 @@ export declare const AnalyzeResultJson: z.ZodObject<{
|
|
|
1145
1144
|
dependencies: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1146
1145
|
dependents: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1147
1146
|
starExports: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1147
|
+
reExports: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1148
|
+
name: z.ZodString;
|
|
1149
|
+
module: z.ZodString;
|
|
1150
|
+
typeOnly: z.ZodDefault<z.ZodBoolean>;
|
|
1151
|
+
sourceLine: z.ZodOptional<z.ZodNumber>;
|
|
1152
|
+
}, z.core.$strict>>>;
|
|
1153
|
+
externalReExports: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1154
|
+
name: z.ZodString;
|
|
1155
|
+
specifier: z.ZodString;
|
|
1156
|
+
originalName: z.ZodOptional<z.ZodString>;
|
|
1157
|
+
typeOnly: z.ZodDefault<z.ZodBoolean>;
|
|
1158
|
+
sourceLine: z.ZodOptional<z.ZodNumber>;
|
|
1159
|
+
}, z.core.$strict>>>;
|
|
1160
|
+
externalStarExports: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1148
1161
|
partial: z.ZodDefault<z.ZodBoolean>;
|
|
1149
1162
|
}, z.core.$strict>>>;
|
|
1150
1163
|
diagnostics: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -1253,7 +1266,7 @@ export declare const AnalyzeResultJson: z.ZodObject<{
|
|
|
1253
1266
|
see: "see";
|
|
1254
1267
|
nodocs: "nodocs";
|
|
1255
1268
|
}>;
|
|
1256
|
-
functionName: z.ZodString
|
|
1269
|
+
functionName: z.ZodOptional<z.ZodString>;
|
|
1257
1270
|
file: z.ZodString;
|
|
1258
1271
|
line: z.ZodOptional<z.ZodNumber>;
|
|
1259
1272
|
column: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1347,16 +1360,6 @@ export interface AnalyzeResultJsonWire {
|
|
|
1347
1360
|
modules: Array<ModuleJsonInput>;
|
|
1348
1361
|
diagnostics: Array<Diagnostic>;
|
|
1349
1362
|
}
|
|
1350
|
-
/**
|
|
1351
|
-
* Result of analyzing a single module.
|
|
1352
|
-
*
|
|
1353
|
-
* `alsoExportedFrom` on declarations is always empty from this path —
|
|
1354
|
-
* cross-module re-export resolution requires all modules.
|
|
1355
|
-
*/
|
|
1356
|
-
export interface ModuleAnalyzeResult {
|
|
1357
|
-
module: ModuleJson;
|
|
1358
|
-
reExports: Array<ReExportInfo>;
|
|
1359
|
-
}
|
|
1360
1363
|
/**
|
|
1361
1364
|
* Analyze a single non-Svelte source file and extract module metadata.
|
|
1362
1365
|
*
|
|
@@ -1373,10 +1376,14 @@ export interface ModuleAnalyzeResult {
|
|
|
1373
1376
|
*
|
|
1374
1377
|
* Returns `undefined` when the file is skipped; the diagnostic is added to
|
|
1375
1378
|
* `diagnostics` so the caller can keep iterating.
|
|
1379
|
+
*
|
|
1380
|
+
* `alsoExportedFrom` on returned declarations is always empty from this path —
|
|
1381
|
+
* cross-module re-export resolution requires all modules (`mergeReExports`
|
|
1382
|
+
* consumes the returned module's `reExports` in phase 2).
|
|
1376
1383
|
*/
|
|
1377
1384
|
export declare const analyzeModule: (sourceFile: SourceFileInfo & {
|
|
1378
1385
|
dependents?: ReadonlyArray<string>;
|
|
1379
|
-
}, program: ts.Program, options: ModuleSourceOptions, diagnostics: Array<Diagnostic>, log?: AnalysisLog) =>
|
|
1386
|
+
}, program: ts.Program, options: ModuleSourceOptions, diagnostics: Array<Diagnostic>, log?: AnalysisLog) => ModuleJson | undefined;
|
|
1380
1387
|
/**
|
|
1381
1388
|
* Inputs to `analyzeCore`. The caller (one-shot wrapper or session.query)
|
|
1382
1389
|
* is responsible for normalizing `sourceOptions`, obtaining the program,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyze-core.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/analyze-core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAC,UAAU,EAAE,KAAK,eAAe,EAAC,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"analyze-core.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/analyze-core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAC,UAAU,EAAE,KAAK,eAAe,EAAC,MAAM,YAAY,CAAC;AAE5D,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,UAAU,CAAC;AAE1C,OAAO,EAAsB,KAAK,iBAAiB,EAAC,MAAM,aAAa,CAAC;AACxE,OAAO,EAAqB,KAAK,cAAc,EAAmB,MAAM,aAAa,CAAC;AACtF,OAAO,EAAC,KAAK,mBAAmB,EAAmC,MAAM,oBAAoB,CAAC;AAE9F,OAAO,EAMN,KAAK,oBAAoB,EACzB,MAAM,kBAAkB,CAAC;AA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F;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,iBAAiB;IACjC,WAAW,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;IAC3C,aAAa,EAAE,mBAAmB,CAAC;IACnC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC;IACpB,kBAAkB,EAAE,WAAW,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC3D,mEAAmE;IACnE,kBAAkB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACzC,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,GAAG,CAAC,EAAE,WAAW,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,WAAW,GAAI,QAAQ,iBAAiB,KAAG,iBA4FvD,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,wBAAwB,GACpC,aAAa,KAAK,CAAC,UAAU,CAAC,EAC9B,aAAa,MAAM,KACjB,IAgBF,CAAC"}
|
package/dist/analyze-core.js
CHANGED
|
@@ -34,7 +34,7 @@ import { analyzeSvelteModule } from './svelte.js';
|
|
|
34
34
|
import { stripVirtualSuffix, getComponentName } from './source.js';
|
|
35
35
|
import { extractPath, extractDependencies } from './source-config.js';
|
|
36
36
|
import { toPosixPath } from './paths.js';
|
|
37
|
-
import { sortModules, findDuplicates, mergeReExports, resolveComponentAliases, } from './postprocess.js';
|
|
37
|
+
import { sortModules, findDuplicates, mergeReExports, resolveComponentAliases, compareStrings, } from './postprocess.js';
|
|
38
38
|
/**
|
|
39
39
|
* Convenience `OnDuplicatesCallback` that throws on any duplicate.
|
|
40
40
|
*
|
|
@@ -121,17 +121,38 @@ export const AnalyzeResultJson = z.strictObject({
|
|
|
121
121
|
modules: z.array(ModuleJson).default([]),
|
|
122
122
|
diagnostics: z.array(Diagnostic).default([]),
|
|
123
123
|
});
|
|
124
|
-
const
|
|
124
|
+
const toModuleJson = (raw) => {
|
|
125
125
|
const filtered = raw.declarations.filter((d) => !d.nodocs).map((d) => d.declaration);
|
|
126
|
-
|
|
126
|
+
// sorted for deterministic, environment-independent output —
|
|
127
|
+
// getExportsOfModule order is a TS implementation detail. Module tie-break
|
|
128
|
+
// because names can collide: a Svelte default-slot re-export re-keys to
|
|
129
|
+
// the component name, which a same-name re-export from another module may
|
|
130
|
+
// also use. The same re-keying can produce exact-duplicate edges
|
|
131
|
+
// (component + same-name script-module export from one file) — deduped on
|
|
132
|
+
// `(name, module)` so those pairs stay unique; the sourceLine tie-break
|
|
133
|
+
// makes the dedup deterministic (smallest line survives)
|
|
134
|
+
const reExports = raw.reExports
|
|
135
|
+
.slice()
|
|
136
|
+
.sort((a, b) => compareStrings(a.name, b.name) ||
|
|
137
|
+
compareStrings(a.module, b.module) ||
|
|
138
|
+
(a.sourceLine ?? 0) - (b.sourceLine ?? 0))
|
|
139
|
+
.filter((r, i, arr) => i === 0 || r.name !== arr[i - 1].name || r.module !== arr[i - 1].module);
|
|
140
|
+
const externalReExports = raw.externalReExports
|
|
141
|
+
.slice()
|
|
142
|
+
.sort((a, b) => compareStrings(a.name, b.name) ||
|
|
143
|
+
compareStrings(a.specifier, b.specifier) ||
|
|
144
|
+
(a.sourceLine ?? 0) - (b.sourceLine ?? 0));
|
|
145
|
+
return ModuleJson.parse({
|
|
127
146
|
path: raw.path,
|
|
128
147
|
declarations: filtered,
|
|
129
148
|
dependencies: raw.dependencies,
|
|
130
149
|
dependents: raw.dependents,
|
|
131
150
|
starExports: raw.starExports,
|
|
151
|
+
reExports,
|
|
152
|
+
externalReExports,
|
|
153
|
+
externalStarExports: raw.externalStarExports,
|
|
132
154
|
...(raw.moduleComment ? { moduleComment: raw.moduleComment } : {}),
|
|
133
155
|
});
|
|
134
|
-
return { module, reExports: raw.reExports };
|
|
135
156
|
};
|
|
136
157
|
// ── Module dispatch ──────────────────────────────────────────────────────────
|
|
137
158
|
/**
|
|
@@ -150,6 +171,10 @@ const toModuleAnalyzeResult = (raw) => {
|
|
|
150
171
|
*
|
|
151
172
|
* Returns `undefined` when the file is skipped; the diagnostic is added to
|
|
152
173
|
* `diagnostics` so the caller can keep iterating.
|
|
174
|
+
*
|
|
175
|
+
* `alsoExportedFrom` on returned declarations is always empty from this path —
|
|
176
|
+
* cross-module re-export resolution requires all modules (`mergeReExports`
|
|
177
|
+
* consumes the returned module's `reExports` in phase 2).
|
|
153
178
|
*/
|
|
154
179
|
export const analyzeModule = (sourceFile, program, options, diagnostics, log) => {
|
|
155
180
|
const checker = program.getTypeChecker();
|
|
@@ -191,6 +216,8 @@ export const analyzeModule = (sourceFile, program, options, diagnostics, log) =>
|
|
|
191
216
|
dependents,
|
|
192
217
|
starExports: [],
|
|
193
218
|
reExports: [],
|
|
219
|
+
externalReExports: [],
|
|
220
|
+
externalStarExports: [],
|
|
194
221
|
};
|
|
195
222
|
}
|
|
196
223
|
else {
|
|
@@ -204,7 +231,7 @@ export const analyzeModule = (sourceFile, program, options, diagnostics, log) =>
|
|
|
204
231
|
log?.warn(`No analyzer for file: ${sourceFile.id}`);
|
|
205
232
|
return undefined;
|
|
206
233
|
}
|
|
207
|
-
return
|
|
234
|
+
return toModuleJson(raw);
|
|
208
235
|
};
|
|
209
236
|
/**
|
|
210
237
|
* Run the two-phase analysis loop on pre-prepared inputs.
|
|
@@ -228,8 +255,7 @@ export const analyzeCore = (inputs) => {
|
|
|
228
255
|
const checker = program.getTypeChecker();
|
|
229
256
|
const diagnostics = [];
|
|
230
257
|
const modules = [];
|
|
231
|
-
|
|
232
|
-
// Phase 1: analyze every module, collect re-exports
|
|
258
|
+
// Phase 1: analyze every module (forward re-export edges land on `ModuleJson.reExports`)
|
|
233
259
|
for (const sourceFile of sourceFiles) {
|
|
234
260
|
// Failed-transform Svelte file: synthesize placeholder ModuleJson so
|
|
235
261
|
// the modules array reflects the full owned set. The originating
|
|
@@ -250,30 +276,27 @@ export const analyzeCore = (inputs) => {
|
|
|
250
276
|
log?.warn(`Svelte component ${componentName} marked partial (transform failed at ingest)`);
|
|
251
277
|
continue;
|
|
252
278
|
}
|
|
253
|
-
let
|
|
279
|
+
let mod;
|
|
254
280
|
const virtualFile = svelteVirtualFiles.get(sourceFile.id);
|
|
255
281
|
if (virtualFile) {
|
|
256
282
|
const modulePath = extractPath(sourceFile.id, sourceOptions);
|
|
257
283
|
const raw = analyzeSvelteModule(sourceFile, modulePath, checker, sourceOptions, diagnostics, program, virtualFile);
|
|
258
284
|
if (raw) {
|
|
259
|
-
|
|
285
|
+
mod = toModuleJson(raw);
|
|
260
286
|
}
|
|
261
287
|
else {
|
|
262
288
|
log?.error(`Svelte module analysis failed: ${sourceFile.id}`);
|
|
263
289
|
}
|
|
264
290
|
}
|
|
265
291
|
else {
|
|
266
|
-
|
|
292
|
+
mod = analyzeModule(sourceFile, program, sourceOptions, diagnostics, log);
|
|
267
293
|
}
|
|
268
|
-
if (!
|
|
294
|
+
if (!mod)
|
|
269
295
|
continue;
|
|
270
|
-
modules.push(
|
|
271
|
-
for (const reExport of result.reExports) {
|
|
272
|
-
collectedReExports.push({ reExportingModule: result.module.path, reExport });
|
|
273
|
-
}
|
|
296
|
+
modules.push(mod);
|
|
274
297
|
}
|
|
275
|
-
// Phase 2a: build alsoExportedFrom arrays
|
|
276
|
-
mergeReExports(modules
|
|
298
|
+
// Phase 2a: build alsoExportedFrom arrays from the modules' forward edges
|
|
299
|
+
mergeReExports(modules);
|
|
277
300
|
// Phase 2b: fill component-only fields on renamed component aliases —
|
|
278
301
|
// canonical components are only fully populated after phase 1 finishes.
|
|
279
302
|
resolveComponentAliases(modules);
|
|
@@ -13,23 +13,7 @@
|
|
|
13
13
|
* @module
|
|
14
14
|
*/
|
|
15
15
|
import { z } from 'zod';
|
|
16
|
-
import type { DeclarationKind, DeclarationModifier, GenericParamJson, MemberKind, ParameterJson, OverloadJsonInput, ComponentPropJsonInput, Reactivity } from './types.js';
|
|
17
|
-
/**
|
|
18
|
-
* Information about a same-name re-export.
|
|
19
|
-
*
|
|
20
|
-
* Collected during phase 1 of analysis and passed to `mergeReExports`
|
|
21
|
-
* in phase 2 to build `alsoExportedFrom` arrays on canonical declarations.
|
|
22
|
-
*/
|
|
23
|
-
export interface ReExportInfo {
|
|
24
|
-
/**
|
|
25
|
-
* Name of the re-exported declaration. `'default'` for default-slot
|
|
26
|
-
* re-exports (`export {default} from './x'`) — that's the canonical's
|
|
27
|
-
* actual symbol name in the original module.
|
|
28
|
-
*/
|
|
29
|
-
name: string;
|
|
30
|
-
/** Module path (relative to `sourceRoot`) where the declaration is originally declared. */
|
|
31
|
-
originalModule: string;
|
|
32
|
-
}
|
|
16
|
+
import type { DeclarationKind, DeclarationModifier, GenericParamJson, MemberKind, ParameterJson, OverloadJsonInput, ComponentPropJsonInput, Reactivity, ReExportJsonInput, ExternalReExportJsonInput } from './types.js';
|
|
33
17
|
/**
|
|
34
18
|
* Permissive type for constructing members incrementally before Zod validation.
|
|
35
19
|
*
|
|
@@ -141,10 +125,23 @@ export interface ModuleExportsAnalysis {
|
|
|
141
125
|
moduleComment?: string;
|
|
142
126
|
/** All exported declarations with `@nodocs` flags — consumer filters based on policy. */
|
|
143
127
|
declarations: Array<DeclarationAnalysis>;
|
|
144
|
-
/**
|
|
145
|
-
|
|
128
|
+
/**
|
|
129
|
+
* Same-name re-exports. Published as `ModuleJson.reExports` and consumed
|
|
130
|
+
* by `mergeReExports` in phase 2 to build `alsoExportedFrom` arrays on
|
|
131
|
+
* canonical declarations. Unsorted here and may contain exact duplicates
|
|
132
|
+
* (Svelte default-slot re-keying) — ordering and dedup are applied at
|
|
133
|
+
* publication in `analyze-core.ts`.
|
|
134
|
+
*/
|
|
135
|
+
reExports: Array<ReExportJsonInput>;
|
|
146
136
|
/** Star exports (`export * from './module'`) — module paths that are fully re-exported. */
|
|
147
137
|
starExports: Array<string>;
|
|
138
|
+
/**
|
|
139
|
+
* Direct re-exports from external packages. Published as
|
|
140
|
+
* `ModuleJson.externalReExports`; unsorted here, sorted at publication.
|
|
141
|
+
*/
|
|
142
|
+
externalReExports: Array<ExternalReExportJsonInput>;
|
|
143
|
+
/** External star exports (`export * from 'pkg'`) — specifiers as written. */
|
|
144
|
+
externalStarExports: Array<string>;
|
|
148
145
|
}
|
|
149
146
|
/**
|
|
150
147
|
* Result of analyzing a module (TypeScript or Svelte).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declaration-build.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/declaration-build.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,KAAK,EACX,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,sBAAsB,EACtB,UAAU,EACV,
|
|
1
|
+
{"version":3,"file":"declaration-build.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/declaration-build.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,KAAK,EACX,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,sBAAsB,EACtB,UAAU,EACV,iBAAiB,EACjB,yBAAyB,EACzB,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;GAUG;AACH,MAAM,WAAW,eAAe;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,UAAU,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACxC,UAAU,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CA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AIG;AACH,MAAM,WAAW,qBAAqB;IACrC,0CAA0C;IAC1C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,yFAAyF;IACzF,YAAY,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACzC;;;;;;OAMG;IACH,SAAS,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACpC,2FAA2F;IAC3F,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3B;;;OAGG;IACH,iBAAiB,EAAE,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACpD,6EAA6E;IAC7E,mBAAmB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACnC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,cAAe,SAAQ,qBAAqB;IAC5D,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5B,gFAAgF;IAChF,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAC1B"}
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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
|
|
|
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.
|
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';
|
|
@@ -17,13 +16,13 @@ export { createAnalysisSession } from './session.js';
|
|
|
17
16
|
export type { AnalysisSession, AnalysisSessionOptions, SetFileOptions, SetFileResult, SetFilesResult, QueryOptions, } from './session.js';
|
|
18
17
|
export { normalizeResolveImport } from './dep-resolver.js';
|
|
19
18
|
export type { ImportResolver, ResolveImport, ResolveImportFn } from './dep-resolver.js';
|
|
20
|
-
export { DeclarationKind, DeclarationModifier, MemberKind, Reactivity, GenericParamJson, ParameterJson, ComponentPropJson, OverloadJson, FunctionMemberJson, VariableMemberJson, ConstructorMemberJson, MemberJson, FunctionDeclarationJson, ClassDeclarationJson, InterfaceDeclarationJson, TypeDeclarationJson, VariableDeclarationJson, EnumDeclarationJson, ComponentDeclarationJson, SnippetDeclarationJson, NamespaceDeclarationJson, DeclarationJson, ModuleJson, } from './types.js';
|
|
19
|
+
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';
|
|
21
20
|
export { getDisplayName, generateImport, compactReplacer, isKind, findTypeReferences, buildTypeReferencePatterns, } from './declaration-helpers.js';
|
|
22
21
|
export type { SourceFileInfo, AnalyzerType } from './source.js';
|
|
23
22
|
export { createSourceOptions, DEFAULT_SOURCE_OPTIONS } from './source-config.js';
|
|
24
23
|
export type { ModuleSourceOptions, SourceOptionsDefaults } from './source-config.js';
|
|
25
|
-
export { findDuplicates, mergeReExports, resolveComponentAliases } from './postprocess.js';
|
|
26
|
-
export type { DuplicateDeclaration,
|
|
24
|
+
export { findDuplicates, mergeReExports, resolveComponentAliases, resolveExportSurface, } from './postprocess.js';
|
|
25
|
+
export type { DuplicateDeclaration, ExportSurface, ExportSurfaceEntry } from './postprocess.js';
|
|
27
26
|
export { deriveIncludePatterns } from './files.js';
|
|
28
27
|
export { discoverSourceFiles } from './discovery.js';
|
|
29
28
|
export type { Discovery, DiscoverSourceFilesOptions, DiscoverSourceFilesResult, } from './discovery.js';
|
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,c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C1B,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,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';
|
|
@@ -15,13 +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
|
-
export { DeclarationKind, DeclarationModifier, MemberKind, Reactivity, GenericParamJson, ParameterJson, ComponentPropJson, OverloadJson, FunctionMemberJson, VariableMemberJson, ConstructorMemberJson, MemberJson, FunctionDeclarationJson, ClassDeclarationJson, InterfaceDeclarationJson, TypeDeclarationJson, VariableDeclarationJson, EnumDeclarationJson, ComponentDeclarationJson, SnippetDeclarationJson, NamespaceDeclarationJson, DeclarationJson, ModuleJson, } from './types.js';
|
|
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
|
-
export { findDuplicates, mergeReExports, resolveComponentAliases } from './postprocess.js';
|
|
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 ──────────────────────────────────────────────────────────
|