@gjsify/cli 0.64.3-next.258 → 0.64.3-next.260
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 +131 -130
- package/lib/types/config-data.d.ts +28 -0
- package/lib/utils/ship/discover.d.ts +12 -0
- package/lib/utils/ship/discover.js +24 -1
- package/lib/utils/ship/launcher.js +10 -0
- package/lib/utils/ship/plan.js +21 -0
- package/lib/utils/ship/settings.d.ts +2 -0
- package/lib/utils/ship/settings.js +1 -0
- package/lib/utils/ship/types.d.ts +8 -0
- package/package.json +21 -21
|
@@ -606,6 +606,19 @@ export interface ConfigDataShip extends AppMetadata {
|
|
|
606
606
|
* bundle seal and `dlopen` both refuse. A target with no key stages nothing.
|
|
607
607
|
*/
|
|
608
608
|
bundledTypelibs?: string[] | ShipBundledTypelibsOptions;
|
|
609
|
+
/**
|
|
610
|
+
* Additions for ONE package format — `deb` or `rpm` — on top of everything above.
|
|
611
|
+
*
|
|
612
|
+
* Exists for a library the distros disagree about: one that Fedora ships and Ubuntu does
|
|
613
|
+
* not (libgda 6), where the `.rpm` should use the system copy and only the `.deb` needs to
|
|
614
|
+
* carry its own. `bundledTypelibs` and `extraFiles` are staged for every format of a
|
|
615
|
+
* layout, so there is no way to say "the `.deb` only" with them.
|
|
616
|
+
*
|
|
617
|
+
* What a format carries here is read back off its package like any other staged file, so a
|
|
618
|
+
* namespace bundled this way no longer becomes a `Depends:` entry of THAT package — and
|
|
619
|
+
* still does in the other format's.
|
|
620
|
+
*/
|
|
621
|
+
formats?: Partial<Record<'deb' | 'rpm', ShipFormatOptions>>;
|
|
609
622
|
/**
|
|
610
623
|
* Directory holding COMPILED gettext catalogues in the layout `bindtextdomain` reads —
|
|
611
624
|
* `<lang>/LC_MESSAGES/<domain>.mo` — e.g. `"dist/locale"`, which is what
|
|
@@ -708,6 +721,21 @@ export interface ShipBundleOptions {
|
|
|
708
721
|
/** The entry the Windows program directory carries. */
|
|
709
722
|
win32?: string;
|
|
710
723
|
}
|
|
724
|
+
/** One entry of `gjsify.ship.formats`: the staged files only that package format carries. */
|
|
725
|
+
export interface ShipFormatOptions {
|
|
726
|
+
/**
|
|
727
|
+
* Directories whose `*.typelib` and shared libraries this format carries, staged flat into
|
|
728
|
+
* `lib/<name>/gi/` like {@link ConfigDataShip.bundledTypelibs}. The launcher puts that
|
|
729
|
+
* directory on `GI_TYPELIB_PATH` and `LD_LIBRARY_PATH` when it exists.
|
|
730
|
+
*/
|
|
731
|
+
bundledTypelibs?: string[];
|
|
732
|
+
/**
|
|
733
|
+
* Destination (relative to the install prefix) → source file, like
|
|
734
|
+
* {@link ConfigDataShip.extraFiles} but for this format only, e.g. a plugin directory the
|
|
735
|
+
* bundled library finds by a path baked in at build time.
|
|
736
|
+
*/
|
|
737
|
+
extraFiles?: Record<string, string>;
|
|
738
|
+
}
|
|
711
739
|
/**
|
|
712
740
|
* `gjsify.ship.bundledTypelibs` as a table — the directories per OS, the twin of
|
|
713
741
|
* {@link ShipBundleOptions}.
|
|
@@ -33,6 +33,18 @@ export declare function discoverPayload(input: DiscoverInput): DiscoveredPayload
|
|
|
33
33
|
* `windows` would otherwise leave that target without its typelib and print nothing.
|
|
34
34
|
*/
|
|
35
35
|
export declare function resolveBundledTypelibs(declared: string[] | ShipBundledTypelibsOptions | undefined, layoutOs: HostOs | undefined): string[];
|
|
36
|
+
/**
|
|
37
|
+
* Typelibs (and their shared libraries) the PROJECT ships itself.
|
|
38
|
+
*
|
|
39
|
+
* Necessary because gjsify's own GI libraries — `Gwebgl` for the WebGL bridge, the GTK runtime
|
|
40
|
+
* bundles, the napi host — arrive as npm prebuilds, not as distro packages. An app using one has
|
|
41
|
+
* no `gir1.2-…` to depend on: it must carry the files, and something must point GI at them.
|
|
42
|
+
*
|
|
43
|
+
* A directory rather than a list of files, because a typelib is never alone: `Gwebgl-0.1.typelib`
|
|
44
|
+
* is useless without `libgwebgl.so`, and staging one without the other produces a package that
|
|
45
|
+
* installs and then fails at the first import.
|
|
46
|
+
*/
|
|
47
|
+
export declare function discoverTypelibs(projectDir: string, dirs: string[] | undefined): string[];
|
|
36
48
|
/**
|
|
37
49
|
* Every regular file under `dir`, as POSIX-separated relative paths.
|
|
38
50
|
*
|
|
@@ -52,12 +52,35 @@ export function discoverPayload(input) {
|
|
|
52
52
|
iconFiles: discoverIcons(projectDir, ship.icon ?? input.flatpakIcon),
|
|
53
53
|
schemaFiles: discoverSchemas(projectDir, ship.schemas),
|
|
54
54
|
typelibFiles: discoverTypelibs(projectDir, resolveBundledTypelibs(ship.bundledTypelibs, input.layoutOs)),
|
|
55
|
+
formatFiles: discoverFormatFiles(projectDir, ship, input.layoutOs),
|
|
55
56
|
localeFiles,
|
|
56
57
|
fontFiles: discoverFonts(projectDir, ship.fonts),
|
|
57
58
|
licenseFile: discoverLicense(projectDir, ship.licenseFile),
|
|
58
59
|
changelogFile: discoverChangelog(projectDir, ship.changelogFile),
|
|
59
60
|
};
|
|
60
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* `gjsify.ship.formats`, resolved to absolute paths. A key other than `deb`/`rpm` is refused: a
|
|
64
|
+
* format that is not a distro package has no overlay to carry the files, so they would be
|
|
65
|
+
* dropped without a word.
|
|
66
|
+
*/
|
|
67
|
+
function discoverFormatFiles(projectDir, ship, layoutOs) {
|
|
68
|
+
const out = {};
|
|
69
|
+
// deb and rpm exist on the Linux layout only. Looking for their files while assembling a macOS or
|
|
70
|
+
// Windows target would fail on a directory that only the Linux build produces.
|
|
71
|
+
if (layoutOs !== undefined && layoutOs !== 'linux')
|
|
72
|
+
return out;
|
|
73
|
+
for (const [id, options] of Object.entries(ship.formats ?? {})) {
|
|
74
|
+
if (id !== 'deb' && id !== 'rpm') {
|
|
75
|
+
throw new Error(`gjsify ship: \`gjsify.ship.formats.${id}\` is not a format that carries its own files. Known: deb, rpm.`);
|
|
76
|
+
}
|
|
77
|
+
out[id] = {
|
|
78
|
+
typelibFiles: discoverTypelibs(projectDir, options?.bundledTypelibs),
|
|
79
|
+
extraFiles: Object.fromEntries(Object.entries(options?.extraFiles ?? {}).map(([dest, source]) => [dest, resolve(projectDir, source)])),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return out;
|
|
83
|
+
}
|
|
61
84
|
/**
|
|
62
85
|
* The directories `gjsify.ship.bundledTypelibs` names for ONE layout.
|
|
63
86
|
*
|
|
@@ -92,7 +115,7 @@ export function resolveBundledTypelibs(declared, layoutOs) {
|
|
|
92
115
|
* is useless without `libgwebgl.so`, and staging one without the other produces a package that
|
|
93
116
|
* installs and then fails at the first import.
|
|
94
117
|
*/
|
|
95
|
-
function discoverTypelibs(projectDir, dirs) {
|
|
118
|
+
export function discoverTypelibs(projectDir, dirs) {
|
|
96
119
|
const out = [];
|
|
97
120
|
for (const dir of dirs ?? []) {
|
|
98
121
|
const root = resolve(projectDir, dir);
|
|
@@ -143,6 +143,16 @@ function renderPrefixLauncher(settings, bundleRelPath, layout) {
|
|
|
143
143
|
lines.push(`${variable}=${giDir}\${${variable}:+:$${variable}}`, `export ${variable}`);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
+
// Typelibs only one format carries (`gjsify.ship.formats`). The launcher is shared by the
|
|
147
|
+
// layout, so the directory is tested at run time instead of decided here.
|
|
148
|
+
else if (Object.values(settings.formatFiles).some((f) => f.typelibFiles.length > 0)) {
|
|
149
|
+
const giDir = `"$prefix"/${dirs.native}`;
|
|
150
|
+
lines.push(`if [ -d ${giDir} ]; then`);
|
|
151
|
+
for (const variable of ['GI_TYPELIB_PATH', 'LD_LIBRARY_PATH']) {
|
|
152
|
+
lines.push(` ${variable}=${giDir}\${${variable}:+:$${variable}}`, ` export ${variable}`);
|
|
153
|
+
}
|
|
154
|
+
lines.push('fi');
|
|
155
|
+
}
|
|
146
156
|
// Where the app's gettext catalogues landed. `bindtextdomain` takes a DIRECTORY and there is no
|
|
147
157
|
// standard environment variable it reads on its own (`TEXTDOMAINDIR` is honoured by the gettext
|
|
148
158
|
// command-line tools, not by the library), so the prefix has to reach the app somehow. Passing
|
package/lib/utils/ship/plan.js
CHANGED
|
@@ -7,6 +7,7 @@ import { gzipDeterministic, POLICY_MAX_COMPRESSION } from './gzip.js';
|
|
|
7
7
|
import { iconThemeDir, isSymbolicIcon } from './icons.js';
|
|
8
8
|
import { renderMimePackage } from './mime.js';
|
|
9
9
|
import { SHARE } from './share-dirs.js';
|
|
10
|
+
import { readFile } from 'node:fs/promises';
|
|
10
11
|
import { basename, extname, posix } from 'node:path';
|
|
11
12
|
/**
|
|
12
13
|
* Build the prefix-relative payload.
|
|
@@ -190,6 +191,26 @@ export async function planOverlay(settings, format, inputs) {
|
|
|
190
191
|
},
|
|
191
192
|
});
|
|
192
193
|
}
|
|
194
|
+
// `gjsify.ship.formats.<id>`: files only THIS format carries (a library built against the
|
|
195
|
+
// distro's own sonames cannot ship in the other format). Typelibs land beside the bundle in
|
|
196
|
+
// `gi/`, where the launcher's guarded block finds them.
|
|
197
|
+
// READ here, as the changelog is compressed here: a stage manifest carries rendered bytes only
|
|
198
|
+
// (`--from-stage` rehydrates the overlay from the sidecar and never touches the project).
|
|
199
|
+
const own = settings.formatFiles[format.id];
|
|
200
|
+
for (const file of own?.typelibFiles ?? []) {
|
|
201
|
+
files.push({
|
|
202
|
+
path: posix.join('lib', settings.binaryName, 'gi', basename(file)),
|
|
203
|
+
mode: 0o755,
|
|
204
|
+
source: { kind: 'bytes', data: new Uint8Array(await readFile(file)) },
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
for (const [dest, source] of Object.entries(own?.extraFiles ?? {})) {
|
|
208
|
+
files.push({
|
|
209
|
+
path: assertInsidePrefix(dest),
|
|
210
|
+
mode: dest.endsWith('.so') ? 0o755 : 0o644,
|
|
211
|
+
source: { kind: 'bytes', data: new Uint8Array(await readFile(source)) },
|
|
212
|
+
});
|
|
213
|
+
}
|
|
193
214
|
return files;
|
|
194
215
|
}
|
|
195
216
|
/**
|
|
@@ -29,6 +29,8 @@ export interface DiscoveredPayload {
|
|
|
29
29
|
schemaFiles: string[];
|
|
30
30
|
/** Absolute paths of the typelibs + shared libraries the project ships itself. */
|
|
31
31
|
typelibFiles: string[];
|
|
32
|
+
/** Per-format typelibs + files (`gjsify.ship.formats`), keyed by format id. */
|
|
33
|
+
formatFiles: ShipSettings['formatFiles'];
|
|
32
34
|
/** Compiled gettext catalogues, each with its `<lang>/LC_MESSAGES/<domain>.mo` path. */
|
|
33
35
|
localeFiles: {
|
|
34
36
|
rel: string;
|
|
@@ -216,6 +216,7 @@ export function resolveShipSettings(input) {
|
|
|
216
216
|
iconFiles: discovered.iconFiles,
|
|
217
217
|
schemaFiles: discovered.schemaFiles,
|
|
218
218
|
typelibFiles: discovered.typelibFiles,
|
|
219
|
+
formatFiles: discovered.formatFiles,
|
|
219
220
|
localeFiles: discovered.localeFiles,
|
|
220
221
|
fontFiles: discovered.fontFiles,
|
|
221
222
|
extraFiles: ship.extraFiles ?? {},
|
|
@@ -473,6 +473,14 @@ export interface ShipSettings extends PackSettings {
|
|
|
473
473
|
* has nothing to depend on and must ship the files — with the launcher pointing GI at them.
|
|
474
474
|
*/
|
|
475
475
|
typelibFiles: string[];
|
|
476
|
+
/**
|
|
477
|
+
* What ONLY one package format carries (`gjsify.ship.formats`), resolved to absolute paths.
|
|
478
|
+
* Staged into that format's overlay, not the shared payload — which is the whole point.
|
|
479
|
+
*/
|
|
480
|
+
formatFiles: Partial<Record<DistroFormatId, {
|
|
481
|
+
typelibFiles: string[];
|
|
482
|
+
extraFiles: Record<string, string>;
|
|
483
|
+
}>>;
|
|
476
484
|
/**
|
|
477
485
|
* Compiled gettext catalogues (`gjsify.ship.localeDir`), each keeping its
|
|
478
486
|
* `<lang>/LC_MESSAGES/<domain>.mo` path so `share/locale/` comes out in the layout
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/cli",
|
|
3
|
-
"version": "0.64.3-next.
|
|
3
|
+
"version": "0.64.3-next.260",
|
|
4
4
|
"description": "CLI for Gjsify",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -142,22 +142,22 @@
|
|
|
142
142
|
"cli"
|
|
143
143
|
],
|
|
144
144
|
"dependencies": {
|
|
145
|
-
"@gjsify/blueprint": "0.64.3-next.
|
|
146
|
-
"@gjsify/buffer": "0.64.3-next.
|
|
147
|
-
"@gjsify/create-app": "0.64.3-next.
|
|
148
|
-
"@gjsify/node-globals": "0.64.3-next.
|
|
149
|
-
"@gjsify/node-polyfills": "0.64.3-next.
|
|
150
|
-
"@gjsify/npm-registry": "0.64.3-next.
|
|
151
|
-
"@gjsify/resolve-npm": "0.64.3-next.
|
|
152
|
-
"@gjsify/rolldown-plugin-gjsify": "0.64.3-next.
|
|
153
|
-
"@gjsify/vite-plugin-blueprint": "0.64.3-next.
|
|
154
|
-
"@gjsify/rolldown-plugin-pnp": "0.64.3-next.
|
|
155
|
-
"@gjsify/semver": "0.64.3-next.
|
|
156
|
-
"@gjsify/tar": "0.64.3-next.
|
|
157
|
-
"@gjsify/tsc": "0.64.3-next.
|
|
158
|
-
"@gjsify/utils": "0.64.3-next.
|
|
159
|
-
"@gjsify/web-polyfills": "0.64.3-next.
|
|
160
|
-
"@gjsify/workspace": "0.64.3-next.
|
|
145
|
+
"@gjsify/blueprint": "0.64.3-next.260",
|
|
146
|
+
"@gjsify/buffer": "0.64.3-next.260",
|
|
147
|
+
"@gjsify/create-app": "0.64.3-next.260",
|
|
148
|
+
"@gjsify/node-globals": "0.64.3-next.260",
|
|
149
|
+
"@gjsify/node-polyfills": "0.64.3-next.260",
|
|
150
|
+
"@gjsify/npm-registry": "0.64.3-next.260",
|
|
151
|
+
"@gjsify/resolve-npm": "0.64.3-next.260",
|
|
152
|
+
"@gjsify/rolldown-plugin-gjsify": "0.64.3-next.260",
|
|
153
|
+
"@gjsify/vite-plugin-blueprint": "0.64.3-next.260",
|
|
154
|
+
"@gjsify/rolldown-plugin-pnp": "0.64.3-next.260",
|
|
155
|
+
"@gjsify/semver": "0.64.3-next.260",
|
|
156
|
+
"@gjsify/tar": "0.64.3-next.260",
|
|
157
|
+
"@gjsify/tsc": "0.64.3-next.260",
|
|
158
|
+
"@gjsify/utils": "0.64.3-next.260",
|
|
159
|
+
"@gjsify/web-polyfills": "0.64.3-next.260",
|
|
160
|
+
"@gjsify/workspace": "0.64.3-next.260",
|
|
161
161
|
"acorn": "^8.17.0",
|
|
162
162
|
"cosmiconfig": "^9.0.2",
|
|
163
163
|
"get-tsconfig": "^4.14.0",
|
|
@@ -166,13 +166,13 @@
|
|
|
166
166
|
"yargs": "^18.0.0"
|
|
167
167
|
},
|
|
168
168
|
"devDependencies": {
|
|
169
|
-
"@gjsify/unit": "0.64.3-next.
|
|
169
|
+
"@gjsify/unit": "0.64.3-next.260",
|
|
170
170
|
"@types/yargs": "^17.0.35",
|
|
171
171
|
"typescript": "^6.0.3"
|
|
172
172
|
},
|
|
173
173
|
"peerDependencies": {
|
|
174
|
-
"@gjsify/oxfmt-native": "0.64.3-next.
|
|
175
|
-
"@gjsify/rolldown-native": "0.64.3-next.
|
|
174
|
+
"@gjsify/oxfmt-native": "0.64.3-next.260",
|
|
175
|
+
"@gjsify/rolldown-native": "0.64.3-next.260"
|
|
176
176
|
},
|
|
177
177
|
"peerDependenciesMeta": {
|
|
178
178
|
"@gjsify/oxfmt-native": {
|
|
@@ -192,5 +192,5 @@
|
|
|
192
192
|
"url": "https://github.com/gjsify/gjsify/issues"
|
|
193
193
|
},
|
|
194
194
|
"homepage": "https://github.com/gjsify/gjsify/tree/main/packages/infra/cli#readme",
|
|
195
|
-
"gitHead": "
|
|
195
|
+
"gitHead": "886de21be840429ce043cdbf8195172530e230d4"
|
|
196
196
|
}
|