@gtkx/config 2.0.0-beta.11 → 2.0.0-beta.13

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 (68) hide show
  1. package/README.md +2 -2
  2. package/dist/builtin-elements.d.ts +23 -0
  3. package/dist/builtin-elements.d.ts.map +1 -0
  4. package/dist/builtin-elements.js +366 -0
  5. package/dist/builtin-elements.js.map +1 -0
  6. package/dist/config-dependencies.d.ts +5 -3
  7. package/dist/config-dependencies.d.ts.map +1 -1
  8. package/dist/config-dependencies.js +54 -22
  9. package/dist/config-dependencies.js.map +1 -1
  10. package/dist/config-error.d.ts.map +1 -1
  11. package/dist/config-error.js.map +1 -1
  12. package/dist/config-reloader.d.ts.map +1 -1
  13. package/dist/config-reloader.js +2 -8
  14. package/dist/config-reloader.js.map +1 -1
  15. package/dist/config-source.d.ts +4 -2
  16. package/dist/config-source.d.ts.map +1 -1
  17. package/dist/config-source.js +26 -8
  18. package/dist/config-source.js.map +1 -1
  19. package/dist/config.d.ts +159 -45
  20. package/dist/config.d.ts.map +1 -1
  21. package/dist/config.js +28 -19
  22. package/dist/config.js.map +1 -1
  23. package/dist/deploy.d.ts +391 -13
  24. package/dist/deploy.d.ts.map +1 -1
  25. package/dist/deploy.js +16 -13
  26. package/dist/deploy.js.map +1 -1
  27. package/dist/index.d.ts +3 -3
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +1 -1
  30. package/dist/index.js.map +1 -1
  31. package/dist/internal.d.ts +3 -3
  32. package/dist/internal.d.ts.map +1 -1
  33. package/dist/internal.js +3 -3
  34. package/dist/internal.js.map +1 -1
  35. package/dist/loader.d.ts +22 -4
  36. package/dist/loader.d.ts.map +1 -1
  37. package/dist/loader.js +59 -31
  38. package/dist/loader.js.map +1 -1
  39. package/dist/resource-base-path.d.ts.map +1 -1
  40. package/dist/schema-text.d.ts.map +1 -1
  41. package/dist/user-event-signals.d.ts.map +1 -1
  42. package/dist/virtual.d.ts +1 -1
  43. package/dist/virtual.d.ts.map +1 -1
  44. package/dist/virtual.js +4 -2
  45. package/dist/virtual.js.map +1 -1
  46. package/dist/vite-plugin.d.ts +2 -0
  47. package/dist/vite-plugin.d.ts.map +1 -1
  48. package/dist/vite-plugin.js +4 -3
  49. package/dist/vite-plugin.js.map +1 -1
  50. package/dist/vite-root.d.ts.map +1 -1
  51. package/package.json +14 -29
  52. package/src/builtin-elements.ts +377 -0
  53. package/src/config-dependencies.ts +61 -27
  54. package/src/config-error.ts +5 -3
  55. package/src/config-reloader.ts +2 -11
  56. package/src/config-source.ts +35 -8
  57. package/src/config.ts +189 -39
  58. package/src/deploy.ts +471 -55
  59. package/src/index.ts +42 -3
  60. package/src/internal.ts +3 -2
  61. package/src/loader.ts +106 -37
  62. package/src/virtual.ts +6 -4
  63. package/src/vite-plugin.ts +9 -2
  64. package/dist/static-dependencies.d.ts +0 -3
  65. package/dist/static-dependencies.d.ts.map +0 -1
  66. package/dist/static-dependencies.js +0 -350
  67. package/dist/static-dependencies.js.map +0 -1
  68. package/src/static-dependencies.ts +0 -464
package/src/deploy.ts CHANGED
@@ -1,14 +1,5 @@
1
1
  import { z } from "zod";
2
- import {
3
- fileExtension,
4
- flag,
5
- girLibrary,
6
- relativePathRecord,
7
- text,
8
- textList,
9
- textRecord,
10
- url,
11
- } from "./schema-text.ts";
2
+ import { fileExtension, flag, girLibrary, relativePathRecord, text, textList, textRecord, url } from "./schema-text.ts";
12
3
 
13
4
  const DEB_COMPRESSIONS = ["gzip", "none", "xz", "zstd"] as const;
14
5
  const DEB_SIGN_METHODS = ["debsign", "dpkg-sig"] as const;
@@ -68,16 +59,56 @@ const minimumLibraryVersionsSchema = z.record(girLibrary(LIBRARY_ID_ERROR), mini
68
59
  error: MINIMUM_LIBRARY_VERSIONS_ERROR,
69
60
  });
70
61
 
