svelte-docinfo 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analyze-core.d.ts +30 -1
- package/dist/analyze-core.d.ts.map +1 -1
- package/dist/analyze-core.js +3 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/package.json +6 -13
- package/virtual-svelte-docinfo.d.ts +12 -12
package/dist/analyze-core.d.ts
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
*/
|
|
28
28
|
import ts from 'typescript';
|
|
29
29
|
import { z } from 'zod';
|
|
30
|
-
import { ModuleJson } from './types.js';
|
|
30
|
+
import { ModuleJson, type ModuleJsonInput } from './types.js';
|
|
31
31
|
import type { ReExportInfo } from './declaration-build.js';
|
|
32
32
|
import { Diagnostic } from './diagnostics.js';
|
|
33
33
|
import type { AnalysisLog } from './log.js';
|
|
@@ -96,6 +96,9 @@ export declare const throwOnDuplicates: OnDuplicatesCallback;
|
|
|
96
96
|
* objects without re-running `.parse()` — the inner `modules` and
|
|
97
97
|
* `diagnostics` arrays are already Zod-validated upstream, and the envelope
|
|
98
98
|
* schema is the type contract, not a validation gate.
|
|
99
|
+
*
|
|
100
|
+
* See `AnalyzeResultJsonWire` for the serialized input-side shape published on
|
|
101
|
+
* `virtual:svelte-docinfo`.
|
|
99
102
|
*/
|
|
100
103
|
export declare const AnalyzeResultJson: z.ZodObject<{
|
|
101
104
|
modules: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -1318,6 +1321,32 @@ export declare const AnalyzeResultJson: z.ZodObject<{
|
|
|
1318
1321
|
}, z.core.$strict>], "kind">>>;
|
|
1319
1322
|
}, z.core.$strict>;
|
|
1320
1323
|
export type AnalyzeResultJson = z.infer<typeof AnalyzeResultJson>;
|
|
1324
|
+
/**
|
|
1325
|
+
* Serialized wire shape of an analysis result, as published by the Vite plugin
|
|
1326
|
+
* on `virtual:svelte-docinfo` — the input-side counterpart to
|
|
1327
|
+
* `AnalyzeResultJson` (the validated output of `.parse()`).
|
|
1328
|
+
*
|
|
1329
|
+
* The two fields are deliberately asymmetric:
|
|
1330
|
+
*
|
|
1331
|
+
* - `modules` is `ModuleJsonInput` (the `z.input` of `ModuleJson`) because the
|
|
1332
|
+
* plugin runs it through `compactReplacer`, which strips `.default([])`
|
|
1333
|
+
* arrays and `.default(false)` booleans. Default-bearing fields therefore
|
|
1334
|
+
* arrive `undefined`.
|
|
1335
|
+
* - `diagnostics` is the output `Diagnostic` — the plugin serializes it
|
|
1336
|
+
* without the replacer, and `Diagnostic` has no defaults to strip, so the
|
|
1337
|
+
* array is always present and the shape matches runtime exactly.
|
|
1338
|
+
*
|
|
1339
|
+
* Consumers restore defaults by parsing through `AnalyzeResultJson`.
|
|
1340
|
+
*
|
|
1341
|
+
* Note this describes the Vite virtual module specifically. The CLI runs the
|
|
1342
|
+
* whole envelope through `compactReplacer`, so its JSON may additionally omit
|
|
1343
|
+
* an empty `diagnostics` array — CLI consumers should parse through
|
|
1344
|
+
* `AnalyzeResultJson` rather than assume this shape.
|
|
1345
|
+
*/
|
|
1346
|
+
export interface AnalyzeResultJsonWire {
|
|
1347
|
+
modules: Array<ModuleJsonInput>;
|
|
1348
|
+
diagnostics: Array<Diagnostic>;
|
|
1349
|
+
}
|
|
1321
1350
|
/**
|
|
1322
1351
|
* Result of analyzing a single module.
|
|
1323
1352
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyze-core.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/analyze-core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"analyze-core.d.ts","sourceRoot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CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,wBAAwB,GACpC,aAAa,KAAK,CAAC,UAAU,CAAC,EAC9B,aAAa,MAAM,KACjB,IAgBF,CAAC"}
|
package/dist/analyze-core.js
CHANGED
|
@@ -113,6 +113,9 @@ const dispatchOnDuplicates = (mode, duplicates, log) => {
|
|
|
113
113
|
* objects without re-running `.parse()` — the inner `modules` and
|
|
114
114
|
* `diagnostics` arrays are already Zod-validated upstream, and the envelope
|
|
115
115
|
* schema is the type contract, not a validation gate.
|
|
116
|
+
*
|
|
117
|
+
* See `AnalyzeResultJsonWire` for the serialized input-side shape published on
|
|
118
|
+
* `virtual:svelte-docinfo`.
|
|
116
119
|
*/
|
|
117
120
|
export const AnalyzeResultJson = z.strictObject({
|
|
118
121
|
modules: z.array(ModuleJson).default([]),
|
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
export { analyze, analyzeFromFiles } from './analyze.js';
|
|
13
13
|
export type { AnalyzeOptions, AnalyzeFromFilesOptions } from './analyze.js';
|
|
14
14
|
export { throwOnDuplicates, AnalyzeResultJson } from './analyze-core.js';
|
|
15
|
-
export type { OnDuplicates, OnDuplicatesCallback } from './analyze-core.js';
|
|
15
|
+
export type { AnalyzeResultJsonWire, OnDuplicates, OnDuplicatesCallback } from './analyze-core.js';
|
|
16
16
|
export { createAnalysisSession } from './session.js';
|
|
17
17
|
export type { AnalysisSession, AnalysisSessionOptions, SetFileOptions, SetFileResult, SetFilesResult, QueryOptions, } from './session.js';
|
|
18
18
|
export { normalizeResolveImport } from './dep-resolver.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAAC,OAAO,EAAE,gBAAgB,EAAC,MAAM,cAAc,CAAC;AACvD,YAAY,EAAC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MAAM,EACN,kBAAkB,EAClB,0BAA0B,GAC1B,MAAM,0BAA0B,CAAC;AAIlC,YAAY,EAAC,cAAc,EAAE,YAAY,EAAC,MAAM,aAAa,CAAC;AAI9D,OAAO,EAAC,mBAAmB,EAAE,sBAAsB,EAAC,MAAM,oBAAoB,CAAC;AAC/E,YAAY,EAAC,mBAAmB,EAAE,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;AAInF,OAAO,EAAC,cAAc,EAAE,cAAc,EAAE,uBAAuB,EAAC,MAAM,kBAAkB,CAAC;AACzF,YAAY,EAAC,oBAAoB,EAAE,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAI1E,OAAO,EAAC,qBAAqB,EAAC,MAAM,YAAY,CAAC;AAIjD,OAAO,EAAC,mBAAmB,EAAC,MAAM,gBAAgB,CAAC;AACnD,YAAY,EACX,SAAS,EACT,0BAA0B,EAC1B,yBAAyB,GACzB,MAAM,gBAAgB,CAAC;AAIxB,OAAO,EACN,SAAS,EACT,WAAW,EACX,QAAQ,EACR,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,UAAU,GACV,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAC,WAAW,EAAC,MAAM,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-docinfo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "static analysis for TypeScript and Svelte",
|
|
5
5
|
"glyph": "📜",
|
|
6
6
|
"logo": "logo.svg",
|
|
@@ -42,20 +42,12 @@
|
|
|
42
42
|
"es-module-lexer": "^2.0.0",
|
|
43
43
|
"picomatch": "^4.0.4",
|
|
44
44
|
"tinyglobby": "^0.2.15",
|
|
45
|
-
"typescript": "^5.9.3"
|
|
46
|
-
"zod": "^4.3.6"
|
|
45
|
+
"typescript": "^5.9.3"
|
|
47
46
|
},
|
|
48
47
|
"peerDependencies": {
|
|
49
48
|
"svelte": "^5.0.0",
|
|
50
|
-
"svelte2tsx": "^0.7.30"
|
|
51
|
-
|
|
52
|
-
"peerDependenciesMeta": {
|
|
53
|
-
"svelte": {
|
|
54
|
-
"optional": true
|
|
55
|
-
},
|
|
56
|
-
"svelte2tsx": {
|
|
57
|
-
"optional": true
|
|
58
|
-
}
|
|
49
|
+
"svelte2tsx": "^0.7.30",
|
|
50
|
+
"zod": "^4"
|
|
59
51
|
},
|
|
60
52
|
"devDependencies": {
|
|
61
53
|
"@fuzdev/blake3_wasm": "^0.1.1",
|
|
@@ -87,7 +79,8 @@
|
|
|
87
79
|
"typescript-eslint": "^8.48.1",
|
|
88
80
|
"vite": "^7.3.1",
|
|
89
81
|
"vitest": "^4.0.15",
|
|
90
|
-
"zimmerframe": "^1.1.4"
|
|
82
|
+
"zimmerframe": "^1.1.4",
|
|
83
|
+
"zod": "^4.3.6"
|
|
91
84
|
},
|
|
92
85
|
"prettier": {
|
|
93
86
|
"plugins": [
|
|
@@ -10,11 +10,12 @@
|
|
|
10
10
|
*
|
|
11
11
|
* ## Wire shape vs Zod output shape
|
|
12
12
|
*
|
|
13
|
-
* The
|
|
14
|
-
*
|
|
15
|
-
* `
|
|
16
|
-
*
|
|
17
|
-
*
|
|
13
|
+
* The module's shape is `AnalyzeResultJsonWire` — the input-side counterpart
|
|
14
|
+
* to `AnalyzeResultJson`. The plugin serializes `modules` through
|
|
15
|
+
* `compactReplacer`, which strips empty arrays and `false` values to keep the
|
|
16
|
+
* bundle small. So fields like `declarations`, `members`, `props` that are
|
|
17
|
+
* `.default([])` in the schema arrive as `undefined` on any module that has
|
|
18
|
+
* none, and `.default(false)` booleans arrive as `undefined` when false.
|
|
18
19
|
*
|
|
19
20
|
* `ModuleJsonInput` (the `z.input` of `ModuleJson`) reflects this — its
|
|
20
21
|
* default-bearing fields are optional. Consumers either use optional
|
|
@@ -30,8 +31,8 @@
|
|
|
30
31
|
* `svelte.config.js` aliases `'svelte-docinfo' → 'src/lib'` (load-bearing
|
|
31
32
|
* for fuz_ui's `library_gen`, a circular dev-dep). `@sveltejs/package`
|
|
32
33
|
* applies that alias to every file under `src/lib/`, including hand-written
|
|
33
|
-
* `.d.ts`, rewriting the `'svelte-docinfo
|
|
34
|
-
*
|
|
34
|
+
* `.d.ts`, rewriting the `'svelte-docinfo'` import below to a relative
|
|
35
|
+
* path. TypeScript doesn't resolve relative imports inside ambient
|
|
35
36
|
* `declare module` blocks in consumer projects — types silently collapse
|
|
36
37
|
* to `any`.
|
|
37
38
|
*
|
|
@@ -40,10 +41,9 @@
|
|
|
40
41
|
* Do not "fix" this by moving the file into `src/lib/`.
|
|
41
42
|
*/
|
|
42
43
|
declare module 'virtual:svelte-docinfo' {
|
|
43
|
-
import type {
|
|
44
|
-
|
|
45
|
-
export const
|
|
46
|
-
|
|
47
|
-
const data: {modules: Array<ModuleJsonInput>; diagnostics: Array<Diagnostic>};
|
|
44
|
+
import type {AnalyzeResultJsonWire} from 'svelte-docinfo';
|
|
45
|
+
export const modules: AnalyzeResultJsonWire['modules'];
|
|
46
|
+
export const diagnostics: AnalyzeResultJsonWire['diagnostics'];
|
|
47
|
+
const data: AnalyzeResultJsonWire;
|
|
48
48
|
export default data;
|
|
49
49
|
}
|