@nimbus-sh/worker 0.12.0 → 0.13.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.
Files changed (198) hide show
  1. package/dist/esbuild-cli-artifact.generated.d.ts +1 -1
  2. package/dist/esbuild-cli-artifact.generated.js +4 -4
  3. package/dist/esbuild-wasm-bundle.generated.d.ts +11 -10
  4. package/dist/esbuild-wasm-bundle.generated.d.ts.map +1 -1
  5. package/dist/esbuild-wasm-bundle.generated.js +11 -10
  6. package/dist/facets/build-facet.d.ts +53 -0
  7. package/dist/facets/build-facet.d.ts.map +1 -0
  8. package/dist/facets/build-facet.js +346 -0
  9. package/dist/facets/cirrus-real.d.ts +3 -0
  10. package/dist/facets/cirrus-real.d.ts.map +1 -1
  11. package/dist/facets/cirrus-real.js +1 -2
  12. package/dist/facets/compose.d.ts +1 -0
  13. package/dist/facets/compose.d.ts.map +1 -1
  14. package/dist/facets/compose.js +3 -0
  15. package/dist/facets/data-plan.d.ts +14 -30
  16. package/dist/facets/data-plan.d.ts.map +1 -1
  17. package/dist/facets/data-plan.js +153 -13
  18. package/dist/facets/dev-stylesheet.d.ts +27 -0
  19. package/dist/facets/dev-stylesheet.d.ts.map +1 -0
  20. package/dist/facets/dev-stylesheet.js +65 -0
  21. package/dist/facets/esbuild-transform.d.ts +23 -18
  22. package/dist/facets/esbuild-transform.d.ts.map +1 -1
  23. package/dist/facets/esbuild-transform.js +63 -109
  24. package/dist/facets/manager.d.ts +49 -9
  25. package/dist/facets/manager.d.ts.map +1 -1
  26. package/dist/facets/manager.js +238 -69
  27. package/dist/facets/oxc-transform.d.ts +29 -0
  28. package/dist/facets/oxc-transform.d.ts.map +1 -0
  29. package/dist/facets/oxc-transform.js +198 -0
  30. package/dist/facets/prebundle-pool.d.ts +23 -0
  31. package/dist/facets/prebundle-pool.d.ts.map +1 -0
  32. package/dist/facets/prebundle-pool.js +55 -0
  33. package/dist/facets/process.d.ts +13 -6
  34. package/dist/facets/process.d.ts.map +1 -1
  35. package/dist/facets/process.js +37 -31
  36. package/dist/facets/transform-store.d.ts +4 -4
  37. package/dist/facets/transform-store.js +4 -4
  38. package/dist/facets/vite-dev-server.d.ts +89 -12
  39. package/dist/facets/vite-dev-server.d.ts.map +1 -1
  40. package/dist/facets/vite-dev-server.js +66 -43
  41. package/dist/hosted/commands.d.ts.map +1 -1
  42. package/dist/hosted/commands.js +20 -4
  43. package/dist/hosted/runtime.d.ts.map +1 -1
  44. package/dist/hosted/runtime.js +7 -2
  45. package/dist/hosted/services.d.ts +3 -3
  46. package/dist/hosted/services.d.ts.map +1 -1
  47. package/dist/hosted/services.js +102 -95
  48. package/dist/hosted/session.d.ts +1 -0
  49. package/dist/hosted/session.d.ts.map +1 -1
  50. package/dist/loaders/generated-workers.d.ts +3 -0
  51. package/dist/loaders/generated-workers.d.ts.map +1 -1
  52. package/dist/loaders/generated-workers.js +3 -0
  53. package/dist/napi-wasm-artifacts.generated.js +2 -2
  54. package/dist/node-shims-artifact.generated.d.ts +14 -1
  55. package/dist/node-shims-artifact.generated.d.ts.map +1 -1
  56. package/dist/node-shims-artifact.generated.js +23 -10
  57. package/dist/npm/bin-links.d.ts +7 -4
  58. package/dist/npm/bin-links.d.ts.map +1 -1
  59. package/dist/npm/bin-links.js +14 -55
  60. package/dist/npm/cache.d.ts +6 -0
  61. package/dist/npm/cache.d.ts.map +1 -1
  62. package/dist/npm/cache.js +26 -4
  63. package/dist/npm/installer.d.ts +1 -1
  64. package/dist/npm/installer.d.ts.map +1 -1
  65. package/dist/npm/installer.js +26 -52
  66. package/dist/npm/pre-bundle-facet.d.ts +15 -117
  67. package/dist/npm/pre-bundle-facet.d.ts.map +1 -1
  68. package/dist/npm/pre-bundle-facet.js +13 -511
  69. package/dist/oxc-facet-artifact.generated.d.ts +18 -0
  70. package/dist/oxc-facet-artifact.generated.d.ts.map +1 -0
  71. package/dist/oxc-facet-artifact.generated.js +17 -0
  72. package/dist/oxc-wasm-artifact.generated.d.ts +20 -0
  73. package/dist/oxc-wasm-artifact.generated.d.ts.map +1 -0
  74. package/dist/oxc-wasm-artifact.generated.js +19 -0
  75. package/dist/rolldown-facet-artifact.generated.d.ts +18 -0
  76. package/dist/rolldown-facet-artifact.generated.d.ts.map +1 -0
  77. package/dist/rolldown-facet-artifact.generated.js +17 -0
  78. package/dist/router/remote-api.d.ts.map +1 -1
  79. package/dist/router/remote-api.js +9 -0
  80. package/dist/runtime/bash-repl.d.ts.map +1 -1
  81. package/dist/runtime/bash-repl.js +1 -4
  82. package/dist/runtime/cpython-resident.d.ts.map +1 -1
  83. package/dist/runtime/cpython-resident.js +1 -0
  84. package/dist/runtime/esbuild-wasm-bytes.d.ts +25 -23
  85. package/dist/runtime/esbuild-wasm-bytes.d.ts.map +1 -1
  86. package/dist/runtime/esbuild-wasm-bytes.js +30 -25
  87. package/dist/runtime/facet-loader-host.d.ts +5 -4
  88. package/dist/runtime/facet-loader-host.d.ts.map +1 -1
  89. package/dist/runtime/facet-loader-host.js +5 -4
  90. package/dist/runtime/node-runner.d.ts +2 -0
  91. package/dist/runtime/node-runner.d.ts.map +1 -1
  92. package/dist/runtime/node-runner.js +1 -0
  93. package/dist/runtime/node-shims-artifact.d.ts +8 -1
  94. package/dist/runtime/node-shims-artifact.d.ts.map +1 -1
  95. package/dist/runtime/node-shims-artifact.js +32 -4
  96. package/dist/runtime/node-shims.d.ts.map +1 -1
  97. package/dist/runtime/node-shims.js +145 -109
  98. package/dist/runtime/opencode-facet-runner.d.ts.map +1 -1
  99. package/dist/runtime/opencode-facet-runner.js +6 -2
  100. package/dist/runtime/oxc-wasm-bytes.d.ts +19 -0
  101. package/dist/runtime/oxc-wasm-bytes.d.ts.map +1 -0
  102. package/dist/runtime/oxc-wasm-bytes.js +39 -0
  103. package/dist/runtime/package-manager.js +1 -1
  104. package/dist/runtime/process-logs-api.d.ts.map +1 -1
  105. package/dist/runtime/process-logs-api.js +2 -0
  106. package/dist/runtime/project-fs.d.ts +8 -1
  107. package/dist/runtime/project-fs.d.ts.map +1 -1
  108. package/dist/runtime/project-fs.js +15 -1
  109. package/dist/runtime/python-repl.d.ts +40 -1
  110. package/dist/runtime/python-repl.d.ts.map +1 -1
  111. package/dist/runtime/python-repl.js +19 -11
  112. package/dist/runtime/ruby-repl.d.ts +38 -0
  113. package/dist/runtime/ruby-repl.d.ts.map +1 -1
  114. package/dist/runtime/ruby-repl.js +24 -5
  115. package/dist/runtime/ruby-resident.d.ts.map +1 -1
  116. package/dist/runtime/ruby-resident.js +2 -0
  117. package/dist/session/nimbus-session.d.ts +13 -8
  118. package/dist/session/nimbus-session.d.ts.map +1 -1
  119. package/dist/session/nimbus-session.js +11 -5
  120. package/dist/session/programmatic.d.ts +25 -30
  121. package/dist/session/programmatic.d.ts.map +1 -1
  122. package/dist/session/programmatic.js +65 -93
  123. package/dist/session/routes.d.ts.map +1 -1
  124. package/dist/session/routes.js +23 -7
  125. package/dist/session/rpc.d.ts +16 -6
  126. package/dist/session/rpc.d.ts.map +1 -1
  127. package/dist/session/rpc.js +53 -13
  128. package/dist/session/start-real-vite.d.ts +24 -9
  129. package/dist/session/start-real-vite.d.ts.map +1 -1
  130. package/dist/session/start-real-vite.js +40 -4
  131. package/dist/session/supervisor-op.d.ts +14 -0
  132. package/dist/session/supervisor-op.d.ts.map +1 -1
  133. package/dist/session/supervisor-op.js +49 -0
  134. package/dist/session/supervisor-rpc.d.ts +11 -0
  135. package/dist/session/supervisor-rpc.d.ts.map +1 -1
  136. package/dist/session/supervisor-rpc.js +18 -0
  137. package/dist/session/vite-command.d.ts.map +1 -1
  138. package/dist/session/vite-command.js +23 -19
  139. package/dist/session/ws-relay.d.ts.map +1 -1
  140. package/dist/session/ws-relay.js +13 -1
  141. package/dist/shell/npm-bin-entrypoints.d.ts +3 -1
  142. package/dist/shell/npm-bin-entrypoints.d.ts.map +1 -1
  143. package/dist/shell/npm-bin-entrypoints.js +53 -25
  144. package/dist/vfs/facet-resident-store.d.ts.map +1 -1
  145. package/dist/vfs/facet-resident-store.js +11 -5
  146. package/dist/wrangler/nimbus-wrangler.d.ts +8 -0
  147. package/dist/wrangler/nimbus-wrangler.d.ts.map +1 -1
  148. package/dist/wrangler/nimbus-wrangler.js +54 -57
  149. package/package.json +6 -4
  150. package/public/_assets/esbuild-0.24.2.wasm +0 -0
  151. package/public/_assets/napi-wasm/loader/{99efae93dd1dcc2b → ab7e57fe9e8750c2}/napi-wasm-loader.mjs +4 -4
  152. package/public/_assets/napi-wasm/loader/{99efae93dd1dcc2b → ab7e57fe9e8750c2}/provenance.json +2 -2
  153. package/public/_assets/oxc/nimbus-oxc-1aa8c4c7057c6c28.provenance.json +72 -0
  154. package/public/_assets/oxc/nimbus-oxc-1aa8c4c7057c6c28.wasm +0 -0
  155. package/public/_assets/runtime/esbuild-cli-f13e6a112b03ac07.js +1143 -0
  156. package/public/_assets/runtime/js-interpreter-3c37c48024f0f651.js +23 -0
  157. package/public/_assets/runtime/js-interpreter-ops-2f4dfec6798e70fc.js +290 -0
  158. package/public/_assets/runtime/js-interpreter-primordials-e620a61b7e9800fa.js +1 -0
  159. package/public/_assets/runtime/{node-shims-f92f16c7d7c532e9.js → node-shims-e3adc4576da31e6e.js} +651 -103
  160. package/public/_assets/runtime/{esbuild-cli-b7aecffd4c6a36fe.js → oxc-facet-fd86fefcdf16bf9c.js} +217 -1047
  161. package/public/_assets/runtime/{resident-store-92386265e8b306dc.js → resident-store-009f39539ac989fc.js} +11 -5
  162. package/public/_assets/runtime/rolldown-facet-09983434e2dbe93e.js +15165 -0
  163. package/public/_assets/runtime/{vfs-write-ledger-d33ee0034446c3e0.js → vfs-write-ledger-9e9594591425a9b8.js} +4 -1
  164. package/scripts/acorn-primordials.mjs +637 -0
  165. package/scripts/bundle-esbuild-wasm.mjs +42 -50
  166. package/scripts/bundle-facet-workers.mjs +247 -18
  167. package/scripts/bundle-node-shims.mjs +29 -2
  168. package/scripts/bundle-oxc-wasm.mjs +105 -0
  169. package/scripts/interpreter-bundle.mjs +105 -0
  170. package/scripts/napi-wasm/build.mjs +4 -1
  171. package/scripts/napi-wasm/loader/napi-wasm-loader.ts +38 -3
  172. package/scripts/oxc-wasm/Cargo.lock +1246 -0
  173. package/scripts/oxc-wasm/Cargo.toml +30 -0
  174. package/scripts/oxc-wasm/build.mjs +249 -0
  175. package/scripts/oxc-wasm/examples/memory.rs +51 -0
  176. package/scripts/oxc-wasm/examples/transform.rs +20 -0
  177. package/scripts/oxc-wasm/inputs.mjs +32 -0
  178. package/scripts/oxc-wasm/rust-toolchain.toml +5 -0
  179. package/scripts/oxc-wasm/src/abi.rs +136 -0
  180. package/scripts/oxc-wasm/src/diagnostics.rs +49 -0
  181. package/scripts/oxc-wasm/src/helpers.rs +139 -0
  182. package/scripts/oxc-wasm/src/lib.rs +247 -0
  183. package/scripts/oxc-wasm/src/module.rs +978 -0
  184. package/scripts/oxc-wasm/src/names.rs +175 -0
  185. package/scripts/oxc-wasm/src/options.rs +154 -0
  186. package/scripts/parser-audit.mjs +492 -0
  187. package/scripts/rolldown-facet/entry.mjs +21 -0
  188. package/scripts/rolldown-facet/shims.mjs +64 -0
  189. package/dist/facets/esbuild-bundle-pool.d.ts +0 -43
  190. package/dist/facets/esbuild-bundle-pool.d.ts.map +0 -1
  191. package/dist/facets/esbuild-bundle-pool.js +0 -80
  192. package/dist/loaders/pre-bundle-preamble.d.ts +0 -44
  193. package/dist/loaders/pre-bundle-preamble.d.ts.map +0 -1
  194. package/dist/loaders/pre-bundle-preamble.js +0 -116
  195. package/dist/runtime/host-wasm.d.ts +0 -8
  196. package/dist/runtime/host-wasm.d.ts.map +0 -1
  197. package/dist/runtime/host-wasm.js +0 -33
  198. /package/public/_assets/napi-wasm/loader/{99efae93dd1dcc2b → ab7e57fe9e8750c2}/wasi-trampoline.wasm +0 -0
