@nimbus-sh/worker 0.10.0 → 0.11.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.
- package/NOTICE.md +5 -0
- package/README.md +10 -0
- package/dist/_shared/session-router.d.ts +7 -0
- package/dist/_shared/session-router.d.ts.map +1 -1
- package/dist/_shared/session-router.js +7 -0
- package/dist/bindings/body.d.ts +6 -0
- package/dist/bindings/body.d.ts.map +1 -0
- package/dist/bindings/body.js +37 -0
- package/dist/bindings/kv.d.ts +0 -2
- package/dist/bindings/kv.d.ts.map +1 -1
- package/dist/bindings/kv.js +3 -42
- package/dist/bindings/r2.d.ts +0 -2
- package/dist/bindings/r2.d.ts.map +1 -1
- package/dist/bindings/r2.js +4 -44
- package/dist/esbuild-cli-artifact.generated.d.ts +18 -0
- package/dist/esbuild-cli-artifact.generated.d.ts.map +1 -0
- package/dist/esbuild-cli-artifact.generated.js +17 -0
- package/dist/facets/cirrus-real.d.ts.map +1 -1
- package/dist/facets/cirrus-real.js +9 -4
- package/dist/facets/compose.d.ts +11 -7
- package/dist/facets/compose.d.ts.map +1 -1
- package/dist/facets/compose.js +8 -38
- package/dist/facets/data-plan.d.ts +79 -0
- package/dist/facets/data-plan.d.ts.map +1 -0
- package/dist/facets/data-plan.js +477 -0
- package/dist/facets/esbuild-transform.d.ts +36 -10
- package/dist/facets/esbuild-transform.d.ts.map +1 -1
- package/dist/facets/esbuild-transform.js +216 -20
- package/dist/facets/exec-telemetry.d.ts +7 -3
- package/dist/facets/exec-telemetry.d.ts.map +1 -1
- package/dist/facets/manager.d.ts +179 -78
- package/dist/facets/manager.d.ts.map +1 -1
- package/dist/facets/manager.js +1221 -649
- package/dist/facets/opencode-staging.d.ts +0 -2
- package/dist/facets/opencode-staging.d.ts.map +1 -1
- package/dist/facets/opencode-staging.js +5 -11
- package/dist/facets/process.d.ts +4 -0
- package/dist/facets/process.d.ts.map +1 -1
- package/dist/facets/process.js +3 -0
- package/dist/facets/read-profile.d.ts +149 -0
- package/dist/facets/read-profile.d.ts.map +1 -0
- package/dist/facets/read-profile.js +483 -0
- package/dist/facets/resident-identity.d.ts +0 -1
- package/dist/facets/resident-identity.d.ts.map +1 -1
- package/dist/facets/resident-identity.js +0 -3
- package/dist/facets/wasm-swap-registry.d.ts +34 -25
- package/dist/facets/wasm-swap-registry.d.ts.map +1 -1
- package/dist/facets/wasm-swap-registry.js +62 -56
- package/dist/facets/ws-terminal.d.ts +4 -4
- package/dist/facets/ws-terminal.d.ts.map +1 -1
- package/dist/facets/ws-terminal.js +4 -5
- package/dist/git/commands.d.ts +16 -9
- package/dist/git/commands.d.ts.map +1 -1
- package/dist/git/commands.js +1818 -188
- package/dist/git/network-facet.d.ts +10 -2
- package/dist/git/network-facet.d.ts.map +1 -1
- package/dist/git/network-facet.js +62 -16
- package/dist/git/unified-diff.d.ts +74 -0
- package/dist/git/unified-diff.d.ts.map +1 -0
- package/dist/git/unified-diff.js +676 -0
- package/dist/git-bundle.generated.d.ts +7 -11
- package/dist/git-bundle.generated.d.ts.map +1 -1
- package/dist/git-bundle.generated.js +7 -11
- package/dist/hosted/commands.d.ts.map +1 -1
- package/dist/hosted/commands.js +62 -243
- package/dist/hosted/runtime.d.ts +19 -13
- package/dist/hosted/runtime.d.ts.map +1 -1
- package/dist/hosted/runtime.js +71 -14
- package/dist/hosted/services.d.ts +6 -7
- package/dist/hosted/services.d.ts.map +1 -1
- package/dist/hosted/services.js +10 -14
- package/dist/hosted/session.d.ts +165 -0
- package/dist/hosted/session.d.ts.map +1 -0
- package/dist/hosted/session.js +132 -0
- package/dist/loaders/generated-workers.d.ts +5 -2
- package/dist/loaders/generated-workers.d.ts.map +1 -1
- package/dist/loaders/generated-workers.js +6 -3
- package/dist/loaders/npm-resolve-preamble.d.ts.map +1 -1
- package/dist/loaders/npm-resolve-preamble.js +0 -27
- package/dist/node-shims-artifact.generated.d.ts +13 -4
- package/dist/node-shims-artifact.generated.d.ts.map +1 -1
- package/dist/node-shims-artifact.generated.js +16 -7
- package/dist/npm/bin-links.d.ts +3 -1
- package/dist/npm/bin-links.d.ts.map +1 -1
- package/dist/npm/bin-links.js +32 -8
- package/dist/npm/cache.d.ts +5 -0
- package/dist/npm/cache.d.ts.map +1 -1
- package/dist/npm/cache.js +13 -1
- package/dist/npm/install-batch-facet.d.ts +2 -2
- package/dist/npm/install-batch-facet.js +3 -3
- package/dist/npm/installer.d.ts +17 -1
- package/dist/npm/installer.d.ts.map +1 -1
- package/dist/npm/installer.js +159 -20
- package/dist/npm/package-lock.d.ts +32 -0
- package/dist/npm/package-lock.d.ts.map +1 -0
- package/dist/npm/package-lock.js +65 -0
- package/dist/npm/pre-bundle-facet.d.ts +1 -30
- package/dist/npm/pre-bundle-facet.d.ts.map +1 -1
- package/dist/npm/pre-bundle-facet.js +3 -5
- package/dist/npm/r2-cache.d.ts +2 -0
- package/dist/npm/r2-cache.d.ts.map +1 -1
- package/dist/npm/r2-cache.js +2 -0
- package/dist/npm/resolve-one-facet.d.ts.map +1 -1
- package/dist/npm/resolve-one-facet.js +14 -3
- package/dist/npm/resolver.d.ts +0 -7
- package/dist/npm/resolver.d.ts.map +1 -1
- package/dist/npm/resolver.js +0 -22
- package/dist/opencode-artifact.generated.js +2 -2
- package/dist/replica/routing.d.ts +2 -38
- package/dist/replica/routing.d.ts.map +1 -1
- package/dist/replica/routing.js +3 -55
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/index.js +15 -2
- package/dist/router/public-directory.d.ts +18 -0
- package/dist/router/public-directory.d.ts.map +1 -1
- package/dist/router/public-directory.js +1 -1
- package/dist/router/remote-api.d.ts +3 -1
- package/dist/router/remote-api.d.ts.map +1 -1
- package/dist/router/remote-api.js +42 -79
- package/dist/runtime/bash-repl.js +2 -2
- package/dist/runtime/bun-repl.d.ts.map +1 -1
- package/dist/runtime/bun-repl.js +2 -13
- package/dist/runtime/esbuild-wasm-bytes.d.ts +17 -5
- package/dist/runtime/esbuild-wasm-bytes.d.ts.map +1 -1
- package/dist/runtime/esbuild-wasm-bytes.js +43 -94
- package/dist/runtime/git-bundle-artifact.d.ts +17 -0
- package/dist/runtime/git-bundle-artifact.d.ts.map +1 -0
- package/dist/runtime/git-bundle-artifact.js +25 -0
- package/dist/runtime/node-repl.d.ts.map +1 -1
- package/dist/runtime/node-repl.js +2 -13
- package/dist/runtime/node-shims-artifact.d.ts +22 -23
- package/dist/runtime/node-shims-artifact.d.ts.map +1 -1
- package/dist/runtime/node-shims-artifact.js +48 -78
- package/dist/runtime/node-shims.d.ts.map +1 -1
- package/dist/runtime/node-shims.js +1567 -864
- package/dist/runtime/opencode-artifact.d.ts.map +1 -1
- package/dist/runtime/opencode-artifact.js +17 -53
- package/dist/runtime/opencode-facet-runner.d.ts +3 -6
- package/dist/runtime/opencode-facet-runner.d.ts.map +1 -1
- package/dist/runtime/opencode-facet-runner.js +45 -10
- package/dist/runtime/opentui-wasm-bytes.d.ts.map +1 -1
- package/dist/runtime/opentui-wasm-bytes.js +16 -49
- package/dist/runtime/package-manager.d.ts +0 -2
- package/dist/runtime/package-manager.d.ts.map +1 -1
- package/dist/runtime/package-manager.js +0 -3
- package/dist/runtime/python-repl.d.ts.map +1 -1
- package/dist/runtime/python-repl.js +2 -2
- package/dist/runtime/repl-session.d.ts +10 -0
- package/dist/runtime/repl-session.d.ts.map +1 -1
- package/dist/runtime/repl-session.js +7 -0
- package/dist/runtime/ruby-repl.d.ts.map +1 -1
- package/dist/runtime/ruby-repl.js +2 -2
- package/dist/runtime/ruby-resident.d.ts.map +1 -1
- package/dist/runtime/ruby-resident.js +36 -35
- package/dist/runtime/runtime-catalog.d.ts +10 -3
- package/dist/runtime/runtime-catalog.d.ts.map +1 -1
- package/dist/runtime/runtime-catalog.js +125 -15
- package/dist/runtime/sqlite-wasm-bytes.d.ts +4 -4
- package/dist/runtime/sqlite-wasm-bytes.d.ts.map +1 -1
- package/dist/runtime/sqlite-wasm-bytes.js +21 -57
- package/dist/runtime/staged-source.d.ts +67 -0
- package/dist/runtime/staged-source.d.ts.map +1 -0
- package/dist/runtime/staged-source.js +113 -0
- package/dist/runtime/wasi/preamble.d.ts.map +1 -1
- package/dist/runtime/wasi/preamble.js +0 -24
- package/dist/runtime-catalog.generated.js +1 -1
- package/dist/session/agent.d.ts +14 -2
- package/dist/session/agent.d.ts.map +1 -1
- package/dist/session/agent.js +57 -19
- package/dist/session/ai.d.ts +0 -11
- package/dist/session/ai.d.ts.map +1 -1
- package/dist/session/ai.js +0 -4
- package/dist/session/fs-watch.d.ts +0 -11
- package/dist/session/fs-watch.d.ts.map +1 -1
- package/dist/session/fs-watch.js +0 -21
- package/dist/session/hibernation.d.ts +34 -11
- package/dist/session/hibernation.d.ts.map +1 -1
- package/dist/session/hibernation.js +46 -29
- package/dist/session/init-phases.d.ts +1 -2
- package/dist/session/init-phases.d.ts.map +1 -1
- package/dist/session/init-phases.js +1 -2
- package/dist/session/init.d.ts.map +1 -1
- package/dist/session/init.js +7 -20
- package/dist/session/keys.d.ts +0 -3
- package/dist/session/keys.d.ts.map +1 -1
- package/dist/session/keys.js +0 -3
- package/dist/session/legacy-reset.d.ts +11 -0
- package/dist/session/legacy-reset.d.ts.map +1 -0
- package/dist/session/legacy-reset.js +16 -0
- package/dist/session/nimbus-session.d.ts +41 -15
- package/dist/session/nimbus-session.d.ts.map +1 -1
- package/dist/session/nimbus-session.js +64 -70
- package/dist/session/npm-install-port.d.ts.map +1 -1
- package/dist/session/npm-install-port.js +1 -0
- package/dist/session/programmatic.d.ts +13 -18
- package/dist/session/programmatic.d.ts.map +1 -1
- package/dist/session/programmatic.js +53 -39
- package/dist/session/replica-routes.d.ts +2 -3
- package/dist/session/replica-routes.d.ts.map +1 -1
- package/dist/session/replica-routes.js +3 -10
- package/dist/session/routes.d.ts.map +1 -1
- package/dist/session/routes.js +7 -10
- package/dist/session/rpc.d.ts +104 -20
- package/dist/session/rpc.d.ts.map +1 -1
- package/dist/session/rpc.js +184 -37
- package/dist/session/start-real-vite.js +2 -2
- package/dist/session/state-store.d.ts +1 -17
- package/dist/session/state-store.d.ts.map +1 -1
- package/dist/session/state-store.js +3 -53
- package/dist/session/supervisor-op.d.ts +7 -0
- package/dist/session/supervisor-op.d.ts.map +1 -1
- package/dist/session/supervisor-op.js +6 -1
- package/dist/session/supervisor-rpc.d.ts +104 -15
- package/dist/session/supervisor-rpc.d.ts.map +1 -1
- package/dist/session/supervisor-rpc.js +188 -71
- package/dist/session/vite-command.d.ts.map +1 -1
- package/dist/session/vite-command.js +17 -14
- package/dist/session/ws.d.ts.map +1 -1
- package/dist/session/ws.js +20 -8
- package/dist/shell/npm-bin-entrypoints.d.ts.map +1 -1
- package/dist/shell/npm-bin-entrypoints.js +30 -5
- package/dist/vfs/facet-resident-limits.d.ts +33 -0
- package/dist/vfs/facet-resident-limits.d.ts.map +1 -0
- package/dist/vfs/facet-resident-limits.js +33 -0
- package/dist/vfs/facet-resident-store.d.ts +2 -10
- package/dist/vfs/facet-resident-store.d.ts.map +1 -1
- package/dist/vfs/facet-resident-store.js +1594 -219
- package/dist/workspace-host.d.ts +2 -0
- package/dist/workspace-host.d.ts.map +1 -1
- package/dist/workspace-host.js +2 -0
- package/dist/wrangler/nimbus-wrangler.d.ts +0 -2
- package/dist/wrangler/nimbus-wrangler.d.ts.map +1 -1
- package/dist/wrangler/nimbus-wrangler.js +5 -22
- package/package.json +8 -7
- package/public/_assets/opencode/1.16.2/index-attach.js +2 -2
- package/public/_assets/runtime/esbuild-cli-c4fda380d52befc1.js +6892 -0
- package/public/_assets/runtime/git-de3e60c9f3ff006a.js +103 -0
- package/public/_assets/runtime/{node-shims-7b4dd7a76d95d21e.js → node-shims-06565b121555c194.js} +2089 -861
- package/public/_assets/runtime/resident-store-6ffb1939c53d982f.js +2264 -0
- package/public/_assets/runtime/vfs-write-ledger-e501e8fc793bc2c1.js +889 -0
- package/scripts/build-opencode-attach-entry.mjs +51 -1
- package/scripts/bundle-facet-workers.mjs +114 -3
- package/scripts/bundle-git.mjs +88 -27
- package/scripts/bundle-node-shims.mjs +72 -46
- package/scripts/bundle-runtime.mjs +18 -421
- package/scripts/cf-git-patch.mjs +137 -0
- package/scripts/patch-install-deps.mjs +49 -96
- package/scripts/runtime-specs.mjs +435 -0
- package/vendor/git-http.generated.d.ts +82 -0
- package/vendor/git-upstream.generated.d.ts +4378 -0
- package/vendor/git.LICENSE +7 -0
- package/vendor/git.generated.d.mts +21 -0
- package/vendor/git.generated.mjs +103 -0
- package/dist/replica/suspension.d.ts +0 -36
- package/dist/replica/suspension.d.ts.map +0 -1
- package/dist/replica/suspension.js +0 -49
- package/dist/runtime/static-server.d.ts +0 -3
- package/dist/runtime/static-server.d.ts.map +0 -1
- package/dist/runtime/static-server.js +0 -133
- package/scripts/clean-dist.mjs +0 -7
package/dist/npm/installer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* npm
|
|
2
|
+
* npm/installer.ts — Unified npm installer for Nimbus.
|
|
3
3
|
*
|
|
4
4
|
* Designed for bun/pnpm-level performance on Cloudflare DO + SQLite.
|
|
5
5
|
*
|
|
@@ -24,10 +24,11 @@ import { BUNDLER_VERSION } from '@nimbus-sh/core/runtime/esbuild-service.js';
|
|
|
24
24
|
import { NpmCache } from './cache.js';
|
|
25
25
|
import { computeHoistPlan, hoistPlacements, } from './resolver.js';
|
|
26
26
|
import { nestedPlacement, visiblePlacements } from './placement.js';
|
|
27
|
+
import { packageLockMismatches, parsePackageLock, stringList, stringRecord } from './package-lock.js';
|
|
27
28
|
import { npmRegistryOrigin, packumentUrl } from './r2-cache.js';
|
|
28
29
|
import { satisfiesRange, isSemverRange } from './semver.js';
|
|
29
30
|
import { npmAddedLine, npmHttpCacheLine, npmHttpFetchLine, npmTitleLine, } from '@nimbus-sh/core/substrate/lifo/commands/system/npm-log.js';
|
|
30
|
-
import { applySwaps, findRejects, lookupSwap, isOptionalNativeBinding, formatSwapNotice, emitRegistryEvent, } from '../facets/wasm-swap-registry.js';
|
|
31
|
+
import { applySwaps, findRejects, lookupSwap, lookupReject, isOptionalNativeBinding, lookupStagedArtifact, applyStagedArtifact, policyNativePlatformReject, PACKAGE_ABI_POLICY, formatSwapNotice, emitRegistryEvent, } from '../facets/wasm-swap-registry.js';
|
|
31
32
|
import { resolvePackageEntry } from '@nimbus-sh/core/_shared/exports-resolver.js';
|
|
32
33
|
import { encodeWriteBatchStream } from '@nimbus-sh/platform/w7-frame.js';
|
|
33
34
|
import { Fanout, IN_DO_THRESHOLD } from '@nimbus-sh/fabric/fanout.js';
|
|
@@ -127,7 +128,10 @@ export class NpmInstaller {
|
|
|
127
128
|
this.npmLog('verbose', npmTitleLine(opts?.packages ?? []));
|
|
128
129
|
let phaseStart = Date.now();
|
|
129
130
|
log('Checking lockfile...');
|
|
130
|
-
|
|
131
|
+
// npm ci takes its roots from the lock, not from package.json specs.
|
|
132
|
+
const { specs, devOnly, optionalRoots, advised } = opts?.fromLockfile
|
|
133
|
+
? { specs: {}, devOnly: new Set(), optionalRoots: new Set(), advised: new Set() }
|
|
134
|
+
: await this.buildSpecs(projDir, opts?.packages, opts?.production);
|
|
131
135
|
// EBADPLATFORM refusals (os/cpu/libc allowlists on a required
|
|
132
136
|
// package) fail the install like real npm; every refused name was
|
|
133
137
|
// already logged as a [skip] line, name them again with the reason.
|
|
@@ -139,7 +143,10 @@ export class NpmInstaller {
|
|
|
139
143
|
log(`npm ERR! ${r.name}: ${r.reason}`);
|
|
140
144
|
}
|
|
141
145
|
};
|
|
142
|
-
|
|
146
|
+
const packageLock = opts?.fromLockfile
|
|
147
|
+
? await this.treeFromPackageLock(projDir, opts.production === true, log, registry)
|
|
148
|
+
: null;
|
|
149
|
+
if (packageLock === null && Object.keys(specs).length === 0) {
|
|
143
150
|
log('No dependencies to install.');
|
|
144
151
|
return { installed, failed, totalFiles: 0, elapsed: Date.now() - start, cachedHits: 0, phases: {} };
|
|
145
152
|
}
|
|
@@ -147,7 +154,17 @@ export class NpmInstaller {
|
|
|
147
154
|
let resolved;
|
|
148
155
|
let nested;
|
|
149
156
|
let usedLockfile = false;
|
|
150
|
-
if (
|
|
157
|
+
if (packageLock !== null) {
|
|
158
|
+
({ resolved, nested } = packageLock);
|
|
159
|
+
recordRefusals(packageLock.rejected);
|
|
160
|
+
for (const [name, reason] of packageLock.unresolved) {
|
|
161
|
+
failed.push(name);
|
|
162
|
+
log(`npm ERR! could not resolve ${name}: ${reason}`);
|
|
163
|
+
}
|
|
164
|
+
log(`Lockfile ${packageLock.lockName}: ${resolved.size + nested.size} packages to place.`);
|
|
165
|
+
phases['lock-check'] = Date.now() - phaseStart;
|
|
166
|
+
}
|
|
167
|
+
else if (lockfile && !opts?.packages && this.isLockfileValid(lockfile, specs)) {
|
|
151
168
|
log(`Lockfile valid (${lockfile.size} packages). Skipping resolution.`);
|
|
152
169
|
({ resolved, nested } = this.lockfileToResolved(lockfile));
|
|
153
170
|
usedLockfile = true;
|
|
@@ -1166,6 +1183,13 @@ export class NpmInstaller {
|
|
|
1166
1183
|
* W6: apply the PACKAGE_ABI_POLICY swap rewrites and reject deny list
|
|
1167
1184
|
* to a top-level spec map. Emits `[swap]` notices via onProgress.
|
|
1168
1185
|
*
|
|
1186
|
+
* A swap rewrites the spec's RANGE to an npm alias of the swap target
|
|
1187
|
+
* (`esbuild` → `npm:esbuild-wasm@<range>`), never its key: the key names
|
|
1188
|
+
* the install directory, so `resolved`, node_modules, the bin links, the
|
|
1189
|
+
* lockfile and package.json all keep the name the user declared. The
|
|
1190
|
+
* resolver facet treats the alias as authoritative and does not announce
|
|
1191
|
+
* the swap a second time.
|
|
1192
|
+
*
|
|
1169
1193
|
* G2: rejects are advisories — a listed package stays in the spec map
|
|
1170
1194
|
* and installs like any other (npm parity: it cannot run here, but
|
|
1171
1195
|
* install is the wrong place to say so). Each gets one `[npm] note:`
|
|
@@ -1252,6 +1276,130 @@ export class NpmInstaller {
|
|
|
1252
1276
|
}
|
|
1253
1277
|
return true;
|
|
1254
1278
|
}
|
|
1279
|
+
/**
|
|
1280
|
+
* npm ci: the placements package-lock.json (or npm-shrinkwrap.json)
|
|
1281
|
+
* records, checked against package.json first. The ABI policy the resolver
|
|
1282
|
+
* applies still holds: platform-native optional shards are skipped, a
|
|
1283
|
+
* required one is refused, and a swapped package resolves its swap target
|
|
1284
|
+
* at the locked version.
|
|
1285
|
+
*/
|
|
1286
|
+
async treeFromPackageLock(projDir, production, log, registry) {
|
|
1287
|
+
const lockName = ['npm-shrinkwrap.json', 'package-lock.json']
|
|
1288
|
+
.find((name) => this.vfs.exists(`${projDir}/${name}`));
|
|
1289
|
+
if (!lockName)
|
|
1290
|
+
throw new Error('`npm ci` needs a package-lock.json or npm-shrinkwrap.json');
|
|
1291
|
+
const lock = parsePackageLock(this.vfs.readFileString(`${projDir}/${lockName}`), lockName);
|
|
1292
|
+
const pkgJsonPath = `${projDir}/package.json`;
|
|
1293
|
+
if (!this.vfs.exists(pkgJsonPath))
|
|
1294
|
+
throw new Error('`npm ci` needs a package.json');
|
|
1295
|
+
const pkgJson = JSON.parse(this.vfs.readFileString(pkgJsonPath));
|
|
1296
|
+
const mismatches = packageLockMismatches(pkgJson, lock);
|
|
1297
|
+
if (mismatches.length > 0) {
|
|
1298
|
+
throw new Error(`\`npm ci\` can only install packages when your package.json and ${lockName} are in sync. ` +
|
|
1299
|
+
`Update the lock file with \`npm install\` before continuing.\n` +
|
|
1300
|
+
mismatches.map((m) => `npm ERR! ${m}`).join('\n'));
|
|
1301
|
+
}
|
|
1302
|
+
const unsupported = Object.keys(lock.packages).find((key) => key !== '' && !key.startsWith('node_modules/'));
|
|
1303
|
+
if (unsupported !== undefined) {
|
|
1304
|
+
throw new Error(`${lockName} entry "${unsupported}" is a workspace or linked package, which \`npm ci\` here does not install`);
|
|
1305
|
+
}
|
|
1306
|
+
// Only a lock that will be installed as written clears the old tree.
|
|
1307
|
+
if (this.vfs.exists(`${projDir}/node_modules`))
|
|
1308
|
+
this.vfs.removeRecursive(`${projDir}/node_modules`);
|
|
1309
|
+
const resolved = new Map();
|
|
1310
|
+
const nested = new Map();
|
|
1311
|
+
const unresolved = new Map();
|
|
1312
|
+
const rejected = [];
|
|
1313
|
+
// Swapped lock entries by placement: each resolves its swap target at its own locked version.
|
|
1314
|
+
const swapPlacements = [];
|
|
1315
|
+
for (const [key, entry] of Object.entries(lock.packages)) {
|
|
1316
|
+
if (key === '')
|
|
1317
|
+
continue;
|
|
1318
|
+
if (production && entry.dev === true)
|
|
1319
|
+
continue;
|
|
1320
|
+
const placement = key.slice('node_modules/'.length);
|
|
1321
|
+
const folderName = placement.split('/node_modules/').pop() ?? placement;
|
|
1322
|
+
const name = typeof entry.name === 'string' ? entry.name : folderName;
|
|
1323
|
+
const version = typeof entry.version === 'string' ? entry.version : '';
|
|
1324
|
+
const platform = {
|
|
1325
|
+
name,
|
|
1326
|
+
os: stringList(entry.os),
|
|
1327
|
+
cpu: stringList(entry.cpu),
|
|
1328
|
+
libc: stringList(entry.libc),
|
|
1329
|
+
main: '',
|
|
1330
|
+
};
|
|
1331
|
+
if (entry.optional === true && isOptionalNativeBinding(platform)) {
|
|
1332
|
+
log(`[resolve-fanout] [skip] ${name} — optional native binding (os=${platform.os ?? '*'}, cpu=${platform.cpu ?? '*'}, libc=${platform.libc ?? '*'})`);
|
|
1333
|
+
continue;
|
|
1334
|
+
}
|
|
1335
|
+
const platformReject = policyNativePlatformReject(PACKAGE_ABI_POLICY, platform);
|
|
1336
|
+
if (platformReject) {
|
|
1337
|
+
log(`[resolve-fanout] [skip] ${name} — ${platformReject.reason}`);
|
|
1338
|
+
rejected.push({ name, reason: platformReject.reason, required: entry.optional !== true });
|
|
1339
|
+
continue;
|
|
1340
|
+
}
|
|
1341
|
+
// Policy follows the registry identity (`name`), placement the folder the lock
|
|
1342
|
+
// names: an aliased entry (`node_modules/build`, name `esbuild`) resolves as
|
|
1343
|
+
// the alias `build@npm:esbuild@<locked>`, so the swap target lands in build.
|
|
1344
|
+
if (lookupSwap(name)) {
|
|
1345
|
+
swapPlacements.push({ placement, folderName, spec: folderName === name ? version : `npm:${name}@${version}` });
|
|
1346
|
+
continue;
|
|
1347
|
+
}
|
|
1348
|
+
if (entry.link === true || typeof entry.resolved !== 'string' || !version) {
|
|
1349
|
+
unresolved.set(name, `${lockName} records no registry tarball for ${key}`);
|
|
1350
|
+
continue;
|
|
1351
|
+
}
|
|
1352
|
+
const reject = lookupReject(name);
|
|
1353
|
+
if (reject)
|
|
1354
|
+
log(`[npm] note: ${name} has no Workers-compatible build: ${reject.reason}${reject.suggest ? ` … try: ${reject.suggest}` : ''}`);
|
|
1355
|
+
const pkg = {
|
|
1356
|
+
name,
|
|
1357
|
+
version,
|
|
1358
|
+
tarballUrl: entry.resolved,
|
|
1359
|
+
integrity: typeof entry.integrity === 'string' ? entry.integrity : '',
|
|
1360
|
+
dependencies: stringRecord(entry.dependencies),
|
|
1361
|
+
optionalDependencies: stringRecord(entry.optionalDependencies),
|
|
1362
|
+
peerDependencies: stringRecord(entry.peerDependencies),
|
|
1363
|
+
os: platform.os,
|
|
1364
|
+
cpu: platform.cpu,
|
|
1365
|
+
libc: platform.libc,
|
|
1366
|
+
exports: null,
|
|
1367
|
+
main: '',
|
|
1368
|
+
module: '',
|
|
1369
|
+
bin: typeof entry.bin === 'string' ? { [folderName]: entry.bin } : stringRecord(entry.bin),
|
|
1370
|
+
};
|
|
1371
|
+
const staged = lookupStagedArtifact(name);
|
|
1372
|
+
if (staged)
|
|
1373
|
+
applyStagedArtifact(pkg, staged);
|
|
1374
|
+
(placement.includes('/node_modules/') ? nested : resolved).set(placement, pkg);
|
|
1375
|
+
}
|
|
1376
|
+
// Root placements resolve together, as top-level specs. A nested one is its own
|
|
1377
|
+
// resolution, rebased under its placement: its package there, anything it
|
|
1378
|
+
// brings below it, unless the lock already placed that path.
|
|
1379
|
+
const rootSwaps = swapPlacements.filter(({ placement }) => !placement.includes('/node_modules/'));
|
|
1380
|
+
const batches = [];
|
|
1381
|
+
if (rootSwaps.length > 0)
|
|
1382
|
+
batches.push({ at: null, specs: Object.fromEntries(rootSwaps.map(({ folderName, spec }) => [folderName, spec])) });
|
|
1383
|
+
for (const { placement, folderName, spec } of swapPlacements) {
|
|
1384
|
+
if (placement.includes('/node_modules/'))
|
|
1385
|
+
batches.push({ at: placement, specs: { [folderName]: spec } });
|
|
1386
|
+
}
|
|
1387
|
+
for (const { at, specs } of batches) {
|
|
1388
|
+
const swapped = await this.resolveTreeViaFanout(specs, log, { registry });
|
|
1389
|
+
const [folder] = Object.keys(specs);
|
|
1390
|
+
const rebase = (path) => (at === null ? path : path === folder ? at : `${at}/node_modules/${path}`);
|
|
1391
|
+
for (const [path, pkg] of [...swapped.resolved, ...swapped.nested]) {
|
|
1392
|
+
const target = rebase(path);
|
|
1393
|
+
const into = target.includes('/node_modules/') ? nested : resolved;
|
|
1394
|
+
if (!into.has(target))
|
|
1395
|
+
into.set(target, pkg);
|
|
1396
|
+
}
|
|
1397
|
+
for (const [name, reason] of swapped.unresolved)
|
|
1398
|
+
unresolved.set(name, reason);
|
|
1399
|
+
rejected.push(...swapped.rejected);
|
|
1400
|
+
}
|
|
1401
|
+
return { resolved, nested, unresolved, rejected, lockName };
|
|
1402
|
+
}
|
|
1255
1403
|
/** Convert a lockfile back to resolved packages: root by name, nested by placement path. */
|
|
1256
1404
|
lockfileToResolved(lockfile) {
|
|
1257
1405
|
const resolved = new Map();
|
|
@@ -1319,7 +1467,7 @@ export class NpmInstaller {
|
|
|
1319
1467
|
const binChunks = [];
|
|
1320
1468
|
const mtime = Date.now();
|
|
1321
1469
|
for (const binEntry of Object.values(manifest.bins)) {
|
|
1322
|
-
const data = enc.encode(createNpmBinShim(binEntry));
|
|
1470
|
+
const data = enc.encode(createNpmBinShim(binEntry, binDir));
|
|
1323
1471
|
const linkPath = binDir + '/' + binEntry.name;
|
|
1324
1472
|
binEntries.push({
|
|
1325
1473
|
path: linkPath,
|
|
@@ -1373,21 +1521,12 @@ export class NpmInstaller {
|
|
|
1373
1521
|
if (!pkgJson.dependencies)
|
|
1374
1522
|
pkgJson.dependencies = {};
|
|
1375
1523
|
for (const spec of explicitPackages) {
|
|
1376
|
-
//
|
|
1524
|
+
// `resolved` is keyed by the name the user typed — a swapped
|
|
1525
|
+
// package resolves as an alias under that name (applySwaps), so
|
|
1526
|
+
// `esbuild` is found as `esbuild` and package.json records the
|
|
1527
|
+
// user's key, never the swap target.
|
|
1377
1528
|
const { name } = parseExplicitPackageSpec(spec);
|
|
1378
|
-
|
|
1379
|
-
// keyed by the swap target (e.g. user typed 'esbuild', resolved
|
|
1380
|
-
// has 'esbuild-wasm'). Look up via lookupSwap to bridge the
|
|
1381
|
-
// gap; write the user's original key into package.json so the
|
|
1382
|
-
// file remains the user's source-of-truth and isn't silently
|
|
1383
|
-
// mutated to the swap target (which would break cross-environment
|
|
1384
|
-
// pushes).
|
|
1385
|
-
let pkg = resolved.get(name);
|
|
1386
|
-
if (!pkg) {
|
|
1387
|
-
const swap = lookupSwap(name);
|
|
1388
|
-
if (swap)
|
|
1389
|
-
pkg = resolved.get(swap.to);
|
|
1390
|
-
}
|
|
1529
|
+
const pkg = resolved.get(name);
|
|
1391
1530
|
if (pkg) {
|
|
1392
1531
|
pkgJson.dependencies[name] = '^' + pkg.version;
|
|
1393
1532
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface PackageLockEntry {
|
|
2
|
+
name?: unknown;
|
|
3
|
+
version?: unknown;
|
|
4
|
+
resolved?: unknown;
|
|
5
|
+
integrity?: unknown;
|
|
6
|
+
link?: unknown;
|
|
7
|
+
dev?: unknown;
|
|
8
|
+
optional?: unknown;
|
|
9
|
+
dependencies?: unknown;
|
|
10
|
+
devDependencies?: unknown;
|
|
11
|
+
optionalDependencies?: unknown;
|
|
12
|
+
peerDependencies?: unknown;
|
|
13
|
+
bin?: unknown;
|
|
14
|
+
os?: unknown;
|
|
15
|
+
cpu?: unknown;
|
|
16
|
+
libc?: unknown;
|
|
17
|
+
}
|
|
18
|
+
export interface PackageLock {
|
|
19
|
+
lockfileVersion: number;
|
|
20
|
+
packages: Record<string, PackageLockEntry>;
|
|
21
|
+
}
|
|
22
|
+
export declare function parsePackageLock(text: string, lockName: string): PackageLock;
|
|
23
|
+
/**
|
|
24
|
+
* Why the lock no longer describes package.json, one line per disagreement;
|
|
25
|
+
* empty when they agree. Every declared dependency must be locked at a
|
|
26
|
+
* version its range accepts, and the lock's root must declare the same
|
|
27
|
+
* dependency set, so a dependency removed from package.json is caught too.
|
|
28
|
+
*/
|
|
29
|
+
export declare function packageLockMismatches(pkgJson: Record<string, unknown>, lock: PackageLock): string[];
|
|
30
|
+
export declare function stringRecord(value: unknown): Record<string, string>;
|
|
31
|
+
export declare function stringList(value: unknown): string[] | undefined;
|
|
32
|
+
//# sourceMappingURL=package-lock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-lock.d.ts","sourceRoot":"","sources":["../../src/npm/package-lock.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAC5C;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,WAAW,CAU5E;AAID;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,WAAW,GAAG,MAAM,EAAE,CA2BnG;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAKnE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,GAAG,SAAS,CAE/D"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* npm's package-lock.json / npm-shrinkwrap.json (lockfileVersion 2 and 3),
|
|
3
|
+
* read for `npm ci`: the `packages` map keyed by install path, and the check
|
|
4
|
+
* that the lock still describes what package.json declares.
|
|
5
|
+
*/
|
|
6
|
+
import { isSemverRange, satisfiesRange } from './semver.js';
|
|
7
|
+
import { parseRegistryRequest } from './resolve-one-facet.js';
|
|
8
|
+
export function parsePackageLock(text, lockName) {
|
|
9
|
+
const lock = JSON.parse(text);
|
|
10
|
+
const version = typeof lock.lockfileVersion === 'number' ? lock.lockfileVersion : 0;
|
|
11
|
+
if (version < 2 || lock.packages === null || typeof lock.packages !== 'object') {
|
|
12
|
+
throw new Error(`${lockName} has lockfileVersion ${version || 'unknown'}; \`npm ci\` here reads lockfileVersion 2 or 3. ` +
|
|
13
|
+
'Run `npm install` with npm 7 or newer to upgrade it.');
|
|
14
|
+
}
|
|
15
|
+
return { lockfileVersion: version, packages: lock.packages };
|
|
16
|
+
}
|
|
17
|
+
const DEPENDENCY_FIELDS = ['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies'];
|
|
18
|
+
/**
|
|
19
|
+
* Why the lock no longer describes package.json, one line per disagreement;
|
|
20
|
+
* empty when they agree. Every declared dependency must be locked at a
|
|
21
|
+
* version its range accepts, and the lock's root must declare the same
|
|
22
|
+
* dependency set, so a dependency removed from package.json is caught too.
|
|
23
|
+
*/
|
|
24
|
+
export function packageLockMismatches(pkgJson, lock) {
|
|
25
|
+
const out = [];
|
|
26
|
+
const root = lock.packages[''] ?? {};
|
|
27
|
+
for (const field of DEPENDENCY_FIELDS) {
|
|
28
|
+
const declared = stringRecord(pkgJson[field]);
|
|
29
|
+
const locked = stringRecord(root[field]);
|
|
30
|
+
for (const [name, spec] of Object.entries(declared)) {
|
|
31
|
+
if (locked[name] !== spec) {
|
|
32
|
+
out.push(`Invalid: lock file's root ${field} has ${name}@${locked[name] ?? '(none)'}, package.json has ${name}@${spec}`);
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
const entry = lock.packages[`node_modules/${name}`];
|
|
36
|
+
if (!entry) {
|
|
37
|
+
if (field !== 'peerDependencies' && field !== 'optionalDependencies')
|
|
38
|
+
out.push(`Missing: ${name}@${spec} from lock file`);
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
const range = parseRegistryRequest(name, spec).range;
|
|
42
|
+
const version = typeof entry.version === 'string' ? entry.version : '';
|
|
43
|
+
if (isSemverRange(range) && !satisfiesRange(version, range)) {
|
|
44
|
+
out.push(`Invalid: lock file's ${name}@${version || '(none)'} does not satisfy ${name}@${spec}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
for (const name of Object.keys(locked)) {
|
|
48
|
+
if (!Object.hasOwn(declared, name))
|
|
49
|
+
out.push(`Invalid: lock file's root ${field} has ${name}, which package.json does not declare`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return out;
|
|
53
|
+
}
|
|
54
|
+
export function stringRecord(value) {
|
|
55
|
+
const out = {};
|
|
56
|
+
if (value === null || typeof value !== 'object')
|
|
57
|
+
return out;
|
|
58
|
+
for (const [key, v] of Object.entries(value))
|
|
59
|
+
if (typeof v === 'string')
|
|
60
|
+
out[key] = v;
|
|
61
|
+
return out;
|
|
62
|
+
}
|
|
63
|
+
export function stringList(value) {
|
|
64
|
+
return Array.isArray(value) ? value.filter((v) => typeof v === 'string') : undefined;
|
|
65
|
+
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Why this exists
|
|
5
5
|
* ───────────────
|
|
6
6
|
* Pre-bundling npm packages (the `Pre-bundling N modules…` step in
|
|
7
|
-
* src/npm
|
|
7
|
+
* src/npm/installer.ts) used to call `EsbuildService.build(...)`
|
|
8
8
|
* inside the supervisor DO isolate. Each `esbuild.build` allocates
|
|
9
9
|
* 30–80 MiB of WASM linear memory plus the input/output graph; against
|
|
10
10
|
* the 128 MB DO heap cap this OOM-killed the supervisor on installs
|
|
@@ -104,35 +104,6 @@ export interface PrebundleResult {
|
|
|
104
104
|
/** Non-fatal warnings the supervisor should surface. */
|
|
105
105
|
warnings: string[];
|
|
106
106
|
}
|
|
107
|
-
/**
|
|
108
|
-
* Walk node_modules to collect every file the pre-bundle of `specifier`
|
|
109
|
-
* may read. Runs in the supervisor (cheap — direct VFS access).
|
|
110
|
-
*
|
|
111
|
-
* Algorithm:
|
|
112
|
-
* 1. Compute the externals via getSharedRuntimeExternals(specifier).
|
|
113
|
-
* These are the bare specifiers esbuild will leave external; their
|
|
114
|
-
* files do NOT need to be in the slice.
|
|
115
|
-
* 2. Resolve the spec's package directory and add every file beneath
|
|
116
|
-
* it to the slice.
|
|
117
|
-
* 3. Read its package.json `dependencies` and recurse into each one
|
|
118
|
-
* that is NOT in the externals set. Deps that walked up are
|
|
119
|
-
* visited at most once (visited set).
|
|
120
|
-
*
|
|
121
|
-
* Lives here (alongside the facet function) so changes to the slice
|
|
122
|
-
* shape touch one file — the supervisor caller in npm-installer.ts is
|
|
123
|
-
* a thin orchestrator.
|
|
124
|
-
*/
|
|
125
|
-
export interface BuildSliceOptions {
|
|
126
|
-
/** Cap on total bytes shipped to the facet. 24 MiB leaves headroom under
|
|
127
|
-
* the 32 MiB workerd RPC cap. Returns `null` if the cap is exceeded so
|
|
128
|
-
* the caller can decide whether to bail or split (bf41d1c precedent).
|
|
129
|
-
*/
|
|
130
|
-
maxBytes?: number;
|
|
131
|
-
}
|
|
132
|
-
export declare function buildSliceForSpecifier(vfs: CredentialedVfs, specifier: string, nmDir: string): {
|
|
133
|
-
slice: SliceEntry[];
|
|
134
|
-
totalBytes: number;
|
|
135
|
-
} | null;
|
|
136
107
|
export declare function buildSliceForSpecifierWithCap(vfs: CredentialedVfs, specifier: string, nmDir: string, capBytes: number): {
|
|
137
108
|
slice: SliceEntry[];
|
|
138
109
|
totalBytes: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pre-bundle-facet.d.ts","sourceRoot":"","sources":["../../src/npm/pre-bundle-facet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAA6B,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAgBxG;;;;;;;;;GASG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,KAAK,CAAC;CACd;AACD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,IAAI,CAAC;CACb;AACD,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;AAEhD,yDAAyD;AACzD,MAAM,WAAW,aAAa;IAC5B,iFAAiF;IACjF,SAAS,EAAE,MAAM,CAAC;IAClB,+GAA+G;IAC/G,SAAS,EAAE,MAAM,CAAC;IAClB,4DAA4D;IAC5D,SAAS,EAAE,MAAM,E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───────────────
|
|
6
6
|
* Pre-bundling npm packages (the `Pre-bundling N modules…` step in
|
|
7
|
-
* src/npm
|
|
7
|
+
* src/npm/installer.ts) used to call `EsbuildService.build(...)`
|
|
8
8
|
* inside the supervisor DO isolate. Each `esbuild.build` allocates
|
|
9
9
|
* 30–80 MiB of WASM linear memory plus the input/output graph; against
|
|
10
10
|
* the 128 MB DO heap cap this OOM-killed the supervisor on installs
|
|
@@ -45,9 +45,7 @@
|
|
|
45
45
|
* contract.
|
|
46
46
|
*/
|
|
47
47
|
import { getSharedRuntimeExternals, BUNDLER_VERSION } from '@nimbus-sh/core/runtime/esbuild-service.js';
|
|
48
|
-
|
|
49
|
-
return buildSliceForSpecifierWithCap(vfs, specifier, nmDir, 24 * 1024 * 1024);
|
|
50
|
-
}
|
|
48
|
+
// ── Supervisor-side: build the slice for one specifier ──────────────────
|
|
51
49
|
export function buildSliceForSpecifierWithCap(vfs, specifier, nmDir, capBytes) {
|
|
52
50
|
const externals = new Set();
|
|
53
51
|
for (const e of getSharedRuntimeExternals(specifier)) {
|
|
@@ -286,7 +284,7 @@ export const prebundleOne = async function prebundleOne(spec, _env) {
|
|
|
286
284
|
initPromise = (async () => {
|
|
287
285
|
// Read the WebAssembly.Module the pool registered. The key matches
|
|
288
286
|
// the name passed to IsolatePool's `wasmModules` option (see
|
|
289
|
-
// src/npm
|
|
287
|
+
// src/npm/installer.ts:prebundleUsedModules dispatch site).
|
|
290
288
|
const wasmRegistry = globalThis.__NIMBUS_WASM;
|
|
291
289
|
const wasmModule = wasmRegistry && wasmRegistry['esbuild.wasm'];
|
|
292
290
|
if (!wasmModule) {
|
package/dist/npm/r2-cache.d.ts
CHANGED
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
* Two buckets, two key shapes:
|
|
17
17
|
* tarball: `${R2_CACHE_PREFIX}/t/<sri-algo>/<sri-digest-hex>.tgz`
|
|
18
18
|
* packument: `${R2_CACHE_PREFIX}/pc/<name>.json (corgi/abbreviated format)`
|
|
19
|
+
* The tarball bucket also holds read profiles under `read-profiles/v1/`
|
|
20
|
+
* (facets/read-profile.ts): package-relative paths per tarball integrity.
|
|
19
21
|
*
|
|
20
22
|
* Why two buckets:
|
|
21
23
|
* Tarballs are content-addressed and never expire. Packuments must
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"r2-cache.d.ts","sourceRoot":"","sources":["../../src/npm/r2-cache.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"r2-cache.d.ts","sourceRoot":"","sources":["../../src/npm/r2-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AAEH,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uDAAuD,CAAC;AAC/G,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AAEnF;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GACxB;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,SAAS,CAAC;IAAC,SAAS,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACrE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,SAAS,CAAC;IAAC,SAAS,EAAE,SAAS,CAAA;CAAE,CAAC;AAE5D;;;;;;;;mBAQmB;AACnB,eAAO,MAAM,eAAe,OAAO,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yDA6ByD;AACzD,eAAO,MAAM,gBAAgB,QAAc,CAAC;AAI5C,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,CAAC;AAKlD,qFAAqF;AACrF,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,MAA4B,GAAG,MAAM,CAKzF;AAcD;;;;0DAI0D;AAC1D,eAAO,MAAM,oBAAoB,QAAm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AE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAwE/D;;;;;;;;;OASG;IACG,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;IAkBtF;;;;;;;;;;;;;;;;OAgBG;IACG,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,MAA4B,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IA8EzG;;;;;;;;;;;;;;;;;;;OAmBG;IACG,oBAAoB,CACxB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GACpE,OAAO,CAAC,oBAAoB,CAAC;IA6DhC;;;;;;;;;;OAUG;IACG,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,MAA4B,GAAG,OAAO,CAAC,OAAO,CAAC;IAexG,uEAAuE;IACvE,gBAAgB,IAAI,OAAO;IAI3B,uEAAuE;IACvE,kBAAkB,IAAI,OAAO;CAG9B"}
|
package/dist/npm/r2-cache.js
CHANGED
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
* Two buckets, two key shapes:
|
|
17
17
|
* tarball: `${R2_CACHE_PREFIX}/t/<sri-algo>/<sri-digest-hex>.tgz`
|
|
18
18
|
* packument: `${R2_CACHE_PREFIX}/pc/<name>.json (corgi/abbreviated format)`
|
|
19
|
+
* The tarball bucket also holds read profiles under `read-profiles/v1/`
|
|
20
|
+
* (facets/read-profile.ts): package-relative paths per tarball integrity.
|
|
19
21
|
*
|
|
20
22
|
* Why two buckets:
|
|
21
23
|
* Tarballs are content-addressed and never expire. Packuments must
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-one-facet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Z,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,SAAS,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAA;SAAE,KAC9D,OAAO,CAAC;YACX,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;YACpB,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC;YAC/B,MAAM,EAAE,KAAK,CACT;gBAAE,IAAI,EAAE,KAAK,CAAC;gBAAC,IAAI,EAAE,MAAM,CAAC;gBAAC,SAAS,EAAE,MAAM,CAAC;gBAAC,KAAK,EAAE,MAAM,CAAA;aAAE,GAC/D;gBAAE,IAAI,EAAE,MAAM,CAAC;gBAAC,IAAI,EAAE,MAAM,CAAC;gBAAC,SAAS,EAAE,MAAM,CAAA;aAAE,CACpD,CAAC;YACF,MAAM,CAAC,EAAE,MAAM,CAAC;YAChB,OAAO,CAAC,EAAE,MAAM,CAAC;SAClB,CAAC,CAAC;KACJ,CAAC;CACH,KACA,OAAO,CAAC,gBAAgB,CAiX1B,CAAC"}
|
|
@@ -175,9 +175,19 @@ export const resolveOnePackumentInFacet = async function resolveOnePackumentInFa
|
|
|
175
175
|
});
|
|
176
176
|
};
|
|
177
177
|
// 1. Registry policy.
|
|
178
|
+
//
|
|
179
|
+
// A swap is an npm alias the policy declares for the package: the
|
|
180
|
+
// packument comes from the swap target, the package installs under the
|
|
181
|
+
// requested name (`request.installName`) — exactly the shape an explicit
|
|
182
|
+
// `name@npm:target@range` spec already has. Policy applies to the
|
|
183
|
+
// REGISTRY identity, placement to the declared name: a top-level swap the
|
|
184
|
+
// supervisor already rewrote (applySwaps, which also announced it)
|
|
185
|
+
// arrives naming the WASM target and is not swapped again, while a user's
|
|
186
|
+
// explicit alias to the native package (`build@npm:esbuild`) still needs
|
|
187
|
+
// its target swapped — and keeps its own install name.
|
|
178
188
|
let effName = request.registryName;
|
|
179
189
|
// @ts-ignore — preamble.
|
|
180
|
-
const __swap = SHOULD_SWAP(
|
|
190
|
+
const __swap = SHOULD_SWAP(request.registryName);
|
|
181
191
|
if (__swap) {
|
|
182
192
|
messages.push(`[npm] \x1b[33m[swap]\x1b[0m ${__swap.from} → ${__swap.to}`);
|
|
183
193
|
events.push({ type: 'swap', from: __swap.from, to: __swap.to, ctx: 'transitive' });
|
|
@@ -185,9 +195,10 @@ export const resolveOnePackumentInFacet = async function resolveOnePackumentInFa
|
|
|
185
195
|
}
|
|
186
196
|
else {
|
|
187
197
|
// @ts-ignore — preamble.
|
|
188
|
-
const __fail = SHOULD_REJECT_FAIL(
|
|
198
|
+
const __fail = SHOULD_REJECT_FAIL(request.registryName);
|
|
189
199
|
// A listed package resolves and installs — npm parity; the
|
|
190
|
-
// advisory names the reason it cannot run here.
|
|
200
|
+
// advisory names the reason it cannot run here. An alias of a listed
|
|
201
|
+
// package (`img@npm:sharp`) is that package.
|
|
191
202
|
if (__fail)
|
|
192
203
|
emitAdvisory(__fail);
|
|
193
204
|
}
|
package/dist/npm/resolver.d.ts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* Registry resolution runs in fanout facets; this module contains only the
|
|
5
5
|
* supervisor-side contracts and computations consumed after resolution.
|
|
6
6
|
*/
|
|
7
|
-
import type { RegistryCacheEntry } from './cache.js';
|
|
8
7
|
/**
|
|
9
8
|
* Injectable fetch function used by the installer's facet-backed registry
|
|
10
9
|
* transport.
|
|
@@ -41,12 +40,6 @@ export interface PackagePlacement {
|
|
|
41
40
|
placement: string;
|
|
42
41
|
pkg: ResolvedPackage;
|
|
43
42
|
}
|
|
44
|
-
/**
|
|
45
|
-
* Serialize a resolved package into the registry-cache row shape. Facet task
|
|
46
|
-
* bodies keep inline literals of this shape because `fn.toString()` isolates
|
|
47
|
-
* cannot import supervisor modules.
|
|
48
|
-
*/
|
|
49
|
-
export declare function registryEntryFromResolved(pkg: ResolvedPackage): RegistryCacheEntry;
|
|
50
43
|
/** The walk's placement decisions carried forward: first version per name at root, the rest nested. */
|
|
51
44
|
export declare function computeHoistPlan(resolved: Map<string, ResolvedPackage>, nested?: Map<string, ResolvedPackage>): HoistPlan;
|
|
52
45
|
/** Every placement in the plan, root first. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../src/npm/resolver.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../src/npm/resolver.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE7E,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,sEAAsE;IACtE,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,8DAA8D;IAC9D,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,sEAAsE;IACtE,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,GAAG,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7B;AAED,MAAM,WAAW,SAAS;IACxB,2DAA2D;IAC3D,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IACnC,iGAAiG;IACjG,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CACtC;AAED,+EAA+E;AAC/E,MAAM,WAAW,gBAAgB;IAC/B,+DAA+D;IAC/D,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,eAAe,CAAC;CACtB;AAID,uGAAuG;AACvG,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,EACtC,MAAM,GAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAa,GAC/C,SAAS,CAKX;AAED,+CAA+C;AAC/C,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,gBAAgB,EAAE,CAKnE"}
|
package/dist/npm/resolver.js
CHANGED
|
@@ -4,28 +4,6 @@
|
|
|
4
4
|
* Registry resolution runs in fanout facets; this module contains only the
|
|
5
5
|
* supervisor-side contracts and computations consumed after resolution.
|
|
6
6
|
*/
|
|
7
|
-
/**
|
|
8
|
-
* Serialize a resolved package into the registry-cache row shape. Facet task
|
|
9
|
-
* bodies keep inline literals of this shape because `fn.toString()` isolates
|
|
10
|
-
* cannot import supervisor modules.
|
|
11
|
-
*/
|
|
12
|
-
export function registryEntryFromResolved(pkg) {
|
|
13
|
-
return {
|
|
14
|
-
name: pkg.name,
|
|
15
|
-
version: pkg.version,
|
|
16
|
-
tarballUrl: pkg.tarballUrl,
|
|
17
|
-
integrity: pkg.integrity,
|
|
18
|
-
depsJson: JSON.stringify(pkg.dependencies),
|
|
19
|
-
peerDepsJson: JSON.stringify(pkg.peerDependencies ?? {}),
|
|
20
|
-
exportsJson: JSON.stringify(pkg.exports ?? {}),
|
|
21
|
-
main: pkg.main,
|
|
22
|
-
moduleField: pkg.module,
|
|
23
|
-
binJson: JSON.stringify(pkg.bin),
|
|
24
|
-
platformJson: JSON.stringify({ os: pkg.os, cpu: pkg.cpu, libc: pkg.libc }),
|
|
25
|
-
optionalDepsJson: JSON.stringify(pkg.optionalDependencies ?? {}),
|
|
26
|
-
fetchedAt: Date.now(),
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
7
|
/** The walk's placement decisions carried forward: first version per name at root, the rest nested. */
|
|
30
8
|
export function computeHoistPlan(resolved, nested = new Map()) {
|
|
31
9
|
return {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* with different content never serves stale bytes from a warm colo cache.
|
|
19
19
|
*/
|
|
20
20
|
export const OPENCODE_ARTIFACT_VERSION = "1.16.2";
|
|
21
|
-
export const OPENCODE_ARTIFACT_BUILD_ID = "
|
|
21
|
+
export const OPENCODE_ARTIFACT_BUILD_ID = "77f4bee3991c68c0";
|
|
22
22
|
export const OPENCODE_ARTIFACT_PRESENT = true;
|
|
23
23
|
export const OPENCODE_ARTIFACT_ENTRY = "/_assets/opencode/1.16.2/index.js";
|
|
24
24
|
export const OPENCODE_ARTIFACT_FILES = ["bip-bop-01-ga21wr3r.mp3", "bip-bop-03-kgfd4rq4.mp3", "chunks.json", "highlights-eq9cgrbb.scm", "highlights-ghv9g403.scm", "highlights-hk7bwhj4.scm", "highlights-r812a2qc.scm", "highlights-x6tmsnaa.scm", "index-attach.js", "injections-73j83es3.scm", "nope-03-2z8weyjw.mp3", "parser.worker.js", "photon_rs_bg-bq08arze.wasm", "staplebops-06-rz29m246.mp3", "tree-sitter-3jzf13jk.wasm", "tree-sitter-bash-hq5s6fxb.wasm", "tree-sitter-javascript-nd0q4pe9.wasm", "tree-sitter-markdown-411r6y9b.wasm", "tree-sitter-markdown_inline-j5349f42.wasm", "tree-sitter-powershell-ryb2ffqs.wasm", "tree-sitter-typescript-zxjzwt75.wasm", "tree-sitter-zig-e78zbjpm.wasm", "worker.js", "yoga.wasm", "yup-01-30ecpeh9.mp3"];
|
|
@@ -28,7 +28,7 @@ export const OPENCODE_ARTIFACT_FILES = ["bip-bop-01-ga21wr3r.mp3", "bip-bop-03-k
|
|
|
28
28
|
* (the L2 tier included) before the bytes are compiled as a wasm module or
|
|
29
29
|
* evaluated as facet ESM; a file with no entry here is a loud throw.
|
|
30
30
|
*/
|
|
31
|
-
export const OPENCODE_ARTIFACT_DIGESTS = { "bip-bop-01-ga21wr3r.mp3": "129765d4203f92ecb36ba17553b037ebf4daf28ebb56013b3896d3e7e36f2d74", "bip-bop-03-kgfd4rq4.mp3": "82b992e5dc5cfdc4d7206e0cd12d3132fa76ae30f8af51ec4cc216ba15f1afcd", "chunks.json": "91a733d40ff10c50202ddc6f1a17cb61205fa58d112c81d85e1a4230d394ee45", "highlights-eq9cgrbb.scm": "8e823819058d480c450ca4ef377a05675f6ed6f7c0460a69b972cdbe940c0893", "highlights-ghv9g403.scm": "c90e849891a3c8698992e10efdeaff7e7a8f98da47f941489566cb9e60f639b5", "highlights-hk7bwhj4.scm": "f2232f0fde717543e4541cec871dd8633cb9bc6b5d1686a56b2d469c1dd9e6b6", "highlights-r812a2qc.scm": "f3b02df1a9213cfecfb6936bce8db2f777edd523fc23ed890695e6cb4552d556", "highlights-x6tmsnaa.scm": "ca9a109ddd21c5ffdc6b84f00c0a4b2eeb55ae36a0b8eeb9b02348269c5acd22", "index-attach.js": "
|
|
31
|
+
export const OPENCODE_ARTIFACT_DIGESTS = { "bip-bop-01-ga21wr3r.mp3": "129765d4203f92ecb36ba17553b037ebf4daf28ebb56013b3896d3e7e36f2d74", "bip-bop-03-kgfd4rq4.mp3": "82b992e5dc5cfdc4d7206e0cd12d3132fa76ae30f8af51ec4cc216ba15f1afcd", "chunks.json": "91a733d40ff10c50202ddc6f1a17cb61205fa58d112c81d85e1a4230d394ee45", "highlights-eq9cgrbb.scm": "8e823819058d480c450ca4ef377a05675f6ed6f7c0460a69b972cdbe940c0893", "highlights-ghv9g403.scm": "c90e849891a3c8698992e10efdeaff7e7a8f98da47f941489566cb9e60f639b5", "highlights-hk7bwhj4.scm": "f2232f0fde717543e4541cec871dd8633cb9bc6b5d1686a56b2d469c1dd9e6b6", "highlights-r812a2qc.scm": "f3b02df1a9213cfecfb6936bce8db2f777edd523fc23ed890695e6cb4552d556", "highlights-x6tmsnaa.scm": "ca9a109ddd21c5ffdc6b84f00c0a4b2eeb55ae36a0b8eeb9b02348269c5acd22", "index-attach.js": "8affc9bb21dc8ef55e8599a2b82f36d9a2cf39189563f9f7a9f029a0f9cc7db0", "index.js": "6002a1bba20dc167453ade832a636f620f00d89c03a4d5f8f9da29e406ee2179", "injections-73j83es3.scm": "a2bf8c052454acbe765970a4ad2706c60cad7b62a762b927e28f60af1a0ef516", "nope-03-2z8weyjw.mp3": "9832805f84dcdb4a8ccb46a98cc75def72b52509610837938ed8343b2537df0c", "parser.worker.js": "6f9e4650d1c4524ed7cf6be288cadd89eebb97506864d85cf63c912b3fde43e6", "photon_rs_bg-bq08arze.wasm": "10468181565c56004c867f3a4af96f89a0ef5a63a72f2b5fb12c1f1992a3615c", "staplebops-06-rz29m246.mp3": "eb87d63312ac11b1ceb1a8b348057dfe4d1166d5a85dc79778fe69d458f4c097", "tree-sitter-3jzf13jk.wasm": "f38dcc4b43b818f9a0785bc1c6d5611a75ac4cdd428ff3f02757c34ca4e46d7f", "tree-sitter-bash-hq5s6fxb.wasm": "364f0a2cd385c792239423026ef442dbd073d34c396b7bc9e5932426b8e4aa5d", "tree-sitter-javascript-nd0q4pe9.wasm": "5fb488d0cabb4775a594bab85682de5ad6ce83c0d6ac997a9f82dd084d571240", "tree-sitter-markdown_inline-j5349f42.wasm": "9bbd71a70a23f6d0193bb162a72eecf2a2bd9ce76910d7ad3da9c5f80f122671", "tree-sitter-markdown-411r6y9b.wasm": "3e13182f21373634c40653f170e6f2d2790914eb2c243927086d79023c534f7a", "tree-sitter-powershell-ryb2ffqs.wasm": "1d30b5a21866354aa2eb94845556f1e19126ff00e3335048719a0e6435b1c154", "tree-sitter-typescript-zxjzwt75.wasm": "778025db5a8be0e70f8ccc3671e486dfeddd048c25d9e8a70c26de2e1bf6f97d", "tree-sitter-zig-e78zbjpm.wasm": "54b3b83dd9c62da5815f06132bc3fc914d9dcc780370b32416446a0b7969e8c6", "worker.js": "9bdd2405e25b2dcec3c936a88efa97670f1c39d71d5c5634f3ec5a0d45a5f7a8", "yoga.wasm": "7ba9c9483c8c38a468e9aef4a95ed72fad8a43594be8e5123eb3bdb6479edf5b", "yup-01-30ecpeh9.mp3": "b227d0516dfa1eda3b250635cce19e040af3f9cee443a8bb4b5a80990bca3f58" };
|
|
32
32
|
export const OPENCODE_TREE_SITTER_WASMS = { "core": "tree-sitter-3jzf13jk.wasm", "bash": "tree-sitter-bash-hq5s6fxb.wasm", "powershell": "tree-sitter-powershell-ryb2ffqs.wasm" };
|
|
33
33
|
export const OPENCODE_TUI_WORKERS = { "server": "worker.js", "parser": "parser.worker.js" };
|
|
34
34
|
/**
|