zod-compiler 1.0.13 → 1.0.15
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 +7 -17
- package/README.md +71 -22
- package/dist/cli/emitter.d.ts +2 -1
- package/dist/cli/emitter.d.ts.map +1 -1
- package/dist/cli/emitter.js +1 -1
- package/dist/cli/emitter.js.map +1 -1
- package/dist/core/codegen/emit-issue.d.ts +5 -0
- package/dist/core/codegen/emit-issue.d.ts.map +1 -1
- package/dist/core/codegen/emit-issue.js +11 -0
- package/dist/core/codegen/emit-issue.js.map +1 -1
- package/dist/core/codegen/issue-decls.d.ts +2 -0
- package/dist/core/codegen/issue-decls.d.ts.map +1 -1
- package/dist/core/codegen/issue-decls.js +3 -0
- package/dist/core/codegen/issue-decls.js.map +1 -1
- package/dist/core/codegen/schemas/object.d.ts.map +1 -1
- package/dist/core/codegen/schemas/object.js +44 -2
- package/dist/core/codegen/schemas/object.js.map +1 -1
- package/dist/core/extract/extractors/object.d.ts.map +1 -1
- package/dist/core/extract/extractors/object.js +11 -7
- package/dist/core/extract/extractors/object.js.map +1 -1
- package/dist/core/types.d.ts +10 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/unplugin/disk-cache.d.ts +88 -15
- package/dist/unplugin/disk-cache.d.ts.map +1 -1
- package/dist/unplugin/disk-cache.js +282 -27
- package/dist/unplugin/disk-cache.js.map +1 -1
- package/dist/unplugin/hoist.d.ts +8 -0
- package/dist/unplugin/hoist.d.ts.map +1 -1
- package/dist/unplugin/hoist.js +192 -25
- package/dist/unplugin/hoist.js.map +1 -1
- package/dist/unplugin/index.d.ts.map +1 -1
- package/dist/unplugin/index.js +50 -26
- package/dist/unplugin/index.js.map +1 -1
- package/dist/unplugin/transform.d.ts.map +1 -1
- package/dist/unplugin/transform.js +22 -2
- package/dist/unplugin/transform.js.map +1 -1
- package/dist/unplugin/types.d.ts +15 -3
- package/dist/unplugin/types.d.ts.map +1 -1
- package/dist/unplugin/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -10,10 +10,32 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Entries are keyed by a hash of (plugin version, zod version, transform
|
|
12
12
|
* options, file id, file content) and validated against a recorded snapshot
|
|
13
|
-
* of
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
13
|
+
* of first-party files. Validation uses an mtime+size fast path and falls
|
|
14
|
+
* back to content hashing, so a `touch` without changes still hits. A
|
|
15
|
+
* superset of true dependencies only over-invalidates, never serves stale
|
|
16
|
+
* output.
|
|
17
|
+
*
|
|
18
|
+
* Layout (CACHE_FORMAT 2): dependency snapshots are CONTENT-ADDRESSED and
|
|
19
|
+
* shared — `deps/<sha1>.json` holds the {path → hash/mtime/size} map, and
|
|
20
|
+
* each entry stores only the dep-set id. The v1 format inlined the full dep
|
|
21
|
+
* map into every entry; in a large-codebase field report 835 superset-
|
|
22
|
+
* fallback entries each embedded a ~1,900-file point-in-time snapshot (813
|
|
23
|
+
* DISTINCT snapshots — the executed-modules superset grows as the build
|
|
24
|
+
* progresses, so per-entry copies cannot even dedupe), totalling 283 MB
|
|
25
|
+
* that any commit invalidated wholesale. Sharing dep-sets also means each
|
|
26
|
+
* unique set is parsed and validated once per process instead of once per
|
|
27
|
+
* entry.
|
|
28
|
+
*
|
|
29
|
+
* Superset fallbacks (entries whose static dep crawl was incomplete) are
|
|
30
|
+
* DEFERRED: queued in memory and flushed in buildEnd / process exit against
|
|
31
|
+
* a single end-of-build superset snapshot, so every superset entry of a
|
|
32
|
+
* build shares ONE dep-set file (recording the still-growing snapshot at
|
|
33
|
+
* save time is what produced 813 distinct copies). Deferred entries are
|
|
34
|
+
* dropped on watchChange — a dependency edited between queueing and flush
|
|
35
|
+
* would pair post-change hashes with a pre-change result, which is the one
|
|
36
|
+
* combination that can serve stale output. A killed process loses only its
|
|
37
|
+
* pending superset entries (the static-complete majority persists
|
|
38
|
+
* immediately); the next run re-pays discovery for those files alone.
|
|
17
39
|
*
|
|
18
40
|
* Writes are atomic (tmp file + rename) so concurrent bundler processes
|
|
19
41
|
* (vitest workspace projects) can share one cache directory safely.
|
|
@@ -22,16 +44,11 @@ export interface CacheEntryStats {
|
|
|
22
44
|
schemas: number;
|
|
23
45
|
optimized: number;
|
|
24
46
|
}
|
|
25
|
-
interface DepRecord {
|
|
26
|
-
hash: string;
|
|
27
|
-
mtimeMs: number;
|
|
28
|
-
size: number;
|
|
29
|
-
}
|
|
30
47
|
export interface CacheEntry {
|
|
31
48
|
/** Transformed code, or null when the transform produced no change. */
|
|
32
49
|
result: string | null;
|
|
33
|
-
/**
|
|
34
|
-
|
|
50
|
+
/** Content-addressed id of the shared dep-set file (deps/<id>.json). */
|
|
51
|
+
depset: string;
|
|
35
52
|
/** Build stats to replay on cache hits (only present when schemas compiled). */
|
|
36
53
|
stats?: CacheEntryStats;
|
|
37
54
|
/** Composed sourcemap for `result` (original → transformed). */
|
|
@@ -46,12 +63,16 @@ export interface CacheSourceMap {
|
|
|
46
63
|
mappings: string;
|
|
47
64
|
file?: string | null;
|
|
48
65
|
}
|
|
49
|
-
/** Reset the per-process dep
|
|
66
|
+
/** Reset the per-process dep validation memos (watch-mode file changes). */
|
|
50
67
|
export declare function resetDepValidationMemo(): void;
|
|
51
68
|
export declare class DiskCache {
|
|
52
69
|
private readonly dir;
|
|
53
70
|
private readonly optionsKey;
|
|
54
|
-
|
|
71
|
+
/** Superset snapshot provider (loader's executed first-party modules). */
|
|
72
|
+
private readonly superset;
|
|
73
|
+
private pending;
|
|
74
|
+
private initialized;
|
|
75
|
+
constructor(dir: string, optionsKey: string, superset?: () => string[] | null);
|
|
55
76
|
/**
|
|
56
77
|
* Resolve the cache directory: an explicit string wins; otherwise
|
|
57
78
|
* node_modules/.cache/zod-compiler under cwd (falling back to a
|
|
@@ -60,9 +81,61 @@ export declare class DiskCache {
|
|
|
60
81
|
static resolveDir(cacheOption: string | true): string;
|
|
61
82
|
key(id: string, code: string): string;
|
|
62
83
|
private entryPath;
|
|
63
|
-
|
|
84
|
+
private depsetPath;
|
|
85
|
+
/**
|
|
86
|
+
* One-time directory init: wipe on format mismatch (v1 inline-deps caches
|
|
87
|
+
* reached 283 MB in the field — disposable by definition), then a
|
|
88
|
+
* throttled GC pass. Best-effort throughout; a concurrent wipe/GC from
|
|
89
|
+
* another process can only cause cache misses, never stale hits.
|
|
90
|
+
*/
|
|
91
|
+
private ensureDir;
|
|
92
|
+
/**
|
|
93
|
+
* Throttled sweep: entries older than MAX_ENTRY_AGE_MS (orphaned by key
|
|
94
|
+
* churn — content/version/options keys never repeat once inputs change)
|
|
95
|
+
* and dep-set files no surviving entry references. Runs at most once per
|
|
96
|
+
* GC_INTERVAL_MS per directory; the marker is claimed BEFORE sweeping so
|
|
97
|
+
* concurrent processes skip. Deleting a dep-set raced by a concurrent
|
|
98
|
+
* entry write only costs that entry a future miss — save() re-creates
|
|
99
|
+
* absent dep-set files.
|
|
100
|
+
*/
|
|
101
|
+
private maybeGc;
|
|
102
|
+
/** Load an entry and validate its dep-set. Any failure → null. */
|
|
64
103
|
load(key: string): CacheEntry | null;
|
|
104
|
+
/**
|
|
105
|
+
* Validate every dep in a dep-set, once per process per set: superset
|
|
106
|
+
* entries all share one set, so the ~N-file validation (and the JSON
|
|
107
|
+
* parse) happens once instead of once per entry.
|
|
108
|
+
*/
|
|
109
|
+
private validateDepset;
|
|
110
|
+
/**
|
|
111
|
+
* Stat + hash every dep into a content-addressed record map. The id hashes
|
|
112
|
+
* sorted (path, content-hash) pairs ONLY — mtimes are validation fast-path
|
|
113
|
+
* hints and must not fork the file name across checkouts/touches. Returns
|
|
114
|
+
* null when any dep cannot be read (an unvalidatable set must not persist).
|
|
115
|
+
*/
|
|
116
|
+
private buildDepset;
|
|
117
|
+
/** Write a dep-set file if absent (content-addressed: same id ⟹ same bytes). */
|
|
118
|
+
private writeDepset;
|
|
119
|
+
private writeEntry;
|
|
120
|
+
/** Persist an entry whose dependency set is fully known (static crawl complete). */
|
|
65
121
|
save(key: string, result: string | null, depPaths: readonly string[], stats?: CacheEntryStats, map?: CacheSourceMap | null): void;
|
|
122
|
+
/**
|
|
123
|
+
* Queue an entry whose static dep crawl was incomplete. Persisted by
|
|
124
|
+
* flushDeferred() against ONE end-of-build superset snapshot — recording
|
|
125
|
+
* the snapshot at save time gave every entry a distinct point-in-time
|
|
126
|
+
* copy (the executed-modules set grows as discovery progresses).
|
|
127
|
+
*/
|
|
128
|
+
saveDeferred(key: string, result: string | null, stats?: CacheEntryStats, map?: CacheSourceMap | null): void;
|
|
129
|
+
/**
|
|
130
|
+
* Flush queued superset entries against the current loader snapshot.
|
|
131
|
+
* Wired to buildEnd and (as a fallback) process exit; idempotent.
|
|
132
|
+
*/
|
|
133
|
+
flushDeferred(): void;
|
|
134
|
+
/**
|
|
135
|
+
* Discard queued superset entries (watch-mode file change): their results
|
|
136
|
+
* predate the change, but a flush would record post-change dep hashes —
|
|
137
|
+
* the one pairing that could validate a stale result.
|
|
138
|
+
*/
|
|
139
|
+
dropDeferred(): void;
|
|
66
140
|
}
|
|
67
|
-
export {};
|
|
68
141
|
//# sourceMappingURL=disk-cache.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disk-cache.d.ts","sourceRoot":"","sources":["../../src/unplugin/disk-cache.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"disk-cache.d.ts","sourceRoot":"","sources":["../../src/unplugin/disk-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAmBH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAQD,MAAM,WAAW,UAAU;IACzB,uEAAuE;IACvE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,wEAAwE;IACxE,MAAM,EAAE,MAAM,CAAC;IACf,gFAAgF;IAChF,KAAK,CAAC,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KG;IACH,OAAO,CAAC,WAAW;IAcnB,gFAAgF;IAChF,OAAO,CAAC,WAAW;IAanB,OAAO,CAAC,UAAU;IA8BlB,oFAAoF;IACpF,IAAI,CACF,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,KAAK,CAAC,EAAE,eAAe,EACvB,GAAG,CAAC,EAAE,cAAc,GAAG,IAAI,GAC1B,IAAI;IAQP;;;;;OAKG;IACH,YAAY,CACV,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,KAAK,CAAC,EAAE,eAAe,EACvB,GAAG,CAAC,EAAE,cAAc,GAAG,IAAI,GAC1B,IAAI;IAMP;;;OAGG;IACH,aAAa,IAAI,IAAI;IAerB;;;;OAIG;IACH,YAAY,IAAI,IAAI;CAGrB"}
|
|
@@ -10,10 +10,32 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Entries are keyed by a hash of (plugin version, zod version, transform
|
|
12
12
|
* options, file id, file content) and validated against a recorded snapshot
|
|
13
|
-
* of
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
13
|
+
* of first-party files. Validation uses an mtime+size fast path and falls
|
|
14
|
+
* back to content hashing, so a `touch` without changes still hits. A
|
|
15
|
+
* superset of true dependencies only over-invalidates, never serves stale
|
|
16
|
+
* output.
|
|
17
|
+
*
|
|
18
|
+
* Layout (CACHE_FORMAT 2): dependency snapshots are CONTENT-ADDRESSED and
|
|
19
|
+
* shared — `deps/<sha1>.json` holds the {path → hash/mtime/size} map, and
|
|
20
|
+
* each entry stores only the dep-set id. The v1 format inlined the full dep
|
|
21
|
+
* map into every entry; in a large-codebase field report 835 superset-
|
|
22
|
+
* fallback entries each embedded a ~1,900-file point-in-time snapshot (813
|
|
23
|
+
* DISTINCT snapshots — the executed-modules superset grows as the build
|
|
24
|
+
* progresses, so per-entry copies cannot even dedupe), totalling 283 MB
|
|
25
|
+
* that any commit invalidated wholesale. Sharing dep-sets also means each
|
|
26
|
+
* unique set is parsed and validated once per process instead of once per
|
|
27
|
+
* entry.
|
|
28
|
+
*
|
|
29
|
+
* Superset fallbacks (entries whose static dep crawl was incomplete) are
|
|
30
|
+
* DEFERRED: queued in memory and flushed in buildEnd / process exit against
|
|
31
|
+
* a single end-of-build superset snapshot, so every superset entry of a
|
|
32
|
+
* build shares ONE dep-set file (recording the still-growing snapshot at
|
|
33
|
+
* save time is what produced 813 distinct copies). Deferred entries are
|
|
34
|
+
* dropped on watchChange — a dependency edited between queueing and flush
|
|
35
|
+
* would pair post-change hashes with a pre-change result, which is the one
|
|
36
|
+
* combination that can serve stale output. A killed process loses only its
|
|
37
|
+
* pending superset entries (the static-complete majority persists
|
|
38
|
+
* immediately); the next run re-pays discovery for those files alone.
|
|
17
39
|
*
|
|
18
40
|
* Writes are atomic (tmp file + rename) so concurrent bundler processes
|
|
19
41
|
* (vitest workspace projects) can share one cache directory safely.
|
|
@@ -22,6 +44,17 @@ import { createHash } from "node:crypto";
|
|
|
22
44
|
import * as fs from "node:fs";
|
|
23
45
|
import * as path from "node:path";
|
|
24
46
|
import { fileURLToPath } from "node:url";
|
|
47
|
+
/** Bump when the on-disk layout changes; mismatched directories are wiped. */
|
|
48
|
+
const CACHE_FORMAT = 2;
|
|
49
|
+
const META_FILE = "_meta.json";
|
|
50
|
+
const GC_MARKER = "_gc";
|
|
51
|
+
const DEPSET_DIR = "deps";
|
|
52
|
+
/** GC at most once per day per cache directory. */
|
|
53
|
+
const GC_INTERVAL_MS = 24 * 60 * 60 * 1000;
|
|
54
|
+
/** Entries unread for this long are presumed orphaned by key churn. */
|
|
55
|
+
const MAX_ENTRY_AGE_MS = 30 * 24 * 60 * 60 * 1000;
|
|
56
|
+
/** Stale atomic-write temp files (crashed processes) older than this are removed. */
|
|
57
|
+
const MAX_TMP_AGE_MS = 60 * 60 * 1000;
|
|
25
58
|
function sha1(data) {
|
|
26
59
|
return createHash("sha1").update(data).digest("hex");
|
|
27
60
|
}
|
|
@@ -99,10 +132,12 @@ const ZOD_VERSION = readZodVersion();
|
|
|
99
132
|
const BUILD_FINGERPRINT = readBuildFingerprint();
|
|
100
133
|
/**
|
|
101
134
|
* Per-process memo: path → current stat (+ lazily computed content hash).
|
|
102
|
-
* One fs.stat per file per process regardless of how many
|
|
135
|
+
* One fs.stat per file per process regardless of how many dep-sets
|
|
103
136
|
* reference it; content is read at most once.
|
|
104
137
|
*/
|
|
105
138
|
const depStatMemo = new Map();
|
|
139
|
+
/** Per-process memo: dep-set file path → validation verdict. */
|
|
140
|
+
const depsetVerdictMemo = new Map();
|
|
106
141
|
function statDep(depPath) {
|
|
107
142
|
const memo = depStatMemo.get(depPath);
|
|
108
143
|
if (memo !== undefined)
|
|
@@ -129,16 +164,36 @@ function hashDep(depPath, stat) {
|
|
|
129
164
|
return null;
|
|
130
165
|
}
|
|
131
166
|
}
|
|
132
|
-
/** Reset the per-process dep
|
|
167
|
+
/** Reset the per-process dep validation memos (watch-mode file changes). */
|
|
133
168
|
export function resetDepValidationMemo() {
|
|
134
169
|
depStatMemo.clear();
|
|
170
|
+
depsetVerdictMemo.clear();
|
|
171
|
+
}
|
|
172
|
+
/** Instances with pending deferred entries, flushed on process exit. */
|
|
173
|
+
const flushOnExit = new Set();
|
|
174
|
+
let exitHookInstalled = false;
|
|
175
|
+
function registerExitFlush(cache) {
|
|
176
|
+
flushOnExit.add(cache);
|
|
177
|
+
if (!exitHookInstalled) {
|
|
178
|
+
exitHookInstalled = true;
|
|
179
|
+
// 'exit' allows only synchronous work; every write below is sync.
|
|
180
|
+
process.once("exit", () => {
|
|
181
|
+
for (const c of flushOnExit)
|
|
182
|
+
c.flushDeferred();
|
|
183
|
+
});
|
|
184
|
+
}
|
|
135
185
|
}
|
|
136
186
|
export class DiskCache {
|
|
137
187
|
dir;
|
|
138
188
|
optionsKey;
|
|
139
|
-
|
|
189
|
+
/** Superset snapshot provider (loader's executed first-party modules). */
|
|
190
|
+
superset;
|
|
191
|
+
pending = [];
|
|
192
|
+
initialized = false;
|
|
193
|
+
constructor(dir, optionsKey, superset) {
|
|
140
194
|
this.dir = dir;
|
|
141
195
|
this.optionsKey = optionsKey;
|
|
196
|
+
this.superset = superset ?? null;
|
|
142
197
|
}
|
|
143
198
|
/**
|
|
144
199
|
* Resolve the cache directory: an explicit string wins; otherwise
|
|
@@ -159,8 +214,100 @@ export class DiskCache {
|
|
|
159
214
|
entryPath(key) {
|
|
160
215
|
return path.join(this.dir, `${key}.json`);
|
|
161
216
|
}
|
|
162
|
-
|
|
217
|
+
depsetPath(id) {
|
|
218
|
+
return path.join(this.dir, DEPSET_DIR, `${id}.json`);
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* One-time directory init: wipe on format mismatch (v1 inline-deps caches
|
|
222
|
+
* reached 283 MB in the field — disposable by definition), then a
|
|
223
|
+
* throttled GC pass. Best-effort throughout; a concurrent wipe/GC from
|
|
224
|
+
* another process can only cause cache misses, never stale hits.
|
|
225
|
+
*/
|
|
226
|
+
ensureDir() {
|
|
227
|
+
if (this.initialized)
|
|
228
|
+
return;
|
|
229
|
+
this.initialized = true;
|
|
230
|
+
try {
|
|
231
|
+
const metaPath = path.join(this.dir, META_FILE);
|
|
232
|
+
let format = 0;
|
|
233
|
+
try {
|
|
234
|
+
format = JSON.parse(fs.readFileSync(metaPath, "utf8")).format ?? 0;
|
|
235
|
+
}
|
|
236
|
+
catch {
|
|
237
|
+
// missing or unreadable marker — treat as foreign format
|
|
238
|
+
}
|
|
239
|
+
if (format !== CACHE_FORMAT) {
|
|
240
|
+
fs.rmSync(this.dir, { recursive: true, force: true });
|
|
241
|
+
fs.mkdirSync(path.join(this.dir, DEPSET_DIR), { recursive: true });
|
|
242
|
+
fs.writeFileSync(metaPath, JSON.stringify({ format: CACHE_FORMAT }));
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
fs.mkdirSync(path.join(this.dir, DEPSET_DIR), { recursive: true });
|
|
246
|
+
this.maybeGc();
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
catch {
|
|
250
|
+
// cache stays best-effort
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Throttled sweep: entries older than MAX_ENTRY_AGE_MS (orphaned by key
|
|
255
|
+
* churn — content/version/options keys never repeat once inputs change)
|
|
256
|
+
* and dep-set files no surviving entry references. Runs at most once per
|
|
257
|
+
* GC_INTERVAL_MS per directory; the marker is claimed BEFORE sweeping so
|
|
258
|
+
* concurrent processes skip. Deleting a dep-set raced by a concurrent
|
|
259
|
+
* entry write only costs that entry a future miss — save() re-creates
|
|
260
|
+
* absent dep-set files.
|
|
261
|
+
*/
|
|
262
|
+
maybeGc() {
|
|
263
|
+
const marker = path.join(this.dir, GC_MARKER);
|
|
264
|
+
try {
|
|
265
|
+
const stat = fs.statSync(marker, { throwIfNoEntry: false });
|
|
266
|
+
if (stat !== undefined && Date.now() - stat.mtimeMs < GC_INTERVAL_MS)
|
|
267
|
+
return;
|
|
268
|
+
fs.writeFileSync(marker, "");
|
|
269
|
+
const now = Date.now();
|
|
270
|
+
const referenced = new Set();
|
|
271
|
+
for (const name of fs.readdirSync(this.dir)) {
|
|
272
|
+
const p = path.join(this.dir, name);
|
|
273
|
+
if (name.endsWith(".tmp")) {
|
|
274
|
+
const st = fs.statSync(p, { throwIfNoEntry: false });
|
|
275
|
+
if (st !== undefined && now - st.mtimeMs > MAX_TMP_AGE_MS)
|
|
276
|
+
fs.rmSync(p, { force: true });
|
|
277
|
+
continue;
|
|
278
|
+
}
|
|
279
|
+
if (!name.endsWith(".json") || name === META_FILE)
|
|
280
|
+
continue;
|
|
281
|
+
try {
|
|
282
|
+
const st = fs.statSync(p);
|
|
283
|
+
if (now - st.mtimeMs > MAX_ENTRY_AGE_MS) {
|
|
284
|
+
fs.rmSync(p, { force: true });
|
|
285
|
+
continue;
|
|
286
|
+
}
|
|
287
|
+
const entry = JSON.parse(fs.readFileSync(p, "utf8"));
|
|
288
|
+
if (typeof entry.depset === "string")
|
|
289
|
+
referenced.add(entry.depset);
|
|
290
|
+
}
|
|
291
|
+
catch {
|
|
292
|
+
fs.rmSync(p, { force: true });
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
for (const name of fs.readdirSync(path.join(this.dir, DEPSET_DIR))) {
|
|
296
|
+
if (!name.endsWith(".json"))
|
|
297
|
+
continue;
|
|
298
|
+
const id = name.slice(0, -".json".length);
|
|
299
|
+
if (!referenced.has(id)) {
|
|
300
|
+
fs.rmSync(path.join(this.dir, DEPSET_DIR, name), { force: true });
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
catch {
|
|
305
|
+
// best effort
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
/** Load an entry and validate its dep-set. Any failure → null. */
|
|
163
309
|
load(key) {
|
|
310
|
+
this.ensureDir();
|
|
164
311
|
let entry;
|
|
165
312
|
try {
|
|
166
313
|
entry = JSON.parse(fs.readFileSync(this.entryPath(key), "utf8"));
|
|
@@ -168,32 +315,89 @@ export class DiskCache {
|
|
|
168
315
|
catch {
|
|
169
316
|
return null;
|
|
170
317
|
}
|
|
171
|
-
if (entry === null || typeof entry !== "object" || typeof entry.
|
|
318
|
+
if (entry === null || typeof entry !== "object" || typeof entry.depset !== "string") {
|
|
172
319
|
return null;
|
|
173
320
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
if (current === null)
|
|
177
|
-
return null;
|
|
178
|
-
if (current.mtimeMs === recorded.mtimeMs && current.size === recorded.size)
|
|
179
|
-
continue;
|
|
180
|
-
if (hashDep(depPath, current) !== recorded.hash)
|
|
181
|
-
return null;
|
|
182
|
-
}
|
|
321
|
+
if (!this.validateDepset(entry.depset))
|
|
322
|
+
return null;
|
|
183
323
|
return entry;
|
|
184
324
|
}
|
|
185
|
-
|
|
186
|
-
|
|
325
|
+
/**
|
|
326
|
+
* Validate every dep in a dep-set, once per process per set: superset
|
|
327
|
+
* entries all share one set, so the ~N-file validation (and the JSON
|
|
328
|
+
* parse) happens once instead of once per entry.
|
|
329
|
+
*/
|
|
330
|
+
validateDepset(id) {
|
|
331
|
+
const depsetFile = this.depsetPath(id);
|
|
332
|
+
const memo = depsetVerdictMemo.get(depsetFile);
|
|
333
|
+
if (memo !== undefined)
|
|
334
|
+
return memo;
|
|
335
|
+
let verdict = true;
|
|
336
|
+
try {
|
|
337
|
+
const parsed = JSON.parse(fs.readFileSync(depsetFile, "utf8"));
|
|
338
|
+
if (parsed === null || typeof parsed !== "object" || typeof parsed.files !== "object") {
|
|
339
|
+
verdict = false;
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
for (const [depPath, recorded] of Object.entries(parsed.files)) {
|
|
343
|
+
const current = statDep(depPath);
|
|
344
|
+
if (current === null) {
|
|
345
|
+
verdict = false;
|
|
346
|
+
break;
|
|
347
|
+
}
|
|
348
|
+
if (current.mtimeMs === recorded.mtimeMs && current.size === recorded.size)
|
|
349
|
+
continue;
|
|
350
|
+
if (hashDep(depPath, current) !== recorded.hash) {
|
|
351
|
+
verdict = false;
|
|
352
|
+
break;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
catch {
|
|
358
|
+
verdict = false;
|
|
359
|
+
}
|
|
360
|
+
depsetVerdictMemo.set(depsetFile, verdict);
|
|
361
|
+
return verdict;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Stat + hash every dep into a content-addressed record map. The id hashes
|
|
365
|
+
* sorted (path, content-hash) pairs ONLY — mtimes are validation fast-path
|
|
366
|
+
* hints and must not fork the file name across checkouts/touches. Returns
|
|
367
|
+
* null when any dep cannot be read (an unvalidatable set must not persist).
|
|
368
|
+
*/
|
|
369
|
+
buildDepset(depPaths) {
|
|
370
|
+
const records = {};
|
|
187
371
|
for (const depPath of depPaths) {
|
|
372
|
+
if (records[depPath] !== undefined)
|
|
373
|
+
continue;
|
|
188
374
|
const stat = statDep(depPath);
|
|
189
375
|
const hash = stat === null ? null : hashDep(depPath, stat);
|
|
190
|
-
if (stat === null || hash === null)
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
376
|
+
if (stat === null || hash === null)
|
|
377
|
+
return null;
|
|
378
|
+
records[depPath] = { hash, mtimeMs: stat.mtimeMs, size: stat.size };
|
|
379
|
+
}
|
|
380
|
+
const sorted = Object.keys(records).sort();
|
|
381
|
+
const id = sha1(sorted.map((p) => `${p}\0${records[p].hash}`).join("\n"));
|
|
382
|
+
return { id, content: { files: records } };
|
|
383
|
+
}
|
|
384
|
+
/** Write a dep-set file if absent (content-addressed: same id ⟹ same bytes). */
|
|
385
|
+
writeDepset(id, content) {
|
|
386
|
+
const file = this.depsetPath(id);
|
|
387
|
+
try {
|
|
388
|
+
if (fs.existsSync(file))
|
|
389
|
+
return true;
|
|
390
|
+
const tmp = `${file}.${process.pid}.tmp`;
|
|
391
|
+
fs.writeFileSync(tmp, JSON.stringify(content));
|
|
392
|
+
fs.renameSync(tmp, file);
|
|
393
|
+
return true;
|
|
394
|
+
}
|
|
395
|
+
catch {
|
|
396
|
+
return false;
|
|
195
397
|
}
|
|
196
|
-
|
|
398
|
+
}
|
|
399
|
+
writeEntry(key, depsetId, result, stats, map) {
|
|
400
|
+
const entry = { result, depset: depsetId };
|
|
197
401
|
if (stats)
|
|
198
402
|
entry.stats = stats;
|
|
199
403
|
if (map !== undefined && map !== null) {
|
|
@@ -208,7 +412,6 @@ export class DiskCache {
|
|
|
208
412
|
};
|
|
209
413
|
}
|
|
210
414
|
try {
|
|
211
|
-
fs.mkdirSync(this.dir, { recursive: true });
|
|
212
415
|
const file = this.entryPath(key);
|
|
213
416
|
const tmp = `${file}.${process.pid}.tmp`;
|
|
214
417
|
fs.writeFileSync(tmp, JSON.stringify(entry));
|
|
@@ -218,5 +421,57 @@ export class DiskCache {
|
|
|
218
421
|
// Cache writes are best-effort; failures only cost a recompute.
|
|
219
422
|
}
|
|
220
423
|
}
|
|
424
|
+
/** Persist an entry whose dependency set is fully known (static crawl complete). */
|
|
425
|
+
save(key, result, depPaths, stats, map) {
|
|
426
|
+
this.ensureDir();
|
|
427
|
+
const built = this.buildDepset(depPaths);
|
|
428
|
+
if (built === null)
|
|
429
|
+
return;
|
|
430
|
+
if (!this.writeDepset(built.id, built.content))
|
|
431
|
+
return;
|
|
432
|
+
this.writeEntry(key, built.id, result, stats, map);
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Queue an entry whose static dep crawl was incomplete. Persisted by
|
|
436
|
+
* flushDeferred() against ONE end-of-build superset snapshot — recording
|
|
437
|
+
* the snapshot at save time gave every entry a distinct point-in-time
|
|
438
|
+
* copy (the executed-modules set grows as discovery progresses).
|
|
439
|
+
*/
|
|
440
|
+
saveDeferred(key, result, stats, map) {
|
|
441
|
+
if (this.superset === null)
|
|
442
|
+
return;
|
|
443
|
+
this.pending.push({ key, result, stats, map });
|
|
444
|
+
registerExitFlush(this);
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Flush queued superset entries against the current loader snapshot.
|
|
448
|
+
* Wired to buildEnd and (as a fallback) process exit; idempotent.
|
|
449
|
+
*/
|
|
450
|
+
flushDeferred() {
|
|
451
|
+
if (this.pending.length === 0)
|
|
452
|
+
return;
|
|
453
|
+
const pending = this.pending;
|
|
454
|
+
this.pending = [];
|
|
455
|
+
const snapshot = this.superset === null ? null : this.superset();
|
|
456
|
+
if (snapshot === null)
|
|
457
|
+
return;
|
|
458
|
+
this.ensureDir();
|
|
459
|
+
const built = this.buildDepset(snapshot);
|
|
460
|
+
if (built === null)
|
|
461
|
+
return;
|
|
462
|
+
if (!this.writeDepset(built.id, built.content))
|
|
463
|
+
return;
|
|
464
|
+
for (const p of pending) {
|
|
465
|
+
this.writeEntry(p.key, built.id, p.result, p.stats, p.map);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Discard queued superset entries (watch-mode file change): their results
|
|
470
|
+
* predate the change, but a flush would record post-change dep hashes —
|
|
471
|
+
* the one pairing that could validate a stale result.
|
|
472
|
+
*/
|
|
473
|
+
dropDeferred() {
|
|
474
|
+
this.pending = [];
|
|
475
|
+
}
|
|
221
476
|
}
|
|
222
477
|
//# sourceMappingURL=disk-cache.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disk-cache.js","sourceRoot":"","sources":["../../src/unplugin/disk-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAkCzC,SAAS,IAAI,CAAC,IAAqB;IACjC,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACvD,CAAC;AAED,gHAAgH;AAChH,SAAS,iBAAiB;IACxB,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,oBAAoB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/D,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAyB,CAAC;QACjF,OAAO,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,CAAC;IACb,CAAC;AACH,CAAC;AAED,mFAAmF;AACnF,SAAS,cAAc;IACrB,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE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/unplugin/hoist.d.ts
CHANGED
|
@@ -28,6 +28,14 @@ export interface HoistOptions {
|
|
|
28
28
|
* @default /ZodSchema$/
|
|
29
29
|
*/
|
|
30
30
|
schemaNamePattern?: RegExp | string | null | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Fired when the file has hoist-relevant roots and the full source scan
|
|
33
|
+
* actually runs — i.e., real parse-level work happened (as opposed to the
|
|
34
|
+
* microsecond import-collection bail). The disk cache uses this to decide
|
|
35
|
+
* that even a null transform result is worth persisting: re-deriving
|
|
36
|
+
* "nothing to hoist" costs a full scan per zod-importing file per run.
|
|
37
|
+
*/
|
|
38
|
+
onScan?: (() => void) | undefined;
|
|
31
39
|
}
|
|
32
40
|
/**
|
|
33
41
|
* Free-variable analysis of a hoisted expression's source text, for the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hoist.d.ts","sourceRoot":"","sources":["../../src/unplugin/hoist.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AA0DnE,iEAAiE;AACjE,MAAM,WAAW,YAAY;IAC3B,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,yGAAyG;IACzG,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,cAAc;IACtB,sDAAsD;IACtD,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACjB,8DAA8D;IAC9D,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACjB,4EAA4E;IAC5E,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;CACpC;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAiBlE;
|
|
1
|
+
{"version":3,"file":"hoist.d.ts","sourceRoot":"","sources":["../../src/unplugin/hoist.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,IAAI,EAAE,K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