@graftland/hmr 0.1.0 → 0.2.0-beta.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.
@@ -1,50 +1,121 @@
1
1
  import { registerHooks } from "node:module";
2
- import { HashSet, Option, Predicate, Schema, String as String$1 } from "effect";
3
- import { fileURLToPath } from "node:url";
2
+ import { fileURLToPath, pathToFileURL } from "node:url";
3
+ import { Array, HashMap, HashSet, Option, Predicate, Schema, String } from "effect";
4
+ import { Base64 } from "effect/encoding";
4
5
  // src/internal/modules.ts
5
6
  var RestartRequired = class extends Schema.TaggedError()("RestartRequired", { url: Schema.String }) {};
6
- const isMissingEntry = (url, cause) => String$1.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
+ 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
+ /** What `request` produces: the generation that imports a specifier. */
25
+ const decodeRequest = Schema.decodeUnknownOption(Schema.TemplateLiteralParser([
26
+ prefix,
27
+ Schema.String.check(Schema.isPattern(/^\d+$/)),
28
+ ":",
29
+ Schema.String
30
+ ]));
12
31
  let revision = 0;
13
- let recording;
14
- let reloading = false;
32
+ let importing;
33
+ let dependencies = HashMap.empty();
34
+ let edges = HashMap.empty();
35
+ const link = (id, parent, child, request) => {
36
+ const graph = Option.getOrElse(HashMap.get(edges, id), HashMap.empty);
37
+ const children = Option.getOrElse(HashMap.get(graph, parent), HashMap.empty);
38
+ edges = HashMap.set(edges, id, HashMap.set(graph, parent, HashMap.set(children, request ?? child, {
39
+ generation: { id: Number(id) },
40
+ parent,
41
+ url: child,
42
+ ...request === void 0 ? {} : { request }
43
+ })));
44
+ };
45
+ const reachable = (id, roots) => {
46
+ const graph = Option.getOrElse(HashMap.get(edges, id), HashMap.empty);
47
+ let seen = HashSet.empty();
48
+ let pending = roots;
49
+ while (Array.isReadonlyArrayNonEmpty(pending)) {
50
+ const [url, ...rest] = pending;
51
+ pending = rest;
52
+ if (HashSet.has(seen, url)) continue;
53
+ seen = HashSet.add(seen, url);
54
+ pending = Array.appendAll(pending, Array.map(HashMap.toValues(Option.getOrElse(HashMap.get(graph, url), HashMap.empty)), (edge) => edge.url));
55
+ }
56
+ return seen;
57
+ };
58
+ const resolutionsFor = (attempt) => {
59
+ const id = String.String(attempt.generation.id);
60
+ const used = reachable(id, [attempt.url]);
61
+ const graph = Option.getOrElse(HashMap.get(edges, id), HashMap.empty);
62
+ return [...attempt.request === void 0 ? [] : [attempt], ...Array.flatMap(HashMap.toValues(graph), (children) => Array.filter(HashMap.toValues(children), (edge) => edge.request !== void 0 && HashSet.has(used, edge.parent)))];
63
+ };
64
+ let sources = HashMap.empty();
15
65
  let resolved;
16
- const prepare = () => ({
17
- id: String(++revision),
18
- unsupported: HashSet.empty()
19
- });
66
+ const prepare = () => ({ id: ++revision });
20
67
  const clean = (url) => {
21
68
  const value = new URL(url);
22
69
  value.searchParams.delete(key);
23
70
  return value.href;
24
71
  };
25
72
  const version = (url) => url === void 0 ? null : new URL(url).searchParams.get(key);
