@nimbus-sh/worker 0.12.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esbuild-cli-artifact.generated.d.ts +1 -1
- package/dist/esbuild-cli-artifact.generated.js +4 -4
- package/dist/esbuild-wasm-bundle.generated.d.ts +11 -10
- package/dist/esbuild-wasm-bundle.generated.d.ts.map +1 -1
- package/dist/esbuild-wasm-bundle.generated.js +11 -10
- package/dist/facets/build-facet.d.ts +53 -0
- package/dist/facets/build-facet.d.ts.map +1 -0
- package/dist/facets/build-facet.js +346 -0
- package/dist/facets/cirrus-real.d.ts +3 -0
- package/dist/facets/cirrus-real.d.ts.map +1 -1
- package/dist/facets/cirrus-real.js +1 -2
- package/dist/facets/compose.d.ts +1 -0
- package/dist/facets/compose.d.ts.map +1 -1
- package/dist/facets/compose.js +3 -0
- package/dist/facets/data-plan.d.ts +14 -30
- package/dist/facets/data-plan.d.ts.map +1 -1
- package/dist/facets/data-plan.js +153 -13
- package/dist/facets/dev-stylesheet.d.ts +27 -0
- package/dist/facets/dev-stylesheet.d.ts.map +1 -0
- package/dist/facets/dev-stylesheet.js +65 -0
- package/dist/facets/esbuild-transform.d.ts +23 -18
- package/dist/facets/esbuild-transform.d.ts.map +1 -1
- package/dist/facets/esbuild-transform.js +63 -109
- package/dist/facets/manager.d.ts +49 -9
- package/dist/facets/manager.d.ts.map +1 -1
- package/dist/facets/manager.js +238 -69
- package/dist/facets/oxc-transform.d.ts +29 -0
- package/dist/facets/oxc-transform.d.ts.map +1 -0
- package/dist/facets/oxc-transform.js +198 -0
- package/dist/facets/prebundle-pool.d.ts +23 -0
- package/dist/facets/prebundle-pool.d.ts.map +1 -0
- package/dist/facets/prebundle-pool.js +55 -0
- package/dist/facets/process.d.ts +13 -6
- package/dist/facets/process.d.ts.map +1 -1
- package/dist/facets/process.js +37 -31
- package/dist/facets/transform-store.d.ts +4 -4
- package/dist/facets/transform-store.js +4 -4
- package/dist/facets/vite-dev-server.d.ts +89 -12
- package/dist/facets/vite-dev-server.d.ts.map +1 -1
- package/dist/facets/vite-dev-server.js +66 -43
- package/dist/hosted/commands.d.ts.map +1 -1
- package/dist/hosted/commands.js +20 -4
- package/dist/hosted/runtime.d.ts.map +1 -1
- package/dist/hosted/runtime.js +7 -2
- package/dist/hosted/services.d.ts +3 -3
- package/dist/hosted/services.d.ts.map +1 -1
- package/dist/hosted/services.js +102 -95
- package/dist/hosted/session.d.ts +1 -0
- package/dist/hosted/session.d.ts.map +1 -1
- package/dist/loaders/generated-workers.d.ts +3 -0
- package/dist/loaders/generated-workers.d.ts.map +1 -1
- package/dist/loaders/generated-workers.js +3 -0
- package/dist/napi-wasm-artifacts.generated.js +2 -2
- package/dist/node-shims-artifact.generated.d.ts +14 -1
- package/dist/node-shims-artifact.generated.d.ts.map +1 -1
- package/dist/node-shims-artifact.generated.js +23 -10
- package/dist/npm/bin-links.d.ts +7 -4
- package/dist/npm/bin-links.d.ts.map +1 -1
- package/dist/npm/bin-links.js +14 -55
- package/dist/npm/cache.d.ts +6 -0
- package/dist/npm/cache.d.ts.map +1 -1
- package/dist/npm/cache.js +26 -4
- package/dist/npm/installer.d.ts +1 -1
- package/dist/npm/installer.d.ts.map +1 -1
- package/dist/npm/installer.js +26 -52
- package/dist/npm/pre-bundle-facet.d.ts +15 -117
- package/dist/npm/pre-bundle-facet.d.ts.map +1 -1
- package/dist/npm/pre-bundle-facet.js +13 -511
- package/dist/oxc-facet-artifact.generated.d.ts +18 -0
- package/dist/oxc-facet-artifact.generated.d.ts.map +1 -0
- package/dist/oxc-facet-artifact.generated.js +17 -0
- package/dist/oxc-wasm-artifact.generated.d.ts +20 -0
- package/dist/oxc-wasm-artifact.generated.d.ts.map +1 -0
- package/dist/oxc-wasm-artifact.generated.js +19 -0
- package/dist/rolldown-facet-artifact.generated.d.ts +18 -0
- package/dist/rolldown-facet-artifact.generated.d.ts.map +1 -0
- package/dist/rolldown-facet-artifact.generated.js +17 -0
- package/dist/router/remote-api.d.ts.map +1 -1
- package/dist/router/remote-api.js +9 -0
- package/dist/runtime/bash-repl.d.ts.map +1 -1
- package/dist/runtime/bash-repl.js +1 -4
- package/dist/runtime/cpython-resident.d.ts.map +1 -1
- package/dist/runtime/cpython-resident.js +1 -0
- package/dist/runtime/esbuild-wasm-bytes.d.ts +25 -23
- package/dist/runtime/esbuild-wasm-bytes.d.ts.map +1 -1
- package/dist/runtime/esbuild-wasm-bytes.js +30 -25
- package/dist/runtime/facet-loader-host.d.ts +5 -4
- package/dist/runtime/facet-loader-host.d.ts.map +1 -1
- package/dist/runtime/facet-loader-host.js +5 -4
- package/dist/runtime/node-runner.d.ts +2 -0
- package/dist/runtime/node-runner.d.ts.map +1 -1
- package/dist/runtime/node-runner.js +1 -0
- package/dist/runtime/node-shims-artifact.d.ts +8 -1
- package/dist/runtime/node-shims-artifact.d.ts.map +1 -1
- package/dist/runtime/node-shims-artifact.js +32 -4
- package/dist/runtime/node-shims.d.ts.map +1 -1
- package/dist/runtime/node-shims.js +145 -109
- package/dist/runtime/opencode-facet-runner.d.ts.map +1 -1
- package/dist/runtime/opencode-facet-runner.js +6 -2
- package/dist/runtime/oxc-wasm-bytes.d.ts +19 -0
- package/dist/runtime/oxc-wasm-bytes.d.ts.map +1 -0
- package/dist/runtime/oxc-wasm-bytes.js +39 -0
- package/dist/runtime/package-manager.js +1 -1
- package/dist/runtime/process-logs-api.d.ts.map +1 -1
- package/dist/runtime/process-logs-api.js +2 -0
- package/dist/runtime/project-fs.d.ts +8 -1
- package/dist/runtime/project-fs.d.ts.map +1 -1
- package/dist/runtime/project-fs.js +15 -1
- package/dist/runtime/python-repl.d.ts +40 -1
- package/dist/runtime/python-repl.d.ts.map +1 -1
- package/dist/runtime/python-repl.js +19 -11
- package/dist/runtime/ruby-repl.d.ts +38 -0
- package/dist/runtime/ruby-repl.d.ts.map +1 -1
- package/dist/runtime/ruby-repl.js +24 -5
- package/dist/runtime/ruby-resident.d.ts.map +1 -1
- package/dist/runtime/ruby-resident.js +2 -0
- package/dist/session/nimbus-session.d.ts +13 -8
- package/dist/session/nimbus-session.d.ts.map +1 -1
- package/dist/session/nimbus-session.js +11 -5
- package/dist/session/programmatic.d.ts +25 -30
- package/dist/session/programmatic.d.ts.map +1 -1
- package/dist/session/programmatic.js +65 -93
- package/dist/session/routes.d.ts.map +1 -1
- package/dist/session/routes.js +23 -7
- package/dist/session/rpc.d.ts +16 -6
- package/dist/session/rpc.d.ts.map +1 -1
- package/dist/session/rpc.js +53 -13
- package/dist/session/start-real-vite.d.ts +24 -9
- package/dist/session/start-real-vite.d.ts.map +1 -1
- package/dist/session/start-real-vite.js +40 -4
- package/dist/session/supervisor-op.d.ts +14 -0
- package/dist/session/supervisor-op.d.ts.map +1 -1
- package/dist/session/supervisor-op.js +49 -0
- package/dist/session/supervisor-rpc.d.ts +11 -0
- package/dist/session/supervisor-rpc.d.ts.map +1 -1
- package/dist/session/supervisor-rpc.js +18 -0
- package/dist/session/vite-command.d.ts.map +1 -1
- package/dist/session/vite-command.js +23 -19
- package/dist/session/ws-relay.d.ts.map +1 -1
- package/dist/session/ws-relay.js +13 -1
- package/dist/shell/npm-bin-entrypoints.d.ts +3 -1
- package/dist/shell/npm-bin-entrypoints.d.ts.map +1 -1
- package/dist/shell/npm-bin-entrypoints.js +53 -25
- package/dist/vfs/facet-resident-store.d.ts.map +1 -1
- package/dist/vfs/facet-resident-store.js +11 -5
- package/dist/wrangler/nimbus-wrangler.d.ts +8 -0
- package/dist/wrangler/nimbus-wrangler.d.ts.map +1 -1
- package/dist/wrangler/nimbus-wrangler.js +54 -57
- package/package.json +7 -5
- package/public/_assets/esbuild-0.24.2.wasm +0 -0
- package/public/_assets/napi-wasm/loader/{99efae93dd1dcc2b → ab7e57fe9e8750c2}/napi-wasm-loader.mjs +4 -4
- package/public/_assets/napi-wasm/loader/{99efae93dd1dcc2b → ab7e57fe9e8750c2}/provenance.json +2 -2
- package/public/_assets/oxc/nimbus-oxc-1aa8c4c7057c6c28.provenance.json +72 -0
- package/public/_assets/oxc/nimbus-oxc-1aa8c4c7057c6c28.wasm +0 -0
- package/public/_assets/runtime/esbuild-cli-f13e6a112b03ac07.js +1143 -0
- package/public/_assets/runtime/js-interpreter-3c37c48024f0f651.js +23 -0
- package/public/_assets/runtime/js-interpreter-ops-2f4dfec6798e70fc.js +290 -0
- package/public/_assets/runtime/js-interpreter-primordials-e620a61b7e9800fa.js +1 -0
- package/public/_assets/runtime/{node-shims-f92f16c7d7c532e9.js → node-shims-e3adc4576da31e6e.js} +651 -103
- package/public/_assets/runtime/{esbuild-cli-b7aecffd4c6a36fe.js → oxc-facet-fd86fefcdf16bf9c.js} +217 -1047
- package/public/_assets/runtime/{resident-store-92386265e8b306dc.js → resident-store-009f39539ac989fc.js} +11 -5
- package/public/_assets/runtime/rolldown-facet-09983434e2dbe93e.js +15165 -0
- package/public/_assets/runtime/{vfs-write-ledger-d33ee0034446c3e0.js → vfs-write-ledger-9e9594591425a9b8.js} +4 -1
- package/scripts/acorn-primordials.mjs +637 -0
- package/scripts/bundle-esbuild-wasm.mjs +42 -50
- package/scripts/bundle-facet-workers.mjs +247 -18
- package/scripts/bundle-node-shims.mjs +29 -2
- package/scripts/bundle-oxc-wasm.mjs +105 -0
- package/scripts/interpreter-bundle.mjs +105 -0
- package/scripts/napi-wasm/build.mjs +4 -1
- package/scripts/napi-wasm/loader/napi-wasm-loader.ts +38 -3
- package/scripts/oxc-wasm/Cargo.lock +1246 -0
- package/scripts/oxc-wasm/Cargo.toml +30 -0
- package/scripts/oxc-wasm/build.mjs +249 -0
- package/scripts/oxc-wasm/examples/memory.rs +51 -0
- package/scripts/oxc-wasm/examples/transform.rs +20 -0
- package/scripts/oxc-wasm/inputs.mjs +32 -0
- package/scripts/oxc-wasm/rust-toolchain.toml +5 -0
- package/scripts/oxc-wasm/src/abi.rs +136 -0
- package/scripts/oxc-wasm/src/diagnostics.rs +49 -0
- package/scripts/oxc-wasm/src/helpers.rs +139 -0
- package/scripts/oxc-wasm/src/lib.rs +247 -0
- package/scripts/oxc-wasm/src/module.rs +978 -0
- package/scripts/oxc-wasm/src/names.rs +175 -0
- package/scripts/oxc-wasm/src/options.rs +154 -0
- package/scripts/parser-audit.mjs +492 -0
- package/scripts/rolldown-facet/entry.mjs +21 -0
- package/scripts/rolldown-facet/shims.mjs +64 -0
- package/dist/facets/esbuild-bundle-pool.d.ts +0 -43
- package/dist/facets/esbuild-bundle-pool.d.ts.map +0 -1
- package/dist/facets/esbuild-bundle-pool.js +0 -80
- package/dist/loaders/pre-bundle-preamble.d.ts +0 -44
- package/dist/loaders/pre-bundle-preamble.d.ts.map +0 -1
- package/dist/loaders/pre-bundle-preamble.js +0 -116
- package/dist/runtime/host-wasm.d.ts +0 -8
- package/dist/runtime/host-wasm.d.ts.map +0 -1
- package/dist/runtime/host-wasm.js +0 -33
- /package/public/_assets/napi-wasm/loader/{99efae93dd1dcc2b → ab7e57fe9e8750c2}/wasi-trampoline.wasm +0 -0
|
@@ -3,19 +3,32 @@
|
|
|
3
3
|
* scripts/bundle-node-shims.mjs. DO NOT EDIT.
|
|
4
4
|
*
|
|
5
5
|
* Pins the staged sources of the node-compat layer, promoted out of the worker
|
|
6
|
-
* bundle: the shims, the VFS write ledger
|
|
6
|
+
* bundle: the shims, the VFS write ledger, the resident store, and the
|
|
7
|
+
* runtime-code interpreter with its host module. Each
|
|
7
8
|
* <NAME>_BUILD_ID is a content-hash prefix so cache layers never serve stale
|
|
8
9
|
* bytes after a rebuild; <NAME>_SHA256 is the full digest verified at fetch time.
|
|
9
10
|
*/
|
|
10
11
|
/** dist/runtime/node-shims.js generateShimsCode() */
|
|
11
|
-
export const NODE_SHIMS_ENTRY = "/_assets/runtime/node-shims-
|
|
12
|
-
export const NODE_SHIMS_BUILD_ID = "
|
|
13
|
-
export const NODE_SHIMS_SHA256 = "
|
|
12
|
+
export const NODE_SHIMS_ENTRY = "/_assets/runtime/node-shims-e3adc4576da31e6e.js";
|
|
13
|
+
export const NODE_SHIMS_BUILD_ID = "e3adc4576da31e6e";
|
|
14
|
+
export const NODE_SHIMS_SHA256 = "e3adc4576da31e6e03edcac52a4bf286c3bfabac2a635156b2dc728d88283c38";
|
|
14
15
|
/** @nimbus-sh/core dist/_shared/vfs-write-ledger.js VFS_WRITE_LEDGER_SOURCE */
|
|
15
|
-
export const VFS_WRITE_LEDGER_ENTRY = "/_assets/runtime/vfs-write-ledger-
|
|
16
|
-
export const VFS_WRITE_LEDGER_BUILD_ID = "
|
|
17
|
-
export const VFS_WRITE_LEDGER_SHA256 = "
|
|
16
|
+
export const VFS_WRITE_LEDGER_ENTRY = "/_assets/runtime/vfs-write-ledger-9e9594591425a9b8.js";
|
|
17
|
+
export const VFS_WRITE_LEDGER_BUILD_ID = "9e9594591425a9b8";
|
|
18
|
+
export const VFS_WRITE_LEDGER_SHA256 = "9e9594591425a9b8e9ca4e24b32e4cc54aeff94954c30891c95976a4fd57a195";
|
|
18
19
|
/** dist/vfs/facet-resident-store.js FACET_RESIDENT_STORE_SOURCE */
|
|
19
|
-
export const RESIDENT_STORE_ENTRY = "/_assets/runtime/resident-store-
|
|
20
|
-
export const RESIDENT_STORE_BUILD_ID = "
|
|
21
|
-
export const RESIDENT_STORE_SHA256 = "
|
|
20
|
+
export const RESIDENT_STORE_ENTRY = "/_assets/runtime/resident-store-009f39539ac989fc.js";
|
|
21
|
+
export const RESIDENT_STORE_BUILD_ID = "009f39539ac989fc";
|
|
22
|
+
export const RESIDENT_STORE_SHA256 = "009f39539ac989fc7d3f6489550e47a690cc6f64868955e8991c0427c145bf21";
|
|
23
|
+
/** @nimbus-sh/core src/interpreter/primordials.ts, bundled by scripts/interpreter-bundle.mjs */
|
|
24
|
+
export const JS_INTERPRETER_PRIMORDIALS_ENTRY = "/_assets/runtime/js-interpreter-primordials-e620a61b7e9800fa.js";
|
|
25
|
+
export const JS_INTERPRETER_PRIMORDIALS_BUILD_ID = "e620a61b7e9800fa";
|
|
26
|
+
export const JS_INTERPRETER_PRIMORDIALS_SHA256 = "e620a61b7e9800fad31b82c28fe64bd149c0518dc8c614e512b88dc200096f48";
|
|
27
|
+
/** @nimbus-sh/core src/interpreter, bundled by scripts/interpreter-bundle.mjs */
|
|
28
|
+
export const JS_INTERPRETER_ENTRY = "/_assets/runtime/js-interpreter-3c37c48024f0f651.js";
|
|
29
|
+
export const JS_INTERPRETER_BUILD_ID = "3c37c48024f0f651";
|
|
30
|
+
export const JS_INTERPRETER_SHA256 = "3c37c48024f0f65132e92de3564068518eaa43b24acd270357e7e9e6a36db88d";
|
|
31
|
+
/** @nimbus-sh/core src/interpreter/host-ops.ts HOST_OPS_SOURCE */
|
|
32
|
+
export const JS_INTERPRETER_OPS_ENTRY = "/_assets/runtime/js-interpreter-ops-2f4dfec6798e70fc.js";
|
|
33
|
+
export const JS_INTERPRETER_OPS_BUILD_ID = "2f4dfec6798e70fc";
|
|
34
|
+
export const JS_INTERPRETER_OPS_SHA256 = "2f4dfec6798e70fcb11871ff1f57fa56336f33bfd5f31dfb3414f10433e4914c";
|
package/dist/npm/bin-links.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ProjectFs } from '../runtime/project-fs.js';
|
|
2
2
|
import type { ResolvedPackage } from './resolver.js';
|
|
3
3
|
/**
|
|
4
4
|
* A staged-artifact bin target (`nimbus-staged:<artifact>`) is a sentinel,
|
|
@@ -30,7 +30,7 @@ export interface NpmBinResolution extends NpmBinEntry {
|
|
|
30
30
|
* caller (see runtime/project-fs.ts), each call answered at once by the
|
|
31
31
|
* engine or awaited through the caller's view of the namespace.
|
|
32
32
|
*/
|
|
33
|
-
type VfsLike = Pick<ProjectFs, 'exists' | 'isDirectory' | 'readFileString' | 'readdir'>;
|
|
33
|
+
type VfsLike = Pick<ProjectFs, 'exists' | 'isDirectory' | 'readFileString' | 'readdir' | 'lstat'>;
|
|
34
34
|
type WritableVfsLike = VfsLike & Pick<ProjectFs, 'mkdir' | 'writeFile' | 'chmod'>;
|
|
35
35
|
export declare function npmBinDirPath(nodeModulesPath: string): string;
|
|
36
36
|
export declare function npmBinManifestPath(nodeModulesPath: string): string;
|
|
@@ -38,8 +38,11 @@ export declare function createNpmBinManifest(entries: NpmBinEntry[]): NpmBinMani
|
|
|
38
38
|
export declare function createNpmBinShim(entry: NpmBinEntry, shimDir: string): string;
|
|
39
39
|
export declare function packageBinEntries(pkg: ResolvedPackage, nodeModulesPath: string): NpmBinEntry[];
|
|
40
40
|
export declare function resolveNpmBin(vfs: VfsLike, cwd: string, name: string): Promise<NpmBinResolution | null>;
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
/**
|
|
42
|
+
* A path-shaped invocation of an npm bin shim: an executable entry of a
|
|
43
|
+
* `node_modules/.bin` directory, or one a bin directory's manifest names
|
|
44
|
+
* (where `npm i -g` links them onto PATH); null for any other file.
|
|
45
|
+
*/
|
|
43
46
|
export declare function resolveNpmBinPath(vfs: VfsLike & Pick<ProjectFs, 'stat'>, cwd: string, path: string): Promise<NpmBinResolution | null>;
|
|
44
47
|
export declare function materializeNpmBinShims(vfs: WritableVfsLike, nodeModulesPath: string, binDir: string): Promise<number>;
|
|
45
48
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin-links.d.ts","sourceRoot":"","sources":["../../src/npm/bin-links.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"bin-links.d.ts","sourceRoot":"","sources":["../../src/npm/bin-links.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAG5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAIrD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE9D;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,gH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AAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAO7G;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAe3I;AAED,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,eAAe,EACpB,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC,CAoBjB"}
|
package/dist/npm/bin-links.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { projectEntryType } from '../runtime/project-fs.js';
|
|
1
2
|
import { normalizeVfsPath, resolveVfsPath } from '@nimbus-sh/core/vfs/path.js';
|
|
2
3
|
import { npmBinMap, npmBinName } from '@nimbus-sh/core/runtime/npm-bin-map.js';
|
|
3
4
|
import { STAGED_ARTIFACT_BIN_PREFIX } from '../facets/wasm-swap-registry.js';
|
|
@@ -98,23 +99,18 @@ export async function resolveNpmBin(vfs, cwd, name) {
|
|
|
98
99
|
}
|
|
99
100
|
return null;
|
|
100
101
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
return null;
|
|
108
|
-
}
|
|
109
|
-
/** A path-shaped invocation of an executable entry in a `node_modules/.bin` directory; null otherwise. */
|
|
102
|
+
/**
|
|
103
|
+
* A path-shaped invocation of an npm bin shim: an executable entry of a
|
|
104
|
+
* `node_modules/.bin` directory, or one a bin directory's manifest names
|
|
105
|
+
* (where `npm i -g` links them onto PATH); null for any other file.
|
|
106
|
+
*/
|
|
110
107
|
export async function resolveNpmBinPath(vfs, cwd, path) {
|
|
111
108
|
const shimPath = resolveVfsPath(path, cwd || '/home/user');
|
|
112
109
|
const slash = shimPath.lastIndexOf('/');
|
|
113
110
|
if (slash < 0)
|
|
114
111
|
return null;
|
|
115
112
|
const binDir = shimPath.slice(0, slash);
|
|
116
|
-
|
|
117
|
-
return null;
|
|
113
|
+
const name = shimPath.slice(slash + 1);
|
|
118
114
|
try {
|
|
119
115
|
if (((await vfs.stat(shimPath)).mode & 0o111) === 0)
|
|
120
116
|
return null;
|
|
@@ -122,7 +118,11 @@ export async function resolveNpmBinPath(vfs, cwd, path) {
|
|
|
122
118
|
catch {
|
|
123
119
|
return null;
|
|
124
120
|
}
|
|
125
|
-
|
|
121
|
+
const nodeModulesPath = nodeModulesPathForBinDir(binDir);
|
|
122
|
+
if (nodeModulesPath?.endsWith('/node_modules'))
|
|
123
|
+
return await resolveNpmBinAt(vfs, nodeModulesPath, name);
|
|
124
|
+
const entry = await resolveFromBinDirManifest(vfs, binDir, name);
|
|
125
|
+
return entry ? { ...entry, shimPath } : null;
|
|
126
126
|
}
|
|
127
127
|
export async function materializeNpmBinShims(vfs, nodeModulesPath, binDir) {
|
|
128
128
|
const entries = await listNpmBinEntries(vfs, normalizeVfsPath(nodeModulesPath));
|
|
@@ -162,31 +162,6 @@ async function resolveNpmBinAt(vfs, nodeModulesPath, name) {
|
|
|
162
162
|
shimPath,
|
|
163
163
|
};
|
|
164
164
|
}
|
|
165
|
-
async function resolveNpmBinInBinDir(vfs, binDir, name) {
|
|
166
|
-
const cleanBinDir = normalizeVfsPath(binDir);
|
|
167
|
-
if (!cleanBinDir)
|
|
168
|
-
return null;
|
|
169
|
-
const shimPath = `${cleanBinDir}/${name}`;
|
|
170
|
-
if (!await vfs.exists(shimPath) || await safeIsDirectory(vfs, shimPath))
|
|
171
|
-
return null;
|
|
172
|
-
const nodeModulesPath = nodeModulesPathForBinDir(cleanBinDir);
|
|
173
|
-
if (nodeModulesPath) {
|
|
174
|
-
const resolved = await resolveNpmBinAt(vfs, nodeModulesPath, name);
|
|
175
|
-
if (resolved)
|
|
176
|
-
return resolved;
|
|
177
|
-
}
|
|
178
|
-
const manifestEntry = await resolveFromBinDirManifest(vfs, cleanBinDir, name);
|
|
179
|
-
if (manifestEntry)
|
|
180
|
-
return { ...manifestEntry, shimPath };
|
|
181
|
-
return {
|
|
182
|
-
name,
|
|
183
|
-
packageName: name,
|
|
184
|
-
packageVersion: '',
|
|
185
|
-
packagePath: cleanBinDir,
|
|
186
|
-
targetPath: shimPath,
|
|
187
|
-
shimPath,
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
165
|
function candidateNodeModulesPaths(cwd) {
|
|
191
166
|
const paths = [];
|
|
192
167
|
let current = normalizeVfsPath(cwd || '/home/user');
|
|
@@ -199,22 +174,6 @@ function candidateNodeModulesPaths(cwd) {
|
|
|
199
174
|
}
|
|
200
175
|
return paths;
|
|
201
176
|
}
|
|
202
|
-
function candidatePathDirs(cwd, envPath) {
|
|
203
|
-
const dirs = [];
|
|
204
|
-
const seen = new Set();
|
|
205
|
-
for (const rawDir of (envPath || '').split(':')) {
|
|
206
|
-
if (!rawDir)
|
|
207
|
-
continue;
|
|
208
|
-
const dir = rawDir.startsWith('/')
|
|
209
|
-
? normalizeVfsPath(rawDir)
|
|
210
|
-
: resolveVfsPath(rawDir, cwd || '/home/user');
|
|
211
|
-
if (!dir || seen.has(dir))
|
|
212
|
-
continue;
|
|
213
|
-
seen.add(dir);
|
|
214
|
-
dirs.push(dir);
|
|
215
|
-
}
|
|
216
|
-
return dirs;
|
|
217
|
-
}
|
|
218
177
|
function nodeModulesPathForBinDir(binDir) {
|
|
219
178
|
const suffix = '/.bin';
|
|
220
179
|
if (!binDir.endsWith(suffix))
|
|
@@ -284,7 +243,7 @@ async function* listPackagePaths(vfs, nodeModulesPath) {
|
|
|
284
243
|
return;
|
|
285
244
|
}
|
|
286
245
|
for (const entry of entries) {
|
|
287
|
-
if (entry.
|
|
246
|
+
if (entry.name === '.bin' || (await projectEntryType(vfs, nodeModulesPath, entry)) !== 'directory')
|
|
288
247
|
continue;
|
|
289
248
|
const path = `${nodeModulesPath}/${entry.name}`;
|
|
290
249
|
if (!entry.name.startsWith('@')) {
|
|
@@ -299,7 +258,7 @@ async function* listPackagePaths(vfs, nodeModulesPath) {
|
|
|
299
258
|
continue;
|
|
300
259
|
}
|
|
301
260
|
for (const scoped of scopedEntries) {
|
|
302
|
-
if (scoped
|
|
261
|
+
if ((await projectEntryType(vfs, path, scoped)) === 'directory')
|
|
303
262
|
yield `${path}/${scoped.name}`;
|
|
304
263
|
}
|
|
305
264
|
}
|
package/dist/npm/cache.d.ts
CHANGED
|
@@ -57,6 +57,12 @@ export interface EsmBundleEntry {
|
|
|
57
57
|
esmCode: string;
|
|
58
58
|
builtAt: number;
|
|
59
59
|
inputHash: string;
|
|
60
|
+
/**
|
|
61
|
+
* The VFS paths the bundle was built from. The cache is the workspace's,
|
|
62
|
+
* shared by every server in it whoever started it, so a reader serves an
|
|
63
|
+
* entry only to a principal who may read every one of them.
|
|
64
|
+
*/
|
|
65
|
+
sources: readonly string[];
|
|
60
66
|
}
|
|
61
67
|
export interface UserModuleTransformEntry {
|
|
62
68
|
/** VFS path of the source module (e.g. "home/user/projects/src/App.tsx"). */
|
package/dist/npm/cache.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/npm/cache.ts"],"names":[],"mappings":"AAyBA,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;;;;;;;OAWG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;;;OAQG;IACH,YAAY,C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IMARY KEY (project_path, name)
|
|
85
85
|
)`);
|
|
86
|
+
// A bundle is served only to a principal who may read what it was built
|
|
87
|
+
// from, so a row that does not say is of no use: a table predating the
|
|
88
|
+
// `sources` column is dropped and recreated, and its bundles rebuild on
|
|
89
|
+
// first request, as user_module_transforms' do below.
|
|
90
|
+
let hasSourcesColumn = true;
|
|
91
|
+
try {
|
|
92
|
+
const cols = [...this.sql.exec(`PRAGMA table_info(pkg_esm_bundles)`)];
|
|
93
|
+
if (cols.length > 0)
|
|
94
|
+
hasSourcesColumn = cols.some((r) => String(r.name) === 'sources');
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
hasSourcesColumn = true; /* table absent — CREATE below handles it */
|
|
98
|
+
}
|
|
99
|
+
if (!hasSourcesColumn) {
|
|
100
|
+
try {
|
|
101
|
+
this.sql.exec(`DROP TABLE pkg_esm_bundles`);
|
|
102
|
+
}
|
|
103
|
+
catch { /* non-fatal */ }
|
|
104
|
+
}
|
|
86
105
|
this.sql.exec(`CREATE TABLE IF NOT EXISTS pkg_esm_bundles (
|
|
87
106
|
specifier TEXT PRIMARY KEY,
|
|
88
107
|
bundle_hash TEXT NOT NULL,
|
|
89
108
|
esm_code TEXT NOT NULL,
|
|
90
109
|
built_at INTEGER NOT NULL DEFAULT 0,
|
|
91
|
-
input_hash TEXT NOT NULL DEFAULT ''
|
|
110
|
+
input_hash TEXT NOT NULL DEFAULT '',
|
|
111
|
+
sources TEXT NOT NULL DEFAULT '[]'
|
|
92
112
|
)`);
|
|
93
113
|
// A transform is keyed by (vfs_path, base): the served output bakes the
|
|
94
114
|
// mount base, so one source served under two mounts is two rows. The
|
|
@@ -303,24 +323,26 @@ export class NpmCache {
|
|
|
303
323
|
/** Get a pre-bundled ESM module. */
|
|
304
324
|
getEsmBundle(specifier) {
|
|
305
325
|
this.ensureSchema();
|
|
306
|
-
const rows = [...this.sql.exec(`SELECT specifier, bundle_hash, esm_code, built_at, input_hash
|
|
326
|
+
const rows = [...this.sql.exec(`SELECT specifier, bundle_hash, esm_code, built_at, input_hash, sources
|
|
307
327
|
FROM pkg_esm_bundles WHERE specifier = ?`, specifier)];
|
|
308
328
|
if (rows.length === 0)
|
|
309
329
|
return null;
|
|
310
330
|
const r = rows[0];
|
|
331
|
+
const sources = JSON.parse(String(r.sources));
|
|
311
332
|
return {
|
|
312
333
|
specifier: String(r.specifier),
|
|
313
334
|
bundleHash: String(r.bundle_hash),
|
|
314
335
|
esmCode: String(r.esm_code),
|
|
315
336
|
builtAt: Number(r.built_at),
|
|
316
337
|
inputHash: String(r.input_hash),
|
|
338
|
+
sources: Array.isArray(sources) ? sources.map(String) : [],
|
|
317
339
|
};
|
|
318
340
|
}
|
|
319
341
|
/** Store a pre-bundled ESM module. */
|
|
320
342
|
putEsmBundle(entry) {
|
|
321
343
|
this.ensureSchema();
|
|
322
|
-
this.sql.exec(`INSERT OR REPLACE INTO pkg_esm_bundles (specifier, bundle_hash, esm_code, built_at, input_hash)
|
|
323
|
-
VALUES (?, ?, ?, ?, ?)`, entry.specifier, entry.bundleHash, entry.esmCode, entry.builtAt, entry.inputHash);
|
|
344
|
+
this.sql.exec(`INSERT OR REPLACE INTO pkg_esm_bundles (specifier, bundle_hash, esm_code, built_at, input_hash, sources)
|
|
345
|
+
VALUES (?, ?, ?, ?, ?, ?)`, entry.specifier, entry.bundleHash, entry.esmCode, entry.builtAt, entry.inputHash, JSON.stringify(entry.sources));
|
|
324
346
|
}
|
|
325
347
|
/** Delete a pre-bundled ESM module (e.g., after package update). */
|
|
326
348
|
deleteEsmBundle(specifier) {
|
package/dist/npm/installer.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ import type { EsbuildService } from '@nimbus-sh/core/runtime/esbuild-service.js'
|
|
|
29
29
|
import { NpmCache } from './cache.js';
|
|
30
30
|
import { type FetchFn } from './resolver.js';
|
|
31
31
|
import { type NpmLogEmitter } from '@nimbus-sh/core/substrate/lifo/commands/system/npm-log.js';
|
|
32
|
-
import type { BundlePoolProvider } from '../facets/
|
|
32
|
+
import type { BundlePoolProvider } from '../facets/prebundle-pool.js';
|
|
33
33
|
import type { InstallPhase } from '@nimbus-sh/platform/install-phase.js';
|
|
34
34
|
export interface InstallProgress {
|
|
35
35
|
phase: InstallPhase;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["../../src/npm/installer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAWH,OAAO,EAAwC,KAAK,OAAO,EAAE,MAAM,yCAAyC,CAAC;AAC7G,OAAO,EAAa,KAAK,YAAY,EAAoB,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["../../src/npm/installer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAWH,OAAO,EAAwC,KAAK,OAAO,EAAE,MAAM,yCAAyC,CAAC;AAC7G,OAAO,EAAa,KAAK,YAAY,EAAoB,MAAM,0CAA0C,CAAC;AAK1G,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAEjF,OAAO,EAAE,QAAQ,EAAsB,MAAM,YAAY,CAAC;AAC1D,OAAO,EAEiC,KAAK,OAAO,EACnD,MAAM,eAAe,CAAC;AAKvB,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,2DAA2D,CAAC;AAUnE,OAAO,KAAK,EAAc,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AA4DlF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAEzE,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,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2EAA2E;IAC3E,OAAO,CAAC,kBAAkB;IAI1B;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,OAAO,CAAC,0BAA0B;CAenC"}
|
package/dist/npm/installer.js
CHANGED
|
@@ -27,6 +27,7 @@ import { CRED_KERNEL } from '@nimbus-sh/core/runtime/os-contracts.js';
|
|
|
27
27
|
import { engineKey } from '@nimbus-sh/core/runtime/process-files.js';
|
|
28
28
|
import { npmBinMap } from '@nimbus-sh/core/runtime/npm-bin-map.js';
|
|
29
29
|
import { isVfsError } from '@nimbus-sh/core/vfs/vfs-error.js';
|
|
30
|
+
import { direntTypeIn } from '@nimbus-sh/core/vfs/dirent-type.js';
|
|
30
31
|
import { handKernelArtifact, projectFs } from '../runtime/project-fs.js';
|
|
31
32
|
import { BUNDLER_VERSION } from '@nimbus-sh/core/runtime/esbuild-service.js';
|
|
32
33
|
import { NpmCache } from './cache.js';
|
|
@@ -48,7 +49,8 @@ import { estimateSupervisorHeap } from '@nimbus-sh/platform/heap-estimate.js';
|
|
|
48
49
|
import { describeError } from '@nimbus-sh/platform/oom-classify.js';
|
|
49
50
|
import { resolveOnePackumentInFacet, parseRegistryRequest, } from './resolve-one-facet.js';
|
|
50
51
|
import { NPM_RESOLVE_PREAMBLE } from '../loaders/npm-resolve-preamble.js';
|
|
51
|
-
import {
|
|
52
|
+
import { buildSliceForSpecifierWithCap, externalsForSpecifier, } from './pre-bundle-facet.js';
|
|
53
|
+
import { sliceSources } from '@nimbus-sh/core/runtime/prebundle-slice.js';
|
|
52
54
|
import { CHUNK_SIZE, PRE_BUNDLE_CONCURRENCY, PRE_BUNDLE_SLICE_CAP_BYTES, } from '@nimbus-sh/platform/limits.js';
|
|
53
55
|
import { acquireSupervisorAllocation } from '@nimbus-sh/platform/heavy-alloc-coord.js';
|
|
54
56
|
import { countPackageFiles, BARREL_PKG_FILE_THRESHOLD, packageNameFromSpecifier } from '@nimbus-sh/core/runtime/barrel-detect.js';
|
|
@@ -1863,11 +1865,9 @@ export class NpmInstaller {
|
|
|
1863
1865
|
* JSX elements get rejected as "alien" — silent render failure.
|
|
1864
1866
|
*/
|
|
1865
1867
|
async prebundleUsedModules(projDir, installed, fs) {
|
|
1866
|
-
// Pre-bundle
|
|
1867
|
-
//
|
|
1868
|
-
// supervisor
|
|
1869
|
-
// still serves the transform path (TS/JSX → JS) which is small and
|
|
1870
|
-
// fits in the supervisor's heap.
|
|
1868
|
+
// Pre-bundle runs in the session's build facet (facets/prebundle-pool.ts),
|
|
1869
|
+
// from slices the supervisor walks (npm/pre-bundle-facet.ts); the
|
|
1870
|
+
// supervisor never holds a bundler.
|
|
1871
1871
|
//
|
|
1872
1872
|
// We gate on this.esbuild presence purely as a feature flag: a caller
|
|
1873
1873
|
// that constructs the installer without esbuild (e.g. minimal
|
|
@@ -2064,33 +2064,11 @@ export class NpmInstaller {
|
|
|
2064
2064
|
// lucide-react is barrel-skipped at af8de12 and the cap
|
|
2065
2065
|
// mostly applies to non-barrel large packages.)
|
|
2066
2066
|
//
|
|
2067
|
-
//
|
|
2068
|
-
//
|
|
2069
|
-
//
|
|
2070
|
-
//
|
|
2071
|
-
//
|
|
2072
|
-
// disposed with the installer and dev server — not per pre-bundle
|
|
2073
|
-
// phase — so the supervisor retains one copy, leased once from the
|
|
2074
|
-
// shared allocation budget. See src/esbuild-wasm-bytes.ts for why
|
|
2075
|
-
// the bytes are never cached supervisor-side beyond that.
|
|
2076
|
-
//
|
|
2077
|
-
// Bytes are shipped into each facet via IsolatePool's
|
|
2078
|
-
// `wasmModules` option which workerd registers in the LOADER
|
|
2079
|
-
// `modules` map as `{ wasm: ArrayBuffer }`. Workerd compiles at
|
|
2080
|
-
// module-load (startup phase, where wasm code generation is
|
|
2081
|
-
// permitted), and the pool's generated worker.js exposes the
|
|
2082
|
-
// resulting WebAssembly.Module on globalThis.__NIMBUS_WASM
|
|
2083
|
-
// for the user fn (prebundleOne) to read at request time.
|
|
2084
|
-
//
|
|
2085
|
-
// Why this works when previous attempts didn't:
|
|
2086
|
-
// - inlining bytes in preamble: 16 MiB per dispatch OOM'd
|
|
2087
|
-
// supervisor (commit dead0e3 fixed by removing it)
|
|
2088
|
-
// - WebAssembly.compile at request time: blocked by workerd
|
|
2089
|
-
// ("Wasm code generation disallowed by embedder")
|
|
2090
|
-
// - RPC of pre-compiled WebAssembly.Module: structured-clone
|
|
2091
|
-
// refuses ("Unable to deserialize cloned data")
|
|
2092
|
-
// - LOADER modules-map: bytes ride INSIDE the worker code blob
|
|
2093
|
-
// before workerd compiles it; bypasses all three failure modes.
|
|
2067
|
+
// The bundler's wasm memory lives in the session's build facet
|
|
2068
|
+
// (facets/prebundle-pool.ts → build-facet.ts `prebundle`), outside the
|
|
2069
|
+
// supervisor; its staged parts load into the facet's module map once
|
|
2070
|
+
// per isolate, so the supervisor keeps no copy. Per-spec try/catch
|
|
2071
|
+
// handles failures — /preview/@modules/ on-demand bundling recovers.
|
|
2094
2072
|
//
|
|
2095
2073
|
// Defensive logger: onProgress is user-supplied and can throw
|
|
2096
2074
|
// (downstream WS write, JSON.stringify on a circular value, etc.).
|
|
@@ -2110,9 +2088,9 @@ export class NpmInstaller {
|
|
|
2110
2088
|
catch { }
|
|
2111
2089
|
}
|
|
2112
2090
|
};
|
|
2113
|
-
// Acquired BEFORE any
|
|
2114
|
-
//
|
|
2115
|
-
//
|
|
2091
|
+
// Acquired BEFORE any slice is built: acquiring loads the build facet,
|
|
2092
|
+
// whose staged parts pass through the supervisor once, so they are
|
|
2093
|
+
// gone again before a slice lease is held beside them.
|
|
2116
2094
|
let pool;
|
|
2117
2095
|
try {
|
|
2118
2096
|
pool = await this.bundlePool.acquire();
|
|
@@ -2149,9 +2127,8 @@ export class NpmInstaller {
|
|
|
2149
2127
|
attempted++;
|
|
2150
2128
|
// Build slice for THIS spec only. Released by explicit nulling
|
|
2151
2129
|
// at the end of every code path through this iteration so the
|
|
2152
|
-
// bytes are GC-eligible before
|
|
2153
|
-
//
|
|
2154
|
-
// slot. With concurrency=1 and 28 MiB caps, peak supervisor
|
|
2130
|
+
// bytes are GC-eligible before the RPC layer has finished
|
|
2131
|
+
// tearing down its own references for the previous spec. With concurrency=1 and 28 MiB caps, peak supervisor
|
|
2155
2132
|
// slice memory is ~34 MiB (slice + spec metadata).
|
|
2156
2133
|
//
|
|
2157
2134
|
// Defensive: buildSliceForSpecifierWithCap performs sync VFS
|
|
@@ -2221,6 +2198,9 @@ export class NpmInstaller {
|
|
|
2221
2198
|
errorsByModule[next.specifier] = msg;
|
|
2222
2199
|
continue;
|
|
2223
2200
|
}
|
|
2201
|
+
// What the bundle can have read, recorded with it: the cache is
|
|
2202
|
+
// shared, and a server serves it only to a principal who may read it all.
|
|
2203
|
+
const sources = sliceSources(slice.slice);
|
|
2224
2204
|
let spec = {
|
|
2225
2205
|
specifier: next.specifier,
|
|
2226
2206
|
entryPath: next.entryPath,
|
|
@@ -2234,12 +2214,7 @@ export class NpmInstaller {
|
|
|
2234
2214
|
slice = null;
|
|
2235
2215
|
let result = null;
|
|
2236
2216
|
try {
|
|
2237
|
-
|
|
2238
|
-
// share slot index 0 in the underlying #dispatchSlot — that's
|
|
2239
|
-
// fine for our use (we don't need stable warm slots beyond
|
|
2240
|
-
// "esbuild compiled once per slot's lifetime"; for pre-bundle
|
|
2241
|
-
// the slot HAS to compile esbuild on first call regardless).
|
|
2242
|
-
result = await pool.submit(prebundleOne, spec);
|
|
2217
|
+
result = await pool.prebundle(spec);
|
|
2243
2218
|
}
|
|
2244
2219
|
catch (e) {
|
|
2245
2220
|
const msg = describeError(e);
|
|
@@ -2250,11 +2225,9 @@ export class NpmInstaller {
|
|
|
2250
2225
|
finally {
|
|
2251
2226
|
// Drop the spec reference (which transitively held slice.slice)
|
|
2252
2227
|
// immediately after the RPC settles, regardless of outcome.
|
|
2253
|
-
//
|
|
2254
|
-
//
|
|
2255
|
-
//
|
|
2256
|
-
// resolves so the next iteration starts from a low-water-mark
|
|
2257
|
-
// heap. Combined defense — see commit msg.
|
|
2228
|
+
// This finally releases our supervisor-side handle the moment
|
|
2229
|
+
// the await resolves so the next iteration starts from a
|
|
2230
|
+
// low-water-mark heap.
|
|
2258
2231
|
spec = null;
|
|
2259
2232
|
}
|
|
2260
2233
|
if (!result || !result.ok) {
|
|
@@ -2287,6 +2260,7 @@ export class NpmInstaller {
|
|
|
2287
2260
|
esmCode: result.esmCode,
|
|
2288
2261
|
builtAt: Date.now(),
|
|
2289
2262
|
inputHash: next.inputHash ?? '',
|
|
2263
|
+
sources,
|
|
2290
2264
|
});
|
|
2291
2265
|
okCount++;
|
|
2292
2266
|
}
|
|
@@ -2309,7 +2283,7 @@ export class NpmInstaller {
|
|
|
2309
2283
|
try {
|
|
2310
2284
|
// Promise.all rejects on the first slot rejection. Every per-slot
|
|
2311
2285
|
// failure mode that can throw inside runSlot is caught above
|
|
2312
|
-
// (slice walk, externals, pool.
|
|
2286
|
+
// (slice walk, externals, pool.prebundle, putEsmBundle) — but a
|
|
2313
2287
|
// future regression that adds an unguarded throw to runSlot
|
|
2314
2288
|
// would bubble out here. The outer try/finally guarantees the
|
|
2315
2289
|
// diag counters get updated for whatever partial run completed;
|
|
@@ -2621,7 +2595,7 @@ async function nodeModulesNames(view, dir) {
|
|
|
2621
2595
|
for (const entry of await view.readdir(dir)) {
|
|
2622
2596
|
if (entry.name.startsWith(COPY_PREFIX))
|
|
2623
2597
|
continue;
|
|
2624
|
-
if (
|
|
2598
|
+
if (!entry.name.startsWith('@') || (await direntTypeIn(view, dir, entry)) !== 'directory') {
|
|
2625
2599
|
names.push(entry.name);
|
|
2626
2600
|
continue;
|
|
2627
2601
|
}
|