svelte-docinfo 0.15.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.
Files changed (74) hide show
  1. package/README.md +21 -175
  2. package/dist/analyze-core.d.ts +10 -5
  3. package/dist/analyze-core.d.ts.map +1 -1
  4. package/dist/analyze-core.js +106 -52
  5. package/dist/declaration-build.d.ts +2 -1
  6. package/dist/declaration-build.d.ts.map +1 -1
  7. package/dist/declaration-helpers.d.ts +2 -1
  8. package/dist/declaration-helpers.d.ts.map +1 -1
  9. package/dist/declaration-helpers.js +12 -4
  10. package/dist/dep-resolver.d.ts +5 -1
  11. package/dist/dep-resolver.d.ts.map +1 -1
  12. package/dist/dep-resolver.js +6 -2
  13. package/dist/diagnostics.d.ts +160 -9
  14. package/dist/diagnostics.d.ts.map +1 -1
  15. package/dist/diagnostics.js +126 -9
  16. package/dist/exports.d.ts.map +1 -1
  17. package/dist/exports.js +51 -21
  18. package/dist/files.d.ts +6 -3
  19. package/dist/files.d.ts.map +1 -1
  20. package/dist/files.js +7 -4
  21. package/dist/index.d.ts +1 -1
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +1 -1
  24. package/dist/postprocess.d.ts.map +1 -1
  25. package/dist/postprocess.js +1 -0
  26. package/dist/session.js +3 -3
  27. package/dist/source-config.d.ts +1 -1
  28. package/dist/source-config.js +1 -1
  29. package/dist/source.d.ts +8 -4
  30. package/dist/source.d.ts.map +1 -1
  31. package/dist/source.js +14 -5
  32. package/dist/svelte-css.d.ts +153 -0
  33. package/dist/svelte-css.d.ts.map +1 -0
  34. package/dist/svelte-css.js +501 -0
  35. package/dist/svelte-scripts.d.ts +25 -0
  36. package/dist/svelte-scripts.d.ts.map +1 -1
  37. package/dist/svelte-scripts.js +15 -5
  38. package/dist/svelte.d.ts +13 -2
  39. package/dist/svelte.d.ts.map +1 -1
  40. package/dist/svelte.js +88 -10
  41. package/dist/tsdoc.d.ts +121 -5
  42. package/dist/tsdoc.d.ts.map +1 -1
  43. package/dist/tsdoc.js +452 -29
  44. package/dist/types.d.ts +112 -6
  45. package/dist/types.d.ts.map +1 -1
  46. package/dist/types.js +107 -6
  47. package/dist/typescript-alias-registry.d.ts +4 -2
  48. package/dist/typescript-alias-registry.d.ts.map +1 -1
  49. package/dist/typescript-alias-registry.js +11 -7
  50. package/dist/typescript-exports.d.ts +8 -4
  51. package/dist/typescript-exports.d.ts.map +1 -1
  52. package/dist/typescript-exports.js +108 -10
  53. package/dist/typescript-extract-class.d.ts +6 -0
  54. package/dist/typescript-extract-class.d.ts.map +1 -1
  55. package/dist/typescript-extract-class.js +293 -26
  56. package/dist/typescript-extract-function.d.ts +1 -1
  57. package/dist/typescript-extract-function.d.ts.map +1 -1
  58. package/dist/typescript-extract-function.js +23 -13
  59. package/dist/typescript-extract-shared.d.ts +69 -8
  60. package/dist/typescript-extract-shared.d.ts.map +1 -1
  61. package/dist/typescript-extract-shared.js +405 -107
  62. package/dist/typescript-extract-type-json.d.ts +61 -2
  63. package/dist/typescript-extract-type-json.d.ts.map +1 -1
  64. package/dist/typescript-extract-type-json.js +75 -7
  65. package/dist/typescript-extract-type-properties.d.ts +8 -1
  66. package/dist/typescript-extract-type-properties.d.ts.map +1 -1
  67. package/dist/typescript-extract-type-properties.js +18 -9
  68. package/dist/typescript-extract-type.d.ts +6 -0
  69. package/dist/typescript-extract-type.d.ts.map +1 -1
  70. package/dist/typescript-extract-type.js +79 -14
  71. package/dist/typescript-program.d.ts +9 -1
  72. package/dist/typescript-program.d.ts.map +1 -1
  73. package/dist/typescript-program.js +22 -3
  74. 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)