62
+ /** Package relations of one kind, such as dependencies, in Debian and RPM dependency syntax. */
63
+ type DeployPackageRelationOptions = {
64
+ /** Package relations expressed in Debian dependency syntax. */
65
+ deb?: string[] | undefined;
66
+ /** Package relations expressed in RPM dependency syntax. */
67
+ rpm?: string[] | undefined;
68
+ };
69
+
71
70
  const relationsSchema = z.strictObject({
72
71
  deb: textList("Debian package relation", "must be an array of Debian package relations").optional(),
73
72
  rpm: textList("RPM package relation", "must be an array of RPM package relations").optional(),
74
- });
73
+ }) satisfies z.ZodType<DeployPackageRelationOptions>;
74
+
75
+ /** Package relations of a kind only Debian packages have, in Debian dependency syntax. */
76
+ type DeployDebPackageRelationOptions = {
77
+ /** Package relations expressed in Debian dependency syntax. RPM has no equivalent relation. */
78
+ deb?: string[] | undefined;
79
+ };
80
+
81
+ const debRelationsSchema = z.strictObject({
82
+ deb: textList("Debian package relation", "must be an array of Debian package relations").optional(),
83
+ }) satisfies z.ZodType<DeployDebPackageRelationOptions>;
84
+
85
+ /** The `deploy.developer` options: who develops and maintains the application. */
86
+ type DeployDeveloperOptions = {
87
+ /** Reverse-DNS developer identifier, derived from the application ID when omitted. */
88
+ id?: string | undefined;
89
+ /** Developer or organization name. Defaults to the author in package.json. */
90
+ name?: string | undefined;
91
+ /** Maintainer email address. Defaults to the author's email in package.json. */
92
+ email?: string | undefined;
93
+ };
75
94
 
76
95
  const developerSchema = z.strictObject({
77
96
  id: text("must be a reverse-DNS developer id").optional(),
78
97
  name: text("must be a developer or organization name").optional(),
79
98
  email: text("must be an email address").optional(),
80
- });
99
+ }) satisfies z.ZodType<DeployDeveloperOptions>;
100
+
101
+ /** One software-center screenshot in `deploy.screenshots`. Either `url` or `file` must be set. */
102
+ type DeployScreenshotOptions = {
103
+ /** Absolute URL of a PNG or JPEG screenshot. Takes precedence over `file`. */
104
+ url?: string | undefined;
105
+ /** Screenshot path relative to the project root, resolved against `screenshotBaseUrl`. */
106
+ file?: string | undefined;
107
+ /** Caption displayed with the screenshot in software centers. */
108
+ caption?: string | undefined;
109
+ /** Marks the primary screenshot. Only the first entry set to `true` is used. */
110
+ isDefault?: boolean | undefined;
111
+ };
81
112
 
82
113
  const screenshotSchema = z
83
114
  .strictObject({
@@ -88,7 +119,23 @@ const screenshotSchema = z
88
119
  })
89
120
  .refine((entry) => entry.url !== undefined || entry.file !== undefined, {
90
121
  error: "must have either a `url` or a `file`",
91
- });
122
+ }) satisfies z.ZodType<DeployScreenshotOptions>;
123
+
124
+ /** One AppStream release-history entry in `deploy.releases`. */
125
+ type DeployReleaseOptions = {
126
+ /** Application version described by this release. */
127
+ version: string;
128
+ /** Release date in `YYYY-MM-DD` format. */
129
+ date: string;
130
+ /** AppStream release classification. */
131
+ type?: "development" | "snapshot" | "stable" | undefined;
132
+ /** AppStream update urgency. */
133
+ urgency?: "critical" | "high" | "low" | "medium" | undefined;
134
+ /** Release notes, with each entry rendered as a paragraph. */
135
+ notes?: string[] | undefined;
136
+ /** Absolute URL containing further details about the release. */
137
+ url?: string | undefined;
138
+ };
92
139
 
93
140
  const releaseSchema = z.strictObject({
94
141
  version: text(VERSION_ERROR),
@@ -97,34 +144,68 @@ const releaseSchema = z.strictObject({
97
144
  urgency: z.enum(RELEASE_URGENCIES, { error: "must be one of critical, high, low, medium" }).optional(),
98
145
  notes: textList("release note paragraph", "must be an array of release note paragraphs").optional(),
99
146
  url: url(URL_ERROR).optional(),
100
- });
147
+ }) satisfies z.ZodType<DeployReleaseOptions>;
148
+
149
+ /** One file extension and MIME type registered through `deploy.fileAssociations`. */
150
+ type DeployFileAssociationOptions = {
151
+ /** File extension to associate with the application, without a leading dot. */
152
+ extension: string;
153
+ /** MIME type registered for the file extension. */
154
+ mimeType: string;
155
+ /** Human-readable description of the file type. */
156
+ description?: string | undefined;
157
+ };
101
158
 
102
159
  const fileAssociationSchema = z.strictObject({
103
160
  extension: fileExtension("must be a file extension without a leading dot"),
104
161
  mimeType: text("must be a MIME type such as text/plain"),
105
162
  description: text("must be a description of the file type").optional(),
106
- });
163
+ }) satisfies z.ZodType<DeployFileAssociationOptions>;
164
+
165
+ /** One desktop launcher action in `deploy.desktopActions`, keyed by its action ID. */
166
+ type DeployDesktopActionOptions = {
167
+ /** Action label shown in the desktop launcher menu. */
168
+ name: string;
169
+ /**
170
+ * Arguments appended to the launch command when the action is chosen. Launchers activate the `app.<id>`
171
+ * application action of a D-Bus-activatable application instead of running this command.
172
+ */
173
+ args?: string[] | undefined;
174
+ /** Icon theme name used for the action. */
175
+ icon?: string | undefined;
176
+ };
107
177
 
