svelte-docinfo 0.1.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/LICENSE +21 -0
- package/README.md +349 -0
- package/dist/analyze-core.d.ts +1386 -0
- package/dist/analyze-core.d.ts.map +1 -0
- package/dist/analyze-core.js +324 -0
- package/dist/analyze.d.ts +137 -0
- package/dist/analyze.d.ts.map +1 -0
- package/dist/analyze.js +148 -0
- package/dist/cli.d.ts +102 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +206 -0
- package/dist/concurrency.d.ts +38 -0
- package/dist/concurrency.d.ts.map +1 -0
- package/dist/concurrency.js +57 -0
- package/dist/declaration-build.d.ts +164 -0
- package/dist/declaration-build.d.ts.map +1 -0
- package/dist/declaration-build.js +15 -0
- package/dist/declaration-helpers.d.ts +169 -0
- package/dist/declaration-helpers.d.ts.map +1 -0
- package/dist/declaration-helpers.js +239 -0
- package/dist/dep-resolver.d.ts +166 -0
- package/dist/dep-resolver.d.ts.map +1 -0
- package/dist/dep-resolver.js +144 -0
- package/dist/diagnostics.d.ts +650 -0
- package/dist/diagnostics.d.ts.map +1 -0
- package/dist/diagnostics.js +377 -0
- package/dist/discovery.d.ts +115 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +126 -0
- package/dist/exports.d.ts +105 -0
- package/dist/exports.d.ts.map +1 -0
- package/dist/exports.js +274 -0
- package/dist/files.d.ts +77 -0
- package/dist/files.d.ts.map +1 -0
- package/dist/files.js +95 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/log.d.ts +32 -0
- package/dist/log.d.ts.map +1 -0
- package/dist/log.js +11 -0
- package/dist/logo.d.ts +8 -0
- package/dist/logo.d.ts.map +1 -0
- package/dist/logo.js +9 -0
- package/dist/main.d.ts +11 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +18 -0
- package/dist/paths.d.ts +35 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +34 -0
- package/dist/postprocess.d.ts +145 -0
- package/dist/postprocess.d.ts.map +1 -0
- package/dist/postprocess.js +305 -0
- package/dist/session.d.ts +248 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +496 -0
- package/dist/source-config.d.ts +330 -0
- package/dist/source-config.d.ts.map +1 -0
- package/dist/source-config.js +356 -0
- package/dist/source.d.ts +126 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +68 -0
- package/dist/svelte.d.ts +179 -0
- package/dist/svelte.d.ts.map +1 -0
- package/dist/svelte.js +898 -0
- package/dist/tsdoc.d.ts +145 -0
- package/dist/tsdoc.d.ts.map +1 -0
- package/dist/tsdoc.js +262 -0
- package/dist/types.d.ts +3381 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +588 -0
- package/dist/typescript-exports.d.ts +91 -0
- package/dist/typescript-exports.d.ts.map +1 -0
- package/dist/typescript-exports.js +656 -0
- package/dist/typescript-extract-class.d.ts +29 -0
- package/dist/typescript-extract-class.d.ts.map +1 -0
- package/dist/typescript-extract-class.js +251 -0
- package/dist/typescript-extract-function.d.ts +47 -0
- package/dist/typescript-extract-function.d.ts.map +1 -0
- package/dist/typescript-extract-function.js +108 -0
- package/dist/typescript-extract-shared.d.ts +166 -0
- package/dist/typescript-extract-shared.d.ts.map +1 -0
- package/dist/typescript-extract-shared.js +528 -0
- package/dist/typescript-extract-type-properties.d.ts +34 -0
- package/dist/typescript-extract-type-properties.d.ts.map +1 -0
- package/dist/typescript-extract-type-properties.js +241 -0
- package/dist/typescript-extract-type.d.ts +48 -0
- package/dist/typescript-extract-type.d.ts.map +1 -0
- package/dist/typescript-extract-type.js +238 -0
- package/dist/typescript-program.d.ts +211 -0
- package/dist/typescript-program.d.ts.map +1 -0
- package/dist/typescript-program.js +290 -0
- package/dist/vite.d.ts +116 -0
- package/dist/vite.d.ts.map +1 -0
- package/dist/vite.js +418 -0
- package/package.json +131 -0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AAO,UAAU,CAAC,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,588 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Metadata types for library source code analysis.
|
|
3
|
+
*
|
|
4
|
+
* These types represent the structure of `src/lib/` exports,
|
|
5
|
+
* extracted at build time via TypeScript compiler analysis.
|
|
6
|
+
* Used for generating API documentation and enabling code search.
|
|
7
|
+
*
|
|
8
|
+
* Hierarchy: `ModuleJson` → `DeclarationJson` (discriminated union on `kind`) → `MemberJson` (discriminated union on `kind`)
|
|
9
|
+
*
|
|
10
|
+
* ## Zod input/output split
|
|
11
|
+
*
|
|
12
|
+
* Array fields use `.default([])` so they're optional in serialized JSON (compact)
|
|
13
|
+
* but guaranteed `[]` at runtime after `.parse()`. Input types (`ModuleJsonInput`,
|
|
14
|
+
* `DeclarationJsonInput`, `ComponentPropJsonInput`) accept optional arrays;
|
|
15
|
+
* output types (`ModuleJson`, `DeclarationJson`, `ComponentPropJson`) guarantee arrays.
|
|
16
|
+
* Use `compactReplacer` (in `declaration-helpers.ts`) with `JSON.stringify` for compact output.
|
|
17
|
+
*
|
|
18
|
+
* ## Discriminated union
|
|
19
|
+
*
|
|
20
|
+
* `DeclarationJson` is a `z.discriminatedUnion` on `kind` with 9 variants:
|
|
21
|
+
* `FunctionDeclarationJson`, `ClassDeclarationJson`, `InterfaceDeclarationJson`,
|
|
22
|
+
* `TypeDeclarationJson`, `VariableDeclarationJson`, `EnumDeclarationJson`,
|
|
23
|
+
* `ComponentDeclarationJson`, `SnippetDeclarationJson`, `NamespaceDeclarationJson`.
|
|
24
|
+
* Each variant has only the fields relevant to that kind, enforced by
|
|
25
|
+
* `z.strictObject`. Use `isKind` (in `declaration-helpers.ts`) to narrow.
|
|
26
|
+
*
|
|
27
|
+
* `MemberJson` is similarly a `z.discriminatedUnion` on `kind` with 3 variants:
|
|
28
|
+
* `FunctionMemberJson`, `VariableMemberJson`, `ConstructorMemberJson`.
|
|
29
|
+
* Each variant has only the fields relevant to that member kind.
|
|
30
|
+
*
|
|
31
|
+
* Internal analysis code that constructs declarations incrementally uses
|
|
32
|
+
* `DeclarationJsonBuild` — a permissive interface with all fields optional.
|
|
33
|
+
* Zod validation at the `ModuleJson.parse()` boundary enforces variant correctness.
|
|
34
|
+
*
|
|
35
|
+
* @see `declaration-helpers.ts` for display formatting and type narrowing utilities
|
|
36
|
+
* @see `analyze.ts` for the main analysis entry points
|
|
37
|
+
* @see `tsdoc.ts` for JSDoc/TSDoc extraction into these types
|
|
38
|
+
* @see `postprocess.ts` for post-processing (`mergeReExports`, `findDuplicates`)
|
|
39
|
+
*
|
|
40
|
+
* @module
|
|
41
|
+
*/
|
|
42
|
+
import { z } from 'zod';
|
|
43
|
+
/**
|
|
44
|
+
* The kind of top-level exported declaration.
|
|
45
|
+
*
|
|
46
|
+
* Does not include `'constructor'` — constructors only appear as `MemberKind`
|
|
47
|
+
* (nested in classes, interfaces, or types with construct signatures), never as
|
|
48
|
+
* top-level module exports.
|
|
49
|
+
*/
|
|
50
|
+
export const DeclarationKind = z.enum([
|
|
51
|
+
'type',
|
|
52
|
+
'function',
|
|
53
|
+
'variable',
|
|
54
|
+
'class',
|
|
55
|
+
'interface',
|
|
56
|
+
'enum',
|
|
57
|
+
'component',
|
|
58
|
+
'snippet',
|
|
59
|
+
'namespace',
|
|
60
|
+
]);
|
|
61
|
+
/**
|
|
62
|
+
* TypeScript modifier keywords extracted from declarations.
|
|
63
|
+
*
|
|
64
|
+
* Only modifiers that appear on public API members are included.
|
|
65
|
+
* Private members (including `#field` syntax) are filtered out during analysis.
|
|
66
|
+
* Protected members are included as part of the extension API.
|
|
67
|
+
*/
|
|
68
|
+
export const DeclarationModifier = z.enum([
|
|
69
|
+
'public',
|
|
70
|
+
'protected',
|
|
71
|
+
'readonly',
|
|
72
|
+
'static',
|
|
73
|
+
'abstract',
|
|
74
|
+
'getter',
|
|
75
|
+
'setter',
|
|
76
|
+
]);
|
|
77
|
+
/**
|
|
78
|
+
* Reactivity flavor for a variable declaration or class field, captured from
|
|
79
|
+
* the rune call at the initializer (e.g., `let count = $state(0)`).
|
|
80
|
+
*
|
|
81
|
+
* Only the value-producing reactivity runes are represented here — `$props`
|
|
82
|
+
* and `$bindable` are modeled separately as `ComponentPropJson.bindable`
|
|
83
|
+
* (and prop-presence on the `props` array). A renderer wanting "all rune
|
|
84
|
+
* annotations across declarations and props" needs to read both this field
|
|
85
|
+
* and `ComponentPropJson.bindable`.
|
|
86
|
+
*
|
|
87
|
+
* - `$state` — deeply reactive proxy
|
|
88
|
+
* - `$state.raw` — reference-only reactive (no proxy)
|
|
89
|
+
* - `$derived` — recomputed from dependencies (re-assignable)
|
|
90
|
+
* - `$derived.by` — same as `$derived`, with a function argument
|
|
91
|
+
*
|
|
92
|
+
* Detection is syntactic (AST-based) and runs on every analyzed file
|
|
93
|
+
* regardless of extension. Most reactive declarations live in `.svelte`,
|
|
94
|
+
* `.svelte.ts`, or `.svelte.js`, but the field will also surface on any
|
|
95
|
+
* `.ts`/`.js` file that uses the same rune call patterns — by design, so
|
|
96
|
+
* documentation pipelines can capture any rune-shaped declaration their
|
|
97
|
+
* conventions choose to expose.
|
|
98
|
+
*/
|
|
99
|
+
export const Reactivity = z.enum(['$state', '$state.raw', '$derived', '$derived.by']);
|
|
100
|
+
/**
|
|
101
|
+
* Generic type parameter metadata extracted from declarations like `<T extends string = unknown>`.
|
|
102
|
+
*
|
|
103
|
+
* Present on functions, classes, interfaces, type aliases, and Svelte components
|
|
104
|
+
* that declare generic type parameters.
|
|
105
|
+
*/
|
|
106
|
+
export const GenericParamJson = z.strictObject({
|
|
107
|
+
/** Parameter name like `T`. */
|
|
108
|
+
name: z.string(),
|
|
109
|
+
/** Constraint like `string` from `T extends string`. */
|
|
110
|
+
constraint: z.string().optional(),
|
|
111
|
+
/** Default type like `unknown` from `T = unknown`. */
|
|
112
|
+
defaultType: z.string().optional(),
|
|
113
|
+
});
|
|
114
|
+
/**
|
|
115
|
+
* Parameter information for functions and methods.
|
|
116
|
+
*
|
|
117
|
+
* Kept distinct from `ComponentPropJson` despite structural similarity.
|
|
118
|
+
* Function parameters form a tuple with positional semantics:
|
|
119
|
+
* calling order matters (`fn(a, b)` vs `fn(b, a)`),
|
|
120
|
+
* may include rest parameters and destructuring patterns.
|
|
121
|
+
*/
|
|
122
|
+
export const ParameterJson = z.strictObject({
|
|
123
|
+
/** Parameter name (e.g., `options`, `...args`). */
|
|
124
|
+
name: z.string(),
|
|
125
|
+
/** Resolved TypeScript type string (e.g., `string`, `Record<string, unknown>`). */
|
|
126
|
+
type: z.string(),
|
|
127
|
+
/** Whether the parameter has a `?` token. */
|
|
128
|
+
optional: z.boolean().default(false),
|
|
129
|
+
/** Whether the parameter uses rest syntax (`...args`). */
|
|
130
|
+
rest: z.boolean().default(false),
|
|
131
|
+
/** Description from `@param` tag. */
|
|
132
|
+
description: z.string().optional(),
|
|
133
|
+
/** Default value expression from the source (e.g., `'hello'`, `42`). */
|
|
134
|
+
defaultValue: z.string().optional(),
|
|
135
|
+
});
|
|
136
|
+
/**
|
|
137
|
+
* Doc-comment fields shared across declarations, members, and component props.
|
|
138
|
+
*
|
|
139
|
+
* Extracted so `declarationSharedFields` and `ComponentPropJson` reference
|
|
140
|
+
* the same field definitions without duplication.
|
|
141
|
+
*/
|
|
142
|
+
const docFields = {
|
|
143
|
+
/** Code examples from `@example` tags. */
|
|
144
|
+
examples: z.array(z.string()).default([]),
|
|
145
|
+
/** Deprecation message from `@deprecated` tag. */
|
|
146
|
+
deprecatedMessage: z.string().optional(),
|
|
147
|
+
/** Related items from `@see` tags, in raw TSDoc format. */
|
|
148
|
+
seeAlso: z.array(z.string()).default([]),
|
|
149
|
+
/** Exceptions from `@throws` tags. */
|
|
150
|
+
throws: z
|
|
151
|
+
.array(z.strictObject({ type: z.string().optional(), description: z.string() }))
|
|
152
|
+
.default([]),
|
|
153
|
+
/** Version introduced, from `@since` tag. */
|
|
154
|
+
since: z.string().optional(),
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Component prop information for Svelte components.
|
|
158
|
+
*
|
|
159
|
+
* Standalone schema (not extending `ParameterJson`) because component props
|
|
160
|
+
* have different semantics: named attributes with no positional order
|
|
161
|
+
* (`<Foo {a} {b} />` = `<Foo {b} {a} />`), no rest parameters,
|
|
162
|
+
* and support for two-way binding via `$bindable` rune.
|
|
163
|
+
*/
|
|
164
|
+
export const ComponentPropJson = z.strictObject({
|
|
165
|
+
/** Prop name as declared in the component's `$props()` type. */
|
|
166
|
+
name: z.string(),
|
|
167
|
+
/** Resolved TypeScript type string. */
|
|
168
|
+
type: z.string(),
|
|
169
|
+
/** Whether the prop is optional in the component's props type. */
|
|
170
|
+
optional: z.boolean().default(false),
|
|
171
|
+
/** Description from JSDoc on the prop's type declaration. */
|
|
172
|
+
description: z.string().optional(),
|
|
173
|
+
/** Default value expression from destructuring or `@default` tag. */
|
|
174
|
+
defaultValue: z.string().optional(),
|
|
175
|
+
/** Whether the prop uses the `$bindable()` rune, enabling two-way binding. */
|
|
176
|
+
bindable: z.boolean().default(false),
|
|
177
|
+
/**
|
|
178
|
+
* Structured parameters for callable props (e.g., `Snippet<[text: string]>`).
|
|
179
|
+
*
|
|
180
|
+
* Present when the prop has extractable parameters, absent otherwise.
|
|
181
|
+
* Only populated when there are actual parameters — bare `Snippet` / `Snippet<[]>`
|
|
182
|
+
* does not set this field. Intentionally `.optional()` rather than
|
|
183
|
+
* `.default([])` (see the array-field policy note above): absence is a
|
|
184
|
+
* meaningful signal, not an empty list.
|
|
185
|
+
*/
|
|
186
|
+
parameters: z.array(ParameterJson).optional(),
|
|
187
|
+
...docFields,
|
|
188
|
+
});
|
|
189
|
+
/**
|
|
190
|
+
* A single function overload signature.
|
|
191
|
+
*
|
|
192
|
+
* When a function has multiple overload signatures, each public overload
|
|
193
|
+
* is captured here. The implementation signature is excluded.
|
|
194
|
+
*/
|
|
195
|
+
export const OverloadJson = z.strictObject({
|
|
196
|
+
/** Full TypeScript type signature for this overload. */
|
|
197
|
+
typeSignature: z.string(),
|
|
198
|
+
/** Parameters for this overload. */
|
|
199
|
+
parameters: z.array(ParameterJson).default([]),
|
|
200
|
+
/** Return type for this overload. */
|
|
201
|
+
returnType: z.string().optional(),
|
|
202
|
+
/** Generic type parameters for this overload. */
|
|
203
|
+
genericParams: z.array(GenericParamJson).default([]),
|
|
204
|
+
/** JSDoc/TSDoc comment specific to this overload. */
|
|
205
|
+
docComment: z.string().optional(),
|
|
206
|
+
/** Return value description from `@returns` tag on this overload. */
|
|
207
|
+
returnDescription: z.string().optional(),
|
|
208
|
+
});
|
|
209
|
+
/**
|
|
210
|
+
* The subset of declaration kinds that appear as nested members in classes, interfaces, and types.
|
|
211
|
+
*
|
|
212
|
+
* Class members include constructors (`'constructor'`), methods (`'function'`),
|
|
213
|
+
* and properties/accessors (`'variable'`). Interface/type properties use the same kinds
|
|
214
|
+
* for property signatures, method signatures, index signatures, and call/construct signatures.
|
|
215
|
+
*
|
|
216
|
+
* Top-level-only kinds (`'class'`, `'interface'`, `'type'`, `'enum'`, `'component'`) never
|
|
217
|
+
* appear as members — nesting is exactly one level deep.
|
|
218
|
+
*/
|
|
219
|
+
export const MemberKind = z.enum(['function', 'variable', 'constructor']);
|
|
220
|
+
/**
|
|
221
|
+
* Shared Zod fields for both `MemberJson` and all `DeclarationJson` variants.
|
|
222
|
+
*
|
|
223
|
+
* Contains fields present on every declaration and member regardless of kind:
|
|
224
|
+
* identity, documentation, modifiers, source location, and generic params.
|
|
225
|
+
*/
|
|
226
|
+
const declarationSharedFields = {
|
|
227
|
+
/**
|
|
228
|
+
* The exported name. Always populated. The default-export slot is named
|
|
229
|
+
* `'default'` — that's the symbol's actual name in JS
|
|
230
|
+
* (`import {default as X}` and `ns.default` both expose it directly), and
|
|
231
|
+
* `import X from 'mod'` is sugar for `import {default as X}`. Consumers
|
|
232
|
+
* branch on `name === 'default'` to render the sugar form when desired.
|
|
233
|
+
*/
|
|
234
|
+
name: z.string(),
|
|
235
|
+
/**
|
|
236
|
+
* Declaration kind — placeholder for key ordering.
|
|
237
|
+
* Each variant and `MemberJson` override with a narrower literal/enum.
|
|
238
|
+
* Placed here so `kind` appears right after `name` in serialized JSON
|
|
239
|
+
* (JS object spread preserves first-occurrence key position).
|
|
240
|
+
*/
|
|
241
|
+
kind: DeclarationKind,
|
|
242
|
+
/** JSDoc/TSDoc comment. */
|
|
243
|
+
docComment: z.string().optional(),
|
|
244
|
+
/** Full TypeScript type signature. */
|
|
245
|
+
typeSignature: z.string().optional(),
|
|
246
|
+
/** TypeScript modifiers like `readonly`, `static`, or `protected`. */
|
|
247
|
+
modifiers: z.array(DeclarationModifier).default([]),
|
|
248
|
+
/**
|
|
249
|
+
* 1-indexed line number in source file.
|
|
250
|
+
* Undefined for synthesized declarations (e.g., alias declarations from renamed re-exports).
|
|
251
|
+
*/
|
|
252
|
+
sourceLine: z.number().optional(),
|
|
253
|
+
/** Generic type parameters like `<T, U>`. */
|
|
254
|
+
genericParams: z.array(GenericParamJson).default([]),
|
|
255
|
+
...docFields,
|
|
256
|
+
/**
|
|
257
|
+
* Mutation documentation from `@mutates` tags (non-standard), mapping keys to descriptions.
|
|
258
|
+
*
|
|
259
|
+
* Keys are intentionally unvalidated — typically a parameter name, but
|
|
260
|
+
* authors may also use compound paths (`this.foo`, `obj.field`) or external
|
|
261
|
+
* state references (`globalCache`). The schema accepts any string key so
|
|
262
|
+
* consumers can render whatever the author wrote.
|
|
263
|
+
*/
|
|
264
|
+
mutates: z.record(z.string(), z.string()).optional(),
|
|
265
|
+
/** Whether extraction failed partway through, leaving some fields missing (e.g., `typeSignature`, `parameters`). */
|
|
266
|
+
partial: z.boolean().default(false),
|
|
267
|
+
};
|
|
268
|
+
/** Callable fields shared by functions and constructors (but not variables). */
|
|
269
|
+
const callableFields = {
|
|
270
|
+
/** Function/method/constructor parameters. */
|
|
271
|
+
parameters: z.array(ParameterJson).default([]),
|
|
272
|
+
/**
|
|
273
|
+
* Overload signatures (when there are multiple public overloads).
|
|
274
|
+
* Includes all public overloads. The implementation signature is excluded.
|
|
275
|
+
* Empty when there are no overloads (single signature).
|
|
276
|
+
*/
|
|
277
|
+
overloads: z.array(OverloadJson).default([]),
|
|
278
|
+
};
|
|
279
|
+
/** Return-value fields for functions only (not constructors or variables). */
|
|
280
|
+
const returnFields = {
|
|
281
|
+
/** Function/method return type. */
|
|
282
|
+
returnType: z.string().optional(),
|
|
283
|
+
/** Return value description from `@returns` tag. */
|
|
284
|
+
returnDescription: z.string().optional(),
|
|
285
|
+
};
|
|
286
|
+
/** Function-like fields shared by `FunctionMemberJson` and `FunctionDeclarationJson`. */
|
|
287
|
+
const functionLikeFields = {
|
|
288
|
+
...callableFields,
|
|
289
|
+
...returnFields,
|
|
290
|
+
};
|
|
291
|
+
// ── MemberJson Variants ────────────────────────────────────────────────────
|
|
292
|
+
/**
|
|
293
|
+
* A function member (method, call signature, method signature).
|
|
294
|
+
* Has `parameters`, `returnType`, `returnDescription`, `overloads`.
|
|
295
|
+
*
|
|
296
|
+
* `optional` reflects a `?` token on the declaration (e.g., `foo?(): void`
|
|
297
|
+
* on an interface or type literal). Always `false` for index/call/construct
|
|
298
|
+
* signatures and for class methods (TypeScript disallows optional methods on
|
|
299
|
+
* classes).
|
|
300
|
+
*
|
|
301
|
+
* `name` is the user-chosen method/property identifier, except for call
|
|
302
|
+
* signatures on interfaces and type aliases where it is the literal sentinel
|
|
303
|
+
* `'(call)'`.
|
|
304
|
+
*/
|
|
305
|
+
export const FunctionMemberJson = z.strictObject({
|
|
306
|
+
...declarationSharedFields,
|
|
307
|
+
...functionLikeFields,
|
|
308
|
+
kind: z.literal('function'),
|
|
309
|
+
/**
|
|
310
|
+
* User-chosen identifier, or the literal `'(call)'` sentinel for
|
|
311
|
+
* unnamed call signatures.
|
|
312
|
+
*/
|
|
313
|
+
name: z.string(),
|
|
314
|
+
/** Whether the member has a `?` token in its declaration. */
|
|
315
|
+
optional: z.boolean().default(false),
|
|
316
|
+
});
|
|
317
|
+
/**
|
|
318
|
+
* A variable member (property, accessor, index signature, enum value).
|
|
319
|
+
* Shared fields plus optional `reactivity` for class fields initialized with
|
|
320
|
+
* a Svelte rune (`$state`, `$state.raw`, `$derived`, `$derived.by`).
|
|
321
|
+
*
|
|
322
|
+
* `optional` reflects a `?` token on the declaration (e.g., `x?: string`).
|
|
323
|
+
* Always `false` for index signatures and enum values.
|
|
324
|
+
*/
|
|
325
|
+
export const VariableMemberJson = z.strictObject({
|
|
326
|
+
...declarationSharedFields,
|
|
327
|
+
kind: z.literal('variable'),
|
|
328
|
+
/** Whether the member has a `?` token in its declaration. */
|
|
329
|
+
optional: z.boolean().default(false),
|
|
330
|
+
/** Rune flavor when this field is initialized with a value-producing reactivity rune. */
|
|
331
|
+
reactivity: Reactivity.optional(),
|
|
332
|
+
/** Default value documented via `@default`. Authoritative initializer (when human-readable) is in `typeSignature`. */
|
|
333
|
+
defaultValue: z.string().optional(),
|
|
334
|
+
});
|
|
335
|
+
/**
|
|
336
|
+
* A constructor member (class constructor, construct signature).
|
|
337
|
+
* Has `parameters`, `overloads` — but not `returnType`/`returnDescription`
|
|
338
|
+
* (constructors always return their class).
|
|
339
|
+
*
|
|
340
|
+
* `name` is narrowed to two literal sentinels: `'constructor'` for class
|
|
341
|
+
* constructors and `'(construct)'` for interface/type-alias construct
|
|
342
|
+
* signatures (which share `kind: 'constructor'` but originate from
|
|
343
|
+
* `getConstructSignatures()` on a non-class type — no user-chosen identifier
|
|
344
|
+
* exists). The literal is preserved (rather than omitted) so `getDisplayName`
|
|
345
|
+
* and consumer renderers reading `member.name` keep working without a
|
|
346
|
+
* constructor-specific branch.
|
|
347
|
+
*/
|
|
348
|
+
export const ConstructorMemberJson = z.strictObject({
|
|
349
|
+
...declarationSharedFields,
|
|
350
|
+
...callableFields,
|
|
351
|
+
kind: z.literal('constructor'),
|
|
352
|
+
name: z.union([z.literal('constructor'), z.literal('(construct)')]),
|
|
353
|
+
});
|
|
354
|
+
/**
|
|
355
|
+
* Metadata for a nested declaration within a class, interface, type, or enum.
|
|
356
|
+
*
|
|
357
|
+
* Discriminated union on `kind` with 3 variants: `FunctionMemberJson`,
|
|
358
|
+
* `VariableMemberJson`, `ConstructorMemberJson`. Use `isKind` (in
|
|
359
|
+
* `declaration-helpers.ts`) to narrow, or check `member.kind` directly.
|
|
360
|
+
*
|
|
361
|
+
* Does not include fields that exist on declarations but not on members
|
|
362
|
+
* (`extends`, `intersects`, `implements`, `props`, `alsoExportedFrom`, `aliasOf`).
|
|
363
|
+
*
|
|
364
|
+
* Nesting is exactly one level deep — members never contain their own members.
|
|
365
|
+
*/
|
|
366
|
+
export const MemberJson = z.discriminatedUnion('kind', [FunctionMemberJson, VariableMemberJson, ConstructorMemberJson]);
|
|
367
|
+
// ── DeclarationJson Variants ────────────────────────────────────────────────
|
|
368
|
+
/** Top-level-only fields shared by all `DeclarationJson` variants. */
|
|
369
|
+
const declarationTopLevelFields = {
|
|
370
|
+
/**
|
|
371
|
+
* Module paths (relative to `sourceRoot`) that re-export this declaration under the same name.
|
|
372
|
+
* The canonical declaration lives in this module's `declarations` array;
|
|
373
|
+
* these paths are additional import locations for the same thing.
|
|
374
|
+
*
|
|
375
|
+
* **Consumer note**: To build a complete re-export map, scan two fields:
|
|
376
|
+
* 1. `alsoExportedFrom` on each declaration — same-name re-exports
|
|
377
|
+
* 2. `aliasOf` on declarations — renamed re-exports (separate declarations)
|
|
378
|
+
*/
|
|
379
|
+
alsoExportedFrom: z.array(z.string()).default([]),
|
|
380
|
+
/**
|
|
381
|
+
* For renamed re-exports (`export {foo as bar}`), points to the original declaration.
|
|
382
|
+
* This declaration's `name` is the alias; `aliasOf.name` is the original name.
|
|
383
|
+
*
|
|
384
|
+
* For renames out of the default slot (`export {default as bar} from './x'` where
|
|
385
|
+
* `./x` is `export default ...`), `aliasOf.name` is `'default'` — the canonical's
|
|
386
|
+
* actual symbol name. Consumers locate the canonical by `(aliasOf.module, aliasOf.name)`.
|
|
387
|
+
*
|
|
388
|
+
* Svelte component exception: when the source is a `.svelte` file (e.g.,
|
|
389
|
+
* `export {default as Foo} from './X.svelte'`), the canonical's name is the
|
|
390
|
+
* component name (derived from the filename), so `aliasOf.name` is the
|
|
391
|
+
* component name (`'X'`), NOT `'default'`. Consumers that branch on
|
|
392
|
+
* `aliasOf.name === 'default'` to detect default-rename should additionally
|
|
393
|
+
* check whether `aliasOf.module` ends with `.svelte`.
|
|
394
|
+
*
|
|
395
|
+
* Different from `alsoExportedFrom`: aliases create new API surface names,
|
|
396
|
+
* while `alsoExportedFrom` tracks additional import paths for the same name.
|
|
397
|
+
*/
|
|
398
|
+
aliasOf: z
|
|
399
|
+
.strictObject({
|
|
400
|
+
module: z.string(),
|
|
401
|
+
name: z.string(),
|
|
402
|
+
})
|
|
403
|
+
.optional(),
|
|
404
|
+
};
|
|
405
|
+
/** A function declaration. Has `parameters`, `returnType`, `returnDescription`, `overloads`. */
|
|
406
|
+
export const FunctionDeclarationJson = z.strictObject({
|
|
407
|
+
...declarationSharedFields,
|
|
408
|
+
...declarationTopLevelFields,
|
|
409
|
+
...functionLikeFields,
|
|
410
|
+
kind: z.literal('function'),
|
|
411
|
+
});
|
|
412
|
+
/** A class declaration. Has `members`, `extends`, `implements`. */
|
|
413
|
+
export const ClassDeclarationJson = z.strictObject({
|
|
414
|
+
...declarationSharedFields,
|
|
415
|
+
...declarationTopLevelFields,
|
|
416
|
+
kind: z.literal('class'),
|
|
417
|
+
/**
|
|
418
|
+
* Extended base class (single; TypeScript allows only one).
|
|
419
|
+
*
|
|
420
|
+
* @see `implements` (this variant), `InterfaceDeclarationJson.extends`,
|
|
421
|
+
* `TypeDeclarationJson.intersects`, `ComponentDeclarationJson.intersects`
|
|
422
|
+
* for sibling "related type identifiers" fields. Field shapes mirror TS syntax.
|
|
423
|
+
*/
|
|
424
|
+
extends: z.string().optional(),
|
|
425
|
+
/** Implemented interfaces. */
|
|
426
|
+
implements: z.array(z.string()).default([]),
|
|
427
|
+
/**
|
|
428
|
+
* Class members: methods, properties, constructors, getters/setters.
|
|
429
|
+
*/
|
|
430
|
+
members: z.array(MemberJson).default([]),
|
|
431
|
+
});
|
|
432
|
+
/** An interface declaration. Has `members`, `extends`. */
|
|
433
|
+
export const InterfaceDeclarationJson = z.strictObject({
|
|
434
|
+
...declarationSharedFields,
|
|
435
|
+
...declarationTopLevelFields,
|
|
436
|
+
kind: z.literal('interface'),
|
|
437
|
+
/**
|
|
438
|
+
* Extended interfaces.
|
|
439
|
+
*
|
|
440
|
+
* @see `ClassDeclarationJson.extends`, `ClassDeclarationJson.implements`,
|
|
441
|
+
* `TypeDeclarationJson.intersects`, `ComponentDeclarationJson.intersects`
|
|
442
|
+
* for sibling "related type identifiers" fields. Field shapes mirror TS syntax.
|
|
443
|
+
*/
|
|
444
|
+
extends: z.array(z.string()).default([]),
|
|
445
|
+
/**
|
|
446
|
+
* Interface members: property signatures, method signatures, index signatures,
|
|
447
|
+
* call/construct signatures.
|
|
448
|
+
*/
|
|
449
|
+
members: z.array(MemberJson).default([]),
|
|
450
|
+
});
|
|
451
|
+
/** A type alias declaration. Has `members`, `intersects`. */
|
|
452
|
+
export const TypeDeclarationJson = z.strictObject({
|
|
453
|
+
...declarationSharedFields,
|
|
454
|
+
...declarationTopLevelFields,
|
|
455
|
+
kind: z.literal('type'),
|
|
456
|
+
/**
|
|
457
|
+
* Types from intersection branches whose properties are all external (filtered out of `members`).
|
|
458
|
+
*
|
|
459
|
+
* @see `ComponentDeclarationJson.intersects`, `ClassDeclarationJson.extends`,
|
|
460
|
+
* `ClassDeclarationJson.implements`, `InterfaceDeclarationJson.extends`
|
|
461
|
+
* for sibling "related type identifiers" fields. Field shapes mirror TS syntax.
|
|
462
|
+
*/
|
|
463
|
+
intersects: z.array(z.string()).default([]),
|
|
464
|
+
/**
|
|
465
|
+
* Type members: property signatures, method signatures, index signatures,
|
|
466
|
+
* call/construct signatures.
|
|
467
|
+
*/
|
|
468
|
+
members: z.array(MemberJson).default([]),
|
|
469
|
+
});
|
|
470
|
+
/**
|
|
471
|
+
* A variable declaration. Has optional `reactivity` for top-level rune-module
|
|
472
|
+
* exports (e.g., `export let count = $state(0)` in `.svelte.ts` or `<script module>`).
|
|
473
|
+
*/
|
|
474
|
+
export const VariableDeclarationJson = z.strictObject({
|
|
475
|
+
...declarationSharedFields,
|
|
476
|
+
...declarationTopLevelFields,
|
|
477
|
+
kind: z.literal('variable'),
|
|
478
|
+
/** Rune flavor when this variable is initialized with a value-producing reactivity rune. */
|
|
479
|
+
reactivity: Reactivity.optional(),
|
|
480
|
+
/** Default value documented via `@default`. Useful when the AST initializer is opaque (a call expression, computed value) and the author wants to document the conceptual default. */
|
|
481
|
+
defaultValue: z.string().optional(),
|
|
482
|
+
});
|
|
483
|
+
/** An enum declaration. Has `members` for enum values. */
|
|
484
|
+
export const EnumDeclarationJson = z.strictObject({
|
|
485
|
+
...declarationSharedFields,
|
|
486
|
+
...declarationTopLevelFields,
|
|
487
|
+
kind: z.literal('enum'),
|
|
488
|
+
/** Enum members: name/value pairs with optional JSDoc. */
|
|
489
|
+
members: z.array(MemberJson).default([]),
|
|
490
|
+
});
|
|
491
|
+
/** A Svelte component declaration. Has `props`, `intersects`, `acceptsChildren`. */
|
|
492
|
+
export const ComponentDeclarationJson = z.strictObject({
|
|
493
|
+
...declarationSharedFields,
|
|
494
|
+
...declarationTopLevelFields,
|
|
495
|
+
kind: z.literal('component'),
|
|
496
|
+
/**
|
|
497
|
+
* Types from intersection branches whose properties are all external (filtered out of `props`).
|
|
498
|
+
*
|
|
499
|
+
* @see `TypeDeclarationJson.intersects`, `ClassDeclarationJson.extends`,
|
|
500
|
+
* `ClassDeclarationJson.implements`, `InterfaceDeclarationJson.extends`
|
|
501
|
+
* for sibling "related type identifiers" fields. Field shapes mirror TS syntax.
|
|
502
|
+
*/
|
|
503
|
+
intersects: z.array(z.string()).default([]),
|
|
504
|
+
/** Svelte component props. */
|
|
505
|
+
props: z.array(ComponentPropJson).default([]),
|
|
506
|
+
/** Whether the component accepts children (explicit `children` prop, inherited, or implicit template usage). */
|
|
507
|
+
acceptsChildren: z.boolean().default(false),
|
|
508
|
+
/** Script language. `undefined` means TypeScript (default), `'js'` for JavaScript-only components. */
|
|
509
|
+
lang: z.enum(['js']).optional(),
|
|
510
|
+
});
|
|
511
|
+
/** A Svelte snippet declaration exported from `<script module>`. Has `parameters`. */
|
|
512
|
+
export const SnippetDeclarationJson = z.strictObject({
|
|
513
|
+
...declarationSharedFields,
|
|
514
|
+
...declarationTopLevelFields,
|
|
515
|
+
kind: z.literal('snippet'),
|
|
516
|
+
/** Snippet parameters. */
|
|
517
|
+
parameters: z.array(ParameterJson).default([]),
|
|
518
|
+
});
|
|
519
|
+
/**
|
|
520
|
+
* A namespace re-export binding: `export * as ns from './x'`.
|
|
521
|
+
*
|
|
522
|
+
* Carries no inline members — `module` points to the source module whose
|
|
523
|
+
* declarations are projected under this name. Consumers that want to render
|
|
524
|
+
* `ns.a` can deref by reading the source module's `declarations` array.
|
|
525
|
+
*/
|
|
526
|
+
export const NamespaceDeclarationJson = z.strictObject({
|
|
527
|
+
...declarationSharedFields,
|
|
528
|
+
...declarationTopLevelFields,
|
|
529
|
+
kind: z.literal('namespace'),
|
|
530
|
+
/** Source module path (relative to `sourceRoot`) projected under this binding. */
|
|
531
|
+
module: z.string(),
|
|
532
|
+
});
|
|
533
|
+
/**
|
|
534
|
+
* Metadata for an exported declaration (function, type, class, component, etc.).
|
|
535
|
+
*
|
|
536
|
+
* Discriminated union on `kind` — each variant has only the fields relevant to that kind.
|
|
537
|
+
* Use `isKind` (in `declaration-helpers.ts`) to narrow, or check `declaration.kind` directly.
|
|
538
|
+
*/
|
|
539
|
+
export const DeclarationJson = z.discriminatedUnion('kind', [
|
|
540
|
+
FunctionDeclarationJson,
|
|
541
|
+
ClassDeclarationJson,
|
|
542
|
+
InterfaceDeclarationJson,
|
|
543
|
+
TypeDeclarationJson,
|
|
544
|
+
VariableDeclarationJson,
|
|
545
|
+
EnumDeclarationJson,
|
|
546
|
+
ComponentDeclarationJson,
|
|
547
|
+
SnippetDeclarationJson,
|
|
548
|
+
NamespaceDeclarationJson,
|
|
549
|
+
]);
|
|
550
|
+
/**
|
|
551
|
+
* Metadata for a source module — the top-level container in the data model.
|
|
552
|
+
*
|
|
553
|
+
* `analyze` and `analyzeFromFiles` return `Array<ModuleJson>` sorted alphabetically by `path`.
|
|
554
|
+
* Each module contains its exported `declarations`, dependency graph, and optional `moduleComment`.
|
|
555
|
+
*/
|
|
556
|
+
export const ModuleJson = z.strictObject({
|
|
557
|
+
/**
|
|
558
|
+
* Path relative to `sourceRoot` (e.g., `helpers.ts` for the default
|
|
559
|
+
* SvelteKit `src/lib` layout). `sourceRoot` is configurable via
|
|
560
|
+
* `createSourceOptions` / the CLI `--source-root` flag — consumers with a
|
|
561
|
+
* custom layout (e.g., `sourcePaths: ['src/lib', 'src/routes']`,
|
|
562
|
+
* `sourceRoot: 'src'`) see prefixes like `lib/foo.ts` here.
|
|
563
|
+
*/
|
|
564
|
+
path: z.string(),
|
|
565
|
+
/** Exported declarations from this module. */
|
|
566
|
+
declarations: z.array(DeclarationJson).default([]),
|
|
567
|
+
/** File-level JSDoc comment (from `@module` tag). */
|
|
568
|
+
moduleComment: z.string().optional(),
|
|
569
|
+
/** Modules this imports (paths relative to `sourceRoot`). */
|
|
570
|
+
dependencies: z.array(z.string()).default([]),
|
|
571
|
+
/** Modules that import this (paths relative to `sourceRoot`). */
|
|
572
|
+
dependents: z.array(z.string()).default([]),
|
|
573
|
+
/**
|
|
574
|
+
* Modules fully re-exported via `export * from './module'`.
|
|
575
|
+
* Paths are relative to `sourceRoot`.
|
|
576
|
+
*/
|
|
577
|
+
starExports: z.array(z.string()).default([]),
|
|
578
|
+
/**
|
|
579
|
+
* Whether the module is a placeholder for a file that couldn't be analyzed.
|
|
580
|
+
*
|
|
581
|
+
* Currently only set for Svelte files where svelte2tsx threw at ingest
|
|
582
|
+
* (the `transform_failed` diagnostic carries the error). Placeholder
|
|
583
|
+
* modules have `declarations: []` and serve as a structural slot so the
|
|
584
|
+
* `modules` array reflects the full owned set; consumers render them as
|
|
585
|
+
* "broken" entries.
|
|
586
|
+
*/
|
|
587
|
+
partial: z.boolean().default(false),
|
|
588
|
+
});
|