@gjsify/cli 0.35.0 → 0.37.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/dist/cli.gjs.mjs +136 -126
- package/lib/actions/build.d.ts +19 -0
- package/lib/actions/build.js +2 -2
- package/lib/bundler-pick.js +72 -98
- package/lib/cli-fail.d.ts +4 -7
- package/lib/cli-fail.js +29 -55
- package/lib/commands/affected.js +161 -286
- package/lib/commands/install.d.ts +63 -66
- package/lib/commands/install.js +372 -536
- package/lib/commands/run.d.ts +1 -0
- package/lib/commands/run.js +37 -0
- package/lib/templates/install.mjs.tmpl +38 -68
- package/lib/types/cli-build-options.d.ts +33 -67
- package/lib/types/command.d.ts +9 -12
- package/lib/types/config-data.d.ts +125 -221
- package/lib/utils/auth-npmrc.d.ts +5 -10
- package/lib/utils/auth-npmrc.js +11 -21
- package/lib/utils/check-system-deps.d.ts +16 -0
- package/lib/utils/check-system-deps.js +49 -0
- package/lib/utils/clear-targets.d.ts +8 -11
- package/lib/utils/clear-targets.js +22 -29
- package/lib/utils/copy-targets.d.ts +13 -19
- package/lib/utils/copy-targets.js +31 -44
- package/lib/utils/dep-aggregation.d.ts +7 -15
- package/lib/utils/dep-aggregation.js +9 -22
- package/lib/utils/detect-native-packages.d.ts +83 -116
- package/lib/utils/detect-native-packages.js +111 -149
- package/lib/utils/dir-link.d.ts +29 -48
- package/lib/utils/dir-link.js +33 -56
- package/lib/utils/discover-showcases.d.ts +6 -7
- package/lib/utils/discover-showcases.js +11 -15
- package/lib/utils/dlx-cache.d.ts +29 -38
- package/lib/utils/dlx-cache.js +53 -63
- package/lib/utils/force-exit.d.ts +0 -3
- package/lib/utils/force-exit.js +13 -24
- package/lib/utils/gi-search-path.d.ts +16 -24
- package/lib/utils/gi-search-path.js +54 -82
- package/lib/utils/gjs-bundle-guard.d.ts +5 -13
- package/lib/utils/gjs-bundle-guard.js +35 -57
- package/lib/utils/gjs-source-escape.d.ts +2 -2
- package/lib/utils/gjs-source-escape.js +21 -39
- package/lib/utils/gjsify-shim.d.ts +26 -8
- package/lib/utils/gjsify-shim.js +128 -80
- package/lib/utils/html-entry.d.ts +8 -12
- package/lib/utils/html-entry.js +19 -28
- package/lib/utils/install-backend-native.d.ts +123 -161
- package/lib/utils/install-backend-native.js +536 -737
- package/lib/utils/install-backend.d.ts +42 -57
- package/lib/utils/install-backend.js +16 -21
- package/lib/utils/install-cache-fs.d.ts +10 -15
- package/lib/utils/install-cache-fs.js +18 -26
- package/lib/utils/install-lock.d.ts +5 -6
- package/lib/utils/install-lock.js +46 -65
- package/lib/utils/install-packument-cache.d.ts +27 -33
- package/lib/utils/install-packument-cache.js +44 -57
- package/lib/utils/install-progress.d.ts +2 -9
- package/lib/utils/install-progress.js +14 -39
- package/lib/utils/install-tarball-cache.d.ts +14 -20
- package/lib/utils/install-tarball-cache.js +41 -59
- package/lib/utils/library-output.d.ts +9 -22
- package/lib/utils/library-output.js +19 -37
- package/lib/utils/load-npmrc.d.ts +5 -6
- package/lib/utils/load-npmrc.js +18 -27
- package/lib/utils/node-bundle-guard.d.ts +4 -8
- package/lib/utils/node-bundle-guard.js +21 -35
- package/lib/utils/node-script.d.ts +12 -0
- package/lib/utils/node-script.js +95 -0
- package/lib/utils/node-version.d.ts +5 -14
- package/lib/utils/node-version.js +15 -24
- package/lib/utils/normalize-bundler-options.d.ts +7 -11
- package/lib/utils/normalize-bundler-options.js +24 -42
- package/lib/utils/npm-oidc.d.ts +23 -37
- package/lib/utils/npm-oidc.js +28 -53
- package/lib/utils/npm-otp-cache.d.ts +4 -4
- package/lib/utils/npm-otp-cache.js +20 -25
- package/lib/utils/npm-otp.d.ts +20 -30
- package/lib/utils/npm-otp.js +32 -51
- package/lib/utils/onboard-probe.d.ts +7 -13
- package/lib/utils/onboard-probe.js +16 -27
- package/lib/utils/parse-spec.d.ts +3 -3
- package/lib/utils/parse-spec.js +4 -5
- package/lib/utils/pkg-json-edit.d.ts +7 -12
- package/lib/utils/pkg-json-edit.js +13 -26
- package/lib/utils/pkg-json.d.ts +11 -18
- package/lib/utils/pkg-json.js +19 -28
- package/lib/utils/prefixed-output.d.ts +3 -4
- package/lib/utils/prefixed-output.js +13 -19
- package/lib/utils/prompt.d.ts +3 -4
- package/lib/utils/prompt.js +14 -18
- package/lib/utils/publish-diagnose.d.ts +11 -16
- package/lib/utils/publish-diagnose.js +15 -28
- package/lib/utils/publish-headers.d.ts +7 -11
- package/lib/utils/publish-headers.js +36 -65
- package/lib/utils/publishable-packages.d.ts +4 -6
- package/lib/utils/publishable-packages.js +14 -18
- package/lib/utils/resolve-gjs-entry.d.ts +5 -8
- package/lib/utils/resolve-gjs-entry.js +10 -27
- package/lib/utils/resolve-npm-package.d.ts +6 -11
- package/lib/utils/resolve-npm-package.js +29 -63
- package/lib/utils/resolve-plugin-by-name.d.ts +11 -19
- package/lib/utils/resolve-plugin-by-name.js +9 -14
- package/lib/utils/run-gjs.d.ts +19 -17
- package/lib/utils/run-gjs.js +37 -51
- package/lib/utils/run-lifecycle-script.d.ts +5 -9
- package/lib/utils/run-lifecycle-script.js +23 -42
- package/lib/utils/run-node.d.ts +23 -33
- package/lib/utils/run-node.js +56 -60
- package/lib/utils/runtimes.d.ts +25 -35
- package/lib/utils/runtimes.js +34 -46
- package/lib/utils/spawn.d.ts +32 -48
- package/lib/utils/spawn.js +51 -84
- package/lib/utils/stdin.d.ts +2 -2
- package/lib/utils/stdin.js +10 -25
- package/lib/utils/suggest.d.ts +6 -7
- package/lib/utils/suggest.js +8 -10
- package/lib/utils/system-gi.d.ts +18 -27
- package/lib/utils/system-gi.js +60 -114
- package/lib/utils/trust-registry.d.ts +4 -8
- package/lib/utils/trust-registry.js +7 -15
- package/lib/utils/win32-command.d.ts +8 -14
- package/lib/utils/win32-command.js +29 -43
- package/lib/utils/workspace-root.js +7 -12
- package/package.json +18 -17
- package/showcases.json +6 -0
|
@@ -6,64 +6,57 @@ interface ParsedSpec {
|
|
|
6
6
|
range: string;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* One placed package in the resolved tree. Exported as a TYPE only
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* One placed package in the resolved tree. Exported as a TYPE only, so a spec can
|
|
10
|
+
* hand {@link computeOptionalFlags} and {@link applyPlatformFilter} a graph
|
|
11
|
+
* directly instead of driving a whole install; nothing outside this module
|
|
12
|
+
* constructs one for real.
|
|
13
13
|
*/
|
|
14
14
|
export interface ResolvedNode {
|
|
15
|
-
/** Package name (e.g. `@gjsify/cli`, `lodash`). */
|
|
16
15
|
name: string;
|
|
17
16
|
version: string;
|
|
18
17
|
tarballUrl: string;
|
|
19
18
|
integrity?: string;
|
|
20
|
-
/**
|
|
21
|
-
*
|
|
22
|
-
* `node_modules/<parent>/node_modules/<dep>`. */
|
|
19
|
+
/** Relative to the install prefix. Always starts with `node_modules/`; nested
|
|
20
|
+
* entries look like `node_modules/<parent>/node_modules/<dep>`. */
|
|
23
21
|
installPath: string;
|
|
24
|
-
/**
|
|
22
|
+
/** Ranges keyed by name, as published. */
|
|
25
23
|
dependencies: Record<string, string>;
|
|
26
|
-
/** `optionalDependencies` field from the packument. */
|
|
27
24
|
optionalDependencies: Record<string, string>;
|
|
28
25
|
bin?: string | Record<string, string>;
|
|
29
26
|
/**
|
|
30
|
-
* The version's `os`/`cpu`/`libc` declaration, as published. Recorded
|
|
31
|
-
*
|
|
32
|
-
*
|
|
27
|
+
* The version's `os`/`cpu`/`libc` declaration, as published. Recorded here
|
|
28
|
+
* (and in the lockfile) so the VERDICT can be recomputed for whichever host
|
|
29
|
+
* runs the install — header note on portability.
|
|
33
30
|
*
|
|
34
|
-
* Read from the FULL packument,
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* `
|
|
41
|
-
* declare `libc: ["glibc"]` and NO `os`/`cpu`).
|
|
31
|
+
* Read from the FULL packument, the only document carrying `libc`: the
|
|
32
|
+
* abbreviated one can never PROVE a `libc` restriction is absent, so a
|
|
33
|
+
* declaration built from it is silently incomplete for exactly the packages
|
|
34
|
+
* the field exists for (nine of this repo's own — `@gjsify/{rolldown,
|
|
35
|
+
* lightningcss,oxfmt}-native`, `webgl`, `napi`, `sab-native`,
|
|
36
|
+
* `terminal-native`, `http2-native`, `http-soup-bridge` — declare
|
|
37
|
+
* `libc: ["glibc"]` and NO `os`/`cpu`).
|
|
42
38
|
*/
|
|
43
39
|
platform?: PlatformDeclaration;
|
|
44
40
|
/**
|
|
45
41
|
* Is this node reachable ONLY through optionalDependency edges? Decides what
|
|
46
|
-
* an incompatible platform means: skip silently
|
|
47
|
-
*
|
|
42
|
+
* an incompatible platform means: skip silently vs. fail the install. npm
|
|
43
|
+
* calls the same set `optionalSet`.
|
|
48
44
|
*
|
|
49
45
|
* DERIVED, not an input — {@link computeOptionalFlags} recomputes it as a
|
|
50
|
-
* fixpoint
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* node is tolerated; it is edge-order-dependent and must never be the final
|
|
54
|
-
* answer (header note, invariant 2).
|
|
46
|
+
* fixpoint on both the fresh-resolve and the lockfile path before anything
|
|
47
|
+
* reads it. What the BFS assigns at placement time is a forward guess, used
|
|
48
|
+
* only to decide whether a resolve FAILURE under this node is tolerated.
|
|
55
49
|
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* dropped from the tree.
|
|
50
|
+
* Absent must read as `false` (= required): callers also build nodes
|
|
51
|
+
* structurally caring only about name/installPath, and the safe default for
|
|
52
|
+
* an unknown edge kind is the loud one — a required incompatible dependency
|
|
53
|
+
* fails the install instead of vanishing from the tree.
|
|
61
54
|
*/
|
|
62
55
|
optional?: boolean;
|
|
63
56
|
/**
|
|
64
|
-
* Set by {@link applyPlatformFilter}:
|
|
65
|
-
*
|
|
66
|
-
*
|
|
57
|
+
* Set by {@link applyPlatformFilter}: not runnable on the install target, so
|
|
58
|
+
* not downloaded or extracted. Never persisted — a per-host verdict, not a
|
|
59
|
+
* property of the resolution.
|
|
67
60
|
*/
|
|
68
61
|
inert?: boolean;
|
|
69
62
|
}
|
|
@@ -74,21 +67,19 @@ export interface InstalledTopLevel {
|
|
|
74
67
|
/**
|
|
75
68
|
* {@link InstallOptions} plus what only the NATIVE backend can use.
|
|
76
69
|
*
|
|
77
|
-
* `optionalSpecs` exists because a spec is a flat `"<name>@<range>"` string by
|
|
78
|
-
*
|
|
79
|
-
* `
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* a package nothing on the host would ever load.
|
|
70
|
+
* `optionalSpecs` exists because a spec is a flat `"<name>@<range>"` string by the
|
|
71
|
+
* time it reaches here (`projectSpecsFromPackageJson` flattens `dependencies`,
|
|
72
|
+
* `devDependencies` and `optionalDependencies` into one list), yet the KIND
|
|
73
|
+
* decides what an incompatible `os`/`cpu`/`libc` means — skipped vs. fatal. The
|
|
74
|
+
* live shape is `optionalDependencies: { fsevents }` in a project manifest: npm
|
|
75
|
+
* leaves fsevents out on Linux and installs fine, so treating every top-level
|
|
76
|
+
* spec as required turns that into a hard EBADPLATFORM for a package nothing on
|
|
77
|
+
* the host would load.
|
|
86
78
|
*
|
|
87
|
-
* It rides the SAME options object `install-backend.ts` forwards wholesale
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
* that assumption is pinned).
|
|
79
|
+
* It rides the SAME options object `install-backend.ts` forwards wholesale here.
|
|
80
|
+
* If that forwarding is ever changed to destructure, this field must be forwarded
|
|
81
|
+
* with it, or top-level optional deps quietly become required again — the
|
|
82
|
+
* `install-platform-filter` e2e is where that assumption is pinned.
|
|
92
83
|
*/
|
|
93
84
|
export interface NativeInstallOptions extends InstallOptions {
|
|
94
85
|
/**
|
|
@@ -100,115 +91,90 @@ export interface NativeInstallOptions extends InstallOptions {
|
|
|
100
91
|
}
|
|
101
92
|
export declare function installPackagesNative(opts: NativeInstallOptions): Promise<InstalledTopLevel[]>;
|
|
102
93
|
/**
|
|
103
|
-
* Split a resolved tree into what THIS target can install, marking the rest
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
* final once every edge that could reach it has been visited.
|
|
94
|
+
* Split a resolved tree into what THIS target can install, marking the rest inert.
|
|
95
|
+
* A post-pass rather than a filter during the walk (as in arborist's
|
|
96
|
+
* `refs/npm-cli/workspaces/arborist/lib/arborist/build-ideal-tree.js`) for two
|
|
97
|
+
* reasons: the verdict must be identical whether the tree came from a fresh
|
|
98
|
+
* resolve or from `gjsify-lock.json`, and a node's optionality is only final once
|
|
99
|
+
* every edge that could reach it has been visited.
|
|
110
100
|
*
|
|
111
101
|
* The two outcomes are npm's, including the asymmetry around `force`:
|
|
112
|
-
* - REQUIRED + incompatible → EBADPLATFORM. A required
|
|
113
|
-
*
|
|
114
|
-
* `pkgid`/`current`/`required`
|
|
115
|
-
*
|
|
116
|
-
* - OPTIONAL + incompatible → inert: not downloaded, not extracted, still in
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
* else.
|
|
102
|
+
* - REQUIRED + incompatible → EBADPLATFORM. A required dep the host cannot run
|
|
103
|
+
* is a broken install, not a smaller one, so it fails loudly with
|
|
104
|
+
* `pkgid`/`current`/`required`. `--force` suppresses it (the user is asserting
|
|
105
|
+
* something about their own machine).
|
|
106
|
+
* - OPTIONAL + incompatible → inert: not downloaded, not extracted, still in the
|
|
107
|
+
* lockfile. `--force` does NOT lift this — npm says so in as many words ("We
|
|
108
|
+
* ignore the --force and --engine-strict flags"), and forcing an optional
|
|
109
|
+
* binary that cannot load buys a download and nothing else.
|
|
121
110
|
*
|
|
122
|
-
* The skip line
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
* GB arrived with no line saying it should not have.
|
|
111
|
+
* The skip line carries npm's `current`/`required` payload so `--verbose` recovers
|
|
112
|
+
* WHY a package is absent. Silence here is what made the original defect invisible
|
|
113
|
+
* in the other direction: 3.67 GB arrived with no line saying it should not have.
|
|
126
114
|
*/
|
|
127
115
|
export declare function applyPlatformFilter(nodes: ResolvedNode[], target: PlatformTarget, force: boolean, log: Logger): ResolvedNode[];
|
|
128
116
|
/**
|
|
129
117
|
* Warn about a native package that installed WITHOUT a usable binary.
|
|
130
118
|
*
|
|
131
|
-
*
|
|
132
|
-
* `
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
* 0.21.0` case: installed, but `node_gi.node` absent → the consumer hit a runtime
|
|
138
|
-
* failure with no hint). Surface it at install time with an actionable line. Pure
|
|
139
|
-
* detection — no script is run, so node-free-ness is preserved.
|
|
119
|
+
* This install is node-free and does NOT run `install`/`postinstall` scripts —
|
|
120
|
+
* `node-gyp rebuild` would need Node plus a C++ toolchain. Such a package works
|
|
121
|
+
* only if it SHIPS a prebuild (`prebuilds/<platform>-<arch>/…`) or is built by
|
|
122
|
+
* hand; with neither it silently loads no binary, as `@gjsify/node-gi 0.21.0` did
|
|
123
|
+
* (installed, `node_gi.node` absent, consumer hit a runtime failure with no hint).
|
|
124
|
+
* Pure detection — no script is run, so node-free-ness is preserved.
|
|
140
125
|
*/
|
|
141
126
|
export declare function warnMissingNativeBuilds(nodes: ResolvedNode[], prefix: string, log: Logger): void;
|
|
142
127
|
/**
|
|
143
|
-
* A node's REQUIRED dependency edges: its `dependencies
|
|
144
|
-
* `optionalDependencies` also lists. The
|
|
145
|
-
*
|
|
146
|
-
* cannot drift.
|
|
128
|
+
* A node's REQUIRED dependency edges: its `dependencies` minus every name its
|
|
129
|
+
* `optionalDependencies` also lists. The ONE place that decides an edge's kind —
|
|
130
|
+
* both the resolve walk and the optionality fixpoint read it, so they cannot drift.
|
|
147
131
|
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
* it's usually best to only put in one place" (npm's package.json docs). Measured
|
|
151
|
-
* on `@parcel/rust@2.16.4`, which lists all eight per-platform napi packages in
|
|
152
|
-
* both blocks: `npm install` exits 0, installs `@parcel/rust-linux-x64-gnu` only,
|
|
153
|
-
* and writes `"optional": true` for all eight in its `package-lock.json`.
|
|
132
|
+
* The subtraction is npm's rule, not ours: "entries in optionalDependencies will
|
|
133
|
+
* override entries of the same name in dependencies" (npm's package.json docs).
|
|
154
134
|
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
135
|
+
* NOT MERELY A DEDUP: the kind decides what an incompatible `os`/`cpu`/`libc` MEANS
|
|
136
|
+
* (fatal vs. inert in `applyPlatformFilter`) and whether a failed resolve is
|
|
137
|
+
* tolerated. Reading `dependencies` alone does not just visit a name twice, it
|
|
138
|
+
* promotes a foreign-platform binary to a required dependency and fails installs npm
|
|
139
|
+
* completes — the header note's invariant 3.
|
|
160
140
|
*
|
|
161
|
-
*
|
|
162
|
-
* `
|
|
163
|
-
* which is what {@link resolveDeps}'s second queue loop covers.
|
|
141
|
+
* Deliberately NOT symmetric: a name in `optionalDependencies` alone is optional (no
|
|
142
|
+
* `dependencies` entry to override), covered by {@link resolveDeps}'s second queue loop.
|
|
164
143
|
*/
|
|
165
144
|
export declare function requiredDepEntries(node: Pick<ResolvedNode, 'dependencies' | 'optionalDependencies'>): [string, string][];
|
|
166
145
|
/**
|
|
167
|
-
* Recompute every node's `optional` flag as a FIXPOINT over the placed graph.
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
146
|
+
* Recompute every node's `optional` flag as a FIXPOINT over the placed graph. The
|
|
147
|
+
* only writer of the final flag; whatever the nodes arrive carrying is an input
|
|
148
|
+
* nothing checked (a BFS forward guess on the resolve path, a value read out of a
|
|
149
|
+
* file on the lockfile path) and is overwritten unconditionally.
|
|
171
150
|
*
|
|
172
|
-
* DEFINITION: a node is REQUIRED iff
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
* is still optional — which is what npm's `optionalSet` computes.
|
|
151
|
+
* DEFINITION: a node is REQUIRED iff reachable from `requiredNames` through
|
|
152
|
+
* REQUIRED edges alone ({@link requiredDepEntries}); every other node is optional.
|
|
153
|
+
* Optionality is therefore INHERITED — a plain dependency OF an optional package is
|
|
154
|
+
* still optional, which is what npm's `optionalSet` computes.
|
|
177
155
|
*
|
|
178
156
|
* WHY A FIXPOINT AND NOT A ONE-SHOT PROMOTION AT THE REUSE SITE (the reviewed
|
|
179
|
-
* defect): the walk queues a node's
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
* first
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
* order. npm reaches for the same shape and says so —
|
|
188
|
-
* refs/npm-cli/workspaces/arborist/lib/calc-dep-flags.js: "If a node is changed,
|
|
189
|
-
* we add to the queue and continue until no more changes."
|
|
157
|
+
* defect): the walk queues a node's dep edges when it is placed, carrying the
|
|
158
|
+
* optionality it had THEN, so promoting the node later leaves its children behind and
|
|
159
|
+
* the answer depends on which edge BFS traversed first. A required transitive dep
|
|
160
|
+
* reached first through an optional edge stayed flagged optional, was persisted that
|
|
161
|
+
* way, and was then silently skipped by the platform filter on every machine instead
|
|
162
|
+
* of raising EBADPLATFORM. A monotone worklist over the FINISHED graph cannot have
|
|
163
|
+
* that property: "required" only ever spreads, so the result is order-independent.
|
|
164
|
+
* Same shape as refs/npm-cli/workspaces/arborist/lib/calc-dep-flags.js.
|
|
190
165
|
*
|
|
191
|
-
* PATH-INDEPENDENCE
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
* every Linux install of any tree containing parcel failed with EBADPLATFORM on
|
|
200
|
-
* `@parcel/rust-darwin-x64` while `npm install` thinned the same tree and exited
|
|
201
|
-
* 0. "Erring toward REQUIRED errs toward the loud failure" is true and was the
|
|
202
|
-
* wrong trade: the loud failure was not a real one, and no `--force` lifts it
|
|
203
|
-
* (nor should it). So the declaration is persisted and both paths subtract it.
|
|
204
|
-
* Reading a pre-v4 lockfile leaves the map empty, which reproduces the old
|
|
205
|
-
* behaviour for that file alone — see READABLE_LOCKFILE_VERSIONS.
|
|
166
|
+
* PATH-INDEPENDENCE is the other requirement, and why the lockfile carries an
|
|
167
|
+
* `optionalDependencies` map per entry (v4). This walk USED to read `dependencies`
|
|
168
|
+
* only, because a lockfile entry recorded nothing else and consulting
|
|
169
|
+
* `node.optionalDependencies` would have made the two paths compute different flags
|
|
170
|
+
* for one tree. That premise was fixable and its consequence — a both-blocks name
|
|
171
|
+
* coming out REQUIRED — was not (header note, invariant 3). A pre-v4 lockfile leaves
|
|
172
|
+
* the map empty and reproduces the old behaviour for that file alone
|
|
173
|
+
* (READABLE_LOCKFILE_VERSIONS).
|
|
206
174
|
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
* fatal-vs-inert question is decided by these two functions in composition, and
|
|
211
|
-
* that is worth pinning without a registry.
|
|
175
|
+
* Exported so the unit spec can drive it with INJECTED graphs — the whole
|
|
176
|
+
* fatal-vs-inert question is decided by this and `applyPlatformFilter` in
|
|
177
|
+
* composition, worth pinning without a registry.
|
|
212
178
|
*/
|
|
213
179
|
export declare function computeOptionalFlags(nodes: ResolvedNode[], requiredNames: Set<string>, log: Logger): void;
|
|
214
180
|
export declare function parseSpec(raw: string): ParsedSpec;
|
|
@@ -216,20 +182,18 @@ export declare function pickVersion(packument: Packument, range: string, preferr
|
|
|
216
182
|
/**
|
|
217
183
|
* Materialise ONE `node_modules/.bin/<name>` entry for `targetAbs`.
|
|
218
184
|
*
|
|
219
|
-
* Exported
|
|
220
|
-
*
|
|
221
|
-
* `symlinkSync`/`CreateSymbolicLink` syscall behaviour itself is OS-bound.
|
|
185
|
+
* Exported and platform-injectable so the Windows branch is unit-tested from a Linux
|
|
186
|
+
* host; only the `symlinkSync`/`CreateSymbolicLink` syscall itself is OS-bound.
|
|
222
187
|
*
|
|
223
|
-
* POSIX: a relative symlink,
|
|
224
|
-
*
|
|
188
|
+
* POSIX: a relative symlink, falling back to a copy (some filesystems and container
|
|
189
|
+
* overlays reject symlinks).
|
|
225
190
|
*
|
|
226
|
-
* Windows: `.bin/<name>` is not on `PATHEXT` and Windows has no shebang
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
* the same set from the same templates. See `./bin-shim.ts`.
|
|
191
|
+
* Windows: `.bin/<name>` is not on `PATHEXT` and Windows has no shebang handling, so a
|
|
192
|
+
* symlink OR a copy of a `#!/usr/bin/env node` script is unrunnable — and a *file*
|
|
193
|
+
* symlink additionally needs elevation or Developer Mode, so the previous code reliably
|
|
194
|
+
* fell into its copy fallback and produced a dead entry. npm's answer is three sibling
|
|
195
|
+
* files (`<name>` for git-bash/MSYS/WSL, `<name>.cmd` for cmd.exe, `<name>.ps1` for
|
|
196
|
+
* pwsh); the same set is written from the same templates (`./bin-shim.ts`).
|
|
233
197
|
*/
|
|
234
198
|
export declare function writeBinEntry(opts: {
|
|
235
199
|
binDir: string;
|
|
@@ -237,25 +201,23 @@ export declare function writeBinEntry(opts: {
|
|
|
237
201
|
targetAbs: string;
|
|
238
202
|
platform?: string;
|
|
239
203
|
/**
|
|
240
|
-
* Set when this entry is the package's GJS-runnable artifact (
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
* {@link pickBinMap} for why `gjsify.bin` has to win here at all.
|
|
204
|
+
* Set when this entry is the package's GJS-runnable artifact (`gjsify.bin`), making
|
|
205
|
+
* it a GENERATED launcher rather than a link to a file with a shebang — see
|
|
206
|
+
* {@link buildShLauncher} for why, {@link pickBinMap} for why `gjsify.bin` wins.
|
|
244
207
|
*
|
|
245
|
-
* The preamble
|
|
246
|
-
*
|
|
247
|
-
*
|
|
208
|
+
* The preamble exports `GI_TYPELIB_PATH` / the loader path before `gjs` starts. It
|
|
209
|
+
* cannot be done from inside the bundle: GI resolves the typelib while the runtime
|
|
210
|
+
* boots, before the first line runs.
|
|
248
211
|
*/
|
|
249
212
|
gjs?: {
|
|
250
213
|
envPreamble: string;
|
|
251
214
|
prebuildDirs: readonly string[];
|
|
252
215
|
};
|
|
253
216
|
/**
|
|
254
|
-
* The package's npm `bin` target
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
* today.
|
|
217
|
+
* The package's npm `bin` target when it declares one ALONGSIDE `gjsify.bin`; the
|
|
218
|
+
* launcher then picks a runtime per invocation instead of hard-coding `gjs` (see
|
|
219
|
+
* {@link pickBinMap}). Absent for a package declaring only one of the two, which is
|
|
220
|
+
* every package but `@gjsify/cli` today.
|
|
259
221
|
*/
|
|
260
222
|
nodeFallbackAbs?: string;
|
|
261
223
|
}): void;
|