@@ -0,0 +1,492 @@
1
+ /**
2
+ * parser-audit.mjs — what of the realm the parser the interpreter bundles can
3
+ * reach, checked with nothing of the rewrite that made it.
4
+ *
5
+ * acorn-primordials.mjs rewrites acorn to reach the realm only through
6
+ * core src/interpreter/parser-realm.ts. A check sharing its scope analysis
7
+ * and its tables would share its blind spots, so this one has its own,
8
+ * deliberately simple: scopes are functions and catch clauses (a `let`,
9
+ * `const` or class is refused rather than scoped), and a form is allowed
10
+ * only where this proves it reaches nothing a program can replace. It
11
+ * refuses what it cannot prove:
12
+ *
13
+ * - any syntax but a fixed set: no destructuring, rest, spread, default
14
+ * parameters, templates, classes, arrows, generators, async, `in`,
15
+ * `instanceof`, `with`, optional chains;
16
+ * - any free name but parser-realm's namespace and undefined, NaN, Infinity;
17
+ * - parser-realm's exports anywhere but where their kind allows: a function
18
+ * called, tested, or held by a variable that is itself only called,
19
+ * tested, or handed to parser-realm's `call`; a record's member read; a
20
+ * symbol as a computed key; RegExp also constructed; an error constructor
21
+ * only constructed, its error only thrown or given fields by `define`;
22
+ * nothing read of any of them, or of what holds them, but a record's member;
23
+ * - `new` but of RegExp, the errors, `ownConstructor(this)`, or a variable
24
+ * whose value is a function literal made to inherit nothing by
25
+ * `nullPrototypes` where it is declared, which is the only thing
26
+ * `nullPrototypes` may be given; a field of such a function only once so made;
27
+ * - an object literal but as `own(...)`'s argument, a list literal at all,
28
+ * a regexp literal but as `regexp(...)`'s argument;
29
+ * - a read or call of a name a built-in prototype has, but a field the
30
+ * parser sets itself (a call, a field it sets to a function);
31
+ * - a computed read but `typeof o === "string" ? index(o, k) : o[k]`, a
32
+ * call by a computed key but of a variable whose value is a list literal;
33
+ * - for-in but over `owned(...)`; `arguments` but read for its `length`
34
+ * or as `argument(arguments, k)`; a caught exception but compared or
35
+ * rethrown;
36
+ * - a call of a method by a name the parser sets nowhere; a member of a
37
+ * function (or what holds one) not made to inherit nothing; a function
38
+ * declared anywhere but at the top of the module or of a function.
39
+ *
40
+ * One thing it takes as given, which no syntax shows: the value a field is
41
+ * read from or set on, an operand of `+` or a comparison, and `this`, is a
42
+ * primitive or an object the parser made, which inherits nothing of the
43
+ * realm's. tests/unit/interpreter-parser-realm.mjs checks that by running
44
+ * the parser in a realm that logs every built-in it reaches.
45
+ */
46
+
47
+ import { parse } from 'acorn';
48
+
49
+ /** The namespace the parser imports parser-realm as. */
50
+ const REALM = '$$';
51
+ const FIXED = new Set(['undefined', 'NaN', 'Infinity']);
52
+
53
+ /** Names a built-in prototype has: what a value of the realm's answers, read or called, from its prototype. */
54
+ function prototypeNames() {
55
+ const iterator = Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()));
56
+ const prototypes = [
57
+ Object.prototype, Function.prototype, Array.prototype, String.prototype, Number.prototype, Boolean.prototype,
58
+ BigInt.prototype, Symbol.prototype, RegExp.prototype, Error.prototype, iterator,
59
+ ];
60
+ const names = new Set();
61
+ for (const prototype of prototypes) for (const name of Object.getOwnPropertyNames(prototype)) names.add(name);
62
+ names.delete('length');
63
+ return names;
64
+ }
65
+
66
+ /** What each of parser-realm's exports is, from the module itself. */
67
+ function exportKinds(realm) {
68
+ const kinds = new Map();
69
+ for (const name of Object.keys(realm)) {
70
+ const value = realm[name];
71
+ if (typeof value === 'function' && (value === Error || Error.prototype.isPrototypeOf(value.prototype))) {
72
+ kinds.set(name, { kind: 'error' });
73
+ } else if (typeof value === 'function') {
74
+ // A function whose regexps inherit nothing of RegExp.prototype may be constructed.
75
+ let constructs = false;
76
+ try {
77
+ const made = Reflect.construct(value, ['a']);
78
+ constructs = made instanceof Object === false && Object.getPrototypeOf(made) !== RegExp.prototype && typeof made.exec === 'function';
79
+ } catch {
80
+ constructs = false;
81
+ }
82
+ kinds.set(name, { kind: constructs ? 'constructor' : 'function' });
83
+ } else if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
84
+ const members = new Set(Object.keys(value).filter((member) => typeof value[member] === 'function'));
85
+ kinds.set(name, { kind: 'record', members });
86
+ } else {
87
+ kinds.set(name, { kind: typeof value === 'symbol' ? 'symbol' : 'value' });
88
+ }
89
+ }
90
+ return kinds;
91
+ }
92
+
93
+ const ALLOWED = new Set([
94
+ 'Program', 'ImportDeclaration', 'ImportNamespaceSpecifier', 'ExportNamedDeclaration', 'ExportSpecifier',
95
+ 'VariableDeclaration', 'VariableDeclarator', 'FunctionDeclaration', 'FunctionExpression',
96
+ 'ReturnStatement', 'IfStatement', 'ForStatement', 'ForInStatement', 'WhileStatement', 'DoWhileStatement',
97
+ 'BreakStatement', 'ContinueStatement', 'LabeledStatement', 'BlockStatement', 'ExpressionStatement', 'EmptyStatement',
98
+ 'DebuggerStatement', 'ThrowStatement', 'TryStatement', 'CatchClause', 'SwitchStatement', 'SwitchCase',
99
+ 'Identifier', 'Literal', 'ThisExpression', 'ObjectExpression', 'Property', 'UnaryExpression', 'UpdateExpression',
100
+ 'BinaryExpression', 'AssignmentExpression', 'LogicalExpression', 'MemberExpression', 'ConditionalExpression',
101
+ 'CallExpression', 'NewExpression', 'SequenceExpression',
102
+ ]);
103
+
104
+ /** Each child node of `node`, once, in source order. */
105
+ function children(node) {
106
+ const out = [];
107
+ for (const key of Object.keys(node)) {
108
+ if (key === 'type' || key === 'start' || key === 'end') continue;
109
+ const value = node[key];
110
+ for (const item of Array.isArray(value) ? value : [value]) {
111
+ if (item && typeof item.type === 'string' && !out.includes(item)) out.push(item);
112
+ }
113
+ }
114
+ return out.sort((a, b) => a.start - b.start);
115
+ }
116
+
117
+ /** Whether the Identifier `id` under `parent` names a binding (rather than a field, a label or an export's name). */
118
+ function isReference(id, parent) {
119
+ switch (parent.type) {
120
+ case 'MemberExpression': return parent.object === id || parent.computed;
121
+ case 'Property': return parent.value === id || parent.computed;
122
+ case 'LabeledStatement': case 'BreakStatement': case 'ContinueStatement': return false;
123
+ case 'ExportSpecifier': return parent.local === id;
124
+ case 'ImportNamespaceSpecifier': return false;
125
+ case 'VariableDeclarator': return parent.init === id;
126
+ case 'FunctionDeclaration': case 'FunctionExpression': return parent.body === id;
127
+ case 'CatchClause': return false;
128
+ default: return true;
129
+ }
130
+ }
131
+
132
+ /** The audit's findings for the parser module `code` (none, for the parser the interpreter bundles). */
133
+ export function auditParser(code, realm) {
134
+ const program = parse(code, { ecmaVersion: 'latest', sourceType: 'module' });
135
+ const kinds = exportKinds(realm);
136
+ const builtins = prototypeNames();
137
+ const findings = [];
138
+ const line = (node) => code.slice(0, node.start).split('\n').length;
139
+ const find = (node, what) => findings.push(`line ${line(node)}: ${what}`);
140
+ const parents = new Map();
141
+ const visitAll = (node, parent, visit) => {
142
+ parents.set(node, parent);
143
+ visit(node, parent);
144
+ for (const child of children(node)) visitAll(child, node, visit);
145
+ };
146
+ visitAll(program, null, () => {});
147
+
148
+ // ── Bindings: functions and catch clauses scope; var and function declarations hoist to their function ──
149
+ const scopes = new Map();
150
+ const bindings = new Map();
151
+ const declare = (scope, id, kind, extra = {}) => {
152
+ let binding = scope.names.get(id.name);
153
+ if (!binding) {
154
+ binding = { name: id.name, kind, scope, values: [], refs: [], assigned: false, ...extra };
155
+ scope.names.set(id.name, binding);
156
+ }
157
+ bindings.set(id, binding);
158
+ return binding;
159
+ };
160
+ const hoist = (body, scope) => {
161
+ const visit = (node) => {
162
+ if (node.type === 'FunctionDeclaration') { declare(scope, node.id, 'function').values.push(node); return; }
163
+ if (node.type === 'FunctionExpression') return;
164
+ if (node.type === 'VariableDeclaration') {
165
+ if (node.kind !== 'var') find(node, `a ${node.kind} declaration, which this does not scope`);
166
+ for (const d of node.declarations) {
167
+ if (d.id.type !== 'Identifier') { find(d.id, `a ${d.id.type}, which this does not allow`); continue; }
168
+ const binding = declare(scope, d.id, 'var');
169
+ binding.values.push(d.init ?? null);
170
+ }
171
+ }
172
+ for (const child of children(node)) visit(child);
173
+ };
174
+ for (const child of children(body)) visit(child);
175
+ };
176
+ const root = { parent: null, kind: 'module', names: new Map() };
177
+ scopes.set(program, root);
178
+ for (const statement of program.body) {
179
+ if (statement.type === 'ImportDeclaration') {
180
+ const spec = statement.specifiers;
181
+ if (statement !== program.body[0] || spec.length !== 1 || spec[0].type !== 'ImportNamespaceSpecifier' || spec[0].local.name !== REALM) {
182
+ find(statement, `an import other than parser-realm's namespace, ${REALM}, first`);
183
+ } else {
184
+ declare(root, spec[0].local, 'realm');
185
+ }
186
+ }
187
+ }
188
+ hoist(program, root);
189
+ const enter = (node, parent) => {
190
+ if (node.type === 'FunctionDeclaration' || node.type === 'FunctionExpression') {
191
+ if (node.async || node.generator) find(node, 'an async or generator function');
192
+ const scope = { parent: scopeOf(parent), kind: 'function', names: new Map() };
193
+ scopes.set(node, scope);
194
+ if (node.type === 'FunctionExpression' && node.id) declare(scope, node.id, 'function').values.push(node);
195
+ for (const param of node.params) {
196
+ if (param.type !== 'Identifier') find(param, `a ${param.type} parameter, which this does not allow`);
197
+ else declare(scope, param, 'param');
198
+ }
199
+ scope.names.set('arguments', { name: 'arguments', kind: 'arguments', scope, values: [], refs: [], assigned: false });
200
+ hoist(node.body, scope);
201
+ } else if (node.type === 'CatchClause') {
202
+ const scope = { parent: scopeOf(parent), kind: 'catch', names: new Map() };
203
+ scopes.set(node, scope);
204
+ if (node.param && node.param.type !== 'Identifier') find(node.param, `a ${node.param.type} caught, which this does not allow`);
205
+ else if (node.param) declare(scope, node.param, 'caught');
206
+ }
207
+ };
208
+ const scopeOf = (node) => {
209
+ for (let n = node; n; n = parents.get(n)) if (scopes.has(n)) return scopes.get(n);
210
+ return root;
211
+ };
212
+ visitAll(program, null, (node, parent) => { if (node !== program) enter(node, parent); });
213
+ const resolve = (id) => {
214
+ for (let scope = scopeOf(parents.get(id)); scope; scope = scope.parent) {
215
+ if (scope.names.has(id.name)) return scope.names.get(id.name);
216
+ }
217
+ return null;
218
+ };
219
+ const references = new Map();
220
+ visitAll(program, null, (node, parent) => {
221
+ if (node.type !== 'Identifier' || !parent || bindings.has(node) || !isReference(node, parent)) return;
222
+ const binding = resolve(node);
223
+ references.set(node, binding);
224
+ if (binding) binding.refs.push(node);
225
+ });
226
+ for (const [id, binding] of references) {
227
+ if (!binding) continue;
228
+ const parent = parents.get(id);
229
+ if ((parent.type === 'AssignmentExpression' && parent.left === id) || parent.type === 'UpdateExpression') {
230
+ binding.assigned = true;
231
+ if (parent.type === 'AssignmentExpression') binding.values.push(parent.right);
232
+ }
233
+ }
234
+ const bindingOf = (n) => (n && n.type === 'Identifier' ? references.get(n) ?? null : null);
235
+ /** The binding of the function `binding` holds: itself, if its value is a function literal, or (following aliases) another's. */
236
+ const functionBinding = (binding, seen = new Set()) => {
237
+ if (!binding || seen.has(binding)) return null;
238
+ seen.add(binding);
239
+ for (const value of binding.values) {
240
+ if (value && (value.type === 'FunctionExpression' || value.type === 'FunctionDeclaration')) return binding;
241
+ if (value && value.type === 'Identifier') { const held = functionBinding(bindingOf(value), seen); if (held) return held; }
242
+ }
243
+ return null;
244
+ };
245
+
246
+ // ── What parser-realm's exports, and what holds them, are ──
247
+ const isRealm = (n) => n && n.type === 'Identifier' && bindingOf(n)?.kind === 'realm';
248
+ const exportOf = (n) => (n && n.type === 'MemberExpression' && !n.computed && isRealm(n.object) ? n.property.name : null);
249
+ const isRealmCall = (n, name) => n && n.type === 'CallExpression' && exportOf(n.callee) === name;
250
+ const kindOf = (name) => kinds.get(name)?.kind ?? null;
251
+ /** A record of parser-realm's, named or held: its export's name. */
252
+ const recordOf = (n) => {
253
+ const name = exportOf(n);
254
+ if (name !== null) return kindOf(name) === 'record' ? name : null;
255
+ const binding = bindingOf(n);
256
+ if (!binding || binding.kind !== 'var' || binding.assigned || binding.values.length !== 1) return null;
257
+ return recordOf(binding.values[0]);
258
+ };
259
+ /** Whether `value` is a function of parser-realm's, or what holds one. */
260
+ const holdsCapture = (value, seen = new Set()) => {
261
+ if (!value) return false;
262
+ const name = exportOf(value);
263
+ if (name !== null) return ['function', 'constructor', 'value'].includes(kindOf(name));
264
+ if (value.type === 'MemberExpression' && !value.computed && recordOf(value.object) !== null) return true;
265
+ if (value.type === 'LogicalExpression') return holdsCapture(value.left, seen) || holdsCapture(value.right, seen);
266
+ const binding = bindingOf(value);
267
+ if (binding && !seen.has(binding)) { seen.add(binding); return binding.values.some((v) => holdsCapture(v, seen)); }
268
+ return false;
269
+ };
270
+ const isCaptureBinding = (binding) => binding && binding.kind === 'var' && binding.values.some((v) => holdsCapture(v));
271
+ /** Whether `n`'s value is only tested for truth. */
272
+ const isTested = (n) => {
273
+ const parent = parents.get(n);
274
+ if (['IfStatement', 'WhileStatement', 'DoWhileStatement', 'ConditionalExpression', 'ForStatement'].includes(parent.type) && parent.test === n) return true;
275
+ if (parent.type === 'UnaryExpression' && parent.operator === '!') return true;
276
+ return parent.type === 'LogicalExpression' && isTested(parent);
277
+ };
278
+ /** Where a function, or what holds one, may be: called, tested, held, or given to parser-realm's `call`. */
279
+ const usedAsFunction = (n) => {
280
+ const parent = parents.get(n);
281
+ if (parent.type === 'CallExpression' && parent.callee === n) return true;
282
+ if (parent.type === 'UnaryExpression' && parent.operator === 'typeof') return true;
283
+ if (isTested(n)) return true;
284
+ if (parent.type === 'VariableDeclarator' && parent.init === n) return true;
285
+ if (parent.type === 'LogicalExpression' && parents.get(parent).type === 'VariableDeclarator') return true;
286
+ return isRealmCall(parent, 'call') && parent.arguments[0] === n;
287
+ };
288
+
289
+ // ── acorn's own constructors, and the fields the parser sets ──
290
+ const functionLiteral = (binding) => binding && binding.scope === root && !binding.assigned && binding.values.length === 1
291
+ && (binding.values[0].type === 'FunctionExpression' || binding.values[0].type === 'FunctionDeclaration');
292
+ const nulled = new Set();
293
+ const imports = program.body.filter((s) => s.type === 'ImportDeclaration').length;
294
+ program.body.forEach((statement, index) => {
295
+ if (statement.type !== 'ExpressionStatement' || !isRealmCall(statement.expression, 'nullPrototypes')) return;
296
+ const target = statement.expression.arguments[0];
297
+ const binding = bindingOf(target);
298
+ if (statement.expression.arguments.length !== 1 || !functionLiteral(binding)) {
299
+ find(statement, 'nullPrototypes given something other than a variable whose value is a function literal');
300
+ return;
301
+ }
302
+ // Where it is declared: right after its var statement; a function declaration's, before any statement but these.
303
+ const declaration = binding.values[0];
304
+ const declared = declaration.type === 'FunctionDeclaration'
305
+ ? program.body.slice(imports, index).every((s) => s.type === 'ExpressionStatement' && isRealmCall(s.expression, 'nullPrototypes'))
306
+ : program.body[index - 1]?.type === 'VariableDeclaration' && program.body[index - 1].declarations.some((d) => d.init === declaration);
307
+ if (!declared) find(statement, `nullPrototypes(${target.name}) away from where ${target.name} is declared`);
308
+ else nulled.add(binding);
309
+ });
310
+ const fieldsSet = new Set();
311
+ const methodsSet = new Set();
312
+ const isFunctionValue = (n) => n && (n.type === 'FunctionExpression' || (n.type === 'MemberExpression' && !n.computed && methodsSet.has(n.property.name))
313
+ || (n.type === 'Identifier' && bindingOf(n)?.kind === 'param'));
314
+ for (let size = -1; size !== fieldsSet.size + methodsSet.size;) {
315
+ size = fieldsSet.size + methodsSet.size;
316
+ visitAll(program, null, (node) => {
317
+ if (node.type === 'AssignmentExpression' && node.left.type === 'MemberExpression' && !node.left.computed) {
318
+ fieldsSet.add(node.left.property.name);
319
+ if (isFunctionValue(node.right)) methodsSet.add(node.left.property.name);
320
+ }
321
+ if (node.type === 'Property' && !node.computed && node.key.type === 'Identifier') {
322
+ fieldsSet.add(node.key.name);
323
+ if (node.value.type === 'FunctionExpression') methodsSet.add(node.key.name);
324
+ }
325
+ });
326
+ }
327
+
328
+ // ── The checks ──
329
+ visitAll(program, null, (node, parent) => {
330
+ if (!ALLOWED.has(node.type)) { find(node, `${node.type}, which this does not allow`); return; }
331
+ if (node.type === 'FunctionDeclaration' && parent.type !== 'Program' && !(parent.type === 'BlockStatement' && scopes.get(parents.get(parent))?.kind === 'function')) {
332
+ find(node, 'a function declared in a block, which a module scopes to the block');
333
+ }
334
+ switch (node.type) {
335
+ case 'Identifier': {
336
+ if (!references.has(node)) return;
337
+ const binding = references.get(node);
338
+ if (binding === null) {
339
+ if (!FIXED.has(node.name)) find(node, `the global ${node.name}`);
340
+ return;
341
+ }
342
+ if (binding.kind === 'realm') {
343
+ if (!(parent.type === 'MemberExpression' && parent.object === node && !parent.computed && kinds.has(parent.property.name))) {
344
+ find(node, `${REALM} used other than for one of its exports`);
345
+ }
346
+ return;
347
+ }
348
+ if (binding.kind === 'arguments') {
349
+ const length = parent.type === 'MemberExpression' && parent.object === node && !parent.computed && parent.property.name === 'length'
350
+ && !(parents.get(parent).type === 'AssignmentExpression' && parents.get(parent).left === parent) && parents.get(parent).type !== 'UpdateExpression';
351
+ const key = isRealmCall(parent, 'argument') ? parent.arguments[1] : null;
352
+ const element = key !== null && parent.arguments.length === 2 && parent.arguments[0] === node
353
+ && !(key.type === 'Literal' && typeof key.value !== 'number');
354
+ if (!length && !element) find(node, 'arguments used other than for its length or argument(arguments, k)');
355
+ }
356
+ if (binding.kind === 'caught' && parent.type !== 'ThrowStatement' && !(parent.type === 'BinaryExpression' && ['===', '!=='].includes(parent.operator))) {
357
+ find(node, `the caught ${node.name} used other than compared or rethrown`);
358
+ }
359
+ if (isCaptureBinding(binding) && !usedAsFunction(node) && !(parent.type === 'MemberExpression' && parent.object === node && recordOf(node) !== null)) {
360
+ find(node, `${node.name}, which holds a function of the realm's, used other than called or tested`);
361
+ }
362
+ if (recordOf(node) !== null && !(parent.type === 'MemberExpression' && parent.object === node && !parent.computed) && !(parent.type === 'VariableDeclarator')) {
363
+ find(node, `${node.name}, which holds a record of captures, used other than for a member`);
364
+ }
365
+ return;
366
+ }
367
+ case 'MemberExpression': {
368
+ const name = exportOf(node);
369
+ if (name !== null) { checkExport(node, name); return; }
370
+ if (isRealm(node.object)) return;
371
+ const record = recordOf(node.object);
372
+ if (record !== null) {
373
+ if (node.computed || !kinds.get(record).members.has(node.property.name)) find(node, `a member of the record ${record} it does not hold`);
374
+ else if (!usedAsFunction(node)) find(node, `${record}.${node.property.name}, a function of the realm's, used other than called or tested`);
375
+ return;
376
+ }
377
+ if (node.object.type === 'Identifier' && isCaptureBinding(bindingOf(node.object))) {
378
+ find(node, `a member of ${node.object.name}, which holds a function of the realm's`);
379
+ return;
380
+ }
381
+ if (node.object.type === 'Identifier' && bindingOf(node.object)?.kind === 'arguments') return;
382
+ const objectBinding = bindingOf(node.object);
383
+ const fn = functionBinding(objectBinding);
384
+ if (fn && !nulled.has(fn)) find(node, `a member of ${node.object.name}, a function that inherits Function.prototype`);
385
+ const write = (parent.type === 'AssignmentExpression' && parent.left === node) || parent.type === 'UpdateExpression'
386
+ || (parent.type === 'UnaryExpression' && parent.operator === 'delete');
387
+ const called = parent.type === 'CallExpression' && parent.callee === node;
388
+ if (node.computed) {
389
+ if (called) {
390
+ const list = objectBinding && objectBinding.kind === 'var' && !objectBinding.assigned && objectBinding.values.length === 1 && isRealmCall(objectBinding.values[0], 'list');
391
+ if (!list) find(node, 'a call by a computed key of something other than a list the parser made');
392
+ } else if (!write && !isGuardedIndex(node, parent)) {
393
+ find(node, 'a computed read, which may read a string past its end');
394
+ }
395
+ return;
396
+ }
397
+ const field = node.property.name;
398
+ if (builtins.has(field) && (called ? !methodsSet.has(field) : !fieldsSet.has(field))) {
399
+ find(node, `${called ? 'a call' : write ? 'a write' : 'a read'} of ${field}, which a built-in prototype has`);
400
+ } else if (called && !fieldsSet.has(field)) {
401
+ find(node, `a call of ${field}, a name the parser sets nowhere`);
402
+ }
403
+ return;
404
+ }
405
+ case 'CallExpression':
406
+ if (isRealmCall(node, 'own') && (node.arguments.length !== 1 || node.arguments[0].type !== 'ObjectExpression')) find(node, 'own given other than one object literal');
407
+ return;
408
+ case 'NewExpression': {
409
+ const callee = node.callee;
410
+ const name = exportOf(callee);
411
+ if (name !== null && (kindOf(name) === 'constructor' || kindOf(name) === 'error')) return;
412
+ if (isRealmCall(callee, 'ownConstructor') && callee.arguments.length === 1 && callee.arguments[0].type === 'ThisExpression') return;
413
+ const binding = bindingOf(callee);
414
+ if (functionLiteral(binding) && nulled.has(binding)) return;
415
+ find(node, `new of ${code.slice(callee.start, callee.end)}, which is not a constructor that inherits nothing`);
416
+ return;
417
+ }
418
+ case 'ObjectExpression':
419
+ if (!(isRealmCall(parent, 'own') && parent.arguments[0] === node)) find(node, 'an object literal that inherits Object.prototype');
420
+ for (const p of node.properties) {
421
+ if (p.type !== 'Property' || p.kind !== 'init' || p.computed) find(p, 'a property that is computed, a getter or a setter');
422
+ else if ((p.key.type === 'Identifier' && p.key.name === '__proto__') || (p.key.type === 'Literal' && p.key.value === '__proto__')) find(p, 'a property naming the prototype');
423
+ }
424
+ return;
425
+ case 'Literal':
426
+ if (node.regex && !(isRealmCall(parent, 'regexp') && parent.arguments[0] === node)) find(node, 'a regexp literal that inherits RegExp.prototype');
427
+ return;
428
+ case 'ForInStatement':
429
+ if (!(isRealmCall(node.right, 'owned') && node.right.arguments.length === 1)) find(node, 'for-in over an object not checked by owned');
430
+ return;
431
+ case 'ThisExpression':
432
+ if (parent.type === 'NewExpression' && parent.callee === node) find(node, 'new this, unchecked');
433
+ return;
434
+ case 'BinaryExpression':
435
+ if (node.operator === 'in' || node.operator === 'instanceof') find(node, `\`${node.operator}\`, which consults the realm`);
436
+ return;
437
+ case 'AssignmentExpression':
438
+ if (node.left.type !== 'Identifier' && node.left.type !== 'MemberExpression') find(node, `an assignment to a ${node.left.type}`);
439
+ return;
440
+ default:
441
+ return;
442
+ }
443
+ });
444
+
445
+ /** `typeof o === "string" ? $$.index(o, k) : o[k]`, with `member` its `o[k]`. */
446
+ function isGuardedIndex(member, conditional) {
447
+ if (conditional.type !== 'ConditionalExpression' || conditional.alternate !== member) return false;
448
+ const text = (n) => code.slice(n.start, n.end);
449
+ const { test, consequent } = conditional;
450
+ return test.type === 'BinaryExpression' && test.operator === '===' && test.left.type === 'UnaryExpression' && test.left.operator === 'typeof'
451
+ && text(test.left.argument) === text(member.object) && test.right.type === 'Literal' && test.right.value === 'string'
452
+ && isRealmCall(consequent, 'index') && consequent.arguments.length === 2
453
+ && text(consequent.arguments[0]) === text(member.object) && text(consequent.arguments[1]) === text(member.property);
454
+ }
455
+
456
+ /** Whether `member`, `$$.name`, is where its export's kind allows. */
457
+ function checkExport(member, name) {
458
+ const parent = parents.get(member);
459
+ const kind = kindOf(name);
460
+ if (kind === null) { find(member, `${REALM}.${name}, which parser-realm does not export`); return; }
461
+ if (parent.type === 'AssignmentExpression' && parent.left === member) { find(member, `a write of ${REALM}.${name}`); return; }
462
+ switch (kind) {
463
+ case 'record':
464
+ if (!(parent.type === 'MemberExpression' && parent.object === member && !parent.computed) && parent.type !== 'VariableDeclarator') {
465
+ find(member, `the record ${name} used other than for a member`);
466
+ }
467
+ return;
468
+ case 'symbol':
469
+ if (!(parent.type === 'MemberExpression' && parent.computed && parent.property === member)) find(member, `the symbol ${name} used other than as a key`);
470
+ return;
471
+ case 'error': {
472
+ if (!(parent.type === 'NewExpression' && parent.callee === member)) { find(member, `the error constructor ${name} used other than constructed`); return; }
473
+ const holder = parents.get(parent);
474
+ if (holder.type === 'ThrowStatement') return;
475
+ const binding = holder.type === 'VariableDeclarator' && holder.init === parent ? bindings.get(holder.id) : null;
476
+ const onlyThrownOrGiven = binding && !binding.assigned && binding.refs.every((ref) => {
477
+ const at = parents.get(ref);
478
+ return at.type === 'ThrowStatement' || (isRealmCall(at, 'define') && at.arguments[0] === ref);
479
+ });
480
+ if (!onlyThrownOrGiven) find(member, `an error of ${name} used other than thrown or given fields by define`);
481
+ return;
482
+ }
483
+ case 'constructor':
484
+ if (!(parent.type === 'NewExpression' && parent.callee === member) && !usedAsFunction(member)) find(member, `${name} used other than called, constructed or tested`);
485
+ return;
486
+ default:
487
+ if (!usedAsFunction(member)) find(member, `${name} used other than called or tested`);
488
+ }
489
+ }
490
+
491
+ return findings;
492
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The build facet's runtime: rolldown's JavaScript API over the staged
3
+ * threadless rolldown binding, core's esbuild-contract adapter
4
+ * (runtime/rolldown-build.ts), and the pre-bundle of one npm specifier from
5
+ * its slice (runtime/prebundle-slice.ts). scripts/bundle-facet-workers.mjs bundles this
6
+ * file, with shims.mjs standing in for the Node modules a facet does not
7
+ * have, into a module of the build facet's module map; the facet's body
8
+ * installs the binding at `globalThis.__nimbusRolldownBinding` before it
9
+ * imports this module.
10
+ */
11
+ import { rolldown } from 'rolldown';
12
+ import { buildWithRolldown } from '../../../core/src/runtime/rolldown-build.ts';
13
+ import { prebundleSlice } from '../../../core/src/runtime/prebundle-slice.ts';
14
+
15
+ export function build(options, plugin) {
16
+ return buildWithRolldown({ rolldown }, options, plugin);
17
+ }
18
+
19
+ export function prebundle(spec) {
20
+ return prebundleSlice(spec, build);
21
+ }
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Node modules rolldown's JavaScript imports that a build facet has no use
3
+ * for, or that workerd's nodejs_compat may not answer as Node does: each is
4
+ * what the bundling path of rolldown reads of it, and nothing else. Anything
5
+ * else of them that runs throws, naming itself.
6
+ */
7
+ const unsupported = (what) => () => { throw new Error(`Nimbus's build facet does not support ${what}`); };
8
+
9
+ // node:worker_threads: not the main thread (no trace subscriber), and no workers (parallel plugins).
10
+ export const isMainThread = false;
11
+ export class Worker { constructor() { unsupported('worker_threads.Worker')(); } }
12
+ export class MessageChannel { constructor() { unsupported('worker_threads.MessageChannel')(); } }
13
+
14
+ // node:tty, node:os: no terminal, no colour.
15
+ export const isatty = () => false;
16
+ export class WriteStream { constructor() { unsupported('tty.WriteStream')(); } }
17
+ export const EOL = '\n';
18
+ export const platform = () => 'linux';
19
+ export const homedir = () => '/';
20
+ export const tmpdir = () => '/tmp';
21
+ export const cpus = () => [];
22
+
23
+ // node:util: plain text.
24
+ export const styleText = (_format, text) => text;
25
+ export const formatWithOptions = (_options, ...args) => args.map((a) => (typeof a === 'string' ? a : JSON.stringify(a))).join(' ');
26
+ export const inspect = (value) => (typeof value === 'string' ? value : JSON.stringify(value));
27
+
28
+ // node:module: no CommonJS loading.
29
+ export class Module {}
30
+ export const createRequire = () => unsupported('require');
31
+
32
+ // node:fs, node:fs/promises: modules come from the plugin; nothing is read.
33
+ export const readFileSync = unsupported('fs.readFileSync');
34
+ export const existsSync = () => false;
35
+ export const readFile = unsupported('fs.readFile');
36
+ export const writeFile = unsupported('fs.writeFile');
37
+ export const stat = unsupported('fs.stat');
38
+
39
+ // node:process
40
+ export const env = {};
41
+ export const cwd = () => '/';
42
+ export const argv = [];
43
+ export const versions = {};
44
+ export const stdin = { isTTY: false, on() {} };
45
+ export const stdout = { isTTY: false, write() {} };
46
+ export const stderr = { isTTY: false, write() {} };
47
+ export const exit = unsupported('process.exit');
48
+ export const on = () => {};
49
+
50
+ // node:readline, node:child_process: no prompts, no processes.
51
+ export const createInterface = unsupported('readline.createInterface');
52
+ export const spawn = unsupported('child_process.spawn');
53
+ export const execSync = unsupported('child_process.execSync');
54
+
55
+ // node:url
56
+ export const fileURLToPath = (url) => decodeURIComponent(new URL(String(url)).pathname);
57
+ export const pathToFileURL = (path) => new URL(`file://${encodeURI(path)}`);
58
+
59
+ const self = {
60
+ isMainThread, Worker, MessageChannel, isatty, WriteStream, EOL, platform, homedir, tmpdir, cpus, styleText, formatWithOptions, inspect,
61
+ Module, createRequire, readFileSync, existsSync, readFile, writeFile, stat, env, cwd, argv, stdin, versions, stdout, stderr, exit, on,
62
+ fileURLToPath, pathToFileURL, createInterface, spawn, execSync, promises: { readFile, writeFile, stat },
63
+ };
64
+ export default self;
@@ -1,43 +0,0 @@
1
- /**
2
- * EsbuildBundlePool — the session's single esbuild facet pool.
3
- *
4
- * Install-time pre-bundling and on-demand /@modules/ bundling dispatch the
5
- * same worker (the pre-bundle preamble + esbuild.wasm, one slot). One pool,
6
- * owned by the session, warms one loader slot for as long as the installer
7
- * and dev server live, and is disposed with them.
8
- *
9
- * The wasm is the host Worker's own compiled esbuild module
10
- * (runtime/host-wasm.ts), shared with the facet. The pool keeps no copy of
11
- * the bytes, so it holds no supervisor allocation credit: it used to fetch
12
- * and retain the ~12 MiB wasm for its whole life, leased from the shared
13
- * supervisor budget as a resident owner.
14
- *
15
- * Construction is lazy and everything heavy is imported on first use so
16
- * the fabric/preamble subgraph stays out of the cold script-eval graph of
17
- * sessions that never bundle.
18
- */
19
- import type { IsolatePool } from '@nimbus-sh/fabric/isolate-pool.js';
20
- /** The pool surface both bundling pipelines dispatch through. */
21
- export type BundlePool = Pick<IsolatePool, 'submit'>;
22
- /** What a bundling pipeline receives from its host. */
23
- export interface BundlePoolProvider {
24
- /** The session's pool, constructed on first call. */
25
- acquire(): Promise<BundlePool>;
26
- }
27
- export declare class EsbuildBundlePool implements BundlePoolProvider {
28
- private readonly env;
29
- private readonly ctx;
30
- private pool;
31
- private pending;
32
- /** Bumped by dispose() so a construction it interrupted tears itself down. */
33
- private generation;
34
- constructor(env: unknown, ctx: DurableObjectState);
35
- acquire(): Promise<IsolatePool>;
36
- private construct;
37
- /**
38
- * Tear the pool down with its host. A later acquire() constructs a fresh
39
- * pool, so a session that installs again after a teardown still bundles.
40
- */
41
- dispose(): void;
42
- }
43
- //# sourceMappingURL=esbuild-bundle-pool.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"esbuild-bundle-pool.d.ts","sourceRoot":"","sources":["../../src/facets/esbuild-bundle-pool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAIrE,iEAAiE;AACjE,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;AAErD,uDAAuD;AACvD,MAAM,WAAW,kBAAkB;IACjC,qDAAqD;IACrD,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;CAChC;AAQD,qBAAa,iBAAkB,YAAW,kBAAkB;IAOxD,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,GAAG;IAPtB,OAAO,CAAC,IAAI,CAA4B;IACxC,OAAO,CAAC,OAAO,CAAqC;IACpD,8EAA8E;IAC9E,OAAO,CAAC,UAAU,CAAK;gBAGJ,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,kBAAkB;IAG1C,OAAO,IAAI,OAAO,CAAC,WAAW,CAAC;YAmBjB,SAAS;IAsBvB;;;OAGG;IACH,OAAO,IAAI,IAAI;CAShB"}