108
178
  const desktopActionSchema = z.strictObject({
109
179
  name: text("must be an action name"),
110
180
  args: textList("argument", "must be an array of arguments appended to Exec").optional(),
111
181
  icon: text("must be an icon name").optional(),
112
- });
182
+ }) satisfies z.ZodType<DeployDesktopActionOptions>;
183
+
184
+ /** The `deploy.branding` colors software centers use around the application's listing. */
185
+ type DeployBrandingOptions = {
186
+ /** Primary AppStream branding color for light mode, in `#rrggbb` format. */
187
+ light: string;
188
+ /** Primary AppStream branding color for dark mode, in `#rrggbb` format. */
189
+ dark: string;
190
+ };
113
191
 
114
192
  const brandingSchema = z.strictObject({
115
193
  light: hexColorSchema,
116
194
  dark: hexColorSchema,
117
- });
195
+ }) satisfies z.ZodType<DeployBrandingOptions>;
118
196
 
119
197
  /**
120
- * A `deploy.extraFiles` entry in object form: the source file, resolved against the project root, that is
121
- * installed at the entry's prefix-relative destination, and the octal mode it is installed with.
198
+ * A `deploy.extraFiles` entry in object form: the source file or directory, resolved against the project root,
199
+ * that is installed at the entry's prefix-relative destination, and the octal mode it is installed with.
122
200
  */
123
- type DeployExtraFileOptions = Record<"source", string> & {
124
- /** Octal file mode. Setuid and setgid bits are rejected. */
201
+ type DeployExtraFileOptions = {
202
+ /** Source file or directory path, resolved relative to the project root. */
203
+ source: string;
204
+ /** Octal file mode, applied to every file of a directory source. Setuid and setgid bits are rejected. */
125
205
  mode?: string | undefined;
126
206
  };
127
- const extraFileSchema: z.ZodType<DeployExtraFileOptions> = z.strictObject({
207
+
208
+ const extraFileSchema = z.strictObject({
128
209
  source: text(SOURCE_PATH_ERROR),
129
210
  mode: z
130
211
  .string({ error: FILE_MODE_ERROR })
@@ -133,14 +214,14 @@ const extraFileSchema: z.ZodType<DeployExtraFileOptions> = z.strictObject({
133
214
  error: FILE_MODE_ERROR,
134
215
  })
135
216
  .optional(),
136
- });
217
+ }) satisfies z.ZodType<DeployExtraFileOptions>;
137
218
 
138
219
  const extraFileEntrySchema = z.union([text(SOURCE_PATH_ERROR), extraFileSchema], { error: EXTRA_FILE_ERROR });
139
220
 
140
221
  const launcherEnvSchema = z.record(
141
222
  z.string({ error: LAUNCHER_ENV_NAME_ERROR }).regex(LAUNCHER_ENV_NAME_PATTERN, { error: LAUNCHER_ENV_NAME_ERROR }),
142
223
  z.string({ error: LAUNCHER_ENV_ERROR }).refine((value) => !value.includes("\0"), { error: LAUNCHER_ENV_ERROR }),
143
- { error: (issue) => issue.code === "invalid_key" ? LAUNCHER_ENV_NAME_ERROR : LAUNCHER_ENV_ERROR },
224
+ { error: (issue) => (issue.code === "invalid_key" ? LAUNCHER_ENV_NAME_ERROR : LAUNCHER_ENV_ERROR) },
144
225
  );
145
226
 
146
227
  const nodeFlagsSchema = z.array(
@@ -154,62 +235,183 @@ const nodeFlagsSchema = z.array(
154
235
  * The `deploy.node` options: where the Node.js runtime bundled with the application comes from, the version it
155
236
  * is expected to be, whether its binary is stripped, and whether the launcher enables the compile cache.
156
237
  */
157
- type DeployNodeOptions = Partial<
158
- Record<"source", "download" | "host" | "path" | undefined> &
159
- Record<"path", string | undefined> &
160
- Record<"shouldStrip" | "shouldUseCompileCache", boolean | undefined>
161
- > & {
238
+ type DeployNodeOptions = {
239
+ /** Runtime source: an official download, the running Node.js executable, or `path`. Defaults to `download`. */
240
+ source?: "download" | "host" | "path" | undefined;
162
241
  /** Expected Node.js version. Downloaded runtimes default to exactly 26.8.2 when omitted. */
163
242
  version?: string | undefined;
243
+ /** Node.js executable path relative to the project root, required when `source` is `path`. */
244
+ path?: string | undefined;
245
+ /** Strip the runtime when its architecture matches the host and `strip` is available. Defaults to `true`. */
246
+ shouldStrip?: boolean | undefined;
247
+ /** Enable Node.js compile caching in the generated launcher. Defaults to `true`. */
248
+ shouldUseCompileCache?: boolean | undefined;
164
249
  };
165
- const nodeRuntimeSchema: z.ZodType<DeployNodeOptions> = z.strictObject({
250
+
251
+ const nodeRuntimeSchema = z.strictObject({
166
252
  source: z.enum(NODE_SOURCES, { error: "must be one of download, host, path" }).optional(),
167
253
  version: text("must be a Node.js version such as 26.7.0").optional(),
168
254
  path: text("must be a path to a node binary").optional(),
169
255
  shouldStrip: flag(BOOLEAN_ERROR).optional(),
170
256
  shouldUseCompileCache: flag(BOOLEAN_ERROR).optional(),
171
- });
257
+ }) satisfies z.ZodType<DeployNodeOptions>;
258
+
259
+ /**
260
+ * The `deploy.scripts` options: maintainer scripts for Debian and RPM packages. Each value is a path to a
261
+ * shell script file, not inline shell; the package carries the file's content.
262
+ */
263
+ type DeployScriptsOptions = {
264
+ /** Path to a shell script, relative to the project root, run before installing a Debian or RPM package. */
265
+ preInstall?: string | undefined;
266
+ /** Path to a shell script, relative to the project root, run after installing a Debian or RPM package. */
267
+ postInstall?: string | undefined;
268
+ /** Path to a shell script, relative to the project root, run before removing a Debian or RPM package. */
269
+ preRemove?: string | undefined;
270
+ /** Path to a shell script, relative to the project root, run after removing a Debian or RPM package. */
271
+ postRemove?: string | undefined;
272
+ };
172
273
 
173
274
  const scriptsSchema = z.strictObject({
174
275
  preInstall: text(SCRIPT_ERROR).optional(),
175
276
  postInstall: text(SCRIPT_ERROR).optional(),
176
277
  preRemove: text(SCRIPT_ERROR).optional(),
177
278
  postRemove: text(SCRIPT_ERROR).optional(),
178
- });
279
+ }) satisfies z.ZodType<DeployScriptsOptions>;
280
+
281
+ /** The `deploy.tools` options: executables `gtkx deploy` runs instead of the ones it downloads. */
282
+ type DeployToolsOptions = {
283
+ /** nFPM executable name or path relative to the project root. Defaults to a verified pinned download. */
284
+ nfpm?: string | undefined;
285
+ };
286
+
287
+ const toolsSchema = z.strictObject({
288
+ nfpm: text("must be an nFPM executable name or path").optional(),
289
+ }) satisfies z.ZodType<DeployToolsOptions>;
290
+
291
+ /** The `deploy.deb` options: Debian package metadata and compression. */
292
+ type DeployDebOptions = {
293
+ /** Debian package name. Defaults to `deploy.binaryName`. */
294
+ packageName?: string | undefined;
295
+ /** Debian archive section, derived from the application categories when omitted. */
296
+ section?: string | undefined;
297
+ /** Debian package priority. Defaults to `optional`. */
298
+ priority?: string | undefined;
299
+ /** Compression used for the Debian package payload. */
300
+ compression?: "gzip" | "none" | "xz" | "zstd" | undefined;
301
+ /** Additional Debian control fields, keyed by field name. */
302
+ fields?: Record<string, string> | undefined;
303
+ };
179
304
 
180
305
  const debSchema = z.strictObject({
181
306
  packageName: text("must be a Debian package name").optional(),
182
307
  section: text("must be a Debian archive section").optional(),
183
308
  priority: text("must be a Debian priority").optional(),
184
309
  compression: z.enum(DEB_COMPRESSIONS, { error: "must be one of gzip, none, xz, zstd" }).optional(),
185
- fields: textRecord("must be a control field value", "must be a record of control field names to values")
186
- .optional(),
187
- });
310
+ fields: textRecord("must be a control field value", "must be a record of control field names to values").optional(),
311
+ }) satisfies z.ZodType<DeployDebOptions>;
312
+
313
+ /** The `deploy.rpm` options: RPM package metadata and compression. */
314
+ type DeployRpmOptions = {
315
+ /** RPM package name. Defaults to `deploy.binaryName`. */
316
+ packageName?: string | undefined;
317
+ /** RPM package group, derived from the application categories when omitted. */
318
+ group?: string | undefined;
319
+ /** Compression used for the RPM package payload. */
320
+ compression?: "gzip" | "lzma" | "xz" | "zstd" | undefined;
321
+ /** Installation prefixes that the RPM package allows users to relocate. */
322
+ prefixes?: string[] | undefined;
323
+ };
188
324
 
