@gtkx/config 2.0.0-beta.10 → 2.0.0-beta.12
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/README.md +11 -169
- package/dist/builtin-elements.d.ts +11 -0
- package/dist/builtin-elements.d.ts.map +1 -0
- package/dist/builtin-elements.js +329 -0
- package/dist/builtin-elements.js.map +1 -0
- package/dist/config-dependencies.d.ts +5 -3
- package/dist/config-dependencies.d.ts.map +1 -1
- package/dist/config-dependencies.js +57 -24
- package/dist/config-dependencies.js.map +1 -1
- package/dist/config-error.d.ts.map +1 -1
- package/dist/config-error.js.map +1 -1
- package/dist/config-reloader.d.ts +8 -0
- package/dist/config-reloader.d.ts.map +1 -0
- package/dist/config-reloader.js +32 -0
- package/dist/config-reloader.js.map +1 -0
- package/dist/config-source.d.ts +9 -0
- package/dist/config-source.d.ts.map +1 -0
- package/dist/config-source.js +32 -0
- package/dist/config-source.js.map +1 -0
- package/dist/config.d.ts +63 -29
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +72 -12
- package/dist/config.js.map +1 -1
- package/dist/deploy.d.ts +67 -13
- package/dist/deploy.d.ts.map +1 -1
- package/dist/deploy.js +169 -12
- package/dist/deploy.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +5 -3
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +5 -3
- package/dist/internal.js.map +1 -1
- package/dist/loader.d.ts +3 -1
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +18 -35
- package/dist/loader.js.map +1 -1
- package/dist/node-version.d.ts +2 -1
- package/dist/node-version.d.ts.map +1 -1
- package/dist/node-version.js +2 -1
- package/dist/node-version.js.map +1 -1
- package/dist/resource-base-path.d.ts.map +1 -1
- package/dist/schema-text.d.ts.map +1 -1
- package/dist/user-event-signals.d.ts.map +1 -1
- package/dist/virtual.d.ts +1 -1
- package/dist/virtual.d.ts.map +1 -1
- package/dist/virtual.js +3 -4
- package/dist/virtual.js.map +1 -1
- package/dist/vite-plugin.d.ts +2 -0
- package/dist/vite-plugin.d.ts.map +1 -1
- package/dist/vite-plugin.js +4 -3
- package/dist/vite-plugin.js.map +1 -1
- package/dist/vite-root.d.ts.map +1 -1
- package/package.json +15 -16
- package/src/builtin-elements.ts +338 -0
- package/src/config-dependencies.ts +65 -29
- package/src/config-error.ts +5 -3
- package/src/config-reloader.ts +45 -0
- package/src/config-source.ts +48 -0
- package/src/config.ts +87 -18
- package/src/deploy.ts +207 -29
- package/src/index.ts +9 -2
- package/src/internal.ts +5 -2
- package/src/loader.ts +27 -52
- package/src/node-version.ts +2 -1
- package/src/virtual.ts +5 -6
- package/src/vite-plugin.ts +9 -4
package/src/deploy.ts
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
flag,
|
|
5
|
-
girLibrary,
|
|
6
|
-
relativePathRecord,
|
|
7
|
-
text,
|
|
8
|
-
textList,
|
|
9
|
-
textRecord,
|
|
10
|
-
url,
|
|
11
|
-
} from "./schema-text.ts";
|
|
12
|
-
|
|
13
|
-
const APPIMAGE_COMPRESSIONS = ["gzip", "xz", "zstd"] as const;
|
|
2
|
+
import { fileExtension, flag, girLibrary, relativePathRecord, text, textList, textRecord, url } from "./schema-text.ts";
|
|
3
|
+
|
|
14
4
|
const DEB_COMPRESSIONS = ["gzip", "none", "xz", "zstd"] as const;
|
|
15
5
|
const DEB_SIGN_METHODS = ["debsign", "dpkg-sig"] as const;
|
|
16
6
|
const DEB_SIGN_TYPES = ["archive", "maint", "origin"] as const;
|
|
@@ -70,50 +60,89 @@ const minimumLibraryVersionsSchema = z.record(girLibrary(LIBRARY_ID_ERROR), mini
|
|
|
70
60
|
});
|
|
71
61
|
|
|
72
62
|
const relationsSchema = z.strictObject({
|
|
63
|
+
/** Package relations expressed in Debian dependency syntax. */
|
|
73
64
|
deb: textList("Debian package relation", "must be an array of Debian package relations").optional(),
|
|
65
|
+
/** Package relations expressed in RPM dependency syntax. */
|
|
74
66
|
rpm: textList("RPM package relation", "must be an array of RPM package relations").optional(),
|
|
75
67
|
});
|
|
76
68
|
|
|
77
69
|
const developerSchema = z.strictObject({
|
|
70
|
+
/** Reverse-DNS developer identifier, derived from the application ID when omitted. */
|
|
78
71
|
id: text("must be a reverse-DNS developer id").optional(),
|
|
72
|
+
/** Developer or organization name. Defaults to the author in package.json. */
|
|
79
73
|
name: text("must be a developer or organization name").optional(),
|
|
74
|
+
/** Maintainer email address. Defaults to the author's email in package.json. */
|
|
80
75
|
email: text("must be an email address").optional(),
|
|
81
76
|
});
|
|
82
77
|
|
|
78
|
+
/** One software-center screenshot in `deploy.screenshots`. Either `url` or `file` must be set. */
|
|
79
|
+
type DeployScreenshotOptions = z.infer<typeof screenshotSchema>;
|
|
80
|
+
|
|
81
|
+
/** Screenshot entry schema and the source of {@link DeployScreenshotOptions}. */
|
|
83
82
|
const screenshotSchema = z
|
|
84
83
|
.strictObject({
|
|
84
|
+
/** Absolute URL of a PNG or JPEG screenshot. Takes precedence over `file`. */
|
|
85
85
|
url: url("must be an absolute URL to a PNG or JPEG").optional(),
|
|
86
|
+
/** Screenshot path relative to the project root, resolved against `screenshotBaseUrl`. */
|
|
86
87
|
file: text("must be an image path relative to the project root").optional(),
|
|
88
|
+
/** Caption displayed with the screenshot in software centers. */
|
|
87
89
|
caption: text("must be a screenshot caption").optional(),
|
|
90
|
+
/** Marks the primary screenshot. Only the first entry set to `true` is used. */
|
|
88
91
|
isDefault: flag(BOOLEAN_ERROR).optional(),
|
|
89
92
|
})
|
|
90
93
|
.refine((entry) => entry.url !== undefined || entry.file !== undefined, {
|
|
91
94
|
error: "must have either a `url` or a `file`",
|
|
92
95
|
});
|
|
93
96
|
|
|
97
|
+
/** One AppStream release-history entry in `deploy.releases`. */
|
|
98
|
+
type DeployReleaseOptions = z.infer<typeof releaseSchema>;
|
|
99
|
+
|
|
100
|
+
/** Release-history entry schema and the source of {@link DeployReleaseOptions}. */
|
|
94
101
|
const releaseSchema = z.strictObject({
|
|
102
|
+
/** Application version described by this release. */
|
|
95
103
|
version: text(VERSION_ERROR),
|
|
104
|
+
/** Release date in `YYYY-MM-DD` format. */
|
|
96
105
|
date: z.iso.date({ error: "must be an ISO date (YYYY-MM-DD)" }),
|
|
106
|
+
/** AppStream release classification. */
|
|
97
107
|
type: z.enum(RELEASE_TYPES, { error: "must be one of development, snapshot, stable" }).optional(),
|
|
108
|
+
/** AppStream update urgency. */
|
|
98
109
|
urgency: z.enum(RELEASE_URGENCIES, { error: "must be one of critical, high, low, medium" }).optional(),
|
|
110
|
+
/** Release notes, with each entry rendered as a paragraph. */
|
|
99
111
|
notes: textList("release note paragraph", "must be an array of release note paragraphs").optional(),
|
|
112
|
+
/** Absolute URL containing further details about the release. */
|
|
100
113
|
url: url(URL_ERROR).optional(),
|
|
101
114
|
});
|
|
102
115
|
|
|
116
|
+
/** One file extension and MIME type registered through `deploy.fileAssociations`. */
|
|
117
|
+
type DeployFileAssociationOptions = z.infer<typeof fileAssociationSchema>;
|
|
118
|
+
|
|
119
|
+
/** File association schema and the source of {@link DeployFileAssociationOptions}. */
|
|
103
120
|
const fileAssociationSchema = z.strictObject({
|
|
121
|
+
/** File extension to associate with the application, without a leading dot. */
|
|
104
122
|
extension: fileExtension("must be a file extension without a leading dot"),
|
|
123
|
+
/** MIME type registered for the file extension. */
|
|
105
124
|
mimeType: text("must be a MIME type such as text/plain"),
|
|
125
|
+
/** Human-readable description of the file type. */
|
|
106
126
|
description: text("must be a description of the file type").optional(),
|
|
107
127
|
});
|
|
108
128
|
|
|
129
|
+
/** One desktop launcher action in `deploy.desktopActions`, keyed by its action ID. */
|
|
130
|
+
type DeployDesktopActionOptions = z.infer<typeof desktopActionSchema>;
|
|
131
|
+
|
|
132
|
+
/** Desktop launcher action schema and the source of {@link DeployDesktopActionOptions}. */
|
|
109
133
|
const desktopActionSchema = z.strictObject({
|
|
134
|
+
/** Action label shown in the desktop launcher menu. */
|
|
110
135
|
name: text("must be an action name"),
|
|
136
|
+
/** Arguments passed to the application when the action is activated. */
|
|
111
137
|
args: textList("argument", "must be an array of arguments appended to Exec").optional(),
|
|
138
|
+
/** Icon theme name used for the action. */
|
|
112
139
|
icon: text("must be an icon name").optional(),
|
|
113
140
|
});
|
|
114
141
|
|
|
115
142
|
const brandingSchema = z.strictObject({
|
|
143
|
+
/** Primary AppStream branding color for light mode, in `#rrggbb` format. */
|
|
116
144
|
light: hexColorSchema,
|
|
145
|
+
/** Primary AppStream branding color for dark mode, in `#rrggbb` format. */
|
|
117
146
|
dark: hexColorSchema,
|
|
118
147
|
});
|
|
119
148
|
|
|
@@ -121,12 +150,16 @@ const brandingSchema = z.strictObject({
|
|
|
121
150
|
* A `deploy.extraFiles` entry in object form: the source file, resolved against the project root, that is
|
|
122
151
|
* installed at the entry's prefix-relative destination, and the octal mode it is installed with.
|
|
123
152
|
*/
|
|
124
|
-
type DeployExtraFileOptions =
|
|
153
|
+
type DeployExtraFileOptions = {
|
|
154
|
+
/** Source file path, resolved relative to the project root. */
|
|
155
|
+
source: string;
|
|
125
156
|
/** Octal file mode. Setuid and setgid bits are rejected. */
|
|
126
157
|
mode?: string | undefined;
|
|
127
158
|
};
|
|
128
159
|
const extraFileSchema: z.ZodType<DeployExtraFileOptions> = z.strictObject({
|
|
160
|
+
/** Source file path, resolved relative to the project root. */
|
|
129
161
|
source: text(SOURCE_PATH_ERROR),
|
|
162
|
+
/** Octal file mode. Setuid and setgid bits are rejected. */
|
|
130
163
|
mode: z
|
|
131
164
|
.string({ error: FILE_MODE_ERROR })
|
|
132
165
|
.regex(FILE_MODE_PATTERN, { error: FILE_MODE_ERROR })
|
|
@@ -141,7 +174,7 @@ const extraFileEntrySchema = z.union([text(SOURCE_PATH_ERROR), extraFileSchema],
|
|
|
141
174
|
const launcherEnvSchema = z.record(
|
|
142
175
|
z.string({ error: LAUNCHER_ENV_NAME_ERROR }).regex(LAUNCHER_ENV_NAME_PATTERN, { error: LAUNCHER_ENV_NAME_ERROR }),
|
|
143
176
|
z.string({ error: LAUNCHER_ENV_ERROR }).refine((value) => !value.includes("\0"), { error: LAUNCHER_ENV_ERROR }),
|
|
144
|
-
{ error: (issue) => issue.code === "invalid_key" ? LAUNCHER_ENV_NAME_ERROR : LAUNCHER_ENV_ERROR },
|
|
177
|
+
{ error: (issue) => (issue.code === "invalid_key" ? LAUNCHER_ENV_NAME_ERROR : LAUNCHER_ENV_ERROR) },
|
|
145
178
|
);
|
|
146
179
|
|
|
147
180
|
const nodeFlagsSchema = z.array(
|
|
@@ -155,192 +188,337 @@ const nodeFlagsSchema = z.array(
|
|
|
155
188
|
* The `deploy.node` options: where the Node.js runtime bundled with the application comes from, the version it
|
|
156
189
|
* is expected to be, whether its binary is stripped, and whether the launcher enables the compile cache.
|
|
157
190
|
*/
|
|
158
|
-
type DeployNodeOptions =
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
> & {
|
|
163
|
-
/** Expected Node.js version. Downloaded runtimes default to exactly 26.7.0 when omitted. */
|
|
191
|
+
type DeployNodeOptions = {
|
|
192
|
+
/** Runtime source: an official download, the running Node.js executable, or `path`. Defaults to `download`. */
|
|
193
|
+
source?: "download" | "host" | "path" | undefined;
|
|
194
|
+
/** Expected Node.js version. Downloaded runtimes default to exactly 26.8.2 when omitted. */
|
|
164
195
|
version?: string | undefined;
|
|
196
|
+
/** Node.js executable path relative to the project root, required when `source` is `path`. */
|
|
197
|
+
path?: string | undefined;
|
|
198
|
+
/** Strip the runtime when its architecture matches the host and `strip` is available. Defaults to `true`. */
|
|
199
|
+
shouldStrip?: boolean | undefined;
|
|
200
|
+
/** Enable Node.js compile caching in the generated launcher. Defaults to `true`. */
|
|
201
|
+
shouldUseCompileCache?: boolean | undefined;
|
|
165
202
|
};
|
|
166
203
|
const nodeRuntimeSchema: z.ZodType<DeployNodeOptions> = z.strictObject({
|
|
204
|
+
/** Runtime source: an official download, the running Node.js executable, or `path`. Defaults to `download`. */
|
|
167
205
|
source: z.enum(NODE_SOURCES, { error: "must be one of download, host, path" }).optional(),
|
|
206
|
+
/** Expected Node.js version. Downloaded runtimes default to exactly 26.8.2 when omitted. */
|
|
168
207
|
version: text("must be a Node.js version such as 26.7.0").optional(),
|
|
208
|
+
/** Node.js executable path relative to the project root, required when `source` is `path`. */
|
|
169
209
|
path: text("must be a path to a node binary").optional(),
|
|
210
|
+
/** Strip the runtime when its architecture matches the host and `strip` is available. Defaults to `true`. */
|
|
170
211
|
shouldStrip: flag(BOOLEAN_ERROR).optional(),
|
|
212
|
+
/** Enable Node.js compile caching in the generated launcher. Defaults to `true`. */
|
|
171
213
|
shouldUseCompileCache: flag(BOOLEAN_ERROR).optional(),
|
|
172
214
|
});
|
|
173
215
|
|
|
174
216
|
const scriptsSchema = z.strictObject({
|
|
217
|
+
/** Shell script run before installing a Debian or RPM package. */
|
|
175
218
|
preInstall: text(SCRIPT_ERROR).optional(),
|
|
219
|
+
/** Shell script run after installing a Debian or RPM package. */
|
|
176
220
|
postInstall: text(SCRIPT_ERROR).optional(),
|
|
221
|
+
/** Shell script run before removing a Debian or RPM package. */
|
|
177
222
|
preRemove: text(SCRIPT_ERROR).optional(),
|
|
223
|
+
/** Shell script run after removing a Debian or RPM package. */
|
|
178
224
|
postRemove: text(SCRIPT_ERROR).optional(),
|
|
179
225
|
});
|
|
180
226
|
|
|
227
|
+
const toolsSchema = z.strictObject({
|
|
228
|
+
/** nFPM executable name or path relative to the project root. Defaults to a verified pinned download. */
|
|
229
|
+
nfpm: text("must be an nFPM executable name or path").optional(),
|
|
230
|
+
});
|
|
231
|
+
|
|
181
232
|
const debSchema = z.strictObject({
|
|
233
|
+
/** Debian package name. Defaults to `deploy.binaryName`. */
|
|
182
234
|
packageName: text("must be a Debian package name").optional(),
|
|
235
|
+
/** Debian archive section, derived from the application categories when omitted. */
|
|
183
236
|
section: text("must be a Debian archive section").optional(),
|
|
237
|
+
/** Debian package priority. Defaults to `optional`. */
|
|
184
238
|
priority: text("must be a Debian priority").optional(),
|
|
239
|
+
/** Compression used for the Debian package payload. */
|
|
185
240
|
compression: z.enum(DEB_COMPRESSIONS, { error: "must be one of gzip, none, xz, zstd" }).optional(),
|
|
186
|
-
|
|
187
|
-
|
|
241
|
+
/** Additional Debian control fields, keyed by field name. */
|
|
242
|
+
fields: textRecord("must be a control field value", "must be a record of control field names to values").optional(),
|
|
188
243
|
});
|
|
189
244
|
|
|
190
245
|
const rpmSchema = z.strictObject({
|
|
246
|
+
/** RPM package name. Defaults to `deploy.binaryName`. */
|
|
191
247
|
packageName: text("must be an RPM package name").optional(),
|
|
248
|
+
/** RPM package group, derived from the application categories when omitted. */
|
|
192
249
|
group: text("must be an RPM group").optional(),
|
|
250
|
+
/** Compression used for the RPM package payload. */
|
|
193
251
|
compression: z.enum(RPM_COMPRESSIONS, { error: "must be one of gzip, lzma, xz, zstd" }).optional(),
|
|
252
|
+
/** Installation prefixes that the RPM package allows users to relocate. */
|
|
194
253
|
prefixes: textList("prefix", "must be an array of relocation prefixes").optional(),
|
|
195
254
|
});
|
|
196
255
|
|
|
197
256
|
const appimageSchema = z.strictObject({
|
|
257
|
+
/** Output file name, derived from the application name, version, and architecture when omitted. */
|
|
198
258
|
fileName: text("must be an output file name").optional(),
|
|
199
|
-
|
|
259
|
+
/** Compression explicitly requested from appimagetool. */
|
|
260
|
+
compression: z.literal("zstd", { error: "must be zstd" }).optional(),
|
|
261
|
+
/** AppImage update information string embedded in the executable. */
|
|
200
262
|
updateInformation: text("must be an AppImage update information string").optional(),
|
|
263
|
+
/** Custom AppImage runtime file path, resolved relative to the project root. */
|
|
201
264
|
runtimeFile: text("must be a path to an AppImage runtime file").optional(),
|
|
202
265
|
});
|
|
203
266
|
|
|
204
267
|
const flatpakSourceSchema = z.strictObject({
|
|
268
|
+
/** Public HTTP or HTTPS Git repository URL. Defaults to the project's Git remote. */
|
|
205
269
|
url: url("must be an absolute git URL").optional(),
|
|
270
|
+
/** Git tag to build, pinned to its commit when `commit` is omitted. */
|
|
206
271
|
tag: text("must be a git tag").optional(),
|
|
272
|
+
/** Git commit to build. Defaults to the configured tag's commit or the current HEAD. */
|
|
207
273
|
commit: text("must be a git commit sha").optional(),
|
|
208
274
|
});
|
|
209
275
|
|
|
210
276
|
const flatpakSchema = z.strictObject({
|
|
277
|
+
/** Package local build output or build from a pinned Git source inside the SDK. Defaults to `prebuilt`. */
|
|
211
278
|
mode: z.enum(FLATPAK_MODES, { error: 'must be "prebuilt" or "source"' }).optional(),
|
|
279
|
+
/** Flatpak runtime ID. Defaults to `org.gnome.Platform`. */
|
|
212
280
|
runtime: text("must be a runtime id").optional(),
|
|
281
|
+
/** Flatpak runtime branch. Defaults to `50`. */
|
|
213
282
|
runtimeVersion: text('must be a runtime branch such as "50"').optional(),
|
|
283
|
+
/** Build SDK ID. Defaults to `org.gnome.Sdk`. */
|
|
214
284
|
sdk: text("must be an SDK id").optional(),
|
|
285
|
+
/** Node.js SDK extension used in source mode. Defaults to `org.freedesktop.Sdk.Extension.node26`. */
|
|
215
286
|
nodeExtension: text("must be a Node SDK extension id").optional(),
|
|
287
|
+
/** Additional SDK extension IDs included in the build environment. */
|
|
216
288
|
sdkExtensions: textList("SDK extension id", "must be an array of SDK extension ids").optional(),
|
|
289
|
+
/** Optional Flatpak base application ID. */
|
|
217
290
|
base: text("must be a base app id").optional(),
|
|
291
|
+
/** Branch of the base application. */
|
|
218
292
|
baseVersion: text("must be a base app version").optional(),
|
|
293
|
+
/** Exported application branch. Defaults to `stable`. */
|
|
219
294
|
branch: text("must be a branch name").optional(),
|
|
295
|
+
/** Sandbox permissions added to display, IPC, and GPU defaults. Negations remove matching defaults. */
|
|
220
296
|
finishArgs: textList("finish argument", "must be an array of flatpak finish arguments").optional(),
|
|
297
|
+
/** Patterns added to header, pkg-config, and static-library cleanup defaults. An empty array disables cleanup. */
|
|
221
298
|
cleanup: textList("cleanup pattern", "must be an array of cleanup patterns").optional(),
|
|
299
|
+
/** Additional shell commands appended to the application's Flatpak build commands. */
|
|
222
300
|
buildCommands: textList("shell command", "must be an array of shell commands").optional(),
|
|
301
|
+
/** Additional Flatpak manifest modules built before the application module. */
|
|
223
302
|
modules: z.array(z.unknown(), { error: "must be an array of flatpak module objects" }).optional(),
|
|
303
|
+
/** Git repository and revision used for source builds. */
|
|
224
304
|
source: flatpakSourceSchema.optional(),
|
|
305
|
+
/** Package manager used for offline source builds, detected from the project's lockfiles when omitted. */
|
|
225
306
|
packageManager: z.enum(PACKAGE_MANAGERS, { error: "must be one of npm, pnpm, yarn" }).optional(),
|
|
307
|
+
/** Lockfile path relative to the project root. Defaults to the selected package manager's standard lockfile. */
|
|
226
308
|
lockfile: text("must be a path to a lockfile").optional(),
|
|
309
|
+
/** Runtime repository URL embedded in the bundle. Defaults to Flathub's `.flatpakrepo` URL. */
|
|
227
310
|
runtimeRepo: url("must be an absolute .flatpakrepo URL").optional(),
|
|
311
|
+
/** Emit a `.flatpak` bundle in addition to the local repository. Defaults to `true`. */
|
|
228
312
|
shouldEmitBundle: flag(BOOLEAN_ERROR).optional(),
|
|
313
|
+
/** Install the built application into the current user's Flatpak installation. Defaults to `false`. */
|
|
229
314
|
shouldInstall: flag(BOOLEAN_ERROR).optional(),
|
|
315
|
+
/** Allow flatpak-builder to use rofiles-fuse. Set to `false` where FUSE is unavailable. */
|
|
230
316
|
shouldUseRofilesFuse: flag(BOOLEAN_ERROR).optional(),
|
|
231
317
|
});
|
|
232
318
|
|
|
233
319
|
const debSigningSchema = z.strictObject({
|
|
320
|
+
/** PGP private key file used to sign the Debian package. */
|
|
234
321
|
keyFile: text(KEY_FILE_ERROR),
|
|
322
|
+
/** PGP signing key ID. */
|
|
235
323
|
keyId: text(KEY_ID_ERROR).optional(),
|
|
324
|
+
/** Debian package signing method. */
|
|
236
325
|
method: z.enum(DEB_SIGN_METHODS, { error: 'must be "debsign" or "dpkg-sig"' }).optional(),
|
|
326
|
+
/** Debian signature role. */
|
|
237
327
|
type: z.enum(DEB_SIGN_TYPES, { error: "must be one of archive, maint, origin" }).optional(),
|
|
328
|
+
/** Name and email address recorded as the signer. */
|
|
238
329
|
signer: text("must be a signer name and email").optional(),
|
|
239
330
|
});
|
|
240
331
|
|
|
241
332
|
const rpmSigningSchema = z.strictObject({
|
|
333
|
+
/** PGP private key file used to sign the RPM package. */
|
|
242
334
|
keyFile: text(KEY_FILE_ERROR),
|
|
335
|
+
/** PGP signing key ID. */
|
|
243
336
|
keyId: text(KEY_ID_ERROR).optional(),
|
|
244
337
|
});
|
|
245
338
|
|
|
246
339
|
const flatpakSigningSchema = z.strictObject({
|
|
340
|
+
/** GPG key ID used to sign the Flatpak bundle. */
|
|
247
341
|
gpgKeyId: text("must be a GPG key id"),
|
|
342
|
+
/** GPG home directory containing the signing key. */
|
|
248
343
|
gpgHomeDir: text("must be a path to a GPG home directory").optional(),
|
|
249
344
|
});
|
|
250
345
|
|
|
251
346
|
const appimageSigningSchema = z.strictObject({
|
|
347
|
+
/** GPG key ID used by appimagetool to sign the AppImage. */
|
|
252
348
|
gpgKeyId: text("must be a GPG key id"),
|
|
253
349
|
});
|
|
254
350
|
|
|
255
351
|
const signingSchema = z.strictObject({
|
|
352
|
+
/** AppImage signing options. */
|
|
256
353
|
appimage: appimageSigningSchema.optional(),
|
|
354
|
+
/** Debian package signing options. */
|
|
257
355
|
deb: debSigningSchema.optional(),
|
|
356
|
+
/** Flatpak bundle signing options. */
|
|
258
357
|
flatpak: flatpakSigningSchema.optional(),
|
|
358
|
+
/** RPM package signing options. */
|
|
259
359
|
rpm: rpmSigningSchema.optional(),
|
|
260
360
|
});
|
|
261
361
|
|
|
262
362
|
const extraRelationsSchema = z.strictObject({
|
|
363
|
+
/** Recommended packages that extend the application's functionality. */
|
|
263
364
|
recommends: relationsSchema.optional(),
|
|
365
|
+
/** Suggested companion packages. */
|
|
264
366
|
suggests: relationsSchema.optional(),
|
|
367
|
+
/** Package names or capabilities supplied by this package. */
|
|
265
368
|
provides: relationsSchema.optional(),
|
|
369
|
+
/** Packages that cannot be installed alongside this package. */
|
|
266
370
|
conflicts: relationsSchema.optional(),
|
|
371
|
+
/** Packages whose files this package may replace. */
|
|
267
372
|
replaces: relationsSchema.optional(),
|
|
373
|
+
/** Debian packages made incompatible by installing this package. Uses the `deb` entries. */
|
|
268
374
|
breaks: relationsSchema.optional(),
|
|
375
|
+
/** Debian dependencies required before unpacking this package. Uses the `deb` entries. */
|
|
269
376
|
preDepends: relationsSchema.optional(),
|
|
270
377
|
});
|
|
271
378
|
|
|
272
379
|
const deploySchema = z.strictObject({
|
|
380
|
+
/** Package formats to build. Defaults to `["flatpak"]`; overridden by `gtkx deploy --target`. */
|
|
273
381
|
targets: z
|
|
274
382
|
.array(z.enum(DEPLOY_TARGET_NAMES, { error: "must be one of appimage, deb, flatpak, rpm" }), {
|
|
275
383
|
error: "must be an array of deploy targets",
|
|
276
384
|
})
|
|
277
385
|
.optional(),
|
|
386
|
+
/** Target CPU architectures. Defaults to the host architecture; overridden by `gtkx deploy --arch`. */
|
|
278
387
|
architectures: z
|
|
279
388
|
.array(z.enum(DEPLOY_ARCH_NAMES, { error: "must be one of arm64, x64" }), {
|
|
280
389
|
error: "must be an array of deploy architectures",
|
|
281
390
|
})
|
|
282
391
|
.optional(),
|
|
392
|
+
/** Deployment directory relative to the project root. Defaults to `build`, with packages in its `out` directory. */
|
|
283
393
|
outDir: text("must be a directory path relative to the project root").optional(),
|
|
394
|
+
/** Display name, derived from package.json's name or the application ID when omitted. */
|
|
284
395
|
name: text("must be the display name shown in the launcher").optional(),
|
|
396
|
+
/** Generic application description shown by desktop launchers, such as `Text Editor`. */
|
|
285
397
|
genericName: text("must be a generic application name").optional(),
|
|
398
|
+
/** Launcher command name, derived from package.json's name or the application ID when omitted. */
|
|
286
399
|
binaryName: text("must be a kebab-case command name").optional(),
|
|
400
|
+
/** Application version. Defaults to the version in package.json. */
|
|
287
401
|
version: text(VERSION_ERROR).optional(),
|
|
402
|
+
/** Debian packaging revision and RPM release. Defaults to `1`. */
|
|
288
403
|
release: text("must be a packaging revision").optional(),
|
|
404
|
+
/** Non-negative Debian and RPM version epoch, omitted from package metadata unless configured. */
|
|
289
405
|
epoch: z.int({ error: EPOCH_ERROR }).min(0, { error: EPOCH_ERROR }).optional(),
|
|
406
|
+
/** Single-line summary without a trailing period. Defaults to the first line of package.json's description. */
|
|
290
407
|
summary: text("must be a single-line summary without a trailing period").optional(),
|
|
408
|
+
/** Long description as paragraphs. Defaults to the summary when omitted or empty. */
|
|
291
409
|
description: textList("description paragraph", "must be an array of description paragraphs").optional(),
|
|
410
|
+
/** Search keywords included in the desktop entry and AppStream metadata. */
|
|
292
411
|
keywords: textList("search keyword", "must be an array of search keywords").optional(),
|
|
412
|
+
/** Freedesktop application categories used by launchers, software centers, and package metadata. */
|
|
293
413
|
categories: textList("freedesktop category", "must be an array of freedesktop categories").optional(),
|
|
414
|
+
/** Supported MIME types, combined with types from file associations and URL protocols. */
|
|
294
415
|
mimeTypes: textList("MIME type", "must be an array of MIME types").optional(),
|
|
416
|
+
/** Developer identity and package maintainer details. */
|
|
295
417
|
developer: developerSchema.optional(),
|
|
418
|
+
/** Application license as an SPDX expression. Defaults to the license in package.json. */
|
|
296
419
|
license: text(SPDX_ERROR).optional(),
|
|
420
|
+
/** License file path relative to the project root, detected from common LICENSE or COPYING names when omitted. */
|
|
297
421
|
licenseFile: text("must be a path to a license file").optional(),
|
|
422
|
+
/** SPDX license expression for the AppStream metadata. Defaults to `CC0-1.0`. */
|
|
298
423
|
metadataLicense: text(SPDX_ERROR).optional(),
|
|
424
|
+
/** Copyright notice. Defaults to the build year and developer name. */
|
|
299
425
|
copyright: text("must be a copyright line").optional(),
|
|
426
|
+
/** Application homepage URL. Defaults to the homepage in package.json. */
|
|
300
427
|
homepage: url(URL_ERROR).optional(),
|
|
428
|
+
/** Additional AppStream links keyed by their purpose, such as `bugtracker` or `help`. */
|
|
301
429
|
urls: z
|
|
302
430
|
.partialRecord(z.enum(URL_KINDS), url(URL_ERROR), {
|
|
303
431
|
error: "must be a record of AppStream url kinds to URLs",
|
|
304
432
|
})
|
|
305
433
|
.optional(),
|
|
434
|
+
/**
|
|
435
|
+
* Screenshots for software centers. Each entry requires a `url` or `file`.
|
|
436
|
+
* @see {@link DeployScreenshotOptions} for the fields accepted by each entry.
|
|
437
|
+
*/
|
|
306
438
|
screenshots: z.array(screenshotSchema, { error: "must be an array of screenshots" }).optional(),
|
|
439
|
+
/** Base URL for screenshot files, inferred from a GitHub or GitLab remote when omitted. */
|
|
307
440
|
screenshotBaseUrl: url("must be an absolute base URL").optional(),
|
|
441
|
+
/** Primary branding colors included in AppStream metadata. */
|
|
308
442
|
branding: brandingSchema.optional(),
|
|
443
|
+
/** OARS 1.1 content-rating attributes mapped to their intensities. */
|
|
309
444
|
contentRating: z
|
|
310
445
|
.record(z.string(), z.enum(OARS_INTENSITIES, { error: "must be one of intense, mild, moderate, none" }), {
|
|
311
446
|
error: "must be a record of OARS 1.1 attribute ids to intensities",
|
|
312
447
|
})
|
|
313
448
|
.optional(),
|
|
449
|
+
/**
|
|
450
|
+
* AppStream release history, sorted newest first. Defaults to the application version and build date.
|
|
451
|
+
* @see {@link DeployReleaseOptions} for the fields accepted by each entry.
|
|
452
|
+
*/
|
|
314
453
|
releases: z.array(releaseSchema, { error: "must be an array of releases" }).optional(),
|
|
454
|
+
/** Application arguments included in the desktop entry's launch command. */
|
|
315
455
|
execArgs: textList("argument", "must be an array of arguments appended to Exec").optional(),
|
|
456
|
+
/** Environment variables exported by the generated launcher. Keys must be POSIX environment names. */
|
|
316
457
|
launcherEnv: launcherEnvSchema.optional(),
|
|
458
|
+
/** Node.js flags placed before the application bundle in the generated launcher. */
|
|
317
459
|
nodeFlags: nodeFlagsSchema.optional(),
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
460
|
+
/**
|
|
461
|
+
* File extensions and MIME types registered for the application.
|
|
462
|
+
* @see {@link DeployFileAssociationOptions} for the fields accepted by each entry.
|
|
463
|
+
*/
|
|
464
|
+
fileAssociations: z.array(fileAssociationSchema, { error: "must be an array of file associations" }).optional(),
|
|
465
|
+
/** URL schemes handled by the application, registered as `x-scheme-handler` MIME types. */
|
|
321
466
|
protocols: textList("URL scheme", "must be an array of URL schemes").optional(),
|
|
467
|
+
/**
|
|
468
|
+
* Desktop launcher actions keyed by action ID.
|
|
469
|
+
* @see {@link DeployDesktopActionOptions} for the fields accepted by each entry.
|
|
470
|
+
*/
|
|
322
471
|
desktopActions: z
|
|
323
472
|
.record(z.string(), desktopActionSchema, { error: "must be a record of action ids to actions" })
|
|
324
473
|
.optional(),
|
|
325
|
-
|
|
326
|
-
|
|
474
|
+
/**
|
|
475
|
+
* Additional desktop entry keys, overriding non-reserved generated values.
|
|
476
|
+
* `DBusActivatable` and `Version` are rejected; use `deploy.isDbusActivatable` for D-Bus activation.
|
|
477
|
+
*/
|
|
478
|
+
desktopEntry: textRecord(
|
|
479
|
+
"must be a desktop entry value",
|
|
480
|
+
"must be a record of desktop entry keys to values",
|
|
481
|
+
).optional(),
|
|
482
|
+
/** Additional XML fragments appended to the AppStream component. */
|
|
327
483
|
metainfoExtra: textList("AppStream XML fragment", "must be an array of AppStream XML fragments").optional(),
|
|
484
|
+
/** Enable D-Bus activation in the desktop entry and generate a session bus service file. Defaults to `false`. */
|
|
328
485
|
isDbusActivatable: flag(BOOLEAN_ERROR).optional(),
|
|
486
|
+
/** Extra files keyed by destination inside the install prefix, with source paths relative to the project root. */
|
|
329
487
|
extraFiles: relativePathRecord(
|
|
330
488
|
"must be a destination path inside the install prefix, without a leading slash or a .. segment",
|
|
331
489
|
extraFileEntrySchema,
|
|
332
490
|
"must be a record of prefix-relative destinations to source paths or { source, mode } entries",
|
|
333
491
|
).optional(),
|
|
492
|
+
/** Minimum runtime library versions keyed by GIR library ID, used when deriving package dependencies. */
|
|
334
493
|
minimumLibraryVersions: minimumLibraryVersionsSchema.optional(),
|
|
494
|
+
/** Additional Debian and RPM dependencies merged with automatically detected dependencies. */
|
|
335
495
|
depends: relationsSchema.optional(),
|
|
496
|
+
/** Additional package relationships for Debian and RPM. */
|
|
336
497
|
relations: extraRelationsSchema.optional(),
|
|
498
|
+
/** Installation and removal scripts for Debian and RPM packages. */
|
|
337
499
|
scripts: scriptsSchema.optional(),
|
|
500
|
+
/** Node.js runtime bundled with prebuilt packages and launcher compile-cache settings. */
|
|
338
501
|
node: nodeRuntimeSchema.optional(),
|
|
502
|
+
/** Overrides for executables used to build packages. */
|
|
503
|
+
tools: toolsSchema.optional(),
|
|
504
|
+
/** Per-format package signing options. */
|
|
339
505
|
signing: signingSchema.optional(),
|
|
506
|
+
/** AppImage packaging options. */
|
|
340
507
|
appimage: appimageSchema.optional(),
|
|
508
|
+
/** Debian package metadata and compression options. */
|
|
341
509
|
deb: debSchema.optional(),
|
|
510
|
+
/** Flatpak runtime, sandbox, build, and distribution options. */
|
|
342
511
|
flatpak: flatpakSchema.optional(),
|
|
512
|
+
/** RPM package metadata and compression options. */
|
|
343
513
|
rpm: rpmSchema.optional(),
|
|
344
514
|
});
|
|
345
515
|
|
|
346
|
-
export {
|
|
516
|
+
export {
|
|
517
|
+
deploySchema,
|
|
518
|
+
type DeployDesktopActionOptions,
|
|
519
|
+
type DeployExtraFileOptions,
|
|
520
|
+
type DeployFileAssociationOptions,
|
|
521
|
+
type DeployNodeOptions,
|
|
522
|
+
type DeployReleaseOptions,
|
|
523
|
+
type DeployScreenshotOptions,
|
|
524
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
export { type Config, defineConfig, mergeConfig, type ResolvedConfig } from "./config.ts";
|
|
2
|
-
export {
|
|
1
|
+
export { type Config, defineConfig, type ElementConfigOptions, mergeConfig, type ResolvedConfig } from "./config.ts";
|
|
2
|
+
export {
|
|
3
|
+
type DeployDesktopActionOptions,
|
|
4
|
+
type DeployExtraFileOptions,
|
|
5
|
+
type DeployFileAssociationOptions,
|
|
6
|
+
type DeployNodeOptions,
|
|
7
|
+
type DeployReleaseOptions,
|
|
8
|
+
type DeployScreenshotOptions,
|
|
9
|
+
} from "./deploy.ts";
|
|
3
10
|
export { type ConfigLoader, type LoadedConfig, loadConfig } from "./loader.ts";
|
package/src/internal.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
export { configDependenciesFor } from "./config-dependencies.ts";
|
|
1
|
+
export { configDependenciesFor, loadConfigModule } from "./config-dependencies.ts";
|
|
2
|
+
export { createConfigReloader } from "./config-reloader.ts";
|
|
3
|
+
export { configCandidatePaths } from "./config-source.ts";
|
|
2
4
|
export type { McpSettings, ResolvedReactCompilerOptions } from "./config.ts";
|
|
3
5
|
export {
|
|
4
6
|
APPLICATION_ID_MAX_LENGTH,
|
|
5
7
|
isAgentReferenceEnabled,
|
|
6
8
|
isAgentRulesEnabled,
|
|
7
9
|
isValidApplicationId,
|
|
10
|
+
resolveAcceptedChildTypes,
|
|
8
11
|
resolveElementComponents,
|
|
9
12
|
resolveElementProps,
|
|
10
13
|
resolveLazyElements,
|
|
@@ -12,6 +15,6 @@ export {
|
|
|
12
15
|
resolveOmittedProps,
|
|
13
16
|
} from "./config.ts";
|
|
14
17
|
export { createConfigLoader } from "./loader.ts";
|
|
15
|
-
export { assertSupportedNodeVersion, MINIMUM_NODE_VERSION } from "./node-version.ts";
|
|
18
|
+
export { assertSupportedNodeVersion, DEFAULT_NODE_VERSION, MINIMUM_NODE_VERSION } from "./node-version.ts";
|
|
16
19
|
export { resourceBasePath } from "./resource-base-path.ts";
|
|
17
20
|
export { viteProjectRoot } from "./vite-root.ts";
|