@@ -92,9 +89,9 @@ and `src/lib/Calculator.svelte`:
92
89
  </script>
93
90
  ```
94
91
 
95
- Three ways to integrate `svelte-docinfo`:
92
+ Three ways to use it:
96
93
 
97
- 1. [Vite plugin](#vite-plugin) - recommended for SvelteKit and Vite projects. Serves a virtual module that stays current in dev mode:
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:
98
95
 
99
96
  ```ts
100
97
  // vite.config.ts
@@ -107,13 +104,13 @@ export default defineConfig({ plugins: [sveltekit(), svelteDocinfo()] });
107
104
  // import {modules} from 'virtual:svelte-docinfo';
108
105
  ```
109
106
 
110
- 2. [CLI](#cli) - quick analysis from the command line, useful for ad-hoc inspection and shell pipelines:
107
+ 2. [CLI](https://svelte-docinfo.fuz.dev/docs/cli) - for inspecting a project, writing a JSON file, and shell pipelines:
111
108
 
112
109
  ```bash
113
110
  npx svelte-docinfo --pretty
114
111
  ```
115
112
 
116
- 3. [API](#api) - programmatic access for build tools, custom pipelines, and standalone scripts:
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:
117
114
 
118
115
  ```ts
119
116
  import { analyzeFromFiles } from 'svelte-docinfo';
@@ -121,6 +118,10 @@ import { analyzeFromFiles } from 'svelte-docinfo';
121
118
  const { modules } = await analyzeFromFiles({ projectRoot: process.cwd() });
122
119
  ```
123
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
+
124
125
  All three produce the same `AnalyzeResultJson` data. The CLI emits it compacted, as shown
125
126
  here (the Vite module compacts `modules` only); the API returns it with defaults filled in:
126
127
 
@@ -201,6 +202,9 @@ import { parseAnalyzeResult } from 'svelte-docinfo';
201
202
  const { modules, diagnostics } = parseAnalyzeResult(JSON.parse(json));
202
203
  ```
203
204
 