189
325
  const rpmSchema = z.strictObject({
190
326
  packageName: text("must be an RPM package name").optional(),
191
327
  group: text("must be an RPM group").optional(),
192
328
  compression: z.enum(RPM_COMPRESSIONS, { error: "must be one of gzip, lzma, xz, zstd" }).optional(),
193
329
  prefixes: textList("prefix", "must be an array of relocation prefixes").optional(),
194
- });
330
+ }) satisfies z.ZodType<DeployRpmOptions>;
331
+
332
+ /** The `deploy.appimage` options: AppImage file name, compression, update information and runtime. */
333
+ type DeployAppImageOptions = {
334
+ /** Output file name, derived from the application name, version, and architecture when omitted. */
335
+ fileName?: string | undefined;
336
+ /** Compression explicitly requested from appimagetool. */
337
+ compression?: "zstd" | undefined;
338
+ /** AppImage update information string embedded in the executable. */
339
+ updateInformation?: string | undefined;
340
+ /** Custom AppImage runtime file path, resolved relative to the project root. */
341
+ runtimeFile?: string | undefined;
342
+ };
195
343
 
196
344
  const appimageSchema = z.strictObject({
197
345
  fileName: text("must be an output file name").optional(),
198
346
  compression: z.literal("zstd", { error: "must be zstd" }).optional(),
199
347
  updateInformation: text("must be an AppImage update information string").optional(),
200
348
  runtimeFile: text("must be a path to an AppImage runtime file").optional(),
201
- });
349
+ }) satisfies z.ZodType<DeployAppImageOptions>;
350
+
351
+ /** The `deploy.flatpak.source` options: the Git revision a source-mode Flatpak builds. */
352
+ type DeployFlatpakSourceOptions = {
353
+ /** Public HTTP or HTTPS Git repository URL. Defaults to the project's Git remote. */
354
+ url?: string | undefined;
355
+ /** Git tag to build, pinned to its commit when `commit` is omitted. */
356
+ tag?: string | undefined;
357
+ /** Git commit to build. Defaults to the configured tag's commit or the current HEAD. */
358
+ commit?: string | undefined;
359
+ };
202
360
 
