svelte-docinfo 0.14.0 → 0.16.0
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 +24 -176
- package/dist/analyze-core.d.ts +10 -5
- package/dist/analyze-core.d.ts.map +1 -1
- package/dist/analyze-core.js +106 -52
- package/dist/declaration-build.d.ts +2 -1
- package/dist/declaration-build.d.ts.map +1 -1
- package/dist/declaration-helpers.d.ts +2 -1
- package/dist/declaration-helpers.d.ts.map +1 -1
- package/dist/declaration-helpers.js +12 -4
- package/dist/dep-resolver.d.ts +5 -1
- package/dist/dep-resolver.d.ts.map +1 -1
- package/dist/dep-resolver.js +6 -2
- package/dist/diagnostics.d.ts +185 -9
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/diagnostics.js +144 -9
- package/dist/exports.d.ts.map +1 -1
- package/dist/exports.js +51 -21
- package/dist/files.d.ts +6 -3
- package/dist/files.d.ts.map +1 -1
- package/dist/files.js +7 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/postprocess.d.ts.map +1 -1
- package/dist/postprocess.js +1 -0
- package/dist/session.js +3 -3
- package/dist/source-config.d.ts +1 -1
- package/dist/source-config.js +1 -1
- package/dist/source.d.ts +8 -4
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +14 -5
- package/dist/svelte-css.d.ts +153 -0
- package/dist/svelte-css.d.ts.map +1 -0
- package/dist/svelte-css.js +501 -0
- package/dist/svelte-scripts.d.ts +37 -0
- package/dist/svelte-scripts.d.ts.map +1 -1
- package/dist/svelte-scripts.js +38 -5
- package/dist/svelte.d.ts +13 -2
- package/dist/svelte.d.ts.map +1 -1
- package/dist/svelte.js +159 -55
- package/dist/tsdoc.d.ts +121 -5
- package/dist/tsdoc.d.ts.map +1 -1
- package/dist/tsdoc.js +452 -29
- package/dist/types.d.ts +112 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +107 -6
- package/dist/typescript-alias-registry.d.ts +4 -2
- package/dist/typescript-alias-registry.d.ts.map +1 -1
- package/dist/typescript-alias-registry.js +11 -7
- package/dist/typescript-exports.d.ts +8 -4
- package/dist/typescript-exports.d.ts.map +1 -1
- package/dist/typescript-exports.js +108 -10
- package/dist/typescript-extract-class.d.ts +6 -0
- package/dist/typescript-extract-class.d.ts.map +1 -1
- package/dist/typescript-extract-class.js +293 -26
- package/dist/typescript-extract-function.d.ts +1 -1
- package/dist/typescript-extract-function.d.ts.map +1 -1
- package/dist/typescript-extract-function.js +23 -13
- package/dist/typescript-extract-shared.d.ts +69 -8
- package/dist/typescript-extract-shared.d.ts.map +1 -1
- package/dist/typescript-extract-shared.js +405 -107
- package/dist/typescript-extract-type-json.d.ts +61 -2
- package/dist/typescript-extract-type-json.d.ts.map +1 -1
- package/dist/typescript-extract-type-json.js +75 -7
- package/dist/typescript-extract-type-properties.d.ts +8 -1
- package/dist/typescript-extract-type-properties.d.ts.map +1 -1
- package/dist/typescript-extract-type-properties.js +18 -9
- package/dist/typescript-extract-type.d.ts +6 -0
- package/dist/typescript-extract-type.d.ts.map +1 -1
- package/dist/typescript-extract-type.js +79 -14
- package/dist/typescript-program.d.ts +9 -1
- package/dist/typescript-program.d.ts.map +1 -1
- package/dist/typescript-program.js +22 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,9 +22,6 @@ Peer dependencies: `svelte` 5+, `svelte2tsx`, and `typescript` 5.9+ or 6,
|
|
|
22
22
|
plus an optional `vite` 6+ for the Vite plugin.
|
|
23
23
|
|
|
24
24
|
- [Quick start](#quick-start)
|
|
25
|
-
- [Vite plugin](#vite-plugin)
|
|
26
|
-
- [CLI](#cli)
|
|
27
|
-
- [API](#api)
|
|
28
25
|
- [Features](#features)
|
|
29
26
|
- [Documentation](#documentation)
|
|
30
27
|
- [Credits](#credits)
|
|
@@ -64,7 +61,9 @@ Given a project with a `tsconfig.json` (at or above the project root) and two fi
|
|
|
64
61
|
* @param b - second number
|
|
65
62
|
* @returns the sum
|
|
66
63
|
*/
|
|
67
|
-
export
|
|
64
|
+
export function add(a: number, b: number): number {
|
|
65
|
+
return a + b;
|
|
66
|
+
}
|
|
68
67
|
```
|
|
69
68
|
|
|
70
69
|
and `src/lib/Calculator.svelte`:
|
|
@@ -90,9 +89,9 @@ and `src/lib/Calculator.svelte`:
|
|
|
90
89
|
</script>
|
|
91
90
|
```
|
|
92
91
|
|
|
93
|
-
Three ways to
|
|
92
|
+
Three ways to use it:
|
|
94
93
|
|
|
95
|
-
1. [Vite plugin](
|
|
94
|
+
1. [Vite plugin](https://svelte-docinfo.fuz.dev/docs/vite-plugin) - for SvelteKit and Vite projects, a virtual module that stays current in dev:
|
|
96
95
|
|
|
97
96
|
```ts
|
|
98
97
|
// vite.config.ts
|
|
@@ -105,13 +104,13 @@ export default defineConfig({ plugins: [sveltekit(), svelteDocinfo()] });
|
|
|
105
104
|
// import {modules} from 'virtual:svelte-docinfo';
|
|
106
105
|
```
|
|
107
106
|
|
|
108
|
-
2. [CLI](
|
|
107
|
+
2. [CLI](https://svelte-docinfo.fuz.dev/docs/cli) - for inspecting a project, writing a JSON file, and shell pipelines:
|
|
109
108
|
|
|
110
109
|
```bash
|
|
111
110
|
npx svelte-docinfo --pretty
|
|
112
111
|
```
|
|
113
112
|
|
|
114
|
-
3. [API](
|
|
113
|
+
3. [JS API](https://svelte-docinfo.fuz.dev/docs/js-api) - for scripts and build tools, with `analyze` for contents you already have and `createAnalysisSession` for incremental re-analysis:
|
|
115
114
|
|
|
116
115
|
```ts
|
|
117
116
|
import { analyzeFromFiles } from 'svelte-docinfo';
|
|
@@ -119,6 +118,10 @@ import { analyzeFromFiles } from 'svelte-docinfo';
|
|
|
119
118
|
const { modules } = await analyzeFromFiles({ projectRoot: process.cwd() });
|
|
120
119
|
```
|
|
121
120
|
|
|
121
|
+
By default all three document the source files your `package.json` `exports` point to,
|
|
122
|
+
falling back to everything under `src/lib`
|
|
123
|
+
(see [source files](https://svelte-docinfo.fuz.dev/docs/source-files)).
|
|
124
|
+
|
|
122
125
|
All three produce the same `AnalyzeResultJson` data. The CLI emits it compacted, as shown
|
|
123
126
|
here (the Vite module compacts `modules` only); the API returns it with defaults filled in:
|
|
124
127
|
|
|
@@ -199,6 +202,9 @@ import { parseAnalyzeResult } from 'svelte-docinfo';
|
|
|
199
202
|
const { modules, diagnostics } = parseAnalyzeResult(JSON.parse(json));
|
|
200
203
|
```
|
|
201
204
|
|
|
205
|
+
`parseAnalyzeResult` loads the TypeScript compiler, so in browser code use
|
|
206
|
+
`parseModuleJson` from `svelte-docinfo/types.js` per module instead.
|
|
207
|
+
|
|
202
208
|
The parse helpers are the stable entry point. The schemas behind them (`AnalyzeResultJson`,
|
|
203
209
|
`ModuleJson`, `DeclarationJson`, …) are exported too, as [valibot](https://valibot.dev/) schemas.
|
|
204
210
|
|
|
@@ -206,185 +212,27 @@ The [extraction demo](https://svelte-docinfo.fuz.dev/demo/extraction) has more e
|
|
|
206
212
|
and see the docs for the complete [output format](https://svelte-docinfo.fuz.dev/docs/output-format).
|
|
207
213
|
You may also want to browse the [test fixtures](https://github.com/fuzdev/svelte-docinfo/tree/main/src/test/fixtures).
|
|
208
214
|
|
|
209
|
-
## Vite plugin
|
|
210
|
-
|
|
211
|
-
Requires Vite 6 or later.
|
|
212
|
-
|
|
213
|
-
1. Add the plugin to `vite.config.ts`:
|
|
214
|
-
|
|
215
|
-
```ts
|
|
216
|
-
import { defineConfig } from 'vite';
|
|
217
|
-
import { sveltekit } from '@sveltejs/kit/vite';
|
|
218
|
-
import svelteDocinfo from 'svelte-docinfo/vite.js';
|
|
219
|
-
|
|
220
|
-
export default defineConfig({
|
|
221
|
-
plugins: [sveltekit(), svelteDocinfo()]
|
|
222
|
-
});
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
2. Add TypeScript support in `app.d.ts`:
|
|
226
|
-
|
|
227
|
-
```ts
|
|
228
|
-
/// <reference types="svelte-docinfo/virtual-svelte-docinfo.js" />
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
3. Import the virtual module anywhere in your app:
|
|
232
|
-
|
|
233
|
-
```ts
|
|
234
|
-
import { modules, diagnostics } from 'virtual:svelte-docinfo';
|
|
235
|
-
// or: import data from 'virtual:svelte-docinfo';
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
Plugin options:
|
|
239
|
-
|
|
240
|
-
| Option | Default | Description |
|
|
241
|
-
| --------------------- | ---------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
242
|
-
| `projectRoot` | Vite's resolved `config.root` | Absolute path to project root. |
|
|
243
|
-
| `include` | — | Glob patterns to include (relative to `projectRoot`; absolute inside it accepted). Collapses `discovery: 'auto'` to glob; combining with `discovery: 'exports'` throws. Widens the source scope — see the notes below. |
|
|
244
|
-
| `exclude` | `['**/*.test.ts', '**/*.spec.ts', '**/internal/**']` | Glob patterns to exclude. An array fully replaces the defaults; the callback form extends them (`(defaults) => [...defaults, '**/*.gen.ts']`). The always-on baseline below still applies. |
|
|
245
|
-
| `discovery` | `'auto'` | Discovery strategy: `'auto'` \| `'exports'` \| `'glob'`. `'exports'` is strict and fails if `package.json` exports is missing or resolves to no files. |
|
|
246
|
-
| `distDir` | `'dist'` | Dist directory name for exports-based discovery. |
|
|
247
|
-
| `sourceOptions` | `{sourcePaths: ['src/lib'], …}` | Partial overrides for default source options (SvelteKit `src/lib` layout). |
|
|
248
|
-
| `resolveDependencies` | `true` | Resolve import dependencies. When `false`, `dependencies`/`dependents` stay empty. |
|
|
249
|
-
| `hmrDebounceMs` | `100` | Dev re-analysis debounce delay in milliseconds. |
|
|
250
|
-
| `onDuplicates` | — | Opt-in check that names are unique across modules, for packages with a flat export namespace: `'diagnostic'` \| `'warn'` \| `'throw'`. Off by default. |
|
|
251
|
-
| `tsconfig` | `'tsconfig.json'` | Path to the tsconfig, relative to `projectRoot` and searched upward from it, or `false` to analyze without one (built-in strict options, with `compilerOptions` merged on top). |
|
|
252
|
-
| `compilerOptions` | — | Compiler options merged over the tsconfig's, per key. |
|
|
253
|
-
| `rootFileNames` | the tsconfig's roots | The program's root files in place of the tsconfig's: a list, or a function over the tsconfig's roots (`declarationFileRoots`, from `svelte-docinfo/typescript-program.js`, keeps the declaration files). Narrowing speeds up cold analysis; an ambient type declared in a dropped root resolves to `any`. |
|
|
254
|
-
|
|
255
|
-
Source-scope notes (shared with the [CLI](#cli) and `analyzeFromFiles`):
|
|
256
|
-
|
|
257
|
-
- `include` **widens the source scope**: each pattern's static base joins `sourceOptions.sourcePaths`, so the files it finds emit modules (with paths relative to the widened set's common root) and the dev watcher tracks them. A pattern with no base (`'**/*.ts'`, a literal root file) makes the whole project root source and logs an info line.
|
|
258
|
-
- Beneath any `exclude`, `node_modules` and dot-directories below a source path are never source. The rule is relative to the source path, so an explicit dot-directory source path (`sourcePaths: ['.hidden/src']`) still works. `dist`, `build`, and `coverage` are ordinary names.
|
|
259
|
-
- **`src/lib/internal/`** holds modules that ship for public modules to import but aren't documented, excluded by the default `**/internal/**` pattern. Packages typically block consumer imports with an `"./internal/*": null` exports entry, which exports discovery honors with Node's best-match semantics. Internal modules stay live in dev: editing one re-analyzes the public modules that use it. A public re-export of an internal symbol documents as a full declaration at the re-export site. To document them anyway: `exclude: (defaults) => defaults.filter((p) => p !== '**/internal/**')`.
|
|
260
|
-
- Paths and patterns resolve against `projectRoot`. Absolute entries inside the root are accepted, and anything outside it **throws** at options creation instead of silently emitting nothing. `'/src/lib'` is filesystem-absolute, not shorthand for `'src/lib'`.
|
|
261
|
-
|
|
262
|
-
The options interface is `VitePluginSvelteDocinfoOptions` from `svelte-docinfo/vite.js` (not re-exported from the main barrel).
|
|
263
|
-
See the [Vite plugin docs](https://svelte-docinfo.fuz.dev/docs/vite-plugin) and [examples/vite/](examples/vite/README.md) for more.
|
|
264
|
-
|
|
265
|
-
> If TypeScript reports `Cannot find module 'virtual:svelte-docinfo'`, ensure the `/// <reference>` line is in your `app.d.ts`.
|
|
266
|
-
|
|
267
|
-
## CLI
|
|
268
|
-
|
|
269
|
-
```bash
|
|
270
|
-
npx svelte-docinfo # analyze cwd, print JSON to stdout
|
|
271
|
-
npx svelte-docinfo -o output.json # write to a file instead
|
|
272
|
-
npx svelte-docinfo ./packages/my-lib # analyze a specific directory
|
|
273
|
-
npx svelte-docinfo --pretty # pretty-print the JSON output
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
Output is compact JSON by default. Use `--pretty` for readable output,
|
|
277
|
-
or pipe through `jq` for queries:
|
|
278
|
-
|
|
279
|
-
```bash
|
|
280
|
-
npx svelte-docinfo | jq '.modules | length' # count modules
|
|
281
|
-
npx svelte-docinfo | jq -r '.modules[].declarations[].name' # list all exported names
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
Info messages print to stderr; only JSON goes to stdout. The terminal interleaves
|
|
285
|
-
them visually, but `>` and `|` capture clean JSON. Use `-q`/`--quiet` to suppress info on
|
|
286
|
-
stderr (warnings and errors still print).
|
|
287
|
-
|
|
288
|
-
All CLI options:
|
|
289
|
-
|
|
290
|
-
| Flag | Description |
|
|
291
|
-
| --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
292
|
-
| `[project-root]` | Project root directory (default: cwd) |
|
|
293
|
-
| `-i, --include <pattern>` | Include pattern (repeatable, replaces exports discovery, widens the source scope; incompatible with `--discovery exports`) |
|
|
294
|
-
| `-e, --exclude <pattern>` | Exclude glob, applied at discovery and analysis (repeatable; fully replaces the defaults `**/*.test.ts`, `**/*.spec.ts`, `**/internal/**` — no merge; the always-on baseline applies beneath) |
|
|
295
|
-
| `-o, --output <file>` | Output file (default: stdout; pass `-` for explicit stdout, so `-o "$OUT"` works when `$OUT=-`) |
|
|
296
|
-
| `--discovery <mode>` | `auto` \| `exports` \| `glob` (default: `auto` — exports first, glob fallback). `exports` is strict and fails if package.json exports is missing or resolves to no files |
|
|
297
|
-
| `--dist-dir <dir>` | Dist directory for exports discovery (default: dist) |
|
|
298
|
-
| `--source-dir <dir>` | Source directory, relative to project root or absolute inside it (default: src/lib). Repeatable for monorepos; drives the implicit include glob when no `--include` is provided |
|
|
299
|
-
| `--source-root <dir>` | Source root for module-path stripping (default: single source-dir or longest common prefix; pass `.` for project-relative paths) |
|
|
300
|
-
| `--only <pattern>` | Glob filter applied to module paths in output (repeatable). Full project is still analyzed (re-exports/dependents stay correct); diagnostics aren't filtered |
|
|
301
|
-
| `--no-resolve-dependencies` | Disable dependency resolution |
|
|
302
|
-
| `--pretty` | Pretty-print JSON output (default: compact) |
|
|
303
|
-
| `--tsconfig <path>` | Path to the tsconfig, relative to project root and searched upward from it (default: `tsconfig.json`) |
|
|
304
|
-
| `--no-tsconfig` | Analyze without a tsconfig, using built-in strict compiler options |
|
|
305
|
-
| `-q, --quiet` | Suppress info messages on stderr (warnings and errors still print) |
|
|
306
|
-
| `--on-duplicates <mode>` | Opt-in check that names are unique across modules, for packages with a flat export namespace: `diagnostic` \| `warn` \| `throw` (default: off) |
|
|
307
|
-
| `-V, --version` | Show version number |
|
|
308
|
-
| `-h, --help` | Show help |
|
|
309
|
-
|
|
310
|
-
The [Vite plugin](#vite-plugin)'s source-scope notes apply here too, with `--include`, `--exclude`, and `--source-dir` in place of the options. `--exclude` always replaces the defaults (there's no callback form), so to document `internal/`, re-list the others: `-e '**/*.test.ts' -e '**/*.spec.ts'`.
|
|
311
|
-
|
|
312
|
-
Exit codes: 0 (success), 1 (analysis errors), 2 (a usage error, like an unknown flag or a
|
|
313
|
-
missing or invalid option value, or a thrown analysis error, like a missing or unloadable
|
|
314
|
-
`tsconfig.json`).
|
|
315
|
-
|
|
316
|
-
See the [CLI docs](https://svelte-docinfo.fuz.dev/docs/cli) and [examples/cli/](examples/cli/README.md) for more.
|
|
317
|
-
|
|
318
|
-
## API
|
|
319
|
-
|
|
320
|
-
Three entry points, same `AnalyzeResultJson` shape (`{modules, diagnostics}`):
|
|
321
|
-
|
|
322
|
-
| Function | Use when |
|
|
323
|
-
| ----------------------- | ------------------------------------------------------------------------------------------------- |
|
|
324
|
-
| `analyzeFromFiles` | One-shot. Standalone projects — handles file discovery and dependency resolution |
|
|
325
|
-
| `analyze` | One-shot. Build-tool integration — you supply `SourceFileInfo[]` already in memory |
|
|
326
|
-
| `createAnalysisSession` | Incremental. Long-lived consumers (Vite plugin, LSP-style tools) reusing parsed ASTs across calls |
|
|
327
|
-
|
|
328
|
-
For most projects, `analyzeFromFiles` is all you need. It reads your `package.json` exports
|
|
329
|
-
to discover source files, falling back to glob patterns:
|
|
330
|
-
|
|
331
|
-
```ts
|
|
332
|
-
import { analyzeFromFiles } from 'svelte-docinfo';
|
|
333
|
-
|
|
334
|
-
const { modules } = await analyzeFromFiles({ projectRoot: process.cwd() });
|
|
335
|
-
```
|
|
336
|
-
|
|
337
|
-
Pass `include` for custom patterns or `discovery: 'glob'` to always use glob.
|
|
338
|
-
Use `discovery: 'exports'` for strict mode that throws if `package.json` has no usable `exports` field.
|
|
339
|
-
When you already have file contents in memory,
|
|
340
|
-
use `analyze` instead of `analyzeFromFiles` to skip file discovery.
|
|
341
|
-
For just the discovery step (without running analysis), use
|
|
342
|
-
`discoverSourceFiles` (also in the main `svelte-docinfo` import).
|
|
343
|
-
|
|
344
|
-
For long-lived consumers (a Vite plugin reacting to file edits, an LSP-style tool),
|
|
345
|
-
`createAnalysisSession` returns a persistent handle that reuses parsed ASTs across calls
|
|
346
|
-
— see the [session docs](https://svelte-docinfo.fuz.dev/docs/session) and
|
|
347
|
-
[examples/api/analyze-session.js](examples/api/analyze-session.js).
|
|
348
|
-
|
|
349
|
-
See [examples/api/](examples/api/README.md) for more patterns
|
|
350
|
-
including custom discovery, diagnostics, sessions, and error handling.
|
|
351
|
-
|
|
352
|
-
Import from `svelte-docinfo` for the common API,
|
|
353
|
-
or from subpaths like `svelte-docinfo/typescript-exports.js` for lower-level access.
|
|
354
|
-
See the [API docs](https://svelte-docinfo.fuz.dev/docs/api) for the full reference.
|
|
355
|
-
|
|
356
215
|
## Features
|
|
357
216
|
|
|
358
217
|
- **Full type resolution**: generics, imported types, and inferred return types, without manual annotations
|
|
359
|
-
- **
|
|
360
|
-
- **
|
|
361
|
-
- **
|
|
362
|
-
- **
|
|
363
|
-
- **
|
|
364
|
-
- **
|
|
365
|
-
- **
|
|
366
|
-
- **Runes**: `$state`, `$state.raw`, `$derived`, and `$derived.by` on variables and class fields (`reactivity`), detected syntactically in any file
|
|
367
|
-
- **Classes, enums, and overloads**: public and protected class members (`private` and `#` excluded), regular and const enums with member values, and every public overload signature with its own JSDoc
|
|
368
|
-
- **Re-exports**: `alsoExportedFrom` on canonical declarations and `ModuleJson.reExports` on barrels, `aliasOf` for renames, `starExports`, `kind: 'namespace'` for `export * as ns`, and external re-exports, with `resolveExportSurface()` combining them using ES star semantics
|
|
369
|
-
- **Dependency graphs**: imports between modules and the computed dependents
|
|
370
|
-
- **Source locations**: the source line of every declaration
|
|
218
|
+
- **[TSDoc and JSDoc tags](https://svelte-docinfo.fuz.dev/docs/tags)**, plus the custom `@nodocs` (leave out of docs) and `@mutates`
|
|
219
|
+
- **[Structured types](https://svelte-docinfo.fuz.dev/docs/structured-types)**: `typeInfo` trees beside the flat type strings, recovering alias names TypeScript drops (`z.infer`, `v.InferOutput`)
|
|
220
|
+
- **Svelte 5 components**: props with types, defaults, and bindability, snippet and callback parameters, generics, children, exported snippets, and runes in any file
|
|
221
|
+
- **[Component styling](https://svelte-docinfo.fuz.dev/docs/component-styling)**: the CSS custom properties a component's styles read, plus those documented with `@cssprop`
|
|
222
|
+
- **[JS modules](https://svelte-docinfo.fuz.dev/docs/js)** documented like their TS twins, from JSDoc types, `@typedef`s, `@template`s, and `@overload`s
|
|
223
|
+
- **[Re-exports](https://svelte-docinfo.fuz.dev/docs/re-exports)** and the import graph between modules
|
|
224
|
+
- **[Diagnostics](https://svelte-docinfo.fuz.dev/docs/diagnostics)** collected without halting, for doc problems like misplaced tags and stale `@param`s
|
|
371
225
|
- **Build-tool agnostic**: files can come from disk, a build pipeline, or memory
|
|
372
|
-
- **Diagnostics**: warnings and errors accumulate without halting; `partial: true` flags incomplete declarations
|
|
373
|
-
|
|
374
|
-
Known gaps:
|
|
375
|
-
|
|
376
|
-
- Svelte context (`setContext`/`getContext`) isn't captured yet; investigation is planned, and
|
|
377
|
-
a [request](https://github.com/fuzdev/svelte-docinfo/discussions) would bump its priority
|
|
378
|
-
- standalone `namespace Foo {}` declarations document as a bare variable with no members, and decorators aren't modeled
|
|
379
|
-
- legacy `export let` components document their props (all `bindable`), and a legacy component's default `<slot />` sets `acceptsChildren` (a runes component's is ignored), but named slots, slot props, events, and `$$restProps` aren't modeled
|
|
380
|
-
- `@nodocs` applies to declarations and export statements only; on a member or component prop it's ignored without a warning
|
|
381
226
|
|
|
227
|
+
Svelte 4 named slots, slot props, and events, Svelte context, and CommonJS aren't modeled; see the
|
|
228
|
+
[limitations](https://svelte-docinfo.fuz.dev/docs/introduction#Limitations).
|
|
382
229
|
[Issues](https://github.com/fuzdev/svelte-docinfo/issues) for bugs and
|
|
383
230
|
[discussions](https://github.com/fuzdev/svelte-docinfo/discussions) are welcome!
|
|
384
231
|
|
|
385
232
|
## Documentation
|
|
386
233
|
|
|
387
234
|
- [svelte-docinfo.fuz.dev](https://svelte-docinfo.fuz.dev/) - docs site with guides, options reference, and API docs
|
|
235
|
+
- [extraction demo](https://svelte-docinfo.fuz.dev/demo/extraction) - live examples of source and output
|
|
388
236
|
- [examples/vite/](examples/vite/README.md) - Vite plugin with live reload in dev
|
|
389
237
|
- [examples/cli/](examples/cli/README.md) - CLI usage and piping
|
|
390
238
|
- [examples/api/](examples/api/README.md) - API usage patterns
|
package/dist/analyze-core.d.ts
CHANGED
|
@@ -65,14 +65,14 @@ import { type FileExists, type IsEmittedFile } from './typescript-extract-shared
|
|
|
65
65
|
export type OnDuplicates = 'diagnostic' | 'warn' | 'throw';
|
|
66
66
|
declare const AnalyzeResultJsonEntries: v.StrictObjectSchema<{
|
|
67
67
|
readonly modules: v.OptionalSchema<v.ArraySchema<import("./types.js").ModuleJsonSchema, undefined>, () => never[]>;
|
|
68
|
-
readonly diagnostics: v.OptionalSchema<v.ArraySchema<v.VariantSchema<"kind", [import("./diagnostics.js").TypeExtractionDiagnosticSchema, import("./diagnostics.js").SignatureAnalysisDiagnosticSchema, import("./diagnostics.js").ClassMemberDiagnosticSchema, import("./diagnostics.js").SveltePropDiagnosticSchema, import("./diagnostics.js").ModuleSkippedDiagnosticSchema, import("./diagnostics.js").ModuleUnreadableDiagnosticSchema, import("./diagnostics.js").ImportParseDiagnosticSchema, import("./diagnostics.js").DuplicateCommentDiagnosticSchema, import("./diagnostics.js").MisplacedTagDiagnosticSchema, import("./diagnostics.js").UnknownParamDiagnosticSchema, import("./diagnostics.js").SourceMapFailedDiagnosticSchema, import("./diagnostics.js").DuplicateDeclarationDiagnosticSchema, import("./diagnostics.js").TransformFailedDiagnosticSchema, import("./diagnostics.js").ResolverFailedDiagnosticSchema, import("./diagnostics.js").AliasLostDiagnosticSchema], undefined>, undefined>, () => never[]>;
|
|
68
|
+
readonly diagnostics: v.OptionalSchema<v.ArraySchema<v.VariantSchema<"kind", [import("./diagnostics.js").TypeExtractionDiagnosticSchema, import("./diagnostics.js").SignatureAnalysisDiagnosticSchema, import("./diagnostics.js").ClassMemberDiagnosticSchema, import("./diagnostics.js").SveltePropDiagnosticSchema, import("./diagnostics.js").ModuleSkippedDiagnosticSchema, import("./diagnostics.js").ModuleUnreadableDiagnosticSchema, import("./diagnostics.js").ImportParseDiagnosticSchema, import("./diagnostics.js").DuplicateCommentDiagnosticSchema, import("./diagnostics.js").ComponentCommentMismatchDiagnosticSchema, import("./diagnostics.js").MisplacedTagDiagnosticSchema, import("./diagnostics.js").ImplementationDocHiddenDiagnosticSchema, import("./diagnostics.js").UnknownParamDiagnosticSchema, import("./diagnostics.js").UnknownCsspropDiagnosticSchema, import("./diagnostics.js").SourceMapFailedDiagnosticSchema, import("./diagnostics.js").DuplicateDeclarationDiagnosticSchema, import("./diagnostics.js").TransformFailedDiagnosticSchema, import("./diagnostics.js").ResolverFailedDiagnosticSchema, import("./diagnostics.js").AliasLostDiagnosticSchema, import("./diagnostics.js").CommonjsUnsupportedDiagnosticSchema, import("./diagnostics.js").CssParseFailedDiagnosticSchema, import("./diagnostics.js").CssLangUnsupportedDiagnosticSchema], undefined>, undefined>, () => never[]>;
|
|
69
69
|
}, undefined>;
|
|
70
70
|
/** @nodocs */
|
|
71
71
|
export interface AnalyzeResultJsonEntriesInput extends Named<v.InferInput<typeof AnalyzeResultJsonEntries>> {
|
|
72
72
|
}
|
|
73
73
|
declare const AnalyzeResultJsonImpl: v.SchemaWithPipe<readonly [v.CustomSchema<AnalyzeResultJsonEntriesInput, v.ErrorMessage<v.CustomIssue> | undefined>, v.StrictObjectSchema<{
|
|
74
74
|
readonly modules: v.OptionalSchema<v.ArraySchema<import("./types.js").ModuleJsonSchema, undefined>, () => never[]>;
|
|
75
|
-
readonly diagnostics: v.OptionalSchema<v.ArraySchema<v.VariantSchema<"kind", [import("./diagnostics.js").TypeExtractionDiagnosticSchema, import("./diagnostics.js").SignatureAnalysisDiagnosticSchema, import("./diagnostics.js").ClassMemberDiagnosticSchema, import("./diagnostics.js").SveltePropDiagnosticSchema, import("./diagnostics.js").ModuleSkippedDiagnosticSchema, import("./diagnostics.js").ModuleUnreadableDiagnosticSchema, import("./diagnostics.js").ImportParseDiagnosticSchema, import("./diagnostics.js").DuplicateCommentDiagnosticSchema, import("./diagnostics.js").MisplacedTagDiagnosticSchema, import("./diagnostics.js").UnknownParamDiagnosticSchema, import("./diagnostics.js").SourceMapFailedDiagnosticSchema, import("./diagnostics.js").DuplicateDeclarationDiagnosticSchema, import("./diagnostics.js").TransformFailedDiagnosticSchema, import("./diagnostics.js").ResolverFailedDiagnosticSchema, import("./diagnostics.js").AliasLostDiagnosticSchema], undefined>, undefined>, () => never[]>;
|
|
75
|
+
readonly diagnostics: v.OptionalSchema<v.ArraySchema<v.VariantSchema<"kind", [import("./diagnostics.js").TypeExtractionDiagnosticSchema, import("./diagnostics.js").SignatureAnalysisDiagnosticSchema, import("./diagnostics.js").ClassMemberDiagnosticSchema, import("./diagnostics.js").SveltePropDiagnosticSchema, import("./diagnostics.js").ModuleSkippedDiagnosticSchema, import("./diagnostics.js").ModuleUnreadableDiagnosticSchema, import("./diagnostics.js").ImportParseDiagnosticSchema, import("./diagnostics.js").DuplicateCommentDiagnosticSchema, import("./diagnostics.js").ComponentCommentMismatchDiagnosticSchema, import("./diagnostics.js").MisplacedTagDiagnosticSchema, import("./diagnostics.js").ImplementationDocHiddenDiagnosticSchema, import("./diagnostics.js").UnknownParamDiagnosticSchema, import("./diagnostics.js").UnknownCsspropDiagnosticSchema, import("./diagnostics.js").SourceMapFailedDiagnosticSchema, import("./diagnostics.js").DuplicateDeclarationDiagnosticSchema, import("./diagnostics.js").TransformFailedDiagnosticSchema, import("./diagnostics.js").ResolverFailedDiagnosticSchema, import("./diagnostics.js").AliasLostDiagnosticSchema, import("./diagnostics.js").CommonjsUnsupportedDiagnosticSchema, import("./diagnostics.js").CssParseFailedDiagnosticSchema, import("./diagnostics.js").CssLangUnsupportedDiagnosticSchema], undefined>, undefined>, () => never[]>;
|
|
76
76
|
}, undefined>]>;
|
|
77
77
|
/** @nodocs */
|
|
78
78
|
export interface AnalyzeResultJsonSchema extends Named<typeof AnalyzeResultJsonImpl> {
|
|
@@ -164,8 +164,8 @@ export interface AnalyzeResultJsonWire {
|
|
|
164
164
|
* - Svelte → `module_skipped: requires_program` (callers using session API
|
|
165
165
|
* should not reach this path; the session pre-handles Svelte)
|
|
166
166
|
*
|
|
167
|
-
* Returns `undefined` when the file is skipped; the
|
|
168
|
-
* `diagnostics` so the caller can keep iterating.
|
|
167
|
+
* Returns `undefined` when the file is skipped (see `findModuleSkip`); the
|
|
168
|
+
* diagnostic is added to `diagnostics` so the caller can keep iterating.
|
|
169
169
|
*
|
|
170
170
|
* `alsoExportedFrom` on returned declarations is always empty from this path —
|
|
171
171
|
* cross-module re-export resolution requires all modules (`mergeReExports`
|
|
@@ -260,7 +260,12 @@ export declare const analyzeCore: (inputs: AnalyzeCoreInputs) => AnalyzeResultJs
|
|
|
260
260
|
* ordering unrepresentable instead of a contract to remember. Omit
|
|
261
261
|
* `virtualFiles` when no Svelte virtuals are in play.
|
|
262
262
|
*
|
|
263
|
-
*
|
|
263
|
+
* Last, identical diagnostics collapse to the first: a symbol analyzed more
|
|
264
|
+
* than once (a renamed re-export's alias re-analyzes its canonical, a type
|
|
265
|
+
* alias over a class reads its members) re-reports the same warning at the
|
|
266
|
+
* same position.
|
|
267
|
+
*
|
|
268
|
+
* @mutates diagnostics - rewrites positions, `file`, and `message`, and removes duplicates
|
|
264
269
|
*/
|
|
265
270
|
export declare const finalizeDiagnostics: (diagnostics: Array<Diagnostic>, options: {
|
|
266
271
|
projectRoot: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyze-core.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/analyze-core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAGH,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAmB,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAC/E,OAAO,EAAoB,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"analyze-core.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/analyze-core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAGH,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAmB,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;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AAE,KAC1E,IAeF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,wBAAwB,GACpC,aAAa,KAAK,CAAC,UAAU,CAAC,EAC9B,aAAa,MAAM,KACjB,IAuBF,CAAC;AAkPF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,2BAA2B,GACvC,SAAS,KAAK,CAAC,UAAU,CAAC,EAC1B,SAAS,mBAAmB,EAC5B,SAAS,EAAE,CAAC,OAAO,KACjB,IAKF,CAAC"}
|
package/dist/analyze-core.js
CHANGED
|
@@ -201,8 +201,8 @@ const toModuleJson = (raw) => {
|
|
|
201
201
|
* - Svelte → `module_skipped: requires_program` (callers using session API
|
|
202
202
|
* should not reach this path; the session pre-handles Svelte)
|
|
203
203
|
*
|
|
204
|
-
* Returns `undefined` when the file is skipped; the
|
|
205
|
-
* `diagnostics` so the caller can keep iterating.
|
|
204
|
+
* Returns `undefined` when the file is skipped (see `findModuleSkip`); the
|
|
205
|
+
* diagnostic is added to `diagnostics` so the caller can keep iterating.
|
|
206
206
|
*
|
|
207
207
|
* `alsoExportedFrom` on returned declarations is always empty from this path —
|
|
208
208
|
* cross-module re-export resolution requires all modules (`mergeReExports`
|
|
@@ -221,40 +221,22 @@ const toModuleJson = (raw) => {
|
|
|
221
221
|
*/
|
|
222
222
|
export const analyzeModule = (sourceFile, program, options, diagnostics, log, aliasRegistry, isEmittedFile, fileExists) => {
|
|
223
223
|
const checker = program.getTypeChecker();
|
|
224
|
-
const modulePath = extractPath(sourceFile.id, options);
|
|
225
224
|
// diagnostics carry the absolute id (see the `Diagnostic.file` schema doc);
|
|
226
225
|
// the returned `ModuleJson` keeps `modulePath`, a different base
|
|
227
|
-
const
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
diagnostics
|
|
232
|
-
|
|
233
|
-
file: diagnosticFile,
|
|
234
|
-
message: 'Svelte files require program integration. Use createAnalysisSession or analyze()/analyzeFromFiles() instead.',
|
|
235
|
-
severity: 'warning',
|
|
236
|
-
reason: 'requires_program'
|
|
237
|
-
});
|
|
238
|
-
log?.warn(`Svelte file skipped in analyzeModule: ${sourceFile.id}`);
|
|
226
|
+
const modulePath = extractPath(sourceFile.id, options);
|
|
227
|
+
const skip = findModuleSkip(sourceFile, program, options);
|
|
228
|
+
if (skip) {
|
|
229
|
+
diagnostics.push(skip);
|
|
230
|
+
// the raw id, unlike the diagnostic: logs are for developers, diagnostics ship
|
|
231
|
+
log?.warn(`Module skipped (${skip.reason}): ${sourceFile.id}`);
|
|
239
232
|
return undefined;
|
|
240
233
|
}
|
|
241
|
-
else
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
// interpolating the same id as `file` keeps the two from naming the
|
|
248
|
-
// file differently — the message gets the same project-root scrub.
|
|
249
|
-
// The log line below keeps the raw id: logs are for developers,
|
|
250
|
-
// diagnostics ship.
|
|
251
|
-
message: `Could not get source file from program: ${diagnosticFile}`,
|
|
252
|
-
severity: 'warning',
|
|
253
|
-
reason: 'not_in_program'
|
|
254
|
-
});
|
|
255
|
-
log?.warn(`Could not get source file from program: ${sourceFile.id}`);
|
|
256
|
-
return undefined;
|
|
257
|
-
}
|
|
234
|
+
// past the skip, a TypeScript file is in the program, and anything else is CSS or JSON
|
|
235
|
+
let raw;
|
|
236
|
+
const tsSourceFile = options.getAnalyzerType(sourceFile.id) === 'typescript'
|
|
237
|
+
? program.getSourceFile(sourceFile.id)
|
|
238
|
+
: undefined;
|
|
239
|
+
if (tsSourceFile) {
|
|
258
240
|
// the pass-scoped extraction context — constructed here because the
|
|
259
241
|
// dispatcher is where the program is in hand (see `analyzeExports`)
|
|
260
242
|
const ctx = createExtractContext(program, checker, options, diagnostics, aliasRegistry, isEmittedFile, fileExists);
|
|
@@ -267,7 +249,7 @@ export const analyzeModule = (sourceFile, program, options, diagnostics, log, al
|
|
|
267
249
|
reclassifySnippetDeclaration(d.declaration);
|
|
268
250
|
}
|
|
269
251
|
}
|
|
270
|
-
else
|
|
252
|
+
else {
|
|
271
253
|
const { dependencies, dependents } = extractDependencies(sourceFile, options);
|
|
272
254
|
raw = {
|
|
273
255
|
path: modulePath,
|
|
@@ -280,19 +262,57 @@ export const analyzeModule = (sourceFile, program, options, diagnostics, log, al
|
|
|
280
262
|
externalStarExports: []
|
|
281
263
|
};
|
|
282
264
|
}
|
|
283
|
-
else {
|
|
284
|
-
diagnostics.push({
|
|
285
|
-
kind: 'module_skipped',
|
|
286
|
-
file: diagnosticFile,
|
|
287
|
-
message: `No analyzer for file type: ${diagnosticFile}`,
|
|
288
|
-
severity: 'warning',
|
|
289
|
-
reason: 'no_analyzer'
|
|
290
|
-
});
|
|
291
|
-
log?.warn(`No analyzer for file: ${sourceFile.id}`);
|
|
292
|
-
return undefined;
|
|
293
|
-
}
|
|
294
265
|
return toModuleJson(raw);
|
|
295
266
|
};
|
|
267
|
+
/**
|
|
268
|
+
* `sourceFiles` less the `removed` ids, with the remaining files' dependency
|
|
269
|
+
* edges to them dropped.
|
|
270
|
+
*/
|
|
271
|
+
const withoutModules = (sourceFiles, removed) => {
|
|
272
|
+
const kept = (ids) => ids?.filter((id) => !removed.has(toPosixPath(id)));
|
|
273
|
+
return sourceFiles
|
|
274
|
+
.filter((f) => !removed.has(toPosixPath(f.id)))
|
|
275
|
+
.map((f) => ({ ...f, dependencies: kept(f.dependencies), dependents: kept(f.dependents) }));
|
|
276
|
+
};
|
|
277
|
+
/**
|
|
278
|
+
* The `module_skipped` diagnostic the module dispatch gives a file, or
|
|
279
|
+
* `undefined` when it analyzes: a Svelte file without its virtual (only the
|
|
280
|
+
* session API transforms one), a TS/JS file or a Svelte virtual the program
|
|
281
|
+
* lacks, or a file with no analyzer. `analyzeCore` asks before analyzing
|
|
282
|
+
* anything, so a skipped file leaves the emitted set before any module can
|
|
283
|
+
* link to it; `analyzeModule` asks for its direct callers.
|
|
284
|
+
*/
|
|
285
|
+
const findModuleSkip = (sourceFile, program, options, virtualFile) => {
|
|
286
|
+
// interpolating the same id as `file` keeps the two from naming the file
|
|
287
|
+
// differently — the message gets the same project-root scrub
|
|
288
|
+
const file = toPosixPath(sourceFile.id);
|
|
289
|
+
const skip = (reason, message) => ({
|
|
290
|
+
kind: 'module_skipped',
|
|
291
|
+
file,
|
|
292
|
+
message,
|
|
293
|
+
severity: 'warning',
|
|
294
|
+
reason
|
|
295
|
+
});
|
|
296
|
+
if (virtualFile) {
|
|
297
|
+
// `virtualPath` would leak the svelte2tsx suffix
|
|
298
|
+
return program.getSourceFile(virtualFile.virtualPath)
|
|
299
|
+
? undefined
|
|
300
|
+
: skip('not_in_program', `Virtual file not found in program: ${file}`);
|
|
301
|
+
}
|
|
302
|
+
switch (options.getAnalyzerType(sourceFile.id)) {
|
|
303
|
+
case 'svelte':
|
|
304
|
+
return skip('requires_program', 'Svelte files require program integration. Use createAnalysisSession or analyze()/analyzeFromFiles() instead.');
|
|
305
|
+
case 'typescript':
|
|
306
|
+
return program.getSourceFile(sourceFile.id)
|
|
307
|
+
? undefined
|
|
308
|
+
: skip('not_in_program', `Could not get source file from program: ${file}`);
|
|
309
|
+
case 'css':
|
|
310
|
+
case 'json':
|
|
311
|
+
return undefined;
|
|
312
|
+
default:
|
|
313
|
+
return skip('no_analyzer', `No analyzer for file type: ${file}`);
|
|
314
|
+
}
|
|
315
|
+
};
|
|
296
316
|
/**
|
|
297
317
|
* Analyze the gated Svelte canonicals referenced by an emitted component
|
|
298
318
|
* alias, as `resolveComponentAliases` fill context only (see
|
|
@@ -346,18 +366,35 @@ const analyzeContextComponents = (contextSvelteFiles, emittedModules, inputs, al
|
|
|
346
366
|
* power users; not stable API.
|
|
347
367
|
*/
|
|
348
368
|
export const analyzeCore = (inputs) => {
|
|
349
|
-
const {
|
|
369
|
+
const { sourceOptions, program, svelteVirtualFiles, transformFailedIds, contextSvelteFiles, onDuplicates, log } = inputs;
|
|
350
370
|
const checker = program.getTypeChecker();
|
|
351
371
|
const diagnostics = [];
|
|
352
|
-
//
|
|
353
|
-
//
|
|
354
|
-
//
|
|
355
|
-
|
|
372
|
+
// Skip pre-pass: a file the module dispatch would skip (`module_skipped`)
|
|
373
|
+
// leaves the emitted set before anything is analyzed, and the edges naming
|
|
374
|
+
// it go with it, so output never references a module it doesn't contain.
|
|
375
|
+
const skippedIds = new Set();
|
|
376
|
+
for (const sourceFile of inputs.sourceFiles) {
|
|
377
|
+
if (transformFailedIds?.has(sourceFile.id))
|
|
378
|
+
continue;
|
|
379
|
+
const skip = findModuleSkip(sourceFile, program, sourceOptions, svelteVirtualFiles.get(sourceFile.id));
|
|
380
|
+
if (!skip)
|
|
381
|
+
continue;
|
|
382
|
+
diagnostics.push(skip);
|
|
383
|
+
log?.warn(`Module skipped (${skip.reason}): ${sourceFile.id}`);
|
|
384
|
+
skippedIds.add(toPosixPath(sourceFile.id));
|
|
385
|
+
}
|
|
386
|
+
const sourceFiles = skippedIds.size
|
|
387
|
+
? withoutModules(inputs.sourceFiles, skippedIds)
|
|
388
|
+
: inputs.sourceFiles;
|
|
389
|
+
// The emitted set is exactly the files handed in, less the skipped ones.
|
|
390
|
+
// `isSource` can't stand in for it: a source file left out of the set
|
|
391
|
+
// emits nothing (see `IsEmittedFile`), and the re-export arms must tell a
|
|
392
|
+
// canonical they can link to from one they have to document in place.
|
|
356
393
|
const emittedIds = new Set(sourceFiles.map((f) => toPosixPath(f.id)));
|
|
357
394
|
const isEmittedFile = (file) => emittedIds.has(file);
|
|
358
395
|
// Existence for `SvelteFileStatus`: the caller's answer, else the files
|
|
359
|
-
// handed in (in-memory content counts) plus the disk.
|
|
360
|
-
const knownIds = new Set(emittedIds);
|
|
396
|
+
// handed in (in-memory content counts, skipped ones too) plus the disk.
|
|
397
|
+
const knownIds = new Set([...emittedIds, ...skippedIds]);
|
|
361
398
|
for (const f of contextSvelteFiles ?? [])
|
|
362
399
|
knownIds.add(toPosixPath(f.id));
|
|
363
400
|
const fileExists = inputs.fileExists ?? ((file) => knownIds.has(file) || ts.sys.fileExists(file));
|
|
@@ -479,13 +516,29 @@ export const analyzeCore = (inputs) => {
|
|
|
479
516
|
* ordering unrepresentable instead of a contract to remember. Omit
|
|
480
517
|
* `virtualFiles` when no Svelte virtuals are in play.
|
|
481
518
|
*
|
|
482
|
-
*
|
|
519
|
+
* Last, identical diagnostics collapse to the first: a symbol analyzed more
|
|
520
|
+
* than once (a renamed re-export's alias re-analyzes its canonical, a type
|
|
521
|
+
* alias over a class reads its members) re-reports the same warning at the
|
|
522
|
+
* same position.
|
|
523
|
+
*
|
|
524
|
+
* @mutates diagnostics - rewrites positions, `file`, and `message`, and removes duplicates
|
|
483
525
|
*/
|
|
484
526
|
export const finalizeDiagnostics = (diagnostics, options) => {
|
|
485
527
|
if (options.virtualFiles) {
|
|
486
528
|
remapVirtualDiagnosticPositions(diagnostics, options.virtualFiles);
|
|
487
529
|
}
|
|
488
530
|
normalizeDiagnosticPaths(diagnostics, options.projectRoot);
|
|
531
|
+
const seen = new Set();
|
|
532
|
+
let kept = 0;
|
|
533
|
+
for (const d of diagnostics) {
|
|
534
|
+
// every producer builds a kind's fields in one order, so the JSON is a stable key
|
|
535
|
+
const key = JSON.stringify(d);
|
|
536
|
+
if (seen.has(key))
|
|
537
|
+
continue;
|
|
538
|
+
seen.add(key);
|
|
539
|
+
diagnostics[kept++] = d;
|
|
540
|
+
}
|
|
541
|
+
diagnostics.length = kept;
|
|
489
542
|
};
|
|
490
543
|
/**
|
|
491
544
|
* Normalize the paths a `Diagnostic` carries to project-root-relative form,
|
|
@@ -611,6 +664,7 @@ const QUOTED_ABSOLUTE_PATH_RE = /"((?:\/|[A-Za-z]:\/)[^"\n]*)"/g;
|
|
|
611
664
|
* resolution check, not this list, is the real guard.
|
|
612
665
|
*/
|
|
613
666
|
const NON_TYPE_TEXT_KEYS = new Set([
|
|
667
|
+
'cssCustomProperties',
|
|
614
668
|
'dependencies',
|
|
615
669
|
'dependents',
|
|
616
670
|
'deprecatedMessage',
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*
|
|
13
13
|
* @module
|
|
14
14
|
*/
|
|
15
|
-
import type { DeclarationKind, DeclarationModifier, GenericParamJson, MemberKind, ParameterJsonInput, OverloadJsonInput, ComponentPropJsonInput, Reactivity, ReExportJsonInput, ExternalReExportJsonInput, TypeJson } from './types.js';
|
|
15
|
+
import type { DeclarationKind, DeclarationModifier, GenericParamJson, MemberKind, ParameterJsonInput, OverloadJsonInput, ComponentCssPropertyJsonInput, ComponentPropJsonInput, Reactivity, ReExportJsonInput, ExternalReExportJsonInput, TypeJson } from './types.js';
|
|
16
16
|
import type { TsdocParsedComment } from './tsdoc.js';
|
|
17
17
|
/**
|
|
18
18
|
* Permissive type for constructing members incrementally before schema validation.
|
|
@@ -93,6 +93,7 @@ export interface DeclarationJsonBuild {
|
|
|
93
93
|
members?: Array<MemberJsonBuild>;
|
|
94
94
|
props?: Array<ComponentPropJsonInput>;
|
|
95
95
|
acceptsChildren?: boolean;
|
|
96
|
+
cssCustomProperties?: Array<ComponentCssPropertyJsonInput>;
|
|
96
97
|
lang?: 'js';
|
|
97
98
|
alsoExportedFrom?: Array<string>;
|
|
98
99
|
aliasOf?: {
|
|
@@ -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,KAAK,EACX,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,UAAU,EACV,iBAAiB,EACjB,yBAAyB,EACzB,QAAQ,EACR,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,eAAe;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IA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,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"}
|
|
@@ -94,7 +94,8 @@ export declare const getDisplayName: (declaration: DeclarationJson | MemberJson)
|
|
|
94
94
|
* synthesized JS binding).
|
|
95
95
|
*
|
|
96
96
|
* @param declaration - the `DeclarationJson` to generate an import for
|
|
97
|
-
* @param modulePath - module path relative to source root (e.g., `foo.ts`)
|
|
97
|
+
* @param modulePath - module path relative to source root (e.g., `foo.ts`); the
|
|
98
|
+
* specifier names the file it ships as (`.ts`, `.tsx`, `.jsx` → `.js`, `.mts` → `.mjs`)
|
|
98
99
|
* @param libraryName - package name for the import specifier (e.g., `@pkg/lib`)
|
|
99
100
|
* @returns formatted import statement string
|
|
100
101
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declaration-helpers.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/declaration-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACX,eAAe,EACf,UAAU,EACV,eAAe,EACf,UAAU,EAEV,QAAQ,EACR,MAAM,YAAY,CAAC;AAIpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,eAAO,MAAM,eAAe,GAAI,KAAK,MAA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