205
+ `parseAnalyzeResult` loads the TypeScript compiler, so in browser code use
206
+ `parseModuleJson` from `svelte-docinfo/types.js` per module instead.
207
+
204
208
  The parse helpers are the stable entry point. The schemas behind them (`AnalyzeResultJson`,
205
209
  `ModuleJson`, `DeclarationJson`, …) are exported too, as [valibot](https://valibot.dev/) schemas.
206
210
 
@@ -208,185 +212,27 @@ The [extraction demo](https://svelte-docinfo.fuz.dev/demo/extraction) has more e
208
212
  and see the docs for the complete [output format](https://svelte-docinfo.fuz.dev/docs/output-format).
209
213
  You may also want to browse the [test fixtures](https://github.com/fuzdev/svelte-docinfo/tree/main/src/test/fixtures).
210
214
 
211
- ## Vite plugin
212
-
213
- Requires Vite 6 or later.
214
-
215
- 1. Add the plugin to `vite.config.ts`:
216
-
217
- ```ts
218
- import { defineConfig } from 'vite';
219
- import { sveltekit } from '@sveltejs/kit/vite';
220
- import svelteDocinfo from 'svelte-docinfo/vite.js';
221
-
222
- export default defineConfig({
223
- plugins: [sveltekit(), svelteDocinfo()]
224
- });
225
- ```
226
-
227
- 2. Add TypeScript support in `app.d.ts`:
228
-
229
- ```ts
230
- /// <reference types="svelte-docinfo/virtual-svelte-docinfo.js" />
231
- ```
232
-
233
- 3. Import the virtual module anywhere in your app:
234
-
235
- ```ts
236
- import { modules, diagnostics } from 'virtual:svelte-docinfo';
237
- // or: import data from 'virtual:svelte-docinfo';
238
- ```
239
-
240
- Plugin options:
241
-
242
- | Option | Default | Description |
243
- | --------------------- | ---------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
244
- | `projectRoot` | Vite's resolved `config.root` | Absolute path to project root. |
245
- | `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. |
246
- | `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. |
247
- | `discovery` | `'auto'` | Discovery strategy: `'auto'` \| `'exports'` \| `'glob'`. `'exports'` is strict and fails if `package.json` exports is missing or resolves to no files. |
248
- | `distDir` | `'dist'` | Dist directory name for exports-based discovery. |
249
- | `sourceOptions` | `{sourcePaths: ['src/lib'], …}` | Partial overrides for default source options (SvelteKit `src/lib` layout). |
250
- | `resolveDependencies` | `true` | Resolve import dependencies. When `false`, `dependencies`/`dependents` stay empty. |
251
- | `hmrDebounceMs` | `100` | Dev re-analysis debounce delay in milliseconds. |
252
- | `onDuplicates` | — | Opt-in check that names are unique across modules, for packages with a flat export namespace: `'diagnostic'` \| `'warn'` \| `'throw'`. Off by default. |
253
- | `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). |
254
- | `compilerOptions` | — | Compiler options merged over the tsconfig's, per key. |
255
- | `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`. |
256
-
257
- Source-scope notes (shared with the [CLI](#cli) and `analyzeFromFiles`):
258
-
259
- - `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.
260
- - 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.
261
- - **`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/**')`.
262
- - 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'`.
263
-
264
- The options interface is `VitePluginSvelteDocinfoOptions` from `svelte-docinfo/vite.js` (not re-exported from the main barrel).
265
- See the [Vite plugin docs](https://svelte-docinfo.fuz.dev/docs/vite-plugin) and [examples/vite/](examples/vite/README.md) for more.
266
-
267
- > If TypeScript reports `Cannot find module 'virtual:svelte-docinfo'`, ensure the `/// <reference>` line is in your `app.d.ts`.
268
-
269
- ## CLI
270
-
271
- ```bash
272
- npx svelte-docinfo # analyze cwd, print JSON to stdout
273
- npx svelte-docinfo -o output.json # write to a file instead
274
- npx svelte-docinfo ./packages/my-lib # analyze a specific directory
275
- npx svelte-docinfo --pretty # pretty-print the JSON output
276
- ```
277
-
278
- Output is compact JSON by default. Use `--pretty` for readable output,
279
- or pipe through `jq` for queries:
280
-
281
- ```bash
282
- npx svelte-docinfo | jq '.modules | length' # count modules
283
- npx svelte-docinfo | jq -r '.modules[].declarations[].name' # list all exported names
284
- ```
285
-
286
- Info messages print to stderr; only JSON goes to stdout. The terminal interleaves
287
- them visually, but `>` and `|` capture clean JSON. Use `-q`/`--quiet` to suppress info on
288
- stderr (warnings and errors still print).
289
-
290
- All CLI options:
291
-
292
- | Flag | Description |
293
- | --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
294
- | `[project-root]` | Project root directory (default: cwd) |
295
- | `-i, --include <pattern>` | Include pattern (repeatable, replaces exports discovery, widens the source scope; incompatible with `--discovery exports`) |
296
- | `-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) |
297
- | `-o, --output <file>` | Output file (default: stdout; pass `-` for explicit stdout, so `-o "$OUT"` works when `$OUT=-`) |
298
- | `--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 |
299
- | `--dist-dir <dir>` | Dist directory for exports discovery (default: dist) |
300
- | `--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 |
301
- | `--source-root <dir>` | Source root for module-path stripping (default: single source-dir or longest common prefix; pass `.` for project-relative paths) |
302
- | `--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 |
303
- | `--no-resolve-dependencies` | Disable dependency resolution |
304
- | `--pretty` | Pretty-print JSON output (default: compact) |
305
- | `--tsconfig <path>` | Path to the tsconfig, relative to project root and searched upward from it (default: `tsconfig.json`) |
306
- | `--no-tsconfig` | Analyze without a tsconfig, using built-in strict compiler options |
307
- | `-q, --quiet` | Suppress info messages on stderr (warnings and errors still print) |
308
- | `--on-duplicates <mode>` | Opt-in check that names are unique across modules, for packages with a flat export namespace: `diagnostic` \| `warn` \| `throw` (default: off) |
309
- | `-V, --version` | Show version number |
310
- | `-h, --help` | Show help |
311
-
312
- 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'`.
313
-
314
- Exit codes: 0 (success), 1 (analysis errors), 2 (a usage error, like an unknown flag or a
315
- missing or invalid option value, or a thrown analysis error, like a missing or unloadable
316
- `tsconfig.json`).
317
-
318
- See the [CLI docs](https://svelte-docinfo.fuz.dev/docs/cli) and [examples/cli/](examples/cli/README.md) for more.
319
-
320
- ## API
321
-
322
- Three entry points, same `AnalyzeResultJson` shape (`{modules, diagnostics}`):
323
-
324
- | Function | Use when |
325
- | ----------------------- | ------------------------------------------------------------------------------------------------- |
326
- | `analyzeFromFiles` | One-shot. Standalone projects — handles file discovery and dependency resolution |
327
- | `analyze` | One-shot. Build-tool integration — you supply `SourceFileInfo[]` already in memory |
328
- | `createAnalysisSession` | Incremental. Long-lived consumers (Vite plugin, LSP-style tools) reusing parsed ASTs across calls |
329
-
330
- For most projects, `analyzeFromFiles` is all you need. It reads your `package.json` exports
331
- to discover source files, falling back to glob patterns:
332
-
333
- ```ts
334
- import { analyzeFromFiles } from 'svelte-docinfo';
335
-
336
- const { modules } = await analyzeFromFiles({ projectRoot: process.cwd() });
337
- ```
338
-
339
- Pass `include` for custom patterns or `discovery: 'glob'` to always use glob.
340
- Use `discovery: 'exports'` for strict mode that throws if `package.json` has no usable `exports` field.
341
- When you already have file contents in memory,
342
- use `analyze` instead of `analyzeFromFiles` to skip file discovery.
343
- For just the discovery step (without running analysis), use
344
- `discoverSourceFiles` (also in the main `svelte-docinfo` import).
345
-
346
- For long-lived consumers (a Vite plugin reacting to file edits, an LSP-style tool),
347
- `createAnalysisSession` returns a persistent handle that reuses parsed ASTs across calls
348
- — see the [session docs](https://svelte-docinfo.fuz.dev/docs/session) and
349
- [examples/api/analyze-session.js](examples/api/analyze-session.js).
350
-
351
- See [examples/api/](examples/api/README.md) for more patterns
352
- including custom discovery, diagnostics, sessions, and error handling.
353
-
354
- Import from `svelte-docinfo` for the common API,
355
- or from subpaths like `svelte-docinfo/typescript-exports.js` for lower-level access.
356
- See the [API docs](https://svelte-docinfo.fuz.dev/docs/api) for the full reference.
357
-
358
215
  ## Features
359
216
 
360
217
  - **Full type resolution**: generics, imported types, and inferred return types, without manual annotations
361
- - **Structured types**: an optional `typeInfo` tree (`TypeJson`) beside the flat type strings, with union and intersection members (alias names kept), type arguments, and array/tuple elements. Absent where the flat string says everything; `typeJsonToTokens`/`typeJsonToText` render it
362
- - **Alias-lost name recovery**: TypeScript drops the name of an alias over an indexed access or conditional (`z.infer<typeof S>`, valibot's `v.InferOutput<typeof S>`) and expands it at every use. `typeInfo` recovers it as `{kind: 'reference', name}`, from the written annotation or from a registry of the project's exported aliases. Losses nothing recovers surface as `alias_lost` warnings
363
- - **TSDoc/JSDoc**: `@param`, `@returns`, `@throws`, `@example`, `@deprecated`, `@internal`, `@see`, `@since`, `@default`, `@module`, plus the custom `@nodocs` (exclude from docs) and `@mutates`; `@return` and `@defaultValue` parse as synonyms. `@internal` is a marker (`internalMessage`), not an exclusion. Inline `{@link}` survives in the text
364
- - **Merged value+type symbols**: `const Foo = z.strictObject({...})` + `type Foo = z.infer<typeof Foo>` documents the type, with `mergedValue: true` marking the name as also a runtime value; JSDoc falls back to the const's
365
- - **Svelte 5 components**: prop types, descriptions, defaults, bindability, and callback signatures via svelte2tsx, plus generics and `acceptsChildren`. JS components take props from the JSDoc `@type` on `$props()` or infer them from the destructuring
366
- - **External types**: props and members from external packages (`HTMLButtonAttributes`) are filtered out and named in `externalTypes` (on components, type aliases, interfaces, and classes, including bags reached through local base types), unless the `$props()` destructuring names them
367
- - **Svelte 5 snippets**: `kind: 'snippet'` for snippets exported from `<script module>`, with structured parameters
368
- - **Runes**: `$state`, `$state.raw`, `$derived`, and `$derived.by` on variables and class fields (`reactivity`), detected syntactically in any file
369
- - **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
370
- - **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
371
- - **Dependency graphs**: imports between modules and the computed dependents
372
- - **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
373
225
  - **Build-tool agnostic**: files can come from disk, a build pipeline, or memory
374
- - **Diagnostics**: warnings and errors accumulate without halting; `partial: true` flags incomplete declarations
375
-
376
- Known gaps:
377
-
378
- - Svelte context (`setContext`/`getContext`) isn't captured yet; investigation is planned, and
379
- a [request](https://github.com/fuzdev/svelte-docinfo/discussions) would bump its priority
380
- - standalone `namespace Foo {}` declarations document as a bare variable with no members, and decorators aren't modeled
381
- - 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
382
- - `@nodocs` applies to declarations and export statements only; on a member or component prop it's ignored without a warning
383
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).
384
229
  [Issues](https://github.com/fuzdev/svelte-docinfo/issues) for bugs and
385
230
  [discussions](https://github.com/fuzdev/svelte-docinfo/discussions) are welcome!
386
231
 
387
232
  ## Documentation
388
233
 
389
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
390
236
  - [examples/vite/](examples/vite/README.md) - Vite plugin with live reload in dev
391
237
  - [examples/cli/](examples/cli/README.md) - CLI usage and piping
392
238
  - [examples/api/](examples/api/README.md) - API usage patterns
@@ -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").ComponentCommentMismatchDiagnosticSchema, 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").ComponentCommentMismatchDiagnosticSchema, 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 diagnostic is added to
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
- * @mutates diagnostics - rewrites positions, `file`, and `message`
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,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,OAAO,EAIN,KAAK,iBAAiB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAGN,KAAK,cAAc,EAEnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,mBAA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AAE,WAAW,CAAC;CAClB;AAiDD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,WAAW,GAAI,QAAQ,iBAAiB,KAAG,iBAgMvD,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,mBAAmB,GAC/B,aAAa,KAAK,CAAC,UAAU,CAAC,EAC9B,SAAS;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAA;CAAE,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"}
@@ -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 diagnostic is added to
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 diagnosticFile = toPosixPath(sourceFile.id);
228
- const analyzerType = options.getAnalyzerType(sourceFile.id);
229
- let raw;
230
- if (analyzerType === 'svelte') {
231
- diagnostics.push({
232
- kind: 'module_skipped',
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 if (analyzerType === 'typescript') {
242
- const tsSourceFile = program.getSourceFile(sourceFile.id);
243
- if (!tsSourceFile) {
244
- diagnostics.push({
245
- kind: 'module_skipped',
246
- file: diagnosticFile,
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 if (analyzerType === 'css' || analyzerType === 'json') {
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 { sourceFiles, sourceOptions, program, svelteVirtualFiles, transformFailedIds, contextSvelteFiles, onDuplicates, log } = inputs;
369
+ const { sourceOptions, program, svelteVirtualFiles, transformFailedIds, contextSvelteFiles, onDuplicates, log } = inputs;
350
370
  const checker = program.getTypeChecker();
351
371
  const diagnostics = [];
352
- // The emitted set is exactly the files handed in. `isSource` can't stand
353
- // in for it: a source file left out of the set emits nothing (see
354
- // `IsEmittedFile`), and the re-export arms must tell a canonical they can
355
- // link to from one they have to document in place.
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
- * @mutates diagnostics - rewrites positions, `file`, and `message`
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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ClC,2FAA2F;IAC3F,MAAM,EAAE,OAAO,CAAC;CAChB;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACrC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAC/B,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"}
@@ -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,E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