203
361
  const flatpakSourceSchema = z.strictObject({
204
362
  url: url("must be an absolute git URL").optional(),
205
363
  tag: text("must be a git tag").optional(),
206
364
  commit: text("must be a git commit sha").optional(),
207
- });
365
+ }) satisfies z.ZodType<DeployFlatpakSourceOptions>;
366
+
367
+ /** The `deploy.flatpak` options: runtime, sandbox permissions, build and distribution of the Flatpak. */
368
+ type DeployFlatpakOptions = {
369
+ /** Package local build output or build from a pinned Git source inside the SDK. Defaults to `prebuilt`. */
370
+ mode?: "prebuilt" | "source" | undefined;
371
+ /** Flatpak runtime ID. Defaults to `org.gnome.Platform`. */
372
+ runtime?: string | undefined;
373
+ /** Flatpak runtime branch. Defaults to `51`. */
374
+ runtimeVersion?: string | undefined;
375
+ /** Build SDK ID. Defaults to `org.gnome.Sdk`. */
376
+ sdk?: string | undefined;
377
+ /** Node.js SDK extension used in source mode. Defaults to `org.freedesktop.Sdk.Extension.node26`. */
378
+ nodeExtension?: string | undefined;
379
+ /** Additional SDK extension IDs included in the build environment. */
380
+ sdkExtensions?: string[] | undefined;
381
+ /** Optional Flatpak base application ID. */
382
+ base?: string | undefined;
383
+ /** Branch of the base application. */
384
+ baseVersion?: string | undefined;
385
+ /** Exported application branch. Defaults to `stable`. */
386
+ branch?: string | undefined;
387
+ /** Sandbox permissions added to display, IPC, and GPU defaults. Negations remove matching defaults. */
388
+ finishArgs?: string[] | undefined;
389
+ /** Patterns added to header, pkg-config, and static-library cleanup defaults. An empty array disables cleanup. */
390
+ cleanup?: string[] | undefined;
391
+ /** Additional shell commands appended to the application's Flatpak build commands. */
392
+ buildCommands?: string[] | undefined;
393
+ /** Additional Flatpak manifest modules built before the application module. */
394
+ modules?: unknown[] | undefined;
395
+ /** Git repository and revision used for source builds. */
396
+ source?: DeployFlatpakSourceOptions | undefined;
397
+ /** Package manager used for offline source builds, detected from the project's lockfiles when omitted. */
398
+ packageManager?: "npm" | "pnpm" | "yarn" | undefined;
399
+ /** Lockfile path relative to the project root. Defaults to the selected package manager's standard lockfile. */
400
+ lockfile?: string | undefined;
401
+ /** Runtime repository URL embedded in the bundle. Defaults to Flathub's `.flatpakrepo` URL. */
402
+ runtimeRepo?: string | undefined;
403
+ /** Emit a `.flatpak` bundle in addition to the local repository. Defaults to `true`. */
404
+ shouldEmitBundle?: boolean | undefined;
405
+ /** Install the built application into the current user's Flatpak installation. Defaults to `false`. */
406
+ shouldInstall?: boolean | undefined;
407
+ /** Allow flatpak-builder to use rofiles-fuse. Set to `false` where FUSE is unavailable. */
408
+ shouldUseRofilesFuse?: boolean | undefined;
409
+ };
208
410
 
209
411
  const flatpakSchema = z.strictObject({
210
412
  mode: z.enum(FLATPAK_MODES, { error: 'must be "prebuilt" or "source"' }).optional(),
211
413
  runtime: text("must be a runtime id").optional(),
212
- runtimeVersion: text('must be a runtime branch such as "50"').optional(),
414
+ runtimeVersion: text('must be a runtime branch such as "51"').optional(),
213
415
  sdk: text("must be an SDK id").optional(),
214
416
  nodeExtension: text("must be a Node SDK extension id").optional(),
215
417
  sdkExtensions: textList("SDK extension id", "must be an array of SDK extension ids").optional(),
@@ -227,7 +429,21 @@ const flatpakSchema = z.strictObject({
227
429
  shouldEmitBundle: flag(BOOLEAN_ERROR).optional(),
228
430
  shouldInstall: flag(BOOLEAN_ERROR).optional(),
229
431
  shouldUseRofilesFuse: flag(BOOLEAN_ERROR).optional(),
230
- });
432
+ }) satisfies z.ZodType<DeployFlatpakOptions>;
433
+
434
+ /** The `deploy.signing.deb` options: the key and method that sign the Debian package. */
435
+ type DeployDebSigningOptions = {
436
+ /** PGP private key file used to sign the Debian package. */
437
+ keyFile: string;
438
+ /** PGP signing key ID. */
439
+ keyId?: string | undefined;
440
+ /** Debian package signing method. */
441
+ method?: "debsign" | "dpkg-sig" | undefined;
442
+ /** Debian signature role. */
443
+ type?: "archive" | "maint" | "origin" | undefined;
444
+ /** Name and email address recorded as the signer. */
445
+ signer?: string | undefined;
446
+ };
231
447
 
