@gjsify/cli 0.48.0 → 0.49.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 +163 -155
- package/lib/actions/build.js +2 -1
- package/lib/commands/build.js +4 -0
- package/lib/commands/install.js +21 -1
- package/lib/commands/upgrade.js +78 -30
- package/lib/config.js +13 -0
- package/lib/types/cli-build-options.d.ts +6 -0
- package/lib/types/config-data.d.ts +14 -0
- package/lib/utils/detect-native-packages.d.ts +31 -0
- package/lib/utils/detect-native-packages.js +37 -1
- package/package.json +19 -19
package/lib/actions/build.js
CHANGED
|
@@ -630,7 +630,7 @@ export class BuildAction {
|
|
|
630
630
|
throw new Error('gjsify build: an .html entry needs an explicit --outfile ' +
|
|
631
631
|
'(e.g. --outfile dist-app/app.js); the emitted index.html is written beside it.');
|
|
632
632
|
}
|
|
633
|
-
const { consoleShim, globals, dialect } = this.configData;
|
|
633
|
+
const { consoleShim, globals, dialect, giRenderer } = this.configData;
|
|
634
634
|
const userExternal = Array.isArray(userBundler.external) ? userBundler.external : undefined;
|
|
635
635
|
const userBanner = typeof userBundler.output?.banner === 'string' ? userBundler.output.banner : undefined;
|
|
636
636
|
const pluginOpts = {
|
|
@@ -641,6 +641,7 @@ export class BuildAction {
|
|
|
641
641
|
reflection: typescript?.reflection,
|
|
642
642
|
consoleShim,
|
|
643
643
|
...(dialect !== undefined ? { dialect } : {}),
|
|
644
|
+
...(giRenderer === true ? { giRenderer: true } : {}),
|
|
644
645
|
...(aliases ? { aliases } : {}),
|
|
645
646
|
...(opts.preserveDefaultExport ? { preserveDefaultExport: true } : {}),
|
|
646
647
|
...(opts.toolchainAnchor !== undefined ? { toolchainAnchor: opts.toolchainAnchor } : {}),
|
package/lib/commands/build.js
CHANGED
|
@@ -112,6 +112,10 @@ export const buildCommand = {
|
|
|
112
112
|
description: "The dialect the SOURCE is written in. 'react-native' aliases 'react-native' onto '@gjsify/react-native' and fails the build on an import whose ADR 0032 support-table status is not supported/partial. GJS and Node app builds. This is NOT gjsify.runtimes['react-native'], which declares the runtime a package RUNS on — the two answer opposite questions.",
|
|
113
113
|
type: 'string',
|
|
114
114
|
choices: [...SOURCE_DIALECTS],
|
|
115
|
+
})
|
|
116
|
+
.option('gi-renderer', {
|
|
117
|
+
description: "Resolve `gi://Ns?version=X` to the target's widget renderer instead of an empty module (ADR 0034 stage 9): --app browser answers gi://Adw and gi://Gtk out of @gjsify/adwaita-web, --app nativescript out of @gjsify/adwaita-nativescript. A namespace with no renderer, and a ?version= the renderer's vocabulary was not generated against, both FAIL the build by name. Off by default — a gi:// import on those targets is usually a GJS-only code path pulled in transitively.",
|
|
118
|
+
type: 'boolean',
|
|
115
119
|
})
|
|
116
120
|
.option('console-shim', {
|
|
117
121
|
description: 'Inject a console shim into GJS builds for clean output without the GLib prefix and with working ANSI colors. Use --no-console-shim to disable. Only applies to GJS app builds.',
|
package/lib/commands/install.js
CHANGED
|
@@ -23,7 +23,7 @@ import { spawnSync } from 'node:child_process';
|
|
|
23
23
|
import { forceExit } from '../utils/force-exit.js';
|
|
24
24
|
import { discoverWorkspaces } from '@gjsify/workspace';
|
|
25
25
|
import { buildInstallCommand, detectPackageManager, runMinimalChecks } from '../utils/check-system-deps.js';
|
|
26
|
-
import { detectNativePackages } from '../utils/detect-native-packages.js';
|
|
26
|
+
import { detectHostLibc, detectNativePackages, muslPrebuildFallbacks } from '../utils/detect-native-packages.js';
|
|
27
27
|
import { buildLauncherShims, buildNativeEnvPreamble } from '../utils/bin-shim.js';
|
|
28
28
|
import { installPackages, makeProgressReporter } from '../utils/install-backend.js';
|
|
29
29
|
import { atomicWriteStrict } from '../utils/install-cache-fs.js';
|
|
@@ -1339,6 +1339,26 @@ async function runPostInstallChecks(args) {
|
|
|
1339
1339
|
console.log(` • ${pkg.name}`);
|
|
1340
1340
|
}
|
|
1341
1341
|
console.log('\nUse `gjsify run <bundle>` to launch with LD_LIBRARY_PATH/GI_TYPELIB_PATH set.');
|
|
1342
|
+
// The install is the ONLY moment this is knowable: the libc axis is decided
|
|
1343
|
+
// here, the failure it predicts happens in another process, days later, and
|
|
1344
|
+
// names something else entirely (see `muslPrebuildFallbacks`). The list is
|
|
1345
|
+
// the point — it is what lets a later `Error relocating` line be matched to
|
|
1346
|
+
// a package.
|
|
1347
|
+
const fellBack = muslPrebuildFallbacks(detectHostLibc(process.platform), native);
|
|
1348
|
+
if (fellBack.length > 0) {
|
|
1349
|
+
console.warn(`\nWarning: musl host — ${fellBack.length} of ${native.length} package(s) ship no \`-musl\`` +
|
|
1350
|
+
' prebuild, so the\n default (glibc) build was used:');
|
|
1351
|
+
for (const name of fellBack)
|
|
1352
|
+
console.warn(` ${name}`);
|
|
1353
|
+
console.warn(' Most of these run anyway: a bridge that links only GLib records no libc at all.\n' +
|
|
1354
|
+
' One that links glibc loads too — musl aliases `libc.so.6` to itself — and then\n' +
|
|
1355
|
+
' fails at dlopen on its first glibc-only symbol:\n' +
|
|
1356
|
+
' Error relocating <prebuild>.so: <symbol>: symbol not found\n' +
|
|
1357
|
+
' A bridge lost that way is silently absent from the next build rather than\n' +
|
|
1358
|
+
' reported, so the first symptom can be an unrelated-looking bundler error\n' +
|
|
1359
|
+
' (`Could not load <file>` from rolldown, for the CSS bridge). Nothing to\n' +
|
|
1360
|
+
' install: no `-musl` package is published for any target yet.');
|
|
1361
|
+
}
|
|
1342
1362
|
}
|
|
1343
1363
|
maybeInstallGitHooks();
|
|
1344
1364
|
}
|
package/lib/commands/upgrade.js
CHANGED
|
@@ -12,11 +12,15 @@
|
|
|
12
12
|
// matching packages automatically without prompting; same selection
|
|
13
13
|
// logic as above but no UI loop.
|
|
14
14
|
//
|
|
15
|
-
// 3. `--align`: offline
|
|
16
|
-
//
|
|
17
|
-
//
|
|
15
|
+
// 3. `--align`: offline repair mode. Finds deps declared at multiple ranges
|
|
16
|
+
// across the workspace and proposes a single range (the highest declared)
|
|
17
|
+
// — no registry calls. With `--exact` it repairs the second question too:
|
|
18
|
+
// a dep every manifest declares identically as `^4.1.0` is consistent and
|
|
19
|
+
// still carries an operator, so the operator goes as well.
|
|
18
20
|
//
|
|
19
|
-
// 4. `--check`: CI gate. Exits non-zero when any inconsistency exists
|
|
21
|
+
// 4. `--check`: CI gate. Exits non-zero when any inconsistency exists; with
|
|
22
|
+
// `--exact`, also when any matched declaration carries a range operator.
|
|
23
|
+
// Whatever `--check` rejects, `--align` with the same flags repairs.
|
|
20
24
|
//
|
|
21
25
|
// Filters:
|
|
22
26
|
//
|
|
@@ -36,7 +40,7 @@ import { parse } from '@gjsify/semver';
|
|
|
36
40
|
import { DEFAULT_REGISTRY, fetchPackument, parseNpmrc } from '@gjsify/npm-registry';
|
|
37
41
|
import { discoverWorkspaces, filterWorkspaces } from '@gjsify/workspace';
|
|
38
42
|
import { findWorkspaceRoot } from '../utils/workspace-root.js';
|
|
39
|
-
import { groupByDependency, findInconsistencies, } from '../utils/dep-aggregation.js';
|
|
43
|
+
import { groupByDependency, findInconsistencies, isInconsistent, } from '../utils/dep-aggregation.js';
|
|
40
44
|
export const upgradeCommand = {
|
|
41
45
|
command: 'upgrade',
|
|
42
46
|
description: 'Workspace-aware dependency upgrades. Walks every package.json in the monorepo, groups by dep, flags inconsistencies. `--latest` / `--minor` / `--patch` for bulk-mode, `--align` for offline consistency-only mode, `--check` for CI drift detection.',
|
|
@@ -71,7 +75,7 @@ export const upgradeCommand = {
|
|
|
71
75
|
type: 'string',
|
|
72
76
|
})
|
|
73
77
|
.option('align', {
|
|
74
|
-
description: 'Offline
|
|
78
|
+
description: 'Offline repair mode: find deps declared at multiple ranges across the workspace and align them to the highest. With `--exact`, also drop the range operator from declarations that already agree. No registry calls.',
|
|
75
79
|
type: 'boolean',
|
|
76
80
|
default: false,
|
|
77
81
|
})
|
|
@@ -81,7 +85,7 @@ export const upgradeCommand = {
|
|
|
81
85
|
default: false,
|
|
82
86
|
})
|
|
83
87
|
.option('exact', {
|
|
84
|
-
description: 'Pin without a range operator. When writing, emits `1.2.3` instead of `^1.2.3`; with `--check`, fails on any matched dep that carries one. Pair with `--filter` — a repository-wide exactness
|
|
88
|
+
description: 'Pin without a range operator. When writing, emits `1.2.3` instead of `^1.2.3`; with `--check`, fails on any matched dep that carries one; with `--align`, repairs exactly that. Pair with `--filter` — a repository-wide exactness run touches every ordinary caret dep by design.',
|
|
85
89
|
type: 'boolean',
|
|
86
90
|
default: false,
|
|
87
91
|
})
|
|
@@ -348,22 +352,63 @@ function runCheckMode(groups, exact = false) {
|
|
|
348
352
|
console.error(` ${range.padEnd(16)} — ${holders.join(', ')}`);
|
|
349
353
|
}
|
|
350
354
|
}
|
|
351
|
-
console.error(
|
|
355
|
+
console.error(exact
|
|
356
|
+
? `\nFix: run \`gjsify upgrade --align --exact\` (offline; aligns each dep to its highest declared version and drops the operator).`
|
|
357
|
+
: `\nFix: run \`gjsify upgrade --align\` (offline; aligns each dep to its highest declared range).`);
|
|
352
358
|
process.exit(1);
|
|
353
359
|
}
|
|
360
|
+
/**
|
|
361
|
+
* The groups `--align` has work on.
|
|
362
|
+
*
|
|
363
|
+
* Inconsistency is the whole question for a bare `--align`: a dep every manifest declares
|
|
364
|
+
* identically is done. `--exact` asks a second one, and the two do not overlap — a tree
|
|
365
|
+
* where every manifest says `^4.1.0` is perfectly consistent and carries an operator on
|
|
366
|
+
* every one of those declarations, which is precisely what `--check --exact` rejects.
|
|
367
|
+
*
|
|
368
|
+
* Selecting on inconsistency alone therefore made the repair that `--check --exact`'s own
|
|
369
|
+
* failure message names answer `nothing to do` to the tree it was pointed at: the gate
|
|
370
|
+
* demanded a property the fix could not deliver, cheerfully. Measured on bauplaner's five
|
|
371
|
+
* `@girs/*` declarations, all five `^4.1.0` and all five consistent.
|
|
372
|
+
*/
|
|
373
|
+
function alignTargets(groups, exact) {
|
|
374
|
+
if (!exact)
|
|
375
|
+
return findInconsistencies(groups);
|
|
376
|
+
return groups.filter((g) => isInconsistent(g) || g.occurrences.some((o) => o.prefix !== ''));
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* A repair that silently skipped part of its job must not report success.
|
|
380
|
+
*
|
|
381
|
+
* The loop that produces is gate red → repair "done" → gate red, where the second red
|
|
382
|
+
* reads as if the repair had never run. `^1.x` is the shape that lands here: `--check
|
|
383
|
+
* --exact` flags the operator, and no single version can be read out of the range to pin
|
|
384
|
+
* it at, so there is nothing to write and the CLI says which deps those are instead.
|
|
385
|
+
*/
|
|
386
|
+
function reportUnrepairable(groups) {
|
|
387
|
+
console.error(`\ngjsify upgrade --align: ${groups.length} dep(s) left unrepaired — no version to align on:\n`);
|
|
388
|
+
for (const g of groups) {
|
|
389
|
+
console.error(` ${ANSI.bold}${g.name}${ANSI.reset} ${[...g.declaredRanges].join(', ')}`);
|
|
390
|
+
}
|
|
391
|
+
console.error(`\nThose ranges name no single version. Edit them by hand, or resolve one with \`--latest\`.`);
|
|
392
|
+
return process.exit(1);
|
|
393
|
+
}
|
|
354
394
|
function runAlignMode(groups, args) {
|
|
355
|
-
const
|
|
356
|
-
|
|
357
|
-
|
|
395
|
+
const exact = args.exact ?? false;
|
|
396
|
+
const targets = alignTargets(groups, exact);
|
|
397
|
+
if (targets.length === 0) {
|
|
398
|
+
console.log(`gjsify upgrade --align: nothing to do. ${groups.length} dep(s) already consistent` +
|
|
399
|
+
(exact ? `, every declaration pinned exactly.` : `.`));
|
|
358
400
|
return;
|
|
359
401
|
}
|
|
360
|
-
// For each
|
|
361
|
-
//
|
|
362
|
-
//
|
|
402
|
+
// For each target, the alignment version is the highest declared one — preserve the
|
|
403
|
+
// prefix of the dominant occurrence so the range shape doesn't mutate (caret stays
|
|
404
|
+
// caret, tilde stays tilde). Under `--exact` the prefix is dropped, in `targetRange`.
|
|
363
405
|
const updates = [];
|
|
364
|
-
|
|
365
|
-
|
|
406
|
+
const unrepairable = [];
|
|
407
|
+
for (const g of targets) {
|
|
408
|
+
if (!g.highestVersion) {
|
|
409
|
+
unrepairable.push(g);
|
|
366
410
|
continue;
|
|
411
|
+
}
|
|
367
412
|
// Pick a prefix: use the prefix of the dominant range; if dominant has
|
|
368
413
|
// no prefix, default to "^" (the npm-cli default).
|
|
369
414
|
const dominantOcc = g.occurrences.find((o) => o.currentRange === g.dominantRange);
|
|
@@ -375,21 +420,24 @@ function runAlignMode(groups, args) {
|
|
|
375
420
|
occurrences: g.occurrences.map((o) => ({ ...o, prefix })),
|
|
376
421
|
});
|
|
377
422
|
}
|
|
378
|
-
if (updates.length
|
|
379
|
-
console.log(
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
423
|
+
if (updates.length > 0) {
|
|
424
|
+
console.log(exact
|
|
425
|
+
? `gjsify upgrade --align --exact: pinning ${updates.length} dep(s) to their highest declared version, without a range operator:\n`
|
|
426
|
+
: `gjsify upgrade --align: aligning ${updates.length} inconsistent dep(s) to their highest declared version:\n`);
|
|
427
|
+
for (const u of updates) {
|
|
428
|
+
const newPrefix = u.occurrences[0]?.prefix ?? '^';
|
|
429
|
+
console.log(` ${u.name.padEnd(28)} ranges: ${[...u.declaredRanges].join(', ')} → ${targetRange(newPrefix, u.latestVersion, exact)}`);
|
|
430
|
+
}
|
|
431
|
+
if (args.dryRun) {
|
|
432
|
+
console.log('\n[gjsify upgrade --align] --dry-run: no files changed.');
|
|
433
|
+
}
|
|
434
|
+
else {
|
|
435
|
+
const files = applyToFiles(updates, exact);
|
|
436
|
+
console.log(`\n✏️ updated ${updates.length} dep(s) across ${files} package.json file(s).`);
|
|
437
|
+
}
|
|
390
438
|
}
|
|
391
|
-
|
|
392
|
-
|
|
439
|
+
if (unrepairable.length > 0)
|
|
440
|
+
return reportUnrepairable(unrepairable);
|
|
393
441
|
}
|
|
394
442
|
// ─── Registry resolution (group-aware) ─────────────────────────────────
|
|
395
443
|
async function resolveCandidateGroups(groups, npmrc, verbose, mode) {
|
package/lib/config.js
CHANGED
|
@@ -5,6 +5,7 @@ import { pathToFileURL } from 'node:url';
|
|
|
5
5
|
import { isGjs, hostRuntime } from '@gjsify/rolldown-plugin-gjsify/runtime';
|
|
6
6
|
import { buildAppForRuntime } from './utils/runtimes.js';
|
|
7
7
|
import { DIALECT_APPS, isSourceDialect, SOURCE_DIALECTS } from '@gjsify/rolldown-plugin-gjsify';
|
|
8
|
+
import { GI_RENDERER_APPS } from '@gjsify/resolve-npm';
|
|
8
9
|
/**
|
|
9
10
|
* Does the failed `import()` of a config look like a MODULE-RESOLUTION failure
|
|
10
11
|
* (the config imports something GJS's ESM loader can't resolve for an external
|
|
@@ -269,6 +270,8 @@ export class Config {
|
|
|
269
270
|
configData.exclude = cliArgs.exclude || [];
|
|
270
271
|
if (cliArgs.consoleShim !== undefined)
|
|
271
272
|
configData.consoleShim = cliArgs.consoleShim;
|
|
273
|
+
if (cliArgs.giRenderer !== undefined)
|
|
274
|
+
configData.giRenderer = cliArgs.giRenderer;
|
|
272
275
|
// `--dialect` narrows here rather than at the call site. yargs `choices`
|
|
273
276
|
// already rejects an unknown value typed on the command line, but a
|
|
274
277
|
// `gjsify.dialect` in package.json or `.gjsifyrc.*` never passes through
|
|
@@ -303,6 +306,16 @@ export class Config {
|
|
|
303
306
|
`It composes on ${[...DIALECT_APPS].join(' and ')} only. ` +
|
|
304
307
|
'Drop the dialect, or build one of those targets.');
|
|
305
308
|
}
|
|
309
|
+
// Same rule for the `gi://` arm, and the same reason: `--gi-renderer --app gjs`
|
|
310
|
+
// would parse, resolve and compose nothing, so the flag would be accepted and
|
|
311
|
+
// ignored. On `gjs` and `node` the specifier is already answered — natively and
|
|
312
|
+
// through `requireGi` — so there is nothing for a renderer to substitute for.
|
|
313
|
+
if (configData.giRenderer === true && !GI_RENDERER_APPS.includes(configData.app)) {
|
|
314
|
+
throw new Error(`gjsify build: --gi-renderer has no effect on --app ${configData.app}. ` +
|
|
315
|
+
`It composes on ${GI_RENDERER_APPS.join(' and ')} only — the targets with no GObject ` +
|
|
316
|
+
'introspection to answer `gi://` with. `--app gjs` resolves it natively and `--app node` ' +
|
|
317
|
+
'through @gjsify/node-gi, so neither needs a widget renderer standing in for it.');
|
|
318
|
+
}
|
|
306
319
|
if (cliArgs.globals !== undefined)
|
|
307
320
|
configData.globals = cliArgs.globals;
|
|
308
321
|
// Fallback applied post-merge (not as a yargs `default:`) so a
|
|
@@ -36,6 +36,12 @@ export interface CliBuildOptions {
|
|
|
36
36
|
* whatever was typed, and the narrowing happens once, where the value is read.
|
|
37
37
|
*/
|
|
38
38
|
dialect?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Resolve `gi://Ns?version=X` to the target's widget renderer instead of an empty
|
|
41
|
+
* module — `--gi-renderer` (ADR 0034 stage 9). `browser` and `nativescript` targets.
|
|
42
|
+
* Default: unset; see `ConfigData.giRenderer` for why it is opt-in.
|
|
43
|
+
*/
|
|
44
|
+
giRenderer?: boolean;
|
|
39
45
|
/**
|
|
40
46
|
* Comma-separated global identifiers the code needs, e.g.
|
|
41
47
|
* `"fetch,Buffer,process,URL,crypto"`. Each maps to the corresponding
|
|
@@ -96,6 +96,20 @@ export interface ConfigData {
|
|
|
96
96
|
* see the header of `SourceDialect`.
|
|
97
97
|
*/
|
|
98
98
|
dialect?: SourceDialect;
|
|
99
|
+
/**
|
|
100
|
+
* Resolve `gi://Ns?version=X` to the target's widget renderer rather than to an
|
|
101
|
+
* empty module (ADR 0034 stage 9). `--app browser` answers out of
|
|
102
|
+
* `@gjsify/adwaita-web`, `--app nativescript` out of `@gjsify/adwaita-nativescript`;
|
|
103
|
+
* `GI_RENDERERS` in `@gjsify/resolve-npm` is the table, and a target with no row
|
|
104
|
+
* there has no arm. Default: unset.
|
|
105
|
+
*
|
|
106
|
+
* Opt-in, never inferred: a `gi://` import reaching one of those targets today is
|
|
107
|
+
* usually a GJS-only code path pulled in transitively, which the empty module
|
|
108
|
+
* silences on purpose. On by default it would pull a widget toolkit into bundles
|
|
109
|
+
* that never named one, and turn every unanswerable namespace from a silent stub
|
|
110
|
+
* into a hard build failure.
|
|
111
|
+
*/
|
|
112
|
+
giRenderer?: boolean;
|
|
99
113
|
/** Comma-separated global identifiers to register. Format: see CliBuildOptions. */
|
|
100
114
|
globals?: string;
|
|
101
115
|
/**
|
|
@@ -233,6 +233,37 @@ export declare function resolveHostLibc(input: {
|
|
|
233
233
|
* reach it.
|
|
234
234
|
*/
|
|
235
235
|
export declare function detectHostLibc(platform: string): HostLibc | null;
|
|
236
|
+
/**
|
|
237
|
+
* The packages a musl host had to take the DEFAULT prebuild of, because they ship
|
|
238
|
+
* no `-musl` directory — the fallback {@link hostPlatformTokens} deliberately
|
|
239
|
+
* allows, named so a caller can report it. Returns names and prints nothing: this
|
|
240
|
+
* module resolves, and `libc` is a parameter for the same reason it is on every
|
|
241
|
+
* other function here (there is no musl runner in this repo's CI, so an injected
|
|
242
|
+
* `libc: 'musl'` is the only way the branch executes).
|
|
243
|
+
*
|
|
244
|
+
* Why a fallback that mostly WORKS is worth naming. musl's loader resolves
|
|
245
|
+
* `libc.so.6`/`libm.so.6` to itself, so a glibc-linked prebuild loads — and a
|
|
246
|
+
* bridge that records no libc at all then runs correctly, which is why the
|
|
247
|
+
* fallback exists rather than resolving to null. The one that is NOT agnostic dies
|
|
248
|
+
* at `dlopen` on its first glibc-only symbol, far from its cause. Measured on a
|
|
249
|
+
* OnePlus 6 (postmarketOS v26.06, musl 1.2.6, aarch64, gjs 1.88.1) against the
|
|
250
|
+
* published 0.48.0 train: nine of ten prebuilds loaded, while
|
|
251
|
+
* `@gjsify/lightningcss-native-linux-arm64` answered `gnu_get_libc_version: symbol
|
|
252
|
+
* not found`. `gjsify install` had printed "System dependencies OK", and the first
|
|
253
|
+
* symptom was rolldown reporting `Could not load src/application.css` — the CSS
|
|
254
|
+
* bridge silently absent from the bundle. Nothing in that chain names libc, which
|
|
255
|
+
* is what makes the report worth more than the failure.
|
|
256
|
+
*
|
|
257
|
+
* Membership goes through {@link parsePlatformToken}, not the suffix constant, so
|
|
258
|
+
* this does not become a second reader of the libc half of the token grammar —
|
|
259
|
+
* `darwin-arm64-musl` is a malformed token rather than a musl build, and only the
|
|
260
|
+
* grammar knows that.
|
|
261
|
+
*
|
|
262
|
+
* TODO(open-todos: `-musl` prebuild package is published): naming the fallback is
|
|
263
|
+
* not fixing it. No `-musl` target is published for any bridge, so on a musl host
|
|
264
|
+
* this reports every prebuild in the tree and there is nothing to fall back FROM.
|
|
265
|
+
*/
|
|
266
|
+
export declare function muslPrebuildFallbacks(libc: HostLibc | null, packages: readonly NativePackage[]): string[];
|
|
236
267
|
/**
|
|
237
268
|
* The environment-variable name the host's dynamic loader consults for an
|
|
238
269
|
* additional shared-library search path, plus the separator its search paths
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
// win32 AND musl branches unit-testable from a glibc Linux host. The host values
|
|
23
23
|
// are read only at the outermost call site, as a default.
|
|
24
24
|
import { readdirSync, existsSync } from 'node:fs';
|
|
25
|
-
import { join, resolve } from 'node:path';
|
|
25
|
+
import { basename, join, resolve } from 'node:path';
|
|
26
26
|
import { readPackageJson } from './pkg-json.js';
|
|
27
27
|
import { composeDyldFallback, systemGiLibraryDirs } from './system-gi.js';
|
|
28
28
|
/**
|
|
@@ -500,6 +500,42 @@ export function detectHostLibc(platform) {
|
|
|
500
500
|
const muslLoaderPresent = existsSync('/lib') && readdirSync('/lib').some((f) => f.startsWith('ld-musl-'));
|
|
501
501
|
return resolveHostLibc({ platform, glibcVersionRuntime, muslLoaderPresent });
|
|
502
502
|
}
|
|
503
|
+
/**
|
|
504
|
+
* The packages a musl host had to take the DEFAULT prebuild of, because they ship
|
|
505
|
+
* no `-musl` directory — the fallback {@link hostPlatformTokens} deliberately
|
|
506
|
+
* allows, named so a caller can report it. Returns names and prints nothing: this
|
|
507
|
+
* module resolves, and `libc` is a parameter for the same reason it is on every
|
|
508
|
+
* other function here (there is no musl runner in this repo's CI, so an injected
|
|
509
|
+
* `libc: 'musl'` is the only way the branch executes).
|
|
510
|
+
*
|
|
511
|
+
* Why a fallback that mostly WORKS is worth naming. musl's loader resolves
|
|
512
|
+
* `libc.so.6`/`libm.so.6` to itself, so a glibc-linked prebuild loads — and a
|
|
513
|
+
* bridge that records no libc at all then runs correctly, which is why the
|
|
514
|
+
* fallback exists rather than resolving to null. The one that is NOT agnostic dies
|
|
515
|
+
* at `dlopen` on its first glibc-only symbol, far from its cause. Measured on a
|
|
516
|
+
* OnePlus 6 (postmarketOS v26.06, musl 1.2.6, aarch64, gjs 1.88.1) against the
|
|
517
|
+
* published 0.48.0 train: nine of ten prebuilds loaded, while
|
|
518
|
+
* `@gjsify/lightningcss-native-linux-arm64` answered `gnu_get_libc_version: symbol
|
|
519
|
+
* not found`. `gjsify install` had printed "System dependencies OK", and the first
|
|
520
|
+
* symptom was rolldown reporting `Could not load src/application.css` — the CSS
|
|
521
|
+
* bridge silently absent from the bundle. Nothing in that chain names libc, which
|
|
522
|
+
* is what makes the report worth more than the failure.
|
|
523
|
+
*
|
|
524
|
+
* Membership goes through {@link parsePlatformToken}, not the suffix constant, so
|
|
525
|
+
* this does not become a second reader of the libc half of the token grammar —
|
|
526
|
+
* `darwin-arm64-musl` is a malformed token rather than a musl build, and only the
|
|
527
|
+
* grammar knows that.
|
|
528
|
+
*
|
|
529
|
+
* TODO(open-todos: `-musl` prebuild package is published): naming the fallback is
|
|
530
|
+
* not fixing it. No `-musl` target is published for any bridge, so on a musl host
|
|
531
|
+
* this reports every prebuild in the tree and there is nothing to fall back FROM.
|
|
532
|
+
*/
|
|
533
|
+
export function muslPrebuildFallbacks(libc, packages) {
|
|
534
|
+
if (libc !== 'musl')
|
|
535
|
+
return [];
|
|
536
|
+
const fellBack = packages.filter((pkg) => parsePlatformToken(basename(pkg.prebuildsDir)).libc !== 'musl');
|
|
537
|
+
return fellBack.map((pkg) => pkg.name);
|
|
538
|
+
}
|
|
503
539
|
/**
|
|
504
540
|
* The environment-variable name the host's dynamic loader consults for an
|
|
505
541
|
* additional shared-library search path, plus the separator its search paths
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.49.0",
|
|
4
4
|
"description": "CLI for Gjsify",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -142,21 +142,21 @@
|
|
|
142
142
|
"cli"
|
|
143
143
|
],
|
|
144
144
|
"dependencies": {
|
|
145
|
-
"@gjsify/buffer": "^0.
|
|
146
|
-
"@gjsify/create-app": "^0.
|
|
147
|
-
"@gjsify/node-globals": "^0.
|
|
148
|
-
"@gjsify/node-polyfills": "^0.
|
|
149
|
-
"@gjsify/npm-registry": "^0.
|
|
150
|
-
"@gjsify/resolve-npm": "^0.
|
|
151
|
-
"@gjsify/rolldown-plugin-gjsify": "^0.
|
|
152
|
-
"@gjsify/vite-plugin-blueprint": "^0.
|
|
153
|
-
"@gjsify/rolldown-plugin-pnp": "^0.
|
|
154
|
-
"@gjsify/semver": "^0.
|
|
155
|
-
"@gjsify/tar": "^0.
|
|
156
|
-
"@gjsify/tsc": "^0.
|
|
157
|
-
"@gjsify/utils": "^0.
|
|
158
|
-
"@gjsify/web-polyfills": "^0.
|
|
159
|
-
"@gjsify/workspace": "^0.
|
|
145
|
+
"@gjsify/buffer": "^0.49.0",
|
|
146
|
+
"@gjsify/create-app": "^0.49.0",
|
|
147
|
+
"@gjsify/node-globals": "^0.49.0",
|
|
148
|
+
"@gjsify/node-polyfills": "^0.49.0",
|
|
149
|
+
"@gjsify/npm-registry": "^0.49.0",
|
|
150
|
+
"@gjsify/resolve-npm": "^0.49.0",
|
|
151
|
+
"@gjsify/rolldown-plugin-gjsify": "^0.49.0",
|
|
152
|
+
"@gjsify/vite-plugin-blueprint": "^0.49.0",
|
|
153
|
+
"@gjsify/rolldown-plugin-pnp": "^0.49.0",
|
|
154
|
+
"@gjsify/semver": "^0.49.0",
|
|
155
|
+
"@gjsify/tar": "^0.49.0",
|
|
156
|
+
"@gjsify/tsc": "^0.49.0",
|
|
157
|
+
"@gjsify/utils": "^0.49.0",
|
|
158
|
+
"@gjsify/web-polyfills": "^0.49.0",
|
|
159
|
+
"@gjsify/workspace": "^0.49.0",
|
|
160
160
|
"acorn": "^8.17.0",
|
|
161
161
|
"cosmiconfig": "^9.0.2",
|
|
162
162
|
"get-tsconfig": "^4.14.0",
|
|
@@ -165,13 +165,13 @@
|
|
|
165
165
|
"yargs": "^18.0.0"
|
|
166
166
|
},
|
|
167
167
|
"devDependencies": {
|
|
168
|
-
"@gjsify/unit": "^0.
|
|
168
|
+
"@gjsify/unit": "^0.49.0",
|
|
169
169
|
"@types/yargs": "^17.0.35",
|
|
170
170
|
"typescript": "^6.0.3"
|
|
171
171
|
},
|
|
172
172
|
"peerDependencies": {
|
|
173
|
-
"@gjsify/oxfmt-native": "^0.
|
|
174
|
-
"@gjsify/rolldown-native": "^0.
|
|
173
|
+
"@gjsify/oxfmt-native": "^0.49.0",
|
|
174
|
+
"@gjsify/rolldown-native": "^0.49.0"
|
|
175
175
|
},
|
|
176
176
|
"peerDependenciesMeta": {
|
|
177
177
|
"@gjsify/oxfmt-native": {
|