@graftland/hmr 0.1.0 → 0.2.0-beta.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/README.md +195 -2
- package/README.zh-CN.md +137 -0
- package/README.zh-TW.md +137 -0
- package/dist/index.d.ts +39 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +250 -48
- package/dist/index.js.map +1 -1
- package/dist/internal/changes.js +92 -0
- package/dist/internal/changes.js.map +1 -0
- package/dist/internal/digest.js +6 -0
- package/dist/internal/digest.js.map +1 -0
- package/dist/internal/modules.js +237 -39
- package/dist/internal/modules.js.map +1 -1
- package/package.json +7 -5
- package/src/index.ts +632 -108
- package/src/internal/changes.ts +274 -0
- package/src/internal/digest.ts +5 -0
- package/src/internal/modules.ts +403 -57
package/dist/internal/modules.js
CHANGED
|
@@ -1,79 +1,277 @@
|
|
|
1
|
+
import { digest } from "./digest.js";
|
|
1
2
|
import { registerHooks } from "node:module";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
3
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
4
|
+
import { Array, Chunk, HashMap, HashSet, Option, Predicate, Schema, String } from "effect";
|
|
4
5
|
// src/internal/modules.ts
|
|
5
6
|
var RestartRequired = class extends Schema.TaggedError()("RestartRequired", { url: Schema.String }) {};
|
|
6
|
-
const isMissingEntry = (url, cause) => String
|
|
7
|
+
const isMissingEntry = (url, cause) => String.startsWith("file:")(url) && Predicate.hasProperty(cause, "code") && (cause.code === "ERR_MODULE_NOT_FOUND" && Predicate.hasProperty(cause, "url") && cause.url === url || cause.code === "ENOENT" && Predicate.hasProperty(cause, "path") && cause.path === fileURLToPath(url));
|
|
7
8
|
let sessions = 0;
|
|
9
|
+
/** Resolve local requests lexically; Node's cached physical target is a separate fact. */
|
|
10
|
+
const fileRequest = (specifier, parent) => {
|
|
11
|
+
if (!Array.some([
|
|
12
|
+
"file:",
|
|
13
|
+
"./",
|
|
14
|
+
"../",
|
|
15
|
+
"/"
|
|
16
|
+
], (prefix) => String.startsWith(prefix)(specifier))) return Option.none();
|
|
17
|
+
const url = new URL(specifier, parent);
|
|
18
|
+
return url.protocol === "file:" ? Option.some(url.href) : Option.none();
|
|
19
|
+
};
|
|
8
20
|
/** A scoped Node hook. Mutable bindings bridge synchronous hooks to Effect. */
|
|
9
21
|
const modules = (base, include) => {
|
|
10
22
|
const key = `graft-hmr-${++sessions}`;
|
|
11
23
|
const prefix = `${key}:`;
|
|
24
|
+
const decodeRequest = Schema.decodeUnknownOption(Schema.TemplateLiteralParser([
|
|
25
|
+
prefix,
|
|
26
|
+
Schema.String.check(Schema.isPattern(/^\d+$/)),
|
|
27
|
+
":",
|
|
28
|
+
Schema.String
|
|
29
|
+
]));
|
|
12
30
|
let revision = 0;
|
|
13
|
-
let
|
|
14
|
-
let reloading = false;
|
|
31
|
+
let importing;
|
|
15
32
|
let resolved;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
33
|
+
let views = HashMap.empty();
|
|
34
|
+
let edges = HashMap.empty();
|
|
35
|
+
let sources = HashMap.empty();
|
|
36
|
+
let dependencies = HashSet.empty();
|
|
37
|
+
let reachCache = HashMap.empty();
|
|
38
|
+
let retained = HashSet.empty();
|
|
39
|
+
let instantiatedViews = HashSet.empty();
|
|
20
40
|
const clean = (url) => {
|
|
21
41
|
const value = new URL(url);
|
|
22
42
|
value.searchParams.delete(key);
|
|
23
43
|
return value.href;
|
|
24
44
|
};
|
|
25
|
-
const version = (url) =>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
45
|
+
const version = (url) => {
|
|
46
|
+
if (url === void 0) return void 0;
|
|
47
|
+
const value = new URL(url).searchParams.get(key);
|
|
48
|
+
return value === null ? void 0 : Number(value);
|
|
49
|
+
};
|
|
50
|
+
const tag = (url, id) => {
|
|
51
|
+
const value = new URL(url);
|
|
52
|
+
value.searchParams.set(key, String.String(id));
|
|
53
|
+
return value.href;
|
|
54
|
+
};
|
|
55
|
+
const route = (url, id) => Option.getOrElse(HashMap.get(Option.getOrElse(HashMap.get(views, id), HashMap.empty), url), () => tag(url, id));
|
|
56
|
+
const root = (attempt) => route(attempt.url, attempt.generation.id);
|
|
57
|
+
const children = (node) => Option.getOrElse(HashMap.get(edges, node), HashMap.empty);
|
|
58
|
+
const reachable = (node) => {
|
|
59
|
+
const cached = HashMap.get(reachCache, node);
|
|
60
|
+
if (Option.isSome(cached)) return cached.value;
|
|
61
|
+
let seen = HashSet.empty();
|
|
62
|
+
let pending = Chunk.of(node);
|
|
63
|
+
while (Chunk.isNonEmpty(pending)) {
|
|
64
|
+
const current = Chunk.headNonEmpty(pending);
|
|
65
|
+
pending = Chunk.drop(pending, 1);
|
|
66
|
+
if (HashSet.has(seen, current)) continue;
|
|
67
|
+
seen = HashSet.add(seen, current);
|
|
68
|
+
for (const edge of HashMap.values(children(current))) pending = Chunk.prepend(pending, edge.node);
|
|
32
69
|
}
|
|
70
|
+
reachCache = HashMap.set(reachCache, node, seen);
|
|
71
|
+
return seen;
|
|
72
|
+
};
|
|
73
|
+
const usedBy = (attempts) => {
|
|
74
|
+
const roots = HashSet.fromIterable(Array.map(attempts, root));
|
|
75
|
+
let used = HashSet.empty();
|
|
76
|
+
for (const node of roots) used = HashSet.union(used, reachable(node));
|
|
77
|
+
return used;
|
|
78
|
+
};
|
|
79
|
+
const link = (parent, node, request) => {
|
|
80
|
+
if (importing === void 0 && !HashSet.has(retained, parent) && !HashSet.has(instantiatedViews, version(parent))) return;
|
|
81
|
+
retained = HashSet.add(retained, node);
|
|
82
|
+
const url = clean(node);
|
|
83
|
+
const edge = {
|
|
84
|
+
node,
|
|
85
|
+
url,
|
|
86
|
+
generation: { id: version(node) },
|
|
87
|
+
...request === void 0 ? {} : { request }
|
|
88
|
+
};
|
|
89
|
+
const previous = HashMap.get(children(parent), request ?? url);
|
|
90
|
+
if (Option.exists(previous, (previous) => previous.node === node && previous.request === request)) return;
|
|
91
|
+
edges = HashMap.set(edges, parent, HashMap.set(children(parent), request ?? url, edge));
|
|
92
|
+
reachCache = HashMap.empty();
|
|
93
|
+
};
|
|
94
|
+
const resolutions = (attempts) => [...Array.filter(attempts, (attempt) => attempt.request !== void 0), ...Array.flatMap(Array.fromIterable(usedBy(attempts)), (node) => Array.filter(HashMap.toValues(children(node)), (edge) => edge.request !== void 0))];
|
|
95
|
+
const unsupported = (url, format) => format === "commonjs" || format === "commonjs-typescript" || format === "addon" || String.endsWith(".node")(new URL(url).pathname);
|
|
96
|
+
const requireRestart = (node) => {
|
|
97
|
+
if (importing !== void 0 || HashSet.has(retained, node)) dependencies = HashSet.add(dependencies, node);
|
|
98
|
+
if (importing?.reload === true && importing.generation.id === version(node)) throw RestartRequired.make({ url: clean(node) });
|
|
99
|
+
};
|
|
100
|
+
const record = (node, format) => {
|
|
101
|
+
if (unsupported(clean(node), format)) requireRestart(node);
|
|
102
|
+
};
|
|
103
|
+
const invalidated = (attempts, dirty) => {
|
|
104
|
+
const used = usedBy(attempts);
|
|
105
|
+
let parents = HashMap.empty();
|
|
106
|
+
let pending = Chunk.empty();
|
|
107
|
+
for (const node of used) {
|
|
108
|
+
if (HashSet.has(dirty, clean(node))) pending = Chunk.prepend(pending, node);
|
|
109
|
+
for (const edge of HashMap.values(children(node))) {
|
|
110
|
+
parents = HashMap.set(parents, edge.node, HashSet.add(Option.getOrElse(HashMap.get(parents, edge.node), HashSet.empty), node));
|
|
111
|
+
if (edge.request !== void 0 && HashSet.has(dirty, edge.request)) pending = Chunk.prepend(pending, edge.node);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
for (const attempt of attempts) if (attempt.request !== void 0 && HashSet.has(dirty, attempt.request)) pending = Chunk.prepend(pending, root(attempt));
|
|
115
|
+
let invalid = HashSet.empty();
|
|
116
|
+
while (Chunk.isNonEmpty(pending)) {
|
|
117
|
+
const node = Chunk.headNonEmpty(pending);
|
|
118
|
+
pending = Chunk.drop(pending, 1);
|
|
119
|
+
if (HashSet.has(invalid, node)) continue;
|
|
120
|
+
invalid = HashSet.add(invalid, node);
|
|
121
|
+
for (const parent of Option.getOrElse(HashMap.get(parents, node), HashSet.empty)) pending = Chunk.prepend(pending, parent);
|
|
122
|
+
}
|
|
123
|
+
return invalid;
|
|
124
|
+
};
|
|
125
|
+
const prepare = (attempts = [], invalid = HashSet.empty()) => {
|
|
126
|
+
const id = ++revision;
|
|
127
|
+
const seed = Array.reduce(attempts, 0, (id, attempt) => Math.max(id, attempt.generation.id));
|
|
128
|
+
let view = Option.getOrElse(HashMap.get(views, seed), HashMap.empty);
|
|
129
|
+
const used = usedBy(attempts);
|
|
130
|
+
for (const [url, node] of view) if (!HashSet.has(used, node) || HashSet.has(invalid, node)) view = HashMap.remove(view, url);
|
|
131
|
+
for (const node of used) {
|
|
132
|
+
if (HashSet.has(invalid, node)) continue;
|
|
133
|
+
const url = clean(node);
|
|
134
|
+
const previous = HashMap.get(view, url);
|
|
135
|
+
if (Option.isNone(previous) || version(previous.value) < version(node)) view = HashMap.set(view, url, node);
|
|
136
|
+
}
|
|
137
|
+
views = HashMap.set(views, id, view);
|
|
138
|
+
return { id };
|
|
33
139
|
};
|
|
34
140
|
const hooks = registerHooks({
|
|
35
141
|
resolve(specifier, context, nextResolve) {
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
parentURL: entry ? base : clean(context.parentURL)
|
|
142
|
+
const parentNode = context.parentURL;
|
|
143
|
+
const request = decodeRequest(specifier);
|
|
144
|
+
const entry = Option.isSome(request);
|
|
145
|
+
const id = Option.match(request, {
|
|
146
|
+
onNone: () => version(context.parentURL),
|
|
147
|
+
onSome: ([, id]) => Number(id)
|
|
43
148
|
});
|
|
149
|
+
if (id === void 0) return nextResolve(specifier, context);
|
|
150
|
+
const target = Option.match(request, {
|
|
151
|
+
onNone: () => specifier,
|
|
152
|
+
onSome: ([, , , target]) => target
|
|
153
|
+
});
|
|
154
|
+
const parent = entry ? base : clean(context.parentURL);
|
|
155
|
+
const lexical = Option.getOrUndefined(fileRequest(target, parent));
|
|
156
|
+
const result = (() => {
|
|
157
|
+
try {
|
|
158
|
+
return nextResolve(target, {
|
|
159
|
+
...context,
|
|
160
|
+
parentURL: parent
|
|
161
|
+
});
|
|
162
|
+
} catch (cause) {
|
|
163
|
+
if (Predicate.hasProperty(cause, "url") && typeof cause.url === "string" && String.startsWith("file:")(cause.url)) {
|
|
164
|
+
if (entry) resolved = cause.url;
|
|
165
|
+
else if (include(cause.url)) link(parentNode, route(cause.url, id), lexical);
|
|
166
|
+
}
|
|
167
|
+
throw cause;
|
|
168
|
+
}
|
|
169
|
+
})();
|
|
44
170
|
if (entry) resolved = result.url;
|
|
45
|
-
if (!
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return
|
|
171
|
+
if (!entry && result.url === "node:module") {
|
|
172
|
+
const node = route(result.url, id);
|
|
173
|
+
link(parentNode, node);
|
|
174
|
+
requireRestart(node);
|
|
175
|
+
}
|
|
176
|
+
if (!String.startsWith("file:")(result.url) || !entry && !include(result.url)) return result;
|
|
177
|
+
const node = route(result.url, id);
|
|
178
|
+
if (!entry) link(parentNode, node, lexical);
|
|
179
|
+
const required = Array.contains(context.conditions, "require");
|
|
180
|
+
if (required) requireRestart(node);
|
|
181
|
+
else record(node, result.format);
|
|
182
|
+
return required || unsupported(result.url, result.format) ? result : {
|
|
51
183
|
...result,
|
|
52
|
-
url:
|
|
184
|
+
url: node
|
|
53
185
|
};
|
|
54
186
|
},
|
|
55
187
|
load(url, context, nextLoad) {
|
|
56
188
|
const id = version(url);
|
|
57
|
-
if (id ===
|
|
189
|
+
if (id === void 0) return nextLoad(url, context);
|
|
190
|
+
instantiatedViews = HashSet.add(instantiatedViews, id);
|
|
58
191
|
const original = clean(url);
|
|
59
|
-
record(
|
|
192
|
+
record(url, context.format);
|
|
60
193
|
const result = nextLoad(original, context);
|
|
61
|
-
|
|
194
|
+
const source = result.source;
|
|
195
|
+
if (source !== void 0 && source !== null) {
|
|
196
|
+
const bytes = typeof source === "string" ? source : ArrayBuffer.isView(source) ? new Uint8Array(source.buffer, source.byteOffset, source.byteLength) : new Uint8Array(source);
|
|
197
|
+
if (importing !== void 0 || HashSet.has(retained, url)) sources = HashMap.set(sources, url, digest(bytes));
|
|
198
|
+
}
|
|
199
|
+
record(url, result.format);
|
|
62
200
|
return result;
|
|
63
201
|
}
|
|
64
202
|
});
|
|
203
|
+
const files = (attempts) => {
|
|
204
|
+
let files = HashMap.empty();
|
|
205
|
+
const put = (url, node, resolution) => {
|
|
206
|
+
if (!String.startsWith("file:")(url) || HashSet.has(dependencies, node)) return;
|
|
207
|
+
const generation = version(node);
|
|
208
|
+
const previous = HashMap.get(files, url);
|
|
209
|
+
if (Option.exists(previous, (previous) => previous.generation > generation || previous.generation === generation && previous.resolution !== void 0)) return;
|
|
210
|
+
files = HashMap.set(files, url, {
|
|
211
|
+
generation,
|
|
212
|
+
content: Option.getOrUndefined(HashMap.get(sources, node)),
|
|
213
|
+
...resolution === void 0 ? {} : { resolution }
|
|
214
|
+
});
|
|
215
|
+
};
|
|
216
|
+
for (const node of usedBy(attempts)) put(clean(node), node);
|
|
217
|
+
for (const attempt of resolutions(attempts)) if (attempt.request !== void 0) put(attempt.request, root(attempt), pathToFileURL(fileURLToPath(attempt.url)).href);
|
|
218
|
+
return files;
|
|
219
|
+
};
|
|
65
220
|
return {
|
|
66
221
|
prepare,
|
|
222
|
+
files,
|
|
223
|
+
resolutions,
|
|
224
|
+
invalidated,
|
|
225
|
+
affected: (attempt, invalid) => HashSet.has(invalid, root(attempt)),
|
|
226
|
+
fileRequest: (specifier) => fileRequest(specifier, base),
|
|
227
|
+
unsupported: (generation, roots) => {
|
|
228
|
+
const used = roots === void 0 ? void 0 : usedBy(Array.map(roots, (url) => ({
|
|
229
|
+
url,
|
|
230
|
+
generation
|
|
231
|
+
})));
|
|
232
|
+
return HashSet.fromIterable(Array.map(Array.filter(Array.fromIterable(dependencies), (node) => used === void 0 ? version(node) === generation.id : HashSet.has(used, node)), clean));
|
|
233
|
+
},
|
|
234
|
+
collect: (attempts) => {
|
|
235
|
+
const used = usedBy(attempts);
|
|
236
|
+
const ownedViews = HashSet.fromIterable(Array.map(attempts, (attempt) => attempt.generation.id));
|
|
237
|
+
views = HashMap.filter(views, (_, id) => id === revision || HashSet.has(instantiatedViews, id) || HashSet.has(ownedViews, id));
|
|
238
|
+
const keep = (node) => HashSet.has(used, node) || HashSet.has(instantiatedViews, version(node));
|
|
239
|
+
retained = used;
|
|
240
|
+
sources = HashMap.filter(sources, (_, node) => keep(node));
|
|
241
|
+
edges = HashMap.filter(edges, (_, node) => keep(node));
|
|
242
|
+
dependencies = HashSet.filter(dependencies, keep);
|
|
243
|
+
reachCache = HashMap.filter(reachCache, (_, node) => HashSet.has(used, node));
|
|
244
|
+
},
|
|
245
|
+
counts: () => ({
|
|
246
|
+
sources: HashMap.size(sources),
|
|
247
|
+
edges: HashMap.size(edges),
|
|
248
|
+
dependencies: HashSet.size(dependencies),
|
|
249
|
+
views: HashMap.size(views)
|
|
250
|
+
}),
|
|
67
251
|
start: (generation, reload = false) => {
|
|
68
|
-
|
|
69
|
-
|
|
252
|
+
importing = {
|
|
253
|
+
generation,
|
|
254
|
+
reload
|
|
255
|
+
};
|
|
70
256
|
},
|
|
71
257
|
discard: () => {
|
|
72
|
-
|
|
258
|
+
importing = void 0;
|
|
73
259
|
},
|
|
74
|
-
request: (specifier) =>
|
|
75
|
-
|
|
76
|
-
|
|
260
|
+
request: (specifier) => {
|
|
261
|
+
resolved = void 0;
|
|
262
|
+
return `${prefix}${importing.generation.id}:${specifier}`;
|
|
263
|
+
},
|
|
264
|
+
resolved: () => Option.fromUndefinedOr(resolved),
|
|
265
|
+
close: () => {
|
|
266
|
+
hooks.deregister();
|
|
267
|
+
views = HashMap.empty();
|
|
268
|
+
sources = HashMap.empty();
|
|
269
|
+
edges = HashMap.empty();
|
|
270
|
+
dependencies = HashSet.empty();
|
|
271
|
+
reachCache = HashMap.empty();
|
|
272
|
+
retained = HashSet.empty();
|
|
273
|
+
instantiatedViews = HashSet.empty();
|
|
274
|
+
}
|
|
77
275
|
};
|
|
78
276
|
};
|
|
79
277
|
export { RestartRequired, isMissingEntry, modules };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modules.js","names":["Str"],"sources":["../../src/internal/modules.ts"],"sourcesContent":["// Node's synchronous module hooks have no Effect equivalent.\nimport { registerHooks } from \"node:module\"\nimport { fileURLToPath } from \"node:url\"\nimport { HashSet, Option, Predicate, Schema, String as Str } from \"effect\"\n\nexport class RestartRequired extends Schema.TaggedError<\n\tRestartRequired,\n\t{ readonly brand: unique symbol }\n>()(\"RestartRequired\", { url: Schema.String }) {}\n\n// Only a missing entry is disposable; missing dependencies still fail the reload.\nexport const isMissingEntry = (url: string, cause: unknown): boolean =>\n\tStr.startsWith(\"file:\")(url) &&\n\tPredicate.hasProperty(cause, \"code\") &&\n\t((cause.code === \"ERR_MODULE_NOT_FOUND\" &&\n\t\tPredicate.hasProperty(cause, \"url\") &&\n\t\tcause.url === url) ||\n\t\t(cause.code === \"ENOENT\" &&\n\t\t\tPredicate.hasProperty(cause, \"path\") &&\n\t\t\tcause.path === fileURLToPath(url)))\n\n// Allocated only when a session starts; importing this module performs no I/O.\nlet sessions = 0\n\nexport interface Generation {\n\treadonly id: string\n\tunsupported: HashSet.HashSet<string>\n}\n\n/** A scoped Node hook. Mutable bindings bridge synchronous hooks to Effect. */\nexport const modules = (base: string, include: (url: string) => boolean) => {\n\tconst key = `graft-hmr-${++sessions}`\n\tconst prefix = `${key}:`\n\tlet revision = 0\n\tlet recording: Generation | undefined\n\tlet reloading = false\n\tlet resolved: string | undefined\n\n\tconst prepare = (): Generation => ({\n\t\tid: String(++revision),\n\t\tunsupported: HashSet.empty(),\n\t})\n\tconst clean = (url: string): string => {\n\t\tconst value = new URL(url)\n\t\tvalue.searchParams.delete(key)\n\t\treturn value.href\n\t}\n\tconst version = (url: string | undefined): string | null =>\n\t\turl === undefined ? null : new URL(url).searchParams.get(key)\n\tconst unsupported = (url: string, format: string | null | undefined) =>\n\t\tformat === \"commonjs\" ||\n\t\tformat === \"commonjs-typescript\" ||\n\t\tformat === \"addon\" ||\n\t\tStr.endsWith(\".node\")(new URL(url).pathname)\n\tconst record = (\n\t\turl: string,\n\t\tid: string,\n\t\tformat: string | null | undefined,\n\t) => {\n\t\tif (recording?.id !== id) return\n\t\tif (unsupported(url, format)) {\n\t\t\trecording.unsupported = HashSet.add(recording.unsupported, url)\n\t\t\tif (reloading) throw RestartRequired.make({ url })\n\t\t}\n\t}\n\n\tconst hooks = registerHooks({\n\t\tresolve(specifier, context, nextResolve) {\n\t\t\tconst entry = Str.startsWith(prefix)(specifier)\n\t\t\tconst separator = !entry\n\t\t\t\t? 0\n\t\t\t\t: prefix.length +\n\t\t\t\t\tOption.getOrThrow(\n\t\t\t\t\t\tStr.indexOf(\":\")(Str.slice(prefix.length)(specifier)),\n\t\t\t\t\t)\n\t\t\tconst id = entry\n\t\t\t\t? Str.slice(prefix.length, separator)(specifier)\n\t\t\t\t: version(context.parentURL)\n\t\t\tif (id === undefined || id === null)\n\t\t\t\treturn nextResolve(specifier, context)\n\t\t\tconst result = nextResolve(\n\t\t\t\tentry ? Str.slice(separator + 1)(specifier) : specifier,\n\t\t\t\t{\n\t\t\t\t\t...context,\n\t\t\t\t\tparentURL: entry ? base : clean(context.parentURL!),\n\t\t\t\t},\n\t\t\t)\n\t\t\tif (entry) resolved = result.url\n\t\t\tif (\n\t\t\t\t!Str.startsWith(\"file:\")(result.url) ||\n\t\t\t\t(!entry && !include(result.url))\n\t\t\t)\n\t\t\t\treturn result\n\t\t\trecord(result.url, id, result.format)\n\t\t\tif (unsupported(result.url, result.format)) return result\n\t\t\tconst url = new URL(result.url)\n\t\t\turl.searchParams.set(key, id)\n\t\t\treturn { ...result, url: url.href }\n\t\t},\n\t\tload(url, context, nextLoad) {\n\t\t\tconst id = version(url)\n\t\t\tif (id === null) return nextLoad(url, context)\n\t\t\tconst original = clean(url)\n\t\t\trecord(original, id, context.format)\n\t\t\tconst result = nextLoad(original, context)\n\t\t\trecord(original, id, result.format)\n\t\t\treturn result\n\t\t},\n\t})\n\treturn {\n\t\tprepare,\n\t\tstart: (generation: Generation, reload = false) => {\n\t\t\trecording = generation\n\t\t\treloading = reload\n\t\t},\n\t\tdiscard: () => {\n\t\t\trecording = undefined\n\t\t},\n\t\trequest: (specifier: string) => `${prefix}${recording!.id}:${specifier}`,\n\t\tresolved: () => resolved,\n\t\tclose: () => hooks.deregister(),\n\t}\n}\n"],"mappings":";;;;AAKA,IAAa,kBAAb,cAAqC,OAAO,YAG1C,CAAC,CAAC,mBAAmB,EAAE,KAAK,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;AAGhD,MAAa,kBAAkB,KAAa,UAC3CA,SAAI,WAAW,OAAO,CAAC,CAAC,GAAG,KAC3B,UAAU,YAAY,OAAO,MAAM,MACjC,MAAM,SAAS,0BAChB,UAAU,YAAY,OAAO,KAAK,KAClC,MAAM,QAAQ,OACb,MAAM,SAAS,YACf,UAAU,YAAY,OAAO,MAAM,KACnC,MAAM,SAAS,cAAc,GAAG;AAGnC,IAAI,WAAW;;AAQf,MAAa,WAAW,MAAc,YAAsC;CAC3E,MAAM,MAAM,aAAa,EAAE;CAC3B,MAAM,SAAS,GAAG,IAAI;CACtB,IAAI,WAAW;CACf,IAAI;CACJ,IAAI,YAAY;CAChB,IAAI;CAEJ,MAAM,iBAA6B;EAClC,IAAI,OAAO,EAAE,QAAQ;EACrB,aAAa,QAAQ,MAAM;CAC5B;CACA,MAAM,SAAS,QAAwB;EACtC,MAAM,QAAQ,IAAI,IAAI,GAAG;EACzB,MAAM,aAAa,OAAO,GAAG;EAC7B,OAAO,MAAM;CACd;CACA,MAAM,WAAW,QAChB,QAAQ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AAO;GACnD,MAAM,MAAM,IAAI,IAAI,OAAO,GAAG;GAC9B,IAAI,aAAa,IAAI,KAAK,EAAE;GAC5B,OAAO;IAAE,GAAG;IAAQ,KAAK,IAAI;GAAK;EACnC;EACA,KAAK,KAAK,SAAS,UAAU;GAC5B,MAAM,KAAK,QAAQ,GAAG;GACtB,IAAI,OAAO,MAAM,OAAO,SAAS,KAAK,OAAO;GAC7C,MAAM,WAAW,MAAM,GAAG;GAC1B,OAAO,UAAU,IAAI,QAAQ,MAAM;GACnC,MAAM,SAAS,SAAS,UAAU,OAAO;GACzC,OAAO,UAAU,IAAI,OAAO,MAAM;GAClC,OAAO;EACR;CACD,CAAC;CACD,OAAO;EACN;EACA,QAAQ,YAAwB,SAAS,UAAU;GAClD,YAAY;GACZ,YAAY;EACb;EACA,eAAe;GACd,YAAY,KAAA;EACb;EACA,UAAU,cAAsB,GAAG,SAAS,UAAW,GAAG,GAAG;EAC7D,gBAAgB;EAChB,aAAa,MAAM,WAAW;CAC/B;AACD"}
|
|
1
|
+
{"version":3,"file":"modules.js","names":[],"sources":["../../src/internal/modules.ts"],"sourcesContent":["// Node's synchronous module hooks have no Effect equivalent.\nimport { digest } from \"./digest\"\nimport { registerHooks } from \"node:module\"\nimport { fileURLToPath, pathToFileURL } from \"node:url\"\nimport {\n\tArray,\n\tChunk,\n\tHashMap,\n\tHashSet,\n\tOption,\n\tPredicate,\n\tSchema,\n\tString,\n} from \"effect\"\n\nexport class RestartRequired extends Schema.TaggedError<\n\tRestartRequired,\n\t{ readonly brand: unique symbol }\n>()(\"RestartRequired\", { url: Schema.String }) {}\n\n// Only a missing entry is disposable; missing dependencies still fail the reload.\nexport const isMissingEntry = (url: string, cause: unknown): boolean =>\n\tString.startsWith(\"file:\")(url) &&\n\tPredicate.hasProperty(cause, \"code\") &&\n\t((cause.code === \"ERR_MODULE_NOT_FOUND\" &&\n\t\tPredicate.hasProperty(cause, \"url\") &&\n\t\tcause.url === url) ||\n\t\t(cause.code === \"ENOENT\" &&\n\t\t\tPredicate.hasProperty(cause, \"path\") &&\n\t\t\tcause.path === fileURLToPath(url)))\n\n// Allocated only when a session starts; importing this module performs no I/O.\nlet sessions = 0\n\n/** A resolution view that allocates fresh URLs for new or invalidated instances. */\nexport interface Generation {\n\treadonly id: number\n}\n\n/** Digest of the bytes actually loaded by a concrete module instance. */\nexport interface FileVersion {\n\treadonly generation: number\n\treadonly content: string | undefined\n\treadonly resolution?: string\n}\n\nexport interface Attempt {\n\treadonly generation: Generation\n\treadonly url: string\n\treadonly request?: string\n}\n\ninterface Dependency extends Attempt {\n\treadonly node: string\n}\n\n/** Resolve local requests lexically; Node's cached physical target is a separate fact. */\nconst fileRequest = (\n\tspecifier: string,\n\tparent: string,\n): Option.Option<string> => {\n\tif (\n\t\t!Array.some([\"file:\", \"./\", \"../\", \"/\"], (prefix) =>\n\t\t\tString.startsWith(prefix)(specifier),\n\t\t)\n\t)\n\t\treturn Option.none()\n\tconst url = new URL(specifier, parent)\n\treturn url.protocol === \"file:\" ? Option.some(url.href) : Option.none()\n}\n\n/** A scoped Node hook. Mutable bindings bridge synchronous hooks to Effect. */\nexport const modules = (base: string, include: (url: string) => boolean) => {\n\tconst key = `graft-hmr-${++sessions}`\n\tconst prefix = `${key}:`\n\tconst decodeRequest = Schema.decodeUnknownOption(\n\t\tSchema.TemplateLiteralParser([\n\t\t\tprefix,\n\t\t\tSchema.String.check(Schema.isPattern(/^\\d+$/)),\n\t\t\t\":\",\n\t\t\tSchema.String,\n\t\t]),\n\t)\n\tlet revision = 0\n\tlet importing:\n\t\t{ readonly generation: Generation; readonly reload: boolean } | undefined\n\tlet resolved: string | undefined\n\t// Resolution views contain only routing identities. Old code can execute after\n\t// replacement (including teardown), so these persistent maps live until close.\n\t// Cached instances also retain their facts: Node does not replay static imports.\n\t// Leases restrict observation, not the lifetime of old routing targets.\n\tlet views = HashMap.empty<number, HashMap.HashMap<string, string>>()\n\tlet edges = HashMap.empty<string, HashMap.HashMap<string, Dependency>>()\n\tlet sources = HashMap.empty<string, string>()\n\tlet dependencies = HashSet.empty<string>()\n\tlet reachCache = HashMap.empty<string, HashSet.HashSet<string>>()\n\tlet retained = HashSet.empty<string>()\n\tlet instantiatedViews = HashSet.empty<number>()\n\tconst clean = (url: string): string => {\n\t\tconst value = new URL(url)\n\t\tvalue.searchParams.delete(key)\n\t\treturn value.href\n\t}\n\tconst version = (url: string | undefined): number | undefined => {\n\t\tif (url === undefined) return undefined\n\t\tconst value = new URL(url).searchParams.get(key)\n\t\treturn value === null ? undefined : Number(value)\n\t}\n\tconst tag = (url: string, id: number) => {\n\t\tconst value = new URL(url)\n\t\tvalue.searchParams.set(key, String.String(id))\n\t\treturn value.href\n\t}\n\tconst route = (url: string, id: number): string =>\n\t\tOption.getOrElse(\n\t\t\tHashMap.get(\n\t\t\t\tOption.getOrElse(HashMap.get(views, id), HashMap.empty<string, string>),\n\t\t\t\turl,\n\t\t\t),\n\t\t\t() => tag(url, id),\n\t\t)\n\n\tconst root = (attempt: Attempt) => route(attempt.url, attempt.generation.id)\n\tconst children = (node: string) =>\n\t\tOption.getOrElse(\n\t\t\tHashMap.get(edges, node),\n\t\t\tHashMap.empty<string, Dependency>,\n\t\t)\n\tconst reachable = (node: string) => {\n\t\tconst cached = HashMap.get(reachCache, node)\n\t\tif (Option.isSome(cached)) return cached.value\n\t\tlet seen = HashSet.empty<string>()\n\t\tlet pending: Chunk.Chunk<string> = Chunk.of(node)\n\t\twhile (Chunk.isNonEmpty(pending)) {\n\t\t\tconst current = Chunk.headNonEmpty(pending)\n\t\t\tpending = Chunk.drop(pending, 1)\n\t\t\tif (HashSet.has(seen, current)) continue\n\t\t\tseen = HashSet.add(seen, current)\n\t\t\tfor (const edge of HashMap.values(children(current)))\n\t\t\t\tpending = Chunk.prepend(pending, edge.node)\n\t\t}\n\t\treachCache = HashMap.set(reachCache, node, seen)\n\t\treturn seen\n\t}\n\tconst usedBy = (attempts: ReadonlyArray<Attempt>) => {\n\t\tconst roots = HashSet.fromIterable(Array.map(attempts, root))\n\t\tlet used = HashSet.empty<string>()\n\t\tfor (const node of roots) used = HashSet.union(used, reachable(node))\n\t\treturn used\n\t}\n\tconst link = (parent: string, node: string, request?: string) => {\n\t\tif (\n\t\t\timporting === undefined &&\n\t\t\t!HashSet.has(retained, parent) &&\n\t\t\t!HashSet.has(instantiatedViews, version(parent)!)\n\t\t)\n\t\t\treturn\n\t\tretained = HashSet.add(retained, node)\n\t\tconst url = clean(node)\n\t\tconst edge = {\n\t\t\tnode,\n\t\t\turl,\n\t\t\tgeneration: { id: version(node)! },\n\t\t\t...(request === undefined ? {} : { request }),\n\t\t}\n\t\tconst previous = HashMap.get(children(parent), request ?? url)\n\t\tif (\n\t\t\tOption.exists(\n\t\t\t\tprevious,\n\t\t\t\t(previous) => previous.node === node && previous.request === request,\n\t\t\t)\n\t\t)\n\t\t\treturn\n\t\tedges = HashMap.set(\n\t\t\tedges,\n\t\t\tparent,\n\t\t\tHashMap.set(children(parent), request ?? url, edge),\n\t\t)\n\t\treachCache = HashMap.empty()\n\t}\n\tconst resolutions = (\n\t\tattempts: ReadonlyArray<Attempt>,\n\t): ReadonlyArray<Attempt> => [\n\t\t...Array.filter(attempts, (attempt) => attempt.request !== undefined),\n\t\t...Array.flatMap(Array.fromIterable(usedBy(attempts)), (node) =>\n\t\t\tArray.filter(\n\t\t\t\tHashMap.toValues(children(node)),\n\t\t\t\t(edge) => edge.request !== undefined,\n\t\t\t),\n\t\t),\n\t]\n\tconst unsupported = (url: string, format: string | null | undefined) =>\n\t\tformat === \"commonjs\" ||\n\t\tformat === \"commonjs-typescript\" ||\n\t\tformat === \"addon\" ||\n\t\tString.endsWith(\".node\")(new URL(url).pathname)\n\tconst requireRestart = (node: string) => {\n\t\tif (importing !== undefined || HashSet.has(retained, node))\n\t\t\tdependencies = HashSet.add(dependencies, node)\n\t\tif (importing?.reload === true && importing.generation.id === version(node))\n\t\t\tthrow RestartRequired.make({ url: clean(node) })\n\t}\n\tconst record = (node: string, format: string | null | undefined) => {\n\t\tif (unsupported(clean(node), format)) requireRestart(node)\n\t}\n\t// One reverse traversal closes cycles and all importers of every dirty instance.\n\tconst invalidated = (\n\t\tattempts: ReadonlyArray<Attempt>,\n\t\tdirty: HashSet.HashSet<string>,\n\t) => {\n\t\tconst used = usedBy(attempts)\n\t\tlet parents = HashMap.empty<string, HashSet.HashSet<string>>()\n\t\tlet pending = Chunk.empty<string>()\n\t\tfor (const node of used) {\n\t\t\tif (HashSet.has(dirty, clean(node)))\n\t\t\t\tpending = Chunk.prepend(pending, node)\n\t\t\tfor (const edge of HashMap.values(children(node))) {\n\t\t\t\tparents = HashMap.set(\n\t\t\t\t\tparents,\n\t\t\t\t\tedge.node,\n\t\t\t\t\tHashSet.add(\n\t\t\t\t\t\tOption.getOrElse(\n\t\t\t\t\t\t\tHashMap.get(parents, edge.node),\n\t\t\t\t\t\t\tHashSet.empty<string>,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnode,\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t\tif (edge.request !== undefined && HashSet.has(dirty, edge.request))\n\t\t\t\t\tpending = Chunk.prepend(pending, edge.node)\n\t\t\t}\n\t\t}\n\t\tfor (const attempt of attempts)\n\t\t\tif (attempt.request !== undefined && HashSet.has(dirty, attempt.request))\n\t\t\t\tpending = Chunk.prepend(pending, root(attempt))\n\t\tlet invalid = HashSet.empty<string>()\n\t\twhile (Chunk.isNonEmpty(pending)) {\n\t\t\tconst node = Chunk.headNonEmpty(pending)\n\t\t\tpending = Chunk.drop(pending, 1)\n\t\t\tif (HashSet.has(invalid, node)) continue\n\t\t\tinvalid = HashSet.add(invalid, node)\n\t\t\tfor (const parent of Option.getOrElse(\n\t\t\t\tHashMap.get(parents, node),\n\t\t\t\tHashSet.empty<string>,\n\t\t\t))\n\t\t\t\tpending = Chunk.prepend(pending, parent)\n\t\t}\n\t\treturn invalid\n\t}\n\tconst prepare = (\n\t\tattempts: ReadonlyArray<Attempt> = [],\n\t\tinvalid = HashSet.empty<string>(),\n\t): Generation => {\n\t\tconst id = ++revision\n\t\tconst seed = Array.reduce(attempts, 0, (id, attempt) =>\n\t\t\tMath.max(id, attempt.generation.id),\n\t\t)\n\t\tlet view = Option.getOrElse(\n\t\t\tHashMap.get(views, seed),\n\t\t\tHashMap.empty<string, string>,\n\t\t)\n\t\tconst used = usedBy(attempts)\n\t\t// Retain HAMT structure between views. Default routes need no stored entry;\n\t\t// only modules reused from older views need an explicit override.\n\t\tfor (const [url, node] of view)\n\t\t\tif (!HashSet.has(used, node) || HashSet.has(invalid, node))\n\t\t\t\tview = HashMap.remove(view, url)\n\t\tfor (const node of used) {\n\t\t\tif (HashSet.has(invalid, node)) continue\n\t\t\tconst url = clean(node)\n\t\t\tconst previous = HashMap.get(view, url)\n\t\t\tif (Option.isNone(previous) || version(previous.value)! < version(node)!)\n\t\t\t\tview = HashMap.set(view, url, node)\n\t\t}\n\n\t\tviews = HashMap.set(views, id, view)\n\t\treturn { id }\n\t}\n\tconst hooks = registerHooks({\n\t\tresolve(specifier, context, nextResolve) {\n\t\t\tconst parentNode = context.parentURL\n\t\t\tconst request = decodeRequest(specifier)\n\t\t\tconst entry = Option.isSome(request)\n\t\t\tconst id = Option.match(request, {\n\t\t\t\tonNone: () => version(context.parentURL),\n\t\t\t\tonSome: ([, id]) => Number(id),\n\t\t\t})\n\t\t\tif (id === undefined) return nextResolve(specifier, context)\n\t\t\tconst target = Option.match(request, {\n\t\t\t\tonNone: () => specifier,\n\t\t\t\tonSome: ([, , , target]) => target,\n\t\t\t})\n\t\t\tconst parent = entry ? base : clean(context.parentURL!)\n\t\t\tconst lexical = Option.getOrUndefined(fileRequest(target, parent))\n\t\t\tconst result = (() => {\n\t\t\t\ttry {\n\t\t\t\t\treturn nextResolve(target, { ...context, parentURL: parent })\n\t\t\t\t} catch (cause) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tPredicate.hasProperty(cause, \"url\") &&\n\t\t\t\t\t\ttypeof cause.url === \"string\" &&\n\t\t\t\t\t\tString.startsWith(\"file:\")(cause.url)\n\t\t\t\t\t) {\n\t\t\t\t\t\tif (entry) resolved = cause.url\n\t\t\t\t\t\telse if (include(cause.url))\n\t\t\t\t\t\t\tlink(parentNode!, route(cause.url, id), lexical)\n\t\t\t\t\t}\n\t\t\t\t\tthrow cause\n\t\t\t\t}\n\t\t\t})()\n\t\t\tif (entry) resolved = result.url\n\t\t\tif (!entry && result.url === \"node:module\") {\n\t\t\t\tconst node = route(result.url, id)\n\t\t\t\tlink(parentNode!, node)\n\t\t\t\trequireRestart(node)\n\t\t\t}\n\t\t\tif (\n\t\t\t\t!String.startsWith(\"file:\")(result.url) ||\n\t\t\t\t(!entry && !include(result.url))\n\t\t\t)\n\t\t\t\treturn result\n\t\t\tconst node = route(result.url, id)\n\t\t\tif (!entry) link(parentNode!, node, lexical)\n\t\t\tconst required = Array.contains(context.conditions, \"require\")\n\t\t\tif (required) requireRestart(node)\n\t\t\telse record(node, result.format)\n\t\t\treturn required || unsupported(result.url, result.format)\n\t\t\t\t? result\n\t\t\t\t: { ...result, url: node }\n\t\t},\n\t\tload(url, context, nextLoad) {\n\t\t\tconst id = version(url)\n\t\t\tif (id === undefined) return nextLoad(url, context)\n\t\t\tinstantiatedViews = HashSet.add(instantiatedViews, id)\n\t\t\tconst original = clean(url)\n\t\t\trecord(url, context.format)\n\t\t\tconst result = nextLoad(original, context)\n\t\t\tconst source = result.source\n\t\t\tif (source !== undefined && source !== null) {\n\t\t\t\tconst bytes =\n\t\t\t\t\ttypeof source === \"string\"\n\t\t\t\t\t\t? source\n\t\t\t\t\t\t: ArrayBuffer.isView(source)\n\t\t\t\t\t\t\t? new Uint8Array(\n\t\t\t\t\t\t\t\t\tsource.buffer,\n\t\t\t\t\t\t\t\t\tsource.byteOffset,\n\t\t\t\t\t\t\t\t\tsource.byteLength,\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: new Uint8Array(source)\n\t\t\t\tif (importing !== undefined || HashSet.has(retained, url))\n\t\t\t\t\tsources = HashMap.set(sources, url, digest(bytes))\n\t\t\t}\n\t\t\trecord(url, result.format)\n\t\t\treturn result\n\t\t},\n\t})\n\tconst files = (attempts: ReadonlyArray<Attempt>) => {\n\t\tlet files = HashMap.empty<string, FileVersion>()\n\t\tconst put = (url: string, node: string, resolution?: string) => {\n\t\t\tif (!String.startsWith(\"file:\")(url) || HashSet.has(dependencies, node))\n\t\t\t\treturn\n\t\t\tconst generation = version(node)!\n\t\t\tconst previous = HashMap.get(files, url)\n\t\t\tif (\n\t\t\t\tOption.exists(\n\t\t\t\t\tprevious,\n\t\t\t\t\t(previous) =>\n\t\t\t\t\t\tprevious.generation > generation ||\n\t\t\t\t\t\t(previous.generation === generation &&\n\t\t\t\t\t\t\tprevious.resolution !== undefined),\n\t\t\t\t)\n\t\t\t)\n\t\t\t\treturn\n\t\t\tfiles = HashMap.set(files, url, {\n\t\t\t\tgeneration,\n\t\t\t\tcontent: Option.getOrUndefined(HashMap.get(sources, node)),\n\t\t\t\t...(resolution === undefined ? {} : { resolution }),\n\t\t\t})\n\t\t}\n\t\tfor (const node of usedBy(attempts)) put(clean(node), node)\n\t\tfor (const attempt of resolutions(attempts))\n\t\t\tif (attempt.request !== undefined)\n\t\t\t\tput(\n\t\t\t\t\tattempt.request,\n\t\t\t\t\troot(attempt),\n\t\t\t\t\tpathToFileURL(fileURLToPath(attempt.url)).href,\n\t\t\t\t)\n\t\treturn files\n\t}\n\treturn {\n\t\tprepare,\n\t\tfiles,\n\t\tresolutions,\n\t\tinvalidated,\n\t\taffected: (attempt: Attempt, invalid: HashSet.HashSet<string>) =>\n\t\t\tHashSet.has(invalid, root(attempt)),\n\t\tfileRequest: (specifier: string) => fileRequest(specifier, base),\n\t\tunsupported: (generation: Generation, roots?: ReadonlyArray<string>) => {\n\t\t\tconst used =\n\t\t\t\troots === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: usedBy(Array.map(roots, (url) => ({ url, generation })))\n\t\t\treturn HashSet.fromIterable(\n\t\t\t\tArray.map(\n\t\t\t\t\tArray.filter(Array.fromIterable(dependencies), (node) =>\n\t\t\t\t\t\tused === undefined\n\t\t\t\t\t\t\t? version(node) === generation.id\n\t\t\t\t\t\t\t: HashSet.has(used, node),\n\t\t\t\t\t),\n\t\t\t\t\tclean,\n\t\t\t\t),\n\t\t\t)\n\t\t},\n\t\tcollect: (attempts: ReadonlyArray<Attempt>) => {\n\t\t\tconst used = usedBy(attempts)\n\t\t\tconst ownedViews = HashSet.fromIterable(\n\t\t\t\tArray.map(attempts, (attempt) => attempt.generation.id),\n\t\t\t)\n\t\t\tviews = HashMap.filter(\n\t\t\t\tviews,\n\t\t\t\t(_, id) =>\n\t\t\t\t\tid === revision ||\n\t\t\t\t\tHashSet.has(instantiatedViews, id) ||\n\t\t\t\t\tHashSet.has(ownedViews, id),\n\t\t\t)\n\t\t\t// Old code can reach any default route in its instantiated view, even\n\t\t\t// after every lease on that target closed. Preserve its complete graph,\n\t\t\t// source baseline and native capabilities until the session closes.\n\t\t\tconst keep = (node: string) =>\n\t\t\t\tHashSet.has(used, node) ||\n\t\t\t\tHashSet.has(instantiatedViews, version(node)!)\n\t\t\tretained = used\n\t\t\tsources = HashMap.filter(sources, (_, node) => keep(node))\n\t\t\tedges = HashMap.filter(edges, (_, node) => keep(node))\n\t\t\tdependencies = HashSet.filter(dependencies, keep)\n\t\t\treachCache = HashMap.filter(reachCache, (_, node) =>\n\t\t\t\tHashSet.has(used, node),\n\t\t\t)\n\t\t},\n\t\t// Internal counters support deterministic retention tests and external benchmarks.\n\t\tcounts: () => ({\n\t\t\tsources: HashMap.size(sources),\n\t\t\tedges: HashMap.size(edges),\n\t\t\tdependencies: HashSet.size(dependencies),\n\t\t\tviews: HashMap.size(views),\n\t\t}),\n\t\tstart: (generation: Generation, reload = false) => {\n\t\t\timporting = { generation, reload }\n\t\t},\n\t\tdiscard: () => {\n\t\t\timporting = undefined\n\t\t},\n\t\trequest: (specifier: string) => {\n\t\t\tresolved = undefined\n\t\t\treturn `${prefix}${importing!.generation.id}:${specifier}`\n\t\t},\n\t\tresolved: () => Option.fromUndefinedOr(resolved),\n\t\tclose: () => {\n\t\t\thooks.deregister()\n\t\t\tviews = HashMap.empty()\n\t\t\tsources = HashMap.empty()\n\t\t\tedges = HashMap.empty()\n\t\t\tdependencies = HashSet.empty()\n\t\t\treachCache = HashMap.empty()\n\t\t\tretained = HashSet.empty()\n\t\t\tinstantiatedViews = HashSet.empty()\n\t\t},\n\t}\n}\n"],"mappings":";;;;;AAeA,IAAa,kBAAb,cAAqC,OAAO,YAG1C,CAAC,CAAC,mBAAmB,EAAE,KAAK,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;AAGhD,MAAa,kBAAkB,KAAa,UAC3C,OAAO,WAAW,OAAO,CAAC,CAAC,GAAG,KAC9B,UAAU,YAAY,OAAO,MAAM,MACjC,MAAM,SAAS,0BAChB,UAAU,YAAY,OAAO,KAAK,KAClC,MAAM,QAAQ,OACb,MAAM,SAAS,YACf,UAAU,YAAY,OAAO,MAAM,KACnC,MAAM,SAAS,cAAc,GAAG;AAGnC,IAAI,WAAW;;AAyBf,MAAM,eACL,WACA,WAC2B;CAC3B,IACC,CAAC,MAAM,KAAK;EAAC;EAAS;EAAM;EAAO;CAAG,IAAI,WACzC,OAAO,WAAW,MAAM,CAAC,CAAC,SAAS,CACpC,GAEA,OAAO,OAAO,KAAK;CACpB,MAAM,MAAM,IAAI,IAAI,WAAW,MAAM;CACrC,OAAO,IAAI,aAAa,UAAU,OAAO,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK;AACvE;;AAGA,MAAa,WAAW,MAAc,YAAsC;CAC3E,MAAM,MAAM,aAAa,EAAE;CAC3B,MAAM,SAAS,GAAG,IAAI;CACtB,MAAM,gBAAgB,OAAO,oBAC5B,OAAO,sBAAsB;EAC5B;EACA,OAAO,OAAO,MAAM,OAAO,UAAU,OAAO,CAAC;EAC7C;EACA,OAAO;CACR,CAAC,CACF;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AC9C,WAAW;GACX,UAAU,QAAQ,OAAO,UAAU,GAAG,SAAS,KAAK,IAAI,CAAC;GACzD,QAAQ,QAAQ,OAAO,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;GACrD,eAAe,QAAQ,OAAO,cAAc,IAAI;GAChD,aAAa,QAAQ,OAAO,aAAa,GAAG,SAC3C,QAAQ,IAAI,MAAM,IAAI,CACvB;EACD;EAEA,eAAe;GACd,SAAS,QAAQ,KAAK,OAAO;GAC7B,OAAO,QAAQ,KAAK,KAAK;GACzB,cAAc,QAAQ,KAAK,YAAY;GACvC,OAAO,QAAQ,KAAK,KAAK;EAC1B;EACA,QAAQ,YAAwB,SAAS,UAAU;GAClD,YAAY;IAAE;IAAY;GAAO;EAClC;EACA,eAAe;GACd,YAAY,KAAA;EACb;EACA,UAAU,cAAsB;GAC/B,WAAW,KAAA;GACX,OAAO,GAAG,SAAS,UAAW,WAAW,GAAG,GAAG;EAChD;EACA,gBAAgB,OAAO,gBAAgB,QAAQ;EAC/C,aAAa;GACZ,MAAM,WAAW;GACjB,QAAQ,QAAQ,MAAM;GACtB,UAAU,QAAQ,MAAM;GACxB,QAAQ,QAAQ,MAAM;GACtB,eAAe,QAAQ,MAAM;GAC7B,aAAa,QAAQ,MAAM;GAC3B,WAAW,QAAQ,MAAM;GACzB,oBAAoB,QAAQ,MAAM;EACnC;CACD;AACD"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graftland/hmr",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-beta.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
|
-
"node": ">=22.
|
|
6
|
+
"node": ">=22.19.0"
|
|
7
7
|
},
|
|
8
8
|
"description": "Reloads plugin modules on Node.js without restarting the process",
|
|
9
9
|
"license": "Apache-2.0",
|
|
@@ -15,14 +15,16 @@
|
|
|
15
15
|
"sideEffects": false,
|
|
16
16
|
"files": [
|
|
17
17
|
"dist",
|
|
18
|
-
"src"
|
|
18
|
+
"src",
|
|
19
|
+
"README.zh-CN.md",
|
|
20
|
+
"README.zh-TW.md"
|
|
19
21
|
],
|
|
20
22
|
"exports": {
|
|
21
23
|
".": "./dist/index.js",
|
|
22
24
|
"./package.json": "./package.json"
|
|
23
25
|
},
|
|
24
26
|
"peerDependencies": {
|
|
25
|
-
"effect": "4.1
|
|
27
|
+
"effect": "4.1.*"
|
|
26
28
|
},
|
|
27
29
|
"devDependencies": {
|
|
28
30
|
"@effect/platform-node": "4.1.2",
|
|
@@ -31,7 +33,7 @@
|
|
|
31
33
|
"vitest": "5.1.0"
|
|
32
34
|
},
|
|
33
35
|
"dependencies": {
|
|
34
|
-
"@graftland/graft": "0.
|
|
36
|
+
"@graftland/graft": "0.2.0-beta.1"
|
|
35
37
|
},
|
|
36
38
|
"scripts": {
|
|
37
39
|
"build": "tsdown",
|