@gjsify/cli 0.42.0 → 0.44.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.
Files changed (51) hide show
  1. package/dist/cli.gjs.mjs +444 -415
  2. package/lib/actions/build.d.ts +6 -0
  3. package/lib/actions/build.js +66 -9
  4. package/lib/commands/affected-classify.js +7 -5
  5. package/lib/commands/build.js +6 -0
  6. package/lib/commands/flatpak/ci.js +10 -2
  7. package/lib/commands/flatpak/init.js +15 -16
  8. package/lib/commands/flatpak/utils.d.ts +0 -26
  9. package/lib/commands/flatpak/utils.js +4 -29
  10. package/lib/commands/ship.d.ts +2 -0
  11. package/lib/commands/ship.js +358 -104
  12. package/lib/config.js +25 -0
  13. package/lib/types/cli-build-options.d.ts +11 -0
  14. package/lib/types/config-data.d.ts +106 -2
  15. package/lib/utils/flatpak-runtime.d.ts +41 -0
  16. package/lib/utils/flatpak-runtime.js +54 -0
  17. package/lib/utils/gjs-bundle-guard.d.ts +57 -3
  18. package/lib/utils/gjs-bundle-guard.js +122 -13
  19. package/lib/utils/jsx-config.d.ts +45 -0
  20. package/lib/utils/jsx-config.js +98 -0
  21. package/lib/utils/onboard-probe.d.ts +23 -0
  22. package/lib/utils/onboard-probe.js +65 -0
  23. package/lib/utils/ship/deb.d.ts +3 -3
  24. package/lib/utils/ship/deb.js +6 -2
  25. package/lib/utils/ship/depends.d.ts +13 -13
  26. package/lib/utils/ship/depends.js +25 -3
  27. package/lib/utils/ship/discover.js +72 -6
  28. package/lib/utils/ship/flatpak-config.d.ts +66 -0
  29. package/lib/utils/ship/flatpak-config.js +132 -0
  30. package/lib/utils/ship/flatpak.d.ts +45 -0
  31. package/lib/utils/ship/flatpak.js +148 -0
  32. package/lib/utils/ship/formats.d.ts +35 -0
  33. package/lib/utils/ship/formats.js +152 -5
  34. package/lib/utils/ship/mime.d.ts +19 -0
  35. package/lib/utils/ship/mime.js +89 -0
  36. package/lib/utils/ship/payload.d.ts +76 -0
  37. package/lib/utils/ship/payload.js +91 -1
  38. package/lib/utils/ship/plan.d.ts +30 -1
  39. package/lib/utils/ship/plan.js +54 -2
  40. package/lib/utils/ship/rpm.d.ts +3 -3
  41. package/lib/utils/ship/rpm.js +20 -3
  42. package/lib/utils/ship/scripts.d.ts +14 -4
  43. package/lib/utils/ship/scripts.js +26 -8
  44. package/lib/utils/ship/settings.js +20 -0
  45. package/lib/utils/ship/stage-manifest.d.ts +163 -0
  46. package/lib/utils/ship/stage-manifest.js +445 -0
  47. package/lib/utils/ship/stage-writer.d.ts +30 -3
  48. package/lib/utils/ship/stage-writer.js +76 -9
  49. package/lib/utils/ship/types.d.ts +203 -27
  50. package/lib/utils/ship/types.js +5 -0
  51. package/package.json +19 -19
@@ -72,6 +72,12 @@ export declare class BuildAction {
72
72
  * natively, `@gjsify/rolldown-native` via `synthRolldownOutput`), and it
73
73
  * cannot be fooled by a `node:` specifier quoted inside a string, which a
74
74
  * text scan cannot tell from a statement.
75
+ *
76
+ * The same list also answers the GENERAL form of the question — any bare
77
+ * specifier GJS cannot resolve, `node:` or not — which is why the target's
78
+ * externals predicate and the emitted fileNames are handed over: they are
79
+ * what separates a declared external and a sibling chunk from a dependency
80
+ * that simply is not there.
75
81
  */
76
82
  private assertGjsOutputLoadable;