232
448
  const debSigningSchema = z.strictObject({
233
449
  keyFile: text(KEY_FILE_ERROR),
@@ -235,28 +451,83 @@ const debSigningSchema = z.strictObject({
235
451
  method: z.enum(DEB_SIGN_METHODS, { error: 'must be "debsign" or "dpkg-sig"' }).optional(),
236
452
  type: z.enum(DEB_SIGN_TYPES, { error: "must be one of archive, maint, origin" }).optional(),
237
453
  signer: text("must be a signer name and email").optional(),
238
- });
454
+ }) satisfies z.ZodType<DeployDebSigningOptions>;
455
+
456
+ /** The `deploy.signing.rpm` options: the key that signs the RPM package. */
457
+ type DeployRpmSigningOptions = {
458
+ /** PGP private key file used to sign the RPM package. */
459
+ keyFile: string;
460
+ /** PGP signing key ID. */
461
+ keyId?: string | undefined;
462
+ };
239
463
 
240
464
  const rpmSigningSchema = z.strictObject({
241
465
  keyFile: text(KEY_FILE_ERROR),
242
466
  keyId: text(KEY_ID_ERROR).optional(),
243
- });
467
+ }) satisfies z.ZodType<DeployRpmSigningOptions>;
468
+
469
+ /** The `deploy.signing.flatpak` options: the GPG key that signs the Flatpak repository commit. */
470
+ type DeployFlatpakSigningOptions = {
471
+ /**
472
+ * GPG key ID that signs the Flatpak repository commit. The bundle embeds its public key, so
473
+ * `flatpak install --bundle` verifies the signature.
474
+ */
475
+ gpgKeyId: string;
476
+ /** GPG home directory containing the signing key. */
477
+ gpgHomeDir?: string | undefined;
478
+ };
244
479
 
245
480
  const flatpakSigningSchema = z.strictObject({
246
481
  gpgKeyId: text("must be a GPG key id"),
247
482
  gpgHomeDir: text("must be a path to a GPG home directory").optional(),
248
- });
483
+ }) satisfies z.ZodType<DeployFlatpakSigningOptions>;
484
+
485
+ /** The `deploy.signing.appimage` options: the GPG key that signs the AppImage. */
486
+ type DeployAppImageSigningOptions = {
487
+ /** GPG key ID used by appimagetool to sign the AppImage. */
488
+ gpgKeyId: string;
489
+ };
249
490
 
250
491
  const appimageSigningSchema = z.strictObject({
251
492
  gpgKeyId: text("must be a GPG key id"),
252
- });
493
+ }) satisfies z.ZodType<DeployAppImageSigningOptions>;
494
+
495
+ /** The `deploy.signing` options: how each package format is signed. Formats without an entry stay unsigned. */
496
+ type DeploySigningOptions = {
497
+ /** AppImage signing options. */
498
+ appimage?: DeployAppImageSigningOptions | undefined;
499
+ /** Debian package signing options. */
500
+ deb?: DeployDebSigningOptions | undefined;
501
+ /** Flatpak bundle signing options. */
502
+ flatpak?: DeployFlatpakSigningOptions | undefined;
503
+ /** RPM package signing options. */
504
+ rpm?: DeployRpmSigningOptions | undefined;
505
+ };
253
506
 
254
507
  const signingSchema = z.strictObject({
255
508
  appimage: appimageSigningSchema.optional(),
256
509
  deb: debSigningSchema.optional(),
257
510
  flatpak: flatpakSigningSchema.optional(),
258
511
  rpm: rpmSigningSchema.optional(),
259
- });
512
+ }) satisfies z.ZodType<DeploySigningOptions>;
513
+
514
+ /** The `deploy.relations` options: package relationships besides dependencies, for Debian and RPM. */
515
+ type DeployRelationsOptions = {
516
+ /** Recommended packages that extend the application's functionality. */
517
+ recommends?: DeployPackageRelationOptions | undefined;
518
+ /** Suggested companion packages. */
519
+ suggests?: DeployPackageRelationOptions | undefined;
520
+ /** Package names or capabilities supplied by this package. */
521
+ provides?: DeployPackageRelationOptions | undefined;
522
+ /** Packages that cannot be installed alongside this package. */
523
+ conflicts?: DeployPackageRelationOptions | undefined;
524
+ /** Packages whose files this package may replace. */
525
+ replaces?: DeployPackageRelationOptions | undefined;
526
+ /** Debian packages made incompatible by installing this package. Debian packages only. */
527
+ breaks?: DeployDebPackageRelationOptions | undefined;
528
+ /** Debian dependencies required before unpacking this package. Debian packages only. */
529
+ preDepends?: DeployDebPackageRelationOptions | undefined;
530
+ };
260
531
 
