@nimbus-sh/worker 0.6.0 → 0.8.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 +677 -342
- 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/real-vite-hmr.d.ts +3 -1
- package/dist/facets/real-vite-hmr.d.ts.map +1 -1
- package/dist/facets/real-vite-hmr.js +18 -8
- 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/facets/ws-terminal.d.ts +9 -31
- package/dist/facets/ws-terminal.d.ts.map +1 -1
- package/dist/facets/ws-terminal.js +58 -51
- package/dist/git/network-facet.d.ts.map +1 -1
- package/dist/git/network-facet.js +6 -5
- package/dist/hosted/commands.d.ts +12 -0
- package/dist/hosted/commands.d.ts.map +1 -0
- package/dist/hosted/commands.js +1658 -0
- package/dist/hosted/runtime.d.ts +114 -0
- package/dist/hosted/runtime.d.ts.map +1 -0
- package/dist/hosted/runtime.js +288 -0
- package/dist/hosted/services.d.ts +40 -0
- package/dist/hosted/services.d.ts.map +1 -0
- package/dist/hosted/services.js +512 -0
- 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/bash-repl.d.ts +1 -1
- package/dist/runtime/bash-repl.d.ts.map +1 -1
- package/dist/runtime/bash-repl.js +38 -4
- package/dist/runtime/bun-runner.js +1 -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 +4 -1
- package/dist/runtime/node-runner.d.ts.map +1 -1
- package/dist/runtime/node-runner.js +9 -2
- 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 +16 -16
- package/dist/runtime/package-manager.d.ts +35 -122
- package/dist/runtime/package-manager.d.ts.map +1 -1
- package/dist/runtime/package-manager.js +61 -596
- package/dist/runtime/process-logs-api.d.ts +1 -1
- package/dist/runtime/process-logs-api.d.ts.map +1 -1
- package/dist/runtime/process-logs-api.js +1 -1
- package/dist/runtime/python-repl.d.ts +2 -1
- package/dist/runtime/python-repl.d.ts.map +1 -1
- package/dist/runtime/python-repl.js +82 -59
- package/dist/runtime/repl-session.d.ts +9 -47
- package/dist/runtime/repl-session.d.ts.map +1 -1
- package/dist/runtime/repl-session.js +105 -105
- package/dist/runtime/runtime-catalog.d.ts +13 -0
- package/dist/runtime/runtime-catalog.d.ts.map +1 -1
- package/dist/runtime/runtime-catalog.js +88 -0
- package/dist/session/agent.d.ts +1 -21
- package/dist/session/agent.d.ts.map +1 -1
- package/dist/session/ai.d.ts +5 -1
- package/dist/session/ai.d.ts.map +1 -1
- package/dist/session/ai.js +7 -0
- 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/hibernation.d.ts +2 -1
- package/dist/session/hibernation.d.ts.map +1 -1
- package/dist/session/hibernation.js +7 -4
- 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 -36
- package/dist/session/init.d.ts.map +1 -1
- package/dist/session/init.js +50 -2327
- package/dist/session/loopback.d.ts +2 -29
- package/dist/session/loopback.d.ts.map +1 -1
- package/dist/session/loopback.js +3 -27
- package/dist/session/nimbus-session.d.ts +77 -34
- package/dist/session/nimbus-session.d.ts.map +1 -1
- package/dist/session/nimbus-session.js +126 -514
- package/dist/session/npm-install-port.d.ts +18 -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 +36 -43
- package/dist/session/programmatic.d.ts.map +1 -1
- package/dist/session/programmatic.js +109 -115
- 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 +98 -49
- 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 +4 -4
- package/dist/session/supervisor-op.d.ts.map +1 -1
- package/dist/session/supervisor-op.js +24 -10
- 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/dist/workspace-host.d.ts +6 -0
- package/dist/workspace-host.d.ts.map +1 -0
- package/dist/workspace-host.js +5 -0
- package/dist/workspace.d.ts +2 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +1 -0
- package/package.json +34 -9
- 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
|
@@ -11,12 +11,11 @@
|
|
|
11
11
|
* `npm:` aliases. They live in `rejects` with a
|
|
12
12
|
* code-change suggestion.
|
|
13
13
|
*
|
|
14
|
-
* - rejects: deny list with helpful messages.
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* `shouldSkipPackage` UX for build-only).
|
|
14
|
+
* - rejects: deny list with helpful messages. Every entry is
|
|
15
|
+
* `transitive: 'fail'` — hard-fail at any depth (top +
|
|
16
|
+
* transitive). The 'warn' classification is retired:
|
|
17
|
+
* plain-JS tooling installs, and native shards are caught
|
|
18
|
+
* by the optional-native-binding classifier instead.
|
|
20
19
|
*
|
|
21
20
|
* IMPORTANT: `PACKAGE_ABI_POLICY` is the single source of truth for the
|
|
22
21
|
* whole npm policy — supervisor AND facets. Generated dynamic-Worker
|
|
@@ -44,8 +43,6 @@ export declare const STAGED_ARTIFACT_BIN_PREFIX = "nimbus-staged:";
|
|
|
44
43
|
* one JSON-serializable object.
|
|
45
44
|
*/
|
|
46
45
|
export declare const PACKAGE_ABI_POLICY: PackageAbiPolicy;
|
|
47
|
-
/** Check if a package is build-only (skipped at transitive depth). */
|
|
48
|
-
export declare function policyShouldSkipPackage(policy: PackageAbiPolicy, name: string, frameworkAware: boolean): boolean;
|
|
49
46
|
export declare function policyLookupSwap(policy: PackageAbiPolicy, name: string): PackageSwapEntry | undefined;
|
|
50
47
|
export declare function policyLookupReject(policy: PackageAbiPolicy, name: string): PackageRejectEntry | undefined;
|
|
51
48
|
export declare function policyLookupStagedArtifact(policy: PackageAbiPolicy, name: string): PackageStagedArtifactEntry | undefined;
|
|
@@ -73,14 +70,6 @@ export declare function applyStagedArtifact(pkg: {
|
|
|
73
70
|
bin?: Record<string, string>;
|
|
74
71
|
optionalDependencies?: Record<string, string>;
|
|
75
72
|
}, entry: PackageStagedArtifactEntry): void;
|
|
76
|
-
/** Check if a package should be skipped (build-only, types). */
|
|
77
|
-
export declare function shouldSkipPackage(name: string): boolean;
|
|
78
|
-
/**
|
|
79
|
-
* W11: framework-aware skip variant. When `frameworkAware` is true,
|
|
80
|
-
* packages in `frameworkRequiredPackages` (currently just `vite`) pass
|
|
81
|
-
* through so framework dev binaries can import them from node_modules.
|
|
82
|
-
*/
|
|
83
|
-
export declare function shouldSkipPackageWithFramework(name: string, frameworkAware: boolean): boolean;
|
|
84
73
|
/**
|
|
85
74
|
* Pure: return a new specs map with every swap `from` key rewritten
|
|
86
75
|
* to its swap target. Records the swaps actually performed.
|
|
@@ -96,66 +85,25 @@ export declare function applySwaps(specs: Record<string, string>): {
|
|
|
96
85
|
swaps: PackageSwapEntry[];
|
|
97
86
|
};
|
|
98
87
|
/**
|
|
99
|
-
* Return rejects whose policy applies at this depth.
|
|
100
|
-
*
|
|
101
|
-
* ctx='transitive' → only `transitive: 'fail'` rejects (the 'warn'
|
|
102
|
-
* policy is handled by the caller as a `[skip]`
|
|
103
|
-
* log + continue).
|
|
88
|
+
* Return rejects whose policy applies at this depth. Only 'fail'
|
|
89
|
+
* entries exist, so 'top' and 'transitive' are the same set.
|
|
104
90
|
*/
|
|
105
91
|
export declare function findRejects(specs: Record<string, string>, ctx: 'top' | 'transitive'): PackageRejectEntry[];
|
|
106
|
-
/**
|
|
107
|
-
* Lookup that the resolver uses at depth>0 to decide between throw and
|
|
108
|
-
* `[skip]`+continue. Returns the entry only when its policy is 'warn'
|
|
109
|
-
* (i.e., this is a transitive-skip case). 'fail' entries return undefined
|
|
110
|
-
* here; the caller handles those via findRejects/throw.
|
|
111
|
-
*/
|
|
112
|
-
export declare function shouldWarnSkipTransitive(name: string): PackageRejectEntry | undefined;
|
|
113
92
|
/**
|
|
114
93
|
* Single-line yellow notice emitted to onProgress when a swap fires.
|
|
115
94
|
* `[npm] [swap] esbuild → esbuild-wasm (Native esbuild not available …)`
|
|
116
95
|
*/
|
|
117
96
|
export declare function formatSwapNotice(s: PackageSwapEntry): string;
|
|
118
97
|
/**
|
|
119
|
-
*
|
|
120
|
-
* Includes a leading summary line and a `try:` suggestion per package
|
|
121
|
-
* (when present).
|
|
122
|
-
*
|
|
123
|
-
* `devOnly` names the rejects that only a devDependency asked for. Refusing a
|
|
124
|
-
* bundled 150 MB browser is right — a sandbox cannot run it, and fetching it
|
|
125
|
-
* to fail later is the same dishonesty as answering `uname -m` with a value
|
|
126
|
-
* whose binaries cannot execute. But when nothing the project RUNS wanted the
|
|
127
|
-
* package, refusing without naming the flag that skips it leaves the caller
|
|
128
|
-
* stuck at a wall that has a door in it.
|
|
129
|
-
*/
|
|
130
|
-
export declare function formatRejectError(rejects: ReadonlyArray<PackageRejectEntry>, devOnly?: ReadonlySet<string>): string;
|
|
131
|
-
/**
|
|
132
|
-
* Single-line yellow notice emitted for a transitive `[skip]`.
|
|
98
|
+
* Single-line yellow notice emitted for a `[skip]`.
|
|
133
99
|
* `[npm] [skip] fsevents — macOS-only filesystem watcher; never runs in Workers`
|
|
134
|
-
*/
|
|
135
|
-
export declare function formatTransitiveSkip(r: PackageRejectEntry): string;
|
|
136
|
-
/**
|
|
137
|
-
* Tag class for registry-driven rejects. Both the supervisor-side path
|
|
138
|
-
* (npm-installer.ts and npm-resolver.ts) and the
|
|
139
|
-
* facet-side path (resolve-one-facet.ts:resolveOnePackumentInFacet) throw
|
|
140
|
-
* errors tagged for this case.
|
|
141
100
|
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
* The own-property survives worker boundary serialization.
|
|
101
|
+
* When the entry carries an actionable suggestion it is appended inline
|
|
102
|
+
* (`… try: <hint>`) — the same line shape for optional-shard skips and
|
|
103
|
+
* required-package skips, so one grep explains every package the install
|
|
104
|
+
* left out.
|
|
148
105
|
*/
|
|
149
|
-
export declare
|
|
150
|
-
readonly rejects: ReadonlyArray<PackageRejectEntry>;
|
|
151
|
-
readonly __nimbus_registry_reject: true;
|
|
152
|
-
constructor(rejects: ReadonlyArray<PackageRejectEntry>, devOnly?: ReadonlySet<string>);
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Robust check that survives the supervisor↔facet boundary: prototypes
|
|
156
|
-
* are lost across that boundary, so we tag via an own-property.
|
|
157
|
-
*/
|
|
158
|
-
export declare function isRegistryReject(e: unknown): boolean;
|
|
106
|
+
export declare function formatTransitiveSkip(r: PackageRejectEntry): string;
|
|
159
107
|
/**
|
|
160
108
|
* The discriminated-union event emitted by the supervisor whenever the
|
|
161
109
|
* registry takes a decision.
|
|
@@ -167,8 +115,9 @@ export declare function isRegistryReject(e: unknown): boolean;
|
|
|
167
115
|
* actionable `suggest`). At `ctx='top'` an error is
|
|
168
116
|
* thrown; at `ctx='transitive'` the throw happens
|
|
169
117
|
* when the entry's policy is `'fail'`.
|
|
170
|
-
* - `transitive-skip` — `from`
|
|
171
|
-
*
|
|
118
|
+
* - `transitive-skip` — `from` was dropped silently from the resolved
|
|
119
|
+
* tree at depth>0 (policy refusal, optional peer
|
|
120
|
+
* in REJECT_INSTALL, or optional native binding).
|
|
172
121
|
*/
|
|
173
122
|
export type RegistryEvent = {
|
|
174
123
|
type: 'swap';
|
|
@@ -181,6 +130,12 @@ export type RegistryEvent = {
|
|
|
181
130
|
reason: string;
|
|
182
131
|
suggest?: string;
|
|
183
132
|
ctx: 'top' | 'transitive';
|
|
133
|
+
} | {
|
|
134
|
+
type: 'advisory';
|
|
135
|
+
from: string;
|
|
136
|
+
reason: string;
|
|
137
|
+
suggest?: string;
|
|
138
|
+
ctx: 'top' | 'transitive';
|
|
184
139
|
} | {
|
|
185
140
|
type: 'transitive-skip';
|
|
186
141
|
from: string;
|
|
@@ -256,19 +211,19 @@ export interface PackageBinManifest {
|
|
|
256
211
|
*/
|
|
257
212
|
export declare function policyIsOptionalNativeBinding(policy: PackageAbiPolicy, p: MinimalPackument): boolean;
|
|
258
213
|
/**
|
|
259
|
-
* Classify a
|
|
260
|
-
*
|
|
261
|
-
* a native platform binary. Detection is metadata-driven:
|
|
214
|
+
* Classify a package's published artifacts against the Nimbus ABI policy.
|
|
215
|
+
* Two halves, two install outcomes:
|
|
262
216
|
*
|
|
263
|
-
* - any bin target with a native executable
|
|
264
|
-
* (
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
* platform
|
|
270
|
-
*
|
|
271
|
-
*
|
|
217
|
+
* - policyNativeBinAdvisory — any bin target with a native executable
|
|
218
|
+
* extension (.exe, .node N-API binaries, …). Real npm installs
|
|
219
|
+
* these: the artifact only fails when invoked, so install keeps the
|
|
220
|
+
* package and reports an advisory naming the reason.
|
|
221
|
+
* - policyNativePlatformReject — package.json `os` / `cpu` / `libc`
|
|
222
|
+
* allowlists. A positive allowlist means the package opts out of
|
|
223
|
+
* cross-platform installs (npm rejects mismatches with
|
|
224
|
+
* EBADPLATFORM); no allowlisted platform is executable in Nimbus.
|
|
225
|
+
* Pure negations (`!win32`) do NOT classify as native — they exclude
|
|
226
|
+
* platforms without requiring one.
|
|
272
227
|
*
|
|
273
228
|
* Diagnostics always name the package, the artifact class found
|
|
274
229
|
* (policy.nativeArtifactClass), and the artifact kinds Nimbus accepts
|
|
@@ -276,6 +231,23 @@ export declare function policyIsOptionalNativeBinding(policy: PackageAbiPolicy,
|
|
|
276
231
|
*
|
|
277
232
|
* Serialized into facet preambles — self-contained by contract.
|
|
278
233
|
*/
|
|
234
|
+
export declare function policyNativeBinAdvisory(policy: PackageAbiPolicy, pkg: PackageBinManifest): PackageRejectEntry | undefined;
|
|
235
|
+
/**
|
|
236
|
+
* The install-time refusal half: package.json `os` / `cpu` / `libc`
|
|
237
|
+
* allowlists. A positive allowlist means the package opts out of
|
|
238
|
+
* cross-platform installs — npm rejects mismatches with EBADPLATFORM,
|
|
239
|
+
* and no allowlisted platform is executable in Nimbus. Pure negations
|
|
240
|
+
* (`!win32`) do NOT classify as native — they exclude platforms without
|
|
241
|
+
* requiring one.
|
|
242
|
+
*
|
|
243
|
+
* Serialized into facet preambles — self-contained by contract.
|
|
244
|
+
*/
|
|
245
|
+
export declare function policyNativePlatformReject(policy: PackageAbiPolicy, pkg: PackageBinManifest): PackageRejectEntry | undefined;
|
|
246
|
+
/**
|
|
247
|
+
* Union of the two halves above — kept for the optional-native-binding
|
|
248
|
+
* skip classifier, which treats either native shape as skippable from
|
|
249
|
+
* an optional edge.
|
|
250
|
+
*/
|
|
279
251
|
export declare function policyNativeArtifactReject(policy: PackageAbiPolicy, pkg: PackageBinManifest): PackageRejectEntry | undefined;
|
|
280
252
|
export declare function isOptionalNativeBinding(p: MinimalPackument): boolean;
|
|
281
253
|
export declare function nativeExecutableReject(pkg: PackageBinManifest): PackageRejectEntry | undefined;
|
|
@@ -307,17 +279,4 @@ export declare function selectAutoInstallPeers(pkg: {
|
|
|
307
279
|
}, opts?: {
|
|
308
280
|
requiredOnly?: boolean;
|
|
309
281
|
}): string[];
|
|
310
|
-
/**
|
|
311
|
-
* Classification of an install-time error so the supervisor can decide
|
|
312
|
-
* whether to swallow (recoverable) or propagate (real fail).
|
|
313
|
-
*
|
|
314
|
-
* - 'optional-dep-skip' — the failed package was an entry in
|
|
315
|
-
* `optionalDependencies`; skip silently.
|
|
316
|
-
* - 'registry-reject' — RegistryRejectError.
|
|
317
|
-
* - 'real-resolve-fail' — anything else; propagate.
|
|
318
|
-
*/
|
|
319
|
-
export type InstallErrorClass = 'optional-dep-skip' | 'registry-reject' | 'real-resolve-fail';
|
|
320
|
-
export declare function classifyInstallError(e: unknown, ctx?: {
|
|
321
|
-
isOptional?: boolean;
|
|
322
|
-
}): InstallErrorClass;
|
|
323
282
|
//# sourceMappingURL=wasm-swap-registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wasm-swap-registry.d.ts","sourceRoot":"","sources":["../../src/facets/wasm-swap-registry.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"wasm-swap-registry.d.ts","sourceRoot":"","sources":["../../src/facets/wasm-swap-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,0BAA0B,EAC/B,KAAK,gBAAgB,EACtB,MAAM,yCAAyC,CAAC;AAsBjD;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,mBAAmB,CAAC;AAgO3D;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,EAAE,gBAwChC,CAAC;AAQF,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,MAAM,GACX,gBAAgB,GAAG,SAAS,CAE9B;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,MAAM,GACX,kBAAkB,GAAG,SAAS,CAEhC;AAED,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,MAAM,GACX,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sB,CACpC,GAAG,EAAE;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CAC/D,EACD,IAAI,GAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAO,GACpC,MAAM,EAAE,CASV"}
|
|
@@ -11,12 +11,11 @@
|
|
|
11
11
|
* `npm:` aliases. They live in `rejects` with a
|
|
12
12
|
* code-change suggestion.
|
|
13
13
|
*
|
|
14
|
-
* - rejects: deny list with helpful messages.
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* `shouldSkipPackage` UX for build-only).
|
|
14
|
+
* - rejects: deny list with helpful messages. Every entry is
|
|
15
|
+
* `transitive: 'fail'` — hard-fail at any depth (top +
|
|
16
|
+
* transitive). The 'warn' classification is retired:
|
|
17
|
+
* plain-JS tooling installs, and native shards are caught
|
|
18
|
+
* by the optional-native-binding classifier instead.
|
|
20
19
|
*
|
|
21
20
|
* IMPORTANT: `PACKAGE_ABI_POLICY` is the single source of truth for the
|
|
22
21
|
* whole npm policy — supervisor AND facets. Generated dynamic-Worker
|
|
@@ -46,23 +45,6 @@ const SWAPS = [
|
|
|
46
45
|
reason: 'Native esbuild not available in Workers; esbuild-wasm exposes the same build/transform/version/initialize API.',
|
|
47
46
|
compat: 'drop-in',
|
|
48
47
|
},
|
|
49
|
-
// X.5-G G2: rollup ships native platform shards as
|
|
50
|
-
// `optionalDependencies` (26 of them). On any host where the matching
|
|
51
|
-
// shard isn't present, rollup's own `native.js` throws the famous
|
|
52
|
-
// 'npm has a bug related to optional dependencies (#4828)'. Even
|
|
53
|
-
// when the matching shard IS installed, the .node binary cannot
|
|
54
|
-
// load in workerd. @rollup/wasm-node is the upstream-published
|
|
55
|
-
// pure-WASM build with byte-identical exports (verified via registry
|
|
56
|
-
// packument compare 2026-05-05; both ship `dist/rollup.js` with the
|
|
57
|
-
// same `exports` map). Drop-in swap.
|
|
58
|
-
{
|
|
59
|
-
from: 'rollup',
|
|
60
|
-
to: '@rollup/wasm-node',
|
|
61
|
-
reason: 'Native rollup uses optionalDependencies for 26 platform shards (npm CLI bug #4828) ' +
|
|
62
|
-
'and ships .node binaries that workerd cannot load. @rollup/wasm-node is the upstream ' +
|
|
63
|
-
'pure-WASM build with identical exports.',
|
|
64
|
-
compat: 'drop-in',
|
|
65
|
-
},
|
|
66
48
|
];
|
|
67
49
|
/**
|
|
68
50
|
* Sentinel bin target the installer writes for a staged-artifact package.
|
|
@@ -114,26 +96,6 @@ const REJECTS = [
|
|
|
114
96
|
suggest: 'tweetnacl (pure JS, untested by Nimbus) or libsodium-wrappers (WASM, untested by Nimbus).',
|
|
115
97
|
transitive: 'fail',
|
|
116
98
|
},
|
|
117
|
-
{
|
|
118
|
-
from: 'fsevents',
|
|
119
|
-
reason: 'macOS-only filesystem watcher; never runs in Workers.',
|
|
120
|
-
suggest: 'optional dep — chokidar/watchpack work without it (untested by Nimbus). ' +
|
|
121
|
-
'Move to optionalDependencies in your package.json.',
|
|
122
|
-
transitive: 'warn',
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
from: 'bufferutil',
|
|
126
|
-
reason: 'Native binding for ws speedups; install requires node-gyp.',
|
|
127
|
-
suggest: 'optional dep — ws works without it (slower frames; untested by Nimbus). ' +
|
|
128
|
-
'Move to optionalDependencies.',
|
|
129
|
-
transitive: 'warn',
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
from: 'utf-8-validate',
|
|
133
|
-
reason: 'Native binding for ws speedups; install requires node-gyp.',
|
|
134
|
-
suggest: 'optional dep — ws works without it (untested by Nimbus). Same as bufferutil.',
|
|
135
|
-
transitive: 'warn',
|
|
136
|
-
},
|
|
137
99
|
{
|
|
138
100
|
from: 'node-pty',
|
|
139
101
|
reason: 'PTY syscalls unavailable in workerd.',
|
|
@@ -197,19 +159,14 @@ const REJECTS = [
|
|
|
197
159
|
suggest: '@prisma/adapter-d1 (untested by Nimbus), or drizzle-orm + @libsql/client (untested).',
|
|
198
160
|
transitive: 'fail',
|
|
199
161
|
},
|
|
200
|
-
// ──
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
from: 'node-pre-gyp',
|
|
209
|
-
reason: 'Build-time native compiler; never runs in Workers.',
|
|
210
|
-
suggest: 'no Workers-compatible target — remove from dependencies.',
|
|
211
|
-
transitive: 'warn',
|
|
212
|
-
},
|
|
162
|
+
// ── Toolchains that carry their own native runtime ───────────────────
|
|
163
|
+
// (wrangler, @cloudflare/vite-plugin, parcel, node-gyp, node-pre-gyp
|
|
164
|
+
// were once 'warn' entries here. They are plain JS packages — the
|
|
165
|
+
// native shards they pull are refused by the optional-native-binding
|
|
166
|
+
// classifier — so they install like any other package. Only 'fail'
|
|
167
|
+
// entries exist in this table; the `transitive` union on the public
|
|
168
|
+
// PackageAbiPolicy type is frozen, so the field stays in the entry
|
|
169
|
+
// shape.)
|
|
213
170
|
// ── Bundled-binary giants ──────────────────────────────────────────
|
|
214
171
|
{
|
|
215
172
|
from: 'puppeteer',
|
|
@@ -277,46 +234,6 @@ const REJECTS = [
|
|
|
277
234
|
transitive: 'fail',
|
|
278
235
|
},
|
|
279
236
|
];
|
|
280
|
-
// W6: `esbuild` and `fsevents` were removed from the skip list so the
|
|
281
|
-
// swap/reject policy can own them. `esbuild` is in `swaps`
|
|
282
|
-
// (→ esbuild-wasm); `fsevents` is in `rejects` (transitive='warn').
|
|
283
|
-
// node-gyp / node-pre-gyp remain here for transitive silence (they
|
|
284
|
-
// also appear in `rejects` with transitive='warn' so a top-level
|
|
285
|
-
// `npm install node-gyp` reaches the registry first and emits a clear
|
|
286
|
-
// rejection).
|
|
287
|
-
//
|
|
288
|
-
// W11: `vite` was previously unconditionally skipped because the
|
|
289
|
-
// supervisor bundles real-vite. But Astro/Nuxt/Remix/SvelteKit `import`
|
|
290
|
-
// from the user's installed `vite` to call createServer() — so when a
|
|
291
|
-
// framework is detected, `vite` must actually land in node_modules
|
|
292
|
-
// (`frameworkRequiredPackages`).
|
|
293
|
-
//
|
|
294
|
-
// X.5-G: `rollup` removed from the skip list because it's in `swaps`
|
|
295
|
-
// (rollup → @rollup/wasm-node). Skipping would mask the swap at
|
|
296
|
-
// transitive depth.
|
|
297
|
-
const SKIP_PACKAGES = [
|
|
298
|
-
// Build tools (X.5-G: rollup migrated to swaps)
|
|
299
|
-
'typescript', 'vite', 'webpack', 'parcel',
|
|
300
|
-
'postcss', 'autoprefixer', 'tailwindcss', 'cssnano',
|
|
301
|
-
'prettier', 'eslint', 'stylelint',
|
|
302
|
-
// Native modules / build-time (chokidar = real-vite intercepts;
|
|
303
|
-
// node-gyp/pre-gyp = build-time only, never run in Workers)
|
|
304
|
-
'chokidar', 'node-gyp', 'node-pre-gyp',
|
|
305
|
-
// Cloudflare dev tools
|
|
306
|
-
'@cloudflare/vite-plugin', '@cloudflare/workers-types', 'wrangler',
|
|
307
|
-
// Other build-only
|
|
308
|
-
'husky', 'lint-staged', 'commitlint',
|
|
309
|
-
];
|
|
310
|
-
const SKIP_PREFIXES = [
|
|
311
|
-
'@types/',
|
|
312
|
-
'@eslint/',
|
|
313
|
-
'@typescript-eslint/',
|
|
314
|
-
'eslint-plugin-',
|
|
315
|
-
'eslint-config-',
|
|
316
|
-
// Note: '@vitejs/' used to be skipped because the Cirrus shim
|
|
317
|
-
// ignored plugins anyway. With real-vite mode those plugins are
|
|
318
|
-
// required — keep them installable.
|
|
319
|
-
];
|
|
320
237
|
/**
|
|
321
238
|
* The single typed package-ABI policy (see `PackageAbiPolicy` in
|
|
322
239
|
* runtime/os-contracts.ts). Everything the npm resolver/installer needs
|
|
@@ -338,9 +255,14 @@ export const PACKAGE_ABI_POLICY = {
|
|
|
338
255
|
swaps: SWAPS,
|
|
339
256
|
stagedArtifacts: STAGED_ARTIFACTS,
|
|
340
257
|
rejects: REJECTS,
|
|
341
|
-
skipPackages:
|
|
342
|
-
skipPrefixes:
|
|
343
|
-
frameworkRequiredPackages: [
|
|
258
|
+
skipPackages: [],
|
|
259
|
+
skipPrefixes: [],
|
|
260
|
+
frameworkRequiredPackages: [],
|
|
261
|
+
// The transitive-skip gate these fields fed was removed with the
|
|
262
|
+
// required-reachability work: every package a project declares is
|
|
263
|
+
// resolved, and refusal is the reject list's job. The fields stay —
|
|
264
|
+
// empty — because `PackageAbiPolicy` is a public `@nimbus-sh/core`
|
|
265
|
+
// type and the preamble's serialized policy must keep its shape.
|
|
344
266
|
// Known native-shard name globs. Matched as `prefix-` (so the parent
|
|
345
267
|
// package name without a platform suffix never matches).
|
|
346
268
|
nativeShardPrefixes: [
|
|
@@ -363,18 +285,6 @@ export const PACKAGE_ABI_POLICY = {
|
|
|
363
285
|
// Policy functions — SERIALIZED into facet preambles via fn.toString().
|
|
364
286
|
// Self-contained by contract: parameters and JS globals only.
|
|
365
287
|
// ─────────────────────────────────────────────────────────────────────────
|
|
366
|
-
/** Check if a package is build-only (skipped at transitive depth). */
|
|
367
|
-
export function policyShouldSkipPackage(policy, name, frameworkAware) {
|
|
368
|
-
if (frameworkAware && policy.frameworkRequiredPackages.includes(name))
|
|
369
|
-
return false;
|
|
370
|
-
if (policy.skipPackages.includes(name))
|
|
371
|
-
return true;
|
|
372
|
-
for (const prefix of policy.skipPrefixes) {
|
|
373
|
-
if (name.startsWith(prefix))
|
|
374
|
-
return true;
|
|
375
|
-
}
|
|
376
|
-
return false;
|
|
377
|
-
}
|
|
378
288
|
export function policyLookupSwap(policy, name) {
|
|
379
289
|
return policy.swaps.find((entry) => entry.from === name);
|
|
380
290
|
}
|
|
@@ -419,18 +329,6 @@ export function lookupStagedArtifact(name) {
|
|
|
419
329
|
export function applyStagedArtifact(pkg, entry) {
|
|
420
330
|
policyApplyStagedArtifact(pkg, entry, STAGED_ARTIFACT_BIN_PREFIX);
|
|
421
331
|
}
|
|
422
|
-
/** Check if a package should be skipped (build-only, types). */
|
|
423
|
-
export function shouldSkipPackage(name) {
|
|
424
|
-
return policyShouldSkipPackage(PACKAGE_ABI_POLICY, name, false);
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* W11: framework-aware skip variant. When `frameworkAware` is true,
|
|
428
|
-
* packages in `frameworkRequiredPackages` (currently just `vite`) pass
|
|
429
|
-
* through so framework dev binaries can import them from node_modules.
|
|
430
|
-
*/
|
|
431
|
-
export function shouldSkipPackageWithFramework(name, frameworkAware) {
|
|
432
|
-
return policyShouldSkipPackage(PACKAGE_ABI_POLICY, name, frameworkAware);
|
|
433
|
-
}
|
|
434
332
|
/**
|
|
435
333
|
* Pure: return a new specs map with every swap `from` key rewritten
|
|
436
334
|
* to its swap target. Records the swaps actually performed.
|
|
@@ -457,11 +355,8 @@ export function applySwaps(specs) {
|
|
|
457
355
|
return { specs: out, swaps };
|
|
458
356
|
}
|
|
459
357
|
/**
|
|
460
|
-
* Return rejects whose policy applies at this depth.
|
|
461
|
-
*
|
|
462
|
-
* ctx='transitive' → only `transitive: 'fail'` rejects (the 'warn'
|
|
463
|
-
* policy is handled by the caller as a `[skip]`
|
|
464
|
-
* log + continue).
|
|
358
|
+
* Return rejects whose policy applies at this depth. Only 'fail'
|
|
359
|
+
* entries exist, so 'top' and 'transitive' are the same set.
|
|
465
360
|
*/
|
|
466
361
|
export function findRejects(specs, ctx) {
|
|
467
362
|
const out = [];
|
|
@@ -475,22 +370,9 @@ export function findRejects(specs, ctx) {
|
|
|
475
370
|
}
|
|
476
371
|
return out;
|
|
477
372
|
}
|
|
478
|
-
/**
|
|
479
|
-
* Lookup that the resolver uses at depth>0 to decide between throw and
|
|
480
|
-
* `[skip]`+continue. Returns the entry only when its policy is 'warn'
|
|
481
|
-
* (i.e., this is a transitive-skip case). 'fail' entries return undefined
|
|
482
|
-
* here; the caller handles those via findRejects/throw.
|
|
483
|
-
*/
|
|
484
|
-
export function shouldWarnSkipTransitive(name) {
|
|
485
|
-
const r = lookupReject(name);
|
|
486
|
-
if (r && r.transitive === 'warn')
|
|
487
|
-
return r;
|
|
488
|
-
return undefined;
|
|
489
|
-
}
|
|
490
373
|
// ─────────────────────────────────────────────────────────────────────────
|
|
491
374
|
// Formatters
|
|
492
375
|
// ─────────────────────────────────────────────────────────────────────────
|
|
493
|
-
const ANSI_RED = '\x1b[31m';
|
|
494
376
|
const ANSI_YELLOW = '\x1b[33m';
|
|
495
377
|
const ANSI_DIM = '\x1b[2m';
|
|
496
378
|
const ANSI_RESET = '\x1b[0m';
|
|
@@ -502,75 +384,19 @@ export function formatSwapNotice(s) {
|
|
|
502
384
|
return `[npm] ${ANSI_YELLOW}[swap]${ANSI_RESET} ${s.from} → ${s.to} (${s.reason})`;
|
|
503
385
|
}
|
|
504
386
|
/**
|
|
505
|
-
*
|
|
506
|
-
* Includes a leading summary line and a `try:` suggestion per package
|
|
507
|
-
* (when present).
|
|
508
|
-
*
|
|
509
|
-
* `devOnly` names the rejects that only a devDependency asked for. Refusing a
|
|
510
|
-
* bundled 150 MB browser is right — a sandbox cannot run it, and fetching it
|
|
511
|
-
* to fail later is the same dishonesty as answering `uname -m` with a value
|
|
512
|
-
* whose binaries cannot execute. But when nothing the project RUNS wanted the
|
|
513
|
-
* package, refusing without naming the flag that skips it leaves the caller
|
|
514
|
-
* stuck at a wall that has a door in it.
|
|
515
|
-
*/
|
|
516
|
-
export function formatRejectError(rejects, devOnly = new Set()) {
|
|
517
|
-
if (rejects.length === 0)
|
|
518
|
-
return '';
|
|
519
|
-
const head = `${ANSI_RED}npm install rejected:${ANSI_RESET} ${rejects.length} package${rejects.length === 1 ? '' : 's'} not supported on Nimbus.`;
|
|
520
|
-
const lines = rejects.map((r) => {
|
|
521
|
-
const dev = devOnly.has(r.from) ? ' (devDependency)' : '';
|
|
522
|
-
const main = ` ❌ ${r.from}${dev} — ${r.reason}`;
|
|
523
|
-
if (r.suggest) {
|
|
524
|
-
return `${main}\n ${ANSI_DIM}try:${ANSI_RESET} ${r.suggest}`;
|
|
525
|
-
}
|
|
526
|
-
return main;
|
|
527
|
-
});
|
|
528
|
-
const allDev = rejects.every((r) => devOnly.has(r.from));
|
|
529
|
-
const footer = allDev
|
|
530
|
-
? [` ${ANSI_DIM}Nothing this project runs depends on ${rejects.length === 1 ? 'it' : 'them'}:`
|
|
531
|
-
+ ` \`npm install --omit=dev\` installs the rest.${ANSI_RESET}`]
|
|
532
|
-
: [];
|
|
533
|
-
return [head, ...lines, ...footer].join('\n');
|
|
534
|
-
}
|
|
535
|
-
/**
|
|
536
|
-
* Single-line yellow notice emitted for a transitive `[skip]`.
|
|
387
|
+
* Single-line yellow notice emitted for a `[skip]`.
|
|
537
388
|
* `[npm] [skip] fsevents — macOS-only filesystem watcher; never runs in Workers`
|
|
538
|
-
*/
|
|
539
|
-
export function formatTransitiveSkip(r) {
|
|
540
|
-
return `[npm] ${ANSI_YELLOW}[skip]${ANSI_RESET} ${r.from} — ${r.reason}`;
|
|
541
|
-
}
|
|
542
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
543
|
-
// Error class — used to mark registry-driven rejects across the
|
|
544
|
-
// supervisor/facet boundary
|
|
545
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
546
|
-
/**
|
|
547
|
-
* Tag class for registry-driven rejects. Both the supervisor-side path
|
|
548
|
-
* (npm-installer.ts and npm-resolver.ts) and the
|
|
549
|
-
* facet-side path (resolve-one-facet.ts:resolveOnePackumentInFacet) throw
|
|
550
|
-
* errors tagged for this case.
|
|
551
|
-
*
|
|
552
|
-
* Supervisor-side: throw `new RegistryRejectError(rejects)` directly.
|
|
553
|
-
* Facet-side: cannot import this class (preamble has no import surface),
|
|
554
|
-
* so the facet throws `new Error(...)` with `err.__nimbus_registry_reject = true`.
|
|
555
|
-
* Both are detected via `isRegistryReject()`.
|
|
556
389
|
*
|
|
557
|
-
*
|
|
390
|
+
* When the entry carries an actionable suggestion it is appended inline
|
|
391
|
+
* (`… try: <hint>`) — the same line shape for optional-shard skips and
|
|
392
|
+
* required-package skips, so one grep explains every package the install
|
|
393
|
+
* left out.
|
|
558
394
|
*/
|
|
559
|
-
export
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
this.name = 'RegistryRejectError';
|
|
565
|
-
this.rejects = rejects;
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
/**
|
|
569
|
-
* Robust check that survives the supervisor↔facet boundary: prototypes
|
|
570
|
-
* are lost across that boundary, so we tag via an own-property.
|
|
571
|
-
*/
|
|
572
|
-
export function isRegistryReject(e) {
|
|
573
|
-
return !!(e && typeof e === 'object' && e.__nimbus_registry_reject === true);
|
|
395
|
+
export function formatTransitiveSkip(r) {
|
|
396
|
+
const base = `[npm] ${ANSI_YELLOW}[skip]${ANSI_RESET} ${r.from} — ${r.reason}`;
|
|
397
|
+
if (r.suggest)
|
|
398
|
+
return `${base} ${ANSI_DIM}… try:${ANSI_RESET} ${r.suggest}`;
|
|
399
|
+
return base;
|
|
574
400
|
}
|
|
575
401
|
let _sink = null;
|
|
576
402
|
let _sinkThrowCount = 0;
|
|
@@ -655,19 +481,19 @@ export function policyIsOptionalNativeBinding(policy, p) {
|
|
|
655
481
|
return false;
|
|
656
482
|
}
|
|
657
483
|
/**
|
|
658
|
-
* Classify a
|
|
659
|
-
*
|
|
660
|
-
* a native platform binary. Detection is metadata-driven:
|
|
484
|
+
* Classify a package's published artifacts against the Nimbus ABI policy.
|
|
485
|
+
* Two halves, two install outcomes:
|
|
661
486
|
*
|
|
662
|
-
* - any bin target with a native executable
|
|
663
|
-
* (
|
|
664
|
-
*
|
|
665
|
-
*
|
|
666
|
-
*
|
|
667
|
-
*
|
|
668
|
-
* platform
|
|
669
|
-
*
|
|
670
|
-
*
|
|
487
|
+
* - policyNativeBinAdvisory — any bin target with a native executable
|
|
488
|
+
* extension (.exe, .node N-API binaries, …). Real npm installs
|
|
489
|
+
* these: the artifact only fails when invoked, so install keeps the
|
|
490
|
+
* package and reports an advisory naming the reason.
|
|
491
|
+
* - policyNativePlatformReject — package.json `os` / `cpu` / `libc`
|
|
492
|
+
* allowlists. A positive allowlist means the package opts out of
|
|
493
|
+
* cross-platform installs (npm rejects mismatches with
|
|
494
|
+
* EBADPLATFORM); no allowlisted platform is executable in Nimbus.
|
|
495
|
+
* Pure negations (`!win32`) do NOT classify as native — they exclude
|
|
496
|
+
* platforms without requiring one.
|
|
671
497
|
*
|
|
672
498
|
* Diagnostics always name the package, the artifact class found
|
|
673
499
|
* (policy.nativeArtifactClass), and the artifact kinds Nimbus accepts
|
|
@@ -675,7 +501,7 @@ export function policyIsOptionalNativeBinding(policy, p) {
|
|
|
675
501
|
*
|
|
676
502
|
* Serialized into facet preambles — self-contained by contract.
|
|
677
503
|
*/
|
|
678
|
-
export function
|
|
504
|
+
export function policyNativeBinAdvisory(policy, pkg) {
|
|
679
505
|
const fileExtension = (path) => {
|
|
680
506
|
const text = String(path || '');
|
|
681
507
|
const query = text.indexOf('?');
|
|
@@ -701,6 +527,19 @@ export function policyNativeArtifactReject(policy, pkg) {
|
|
|
701
527
|
};
|
|
702
528
|
}
|
|
703
529
|
}
|
|
530
|
+
return undefined;
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* The install-time refusal half: package.json `os` / `cpu` / `libc`
|
|
534
|
+
* allowlists. A positive allowlist means the package opts out of
|
|
535
|
+
* cross-platform installs — npm rejects mismatches with EBADPLATFORM,
|
|
536
|
+
* and no allowlisted platform is executable in Nimbus. Pure negations
|
|
537
|
+
* (`!win32`) do NOT classify as native — they exclude platforms without
|
|
538
|
+
* requiring one.
|
|
539
|
+
*
|
|
540
|
+
* Serialized into facet preambles — self-contained by contract.
|
|
541
|
+
*/
|
|
542
|
+
export function policyNativePlatformReject(policy, pkg) {
|
|
704
543
|
const allowlisted = (values) => Array.isArray(values)
|
|
705
544
|
? values.filter((v) => typeof v === 'string' && v.length > 0 && !v.startsWith('!'))
|
|
706
545
|
: [];
|
|
@@ -724,6 +563,15 @@ export function policyNativeArtifactReject(policy, pkg) {
|
|
|
724
563
|
}
|
|
725
564
|
return undefined;
|
|
726
565
|
}
|
|
566
|
+
/**
|
|
567
|
+
* Union of the two halves above — kept for the optional-native-binding
|
|
568
|
+
* skip classifier, which treats either native shape as skippable from
|
|
569
|
+
* an optional edge.
|
|
570
|
+
*/
|
|
571
|
+
export function policyNativeArtifactReject(policy, pkg) {
|
|
572
|
+
return (policyNativeBinAdvisory(policy, pkg) ??
|
|
573
|
+
policyNativePlatformReject(policy, pkg));
|
|
574
|
+
}
|
|
727
575
|
// Supervisor wrappers over the serializable policy functions.
|
|
728
576
|
export function isOptionalNativeBinding(p) {
|
|
729
577
|
return policyIsOptionalNativeBinding(PACKAGE_ABI_POLICY, p);
|
|
@@ -762,13 +610,6 @@ export function selectAutoInstallPeers(pkg, opts = {}) {
|
|
|
762
610
|
}
|
|
763
611
|
return out;
|
|
764
612
|
}
|
|
765
|
-
export function classifyInstallError(e, ctx = {}) {
|
|
766
|
-
if (isRegistryReject(e))
|
|
767
|
-
return 'registry-reject';
|
|
768
|
-
if (ctx.isOptional)
|
|
769
|
-
return 'optional-dep-skip';
|
|
770
|
-
return 'real-resolve-fail';
|
|
771
|
-
}
|
|
772
613
|
// ─────────────────────────────────────────────────────────────────────────
|
|
773
614
|
// Module-load assertion: swap and reject `from` names are disjoint
|
|
774
615
|
// ─────────────────────────────────────────────────────────────────────────
|