77
83
  /**
@@ -1,5 +1,5 @@
1
1
  import { runBundle, runWatch, bundleToChunks } from '../bundler-pick.js';
2
- import { gjsifyPlugin, textLoaderPlugin, resolveShebangLine, NODE_SHEBANG } from '@gjsify/rolldown-plugin-gjsify';
2
+ import { gjsifyPlugin, textLoaderPlugin, resolveShebangLine, NODE_SHEBANG, createGjsExternalsPredicate, globToEntryPoints, } from '@gjsify/rolldown-plugin-gjsify';
3
3
  import { isGjs } from '@gjsify/rolldown-plugin-gjsify/runtime';
4
4
  import { resolveUserPlugins } from '../utils/resolve-plugin-by-name.js';
5
5
  import { resolveGlobalsList, writeRegisterInjectFile, detectAutoGlobals, detectNodeGiGlobals, } from '@gjsify/rolldown-plugin-gjsify/globals';
@@ -10,7 +10,8 @@ import { chmod, mkdir, readdir, readFile, stat, writeFile } from 'node:fs/promis
10
10
  import { normalizeBundlerOptions, mergeBundlerOptions } from '../utils/normalize-bundler-options.js';
11
11
  import { inputSourceDirs, isOutdirInsideSource, libraryOutputLeakError } from '../utils/library-output.js';
12
12
  import { detectHtmlEntry, parseHtmlEntry, emitBrowserHtml, htmlOutPathFor } from '../utils/html-entry.js';
13
- import { assertGjsBundleLoadable } from '../utils/gjs-bundle-guard.js';
13
+ import { assertGjsBundleLoadable, assertGjsBundleParses } from '../utils/gjs-bundle-guard.js';
14
+ import { collectEntryPaths, describeJsxConfig, findJsxEntryPoint, jsxConfigMissingError } from '../utils/jsx-config.js';
14
15
  import { giSystemProbes } from '../utils/gi-runtime-paths.js';
15
16
  import { escapeRawNulForGjs } from '../utils/gjs-source-escape.js';
16
17
  import { assertNodeBundleGlobalsShimmed } from '../utils/node-bundle-guard.js';
@@ -149,6 +150,21 @@ export class BuildAction {
149
150
  const multipleBuilds = moduleOutdir && mainOutdir && moduleOutdir !== mainOutdir;
150
151
  const pnp = await buildPnpPlugin();
151
152
  const pnpPlugins = pnp ? [pnp] : [];
153
+ // The same chain `buildApp` assembles, and it was missing here entirely:
154
+ // a library build resolved NO user plugin and NO user text loader, then
155
+ // emitted the default transform at exit 0. Configuring
156
+ // `gjsify.bundler.plugins` and watching it do nothing is the repo's most
157
+ // expensive failure shape, and `@gjsify/gtk-host` itself builds with
158
+ // `--library` — which is where it was found.
159
+ const userTextLoader = textLoaderPlugin({ loaders: this.configData.loaders });
160
+ const userPlugins = userTextLoader ? [userTextLoader] : [];
161
+ if (userBundler.plugins?.length) {
162
+ // Under GJS a plugin module cannot always be imported directly — the
163
+ // native ESM loader does not follow `package.json#exports` — so the
164
+ // same bundle-then-import escape the app path uses is passed in here.
165
+ const resolved = await resolveUserPlugins(userBundler.plugins, process.cwd(), isGjs() ? { loadModule: (pth, name) => this.loadPluginViaGjsBundle(pth, name, verbose) } : {});
166
+ userPlugins.push(...resolved);
167
+ }
152
168
  const results = [];
153
169
  if (multipleBuilds) {
154
170
  // Both outdirs are derived from module/main — always guard them
@@ -168,6 +184,7 @@ export class BuildAction {
168
184
  output: { dir: moduleOutdir },
169
185
  userAliases: aliases,
170
186
  pnpPlugins,
187
+ userPlugins,
171
188
  }));
172
189
  const mainFormat = mainOutdir.includes('/cjs') || mainOutExt === '.cjs' ? 'cjs' : 'esm';
173
190
  results.push(await runOneLibraryBuild({
@@ -182,6 +199,7 @@ export class BuildAction {
182
199
  output: { dir: mainOutdir },
183
200
  userAliases: aliases,
184
201
  pnpPlugins,
202
+ userPlugins,
185
203
  }));
186
204
  }
187
205
  else {
@@ -207,6 +225,7 @@ export class BuildAction {
207
225
  output: { dir: outdir },
208
226
  userAliases: aliases,
209
227
  pnpPlugins,
228
+ userPlugins,
210
229
  }));
211
230
  }
212
231
  return results;
@@ -375,10 +394,22 @@ export class BuildAction {
375
394
  * natively, `@gjsify/rolldown-native` via `synthRolldownOutput`), and it
376
395
  * cannot be fooled by a `node:` specifier quoted inside a string, which a
377
396
  * text scan cannot tell from a statement.
397
+ *
398
+ * The same list also answers the GENERAL form of the question — any bare
399
+ * specifier GJS cannot resolve, `node:` or not — which is why the target's
400
+ * externals predicate and the emitted fileNames are handed over: they are
401
+ * what separates a declared external and a sibling chunk from a dependency
402
+ * that simply is not there.
378
403
  */