261
532
  const extraRelationsSchema = z.strictObject({
262
533
  recommends: relationsSchema.optional(),
@@ -264,9 +535,127 @@ const extraRelationsSchema = z.strictObject({
264
535
  provides: relationsSchema.optional(),
265
536
  conflicts: relationsSchema.optional(),
266
537
  replaces: relationsSchema.optional(),
267
- breaks: relationsSchema.optional(),
268
- preDepends: relationsSchema.optional(),
269
- });
538
+ breaks: debRelationsSchema.optional(),
539
+ preDepends: debRelationsSchema.optional(),
540
+ }) satisfies z.ZodType<DeployRelationsOptions>;
541
+
542
+ /** The `deploy` options: application metadata, bundled runtime settings, and packaging options for `gtkx deploy`. */
543
+ type DeployOptions = {
544
+ /** Package formats to build. Defaults to `["flatpak"]`; overridden by `gtkx deploy --target`. */
545
+ targets?: ("appimage" | "deb" | "flatpak" | "rpm")[] | undefined;
546
+ /** Target CPU architectures. Defaults to the host architecture; overridden by `gtkx deploy --arch`. */
547
+ architectures?: ("arm64" | "x64")[] | undefined;
548
+ /** Deployment directory relative to the project root. Defaults to `build`, with packages in its `out` directory. */
549
+ outDir?: string | undefined;
550
+ /** Display name, derived from package.json's name or the application ID when omitted. */
551
+ name?: string | undefined;
552
+ /** Generic application description shown by desktop launchers, such as `Text Editor`. */
553
+ genericName?: string | undefined;
554
+ /** Launcher command name, derived from package.json's name or the application ID when omitted. */
555
+ binaryName?: string | undefined;
556
+ /** Application version. Defaults to the version in package.json. */
557
+ version?: string | undefined;
558
+ /** Debian packaging revision and RPM release. Defaults to `1`. */
559
+ release?: string | undefined;
560
+ /** Non-negative Debian and RPM version epoch, omitted from package metadata unless configured. */
561
+ epoch?: number | undefined;
562
+ /** Single-line summary without a trailing period. Defaults to the first line of package.json's description. */
563
+ summary?: string | undefined;
564
+ /** Long description as paragraphs. Defaults to the summary when omitted or empty. */
565
+ description?: string[] | undefined;
566
+ /** Search keywords included in the desktop entry and AppStream metadata. */
567
+ keywords?: string[] | undefined;
568
+ /** Freedesktop application categories used by launchers, software centers, and package metadata. */
569
+ categories?: string[] | undefined;
570
+ /** Supported MIME types, combined with types from file associations and URL protocols. */
571
+ mimeTypes?: string[] | undefined;
572
+ /** Developer identity and package maintainer details. */
573
+ developer?: DeployDeveloperOptions | undefined;
574
+ /** Application license as an SPDX expression. Defaults to the license in package.json. */
575
+ license?: string | undefined;
576
+ /** License file path relative to the project root, detected from common LICENSE or COPYING names when omitted. */
577
+ licenseFile?: string | undefined;
578
+ /** SPDX license expression for the AppStream metadata. Defaults to `CC0-1.0`. */
579
+ metadataLicense?: string | undefined;
580
+ /** Copyright notice. Defaults to the build year and developer name. */
581
+ copyright?: string | undefined;
582
+ /** Application homepage URL. Defaults to the homepage in package.json. */
583
+ homepage?: string | undefined;
584
+ /** Additional AppStream links keyed by their purpose, such as `bugtracker` or `help`. */
585
+ urls?:
586
+ | Partial<
587
+ Record<
588
+ "bugtracker" | "contact" | "contribute" | "donation" | "faq" | "help" | "translate" | "vcs-browser",
589
+ string
590
+ >
591
+ >
592
+ | undefined;
593
+ /** Screenshots for software centers. Each entry requires a `url` or `file`. */
594
+ screenshots?: DeployScreenshotOptions[] | undefined;
595
+ /** Base URL for screenshot files, inferred from a GitHub or GitLab remote when omitted. */
596
+ screenshotBaseUrl?: string | undefined;
597
+ /** Primary branding colors included in AppStream metadata. */
598
+ branding?: DeployBrandingOptions | undefined;
599
+ /** OARS 1.1 content-rating attributes mapped to their intensities. */
600
+ contentRating?: Record<string, "intense" | "mild" | "moderate" | "none"> | undefined;
601
+ /** AppStream release history, sorted newest first. Defaults to the application version and build date. */
602
+ releases?: DeployReleaseOptions[] | undefined;
603
+ /** Application arguments included in the desktop entry's launch command. */
604
+ execArgs?: string[] | undefined;
605
+ /** Environment variables exported by the generated launcher. Keys must be POSIX environment names. */
606
+ launcherEnv?: Record<string, string> | undefined;
607
+ /** Node.js flags placed before the application bundle in the generated launcher. */
608
+ nodeFlags?: string[] | undefined;
609
+ /** File extensions and MIME types registered for the application. */
610
+ fileAssociations?: DeployFileAssociationOptions[] | undefined;
611
+ /** URL schemes handled by the application, registered as `x-scheme-handler` MIME types. */
612
+ protocols?: string[] | undefined;
613
+ /**
614
+ * Desktop launcher actions keyed by action ID. With `isDbusActivatable`, the application must register an
615
+ * `app.<id>` action for each one.
616
+ */
617
+ desktopActions?: Record<string, DeployDesktopActionOptions> | undefined;
618
+ /**
619
+ * Additional desktop entry keys, overriding non-reserved generated values.
620
+ * `DBusActivatable` and `Version` are rejected; use `deploy.isDbusActivatable` for D-Bus activation.
621
+ */
622
+ desktopEntry?: Record<string, string> | undefined;
623
+ /** Additional XML fragments appended to the AppStream component. */
624
+ metainfoExtra?: string[] | undefined;
625
+ /** Enable D-Bus activation in the desktop entry and generate a session bus service file. Defaults to `false`. */
626
+ isDbusActivatable?: boolean | undefined;
627
+ /**
628
+ * Extra files keyed by destination inside the install prefix, without a leading slash or a `..` segment.
629
+ * Each value is a source path relative to the project root, or a {@link DeployExtraFileOptions} entry that
630
+ * also sets the file mode. A directory source installs every file below it at the same path below the
631
+ * destination; without a mode, each file is executable when its source is. Scripts installed this way, such
632
+ * as a helper command's launcher, can run the bundled Node.js runtime at `lib/<binaryName>/node` in every
633
+ * prebuilt target and in source Flatpaks.
634
+ */
635
+ extraFiles?: Record<string, string | DeployExtraFileOptions> | undefined;
636
+ /** Minimum runtime library versions keyed by GIR library ID, used when deriving package dependencies. */
637
+ minimumLibraryVersions?: Record<string, string> | undefined;
638
+ /** Additional Debian and RPM dependencies merged with automatically detected dependencies. */
639
+ depends?: DeployPackageRelationOptions | undefined;
640
+ /** Additional package relationships for Debian and RPM. */
641
+ relations?: DeployRelationsOptions | undefined;
642
+ /** Installation and removal scripts for Debian and RPM packages. */
643
+ scripts?: DeployScriptsOptions | undefined;
644
+ /** Node.js runtime bundled with prebuilt packages and launcher compile-cache settings. */
645
+ node?: DeployNodeOptions | undefined;
646
+ /** Overrides for executables used to build packages. */
647
+ tools?: DeployToolsOptions | undefined;
648
+ /** Per-format package signing options. */
649
+ signing?: DeploySigningOptions | undefined;
650
+ /** AppImage packaging options. */
651
+ appimage?: DeployAppImageOptions | undefined;
652
+ /** Debian package metadata and compression options. */
653
+ deb?: DeployDebOptions | undefined;
654
+ /** Flatpak runtime, sandbox, build, and distribution options. */
655
+ flatpak?: DeployFlatpakOptions | undefined;
656
+ /** RPM package metadata and compression options. */
657
+ rpm?: DeployRpmOptions | undefined;
658
+ };
270
659
 