26
- const unsupported = (url, format) => format === "commonjs" || format === "commonjs-typescript" || format === "addon" || String$1.endsWith(".node")(new URL(url).pathname);
73
+ const unsupported = (url, format) => format === "commonjs" || format === "commonjs-typescript" || format === "addon" || String.endsWith(".node")(new URL(url).pathname);
74
+ const requireRestart = (url, id) => {
75
+ dependencies = HashMap.set(dependencies, id, HashSet.add(Option.getOrElse(HashMap.get(dependencies, id), HashSet.empty), url));
76
+ if (importing !== void 0 && String.String(importing.generation.id) === id && importing.reload) throw RestartRequired.make({ url });
77
+ };
27
78
  const record = (url, id, format) => {
28
- if (recording?.id !== id) return;
29
- if (unsupported(url, format)) {
30
- recording.unsupported = HashSet.add(recording.unsupported, url);
31
- if (reloading) throw RestartRequired.make({ url });
32
- }
79
+ if (unsupported(url, format)) requireRestart(url, id);
33
80
  };
34
81
  const hooks = registerHooks({
35
82
  resolve(specifier, context, nextResolve) {
36
- const entry = String$1.startsWith(prefix)(specifier);
37
- const separator = !entry ? 0 : prefix.length + Option.getOrThrow(String$1.indexOf(":")(String$1.slice(prefix.length)(specifier)));
38
- const id = entry ? String$1.slice(prefix.length, separator)(specifier) : version(context.parentURL);
39
- if (id === void 0 || id === null) return nextResolve(specifier, context);
40
- const result = nextResolve(entry ? String$1.slice(separator + 1)(specifier) : specifier, {
83
+ const request = decodeRequest(specifier);
84
+ const entry = Option.isSome(request);
85
+ const id = Option.match(request, {
86
+ onNone: () => version(context.parentURL),
87
+ onSome: ([, id]) => id
88
+ });
89
+ if (id === null) return nextResolve(specifier, context);
90
+ const resolve = () => nextResolve(Option.match(request, {
91
+ onNone: () => specifier,
92
+ onSome: ([, , , target]) => target
93
+ }), {
41
94
  ...context,
42
95
  parentURL: entry ? base : clean(context.parentURL)
43
96
  });
97
+ const result = (() => {
98
+ try {
99
+ return resolve();
100
+ } catch (cause) {
101
+ if (Predicate.hasProperty(cause, "url") && typeof cause.url === "string" && String.startsWith("file:")(cause.url)) {
102
+ if (entry) resolved = cause.url;
103
+ else if (context.parentURL !== void 0 && include(cause.url)) link(id, clean(context.parentURL), cause.url, Option.getOrUndefined(fileRequest(specifier, clean(context.parentURL))));
104
+ }
105
+ throw cause;
106
+ }
107
+ })();
44
108
  if (entry) resolved = result.url;
45
- if (!String$1.startsWith("file:")(result.url) || !entry && !include(result.url)) return result;
46
- record(result.url, id, result.format);
47
- if (unsupported(result.url, result.format)) return result;
109
+ if (!entry && result.url === "node:module" && context.parentURL !== void 0) {
110
+ link(id, clean(context.parentURL), result.url);
111
+ requireRestart(result.url, id);
112
+ }
113
+ if (!String.startsWith("file:")(result.url) || !entry && !include(result.url)) return result;
114
+ if (!entry && context.parentURL !== void 0) link(id, clean(context.parentURL), result.url, Option.getOrUndefined(fileRequest(specifier, clean(context.parentURL))));
115
+ const required = Array.contains(context.conditions, "require");
116
+ if (required) requireRestart(result.url, id);
117
+ else record(result.url, id, result.format);
118
+ if (required || unsupported(result.url, result.format)) return result;
48
119
  const url = new URL(result.url);
49
120
  url.searchParams.set(key, id);
50
121
  return {
@@ -58,21 +129,63 @@ const modules = (base, include) => {
58
129
  const original = clean(url);
59
130
  record(original, id, context.format);
60
131
  const result = nextLoad(original, context);
132
+ const source = result.source;
133
+ if (source !== void 0 && source !== null) {
134
+ const bytes = typeof source === "string" ? source : ArrayBuffer.isView(source) ? new Uint8Array(source.buffer, source.byteOffset, source.byteLength) : new Uint8Array(source);
135
+ sources = HashMap.set(sources, id, HashMap.set(Option.getOrElse(HashMap.get(sources, id), HashMap.empty), original, Base64.encode(bytes)));
136
+ }
61
137
  record(original, id, result.format);
62
138
  return result;
63
139
  }
64
140
  });
65
141
  return {
66
142
  prepare,
143
+ fileRequest: (specifier) => fileRequest(specifier, base),
144
+ resolutions: (attempts) => Array.flatMap(attempts, resolutionsFor),
145
+ files: (attempts) => Array.reduce(attempts, HashMap.empty(), (files, { generation, url, request }) => {
146
+ const contents = Option.getOrElse(HashMap.get(sources, String.String(generation.id)), HashMap.empty);
147
+ const unversioned = Option.getOrElse(HashMap.get(dependencies, String.String(generation.id)), HashSet.empty);
148
+ const tracked = Array.reduce(Array.fromIterable(reachable(String.String(generation.id), [url])), files, (files, url) => {
149
+ if (!String.startsWith("file:")(url) || HashSet.has(unversioned, url)) return files;
150
+ if (Option.exists(HashMap.get(files, url), (current) => current.generation > generation.id || current.generation === generation.id && current.resolution !== void 0)) return files;
151
+ return HashMap.set(files, url, {
152
+ generation: generation.id,
153
+ content: Option.getOrUndefined(HashMap.get(contents, url))
154
+ });
155
+ });
156
+ return Array.reduce(resolutionsFor({
157
+ generation,
158
+ url,
159
+ ...request === void 0 ? {} : { request }
160
+ }), tracked, (files, edge) => {
161
+ if (edge.request === void 0 || HashSet.has(unversioned, edge.url) || Option.exists(HashMap.get(files, edge.request), (file) => file.generation > generation.id)) return files;
162
+ return HashMap.set(files, edge.request, {
163
+ generation: generation.id,
164
+ content: Option.getOrUndefined(HashMap.get(contents, edge.url)),
165
+ resolution: pathToFileURL(fileURLToPath(edge.url)).href
166
+ });
167
+ });
168
+ }),
169
+ unsupported: (generation, roots) => {
170
+ const found = Option.getOrElse(HashMap.get(dependencies, String.String(generation.id)), HashSet.empty);
171
+ if (roots === void 0) return found;
172
+ const used = reachable(String.String(generation.id), roots);
173
+ return HashSet.filter(found, (url) => HashSet.has(used, url));
174
+ },
67
175
  start: (generation, reload = false) => {
68
- recording = generation;
69
- reloading = reload;
176
+ importing = {
177
+ generation,
178
+ reload
179
+ };
70
180
  },
71
181
  discard: () => {
72
- recording = void 0;
182
+ importing = void 0;
183
+ },
184
+ request: (specifier) => {
185
+ resolved = void 0;
186
+ return `${prefix}${importing.generation.id}:${specifier}`;
73
187
  },
74
- request: (specifier) => `${prefix}${recording.id}:${specifier}`,
75
- resolved: () => resolved,
188
+ resolved: () => Option.fromUndefinedOr(resolved),
76
189
  close: () => hooks.deregister()
77
190
  };
78
191
  };
@@ -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,KAAA,IAAY,OAAO,IAAI,IAAI,GAAG,CAAC,CAAC,aAAa,IAAI,GAAG;CAC7D,MAAM,eAAe,KAAa,WACjC,WAAW,cACX,WAAW,yBACX,WAAW,WACXA,SAAI,SAAS,OAAO,CAAC,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,QAAQ;CAC5C,MAAM,UACL,KACA,IACA,WACI;EACJ,IAAI,WAAW,OAAO,IAAI;EAC1B,IAAI,YAAY,KAAK,MAAM,GAAG;GAC7B,UAAU,cAAc,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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 { Base64 } from \"effect/encoding\"\nimport { registerHooks } from \"node:module\"\nimport { fileURLToPath, pathToFileURL } from \"node:url\"\nimport {\n\tArray,\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\nexport interface Generation {\n\treadonly id: number\n}\n\n/** Bytes actually read by a particular native import attempt. */\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 parent: 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\t/** What `request` produces: the generation that imports a specifier. */\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\t// Dependency facts outlive an import operation: apply may import modules later.\n\tlet dependencies = HashMap.empty<string, HashSet.HashSet<string>>()\n\tlet edges = HashMap.empty<\n\t\tstring,\n\t\tHashMap.HashMap<string, HashMap.HashMap<string, Dependency>>\n\t>()\n\tconst link = (\n\t\tid: string,\n\t\tparent: string,\n\t\tchild: string,\n\t\trequest?: string,\n\t) => {\n\t\tconst graph = Option.getOrElse(\n\t\t\tHashMap.get(edges, id),\n\t\t\tHashMap.empty<string, HashMap.HashMap<string, Dependency>>,\n\t\t)\n\t\tconst children = Option.getOrElse(\n\t\t\tHashMap.get(graph, parent),\n\t\t\tHashMap.empty<string, Dependency>,\n\t\t)\n\t\tedges = HashMap.set(\n\t\t\tedges,\n\t\t\tid,\n\t\t\tHashMap.set(\n\t\t\t\tgraph,\n\t\t\t\tparent,\n\t\t\t\tHashMap.set(children, request ?? child, {\n\t\t\t\t\tgeneration: { id: Number(id) },\n\t\t\t\t\tparent,\n\t\t\t\t\turl: child,\n\t\t\t\t\t...(request === undefined ? {} : { request }),\n\t\t\t\t}),\n\t\t\t),\n\t\t)\n\t}\n\tconst reachable = (id: string, roots: ReadonlyArray<string>) => {\n\t\tconst graph = Option.getOrElse(\n\t\t\tHashMap.get(edges, id),\n\t\t\tHashMap.empty<string, HashMap.HashMap<string, Dependency>>,\n\t\t)\n\t\tlet seen = HashSet.empty<string>()\n\t\tlet pending = roots\n\t\twhile (Array.isReadonlyArrayNonEmpty(pending)) {\n\t\t\tconst [url, ...rest] = pending\n\t\t\tpending = rest\n\t\t\tif (HashSet.has(seen, url)) continue\n\t\t\tseen = HashSet.add(seen, url)\n\t\t\tpending = Array.appendAll(\n\t\t\t\tpending,\n\t\t\t\tArray.map(\n\t\t\t\t\tHashMap.toValues(\n\t\t\t\t\t\tOption.getOrElse(\n\t\t\t\t\t\t\tHashMap.get(graph, url),\n\t\t\t\t\t\t\tHashMap.empty<string, Dependency>,\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t\t(edge) => edge.url,\n\t\t\t\t),\n\t\t\t)\n\t\t}\n\t\treturn seen\n\t}\n\t// Both checks and polling derive resolution facts from the same owned graph.\n\tconst resolutionsFor = (attempt: Attempt): ReadonlyArray<Attempt> => {\n\t\tconst id = String.String(attempt.generation.id)\n\t\tconst used = reachable(id, [attempt.url])\n\t\tconst graph = Option.getOrElse(\n\t\t\tHashMap.get(edges, id),\n\t\t\tHashMap.empty<string, HashMap.HashMap<string, Dependency>>,\n\t\t)\n\t\treturn [\n\t\t\t...(attempt.request === undefined ? [] : [attempt]),\n\t\t\t...Array.flatMap(HashMap.toValues(graph), (children) =>\n\t\t\t\tArray.filter(\n\t\t\t\t\tHashMap.toValues(children),\n\t\t\t\t\t(edge) =>\n\t\t\t\t\t\tedge.request !== undefined && HashSet.has(used, edge.parent),\n\t\t\t\t),\n\t\t\t),\n\t\t]\n\t}\n\n\tlet sources = HashMap.empty<string, HashMap.HashMap<string, string>>()\n\tlet resolved: string | undefined\n\n\tconst prepare = (): Generation => ({\n\t\tid: ++revision,\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\tString.endsWith(\".node\")(new URL(url).pathname)\n\tconst requireRestart = (url: string, id: string) => {\n\t\tdependencies = HashMap.set(\n\t\t\tdependencies,\n\t\t\tid,\n\t\t\tHashSet.add(\n\t\t\t\tOption.getOrElse(HashMap.get(dependencies, id), HashSet.empty<string>),\n\t\t\t\turl,\n\t\t\t),\n\t\t)\n\t\tif (\n\t\t\timporting !== undefined &&\n\t\t\tString.String(importing.generation.id) === id &&\n\t\t\timporting.reload\n\t\t)\n\t\t\tthrow RestartRequired.make({ url })\n\t}\n\n\tconst record = (\n\t\turl: string,\n\t\tid: string,\n\t\tformat: string | null | undefined,\n\t) => {\n\t\tif (unsupported(url, format)) requireRestart(url, id)\n\t}\n\n\tconst hooks = registerHooks({\n\t\tresolve(specifier, context, nextResolve) {\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]) => id,\n\t\t\t})\n\t\t\tif (id === null) return nextResolve(specifier, context)\n\t\t\tconst resolve = () =>\n\t\t\t\tnextResolve(\n\t\t\t\t\tOption.match(request, {\n\t\t\t\t\t\tonNone: () => specifier,\n\t\t\t\t\t\tonSome: ([, , , target]) => target,\n\t\t\t\t\t}),\n\t\t\t\t\t{\n\t\t\t\t\t\t...context,\n\t\t\t\t\t\tparentURL: entry ? base : clean(context.parentURL!),\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\tconst result = (() => {\n\t\t\t\ttry {\n\t\t\t\t\treturn resolve()\n\t\t\t\t} catch (cause) {\n\t\t\t\t\t// Node reports the missing file even though resolution did not complete.\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 (context.parentURL !== undefined && include(cause.url))\n\t\t\t\t\t\t\tlink(\n\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\tclean(context.parentURL),\n\t\t\t\t\t\t\t\tcause.url,\n\t\t\t\t\t\t\t\tOption.getOrUndefined(\n\t\t\t\t\t\t\t\t\tfileRequest(specifier, clean(context.parentURL)),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t)\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\t// Acquiring node:module permits require calls that Node can satisfy\n\t\t\t// without hooks. Record this capability before any cache can hide them.\n\t\t\tif (\n\t\t\t\t!entry &&\n\t\t\t\tresult.url === \"node:module\" &&\n\t\t\t\tcontext.parentURL !== undefined\n\t\t\t) {\n\t\t\t\tlink(id, clean(context.parentURL), result.url)\n\t\t\t\trequireRestart(result.url, id)\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\tif (!entry && context.parentURL !== undefined)\n\t\t\t\tlink(\n\t\t\t\t\tid,\n\t\t\t\t\tclean(context.parentURL),\n\t\t\t\t\tresult.url,\n\t\t\t\t\tOption.getOrUndefined(\n\t\t\t\t\t\tfileRequest(specifier, clean(context.parentURL)),\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\tconst required = Array.contains(context.conditions, \"require\")\n\t\t\tif (required) requireRestart(result.url, id)\n\t\t\telse record(result.url, id, result.format)\n\t\t\tif (required || 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\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\tsources = HashMap.set(\n\t\t\t\t\tsources,\n\t\t\t\t\tid,\n\t\t\t\t\tHashMap.set(\n\t\t\t\t\t\tOption.getOrElse(\n\t\t\t\t\t\t\tHashMap.get(sources, id),\n\t\t\t\t\t\t\tHashMap.empty<string, string>,\n\t\t\t\t\t\t),\n\t\t\t\t\t\toriginal,\n\t\t\t\t\t\tBase64.encode(bytes),\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t}\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\tfileRequest: (specifier: string) => fileRequest(specifier, base),\n\t\tresolutions: (attempts: ReadonlyArray<Attempt>) =>\n\t\t\tArray.flatMap(attempts, resolutionsFor),\n\t\tfiles: (attempts: ReadonlyArray<Attempt>) =>\n\t\t\tArray.reduce(\n\t\t\t\tattempts,\n\t\t\t\tHashMap.empty<string, FileVersion>(),\n\t\t\t\t(files, { generation, url, request }) => {\n\t\t\t\t\tconst contents = Option.getOrElse(\n\t\t\t\t\t\tHashMap.get(sources, String.String(generation.id)),\n\t\t\t\t\t\tHashMap.empty<string, string>,\n\t\t\t\t\t)\n\t\t\t\t\tconst unversioned = Option.getOrElse(\n\t\t\t\t\t\tHashMap.get(dependencies, String.String(generation.id)),\n\t\t\t\t\t\tHashSet.empty<string>,\n\t\t\t\t\t)\n\t\t\t\t\tconst tracked = Array.reduce(\n\t\t\t\t\t\tArray.fromIterable(reachable(String.String(generation.id), [url])),\n\t\t\t\t\t\tfiles,\n\t\t\t\t\t\t(files, url) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t!String.startsWith(\"file:\")(url) ||\n\t\t\t\t\t\t\t\tHashSet.has(unversioned, url)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\treturn files\n\t\t\t\t\t\t\t// A retained failed lease must not override a newer import\n\t\t\t\t\t\t\t// of the same file just because its owner is visited last.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tOption.exists(\n\t\t\t\t\t\t\t\t\tHashMap.get(files, url),\n\t\t\t\t\t\t\t\t\t(current) =>\n\t\t\t\t\t\t\t\t\t\tcurrent.generation > generation.id ||\n\t\t\t\t\t\t\t\t\t\t(current.generation === generation.id &&\n\t\t\t\t\t\t\t\t\t\t\tcurrent.resolution !== undefined),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\treturn files\n\t\t\t\t\t\t\treturn HashMap.set(files, url, {\n\t\t\t\t\t\t\t\tgeneration: generation.id,\n\t\t\t\t\t\t\t\tcontent: Option.getOrUndefined(HashMap.get(contents, url)),\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t},\n\t\t\t\t\t)\n\t\t\t\t\treturn Array.reduce(\n\t\t\t\t\t\tresolutionsFor({\n\t\t\t\t\t\t\tgeneration,\n\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t...(request === undefined ? {} : { request }),\n\t\t\t\t\t\t}),\n\t\t\t\t\t\ttracked,\n\t\t\t\t\t\t(files, edge) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tedge.request === undefined ||\n\t\t\t\t\t\t\t\tHashSet.has(unversioned, edge.url) ||\n\t\t\t\t\t\t\t\tOption.exists(\n\t\t\t\t\t\t\t\t\tHashMap.get(files, edge.request),\n\t\t\t\t\t\t\t\t\t(file) => file.generation > generation.id,\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\treturn files\n\t\t\t\t\t\t\treturn HashMap.set(files, edge.request, {\n\t\t\t\t\t\t\t\tgeneration: generation.id,\n\t\t\t\t\t\t\t\tcontent: Option.getOrUndefined(HashMap.get(contents, edge.url)),\n\t\t\t\t\t\t\t\tresolution: pathToFileURL(fileURLToPath(edge.url)).href,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t},\n\t\t\t\t\t)\n\t\t\t\t},\n\t\t\t),\n\t\tunsupported: (generation: Generation, roots?: ReadonlyArray<string>) => {\n\t\t\tconst found = Option.getOrElse(\n\t\t\t\tHashMap.get(dependencies, String.String(generation.id)),\n\t\t\t\tHashSet.empty<string>,\n\t\t\t)\n\t\t\tif (roots === undefined) return found\n\t\t\tconst used = reachable(String.String(generation.id), roots)\n\t\t\treturn HashSet.filter(found, (url) => HashSet.has(used, url))\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: () => hooks.deregister(),\n\t}\n}\n"],"mappings":";;;;;AAcA,IAAa,kBAAb,cAAqC,OAAO,YAG1C,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"version": "0.2.0-beta.0",
4
4
  "type": "module",
5
5
  "engines": {
6
- "node": ">=22.15.0"
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.2"
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.1.0"
36
+ "@graftland/graft": "0.2.0-beta.0"
35
37
  },
36
38
  "scripts": {
37
39
  "build": "tsdown",