@fuzdev/fuz_ui 0.194.0 → 0.195.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/dist/DeclarationDetail.svelte +139 -64
- package/dist/DeclarationDetail.svelte.d.ts +9 -0
- package/dist/DeclarationDetail.svelte.d.ts.map +1 -1
- package/dist/LibraryDetail.svelte +14 -10
- package/dist/LibraryDetail.svelte.d.ts +7 -0
- package/dist/LibraryDetail.svelte.d.ts.map +1 -1
- package/dist/declaration.svelte.d.ts +233 -25
- package/dist/declaration.svelte.d.ts.map +1 -1
- package/dist/declaration.svelte.js +71 -23
- package/dist/library.svelte.js +1 -1
- package/dist/library_gen.d.ts +24 -17
- package/dist/library_gen.d.ts.map +1 -1
- package/dist/library_gen.js +52 -32
- package/dist/library_output.d.ts +5 -4
- package/dist/library_output.d.ts.map +1 -1
- package/dist/library_output.js +11 -8
- package/dist/module.svelte.d.ts +21 -7
- package/dist/module.svelte.d.ts.map +1 -1
- package/dist/module.svelte.js +26 -11
- package/dist/tsdoc_mdz.d.ts +6 -1
- package/dist/tsdoc_mdz.d.ts.map +1 -1
- package/dist/tsdoc_mdz.js +23 -2
- package/package.json +10 -8
- package/src/lib/declaration.svelte.ts +90 -35
- package/src/lib/library.svelte.ts +1 -1
- package/src/lib/library_gen.ts +65 -42
- package/src/lib/library_output.ts +11 -8
- package/src/lib/module.svelte.ts +29 -16
- package/src/lib/tsdoc_mdz.ts +25 -2
- package/dist/analysis_context.d.ts +0 -199
- package/dist/analysis_context.d.ts.map +0 -1
- package/dist/analysis_context.js +0 -138
- package/dist/library_analysis.d.ts +0 -112
- package/dist/library_analysis.d.ts.map +0 -1
- package/dist/library_analysis.js +0 -106
- package/dist/library_generate.d.ts +0 -94
- package/dist/library_generate.d.ts.map +0 -1
- package/dist/library_generate.js +0 -147
- package/dist/library_pipeline.d.ts +0 -113
- package/dist/library_pipeline.d.ts.map +0 -1
- package/dist/library_pipeline.js +0 -160
- package/dist/module_helpers.d.ts +0 -334
- package/dist/module_helpers.d.ts.map +0 -1
- package/dist/module_helpers.js +0 -317
- package/dist/svelte_helpers.d.ts +0 -92
- package/dist/svelte_helpers.d.ts.map +0 -1
- package/dist/svelte_helpers.js +0 -367
- package/dist/ts_helpers.d.ts +0 -181
- package/dist/ts_helpers.d.ts.map +0 -1
- package/dist/ts_helpers.js +0 -674
- package/dist/tsdoc_helpers.d.ts +0 -119
- package/dist/tsdoc_helpers.d.ts.map +0 -1
- package/dist/tsdoc_helpers.js +0 -207
- package/src/lib/analysis_context.ts +0 -254
- package/src/lib/library_analysis.ts +0 -168
- package/src/lib/library_generate.ts +0 -215
- package/src/lib/library_pipeline.ts +0 -221
- package/src/lib/module_helpers.ts +0 -501
- package/src/lib/svelte_helpers.ts +0 -539
- package/src/lib/ts_helpers.ts +0 -862
- package/src/lib/tsdoc_helpers.ts +0 -246
|
@@ -1,18 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { DeclarationJsonInput } from 'svelte-docinfo/types.js';
|
|
2
2
|
import type { Module } from './module.svelte.js';
|
|
3
3
|
/**
|
|
4
4
|
* Rich runtime representation of an exported declaration.
|
|
5
|
+
*
|
|
6
|
+
* Wraps svelte-docinfo's `DeclarationJson` discriminated union (on `kind`)
|
|
7
|
+
* with Svelte 5 reactive derivations and computed URLs.
|
|
8
|
+
* Kind-specific fields are accessed via the `field()` helper since
|
|
9
|
+
* not all fields exist on all variants.
|
|
10
|
+
*
|
|
11
|
+
* @see {@link https://github.com/ryanatkn/svelte-docinfo svelte-docinfo} for the analysis library
|
|
12
|
+
* @see `DeclarationDetail.svelte` for the rendering component
|
|
5
13
|
*/
|
|
6
14
|
export declare class Declaration {
|
|
7
15
|
readonly module: Module;
|
|
8
|
-
readonly declaration_json:
|
|
16
|
+
readonly declaration_json: DeclarationJsonInput;
|
|
9
17
|
library: import("./library.svelte.ts").Library;
|
|
10
18
|
/**
|
|
11
19
|
* Module path where this declaration is defined.
|
|
12
20
|
*/
|
|
13
21
|
module_path: string;
|
|
14
22
|
name: string;
|
|
15
|
-
kind: "function" | "class" | "type" | "
|
|
23
|
+
kind: "function" | "class" | "type" | "variable" | "component" | "interface" | "enum" | "snippet" | "namespace";
|
|
16
24
|
/**
|
|
17
25
|
* GitHub source URL with line number.
|
|
18
26
|
*/
|
|
@@ -37,57 +45,257 @@ export declare class Declaration {
|
|
|
37
45
|
doc_comment: string | undefined;
|
|
38
46
|
deprecated_message: string | undefined;
|
|
39
47
|
parameters: {
|
|
40
|
-
[x: string]: unknown;
|
|
41
48
|
name: string;
|
|
42
49
|
type: string;
|
|
43
50
|
optional?: boolean | undefined;
|
|
51
|
+
rest?: boolean | undefined;
|
|
44
52
|
description?: string | undefined;
|
|
45
|
-
|
|
53
|
+
defaultValue?: string | undefined;
|
|
46
54
|
}[] | undefined;
|
|
47
55
|
props: {
|
|
48
|
-
[x: string]: unknown;
|
|
49
56
|
name: string;
|
|
50
57
|
type: string;
|
|
51
|
-
optional?: boolean | undefined;
|
|
52
|
-
description?: string | undefined;
|
|
53
|
-
default_value?: string | undefined;
|
|
54
|
-
bindable?: boolean | undefined;
|
|
55
58
|
examples?: string[] | undefined;
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
deprecatedMessage?: string | undefined;
|
|
60
|
+
seeAlso?: string[] | undefined;
|
|
58
61
|
throws?: {
|
|
59
|
-
[x: string]: unknown;
|
|
60
62
|
description: string;
|
|
61
63
|
type?: string | undefined;
|
|
62
64
|
}[] | undefined;
|
|
63
65
|
since?: string | undefined;
|
|
66
|
+
optional?: boolean | undefined;
|
|
67
|
+
description?: string | undefined;
|
|
68
|
+
defaultValue?: string | undefined;
|
|
69
|
+
bindable?: boolean | undefined;
|
|
70
|
+
parameters?: {
|
|
71
|
+
name: string;
|
|
72
|
+
type: string;
|
|
73
|
+
optional?: boolean | undefined;
|
|
74
|
+
rest?: boolean | undefined;
|
|
75
|
+
description?: string | undefined;
|
|
76
|
+
defaultValue?: string | undefined;
|
|
77
|
+
}[] | undefined;
|
|
64
78
|
}[] | undefined;
|
|
65
79
|
return_type: string | undefined;
|
|
66
80
|
return_description: string | undefined;
|
|
67
81
|
generic_params: {
|
|
68
|
-
[x: string]: unknown;
|
|
69
82
|
name: string;
|
|
70
83
|
constraint?: string | undefined;
|
|
71
|
-
|
|
72
|
-
}[]
|
|
73
|
-
|
|
74
|
-
|
|
84
|
+
defaultType?: string | undefined;
|
|
85
|
+
}[];
|
|
86
|
+
extends_type: string | string[] | undefined;
|
|
87
|
+
implements_types: string[] | undefined;
|
|
75
88
|
throws: {
|
|
76
|
-
[x: string]: unknown;
|
|
77
89
|
description: string;
|
|
78
90
|
type?: string | undefined;
|
|
79
|
-
}[]
|
|
91
|
+
}[];
|
|
80
92
|
since: string | undefined;
|
|
81
|
-
examples: string[]
|
|
82
|
-
see_also: string[]
|
|
83
|
-
|
|
84
|
-
|
|
93
|
+
examples: string[];
|
|
94
|
+
see_also: string[];
|
|
95
|
+
/**
|
|
96
|
+
* Nested members for classes, interfaces, types, and enums.
|
|
97
|
+
*/
|
|
98
|
+
members: ({
|
|
99
|
+
kind: "function";
|
|
100
|
+
name: string;
|
|
101
|
+
optional?: boolean | undefined;
|
|
102
|
+
returnType?: string | undefined;
|
|
103
|
+
returnDescription?: string | undefined;
|
|
104
|
+
parameters?: {
|
|
105
|
+
name: string;
|
|
106
|
+
type: string;
|
|
107
|
+
optional?: boolean | undefined;
|
|
108
|
+
rest?: boolean | undefined;
|
|
109
|
+
description?: string | undefined;
|
|
110
|
+
defaultValue?: string | undefined;
|
|
111
|
+
}[] | undefined;
|
|
112
|
+
overloads?: {
|
|
113
|
+
typeSignature: string;
|
|
114
|
+
parameters?: {
|
|
115
|
+
name: string;
|
|
116
|
+
type: string;
|
|
117
|
+
optional?: boolean | undefined;
|
|
118
|
+
rest?: boolean | undefined;
|
|
119
|
+
description?: string | undefined;
|
|
120
|
+
defaultValue?: string | undefined;
|
|
121
|
+
}[] | undefined;
|
|
122
|
+
returnType?: string | undefined;
|
|
123
|
+
genericParams?: {
|
|
124
|
+
name: string;
|
|
125
|
+
constraint?: string | undefined;
|
|
126
|
+
defaultType?: string | undefined;
|
|
127
|
+
}[] | undefined;
|
|
128
|
+
docComment?: string | undefined;
|
|
129
|
+
returnDescription?: string | undefined;
|
|
130
|
+
}[] | undefined;
|
|
131
|
+
mutates?: Record<string, string> | undefined;
|
|
132
|
+
partial?: boolean | undefined;
|
|
133
|
+
examples?: string[] | undefined;
|
|
134
|
+
deprecatedMessage?: string | undefined;
|
|
135
|
+
seeAlso?: string[] | undefined;
|
|
136
|
+
throws?: {
|
|
137
|
+
description: string;
|
|
138
|
+
type?: string | undefined;
|
|
139
|
+
}[] | undefined;
|
|
140
|
+
since?: string | undefined;
|
|
141
|
+
docComment?: string | undefined;
|
|
142
|
+
typeSignature?: string | undefined;
|
|
143
|
+
modifiers?: ("public" | "protected" | "readonly" | "static" | "abstract" | "getter" | "setter")[] | undefined;
|
|
144
|
+
sourceLine?: number | undefined;
|
|
145
|
+
genericParams?: {
|
|
146
|
+
name: string;
|
|
147
|
+
constraint?: string | undefined;
|
|
148
|
+
defaultType?: string | undefined;
|
|
149
|
+
}[] | undefined;
|
|
150
|
+
} | {
|
|
151
|
+
kind: "variable";
|
|
152
|
+
name: string;
|
|
153
|
+
optional?: boolean | undefined;
|
|
154
|
+
reactivity?: "$state" | "$state.raw" | "$derived" | "$derived.by" | undefined;
|
|
155
|
+
defaultValue?: string | undefined;
|
|
156
|
+
mutates?: Record<string, string> | undefined;
|
|
157
|
+
partial?: boolean | undefined;
|
|
158
|
+
examples?: string[] | undefined;
|
|
159
|
+
deprecatedMessage?: string | undefined;
|
|
160
|
+
seeAlso?: string[] | undefined;
|
|
161
|
+
throws?: {
|
|
162
|
+
description: string;
|
|
163
|
+
type?: string | undefined;
|
|
164
|
+
}[] | undefined;
|
|
165
|
+
since?: string | undefined;
|
|
166
|
+
docComment?: string | undefined;
|
|
167
|
+
typeSignature?: string | undefined;
|
|
168
|
+
modifiers?: ("public" | "protected" | "readonly" | "static" | "abstract" | "getter" | "setter")[] | undefined;
|
|
169
|
+
sourceLine?: number | undefined;
|
|
170
|
+
genericParams?: {
|
|
171
|
+
name: string;
|
|
172
|
+
constraint?: string | undefined;
|
|
173
|
+
defaultType?: string | undefined;
|
|
174
|
+
}[] | undefined;
|
|
175
|
+
} | {
|
|
176
|
+
kind: "constructor";
|
|
177
|
+
name: "constructor" | "(construct)";
|
|
178
|
+
parameters?: {
|
|
179
|
+
name: string;
|
|
180
|
+
type: string;
|
|
181
|
+
optional?: boolean | undefined;
|
|
182
|
+
rest?: boolean | undefined;
|
|
183
|
+
description?: string | undefined;
|
|
184
|
+
defaultValue?: string | undefined;
|
|
185
|
+
}[] | undefined;
|
|
186
|
+
overloads?: {
|
|
187
|
+
typeSignature: string;
|
|
188
|
+
parameters?: {
|
|
189
|
+
name: string;
|
|
190
|
+
type: string;
|
|
191
|
+
optional?: boolean | undefined;
|
|
192
|
+
rest?: boolean | undefined;
|
|
193
|
+
description?: string | undefined;
|
|
194
|
+
defaultValue?: string | undefined;
|
|
195
|
+
}[] | undefined;
|
|
196
|
+
returnType?: string | undefined;
|
|
197
|
+
genericParams?: {
|
|
198
|
+
name: string;
|
|
199
|
+
constraint?: string | undefined;
|
|
200
|
+
defaultType?: string | undefined;
|
|
201
|
+
}[] | undefined;
|
|
202
|
+
docComment?: string | undefined;
|
|
203
|
+
returnDescription?: string | undefined;
|
|
204
|
+
}[] | undefined;
|
|
205
|
+
mutates?: Record<string, string> | undefined;
|
|
206
|
+
partial?: boolean | undefined;
|
|
207
|
+
examples?: string[] | undefined;
|
|
208
|
+
deprecatedMessage?: string | undefined;
|
|
209
|
+
seeAlso?: string[] | undefined;
|
|
210
|
+
throws?: {
|
|
211
|
+
description: string;
|
|
212
|
+
type?: string | undefined;
|
|
213
|
+
}[] | undefined;
|
|
214
|
+
since?: string | undefined;
|
|
215
|
+
docComment?: string | undefined;
|
|
216
|
+
typeSignature?: string | undefined;
|
|
217
|
+
modifiers?: ("public" | "protected" | "readonly" | "static" | "abstract" | "getter" | "setter")[] | undefined;
|
|
218
|
+
sourceLine?: number | undefined;
|
|
219
|
+
genericParams?: {
|
|
220
|
+
name: string;
|
|
221
|
+
constraint?: string | undefined;
|
|
222
|
+
defaultType?: string | undefined;
|
|
223
|
+
}[] | undefined;
|
|
224
|
+
})[] | undefined;
|
|
225
|
+
/**
|
|
226
|
+
* Intersection types whose properties are external (filtered out of props/members).
|
|
227
|
+
* Present on `component` and `type` kinds.
|
|
228
|
+
*/
|
|
229
|
+
intersects: string[] | undefined;
|
|
230
|
+
/**
|
|
231
|
+
* Whether a component accepts children via props or template usage.
|
|
232
|
+
* Present on `component` kind only.
|
|
233
|
+
*/
|
|
234
|
+
accepts_children: boolean | undefined;
|
|
235
|
+
/**
|
|
236
|
+
* Function overload signatures when multiple public overloads exist.
|
|
237
|
+
* Present on `function` and `snippet` kinds, and on function/constructor members.
|
|
238
|
+
*/
|
|
239
|
+
overloads: {
|
|
240
|
+
typeSignature: string;
|
|
241
|
+
parameters?: {
|
|
242
|
+
name: string;
|
|
243
|
+
type: string;
|
|
244
|
+
optional?: boolean | undefined;
|
|
245
|
+
rest?: boolean | undefined;
|
|
246
|
+
description?: string | undefined;
|
|
247
|
+
defaultValue?: string | undefined;
|
|
248
|
+
}[] | undefined;
|
|
249
|
+
returnType?: string | undefined;
|
|
250
|
+
genericParams?: {
|
|
251
|
+
name: string;
|
|
252
|
+
constraint?: string | undefined;
|
|
253
|
+
defaultType?: string | undefined;
|
|
254
|
+
}[] | undefined;
|
|
255
|
+
docComment?: string | undefined;
|
|
256
|
+
returnDescription?: string | undefined;
|
|
257
|
+
}[] | undefined;
|
|
258
|
+
/**
|
|
259
|
+
* Re-export alias info when this declaration is a renamed re-export.
|
|
260
|
+
*/
|
|
261
|
+
alias_of: {
|
|
262
|
+
module: string;
|
|
263
|
+
name: string;
|
|
264
|
+
} | {
|
|
265
|
+
module: string;
|
|
266
|
+
name: string;
|
|
267
|
+
} | {
|
|
268
|
+
module: string;
|
|
269
|
+
name: string;
|
|
270
|
+
} | {
|
|
271
|
+
module: string;
|
|
272
|
+
name: string;
|
|
273
|
+
} | {
|
|
274
|
+
module: string;
|
|
275
|
+
name: string;
|
|
276
|
+
} | {
|
|
277
|
+
module: string;
|
|
278
|
+
name: string;
|
|
279
|
+
} | {
|
|
280
|
+
module: string;
|
|
281
|
+
name: string;
|
|
282
|
+
} | {
|
|
283
|
+
module: string;
|
|
284
|
+
name: string;
|
|
285
|
+
} | {
|
|
286
|
+
module: string;
|
|
287
|
+
name: string;
|
|
288
|
+
} | undefined;
|
|
289
|
+
/**
|
|
290
|
+
* Mutation documentation from `@mutates` tags, mapping parameter names to descriptions.
|
|
291
|
+
*/
|
|
292
|
+
mutates: Record<string, string> | undefined;
|
|
85
293
|
has_examples: boolean;
|
|
86
294
|
is_deprecated: boolean;
|
|
87
295
|
has_documentation: boolean;
|
|
88
296
|
has_parameters: boolean;
|
|
89
297
|
has_props: boolean;
|
|
90
298
|
has_generics: boolean;
|
|
91
|
-
constructor(module: Module, declaration_json:
|
|
299
|
+
constructor(module: Module, declaration_json: DeclarationJsonInput);
|
|
92
300
|
}
|
|
93
301
|
//# sourceMappingURL=declaration.svelte.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declaration.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/declaration.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"declaration.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/declaration.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEX,oBAAoB,EAKpB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,oBAAoB,CAAC;AAa/C;;;;;;;;;;GAUG;AACH,qBAAa,WAAW;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAi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IlE"}
|
|
@@ -1,8 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { generateImport, getDisplayName } from 'svelte-docinfo/declaration-helpers.js';
|
|
2
2
|
import { url_github_file } from './package_helpers.js';
|
|
3
|
-
|
|
3
|
+
// `library.json` is serialized with svelte-docinfo's `compactReplacer`, which
|
|
4
|
+
// strips empty default arrays — so the on-disk data is the `*Input` shape
|
|
5
|
+
// (defaulted arrays optional), not the parsed `*Json` shape. Typing it as
|
|
6
|
+
// input makes TypeScript force a guard on every defaulted-array read.
|
|
7
|
+
//
|
|
8
|
+
// Helper to access kind-specific fields on the discriminated union.
|
|
9
|
+
// At runtime the field is present or undefined; TypeScript needs the cast.
|
|
10
|
+
const field = (decl, key) => decl[key];
|
|
4
11
|
/**
|
|
5
12
|
* Rich runtime representation of an exported declaration.
|
|
13
|
+
*
|
|
14
|
+
* Wraps svelte-docinfo's `DeclarationJson` discriminated union (on `kind`)
|
|
15
|
+
* with Svelte 5 reactive derivations and computed URLs.
|
|
16
|
+
* Kind-specific fields are accessed via the `field()` helper since
|
|
17
|
+
* not all fields exist on all variants.
|
|
18
|
+
*
|
|
19
|
+
* @see {@link https://github.com/ryanatkn/svelte-docinfo svelte-docinfo} for the analysis library
|
|
20
|
+
* @see `DeclarationDetail.svelte` for the rendering component
|
|
6
21
|
*/
|
|
7
22
|
export class Declaration {
|
|
8
23
|
module = $state.raw();
|
|
@@ -17,8 +32,8 @@ export class Declaration {
|
|
|
17
32
|
/**
|
|
18
33
|
* GitHub source URL with line number.
|
|
19
34
|
*/
|
|
20
|
-
url_github = $derived(this.library.repo_url && this.declaration_json.
|
|
21
|
-
? url_github_file(this.library.repo_url, `src/lib/${this.module_path}`, this.declaration_json.
|
|
35
|
+
url_github = $derived(this.library.repo_url && this.declaration_json.sourceLine
|
|
36
|
+
? url_github_file(this.library.repo_url, `src/lib/${this.module_path}`, this.declaration_json.sourceLine)
|
|
22
37
|
: undefined);
|
|
23
38
|
/**
|
|
24
39
|
* API documentation URL.
|
|
@@ -27,7 +42,10 @@ export class Declaration {
|
|
|
27
42
|
/**
|
|
28
43
|
* Generated TypeScript import statement.
|
|
29
44
|
*/
|
|
30
|
-
import_statement = $derived(
|
|
45
|
+
import_statement = $derived(
|
|
46
|
+
// `generateImport` reads only `name`/`kind`/path, none of the defaulted
|
|
47
|
+
// arrays, so asserting the parsed shape here is sound.
|
|
48
|
+
generateImport(this.declaration_json, this.module_path, this.library.package_json.name));
|
|
31
49
|
/**
|
|
32
50
|
* Public documentation link (if homepage_url is available).
|
|
33
51
|
*/
|
|
@@ -37,29 +55,59 @@ export class Declaration {
|
|
|
37
55
|
/**
|
|
38
56
|
* Display name with generic parameters.
|
|
39
57
|
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
58
|
+
// `getDisplayName` reads `genericParams` unguarded, so feed it the defaulted
|
|
59
|
+
// value rather than the raw (possibly-absent) input field.
|
|
60
|
+
display_name = $derived(getDisplayName({
|
|
61
|
+
...this.declaration_json,
|
|
62
|
+
genericParams: this.declaration_json.genericParams ?? [],
|
|
63
|
+
}));
|
|
64
|
+
type_signature = $derived(this.declaration_json.typeSignature);
|
|
65
|
+
doc_comment = $derived(this.declaration_json.docComment);
|
|
66
|
+
deprecated_message = $derived(this.declaration_json.deprecatedMessage);
|
|
67
|
+
parameters = $derived(field(this.declaration_json, 'parameters'));
|
|
68
|
+
props = $derived(field(this.declaration_json, 'props'));
|
|
69
|
+
return_type = $derived(field(this.declaration_json, 'returnType'));
|
|
70
|
+
return_description = $derived(field(this.declaration_json, 'returnDescription'));
|
|
71
|
+
generic_params = $derived(this.declaration_json.genericParams ?? []);
|
|
72
|
+
extends_type = $derived(field(this.declaration_json, 'extends'));
|
|
73
|
+
implements_types = $derived(field(this.declaration_json, 'implements'));
|
|
74
|
+
throws = $derived(this.declaration_json.throws ?? []);
|
|
52
75
|
since = $derived(this.declaration_json.since);
|
|
53
|
-
examples = $derived(this.declaration_json.examples);
|
|
54
|
-
see_also = $derived(this.declaration_json.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
76
|
+
examples = $derived(this.declaration_json.examples ?? []);
|
|
77
|
+
see_also = $derived(this.declaration_json.seeAlso ?? []);
|
|
78
|
+
/**
|
|
79
|
+
* Nested members for classes, interfaces, types, and enums.
|
|
80
|
+
*/
|
|
81
|
+
members = $derived(field(this.declaration_json, 'members'));
|
|
82
|
+
/**
|
|
83
|
+
* Intersection types whose properties are external (filtered out of props/members).
|
|
84
|
+
* Present on `component` and `type` kinds.
|
|
85
|
+
*/
|
|
86
|
+
intersects = $derived(field(this.declaration_json, 'intersects'));
|
|
87
|
+
/**
|
|
88
|
+
* Whether a component accepts children via props or template usage.
|
|
89
|
+
* Present on `component` kind only.
|
|
90
|
+
*/
|
|
91
|
+
accepts_children = $derived(field(this.declaration_json, 'acceptsChildren'));
|
|
92
|
+
/**
|
|
93
|
+
* Function overload signatures when multiple public overloads exist.
|
|
94
|
+
* Present on `function` and `snippet` kinds, and on function/constructor members.
|
|
95
|
+
*/
|
|
96
|
+
overloads = $derived(field(this.declaration_json, 'overloads'));
|
|
97
|
+
/**
|
|
98
|
+
* Re-export alias info when this declaration is a renamed re-export.
|
|
99
|
+
*/
|
|
100
|
+
alias_of = $derived(this.declaration_json.aliasOf);
|
|
101
|
+
/**
|
|
102
|
+
* Mutation documentation from `@mutates` tags, mapping parameter names to descriptions.
|
|
103
|
+
*/
|
|
104
|
+
mutates = $derived(this.declaration_json.mutates);
|
|
105
|
+
has_examples = $derived(this.examples.length > 0);
|
|
58
106
|
is_deprecated = $derived(!!this.deprecated_message);
|
|
59
107
|
has_documentation = $derived(!!this.doc_comment);
|
|
60
108
|
has_parameters = $derived(!!(this.parameters && this.parameters.length > 0));
|
|
61
109
|
has_props = $derived(!!(this.props && this.props.length > 0));
|
|
62
|
-
has_generics = $derived(
|
|
110
|
+
has_generics = $derived(this.generic_params.length > 0);
|
|
63
111
|
constructor(module, declaration_json) {
|
|
64
112
|
this.module = module;
|
|
65
113
|
this.declaration_json = declaration_json;
|
package/dist/library.svelte.js
CHANGED
|
@@ -52,7 +52,7 @@ export class Library {
|
|
|
52
52
|
* All modules as rich `Module` instances.
|
|
53
53
|
*/
|
|
54
54
|
modules = $derived(this.source_json.modules
|
|
55
|
-
? this.source_json.modules.map((module_json) => new Module(this, module_json))
|
|
55
|
+
? this.source_json.modules.map((module_json) => new Module(this, module_json)) // TODO: remove cast when fuz_util SourceJson uses svelte-docinfo types
|
|
56
56
|
: []);
|
|
57
57
|
/**
|
|
58
58
|
* All modules sorted alphabetically by path.
|
package/dist/library_gen.d.ts
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Gro-specific library metadata generation.
|
|
3
3
|
*
|
|
4
|
-
* This module provides Gro integration for library generation. It
|
|
5
|
-
* `
|
|
6
|
-
*
|
|
4
|
+
* This module provides Gro integration for library generation. It uses svelte-docinfo's
|
|
5
|
+
* pure analysis (`analyze`) and wraps the results with fuz_ui's opinionated
|
|
6
|
+
* LibraryJson format (GitHub/npm metadata).
|
|
7
7
|
*
|
|
8
|
-
* For build-tool agnostic usage, see `
|
|
8
|
+
* For build-tool agnostic usage, see `svelte-docinfo`.
|
|
9
9
|
*
|
|
10
|
-
* @see
|
|
11
|
-
* @see
|
|
12
|
-
* @see
|
|
10
|
+
* @see svelte-docinfo/analyze.js for the generic analysis entry point
|
|
11
|
+
* @see svelte-docinfo/postprocess.js for post-processing helpers
|
|
12
|
+
* @see library_output.js for output file generation
|
|
13
13
|
*
|
|
14
14
|
* @module
|
|
15
15
|
*/
|
|
16
16
|
import type { Gen } from '@fuzdev/gro';
|
|
17
17
|
import type { Disknode } from '@fuzdev/gro/disknode.js';
|
|
18
|
-
import { type
|
|
19
|
-
import { type OnDuplicatesCallback } from './library_generate.js';
|
|
18
|
+
import { type ModuleSourceOptions, type OnDuplicatesCallback, type SourceFileInfo, type SourceOptionsDefaults } from 'svelte-docinfo';
|
|
20
19
|
/** Options for Gro library generation. */
|
|
21
20
|
export interface LibraryGenOptions {
|
|
22
21
|
/**
|
|
@@ -26,17 +25,17 @@ export interface LibraryGenOptions {
|
|
|
26
25
|
* merged with defaults. The `project_root` is automatically set to
|
|
27
26
|
* `process.cwd()` if not provided.
|
|
28
27
|
*/
|
|
29
|
-
source?: ModuleSourceOptions | Partial<
|
|
28
|
+
source?: ModuleSourceOptions | Partial<SourceOptionsDefaults>;
|
|
30
29
|
/**
|
|
31
30
|
* Callback invoked when duplicate declaration names are found.
|
|
32
31
|
*
|
|
33
32
|
* Consumers decide how to handle duplicates: throw, warn, or ignore.
|
|
34
|
-
* Use `
|
|
33
|
+
* Use `throwOnDuplicates` for strict flat namespace enforcement.
|
|
35
34
|
*
|
|
36
35
|
* @example
|
|
37
36
|
* ```ts
|
|
38
37
|
* // Throw on duplicates (strict flat namespace)
|
|
39
|
-
* library_gen({ on_duplicates:
|
|
38
|
+
* library_gen({ on_duplicates: throwOnDuplicates });
|
|
40
39
|
*
|
|
41
40
|
* // Warn but continue
|
|
42
41
|
* library_gen({
|
|
@@ -53,7 +52,13 @@ export interface LibraryGenOptions {
|
|
|
53
52
|
/**
|
|
54
53
|
* Convert Gro's `Disknode` to the build-tool agnostic `SourceFileInfo` interface.
|
|
55
54
|
*
|
|
56
|
-
* Use this when you want to analyze files using Gro's filer directly.
|
|
55
|
+
* Use this when you want to analyze files using Gro's filer directly. The
|
|
56
|
+
* `dependencies` field is populated from the filer's forward-edge graph — the
|
|
57
|
+
* svelte-docinfo session honors it as pre-resolved input and skips its own
|
|
58
|
+
* lex+resolve pass for these files, avoiding duplicate work the filer already did.
|
|
59
|
+
*
|
|
60
|
+
* Reverse edges (`dependents`) are not threaded through — svelte-docinfo
|
|
61
|
+
* computes them internally from the forward edges of the owned set.
|
|
57
62
|
*
|
|
58
63
|
* @throws Error if disknode has no content (should be loaded by Gro filer)
|
|
59
64
|
*/
|
|
@@ -62,7 +67,7 @@ export declare const source_file_from_disknode: (disknode: Disknode) => SourceFi
|
|
|
62
67
|
* Collect source files from Gro disknodes, filtering BEFORE conversion to `SourceFileInfo`.
|
|
63
68
|
*
|
|
64
69
|
* This avoids errors from files outside source directories (like test fixtures that may
|
|
65
|
-
* have malformed paths or missing content). The filtering uses `
|
|
70
|
+
* have malformed paths or missing content). The filtering uses `isSource` which
|
|
66
71
|
* checks `source_paths` to only include files in configured source directories.
|
|
67
72
|
*
|
|
68
73
|
* @param disknodes - iterator of Gro disknodes from filer
|
|
@@ -78,10 +83,12 @@ export declare const library_collect_source_files_from_disknodes: (disknodes: It
|
|
|
78
83
|
*
|
|
79
84
|
* This is the Gro-specific entry point. It handles:
|
|
80
85
|
* - Reading files from Gro's filer
|
|
81
|
-
* - Loading
|
|
82
|
-
* -
|
|
86
|
+
* - Loading package.json via Gro utilities
|
|
87
|
+
* - Analyzing source with svelte-docinfo (pure analysis)
|
|
88
|
+
* - Wrapping with LibraryJson (GitHub/npm metadata)
|
|
89
|
+
* - Returning output in Gro's Gen format
|
|
83
90
|
*
|
|
84
|
-
* For build-tool agnostic usage, use `
|
|
91
|
+
* For build-tool agnostic usage, use `analyze` directly.
|
|
85
92
|
*
|
|
86
93
|
* Usage in a `.gen.ts` file:
|
|
87
94
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"library_gen.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/library_gen.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,aAAa,CAAC;AAErC,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"library_gen.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/library_gen.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;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