@gjsify/cli 0.36.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 +3 -3
- package/lib/bundler-pick.js +61 -87
- 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/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/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 +17 -20
- package/lib/utils/gjsify-shim.js +80 -120
- 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.js +33 -54
- 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 +16 -21
- package/lib/utils/run-gjs.js +31 -56
- 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 +21 -33
- package/lib/utils/run-node.js +43 -64
- 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 -18
|
@@ -22,37 +22,41 @@ export declare const installCommand: Command<unknown, InstallOptions>;
|
|
|
22
22
|
/**
|
|
23
23
|
* Which dependency NAMES are optional across the given manifests.
|
|
24
24
|
*
|
|
25
|
-
* The specs handed to the
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* REQUIRED one (see `NativeInstallOptions.optionalSpecs`).
|
|
25
|
+
* The specs handed to the backend are flat `"<name>@<range>"` strings, so the
|
|
26
|
+
* kind has to travel beside them. It decides exactly one thing: an incompatible
|
|
27
|
+
* `os`/`cpu`/`libc` skips an OPTIONAL dependency and fails a REQUIRED one (see
|
|
28
|
+
* `NativeInstallOptions.optionalSpecs`).
|
|
30
29
|
*
|
|
31
|
-
* REQUIRED WINS ACROSS MANIFESTS, OPTIONAL WINS WITHIN ONE —
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* `requiredDepEntries` fixes: `optionalDependencies: { fsevents }` alongside a
|
|
44
|
-
* `dependencies: { fsevents }` line would fail every Linux install with
|
|
30
|
+
* REQUIRED WINS ACROSS MANIFESTS, OPTIONAL WINS WITHIN ONE — two rules with two
|
|
31
|
+
* reasons, neither a special case of the other:
|
|
32
|
+
* - Across manifests: one package can be a plain dependency of one member and
|
|
33
|
+
* an optionalDependency of another. Those are two real edges, and an edge
|
|
34
|
+
* that may not be missing must not be silently missed. Subtracting rather
|
|
35
|
+
* than "last block seen" also makes the answer order-independent.
|
|
36
|
+
* - Within one manifest: a name in BOTH blocks is OPTIONAL because npm says so
|
|
37
|
+
* ("entries in optionalDependencies will override entries of the same name
|
|
38
|
+
* in dependencies") — one edge, and the optional block names its kind.
|
|
39
|
+
* Treating it as required is the root-edge twin of the defect
|
|
40
|
+
* `requiredDepEntries` fixes: `optionalDependencies: { fsevents }` beside a
|
|
41
|
+
* `dependencies: { fsevents }` line failed every Linux install with
|
|
45
42
|
* EBADPLATFORM over a package npm never installs there.
|
|
46
43
|
*/
|
|
47
44
|
export declare function optionalDependencyNames(manifests: readonly PackageJson[]): Set<string>;
|
|
45
|
+
/**
|
|
46
|
+
* Build the `sh` shim for one bin. Which interpreter it tries first is decided
|
|
47
|
+
* per platform below; the probe is per-INVOCATION, not per-install, so the same
|
|
48
|
+
* shim works before and after the workspace's `lib/` has been built.
|
|
49
|
+
*
|
|
50
|
+
* Both targets are absolute so the shim survives the different cwds consumers
|
|
51
|
+
* (`yarn run`, `npm run`, a direct PATH invocation) call it from.
|
|
52
|
+
*/
|
|
48
53
|
export declare function buildBinShim(wsLocation: string, nodeTarget?: string, gjsTarget?: string, nativePrebuildDirs?: string[], platform?: string, scanRoot?: string): string;
|
|
49
54
|
/**
|
|
50
55
|
* `.cmd` / `.ps1` companions for {@link buildBinShim}.
|
|
51
56
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* both targets resolves to Node here, and a GJS-only workspace gets an honest
|
|
57
|
+
* There is no GJS host on Windows at all (no prebuilt `libgjs` — see
|
|
58
|
+
* `website/src/content/docs/platform-support.md`), so a workspace shipping both
|
|
59
|
+
* targets resolves to Node here, and a GJS-only workspace gets an honest
|
|
56
60
|
* `gjs`-invoking shim that fails exactly the way the `sh` one does.
|
|
57
61
|
*
|
|
58
62
|
* Exported + platform-free so it is unit-tested from Linux.
|
|
@@ -61,49 +65,6 @@ export declare function buildWorkspaceBinShimsForWindows(wsLocation: string, nod
|
|
|
61
65
|
cmd: string;
|
|
62
66
|
ps1: string;
|
|
63
67
|
};
|
|
64
|
-
/**
|
|
65
|
-
* Lay the GJS bundler engine down after a PROJECT install, when the host will
|
|
66
|
-
* need it and does not have it. Closes #1005.
|
|
67
|
-
*
|
|
68
|
-
* The engine is an OPTIONAL PEER of `@gjsify/cli`, deliberately: a plain
|
|
69
|
-
* `npm install @gjsify/cli` on Node/macOS/Windows must not fetch Linux
|
|
70
|
-
* prebuilds. But nobody resolves it for a project — npm 7+ skips optional peers,
|
|
71
|
-
* and the native backend does not resolve peerDependencies at all
|
|
72
|
-
* (`install-backend-native.ts:76`). Under GJS there is no npm `rolldown`
|
|
73
|
-
* fallback, so `gjsify build` simply cannot work. Every consumer in the
|
|
74
|
-
* workspace independently discovered this and hand-declared the engine.
|
|
75
|
-
*
|
|
76
|
-
* Four conditions, and the second is the one worth reading:
|
|
77
|
-
*
|
|
78
|
-
* (a) `@gjsify/cli` is in this tree — otherwise the engine has no caller.
|
|
79
|
-
* (b) THE HOST CAN RUN GJS, which is NOT the same question as `isGjs()`.
|
|
80
|
-
* `isGjs()` asks which runtime is executing the installer; the launcher
|
|
81
|
-
* (`bin-shim.ts:616`) prefers the GJS bundle whenever `command -v gjs`
|
|
82
|
-
* succeeds, so a tree installed BY NODE is routinely built BY GJS. Gating
|
|
83
|
-
* on the interpreter would reproduce #1005 for every contributor who
|
|
84
|
-
* installs on Node and builds through the shim. `runMinimalChecks()` above
|
|
85
|
-
* already probed for gjs, so this costs no extra spawn — and it goes
|
|
86
|
-
* nowhere near `which`.
|
|
87
|
-
* (c) No engine is already reachable — asked with the same walk the BUILD uses.
|
|
88
|
-
* (d) Not `--immutable`. A frozen install cannot acquire something its
|
|
89
|
-
* lockfile does not name without breaking the contract `--immutable`
|
|
90
|
-
* exists to hold, so that case warns and installs nothing.
|
|
91
|
-
*
|
|
92
|
-
* Deliberately NOT gated on `gjsify.app` or on "declares a build script":
|
|
93
|
-
* neither of the failing consumers declares the former, and the latter would
|
|
94
|
-
* mean pattern-matching script bodies — the hand-maintained judgement that
|
|
95
|
-
* drifts, which ADR 0017 rejects by name.
|
|
96
|
-
*
|
|
97
|
-
* NOT recorded in the lockfile. `installPackages` writes one only under
|
|
98
|
-
* `if (resolved && opts.lockfile)` and the default is falsy, so a consumer's
|
|
99
|
-
* `gjsify-lock.json` is never rewritten by this. An e2e row pins that.
|
|
100
|
-
*
|
|
101
|
-
* Ordering is not a constraint here, unlike the global path (which must precede
|
|
102
|
-
* `linkGlobalBins`): `buildNativeEnvPreamble` scans the prefix at LAUNCH time
|
|
103
|
-
* (`bin-shim.ts:432-444`), so a shim written before the engine arrives still
|
|
104
|
-
* exports its dir. `tests/e2e/global-install-engine/run.mjs:361-374` asserts
|
|
105
|
-
* exactly that case.
|
|
106
|
-
*/
|
|
107
68
|
export interface EnsureProjectGjsEngineDeps {
|
|
108
69
|
/** Project root. Defaults to `process.cwd()`. */
|
|
109
70
|
cwd?: string;
|
|
@@ -115,5 +76,41 @@ export interface EnsureProjectGjsEngineDeps {
|
|
|
115
76
|
/** Injected so a host that HAS an engine can still exercise the missing branch. */
|
|
116
77
|
hasEngineFn?: (dir: string) => boolean;
|
|
117
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Lay the GJS bundler engine down after a PROJECT install, when the host will need
|
|
81
|
+
* it and does not have it (#1005).
|
|
82
|
+
*
|
|
83
|
+
* The engine is an OPTIONAL PEER of `@gjsify/cli` on purpose — a plain
|
|
84
|
+
* `npm install @gjsify/cli` on Node must not fetch prebuilds — but nobody resolves
|
|
85
|
+
* it for a project: npm 7+ skips optional peers and the native backend does not
|
|
86
|
+
* resolve `peerDependencies` at all. Under GJS there is no npm `rolldown`
|
|
87
|
+
* fallback, so `gjsify build` had nothing to load.
|
|
88
|
+
*
|
|
89
|
+
* Four conditions, and (b) is the one worth reading:
|
|
90
|
+
*
|
|
91
|
+
* (a) `@gjsify/cli` is in this tree — otherwise the engine has no caller.
|
|
92
|
+
* (b) THE HOST CAN RUN GJS, which is NOT the `isGjs()` question. `isGjs()` asks
|
|
93
|
+
* which runtime is executing the installer, but the launcher prefers the GJS
|
|
94
|
+
* bundle whenever `command -v gjs` succeeds, so a tree installed BY NODE is
|
|
95
|
+
* routinely built BY GJS. Gating on the interpreter reproduces #1005 for
|
|
96
|
+
* every contributor who installs on Node and builds through the shim.
|
|
97
|
+
* `runMinimalChecks()` already probed for gjs, so this costs no extra spawn.
|
|
98
|
+
* (c) No engine is already reachable — asked with the same walk the BUILD uses.
|
|
99
|
+
* (d) Not `--immutable`: a frozen install cannot acquire what its lockfile does
|
|
100
|
+
* not name, so that case warns and installs nothing.
|
|
101
|
+
*
|
|
102
|
+
* NOT gated on `gjsify.app` or on "declares a build script": neither failing
|
|
103
|
+
* consumer declares the former, and the latter means pattern-matching script
|
|
104
|
+
* bodies, the drifting hand-maintained judgement ADR 0017 rejects by name.
|
|
105
|
+
* ADR 0020 records the simpler `optionalDependencies` shape that would retire
|
|
106
|
+
* this policy entirely.
|
|
107
|
+
*
|
|
108
|
+
* NOT recorded in the lockfile — `installPackages` writes one only when both
|
|
109
|
+
* `resolved` and `opts.lockfile` hold — so a consumer's `gjsify-lock.json` is
|
|
110
|
+
* never rewritten by this; an e2e row pins it. Ordering is free here, unlike the
|
|
111
|
+
* global path: `buildNativeEnvPreamble` scans the prefix at LAUNCH time, so a shim
|
|
112
|
+
* written before the engine arrives still exports its dir
|
|
113
|
+
* (`tests/e2e/global-install-engine/`).
|
|
114
|
+
*/
|
|
118
115
|
export declare function ensureProjectGjsEngine(args: InstallOptions, gjsFound: boolean, deps?: EnsureProjectGjsEngineDeps): Promise<void>;
|
|
119
116
|
export {};
|