379
- assertGjsOutputLoadable(result, outfile, outdir) {
404
+ assertGjsOutputLoadable(result, outfile, outdir, userExternal) {
380
405
  const chunks = (result.output ?? []).filter((item) => item.type === 'chunk');
381
- assertGjsBundleLoadable(chunks, outfile ?? outdir ?? 'the GJS bundle');
406
+ assertGjsBundleLoadable(chunks, outfile ?? outdir ?? 'the GJS bundle', {
407
+ // The target's OWN predicate, not a second list: `externalsPlugin` enforces
408
+ // this exact one, so a specifier the build let through as external cannot be
409
+ // reported as unresolvable here.
410
+ isExternal: createGjsExternalsPredicate(userExternal ?? []),
411
+ emitted: (result.output ?? []).map((item) => item.fileName),
412
+ });
382
413
  }
383
414
  /**
384
415
  * Post-bundle gate for `--app node`: throw when the emitted bundle still
@@ -544,6 +575,21 @@ export class BuildAction {
544
575
  async buildApp(app = 'gjs', opts = {}) {
545
576
  const { verbose, typescript, exclude, library: pkg, aliases, excludeGlobals } = this.configData;
546
577
  const userBundler = normalizeBundlerOptions(this.configData);
578
+ // Refuse a JSX entry with no JSX policy BEFORE bundling anything — see
579
+ // `utils/jsx-config.ts` for what the unset default emits and why it can never be
580
+ // right for this target. The glob expansion is paid only on the failing branch:
581
+ // when JSX is configured there is nothing to name.
582
+ const jsxPolicy = describeJsxConfig({
583
+ transformJsx: userBundler.transform?.jsx,
584
+ tsconfigJsx: typescript?.compilerOptions?.jsx,
585
+ tsconfigJsxImportSource: typescript?.compilerOptions?.jsxImportSource,
586
+ });
587
+ if (app === 'gjs' && !jsxPolicy.configured) {
588
+ const entries = collectEntryPaths(await globToEntryPoints(userBundler.input, exclude));
589
+ const jsxEntry = findJsxEntryPoint(entries);
590
+ if (jsxEntry !== undefined)
591
+ throw jsxConfigMissingError(jsxEntry);
592
+ }
547
593
  // --- `--app browser` HTML entry (Vite-style) ---
548
594
  // When the entry is an `index.html`, bundle the module its
549
595
  // `<script type="module" src>` references (rewrite `input` to that
@@ -584,7 +630,7 @@ export class BuildAction {
584
630
  throw new Error('gjsify build: an .html entry needs an explicit --outfile ' +
585
631
  '(e.g. --outfile dist-app/app.js); the emitted index.html is written beside it.');
586
632
  }
587
- const { consoleShim, globals } = this.configData;
633
+ const { consoleShim, globals, dialect } = this.configData;
588
634
  const userExternal = Array.isArray(userBundler.external) ? userBundler.external : undefined;
589
635
  const userBanner = typeof userBundler.output?.banner === 'string' ? userBundler.output.banner : undefined;
590
636
  const pluginOpts = {
@@ -594,6 +640,7 @@ export class BuildAction {
594
640
  exclude,
595
641
  reflection: typescript?.reflection,
596
642
  consoleShim,
643
+ ...(dialect !== undefined ? { dialect } : {}),
597
644
  ...(aliases ? { aliases } : {}),
598
645
  ...(opts.preserveDefaultExport ? { preserveDefaultExport: true } : {}),
599
646
  ...(opts.toolchainAnchor !== undefined ? { toolchainAnchor: opts.toolchainAnchor } : {}),
@@ -746,7 +793,7 @@ export class BuildAction {
746
793
  // and appended into `userPlugins` above. Re-emitting the raw
747
794
  // entries (which may include `BundlerPluginByName` shapes
748
795
  // Rolldown doesn't understand) would crash the build.
749
- plugins: [...pnpPlugins, ...userPlugins, ...cfg.plugins],
796
+ plugins: [...pnpPlugins, ...cfg.prePlugins, ...userPlugins, ...cfg.plugins],
750
797
  };
751
798
  if (opts.watch) {
752
799
  await this.runWatchLoop(finalOpts, app, outfile, outdir, verbose);
@@ -762,9 +809,15 @@ export class BuildAction {
762
809
  if ((app === 'gjs' || app === 'node') && this.configData.shebang) {
763
810
  await this.applyShebang(app, outfile, verbose);
764
811
  }
765
- // Refuse to hand back a `--app gjs` bundle stock GJS cannot even load.
812
+ // Refuse to hand back a `--app gjs` bundle stock GJS cannot even load: one that
813
+ // imports what the runtime cannot resolve, or — when the transform was told to
814
+ // keep JSX — one that is not parseable JavaScript at all.
766
815
  if (app === 'gjs') {
767
- this.assertGjsOutputLoadable(writeResult, outfile, outdir);
816
+ this.assertGjsOutputLoadable(writeResult, outfile, outdir, userExternal);
817
+ if (jsxPolicy.preserves) {
818
+ const chunks = (writeResult.output ?? []).filter((item) => item.type === 'chunk');
819
+ assertGjsBundleParses(chunks, outfile ?? outdir ?? 'the GJS bundle');
820
+ }
768
821
  }
769
822
  // Refuse to hand back a `--app node` bundle that reaches for GJS ambient
770
823
  // globals nothing seeds. Only meaningful when the shim was NOT injected:
@@ -882,7 +935,11 @@ async function runOneLibraryBuild(args) {
882
935
  const merged = mergeBundlerOptions(cfg.options, args.userBundler);
883
936
  const finalOpts = {
884
937
  ...merged,
885
- plugins: [...args.pnpPlugins, ...cfg.plugins],
938
+ // Same order as the app path: PnP resolves, then the user transforms,
939
+ // then gjsify's own chain. `merged.plugins` is deliberately NOT spread —
940
+ // the user's entries arrive RESOLVED, in `userPlugins`, exactly as
941
+ // `buildApp` passes them.
942
+ plugins: [...args.pnpPlugins, ...cfg.prePlugins, ...args.userPlugins, ...cfg.plugins],
886
943
  };
887
944
  return await runBundle(finalOpts);
888
945
  }
@@ -85,11 +85,13 @@ const IGNORE = [
85
85
  /^docs\//,
86
86
  ...OTHER_WORKFLOW_INPUTS,
87
87
  // Neither `@gjsify/node-gi` (the Node-native GI engine) nor `@gjsify/napi` (the
88
- // N-API host over SpiderMonkey) is a gjsify workspace member: the GJS-first
89
- // install/foreach tooling cannot build their node-gyp addons or Vala+C++/meson
90
- // shim, so `main.yml` neither builds nor tests them and their own workflows are
91
- // the source of truth. Without the carve-outs their files map to no workspace,
92
- // land in `unmatched`, and force a full run on every node-gi/napi PR.
88
+ // N-API host over SpiderMonkey) is a gjsify workspace member — WHY is ADR 0031,
89
+ // which this comment used to carry alone. The short of it: node-gi's `build` is
90
+ // `node-gyp rebuild`, so a member would enter `foreach build` in a container with
91
+ // no GTK/GI toolchain. `main.yml` therefore neither builds nor tests them and
92
+ // their own workflows are the source of truth. Without the carve-outs their files
93
+ // map to no workspace, land in `unmatched`, and force a full run on every
94
+ // node-gi/napi PR.
93
95
  /^packages\/node-gi\//,
94
96
  /^packages\/napi\//,
95
97
  // Flatpak build/distribution tooling (SDK-extension manifest + metainfo). No
@@ -1,5 +1,6 @@
1
1
  import { Config } from '../config.js';
2
2
  import { BuildAction } from '../actions/build.js';
3
+ import { SOURCE_DIALECTS } from '@gjsify/rolldown-plugin-gjsify';
3
4
  // NO `normalize: true` ON THE GLOB-BEARING OPTIONS — `entry-points` and
4
5
  // `exclude` are PATTERNS, not paths.
5
6
  //
@@ -106,6 +107,11 @@ export const buildCommand = {
106
107
  type: 'string',
107
108
  choices: ['silent', 'error', 'warning', 'info', 'debug', 'verbose'],
108
109
  default: 'warning',
110
+ })
111
+ .option('dialect', {
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
+ type: 'string',
114
+ choices: [...SOURCE_DIALECTS],
109
115
  })
110
116
  .option('console-shim', {
111
117
  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.',
@@ -9,7 +9,9 @@
9
9
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
10
10
  import { dirname, resolve } from 'node:path';
11
11
  import { Config } from '../../config.js';
12
- import { defaultCiContainer, looksLikeAppId, readPackageJson, resolveRuntime } from './utils.js';
12
+ import { defaultCiContainer, looksLikeAppId, readPackageJson } from './utils.js';
13
+ import { resolveRuntime } from '../../utils/flatpak-runtime.js';
14
+ import { pickFlatpakBuildKeys } from '../../utils/ship/flatpak-config.js';
13
15
  export const flatpakCiCommand = {
14
16
  command: 'ci',
15
17
  description: 'Scaffold .github/workflows/flatpak.yml using the flathub-infra container + flatpak-builder@v6 action.',
@@ -68,7 +70,13 @@ export const flatpakCiCommand = {
68
70
  }
69
71
  const manifest = args.manifest ?? `${appId}.json`;
70
72
  const bundle = args.bundle ?? `${appId}.flatpak`;
71
- const { runtime, runtimeVersion } = resolveRuntime(flatpak, {});
73
+ // Through the deprecation window, not straight off `gjsify.flatpak`: a
74
+ // project told to move these keys to `gjsify.ship.flatpak` must not lose
75
+ // them here — the CI container tag is derived from the runtime, so
76
+ // reading the old block alone scaffolds a workflow against the default
77
+ // GNOME release rather than the pinned one.
78
+ const buildKeys = pickFlatpakBuildKeys(configData.ship?.flatpak, flatpak).values;
79
+ const { runtime, runtimeVersion } = resolveRuntime(buildKeys, {});
72
80
  const runtimeImage = args.runtimeImage ??
73
81
  flatpak.ciContainer ??
74
82
  defaultCiContainer(runtime, runtimeVersion);
@@ -13,7 +13,9 @@
13
13
  // with `skip-icons-check`.
14
14
  import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
15
15
  import { dirname, resolve } from 'node:path';
16
- import { DEFAULT_CLI_FINISH_ARGS, DEFAULT_GUI_FINISH_ARGS, looksLikeAppId, readPackageJson, resolveRuntime, } from './utils.js';
16
+ import { looksLikeAppId, readPackageJson } from './utils.js';
17
+ import { DEFAULT_CLI_FINISH_ARGS, DEFAULT_GUI_FINISH_ARGS, deriveAppendPath, resolveRuntime, } from '../../utils/flatpak-runtime.js';
18
+ import { pickFlatpakBuildKeys } from '../../utils/ship/flatpak-config.js';
17
19
  import { renderDesktop, renderFlathubJson, renderMetainfoApp, renderMetainfoCli, validateScaffoldInputs, } from './scaffold.js';
18
20
  import { Config } from '../../config.js';
19
21
  import { OxcNotFoundError, hasOxcDevDep, runOxfmt } from '../../utils/oxc-resolve.js';
@@ -109,17 +111,24 @@ export const flatpakInitCommand = {
109
111
  'or rename the package to a reverse-DNS id like org.example.MyApp.');
110
112
  }
111
113
  const kind = args.kind ?? flatpak.kind ?? (args.cliOnly ? 'cli' : 'app');
112
- const { runtime, runtimeId, sdk, runtimeVersion } = resolveRuntime(flatpak, {
114
+ // The six BUILD keys come through the deprecation window
115
+ // (`utils/ship/flatpak-config.ts`), not straight off `gjsify.flatpak`.
116
+ // These commands did NOT move, but the keys did: a project that followed
117
+ // `ship`'s own advice and moved them would otherwise lose them here and
118
+ // get a committed manifest against a different runtime version with
119
+ // different finish-args, silently, at exit 0.
120
+ const buildKeys = pickFlatpakBuildKeys(configData.ship?.flatpak, flatpak).values;
121
+ const { runtime, runtimeId, sdk, runtimeVersion } = resolveRuntime(buildKeys, {
113
122
  runtime: args.runtime,
114
123
  runtimeVersion: args.runtimeVersion,
115
124
  });
116
- const sdkExtensions = mergeArrays(flatpak.sdkExtensions, args.sdkExtension);
117
- const appendPath = flatpak.appendPath ?? (sdkExtensions?.length ? deriveAppendPath(sdkExtensions) : undefined);
125
+ const sdkExtensions = mergeArrays(buildKeys.sdkExtensions, args.sdkExtension);
126
+ const appendPath = buildKeys.appendPath ?? (sdkExtensions?.length ? deriveAppendPath(sdkExtensions) : undefined);
118
127
  const command = args.command ?? flatpak.command ?? appId;
119
128
  const explicitFinishArgs = args.finishArg;
120
129
  const finishArgs = explicitFinishArgs !== undefined
121
130
  ? explicitFinishArgs
122
- : (flatpak.finishArgs ?? (kind === 'cli' ? DEFAULT_CLI_FINISH_ARGS : DEFAULT_GUI_FINISH_ARGS));
131
+ : (buildKeys.finishArgs ?? (kind === 'cli' ? DEFAULT_CLI_FINISH_ARGS : DEFAULT_GUI_FINISH_ARGS));
123
132
  const manifest = {
124
133
  id: appId,
125
134
  runtime: runtimeId,
@@ -133,7 +142,7 @@ export const flatpakInitCommand = {
133
142
  }
134
143
  manifest.command = command;
135
144
  manifest['finish-args'] = finishArgs;
136
- const cleanup = flatpak.cleanup;
145
+ const cleanup = buildKeys.cleanup;
137
146
  if (cleanup?.length)
138
147
  manifest.cleanup = cleanup;
139
148
  // Module assembly. Two precedence rules:
@@ -253,16 +262,6 @@ function mergeArrays(a, b) {
253
262
  return undefined;
254
263
  return [...(a ?? []), ...(b ?? [])];
255
264
  }
256
- function deriveAppendPath(sdkExtensions) {
257
- const out = [];
258
- for (const ext of sdkExtensions) {
259
- const m = /^org\.freedesktop\.Sdk\.Extension\.([A-Za-z0-9-]+)$/.exec(ext);
260
- if (m)
261
- out.push(`/usr/lib/sdk/${m[1]}/bin`);
262
- }
263
- out.push('/app/bin');
264
- return out;
265
- }
266
265
  function deriveModuleName(appId) {
267
266
  const parts = appId.split('.');
268
267
  return parts[parts.length - 1] || appId;
@@ -1,32 +1,6 @@
1
- import type { ConfigDataFlatpak } from '../../types/config-data.js';
2
- /**
3
- * Default GNOME-Platform runtime version. Bumped per release window.
4
- * GNOME 50 = April 2026 stable; tracked in
5
- * https://docs.flathub.org/docs/for-app-authors/requirements.
6
- */
7
- export declare const DEFAULT_GNOME_RUNTIME_VERSION = "50";
8
- /** Default Freedesktop-Platform runtime version (LTS-ish). */
9
- export declare const DEFAULT_FREEDESKTOP_RUNTIME_VERSION = "24.08";
10
- /** Permissive GUI defaults for GTK4 + Adwaita apps. */
11
- export declare const DEFAULT_GUI_FINISH_ARGS: string[];
12
- /** Lean defaults for headless CLI tools — no display, no GPU. */
13
- export declare const DEFAULT_CLI_FINISH_ARGS: string[];
14
1
  /** Read package.json from a directory. Throws a helpful error if missing/invalid. */
15
2
  export declare function readPackageJson(dir: string): Record<string, unknown>;
16
3
  /** True if a name string looks like a reverse-DNS Flatpak app id. */
17
4
  export declare function looksLikeAppId(value: unknown): value is string;
18
- /**
19
- * Pick the runtime + sdk + version triple from config + CLI overrides.
20
- * `--runtime` and `--runtime-version` flags win over config values.
21
- */
22
- export declare function resolveRuntime(flatpak: ConfigDataFlatpak | undefined, overrides: {
23
- runtime?: string;
24
- runtimeVersion?: string;
25
- }): {
26
- runtime: 'gnome' | 'freedesktop';
27
- runtimeId: string;
28
- sdk: string;
29
- runtimeVersion: string;
30
- };
31
5
  /** Default container image for the GitHub Actions workflow. */
32
6
  export declare function defaultCiContainer(runtime: 'gnome' | 'freedesktop', runtimeVersion: string): string;
@@ -1,18 +1,10 @@
1
1
  // Shared helpers for the `gjsify flatpak <sub>` subcommand group.
2
+ //
3
+ // The runtime/SDK/finish-args half moved to `utils/flatpak-runtime.ts` when
4
+ // `gjsify ship --target flatpak` became its second caller — see that file's
5
+ // header. What is left here is what only these subcommands ask.
2
6
  import { readFileSync } from 'node:fs';
3
7
  import { resolve } from 'node:path';
4
- /**
5
- * Default GNOME-Platform runtime version. Bumped per release window.
6
- * GNOME 50 = April 2026 stable; tracked in
7
- * https://docs.flathub.org/docs/for-app-authors/requirements.
8
- */
9
- export const DEFAULT_GNOME_RUNTIME_VERSION = '50';
10
- /** Default Freedesktop-Platform runtime version (LTS-ish). */
11
- export const DEFAULT_FREEDESKTOP_RUNTIME_VERSION = '24.08';
12
- /** Permissive GUI defaults for GTK4 + Adwaita apps. */
13
- export const DEFAULT_GUI_FINISH_ARGS = ['--device=dri', '--share=ipc', '--socket=fallback-x11', '--socket=wayland'];
14
- /** Lean defaults for headless CLI tools — no display, no GPU. */
15
- export const DEFAULT_CLI_FINISH_ARGS = [];
16
8
  /** Read package.json from a directory. Throws a helpful error if missing/invalid. */
17
9
  export function readPackageJson(dir) {
18
10
  const path = resolve(dir, 'package.json');
@@ -34,23 +26,6 @@ export function readPackageJson(dir) {
34
26
  export function looksLikeAppId(value) {
35
27
  return typeof value === 'string' && /^[A-Za-z][A-Za-z0-9_-]*(\.[A-Za-z][A-Za-z0-9_-]*){2,}$/.test(value);
36
28
  }
37
- /**
38
- * Pick the runtime + sdk + version triple from config + CLI overrides.
39
- * `--runtime` and `--runtime-version` flags win over config values.
40
- */
41
- export function resolveRuntime(flatpak, overrides) {
42
- const runtime = (overrides.runtime ?? flatpak?.runtime ?? 'gnome');
43
- if (runtime !== 'gnome' && runtime !== 'freedesktop') {
44
- throw new Error(`gjsify flatpak: unknown runtime "${runtime}" (expected "gnome" or "freedesktop")`);
45
- }
46
- const runtimeVersion = overrides.runtimeVersion ??
47
- flatpak?.runtimeVersion ??
48
- (runtime === 'gnome' ? DEFAULT_GNOME_RUNTIME_VERSION : DEFAULT_FREEDESKTOP_RUNTIME_VERSION);
49
- if (runtime === 'gnome') {
50
- return { runtime, runtimeId: 'org.gnome.Platform', sdk: 'org.gnome.Sdk', runtimeVersion };
51
- }
52
- return { runtime, runtimeId: 'org.freedesktop.Platform', sdk: 'org.freedesktop.Sdk', runtimeVersion };
53
- }
54
29
  /** Default container image for the GitHub Actions workflow. */
55
30
  export function defaultCiContainer(runtime, runtimeVersion) {
56
31
  const tag = `${runtime}-${runtimeVersion}`;
@@ -3,6 +3,8 @@ interface ShipOptions {
3
3
  target?: string[];
4
4
  out?: string;
5
5
  stage: boolean;
6
+ 'from-stage'?: string;
7
+ 'expect-target'?: string;
6
8
  'skip-build': boolean;
7
9
  arch?: string;
8
10
  verbose: boolean;