@nimbus-sh/worker 0.6.0 → 0.7.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/README.md +2 -2
- package/dist/cirrus-npm-cjs.generated.d.ts +1 -1
- package/dist/cirrus-npm-cjs.generated.js +1 -1
- package/dist/facets/cirrus-real.d.ts.map +1 -1
- package/dist/facets/cirrus-real.js +6 -5
- package/dist/facets/compose.d.ts +148 -0
- package/dist/facets/compose.d.ts.map +1 -0
- package/dist/facets/compose.js +146 -0
- package/dist/facets/durable-images.d.ts +9 -5
- package/dist/facets/durable-images.d.ts.map +1 -1
- package/dist/facets/durable-images.js +17 -7
- package/dist/facets/esbuild-bundle-pool.d.ts +49 -0
- package/dist/facets/esbuild-bundle-pool.d.ts.map +1 -0
- package/dist/facets/esbuild-bundle-pool.js +122 -0
- package/dist/facets/exec-telemetry.d.ts +8 -0
- package/dist/facets/exec-telemetry.d.ts.map +1 -1
- package/dist/facets/manager.d.ts +240 -109
- package/dist/facets/manager.d.ts.map +1 -1
- package/dist/facets/manager.js +661 -337
- package/dist/facets/process.d.ts +20 -16
- package/dist/facets/process.d.ts.map +1 -1
- package/dist/facets/process.js +59 -28
- package/dist/facets/real-vite-fs-shim.js +2 -2
- package/dist/facets/vite-dev-server.d.ts +25 -47
- package/dist/facets/vite-dev-server.d.ts.map +1 -1
- package/dist/facets/vite-dev-server.js +185 -219
- package/dist/facets/wasm-image-digest.d.ts +25 -0
- package/dist/facets/wasm-image-digest.d.ts.map +1 -0
- package/dist/facets/wasm-image-digest.js +25 -0
- package/dist/facets/wasm-swap-registry.d.ts +51 -92
- package/dist/facets/wasm-swap-registry.d.ts.map +1 -1
- package/dist/facets/wasm-swap-registry.js +68 -227
- package/dist/git/network-facet.d.ts.map +1 -1
- package/dist/git/network-facet.js +6 -5
- package/dist/loaders/child-process/spawn-pool.d.ts +3 -2
- package/dist/loaders/child-process/spawn-pool.d.ts.map +1 -1
- package/dist/loaders/child-process/spawn-pool.js +3 -2
- package/dist/loaders/generated-workers.d.ts +2 -2
- package/dist/loaders/generated-workers.d.ts.map +1 -1
- package/dist/loaders/generated-workers.js +3 -3
- package/dist/loaders/npm-resolve-preamble.d.ts +3 -6
- package/dist/loaders/npm-resolve-preamble.d.ts.map +1 -1
- package/dist/loaders/npm-resolve-preamble.js +34 -108
- package/dist/node-shims-artifact.generated.js +3 -3
- package/dist/npm/install-batch-facet.d.ts +3 -2
- package/dist/npm/install-batch-facet.d.ts.map +1 -1
- package/dist/npm/install-batch-facet.js +45 -15
- package/dist/npm/installer.d.ts +22 -17
- package/dist/npm/installer.d.ts.map +1 -1
- package/dist/npm/installer.js +209 -193
- package/dist/npm/pre-bundle-facet.d.ts +1 -1
- package/dist/npm/pre-bundle-facet.d.ts.map +1 -1
- package/dist/npm/pre-bundle-facet.js +1 -1
- package/dist/npm/resolve-facet.d.ts +6 -0
- package/dist/npm/resolve-facet.d.ts.map +1 -1
- package/dist/npm/resolve-one-facet.d.ts +21 -20
- package/dist/npm/resolve-one-facet.d.ts.map +1 -1
- package/dist/npm/resolve-one-facet.js +85 -84
- package/dist/npm/semver.d.ts +59 -0
- package/dist/npm/semver.d.ts.map +1 -0
- package/dist/npm/semver.js +226 -0
- package/dist/router/remote-api.js +31 -1
- package/dist/runtime/html-entrypoint.d.ts +7 -0
- package/dist/runtime/html-entrypoint.d.ts.map +1 -1
- package/dist/runtime/html-entrypoint.js +18 -2
- package/dist/runtime/node-runner.d.ts +3 -0
- package/dist/runtime/node-runner.d.ts.map +1 -1
- package/dist/runtime/node-runner.js +7 -0
- package/dist/runtime/node-shims.d.ts.map +1 -1
- package/dist/runtime/node-shims.js +305 -29
- package/dist/runtime/opencode-facet-runner.js +2 -2
- package/dist/session/helpers.d.ts +38 -0
- package/dist/session/helpers.d.ts.map +1 -1
- package/dist/session/helpers.js +76 -0
- package/dist/session/init-phases.d.ts +1 -1
- package/dist/session/init-phases.d.ts.map +1 -1
- package/dist/session/init-phases.js +2 -12
- package/dist/session/init.d.ts +15 -1
- package/dist/session/init.d.ts.map +1 -1
- package/dist/session/init.js +82 -603
- package/dist/session/nimbus-session.d.ts +56 -22
- package/dist/session/nimbus-session.d.ts.map +1 -1
- package/dist/session/nimbus-session.js +130 -101
- package/dist/session/npm-install-port.d.ts +16 -0
- package/dist/session/npm-install-port.d.ts.map +1 -0
- package/dist/session/npm-install-port.js +37 -0
- package/dist/session/port-capability.d.ts +44 -0
- package/dist/session/port-capability.d.ts.map +1 -1
- package/dist/session/port-capability.js +110 -0
- package/dist/session/programmatic.d.ts +31 -5
- package/dist/session/programmatic.d.ts.map +1 -1
- package/dist/session/programmatic.js +94 -68
- package/dist/session/routes.d.ts +30 -17
- package/dist/session/routes.d.ts.map +1 -1
- package/dist/session/routes.js +42 -131
- package/dist/session/rpc.d.ts +15 -15
- package/dist/session/rpc.d.ts.map +1 -1
- package/dist/session/rpc.js +97 -47
- package/dist/session/serving-port.d.ts +27 -0
- package/dist/session/serving-port.d.ts.map +1 -0
- package/dist/session/serving-port.js +27 -0
- package/dist/session/start-real-vite.d.ts +12 -0
- package/dist/session/start-real-vite.d.ts.map +1 -1
- package/dist/session/start-real-vite.js +4 -4
- package/dist/session/supervisor-op.d.ts +2 -2
- package/dist/session/supervisor-op.d.ts.map +1 -1
- package/dist/session/supervisor-op.js +13 -7
- package/dist/session/supervisor-rpc.d.ts +7 -7
- package/dist/session/supervisor-rpc.d.ts.map +1 -1
- package/dist/session/supervisor-rpc.js +4 -0
- package/dist/session/vite-command.d.ts +18 -0
- package/dist/session/vite-command.d.ts.map +1 -0
- package/dist/session/vite-command.js +609 -0
- package/dist/session/ws.d.ts +61 -0
- package/dist/session/ws.d.ts.map +1 -1
- package/dist/session/ws.js +122 -12
- package/dist/shell/npm-bin-entrypoints.d.ts +0 -35
- package/dist/shell/npm-bin-entrypoints.d.ts.map +1 -1
- package/dist/shell/npm-bin-entrypoints.js +12 -85
- package/package.json +24 -4
- package/public/_assets/runtime/{node-shims-9e1380d9ee430fcc.js → node-shims-8f8c64edd2a1f0f5.js} +305 -29
- package/public/index.html +1 -1
- package/scripts/bundle-facet-workers.mjs +1 -1
- package/scripts/bundle-npm-cjs.mjs +2 -2
- package/dist/facets/on-demand-bundle-gate.d.ts +0 -65
- package/dist/facets/on-demand-bundle-gate.d.ts.map +0 -1
- package/dist/facets/on-demand-bundle-gate.js +0 -125
- package/dist/npm/install-args.d.ts +0 -21
- package/dist/npm/install-args.d.ts.map +0 -1
- package/dist/npm/install-args.js +0 -70
- package/dist/npm/npm-log.d.ts +0 -31
- package/dist/npm/npm-log.d.ts.map +0 -1
- package/dist/npm/npm-log.js +0 -51
|
@@ -71,7 +71,7 @@ export type SliceEntry = SlicedFile | SlicedDir;
|
|
|
71
71
|
export interface PrebundleSpec {
|
|
72
72
|
/** Bare specifier being bundled, e.g. "framer-motion" or "react/jsx-runtime". */
|
|
73
73
|
specifier: string;
|
|
74
|
-
/** VFS path of the entry point, e.g. "/home/user/app/node_modules/framer-motion/dist/es/index.mjs". */
|
|
74
|
+
/** VFS path of the entry point, e.g. "/home/user/example-app/node_modules/framer-motion/dist/es/index.mjs". */
|
|
75
75
|
entryPath: string;
|
|
76
76
|
/** External specifiers (from getSharedRuntimeExternals). */
|
|
77
77
|
externals: string[];
|
|
@@ -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,EAA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B,GAAG,eAAe,CAAC"}
|
|
@@ -598,7 +598,7 @@ export const prebundleOne = async function prebundleOne(spec, _env) {
|
|
|
598
598
|
// NOTE: do NOT pass `external: spec.externals` here at the top level.
|
|
599
599
|
// esbuild's top-level external matches by file PATH too — when bundling
|
|
600
600
|
// a subpath like 'react/jsx-runtime', the resolved entry path
|
|
601
|
-
// /home/user/app/node_modules/react/jsx-runtime.js matches the 'react'
|
|
601
|
+
// /home/user/example-app/node_modules/react/jsx-runtime.js matches the 'react'
|
|
602
602
|
// external and esbuild errors with
|
|
603
603
|
// "The entry point '...' cannot be marked as external"
|
|
604
604
|
//
|
|
@@ -42,6 +42,12 @@ export type FacetRegistryEvent = {
|
|
|
42
42
|
reason: string;
|
|
43
43
|
suggest?: string;
|
|
44
44
|
ctx: 'transitive';
|
|
45
|
+
} | {
|
|
46
|
+
type: 'advisory';
|
|
47
|
+
from: string;
|
|
48
|
+
reason: string;
|
|
49
|
+
suggest?: string;
|
|
50
|
+
ctx: 'transitive';
|
|
45
51
|
} | {
|
|
46
52
|
type: 'transitive-skip';
|
|
47
53
|
from: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-facet.d.ts","sourceRoot":"","sources":["../../src/npm/resolve-facet.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,WAAW,gBAAgB;IAC/B;iEAC6D;IAC7D,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,yDAAyD;IACzD,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,gEAAgE;IAChE,YAAY,CAAC,EAAE,MAAM,CAAC;IACt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AAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,YAAY,CAAA;CAAE,GAGrF;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,YAAY,CAAA;CAAE,GACvF;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
|
@@ -19,9 +19,7 @@
|
|
|
19
19
|
* - All helpers (semver, exports, skip-list, registry decisions) are
|
|
20
20
|
* accessed via bare identifiers from the preamble:
|
|
21
21
|
*
|
|
22
|
-
* SHOULD_SKIP_PACKAGE(name, frameworkAware) → boolean
|
|
23
22
|
* SHOULD_SWAP(name) → { from, to } | null
|
|
24
|
-
* SHOULD_WARN_SKIP_TRANSITIVE(name) → { from, reason } | null
|
|
25
23
|
* SHOULD_REJECT_FAIL(name) → { from, reason, suggest? } | null
|
|
26
24
|
* NATIVE_EXECUTABLE_REJECT(pkg) → { from, reason, suggest? } | null
|
|
27
25
|
* PARSE_SEMVER(v) → [maj, min, patch] | null
|
|
@@ -38,24 +36,21 @@
|
|
|
38
36
|
* bestEffortNames set; the task returns the `pkg` raw and the
|
|
39
37
|
* supervisor decides whether a downstream reject silent-skips or
|
|
40
38
|
* propagates.
|
|
41
|
-
* - Top-level handling: the supervisor maintains topLevelNames.
|
|
42
|
-
* `topLevel` is passed in per task so SKIP_PACKAGES bypass works.
|
|
43
39
|
*
|
|
44
40
|
* What the task DOES do
|
|
45
41
|
* ─────────────────────
|
|
46
|
-
* 1. Apply
|
|
47
|
-
* 2.
|
|
48
|
-
* 3. Try in-task cache from `cachedHit` (one entry shipped from
|
|
42
|
+
* 1. Apply swap / reject-fail registry policy.
|
|
43
|
+
* 2. Try in-task cache from `cachedHit` (one entry shipped from
|
|
49
44
|
* supervisor's NpmCache).
|
|
50
|
-
*
|
|
45
|
+
* 3. Ask env.SUPERVISOR.getPackument for the packument. Fetching the
|
|
51
46
|
* registry and filling the cross-tenant cache are supervisor-side;
|
|
52
47
|
* the facet only reads.
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
48
|
+
* 4. Pick version via preamble's RESOLVE_VERSION.
|
|
49
|
+
* 5. Materialise ResolvedPackage shape (versionToResolved-style).
|
|
50
|
+
* 6. Stage cache writes for this version + top-5 recent versions.
|
|
56
51
|
* Returns them in `cacheWrites` so the supervisor can flush in one
|
|
57
52
|
* batched RPC.
|
|
58
|
-
*
|
|
53
|
+
* 7. Return {pkg, deps, peerDeps, optionalDeps, allPeerDependencies,
|
|
59
54
|
* cacheWrites, messages, events, packumentBytesDecoded,
|
|
60
55
|
* packumentSource, error?}.
|
|
61
56
|
*/
|
|
@@ -78,17 +73,9 @@ export interface ResolveOneSpec {
|
|
|
78
73
|
* the best version that satisfies range.
|
|
79
74
|
*/
|
|
80
75
|
cachedEntries: FacetCachedEntry[];
|
|
81
|
-
/**
|
|
82
|
-
* X.5-F R1: when true, this package was either user-typed OR a
|
|
83
|
-
* required peer-dep enqueued by the supervisor. Bypasses
|
|
84
|
-
* SKIP_PACKAGES. The supervisor decides the flag at enqueue time.
|
|
85
|
-
*/
|
|
86
|
-
topLevel: boolean;
|
|
87
76
|
/** X.5-G G1: this spec came from an optionalDependencies edge, so
|
|
88
77
|
* platform-native bindings silent-skip rather than failing the parent. */
|
|
89
78
|
isOptional: boolean;
|
|
90
|
-
/** W11 framework-aware skip. */
|
|
91
|
-
frameworkAware: boolean;
|
|
92
79
|
/** Per-fetch timeout (ms). Default 15_000. */
|
|
93
80
|
fetchTimeoutMs: number;
|
|
94
81
|
/** Retries for transient failures. Default 3. */
|
|
@@ -178,6 +165,20 @@ export interface ResolveOneResult {
|
|
|
178
165
|
reason: string;
|
|
179
166
|
};
|
|
180
167
|
}
|
|
168
|
+
/**
|
|
169
|
+
* Parse an npm spec into install-name / registry-name / range. `npm:`
|
|
170
|
+
* aliases redirect the registry lookup to a different package while the
|
|
171
|
+
* dep records the alias as the install name; everything else is the
|
|
172
|
+
* identity. Shared with the installer's lockfile check (which reads the
|
|
173
|
+
* inner range out of an alias spec) and re-declared in the loader
|
|
174
|
+
* preamble so the facet's serialized body sees the same implementation.
|
|
175
|
+
*/
|
|
176
|
+
export declare function parseRegistryRequest(name: string, range: string): {
|
|
177
|
+
installName: string;
|
|
178
|
+
registryName: string;
|
|
179
|
+
range: string;
|
|
180
|
+
alias: boolean;
|
|
181
|
+
};
|
|
181
182
|
/**
|
|
182
183
|
* Per-package fanout task body. Serialised via fn.toString() and
|
|
183
184
|
* dispatched by Fanout.submitMany — see installer.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-one-facet.d.ts","sourceRoot":"","sources":["../../src/npm/resolve-one-facet.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"resolve-one-facet.d.ts","sourceRoot":"","sources":["../../src/npm/resolve-one-facet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AA4B/E;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,aAAa,EAAE,gBAAgB,EAAE,CAAC;IAClC;+EAC2E;IAC3E,UAAU,EAAE,OAAO,CAAC;IACpB,8CAA8C;IAC9C,cAAc,EAAE,MAAM,CAAC;IACv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AAA;KAAE,GACrE;QAAE,IAAI,EAAE,YAAY,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5C;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;;;;;EAsB/D;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,0BAA0B,GACrC,MAAM,cAAc,EACpB,KAAK;IACH,UAAU,EAAE;QACV;;;;WAIG;QACH,YAAY,EAAE,CACZ,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,SAAS,EAAE,MAAM,CAAA;SAAE,KAC5C,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,CAqW1B,CAAC"}
|
|
@@ -19,9 +19,7 @@
|
|
|
19
19
|
* - All helpers (semver, exports, skip-list, registry decisions) are
|
|
20
20
|
* accessed via bare identifiers from the preamble:
|
|
21
21
|
*
|
|
22
|
-
* SHOULD_SKIP_PACKAGE(name, frameworkAware) → boolean
|
|
23
22
|
* SHOULD_SWAP(name) → { from, to } | null
|
|
24
|
-
* SHOULD_WARN_SKIP_TRANSITIVE(name) → { from, reason } | null
|
|
25
23
|
* SHOULD_REJECT_FAIL(name) → { from, reason, suggest? } | null
|
|
26
24
|
* NATIVE_EXECUTABLE_REJECT(pkg) → { from, reason, suggest? } | null
|
|
27
25
|
* PARSE_SEMVER(v) → [maj, min, patch] | null
|
|
@@ -38,27 +36,58 @@
|
|
|
38
36
|
* bestEffortNames set; the task returns the `pkg` raw and the
|
|
39
37
|
* supervisor decides whether a downstream reject silent-skips or
|
|
40
38
|
* propagates.
|
|
41
|
-
* - Top-level handling: the supervisor maintains topLevelNames.
|
|
42
|
-
* `topLevel` is passed in per task so SKIP_PACKAGES bypass works.
|
|
43
39
|
*
|
|
44
40
|
* What the task DOES do
|
|
45
41
|
* ─────────────────────
|
|
46
|
-
* 1. Apply
|
|
47
|
-
* 2.
|
|
48
|
-
* 3. Try in-task cache from `cachedHit` (one entry shipped from
|
|
42
|
+
* 1. Apply swap / reject-fail registry policy.
|
|
43
|
+
* 2. Try in-task cache from `cachedHit` (one entry shipped from
|
|
49
44
|
* supervisor's NpmCache).
|
|
50
|
-
*
|
|
45
|
+
* 3. Ask env.SUPERVISOR.getPackument for the packument. Fetching the
|
|
51
46
|
* registry and filling the cross-tenant cache are supervisor-side;
|
|
52
47
|
* the facet only reads.
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
48
|
+
* 4. Pick version via preamble's RESOLVE_VERSION.
|
|
49
|
+
* 5. Materialise ResolvedPackage shape (versionToResolved-style).
|
|
50
|
+
* 6. Stage cache writes for this version + top-5 recent versions.
|
|
56
51
|
* Returns them in `cacheWrites` so the supervisor can flush in one
|
|
57
52
|
* batched RPC.
|
|
58
|
-
*
|
|
53
|
+
* 7. Return {pkg, deps, peerDeps, optionalDeps, allPeerDependencies,
|
|
59
54
|
* cacheWrites, messages, events, packumentBytesDecoded,
|
|
60
55
|
* packumentSource, error?}.
|
|
61
56
|
*/
|
|
57
|
+
/**
|
|
58
|
+
* Parse an npm spec into install-name / registry-name / range. `npm:`
|
|
59
|
+
* aliases redirect the registry lookup to a different package while the
|
|
60
|
+
* dep records the alias as the install name; everything else is the
|
|
61
|
+
* identity. Shared with the installer's lockfile check (which reads the
|
|
62
|
+
* inner range out of an alias spec) and re-declared in the loader
|
|
63
|
+
* preamble so the facet's serialized body sees the same implementation.
|
|
64
|
+
*/
|
|
65
|
+
export function parseRegistryRequest(name, range) {
|
|
66
|
+
const text = String(range || 'latest');
|
|
67
|
+
if (!text.startsWith('npm:')) {
|
|
68
|
+
return { installName: name, registryName: name, range: text, alias: false };
|
|
69
|
+
}
|
|
70
|
+
const target = text.slice(4);
|
|
71
|
+
const findSeparator = (specText) => {
|
|
72
|
+
if (!specText)
|
|
73
|
+
return -1;
|
|
74
|
+
if (specText[0] !== '@')
|
|
75
|
+
return specText.indexOf('@');
|
|
76
|
+
const slash = specText.indexOf('/');
|
|
77
|
+
if (slash < 0)
|
|
78
|
+
return -1;
|
|
79
|
+
return specText.indexOf('@', slash + 1);
|
|
80
|
+
};
|
|
81
|
+
const splitAt = findSeparator(target);
|
|
82
|
+
const registryName = splitAt >= 0 ? target.slice(0, splitAt) : target;
|
|
83
|
+
const targetRange = splitAt >= 0 ? target.slice(splitAt + 1) : 'latest';
|
|
84
|
+
return {
|
|
85
|
+
installName: name,
|
|
86
|
+
registryName: registryName || name,
|
|
87
|
+
range: targetRange || 'latest',
|
|
88
|
+
alias: true,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
62
91
|
/**
|
|
63
92
|
* Per-package fanout task body. Serialised via fn.toString() and
|
|
64
93
|
* dispatched by Fanout.submitMany — see installer.ts
|
|
@@ -75,32 +104,6 @@ export const resolveOnePackumentInFacet = async function resolveOnePackumentInFa
|
|
|
75
104
|
const messages = [];
|
|
76
105
|
const events = [];
|
|
77
106
|
const cacheWrites = [];
|
|
78
|
-
const parseRegistryRequest = (name, range) => {
|
|
79
|
-
const text = String(range || 'latest');
|
|
80
|
-
if (!text.startsWith('npm:')) {
|
|
81
|
-
return { installName: name, registryName: name, range: text, alias: false };
|
|
82
|
-
}
|
|
83
|
-
const target = text.slice(4);
|
|
84
|
-
const findSeparator = (specText) => {
|
|
85
|
-
if (!specText)
|
|
86
|
-
return -1;
|
|
87
|
-
if (specText[0] !== '@')
|
|
88
|
-
return specText.indexOf('@');
|
|
89
|
-
const slash = specText.indexOf('/');
|
|
90
|
-
if (slash < 0)
|
|
91
|
-
return -1;
|
|
92
|
-
return specText.indexOf('@', slash + 1);
|
|
93
|
-
};
|
|
94
|
-
const splitAt = findSeparator(target);
|
|
95
|
-
const registryName = splitAt >= 0 ? target.slice(0, splitAt) : target;
|
|
96
|
-
const targetRange = splitAt >= 0 ? target.slice(splitAt + 1) : 'latest';
|
|
97
|
-
return {
|
|
98
|
-
installName: name,
|
|
99
|
-
registryName: registryName || name,
|
|
100
|
-
range: targetRange || 'latest',
|
|
101
|
-
alias: true,
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
107
|
const request = parseRegistryRequest(spec.name, spec.range);
|
|
105
108
|
// cache-obs-2: per-resolve cache events. Filled by the L2/L3 path
|
|
106
109
|
// (spliced from supervisor RPC return.events) and the L4 path
|
|
@@ -122,6 +125,19 @@ export const resolveOnePackumentInFacet = async function resolveOnePackumentInFa
|
|
|
122
125
|
cacheStatEvents,
|
|
123
126
|
error,
|
|
124
127
|
});
|
|
128
|
+
// npm parity: a table reject or a native-executable bin is a package
|
|
129
|
+
// with no Workers-compatible build — real npm still installs it. The
|
|
130
|
+
// advisory event tells the installer to print one `note:` line per
|
|
131
|
+
// name and the resolution continues like any package.
|
|
132
|
+
const emitAdvisory = (entry) => {
|
|
133
|
+
events.push({
|
|
134
|
+
type: 'advisory',
|
|
135
|
+
from: entry.from,
|
|
136
|
+
reason: entry.reason,
|
|
137
|
+
suggest: entry.suggest,
|
|
138
|
+
ctx: 'transitive',
|
|
139
|
+
});
|
|
140
|
+
};
|
|
125
141
|
const outNativeExecutableReject = (pkg, bytes, source) => {
|
|
126
142
|
const reject = NATIVE_EXECUTABLE_REJECT(pkg);
|
|
127
143
|
if (!reject)
|
|
@@ -135,26 +151,30 @@ export const resolveOnePackumentInFacet = async function resolveOnePackumentInFa
|
|
|
135
151
|
});
|
|
136
152
|
return out(null, bytes, 'skipped');
|
|
137
153
|
}
|
|
154
|
+
// Only an os/cpu/libc allowlist fails the install (EBADPLATFORM
|
|
155
|
+
// parity); a native-executable bin is advisory — the package's JS
|
|
156
|
+
// tree installs and the reason is reported as an advisory.
|
|
157
|
+
// @ts-ignore — preamble.
|
|
158
|
+
const platformReject = NATIVE_PLATFORM_REJECT(pkg);
|
|
159
|
+
if (!platformReject) {
|
|
160
|
+
emitAdvisory(reject);
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
138
163
|
events.push({
|
|
139
164
|
type: 'reject',
|
|
140
|
-
from:
|
|
141
|
-
reason:
|
|
142
|
-
suggest:
|
|
165
|
+
from: platformReject.from,
|
|
166
|
+
reason: platformReject.reason,
|
|
167
|
+
suggest: platformReject.suggest,
|
|
143
168
|
ctx: 'transitive',
|
|
144
169
|
});
|
|
145
170
|
return out(null, bytes, source, {
|
|
146
171
|
type: 'w6-reject',
|
|
147
|
-
from:
|
|
148
|
-
reason:
|
|
149
|
-
suggest:
|
|
172
|
+
from: platformReject.from,
|
|
173
|
+
reason: platformReject.reason,
|
|
174
|
+
suggest: platformReject.suggest,
|
|
150
175
|
});
|
|
151
176
|
};
|
|
152
|
-
// 1.
|
|
153
|
-
// @ts-ignore — preamble.
|
|
154
|
-
if (!spec.topLevel && SHOULD_SKIP_PACKAGE(spec.name, !!spec.frameworkAware)) {
|
|
155
|
-
return out(null, 0, 'skipped');
|
|
156
|
-
}
|
|
157
|
-
// 2. Registry policy.
|
|
177
|
+
// 1. Registry policy.
|
|
158
178
|
let effName = request.registryName;
|
|
159
179
|
// @ts-ignore — preamble.
|
|
160
180
|
const __swap = SHOULD_SWAP(spec.name);
|
|
@@ -164,48 +184,29 @@ export const resolveOnePackumentInFacet = async function resolveOnePackumentInFa
|
|
|
164
184
|
effName = __swap.to;
|
|
165
185
|
}
|
|
166
186
|
else {
|
|
167
|
-
// @ts-ignore — preamble.
|
|
168
|
-
const __warn = SHOULD_WARN_SKIP_TRANSITIVE(spec.name);
|
|
169
|
-
if (__warn) {
|
|
170
|
-
messages.push(`[npm] \x1b[33m[skip]\x1b[0m ${__warn.from} — ${__warn.reason}`);
|
|
171
|
-
events.push({ type: 'transitive-skip', from: __warn.from, reason: __warn.reason });
|
|
172
|
-
return out(null, 0, 'skipped');
|
|
173
|
-
}
|
|
174
187
|
// @ts-ignore — preamble.
|
|
175
188
|
const __fail = SHOULD_REJECT_FAIL(spec.name);
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
reason: __fail.reason,
|
|
181
|
-
suggest: __fail.suggest,
|
|
182
|
-
ctx: 'transitive',
|
|
183
|
-
});
|
|
184
|
-
return out(null, 0, 'skipped', {
|
|
185
|
-
type: 'w6-reject',
|
|
186
|
-
from: __fail.from,
|
|
187
|
-
reason: __fail.reason,
|
|
188
|
-
suggest: __fail.suggest,
|
|
189
|
-
});
|
|
190
|
-
}
|
|
189
|
+
// A listed package resolves and installs — npm parity; the
|
|
190
|
+
// advisory names the reason it cannot run here.
|
|
191
|
+
if (__fail)
|
|
192
|
+
emitAdvisory(__fail);
|
|
191
193
|
}
|
|
192
|
-
//
|
|
194
|
+
// 2. cachedHit fast-path. The pick over the cached versions is the same
|
|
195
|
+
// RESOLVE_VERSION the packument path uses — a range is never reduced
|
|
196
|
+
// to its base version. It used to be: `^3.0.0` was stripped to `3.0.0`
|
|
197
|
+
// and answered by a cached 3.0.0 even with 3.0.1 sitting beside it,
|
|
198
|
+
// which is how the second install in a session came back with lower
|
|
199
|
+
// versions than the first (measured: totalist, readdirp, mrmime,
|
|
200
|
+
// milliparsec, dot-prop, eta on json-server@1.0.0-beta.15).
|
|
193
201
|
const cached = (() => {
|
|
194
202
|
const entries = spec.cachedEntries || [];
|
|
195
203
|
if (entries.length === 0)
|
|
196
204
|
return null;
|
|
197
|
-
const cleanRange = (request.range || '').replace(/^[~^>=<\s]+/, '');
|
|
198
|
-
if (/^\d+\.\d+\.\d+$/.test(cleanRange)) {
|
|
199
|
-
const exact = entries.find((e) => e.name === request.installName && e.version === cleanRange);
|
|
200
|
-
if (exact)
|
|
201
|
-
return exact;
|
|
202
|
-
}
|
|
203
205
|
const candidates = entries.filter((e) => e.name === request.installName);
|
|
204
206
|
if (candidates.length === 0)
|
|
205
207
|
return null;
|
|
206
|
-
const versions = candidates.map((e) => e.version);
|
|
207
208
|
// @ts-ignore — preamble.
|
|
208
|
-
const picked = RESOLVE_VERSION(
|
|
209
|
+
const picked = RESOLVE_VERSION(candidates.map((e) => e.version), request.range);
|
|
209
210
|
if (!picked)
|
|
210
211
|
return null;
|
|
211
212
|
return candidates.find((e) => e.version === picked) || null;
|
|
@@ -343,7 +344,7 @@ export const resolveOnePackumentInFacet = async function resolveOnePackumentInFa
|
|
|
343
344
|
reason: `packument for ${effName} carries no versions`,
|
|
344
345
|
});
|
|
345
346
|
}
|
|
346
|
-
//
|
|
347
|
+
// 3. Pick version.
|
|
347
348
|
let version = null;
|
|
348
349
|
if (request.range && data.versions[request.range])
|
|
349
350
|
version = request.range;
|
|
@@ -362,7 +363,7 @@ export const resolveOnePackumentInFacet = async function resolveOnePackumentInFa
|
|
|
362
363
|
reason: `no published version of ${effName} satisfies ${request.range}`,
|
|
363
364
|
});
|
|
364
365
|
}
|
|
365
|
-
//
|
|
366
|
+
// 4. Materialise ResolvedPackage.
|
|
366
367
|
const vData = data.versions[version];
|
|
367
368
|
const versionToResolved = (v) => {
|
|
368
369
|
const packageName = request.installName || v.name;
|
|
@@ -424,7 +425,7 @@ export const resolveOnePackumentInFacet = async function resolveOnePackumentInFa
|
|
|
424
425
|
const nativeReject = outNativeExecutableReject(pkg, bytes, packumentSource);
|
|
425
426
|
if (nativeReject)
|
|
426
427
|
return nativeReject;
|
|
427
|
-
//
|
|
428
|
+
// 5. Stage cache writes.
|
|
428
429
|
cacheWrites.push({
|
|
429
430
|
name: pkg.name,
|
|
430
431
|
version: pkg.version,
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* npm/semver.ts — the one semver implementation the npm resolver picks
|
|
3
|
+
* versions with.
|
|
4
|
+
*
|
|
5
|
+
* The resolver facet (npm/resolve-one-facet.ts) runs inside a dynamic worker
|
|
6
|
+
* whose only module scope is the preamble string in
|
|
7
|
+
* loaders/npm-resolve-preamble.ts. That preamble embeds THESE functions by
|
|
8
|
+
* `fn.toString()`, so the facet's version pick is this module's by
|
|
9
|
+
* construction — there is no second copy to drift, and
|
|
10
|
+
* tests/unit/npm-semver.mjs asserts the embedded functions answer exactly
|
|
11
|
+
* as the exported ones do.
|
|
12
|
+
*
|
|
13
|
+
* Every function here is self-contained on purpose: no closures over module
|
|
14
|
+
* constants, no imports, only calls to the other functions in this file by
|
|
15
|
+
* name. `toString()` reproduces exactly that, and nothing else.
|
|
16
|
+
*
|
|
17
|
+
* What is implemented is the subset of node-semver that npm dependency
|
|
18
|
+
* ranges use: exact versions, `^`, `~`, comparators, hyphen ranges, `||`,
|
|
19
|
+
* X-ranges (`1`, `1.2`, `1.x`, `*`), and — the part the previous helper
|
|
20
|
+
* lacked — prerelease identifiers. Ignoring them meant every `1.0.0-*`
|
|
21
|
+
* compared equal, so `json-server@1.0.0-beta.15` resolved to whichever
|
|
22
|
+
* `1.0.0-*` the packument listed first (`1.0.0-alpha.1`) and
|
|
23
|
+
* `^1.0.0-next.24` picked `1.0.0-next.0`. Measured against the live registry
|
|
24
|
+
* lists before this rewrite.
|
|
25
|
+
*/
|
|
26
|
+
/** `[major, minor, patch, prerelease]` — prerelease is `[]` for a release. */
|
|
27
|
+
export type ParsedSemver = [number, number, number, Array<string | number>];
|
|
28
|
+
/** Parse `v1.2.3-beta.4+build` → `[1, 2, 3, ['beta', 4]]`; null for a non-version. */
|
|
29
|
+
export declare function parseSemver(v: string): ParsedSemver | null;
|
|
30
|
+
/**
|
|
31
|
+
* Total order. A release sorts above every prerelease of the same triple;
|
|
32
|
+
* prerelease identifiers compare left to right, numeric before alphanumeric,
|
|
33
|
+
* numeric by value, alphanumeric lexically, and a longer list sorts above
|
|
34
|
+
* its prefix (semver.org §11).
|
|
35
|
+
*/
|
|
36
|
+
export declare function compareSemver(a: ParsedSemver, b: ParsedSemver): number;
|
|
37
|
+
/**
|
|
38
|
+
* One comparator set (the space-separated part of a range) as
|
|
39
|
+
* `>=lower <upper` bounds. Every range shape npm uses normalises to at
|
|
40
|
+
* most two bounds, so a set is a list of `[op, version]` pairs.
|
|
41
|
+
*/
|
|
42
|
+
export declare function semverComparators(part: string): Array<[string, ParsedSemver]> | null;
|
|
43
|
+
/**
|
|
44
|
+
* node-semver's prerelease rule: a prerelease version satisfies a comparator
|
|
45
|
+
* set only when some comparator in that set names a prerelease of the same
|
|
46
|
+
* `major.minor.patch`. `^1.0.0-next.24` admits `1.0.0-next.29` and `1.0.0`,
|
|
47
|
+
* never `1.1.0-rc.1`; `^1.0.0` admits no prerelease at all.
|
|
48
|
+
*/
|
|
49
|
+
export declare function satisfiesRange(version: string, range: string): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Whether `range` is semver-shaped at all — `''`, `*`, `latest`, tags,
|
|
52
|
+
* comparators, hyphen ranges, `||` groups. False for git:, github:,
|
|
53
|
+
* URL, file:, and other non-registry specifiers, where a version pin's
|
|
54
|
+
* presence is all a lockfile can answer.
|
|
55
|
+
*/
|
|
56
|
+
export declare function isSemverRange(range: string): boolean;
|
|
57
|
+
/** The highest version satisfying `range`, or null; `latest`/`*` are the caller's dist-tag lookup. */
|
|
58
|
+
export declare function resolveVersion(versions: readonly string[], range: string): string | null;
|
|
59
|
+
//# sourceMappingURL=semver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semver.d.ts","sourceRoot":"","sources":["../../src/npm/semver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,8EAA8E;AAC9E,MAAM,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC;AAE5E,sFAAsF;AACtF,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAQ1D;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,GAAG,MAAM,CAoBtE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,GAAG,IAAI,CA4CpF;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAqCtE;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAgBpD;AAED,sGAAsG;AACtG,wBAAgB,cAAc,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAWxF"}
|