271
660
  const deploySchema = z.strictObject({
272
661
  targets: z
@@ -314,15 +703,15 @@ const deploySchema = z.strictObject({
314
703
  execArgs: textList("argument", "must be an array of arguments appended to Exec").optional(),
315
704
  launcherEnv: launcherEnvSchema.optional(),
316
705
  nodeFlags: nodeFlagsSchema.optional(),
317
- fileAssociations: z
318
- .array(fileAssociationSchema, { error: "must be an array of file associations" })
319
- .optional(),
706
+ fileAssociations: z.array(fileAssociationSchema, { error: "must be an array of file associations" }).optional(),
320
707
  protocols: textList("URL scheme", "must be an array of URL schemes").optional(),
321
708
  desktopActions: z
322
709
  .record(z.string(), desktopActionSchema, { error: "must be a record of action ids to actions" })
323
710
  .optional(),
324
- desktopEntry: textRecord("must be a desktop entry value", "must be a record of desktop entry keys to values")
325
- .optional(),
711
+ desktopEntry: textRecord(
712
+ "must be a desktop entry value",
713
+ "must be a record of desktop entry keys to values",
714
+ ).optional(),
326
715
  metainfoExtra: textList("AppStream XML fragment", "must be an array of AppStream XML fragments").optional(),
327
716
  isDbusActivatable: flag(BOOLEAN_ERROR).optional(),
328
717
  extraFiles: relativePathRecord(
@@ -335,11 +724,38 @@ const deploySchema = z.strictObject({
335
724
  relations: extraRelationsSchema.optional(),
336
725
  scripts: scriptsSchema.optional(),
337
726
  node: nodeRuntimeSchema.optional(),
727
+ tools: toolsSchema.optional(),
338
728
  signing: signingSchema.optional(),
339
729
  appimage: appimageSchema.optional(),
340
730
  deb: debSchema.optional(),
341
731
  flatpak: flatpakSchema.optional(),
342
732
  rpm: rpmSchema.optional(),
343
- });
733
+ }) satisfies z.ZodType<DeployOptions>;
344
734
 
345
- export { deploySchema, type DeployExtraFileOptions, type DeployNodeOptions };
735
+ export {
736
+ deploySchema,
737
+ type DeployAppImageOptions,
738
+ type DeployAppImageSigningOptions,
739
+ type DeployBrandingOptions,
740
+ type DeployDebOptions,
741
+ type DeployDebPackageRelationOptions,
742
+ type DeployDebSigningOptions,
743
+ type DeployDesktopActionOptions,
744
+ type DeployDeveloperOptions,
745
+ type DeployExtraFileOptions,
746
+ type DeployFileAssociationOptions,
747
+ type DeployFlatpakOptions,
748
+ type DeployFlatpakSigningOptions,
749
+ type DeployFlatpakSourceOptions,
750
+ type DeployNodeOptions,
751
+ type DeployOptions,
752
+ type DeployPackageRelationOptions,
753
+ type DeployRelationsOptions,
754
+ type DeployReleaseOptions,
755
+ type DeployRpmOptions,
756
+ type DeployRpmSigningOptions,
757
+ type DeployScreenshotOptions,
758
+ type DeployScriptsOptions,
759
+ type DeploySigningOptions,
760
+ type DeployToolsOptions,
761
+ };