@gtkx/config 2.0.0-beta.1 → 2.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config-error.d.ts +2 -2
- package/dist/config-error.d.ts.map +1 -1
- package/dist/config-error.js +6 -3
- package/dist/config-error.js.map +1 -1
- package/dist/config.d.ts +4 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -2
- package/dist/config.js.map +1 -1
- package/dist/deploy.d.ts +3 -0
- package/dist/deploy.d.ts.map +1 -1
- package/dist/deploy.js +21 -2
- package/dist/deploy.js.map +1 -1
- package/dist/internal.d.ts +1 -0
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +1 -0
- package/dist/internal.js.map +1 -1
- package/dist/loader.d.ts +1 -1
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +18 -3
- package/dist/loader.js.map +1 -1
- package/dist/node-version.d.ts +4 -0
- package/dist/node-version.d.ts.map +1 -0
- package/dist/node-version.js +12 -0
- package/dist/node-version.js.map +1 -0
- package/package.json +2 -2
- package/src/config-error.ts +9 -4
- package/src/config.ts +2 -2
- package/src/deploy.ts +30 -2
- package/src/internal.ts +1 -0
- package/src/loader.ts +23 -4
- package/src/node-version.ts +16 -0
package/dist/config-error.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
declare const isRecord: (value: unknown) => value is Record<string, unknown>;
|
|
3
|
-
declare const missingConfigFileError: (cwd: string) => Error;
|
|
4
|
-
declare const configError: (error: z.ZodError) => Error;
|
|
3
|
+
declare const missingConfigFileError: (cwd: string, configFile?: string) => Error;
|
|
4
|
+
declare const configError: (error: z.ZodError, configFile?: string) => Error;
|
|
5
5
|
export { isRecord, missingConfigFileError, configError };
|
|
6
6
|
//# sourceMappingURL=config-error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-error.d.ts","sourceRoot":"","sources":["../src/config-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,QAAA,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CACM,CAAC;
|
|
1
|
+
{"version":3,"file":"config-error.d.ts","sourceRoot":"","sources":["../src/config-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,QAAA,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CACM,CAAC;AAIzE,QAAA,MAAM,sBAAsB,GAAI,KAAK,MAAM,EAAE,aAAa,MAAM,KAAG,KAGC,CAAC;AAErE,QAAA,MAAM,WAAW,GAAI,OAAO,CAAC,CAAC,QAAQ,EAAE,mBAAgC,KAAG,KACJ,CAAC;AAExE,OAAO,EAAE,QAAQ,EAAE,sBAAsB,EAAE,WAAW,EAAE,CAAC"}
|
package/dist/config-error.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
const
|
|
2
|
+
const DEFAULT_CONFIG_FILE = "gtkx.config.ts";
|
|
3
3
|
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const configPrefix = (configFile) => `${configFile}:`;
|
|
5
|
+
const missingConfigFileError = (cwd, configFile) => new Error(configFile === undefined
|
|
6
|
+
? `${configPrefix(DEFAULT_CONFIG_FILE)} no configuration file found in ${cwd}`
|
|
7
|
+
: `${configPrefix(configFile)} no configuration file found`);
|
|
8
|
+
const configError = (error, configFile = DEFAULT_CONFIG_FILE) => new Error(`${configPrefix(configFile)}\n${z.prettifyError(error)}`);
|
|
6
9
|
export { isRecord, missingConfigFileError, configError };
|
|
7
10
|
//# sourceMappingURL=config-error.js.map
|
package/dist/config-error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-error.js","sourceRoot":"","sources":["../src/config-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,
|
|
1
|
+
{"version":3,"file":"config-error.js","sourceRoot":"","sources":["../src/config-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,mBAAmB,GAAG,gBAAgB,CAAC;AAE7C,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CAClE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAEzE,MAAM,YAAY,GAAG,CAAC,UAAkB,EAAU,EAAE,CAAC,GAAG,UAAU,GAAG,CAAC;AAEtE,MAAM,sBAAsB,GAAG,CAAC,GAAW,EAAE,UAAmB,EAAS,EAAE,CACvE,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS;IAC9B,CAAC,CAAC,GAAG,YAAY,CAAC,mBAAmB,CAAC,mCAAmC,GAAG,EAAE;IAC9E,CAAC,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,8BAA8B,CAAC,CAAC;AAErE,MAAM,WAAW,GAAG,CAAC,KAAiB,EAAE,UAAU,GAAG,mBAAmB,EAAS,EAAE,CAC/E,IAAI,KAAK,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAExE,OAAO,EAAE,QAAQ,EAAE,sBAAsB,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { z } from \"zod\";\n\nconst DEFAULT_CONFIG_FILE = \"gtkx.config.ts\";\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst configPrefix = (configFile: string): string => `${configFile}:`;\n\nconst missingConfigFileError = (cwd: string, configFile?: string): Error =>\n new Error(configFile === undefined\n ? `${configPrefix(DEFAULT_CONFIG_FILE)} no configuration file found in ${cwd}`\n : `${configPrefix(configFile)} no configuration file found`);\n\nconst configError = (error: z.ZodError, configFile = DEFAULT_CONFIG_FILE): Error =>\n new Error(`${configPrefix(configFile)}\\n${z.prettifyError(error)}`);\n\nexport { isRecord, missingConfigFileError, configError };\n"]}
|
package/dist/config.d.ts
CHANGED
|
@@ -162,6 +162,8 @@ declare const configSchema: z.ZodObject<{
|
|
|
162
162
|
url: z.ZodOptional<z.ZodURL>;
|
|
163
163
|
}, z.core.$strict>>>;
|
|
164
164
|
execArgs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
165
|
+
launcherEnv: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
166
|
+
nodeFlags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
165
167
|
fileAssociations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
166
168
|
extension: z.ZodString;
|
|
167
169
|
mimeType: z.ZodString;
|
|
@@ -174,6 +176,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
174
176
|
icon: z.ZodOptional<z.ZodString>;
|
|
175
177
|
}, z.core.$strict>>>;
|
|
176
178
|
desktopEntry: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
179
|
+
metainfoExtra: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
177
180
|
isDbusActivatable: z.ZodOptional<z.ZodBoolean>;
|
|
178
181
|
extraFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
179
182
|
source: z.ZodString;
|
|
@@ -343,7 +346,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
343
346
|
*/
|
|
344
347
|
declare const defineConfig: DefineConfig<Config>;
|
|
345
348
|
declare const isValidApplicationId: (applicationId: string) => boolean;
|
|
346
|
-
declare const validateConfig: (config: unknown) => void;
|
|
349
|
+
declare const validateConfig: (config: unknown, configFile?: string) => void;
|
|
347
350
|
declare const graduatedFutureKeys: (config: unknown) => string[];
|
|
348
351
|
/**
|
|
349
352
|
* Deep-merges a configuration over a base. `override` wins over `base` on conflicting scalar and object keys, while
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,KAAK,CAAC;AAG5D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,iGAAiG;AACjG,KAAK,oBAAoB,GAAG;IACxB,8CAA8C;IAC9C,eAAe,CAAC,EAAE,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;IACrD,iDAAiD;IACjD,cAAc,CAAC,EAAE,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;CACtD,CAAC;AAEF;;;GAGG;AACH,KAAK,4BAA4B,GAAG,oBAAoB,GAAG;IACvD,kDAAkD;IAClD,MAAM,EAAE,IAAI,CAAC;CAChB,CAAC;AAEF;;;;;GAKG;AACH,KAAK,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAC3C,KAAK,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAGvD,KAAK,WAAW,GAAG;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,2GAA2G;AAC3G,KAAK,cAAc,GAAG;IAClB,2DAA2D;IAC3D,aAAa,EAAE,MAAM,CAAC;IACtB,qFAAqF;IACrF,aAAa,EAAE,4BAA4B,GAAG,IAAI,CAAC;IACnD;;;OAGG;IACH,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,E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AE,UAAU,MAAM,KAAG,MAA8B,CAAC;AAUrF,QAAA,MAAM,mBAAmB,GAAI,UAAU,MAAM,CAAC,UAAU,CAAC,KAAG,MAAM,EAGpC,CAAC;AAc/B,QAAA,MAAM,wBAAwB,GAAI,UAAU,MAAM,CAAC,UAAU,CAAC,KAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAChC,CAAC;AAE7D,QAAA,MAAM,mBAAmB,GAAI,UAAU,MAAM,CAAC,UAAU,CAAC,KAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAC/B,CAAC;AAEzD,QAAA,MAAM,mBAAmB,GAAI,UAAU,MAAM,CAAC,UAAU,CAAC,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CACpB,CAAC;AAEhE,QAAA,MAAM,mBAAmB,GAAI,QAAQ,MAAM,KAAG,OAAyC,CAAC;AACxF,QAAA,MAAM,uBAAuB,GAAI,QAAQ,MAAM,KAAG,OAA6C,CAAC;AAEhG,QAAA,MAAM,kBAAkB,GAAI,QAAQ,MAAM,KAAG,WAG3C,CAAC;AAEH,QAAA,MAAM,aAAa,GAAI,QAAQ,MAAM,EAAE,OAAO,MAAM,KAAG,cAMrD,CAAC;AAEH,OAAO,EACH,yBAAyB,EACzB,YAAY,EACZ,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EACb,KAAK,WAAW,EAChB,KAAK,4BAA4B,EACjC,KAAK,MAAM,EACX,KAAK,cAAc,GACtB,CAAC"}
|
package/dist/config.js
CHANGED
|
@@ -118,10 +118,10 @@ const resolveReactCompilerOptions = (setting) => {
|
|
|
118
118
|
target: REACT_COMPILER_TARGET,
|
|
119
119
|
};
|
|
120
120
|
};
|
|
121
|
-
const validateConfig = (config) => {
|
|
121
|
+
const validateConfig = (config, configFile) => {
|
|
122
122
|
const result = validationSchema.safeParse(config);
|
|
123
123
|
if (!result.success) {
|
|
124
|
-
throw configError(result.error);
|
|
124
|
+
throw configError(result.error, configFile);
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
127
|
const graduatedFutureKeys = (config) => {
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAqB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAmDlE,MAAM,sBAAsB,GAAG,uDAAuD,CAAC;AACvF,MAAM,yBAAyB,GAAG,GAAG,CAAC;AACtC,MAAM,iBAAiB,GAAgB,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;AACrE,+DAA+D;AAC/D,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,CAAU,CAAC;AAC5E,8DAA8D;AAC9D,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,iBAAiB,EAAE,YAAY,CAAU,CAAC;AAC5E,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAEnC,MAAM,aAAa,GAAG,UAAU,CAAC,uDAAuD,CAAC;KACpF,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,iBAAiB,CAAC,GA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EAAE,SAAS,EAAE,IAAI,CAAC;IACjE,YAAY,EAAE,mBAAmB,CAAC,MAAM,CAAC,QAAQ,CAAC;CACrD,CAAC,CAAC;AAEH,OAAO,EACH,yBAAyB,EACzB,YAAY,EACZ,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,GAKhB,CAAC","sourcesContent":["import { createDefineConfig, type DefineConfig } from \"c12\";\nimport { defu } from \"defu\";\nimport { resolve } from \"node:path\";\nimport { z } from \"zod\";\nimport { configError, isRecord } from \"./config-error.ts\";\nimport { deploySchema } from \"./deploy.ts\";\nimport { girLibrary, text } from \"./schema-text.ts\";\nimport { resolveUserEventSignals } from \"./user-event-signals.ts\";\n\n/** Object form of the `reactCompiler` config key, forwarded to `babel-plugin-react-compiler`. */\ntype ReactCompilerOptions = {\n /** Which functions the compiler processes. */\n compilationMode?: (typeof COMPILATION_MODES)[number];\n /** Which compiler diagnostics fail the build. */\n panicThreshold?: (typeof PANIC_THRESHOLDS)[number];\n};\n\n/**\n * The React Compiler options the build hands to `babel-plugin-react-compiler`, with the React version\n * GTKX targets filled in.\n */\ntype ResolvedReactCompilerOptions = ReactCompilerOptions & {\n /** React major version the compiler emits for. */\n target: \"19\";\n};\n\n/**\n * User-facing configuration for a GTKX project, as authored in `gtkx.config.ts`: the GIR libraries\n * to bind and where to find them, the GApplication id, per-element configuration, the React\n * Compiler, codegen, and user event signal settings, and the `agents` and `mcp` blocks controlling\n * what coding agents are given.\n */\ntype Config = z.infer<typeof configSchema>;\ntype ModuleExport = z.infer<typeof moduleExportSchema>;\ntype ElementConfigEntry = z.infer<typeof elementConfigSchema>;\n\ntype McpSettings = {\n tools: string[];\n isReadOnly: boolean;\n};\n\n/** Configuration reduced to the values the app runtime and the build need, with paths already resolved. */\ntype ResolvedConfig = {\n /** The GApplication identifier the app registers under. */\n applicationId: string;\n /** React Compiler options for the build, or `null` when the compiler is disabled. */\n reactCompiler: ResolvedReactCompilerOptions | null;\n /**\n * Signal names, keyed by GLib type name, that stay suppressed while a React commit writes to a widget.\n * `notify` stays suppressed only for the property being written.\n */\n userEventSignals: Record<string, string[]>;\n /** Path of the module exporting per-element configs, or `null` when none is configured. */\n elements: string | null;\n /** GLib type names of the elements marked `isLazy`, whose GObject their parent container creates. */\n lazyElements: string[];\n};\n\nconst APPLICATION_ID_PATTERN = /^[A-Za-z_][A-Za-z0-9_-]*(\\.[A-Za-z_][A-Za-z0-9_-]*)+$/;\nconst APPLICATION_ID_MAX_LENGTH = 255;\nconst DEFAULT_LIBRARIES: Set<string> = new Set([\"Gtk-4.0\", \"Adw-1\"]);\n/** Compilation modes `babel-plugin-react-compiler` accepts. */\nconst COMPILATION_MODES = [\"infer\", \"syntax\", \"annotation\", \"all\"] as const;\n/** Panic thresholds `babel-plugin-react-compiler` accepts. */\nconst PANIC_THRESHOLDS = [\"none\", \"critical_errors\", \"all_errors\"] as const;\nconst REACT_COMPILER_TARGET = \"19\";\n\nconst librarySchema = girLibrary('must be of the form \"Name-Version\", such as \"Gtk-4.0\"')\n .refine((library) => !DEFAULT_LIBRARIES.has(library), { error: \"is bound by default; remove it\" });\n\nconst librariesSchema = z\n .array(librarySchema, { error: \"must be a non-empty string array or omitted\" })\n .min(1, { error: \"must be a non-empty string array or omitted\" });\n\nconst applicationIdSchema = z\n .string({ error: \"must satisfy g_application_id_is_valid\" })\n .refine((value) => isValidApplicationId(value), {\n error: 'must satisfy g_application_id_is_valid, such as \"org.example.MyApp\"',\n });\n\nconst reactCompilerSchema = z.union([\n z.boolean(),\n z.object({\n compilationMode: z.enum(COMPILATION_MODES).optional(),\n panicThreshold: z.enum(PANIC_THRESHOLDS).optional(),\n }),\n]);\n\nconst userEventSignalsSchema = z.record(\n z.string(),\n z.array(\n z.string({ error: \"must be a non-empty signal name\" }).min(1, { error: \"must be a non-empty signal name\" }),\n {\n error: \"must be an array of signal names\",\n },\n ),\n { error: \"must be a record of GLib type names to signal name arrays\" },\n);\n\nconst moduleExportSchema = z.object(\n {\n module: z.string({ error: \"must be a module specifier\" }).min(1, { error: \"must be a module specifier\" }),\n export: z.string({ error: \"must be an export name\" }).min(1, { error: \"must be an export name\" }),\n },\n { error: \"must be a { module, export } object\" },\n);\n\nconst elementConfigSchema = z.object({\n component: moduleExportSchema.optional(),\n props: moduleExportSchema.optional(),\n isLazy: z.boolean({ error: \"must be a boolean\" }).optional(),\n omittedProps: z\n .array(\n z.string({ error: \"must be a non-empty property name\" }).min(1, {\n error: \"must be a non-empty property name\",\n }),\n { error: \"must be an array of property names\" },\n )\n .optional(),\n});\n\nconst elementsSchema = z.object({\n behaviors: z\n .string({ error: \"must be a path to a module exporting element behaviors\" })\n .min(1, { error: \"must be a path to a module exporting element behaviors\" })\n .optional(),\n config: z.record(z.string(), elementConfigSchema).optional(),\n});\n\nconst agentsSchema = z.object({\n rules: z.boolean({ error: \"must be a boolean\" }).optional(),\n reference: z.boolean({ error: \"must be a boolean\" }).optional(),\n});\n\nconst mcpSchema = z.object({\n tools: z\n .array(z.string({ error: \"must be a tool name pattern\" }).min(1, { error: \"must be a tool name pattern\" }), {\n error: \"must be an array of tool name patterns\",\n })\n .optional(),\n readOnly: z.boolean({ error: \"must be a boolean\" }).optional(),\n});\n\nconst graduatedFutureSchema = z\n .object({\n v2ByteArrays: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n v2ValueReturns: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n v2FinishResults: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n v2InoutReturns: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n v2ResourceImports: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n v2DefaultLibraries: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n v2TreeShaking: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n })\n .strict();\n\nconst deprecationsSchema = z.object({\n silence: z\n .array(z.never({ error: \"does not name a current deprecation\" }), {\n error: \"must be an array of current deprecation ids\",\n })\n .optional(),\n});\n\n/** Schema every `gtkx.config.ts` is validated against, and the source of the {@link Config} type. */\nconst configSchema = z.object({\n libraries: librariesSchema.optional(),\n girPath: z.array(z.string(), { error: \"must be an array of strings if provided\" }).optional(),\n applicationId: applicationIdSchema,\n reactCompiler: reactCompilerSchema.optional(),\n codegen: z.boolean({ error: \"must be a boolean\" }).optional(),\n userEventSignals: userEventSignalsSchema.optional(),\n elements: elementsSchema.optional(),\n applicationIcon: text(\"must be a path to an icon theme directory or a single icon file\").optional(),\n deploy: deploySchema.optional(),\n agents: agentsSchema.optional(),\n mcp: mcpSchema.optional(),\n deprecations: deprecationsSchema.optional(),\n});\n\n/**\n * Returns the given configuration unchanged, typed as {@link Config}, so `gtkx.config.ts` gets\n * autocompletion and type checking.\n */\nconst defineConfig: DefineConfig<Config> = createDefineConfig<Config>();\nconst validationSchema = configSchema.extend({ future: graduatedFutureSchema.optional() });\n\nconst isValidApplicationId = (applicationId: string): boolean =>\n applicationId.length <= APPLICATION_ID_MAX_LENGTH && APPLICATION_ID_PATTERN.test(applicationId);\n\nconst resolveReactCompilerOptions = (setting: Config[\"reactCompiler\"]): ResolvedReactCompilerOptions | null => {\n if (setting === false) {\n return null;\n }\n\n const overrides = setting === undefined || setting === true ? {} : setting;\n\n return {\n ...(overrides.compilationMode !== undefined && { compilationMode: overrides.compilationMode }),\n ...(overrides.panicThreshold !== undefined && { panicThreshold: overrides.panicThreshold }),\n target: REACT_COMPILER_TARGET,\n };\n};\n\nconst validateConfig = (config: unknown): void => {\n const result = validationSchema.safeParse(config);\n\n if (!result.success) {\n throw configError(result.error);\n }\n};\n\nconst graduatedFutureKeys = (config: unknown): string[] => {\n if (!isRecord(config) || !isRecord(config.future)) {\n return [];\n }\n\n return Object.keys(config.future).toSorted((first, second) => first.localeCompare(second));\n};\n\n/**\n * Deep-merges a configuration over a base. `override` wins over `base` on conflicting scalar and object keys, while\n * arrays are concatenated with the `override` entries first.\n */\nconst mergeConfig = (base: Config, override: Config): Config => defu(override, base);\n\nconst resolveElementsModule = (behaviors: string | undefined, root: string | undefined): string | null => {\n if (behaviors === undefined) {\n return null;\n }\n\n return root === undefined ? behaviors : resolve(root, behaviors);\n};\n\nconst resolveLazyElements = (elements: Config[\"elements\"]): string[] =>\n Object.entries(elements?.config ?? {})\n .filter(([, entry]) => entry.isLazy === true)\n .map(([type]) => type);\n\nconst elementEntryValues = <T>(\n elements: Config[\"elements\"],\n pick: (entry: ElementConfigEntry) => T | undefined,\n): Record<string, T> =>\n Object.fromEntries(\n Object.entries(elements?.config ?? {}).flatMap(([type, entry]) => {\n const value = pick(entry);\n\n return value === undefined ? [] : [[type, value] as const];\n }),\n );\n\nconst resolveElementComponents = (elements: Config[\"elements\"]): Record<string, ModuleExport> =>\n elementEntryValues(elements, (entry) => entry.component);\n\nconst resolveElementProps = (elements: Config[\"elements\"]): Record<string, ModuleExport> =>\n elementEntryValues(elements, (entry) => entry.props);\n\nconst resolveOmittedProps = (elements: Config[\"elements\"]): Record<string, string[]> =>\n elementEntryValues(elements, (entry) => entry.omittedProps);\n\nconst isAgentRulesEnabled = (config: Config): boolean => config.agents?.rules !== false;\nconst isAgentReferenceEnabled = (config: Config): boolean => config.agents?.reference !== false;\n\nconst resolveMcpSettings = (config: Config): McpSettings => ({\n tools: config.mcp?.tools ?? [],\n isReadOnly: config.mcp?.readOnly === true,\n});\n\nconst resolveConfig = (config: Config, root?: string): ResolvedConfig => ({\n applicationId: config.applicationId,\n reactCompiler: resolveReactCompilerOptions(config.reactCompiler),\n userEventSignals: resolveUserEventSignals(config.userEventSignals),\n elements: resolveElementsModule(config.elements?.behaviors, root),\n lazyElements: resolveLazyElements(config.elements),\n});\n\nexport {\n APPLICATION_ID_MAX_LENGTH,\n defineConfig,\n isAgentReferenceEnabled,\n isAgentRulesEnabled,\n isValidApplicationId,\n graduatedFutureKeys,\n validateConfig,\n mergeConfig,\n resolveLazyElements,\n resolveElementComponents,\n resolveElementProps,\n resolveMcpSettings,\n resolveOmittedProps,\n resolveConfig,\n type McpSettings,\n type ResolvedReactCompilerOptions,\n type Config,\n type ResolvedConfig,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAqB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAmDlE,MAAM,sBAAsB,GAAG,uDAAuD,CAAC;AACvF,MAAM,yBAAyB,GAAG,GAAG,CAAC;AACtC,MAAM,iBAAiB,GAAgB,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;AACrE,+DAA+D;AAC/D,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,CAAU,CAAC;AAC5E,8DAA8D;AAC9D,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,iBAAiB,EAAE,YAAY,CAAU,CAAC;AAC5E,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAEnC,MAAM,aAAa,GAAG,UAAU,CAAC,uDAAuD,CAAC;KACpF,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAA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AAS,EAAE,IAAI,CAAC;IACjE,YAAY,EAAE,mBAAmB,CAAC,MAAM,CAAC,QAAQ,CAAC;CACrD,CAAC,CAAC;AAEH,OAAO,EACH,yBAAyB,EACzB,YAAY,EACZ,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,GAKhB,CAAC","sourcesContent":["import { createDefineConfig, type DefineConfig } from \"c12\";\nimport { defu } from \"defu\";\nimport { resolve } from \"node:path\";\nimport { z } from \"zod\";\nimport { configError, isRecord } from \"./config-error.ts\";\nimport { deploySchema } from \"./deploy.ts\";\nimport { girLibrary, text } from \"./schema-text.ts\";\nimport { resolveUserEventSignals } from \"./user-event-signals.ts\";\n\n/** Object form of the `reactCompiler` config key, forwarded to `babel-plugin-react-compiler`. */\ntype ReactCompilerOptions = {\n /** Which functions the compiler processes. */\n compilationMode?: (typeof COMPILATION_MODES)[number];\n /** Which compiler diagnostics fail the build. */\n panicThreshold?: (typeof PANIC_THRESHOLDS)[number];\n};\n\n/**\n * The React Compiler options the build hands to `babel-plugin-react-compiler`, with the React version\n * GTKX targets filled in.\n */\ntype ResolvedReactCompilerOptions = ReactCompilerOptions & {\n /** React major version the compiler emits for. */\n target: \"19\";\n};\n\n/**\n * User-facing configuration for a GTKX project, as authored in `gtkx.config.ts`: the GIR libraries\n * to bind and where to find them, the GApplication id, per-element configuration, the React\n * Compiler, codegen, and user event signal settings, and the `agents` and `mcp` blocks controlling\n * what coding agents are given.\n */\ntype Config = z.infer<typeof configSchema>;\ntype ModuleExport = z.infer<typeof moduleExportSchema>;\ntype ElementConfigEntry = z.infer<typeof elementConfigSchema>;\n\ntype McpSettings = {\n tools: string[];\n isReadOnly: boolean;\n};\n\n/** Configuration reduced to the values the app runtime and the build need, with paths already resolved. */\ntype ResolvedConfig = {\n /** The GApplication identifier the app registers under. */\n applicationId: string;\n /** React Compiler options for the build, or `null` when the compiler is disabled. */\n reactCompiler: ResolvedReactCompilerOptions | null;\n /**\n * Signal names, keyed by GLib type name, that stay suppressed while a React commit writes to a widget.\n * `notify` stays suppressed only for the property being written.\n */\n userEventSignals: Record<string, string[]>;\n /** Path of the module exporting per-element configs, or `null` when none is configured. */\n elements: string | null;\n /** GLib type names of the elements marked `isLazy`, whose GObject their parent container creates. */\n lazyElements: string[];\n};\n\nconst APPLICATION_ID_PATTERN = /^[A-Za-z_][A-Za-z0-9_-]*(\\.[A-Za-z_][A-Za-z0-9_-]*)+$/;\nconst APPLICATION_ID_MAX_LENGTH = 255;\nconst DEFAULT_LIBRARIES: Set<string> = new Set([\"Gtk-4.0\", \"Adw-1\"]);\n/** Compilation modes `babel-plugin-react-compiler` accepts. */\nconst COMPILATION_MODES = [\"infer\", \"syntax\", \"annotation\", \"all\"] as const;\n/** Panic thresholds `babel-plugin-react-compiler` accepts. */\nconst PANIC_THRESHOLDS = [\"none\", \"critical_errors\", \"all_errors\"] as const;\nconst REACT_COMPILER_TARGET = \"19\";\n\nconst librarySchema = girLibrary('must be of the form \"Name-Version\", such as \"Gtk-4.0\"')\n .refine((library) => !DEFAULT_LIBRARIES.has(library), { error: \"is bound by default; remove it\" });\n\nconst librariesSchema = z\n .array(librarySchema, { error: \"must be a non-empty string array or omitted\" })\n .min(1, { error: \"must be a non-empty string array or omitted\" });\n\nconst applicationIdSchema = z\n .string({ error: \"must satisfy g_application_id_is_valid\" })\n .refine((value) => isValidApplicationId(value), {\n error: 'must satisfy g_application_id_is_valid, such as \"org.example.MyApp\"',\n });\n\nconst reactCompilerSchema = z.union([\n z.boolean(),\n z.object({\n compilationMode: z.enum(COMPILATION_MODES).optional(),\n panicThreshold: z.enum(PANIC_THRESHOLDS).optional(),\n }),\n]);\n\nconst userEventSignalsSchema = z.record(\n z.string(),\n z.array(\n z.string({ error: \"must be a non-empty signal name\" }).min(1, { error: \"must be a non-empty signal name\" }),\n {\n error: \"must be an array of signal names\",\n },\n ),\n { error: \"must be a record of GLib type names to signal name arrays\" },\n);\n\nconst moduleExportSchema = z.object(\n {\n module: z.string({ error: \"must be a module specifier\" }).min(1, { error: \"must be a module specifier\" }),\n export: z.string({ error: \"must be an export name\" }).min(1, { error: \"must be an export name\" }),\n },\n { error: \"must be a { module, export } object\" },\n);\n\nconst elementConfigSchema = z.object({\n component: moduleExportSchema.optional(),\n props: moduleExportSchema.optional(),\n isLazy: z.boolean({ error: \"must be a boolean\" }).optional(),\n omittedProps: z\n .array(\n z.string({ error: \"must be a non-empty property name\" }).min(1, {\n error: \"must be a non-empty property name\",\n }),\n { error: \"must be an array of property names\" },\n )\n .optional(),\n});\n\nconst elementsSchema = z.object({\n behaviors: z\n .string({ error: \"must be a path to a module exporting element behaviors\" })\n .min(1, { error: \"must be a path to a module exporting element behaviors\" })\n .optional(),\n config: z.record(z.string(), elementConfigSchema).optional(),\n});\n\nconst agentsSchema = z.object({\n rules: z.boolean({ error: \"must be a boolean\" }).optional(),\n reference: z.boolean({ error: \"must be a boolean\" }).optional(),\n});\n\nconst mcpSchema = z.object({\n tools: z\n .array(z.string({ error: \"must be a tool name pattern\" }).min(1, { error: \"must be a tool name pattern\" }), {\n error: \"must be an array of tool name patterns\",\n })\n .optional(),\n readOnly: z.boolean({ error: \"must be a boolean\" }).optional(),\n});\n\nconst graduatedFutureSchema = z\n .object({\n v2ByteArrays: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n v2ValueReturns: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n v2FinishResults: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n v2InoutReturns: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n v2ResourceImports: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n v2DefaultLibraries: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n v2TreeShaking: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n })\n .strict();\n\nconst deprecationsSchema = z.object({\n silence: z\n .array(z.never({ error: \"does not name a current deprecation\" }), {\n error: \"must be an array of current deprecation ids\",\n })\n .optional(),\n});\n\n/** Schema every `gtkx.config.ts` is validated against, and the source of the {@link Config} type. */\nconst configSchema = z.object({\n libraries: librariesSchema.optional(),\n girPath: z.array(z.string(), { error: \"must be an array of strings if provided\" }).optional(),\n applicationId: applicationIdSchema,\n reactCompiler: reactCompilerSchema.optional(),\n codegen: z.boolean({ error: \"must be a boolean\" }).optional(),\n userEventSignals: userEventSignalsSchema.optional(),\n elements: elementsSchema.optional(),\n applicationIcon: text(\"must be a path to an icon theme directory or a single icon file\").optional(),\n deploy: deploySchema.optional(),\n agents: agentsSchema.optional(),\n mcp: mcpSchema.optional(),\n deprecations: deprecationsSchema.optional(),\n});\n\n/**\n * Returns the given configuration unchanged, typed as {@link Config}, so `gtkx.config.ts` gets\n * autocompletion and type checking.\n */\nconst defineConfig: DefineConfig<Config> = createDefineConfig<Config>();\nconst validationSchema = configSchema.extend({ future: graduatedFutureSchema.optional() });\n\nconst isValidApplicationId = (applicationId: string): boolean =>\n applicationId.length <= APPLICATION_ID_MAX_LENGTH && APPLICATION_ID_PATTERN.test(applicationId);\n\nconst resolveReactCompilerOptions = (setting: Config[\"reactCompiler\"]): ResolvedReactCompilerOptions | null => {\n if (setting === false) {\n return null;\n }\n\n const overrides = setting === undefined || setting === true ? {} : setting;\n\n return {\n ...(overrides.compilationMode !== undefined && { compilationMode: overrides.compilationMode }),\n ...(overrides.panicThreshold !== undefined && { panicThreshold: overrides.panicThreshold }),\n target: REACT_COMPILER_TARGET,\n };\n};\n\nconst validateConfig = (config: unknown, configFile?: string): void => {\n const result = validationSchema.safeParse(config);\n\n if (!result.success) {\n throw configError(result.error, configFile);\n }\n};\n\nconst graduatedFutureKeys = (config: unknown): string[] => {\n if (!isRecord(config) || !isRecord(config.future)) {\n return [];\n }\n\n return Object.keys(config.future).toSorted((first, second) => first.localeCompare(second));\n};\n\n/**\n * Deep-merges a configuration over a base. `override` wins over `base` on conflicting scalar and object keys, while\n * arrays are concatenated with the `override` entries first.\n */\nconst mergeConfig = (base: Config, override: Config): Config => defu(override, base);\n\nconst resolveElementsModule = (behaviors: string | undefined, root: string | undefined): string | null => {\n if (behaviors === undefined) {\n return null;\n }\n\n return root === undefined ? behaviors : resolve(root, behaviors);\n};\n\nconst resolveLazyElements = (elements: Config[\"elements\"]): string[] =>\n Object.entries(elements?.config ?? {})\n .filter(([, entry]) => entry.isLazy === true)\n .map(([type]) => type);\n\nconst elementEntryValues = <T>(\n elements: Config[\"elements\"],\n pick: (entry: ElementConfigEntry) => T | undefined,\n): Record<string, T> =>\n Object.fromEntries(\n Object.entries(elements?.config ?? {}).flatMap(([type, entry]) => {\n const value = pick(entry);\n\n return value === undefined ? [] : [[type, value] as const];\n }),\n );\n\nconst resolveElementComponents = (elements: Config[\"elements\"]): Record<string, ModuleExport> =>\n elementEntryValues(elements, (entry) => entry.component);\n\nconst resolveElementProps = (elements: Config[\"elements\"]): Record<string, ModuleExport> =>\n elementEntryValues(elements, (entry) => entry.props);\n\nconst resolveOmittedProps = (elements: Config[\"elements\"]): Record<string, string[]> =>\n elementEntryValues(elements, (entry) => entry.omittedProps);\n\nconst isAgentRulesEnabled = (config: Config): boolean => config.agents?.rules !== false;\nconst isAgentReferenceEnabled = (config: Config): boolean => config.agents?.reference !== false;\n\nconst resolveMcpSettings = (config: Config): McpSettings => ({\n tools: config.mcp?.tools ?? [],\n isReadOnly: config.mcp?.readOnly === true,\n});\n\nconst resolveConfig = (config: Config, root?: string): ResolvedConfig => ({\n applicationId: config.applicationId,\n reactCompiler: resolveReactCompilerOptions(config.reactCompiler),\n userEventSignals: resolveUserEventSignals(config.userEventSignals),\n elements: resolveElementsModule(config.elements?.behaviors, root),\n lazyElements: resolveLazyElements(config.elements),\n});\n\nexport {\n APPLICATION_ID_MAX_LENGTH,\n defineConfig,\n isAgentReferenceEnabled,\n isAgentRulesEnabled,\n isValidApplicationId,\n graduatedFutureKeys,\n validateConfig,\n mergeConfig,\n resolveLazyElements,\n resolveElementComponents,\n resolveElementProps,\n resolveMcpSettings,\n resolveOmittedProps,\n resolveConfig,\n type McpSettings,\n type ResolvedReactCompilerOptions,\n type Config,\n type ResolvedConfig,\n};\n"]}
|
package/dist/deploy.d.ts
CHANGED
|
@@ -73,6 +73,8 @@ declare const deploySchema: z.ZodObject<{
|
|
|
73
73
|
url: z.ZodOptional<z.ZodURL>;
|
|
74
74
|
}, z.core.$strict>>>;
|
|
75
75
|
execArgs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
76
|
+
launcherEnv: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
77
|
+
nodeFlags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
76
78
|
fileAssociations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
77
79
|
extension: z.ZodString;
|
|
78
80
|
mimeType: z.ZodString;
|
|
@@ -85,6 +87,7 @@ declare const deploySchema: z.ZodObject<{
|
|
|
85
87
|
icon: z.ZodOptional<z.ZodString>;
|
|
86
88
|
}, z.core.$strict>>>;
|
|
87
89
|
desktopEntry: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
90
|
+
metainfoExtra: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
88
91
|
isDbusActivatable: z.ZodOptional<z.ZodBoolean>;
|
|
89
92
|
extraFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
90
93
|
source: z.ZodString;
|
package/dist/deploy.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../src/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../src/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA0PxB,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAmEhB,CAAC;AAEH,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
package/dist/deploy.js
CHANGED
|
@@ -25,15 +25,21 @@ const URL_KINDS = [
|
|
|
25
25
|
const BOOLEAN_ERROR = "must be a boolean";
|
|
26
26
|
const EPOCH_ERROR = "must be a non-negative integer";
|
|
27
27
|
const EXTRA_FILE_ERROR = "must be a source path or a { source, mode } entry";
|
|
28
|
-
const FILE_MODE_ERROR = "must be an octal file mode such as 755";
|
|
28
|
+
const FILE_MODE_ERROR = "must be an octal file mode without setuid or setgid bits, such as 755";
|
|
29
29
|
const FILE_MODE_PATTERN = /^[0-7]{3,4}$/;
|
|
30
|
+
const FILE_MODE_RADIX = 8;
|
|
31
|
+
const PRIVILEGED_FILE_MODE_MASK = 0o6000;
|
|
30
32
|
const HEX_COLOR_ERROR = "must be a #rrggbb color";
|
|
31
33
|
const HEX_COLOR_PATTERN = /^#[\dA-Fa-f]{6}$/;
|
|
32
34
|
const KEY_FILE_ERROR = "must be a path to a PGP key file";
|
|
33
35
|
const KEY_ID_ERROR = "must be a PGP key id";
|
|
36
|
+
const LAUNCHER_ENV_ERROR = "must be a record of POSIX environment names to values without null bytes";
|
|
37
|
+
const LAUNCHER_ENV_NAME_ERROR = "must be a POSIX environment name";
|
|
38
|
+
const LAUNCHER_ENV_NAME_PATTERN = /^[A-Za-z_]\w*$/;
|
|
34
39
|
const MINIMUM_LIBRARY_VERSION_ERROR = "must be a version such as 4.18";
|
|
35
40
|
const MINIMUM_LIBRARY_VERSION_PATTERN = /^\d+(?:\.\d+)*$/;
|
|
36
41
|
const MINIMUM_LIBRARY_VERSIONS_ERROR = "must be a record of GIR library ids to a minimum version";
|
|
42
|
+
const NODE_FLAG_ERROR = "must be a Node.js flag beginning with a hyphen and containing no null bytes";
|
|
37
43
|
const LIBRARY_ID_ERROR = 'must be a GIR library identifier of the form "Name-Version", such as "Gtk-4.0"';
|
|
38
44
|
const SCRIPT_ERROR = "must be a path to a shell script";
|
|
39
45
|
const SOURCE_PATH_ERROR = "must be a source path";
|
|
@@ -90,9 +96,19 @@ const brandingSchema = z.strictObject({
|
|
|
90
96
|
});
|
|
91
97
|
const extraFileSchema = z.strictObject({
|
|
92
98
|
source: text(SOURCE_PATH_ERROR),
|
|
93
|
-
mode: z
|
|
99
|
+
mode: z
|
|
100
|
+
.string({ error: FILE_MODE_ERROR })
|
|
101
|
+
.regex(FILE_MODE_PATTERN, { error: FILE_MODE_ERROR })
|
|
102
|
+
.refine((mode) => (Number.parseInt(mode, FILE_MODE_RADIX) & PRIVILEGED_FILE_MODE_MASK) === 0, {
|
|
103
|
+
error: FILE_MODE_ERROR,
|
|
104
|
+
})
|
|
105
|
+
.optional(),
|
|
94
106
|
});
|
|
95
107
|
const extraFileEntrySchema = z.union([text(SOURCE_PATH_ERROR), extraFileSchema], { error: EXTRA_FILE_ERROR });
|
|
108
|
+
const launcherEnvSchema = z.record(z.string({ error: LAUNCHER_ENV_NAME_ERROR }).regex(LAUNCHER_ENV_NAME_PATTERN, { error: LAUNCHER_ENV_NAME_ERROR }), z.string({ error: LAUNCHER_ENV_ERROR }).refine((value) => !value.includes("\0"), { error: LAUNCHER_ENV_ERROR }), { error: (issue) => issue.code === "invalid_key" ? LAUNCHER_ENV_NAME_ERROR : LAUNCHER_ENV_ERROR });
|
|
109
|
+
const nodeFlagsSchema = z.array(z
|
|
110
|
+
.string({ error: NODE_FLAG_ERROR })
|
|
111
|
+
.refine((value) => value.startsWith("-") && !value.includes("\0"), { error: NODE_FLAG_ERROR }), { error: "must be an array of Node.js flags" });
|
|
96
112
|
const nodeRuntimeSchema = z.strictObject({
|
|
97
113
|
source: z.enum(NODE_SOURCES, { error: "must be one of download, host, path" }).optional(),
|
|
98
114
|
version: text("must be a Node.js version such as 26.7.0").optional(),
|
|
@@ -225,6 +241,8 @@ const deploySchema = z.strictObject({
|
|
|
225
241
|
.optional(),
|
|
226
242
|
releases: z.array(releaseSchema, { error: "must be an array of releases" }).optional(),
|
|
227
243
|
execArgs: textList("argument", "must be an array of arguments appended to Exec").optional(),
|
|
244
|
+
launcherEnv: launcherEnvSchema.optional(),
|
|
245
|
+
nodeFlags: nodeFlagsSchema.optional(),
|
|
228
246
|
fileAssociations: z
|
|
229
247
|
.array(fileAssociationSchema, { error: "must be an array of file associations" })
|
|
230
248
|
.optional(),
|
|
@@ -234,6 +252,7 @@ const deploySchema = z.strictObject({
|
|
|
234
252
|
.optional(),
|
|
235
253
|
desktopEntry: textRecord("must be a desktop entry value", "must be a record of desktop entry keys to values")
|
|
236
254
|
.optional(),
|
|
255
|
+
metainfoExtra: textList("AppStream XML fragment", "must be an array of AppStream XML fragments").optional(),
|
|
237
256
|
isDbusActivatable: flag(BOOLEAN_ERROR).optional(),
|
|
238
257
|
extraFiles: relativePathRecord("must be a destination path inside the install prefix, without a leading slash or a .. segment", extraFileEntrySchema, "must be a record of prefix-relative destinations to source paths or { source, mode } entries").optional(),
|
|
239
258
|
minimumLibraryVersions: minimumLibraryVersionsSchema.optional(),
|
package/dist/deploy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../src/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACH,aAAa,EACb,IAAI,EACJ,UAAU,EACV,kBAAkB,EAClB,IAAI,EACJ,QA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AAEH,OAAO,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import { z } from \"zod\";\nimport {\n fileExtension,\n flag,\n girLibrary,\n relativePathRecord,\n text,\n textList,\n textRecord,\n url,\n} from \"./schema-text.ts\";\n\nconst APPIMAGE_COMPRESSIONS = [\"gzip\", \"xz\", \"zstd\"] as const;\nconst DEB_COMPRESSIONS = [\"gzip\", \"none\", \"xz\", \"zstd\"] as const;\nconst DEB_SIGN_METHODS = [\"debsign\", \"dpkg-sig\"] as const;\nconst DEB_SIGN_TYPES = [\"archive\", \"maint\", \"origin\"] as const;\nconst DEPLOY_TARGET_NAMES = [\"appimage\", \"deb\", \"flatpak\", \"rpm\"] as const;\nconst FLATPAK_MODES = [\"prebuilt\", \"source\"] as const;\nconst NODE_SOURCES = [\"download\", \"host\", \"path\"] as const;\nconst OARS_INTENSITIES = [\"intense\", \"mild\", \"moderate\", \"none\"] as const;\nconst PACKAGE_MANAGERS = [\"npm\", \"pnpm\", \"yarn\"] as const;\nconst RELEASE_TYPES = [\"development\", \"snapshot\", \"stable\"] as const;\nconst RELEASE_URGENCIES = [\"critical\", \"high\", \"low\", \"medium\"] as const;\nconst RPM_COMPRESSIONS = [\"gzip\", \"lzma\", \"xz\", \"zstd\"] as const;\n\nconst URL_KINDS = [\n \"bugtracker\",\n \"contact\",\n \"contribute\",\n \"donation\",\n \"faq\",\n \"help\",\n \"translate\",\n \"vcs-browser\",\n] as const;\n\nconst BOOLEAN_ERROR = \"must be a boolean\";\nconst EPOCH_ERROR = \"must be a non-negative integer\";\nconst EXTRA_FILE_ERROR = \"must be a source path or a { source, mode } entry\";\nconst FILE_MODE_ERROR = \"must be an octal file mode such as 755\";\nconst FILE_MODE_PATTERN = /^[0-7]{3,4}$/;\nconst HEX_COLOR_ERROR = \"must be a #rrggbb color\";\nconst HEX_COLOR_PATTERN = /^#[\\dA-Fa-f]{6}$/;\nconst KEY_FILE_ERROR = \"must be a path to a PGP key file\";\nconst KEY_ID_ERROR = \"must be a PGP key id\";\nconst MINIMUM_LIBRARY_VERSION_ERROR = \"must be a version such as 4.18\";\nconst MINIMUM_LIBRARY_VERSION_PATTERN = /^\\d+(?:\\.\\d+)*$/;\nconst MINIMUM_LIBRARY_VERSIONS_ERROR = \"must be a record of GIR library ids to a minimum version\";\nconst LIBRARY_ID_ERROR = 'must be a GIR library identifier of the form \"Name-Version\", such as \"Gtk-4.0\"';\nconst SCRIPT_ERROR = \"must be a path to a shell script\";\nconst SOURCE_PATH_ERROR = \"must be a source path\";\nconst SPDX_ERROR = \"must be an SPDX license expression\";\nconst URL_ERROR = \"must be an absolute URL\";\nconst VERSION_ERROR = \"must be a version string\";\nconst hexColorSchema = z.string({ error: HEX_COLOR_ERROR }).regex(HEX_COLOR_PATTERN, { error: HEX_COLOR_ERROR });\n\nconst minimumLibraryVersionSchema = z\n .string({ error: MINIMUM_LIBRARY_VERSION_ERROR })\n .regex(MINIMUM_LIBRARY_VERSION_PATTERN, { error: MINIMUM_LIBRARY_VERSION_ERROR });\n\nconst minimumLibraryVersionsSchema = z.record(girLibrary(LIBRARY_ID_ERROR), minimumLibraryVersionSchema, {\n error: MINIMUM_LIBRARY_VERSIONS_ERROR,\n});\n\nconst relationsSchema = z.strictObject({\n deb: textList(\"Debian package relation\", \"must be an array of Debian package relations\").optional(),\n rpm: textList(\"RPM package relation\", \"must be an array of RPM package relations\").optional(),\n});\n\nconst developerSchema = z.strictObject({\n id: text(\"must be a reverse-DNS developer id\").optional(),\n name: text(\"must be a developer or organization name\").optional(),\n email: text(\"must be an email address\").optional(),\n});\n\nconst screenshotSchema = z\n .strictObject({\n url: url(\"must be an absolute URL to a PNG or JPEG\").optional(),\n file: text(\"must be an image path relative to the project root\").optional(),\n caption: text(\"must be a screenshot caption\").optional(),\n isDefault: flag(BOOLEAN_ERROR).optional(),\n })\n .refine((entry) => entry.url !== undefined || entry.file !== undefined, {\n error: \"must have either a `url` or a `file`\",\n });\n\nconst releaseSchema = z.strictObject({\n version: text(VERSION_ERROR),\n date: z.iso.date({ error: \"must be an ISO date (YYYY-MM-DD)\" }),\n type: z.enum(RELEASE_TYPES, { error: \"must be one of development, snapshot, stable\" }).optional(),\n urgency: z.enum(RELEASE_URGENCIES, { error: \"must be one of critical, high, low, medium\" }).optional(),\n notes: textList(\"release note paragraph\", \"must be an array of release note paragraphs\").optional(),\n url: url(URL_ERROR).optional(),\n});\n\nconst fileAssociationSchema = z.strictObject({\n extension: fileExtension(\"must be a file extension without a leading dot\"),\n mimeType: text(\"must be a MIME type such as text/plain\"),\n description: text(\"must be a description of the file type\").optional(),\n});\n\nconst desktopActionSchema = z.strictObject({\n name: text(\"must be an action name\"),\n args: textList(\"argument\", \"must be an array of arguments appended to Exec\").optional(),\n icon: text(\"must be an icon name\").optional(),\n});\n\nconst brandingSchema = z.strictObject({\n light: hexColorSchema,\n dark: hexColorSchema,\n});\n\nconst extraFileSchema = z.strictObject({\n source: text(SOURCE_PATH_ERROR),\n mode: z.string({ error: FILE_MODE_ERROR }).regex(FILE_MODE_PATTERN, { error: FILE_MODE_ERROR }).optional(),\n});\n\nconst extraFileEntrySchema = z.union([text(SOURCE_PATH_ERROR), extraFileSchema], { error: EXTRA_FILE_ERROR });\n\nconst nodeRuntimeSchema = z.strictObject({\n source: z.enum(NODE_SOURCES, { error: \"must be one of download, host, path\" }).optional(),\n version: text(\"must be a Node.js version such as 26.7.0\").optional(),\n path: text(\"must be a path to a node binary\").optional(),\n shouldStrip: flag(BOOLEAN_ERROR).optional(),\n shouldUseCompileCache: flag(BOOLEAN_ERROR).optional(),\n});\n\nconst scriptsSchema = z.strictObject({\n preInstall: text(SCRIPT_ERROR).optional(),\n postInstall: text(SCRIPT_ERROR).optional(),\n preRemove: text(SCRIPT_ERROR).optional(),\n postRemove: text(SCRIPT_ERROR).optional(),\n});\n\nconst debSchema = z.strictObject({\n packageName: text(\"must be a Debian package name\").optional(),\n section: text(\"must be a Debian archive section\").optional(),\n priority: text(\"must be a Debian priority\").optional(),\n compression: z.enum(DEB_COMPRESSIONS, { error: \"must be one of gzip, none, xz, zstd\" }).optional(),\n fields: textRecord(\"must be a control field value\", \"must be a record of control field names to values\")\n .optional(),\n});\n\nconst rpmSchema = z.strictObject({\n packageName: text(\"must be an RPM package name\").optional(),\n group: text(\"must be an RPM group\").optional(),\n compression: z.enum(RPM_COMPRESSIONS, { error: \"must be one of gzip, lzma, xz, zstd\" }).optional(),\n prefixes: textList(\"prefix\", \"must be an array of relocation prefixes\").optional(),\n});\n\nconst appimageSchema = z.strictObject({\n fileName: text(\"must be an output file name\").optional(),\n compression: z.enum(APPIMAGE_COMPRESSIONS, { error: \"must be one of gzip, xz, zstd\" }).optional(),\n updateInformation: text(\"must be an AppImage update information string\").optional(),\n runtimeFile: text(\"must be a path to an AppImage runtime file\").optional(),\n});\n\nconst flatpakSourceSchema = z.strictObject({\n url: url(\"must be an absolute git URL\").optional(),\n tag: text(\"must be a git tag\").optional(),\n commit: text(\"must be a git commit sha\").optional(),\n});\n\nconst flatpakSchema = z.strictObject({\n mode: z.enum(FLATPAK_MODES, { error: 'must be \"prebuilt\" or \"source\"' }).optional(),\n runtime: text(\"must be a runtime id\").optional(),\n runtimeVersion: text('must be a runtime branch such as \"50\"').optional(),\n sdk: text(\"must be an SDK id\").optional(),\n nodeExtension: text(\"must be a Node SDK extension id\").optional(),\n sdkExtensions: textList(\"SDK extension id\", \"must be an array of SDK extension ids\").optional(),\n base: text(\"must be a base app id\").optional(),\n baseVersion: text(\"must be a base app version\").optional(),\n branch: text(\"must be a branch name\").optional(),\n finishArgs: textList(\"finish argument\", \"must be an array of flatpak finish arguments\").optional(),\n cleanup: textList(\"cleanup pattern\", \"must be an array of cleanup patterns\").optional(),\n buildCommands: textList(\"shell command\", \"must be an array of shell commands\").optional(),\n modules: z.array(z.unknown(), { error: \"must be an array of flatpak module objects\" }).optional(),\n source: flatpakSourceSchema.optional(),\n packageManager: z.enum(PACKAGE_MANAGERS, { error: \"must be one of npm, pnpm, yarn\" }).optional(),\n lockfile: text(\"must be a path to a lockfile\").optional(),\n runtimeRepo: url(\"must be an absolute .flatpakrepo URL\").optional(),\n shouldEmitBundle: flag(BOOLEAN_ERROR).optional(),\n shouldInstall: flag(BOOLEAN_ERROR).optional(),\n shouldUseRofilesFuse: flag(BOOLEAN_ERROR).optional(),\n});\n\nconst debSigningSchema = z.strictObject({\n keyFile: text(KEY_FILE_ERROR),\n keyId: text(KEY_ID_ERROR).optional(),\n method: z.enum(DEB_SIGN_METHODS, { error: 'must be \"debsign\" or \"dpkg-sig\"' }).optional(),\n type: z.enum(DEB_SIGN_TYPES, { error: \"must be one of archive, maint, origin\" }).optional(),\n signer: text(\"must be a signer name and email\").optional(),\n});\n\nconst rpmSigningSchema = z.strictObject({\n keyFile: text(KEY_FILE_ERROR),\n keyId: text(KEY_ID_ERROR).optional(),\n});\n\nconst flatpakSigningSchema = z.strictObject({\n gpgKeyId: text(\"must be a GPG key id\"),\n gpgHomeDir: text(\"must be a path to a GPG home directory\").optional(),\n});\n\nconst appimageSigningSchema = z.strictObject({\n gpgKeyId: text(\"must be a GPG key id\"),\n});\n\nconst signingSchema = z.strictObject({\n appimage: appimageSigningSchema.optional(),\n deb: debSigningSchema.optional(),\n flatpak: flatpakSigningSchema.optional(),\n rpm: rpmSigningSchema.optional(),\n});\n\nconst extraRelationsSchema = z.strictObject({\n recommends: relationsSchema.optional(),\n suggests: relationsSchema.optional(),\n provides: relationsSchema.optional(),\n conflicts: relationsSchema.optional(),\n replaces: relationsSchema.optional(),\n breaks: relationsSchema.optional(),\n preDepends: relationsSchema.optional(),\n});\n\nconst deploySchema = z.strictObject({\n targets: z\n .array(z.enum(DEPLOY_TARGET_NAMES, { error: \"must be one of appimage, deb, flatpak, rpm\" }), {\n error: \"must be an array of deploy targets\",\n })\n .optional(),\n outDir: text(\"must be a directory path relative to the project root\").optional(),\n name: text(\"must be the display name shown in the launcher\").optional(),\n genericName: text(\"must be a generic application name\").optional(),\n binaryName: text(\"must be a kebab-case command name\").optional(),\n version: text(VERSION_ERROR).optional(),\n release: text(\"must be a packaging revision\").optional(),\n epoch: z.int({ error: EPOCH_ERROR }).min(0, { error: EPOCH_ERROR }).optional(),\n summary: text(\"must be a single-line summary without a trailing period\").optional(),\n description: textList(\"description paragraph\", \"must be an array of description paragraphs\").optional(),\n keywords: textList(\"search keyword\", \"must be an array of search keywords\").optional(),\n categories: textList(\"freedesktop category\", \"must be an array of freedesktop categories\").optional(),\n mimeTypes: textList(\"MIME type\", \"must be an array of MIME types\").optional(),\n developer: developerSchema.optional(),\n license: text(SPDX_ERROR).optional(),\n licenseFile: text(\"must be a path to a license file\").optional(),\n metadataLicense: text(SPDX_ERROR).optional(),\n copyright: text(\"must be a copyright line\").optional(),\n homepage: url(URL_ERROR).optional(),\n urls: z\n .partialRecord(z.enum(URL_KINDS), url(URL_ERROR), {\n error: \"must be a record of AppStream url kinds to URLs\",\n })\n .optional(),\n screenshots: z.array(screenshotSchema, { error: \"must be an array of screenshots\" }).optional(),\n screenshotBaseUrl: url(\"must be an absolute base URL\").optional(),\n branding: brandingSchema.optional(),\n contentRating: z\n .record(z.string(), z.enum(OARS_INTENSITIES, { error: \"must be one of intense, mild, moderate, none\" }), {\n error: \"must be a record of OARS 1.1 attribute ids to intensities\",\n })\n .optional(),\n releases: z.array(releaseSchema, { error: \"must be an array of releases\" }).optional(),\n execArgs: textList(\"argument\", \"must be an array of arguments appended to Exec\").optional(),\n fileAssociations: z\n .array(fileAssociationSchema, { error: \"must be an array of file associations\" })\n .optional(),\n protocols: textList(\"URL scheme\", \"must be an array of URL schemes\").optional(),\n desktopActions: z\n .record(z.string(), desktopActionSchema, { error: \"must be a record of action ids to actions\" })\n .optional(),\n desktopEntry: textRecord(\"must be a desktop entry value\", \"must be a record of desktop entry keys to values\")\n .optional(),\n isDbusActivatable: flag(BOOLEAN_ERROR).optional(),\n extraFiles: relativePathRecord(\n \"must be a destination path inside the install prefix, without a leading slash or a .. segment\",\n extraFileEntrySchema,\n \"must be a record of prefix-relative destinations to source paths or { source, mode } entries\",\n ).optional(),\n minimumLibraryVersions: minimumLibraryVersionsSchema.optional(),\n depends: relationsSchema.optional(),\n relations: extraRelationsSchema.optional(),\n scripts: scriptsSchema.optional(),\n node: nodeRuntimeSchema.optional(),\n signing: signingSchema.optional(),\n appimage: appimageSchema.optional(),\n deb: debSchema.optional(),\n flatpak: flatpakSchema.optional(),\n rpm: rpmSchema.optional(),\n});\n\nexport { deploySchema };\n"]}
|
|
1
|
+
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../src/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACH,aAAa,EACb,IAAI,EACJ,UAAU,EACV,kBAAkB,EAClB,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,GAAG,GACN,MAAM,kBAAkB,CAAC;AAE1B,MAAM,qBAAqB,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAU,CAAC;AAC9D,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAU,CAAC;AACjE,MAAM,gBAAgB,GAAG,CAAC,SAAS,EAAE,UAAU,CAAU,CAAC;AAC1D,MAAM,cAAc,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAU,CAAC;AAC/D,MAAM,mBAAmB,GAAG,CAAC,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,CAAU,CAAC;AAC3E,MAAM,aAAa,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAU,CAAC;AACtD,MAAM,YAAY,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC;AAC3D,MAAM,gBAAgB,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAU,CAAC;AAC1E,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC;AAC1D,MAA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,EAAE;IACf,aAAa,EAAE,QAAQ,CAAC,wBAAwB,EAAE,6CAA6C,CAAC,CAAC,QAAQ,EAAE;IAC3G,iBAAiB,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,QAAQ,EAAE;IACjD,UAAU,EAAE,kBAAkB,CAC1B,+FAA+F,EAC/F,oBAAoB,EACpB,8FAA8F,CACjG,CAAC,QAAQ,EAAE;IACZ,sBAAsB,EAAE,4BAA4B,CAAC,QAAQ,EAAE;IAC/D,OAAO,EAAE,eAAe,CAAC,QAAQ,EAAE;IACnC,SAAS,EAAE,oBAAoB,CAAC,QAAQ,EAAE;IAC1C,OAAO,EAAE,aAAa,CAAC,QAAQ,EAAE;IACjC,IAAI,EAAE,iBAAiB,CAAC,QAAQ,EAAE;IAClC,OAAO,EAAE,aAAa,CAAC,QAAQ,EAAE;IACjC,QAAQ,EAAE,cAAc,CAAC,QAAQ,EAAE;IACnC,GAAG,EAAE,SAAS,CAAC,QAAQ,EAAE;IACzB,OAAO,EAAE,aAAa,CAAC,QAAQ,EAAE;IACjC,GAAG,EAAE,SAAS,CAAC,QAAQ,EAAE;CAC5B,CAAC,CAAC;AAEH,OAAO,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import { z } from \"zod\";\nimport {\n fileExtension,\n flag,\n girLibrary,\n relativePathRecord,\n text,\n textList,\n textRecord,\n url,\n} from \"./schema-text.ts\";\n\nconst APPIMAGE_COMPRESSIONS = [\"gzip\", \"xz\", \"zstd\"] as const;\nconst DEB_COMPRESSIONS = [\"gzip\", \"none\", \"xz\", \"zstd\"] as const;\nconst DEB_SIGN_METHODS = [\"debsign\", \"dpkg-sig\"] as const;\nconst DEB_SIGN_TYPES = [\"archive\", \"maint\", \"origin\"] as const;\nconst DEPLOY_TARGET_NAMES = [\"appimage\", \"deb\", \"flatpak\", \"rpm\"] as const;\nconst FLATPAK_MODES = [\"prebuilt\", \"source\"] as const;\nconst NODE_SOURCES = [\"download\", \"host\", \"path\"] as const;\nconst OARS_INTENSITIES = [\"intense\", \"mild\", \"moderate\", \"none\"] as const;\nconst PACKAGE_MANAGERS = [\"npm\", \"pnpm\", \"yarn\"] as const;\nconst RELEASE_TYPES = [\"development\", \"snapshot\", \"stable\"] as const;\nconst RELEASE_URGENCIES = [\"critical\", \"high\", \"low\", \"medium\"] as const;\nconst RPM_COMPRESSIONS = [\"gzip\", \"lzma\", \"xz\", \"zstd\"] as const;\n\nconst URL_KINDS = [\n \"bugtracker\",\n \"contact\",\n \"contribute\",\n \"donation\",\n \"faq\",\n \"help\",\n \"translate\",\n \"vcs-browser\",\n] as const;\n\nconst BOOLEAN_ERROR = \"must be a boolean\";\nconst EPOCH_ERROR = \"must be a non-negative integer\";\nconst EXTRA_FILE_ERROR = \"must be a source path or a { source, mode } entry\";\nconst FILE_MODE_ERROR = \"must be an octal file mode without setuid or setgid bits, such as 755\";\nconst FILE_MODE_PATTERN = /^[0-7]{3,4}$/;\nconst FILE_MODE_RADIX = 8;\nconst PRIVILEGED_FILE_MODE_MASK = 0o6000;\nconst HEX_COLOR_ERROR = \"must be a #rrggbb color\";\nconst HEX_COLOR_PATTERN = /^#[\\dA-Fa-f]{6}$/;\nconst KEY_FILE_ERROR = \"must be a path to a PGP key file\";\nconst KEY_ID_ERROR = \"must be a PGP key id\";\nconst LAUNCHER_ENV_ERROR = \"must be a record of POSIX environment names to values without null bytes\";\nconst LAUNCHER_ENV_NAME_ERROR = \"must be a POSIX environment name\";\nconst LAUNCHER_ENV_NAME_PATTERN = /^[A-Za-z_]\\w*$/;\nconst MINIMUM_LIBRARY_VERSION_ERROR = \"must be a version such as 4.18\";\nconst MINIMUM_LIBRARY_VERSION_PATTERN = /^\\d+(?:\\.\\d+)*$/;\nconst MINIMUM_LIBRARY_VERSIONS_ERROR = \"must be a record of GIR library ids to a minimum version\";\nconst NODE_FLAG_ERROR = \"must be a Node.js flag beginning with a hyphen and containing no null bytes\";\nconst LIBRARY_ID_ERROR = 'must be a GIR library identifier of the form \"Name-Version\", such as \"Gtk-4.0\"';\nconst SCRIPT_ERROR = \"must be a path to a shell script\";\nconst SOURCE_PATH_ERROR = \"must be a source path\";\nconst SPDX_ERROR = \"must be an SPDX license expression\";\nconst URL_ERROR = \"must be an absolute URL\";\nconst VERSION_ERROR = \"must be a version string\";\nconst hexColorSchema = z.string({ error: HEX_COLOR_ERROR }).regex(HEX_COLOR_PATTERN, { error: HEX_COLOR_ERROR });\n\nconst minimumLibraryVersionSchema = z\n .string({ error: MINIMUM_LIBRARY_VERSION_ERROR })\n .regex(MINIMUM_LIBRARY_VERSION_PATTERN, { error: MINIMUM_LIBRARY_VERSION_ERROR });\n\nconst minimumLibraryVersionsSchema = z.record(girLibrary(LIBRARY_ID_ERROR), minimumLibraryVersionSchema, {\n error: MINIMUM_LIBRARY_VERSIONS_ERROR,\n});\n\nconst relationsSchema = z.strictObject({\n deb: textList(\"Debian package relation\", \"must be an array of Debian package relations\").optional(),\n rpm: textList(\"RPM package relation\", \"must be an array of RPM package relations\").optional(),\n});\n\nconst developerSchema = z.strictObject({\n id: text(\"must be a reverse-DNS developer id\").optional(),\n name: text(\"must be a developer or organization name\").optional(),\n email: text(\"must be an email address\").optional(),\n});\n\nconst screenshotSchema = z\n .strictObject({\n url: url(\"must be an absolute URL to a PNG or JPEG\").optional(),\n file: text(\"must be an image path relative to the project root\").optional(),\n caption: text(\"must be a screenshot caption\").optional(),\n isDefault: flag(BOOLEAN_ERROR).optional(),\n })\n .refine((entry) => entry.url !== undefined || entry.file !== undefined, {\n error: \"must have either a `url` or a `file`\",\n });\n\nconst releaseSchema = z.strictObject({\n version: text(VERSION_ERROR),\n date: z.iso.date({ error: \"must be an ISO date (YYYY-MM-DD)\" }),\n type: z.enum(RELEASE_TYPES, { error: \"must be one of development, snapshot, stable\" }).optional(),\n urgency: z.enum(RELEASE_URGENCIES, { error: \"must be one of critical, high, low, medium\" }).optional(),\n notes: textList(\"release note paragraph\", \"must be an array of release note paragraphs\").optional(),\n url: url(URL_ERROR).optional(),\n});\n\nconst fileAssociationSchema = z.strictObject({\n extension: fileExtension(\"must be a file extension without a leading dot\"),\n mimeType: text(\"must be a MIME type such as text/plain\"),\n description: text(\"must be a description of the file type\").optional(),\n});\n\nconst desktopActionSchema = z.strictObject({\n name: text(\"must be an action name\"),\n args: textList(\"argument\", \"must be an array of arguments appended to Exec\").optional(),\n icon: text(\"must be an icon name\").optional(),\n});\n\nconst brandingSchema = z.strictObject({\n light: hexColorSchema,\n dark: hexColorSchema,\n});\n\nconst extraFileSchema = z.strictObject({\n source: text(SOURCE_PATH_ERROR),\n mode: z\n .string({ error: FILE_MODE_ERROR })\n .regex(FILE_MODE_PATTERN, { error: FILE_MODE_ERROR })\n .refine((mode) => (Number.parseInt(mode, FILE_MODE_RADIX) & PRIVILEGED_FILE_MODE_MASK) === 0, {\n error: FILE_MODE_ERROR,\n })\n .optional(),\n});\n\nconst extraFileEntrySchema = z.union([text(SOURCE_PATH_ERROR), extraFileSchema], { error: EXTRA_FILE_ERROR });\n\nconst launcherEnvSchema = z.record(\n z.string({ error: LAUNCHER_ENV_NAME_ERROR }).regex(LAUNCHER_ENV_NAME_PATTERN, { error: LAUNCHER_ENV_NAME_ERROR }),\n z.string({ error: LAUNCHER_ENV_ERROR }).refine((value) => !value.includes(\"\\0\"), { error: LAUNCHER_ENV_ERROR }),\n { error: (issue) => issue.code === \"invalid_key\" ? LAUNCHER_ENV_NAME_ERROR : LAUNCHER_ENV_ERROR },\n);\n\nconst nodeFlagsSchema = z.array(\n z\n .string({ error: NODE_FLAG_ERROR })\n .refine((value) => value.startsWith(\"-\") && !value.includes(\"\\0\"), { error: NODE_FLAG_ERROR }),\n { error: \"must be an array of Node.js flags\" },\n);\n\nconst nodeRuntimeSchema = z.strictObject({\n source: z.enum(NODE_SOURCES, { error: \"must be one of download, host, path\" }).optional(),\n version: text(\"must be a Node.js version such as 26.7.0\").optional(),\n path: text(\"must be a path to a node binary\").optional(),\n shouldStrip: flag(BOOLEAN_ERROR).optional(),\n shouldUseCompileCache: flag(BOOLEAN_ERROR).optional(),\n});\n\nconst scriptsSchema = z.strictObject({\n preInstall: text(SCRIPT_ERROR).optional(),\n postInstall: text(SCRIPT_ERROR).optional(),\n preRemove: text(SCRIPT_ERROR).optional(),\n postRemove: text(SCRIPT_ERROR).optional(),\n});\n\nconst debSchema = z.strictObject({\n packageName: text(\"must be a Debian package name\").optional(),\n section: text(\"must be a Debian archive section\").optional(),\n priority: text(\"must be a Debian priority\").optional(),\n compression: z.enum(DEB_COMPRESSIONS, { error: \"must be one of gzip, none, xz, zstd\" }).optional(),\n fields: textRecord(\"must be a control field value\", \"must be a record of control field names to values\")\n .optional(),\n});\n\nconst rpmSchema = z.strictObject({\n packageName: text(\"must be an RPM package name\").optional(),\n group: text(\"must be an RPM group\").optional(),\n compression: z.enum(RPM_COMPRESSIONS, { error: \"must be one of gzip, lzma, xz, zstd\" }).optional(),\n prefixes: textList(\"prefix\", \"must be an array of relocation prefixes\").optional(),\n});\n\nconst appimageSchema = z.strictObject({\n fileName: text(\"must be an output file name\").optional(),\n compression: z.enum(APPIMAGE_COMPRESSIONS, { error: \"must be one of gzip, xz, zstd\" }).optional(),\n updateInformation: text(\"must be an AppImage update information string\").optional(),\n runtimeFile: text(\"must be a path to an AppImage runtime file\").optional(),\n});\n\nconst flatpakSourceSchema = z.strictObject({\n url: url(\"must be an absolute git URL\").optional(),\n tag: text(\"must be a git tag\").optional(),\n commit: text(\"must be a git commit sha\").optional(),\n});\n\nconst flatpakSchema = z.strictObject({\n mode: z.enum(FLATPAK_MODES, { error: 'must be \"prebuilt\" or \"source\"' }).optional(),\n runtime: text(\"must be a runtime id\").optional(),\n runtimeVersion: text('must be a runtime branch such as \"50\"').optional(),\n sdk: text(\"must be an SDK id\").optional(),\n nodeExtension: text(\"must be a Node SDK extension id\").optional(),\n sdkExtensions: textList(\"SDK extension id\", \"must be an array of SDK extension ids\").optional(),\n base: text(\"must be a base app id\").optional(),\n baseVersion: text(\"must be a base app version\").optional(),\n branch: text(\"must be a branch name\").optional(),\n finishArgs: textList(\"finish argument\", \"must be an array of flatpak finish arguments\").optional(),\n cleanup: textList(\"cleanup pattern\", \"must be an array of cleanup patterns\").optional(),\n buildCommands: textList(\"shell command\", \"must be an array of shell commands\").optional(),\n modules: z.array(z.unknown(), { error: \"must be an array of flatpak module objects\" }).optional(),\n source: flatpakSourceSchema.optional(),\n packageManager: z.enum(PACKAGE_MANAGERS, { error: \"must be one of npm, pnpm, yarn\" }).optional(),\n lockfile: text(\"must be a path to a lockfile\").optional(),\n runtimeRepo: url(\"must be an absolute .flatpakrepo URL\").optional(),\n shouldEmitBundle: flag(BOOLEAN_ERROR).optional(),\n shouldInstall: flag(BOOLEAN_ERROR).optional(),\n shouldUseRofilesFuse: flag(BOOLEAN_ERROR).optional(),\n});\n\nconst debSigningSchema = z.strictObject({\n keyFile: text(KEY_FILE_ERROR),\n keyId: text(KEY_ID_ERROR).optional(),\n method: z.enum(DEB_SIGN_METHODS, { error: 'must be \"debsign\" or \"dpkg-sig\"' }).optional(),\n type: z.enum(DEB_SIGN_TYPES, { error: \"must be one of archive, maint, origin\" }).optional(),\n signer: text(\"must be a signer name and email\").optional(),\n});\n\nconst rpmSigningSchema = z.strictObject({\n keyFile: text(KEY_FILE_ERROR),\n keyId: text(KEY_ID_ERROR).optional(),\n});\n\nconst flatpakSigningSchema = z.strictObject({\n gpgKeyId: text(\"must be a GPG key id\"),\n gpgHomeDir: text(\"must be a path to a GPG home directory\").optional(),\n});\n\nconst appimageSigningSchema = z.strictObject({\n gpgKeyId: text(\"must be a GPG key id\"),\n});\n\nconst signingSchema = z.strictObject({\n appimage: appimageSigningSchema.optional(),\n deb: debSigningSchema.optional(),\n flatpak: flatpakSigningSchema.optional(),\n rpm: rpmSigningSchema.optional(),\n});\n\nconst extraRelationsSchema = z.strictObject({\n recommends: relationsSchema.optional(),\n suggests: relationsSchema.optional(),\n provides: relationsSchema.optional(),\n conflicts: relationsSchema.optional(),\n replaces: relationsSchema.optional(),\n breaks: relationsSchema.optional(),\n preDepends: relationsSchema.optional(),\n});\n\nconst deploySchema = z.strictObject({\n targets: z\n .array(z.enum(DEPLOY_TARGET_NAMES, { error: \"must be one of appimage, deb, flatpak, rpm\" }), {\n error: \"must be an array of deploy targets\",\n })\n .optional(),\n outDir: text(\"must be a directory path relative to the project root\").optional(),\n name: text(\"must be the display name shown in the launcher\").optional(),\n genericName: text(\"must be a generic application name\").optional(),\n binaryName: text(\"must be a kebab-case command name\").optional(),\n version: text(VERSION_ERROR).optional(),\n release: text(\"must be a packaging revision\").optional(),\n epoch: z.int({ error: EPOCH_ERROR }).min(0, { error: EPOCH_ERROR }).optional(),\n summary: text(\"must be a single-line summary without a trailing period\").optional(),\n description: textList(\"description paragraph\", \"must be an array of description paragraphs\").optional(),\n keywords: textList(\"search keyword\", \"must be an array of search keywords\").optional(),\n categories: textList(\"freedesktop category\", \"must be an array of freedesktop categories\").optional(),\n mimeTypes: textList(\"MIME type\", \"must be an array of MIME types\").optional(),\n developer: developerSchema.optional(),\n license: text(SPDX_ERROR).optional(),\n licenseFile: text(\"must be a path to a license file\").optional(),\n metadataLicense: text(SPDX_ERROR).optional(),\n copyright: text(\"must be a copyright line\").optional(),\n homepage: url(URL_ERROR).optional(),\n urls: z\n .partialRecord(z.enum(URL_KINDS), url(URL_ERROR), {\n error: \"must be a record of AppStream url kinds to URLs\",\n })\n .optional(),\n screenshots: z.array(screenshotSchema, { error: \"must be an array of screenshots\" }).optional(),\n screenshotBaseUrl: url(\"must be an absolute base URL\").optional(),\n branding: brandingSchema.optional(),\n contentRating: z\n .record(z.string(), z.enum(OARS_INTENSITIES, { error: \"must be one of intense, mild, moderate, none\" }), {\n error: \"must be a record of OARS 1.1 attribute ids to intensities\",\n })\n .optional(),\n releases: z.array(releaseSchema, { error: \"must be an array of releases\" }).optional(),\n execArgs: textList(\"argument\", \"must be an array of arguments appended to Exec\").optional(),\n launcherEnv: launcherEnvSchema.optional(),\n nodeFlags: nodeFlagsSchema.optional(),\n fileAssociations: z\n .array(fileAssociationSchema, { error: \"must be an array of file associations\" })\n .optional(),\n protocols: textList(\"URL scheme\", \"must be an array of URL schemes\").optional(),\n desktopActions: z\n .record(z.string(), desktopActionSchema, { error: \"must be a record of action ids to actions\" })\n .optional(),\n desktopEntry: textRecord(\"must be a desktop entry value\", \"must be a record of desktop entry keys to values\")\n .optional(),\n metainfoExtra: textList(\"AppStream XML fragment\", \"must be an array of AppStream XML fragments\").optional(),\n isDbusActivatable: flag(BOOLEAN_ERROR).optional(),\n extraFiles: relativePathRecord(\n \"must be a destination path inside the install prefix, without a leading slash or a .. segment\",\n extraFileEntrySchema,\n \"must be a record of prefix-relative destinations to source paths or { source, mode } entries\",\n ).optional(),\n minimumLibraryVersions: minimumLibraryVersionsSchema.optional(),\n depends: relationsSchema.optional(),\n relations: extraRelationsSchema.optional(),\n scripts: scriptsSchema.optional(),\n node: nodeRuntimeSchema.optional(),\n signing: signingSchema.optional(),\n appimage: appimageSchema.optional(),\n deb: debSchema.optional(),\n flatpak: flatpakSchema.optional(),\n rpm: rpmSchema.optional(),\n});\n\nexport { deploySchema };\n"]}
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type { McpSettings, ResolvedReactCompilerOptions } from "./config.ts";
|
|
2
2
|
export { APPLICATION_ID_MAX_LENGTH, isAgentReferenceEnabled, isAgentRulesEnabled, isValidApplicationId, resolveElementComponents, resolveElementProps, resolveLazyElements, resolveMcpSettings, resolveOmittedProps, } from "./config.ts";
|
|
3
3
|
export { createConfigLoader } from "./loader.ts";
|
|
4
|
+
export { assertSupportedNodeVersion, MINIMUM_NODE_VERSION } from "./node-version.ts";
|
|
4
5
|
export { resourceBasePath } from "./resource-base-path.ts";
|
|
5
6
|
//# sourceMappingURL=internal.d.ts.map
|
package/dist/internal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EACH,yBAAyB,EACzB,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EACH,yBAAyB,EACzB,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC"}
|
package/dist/internal.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { APPLICATION_ID_MAX_LENGTH, isAgentReferenceEnabled, isAgentRulesEnabled, isValidApplicationId, resolveElementComponents, resolveElementProps, resolveLazyElements, resolveMcpSettings, resolveOmittedProps, } from "./config.js";
|
|
2
2
|
export { createConfigLoader } from "./loader.js";
|
|
3
|
+
export { assertSupportedNodeVersion, MINIMUM_NODE_VERSION } from "./node-version.js";
|
|
3
4
|
export { resourceBasePath } from "./resource-base-path.js";
|
|
4
5
|
//# sourceMappingURL=internal.js.map
|
package/dist/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AACA,OAAO,EACH,yBAAyB,EACzB,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC","sourcesContent":["export type { McpSettings, ResolvedReactCompilerOptions } from \"./config.ts\";\nexport {\n APPLICATION_ID_MAX_LENGTH,\n isAgentReferenceEnabled,\n isAgentRulesEnabled,\n isValidApplicationId,\n resolveElementComponents,\n resolveElementProps,\n resolveLazyElements,\n resolveMcpSettings,\n resolveOmittedProps,\n} from \"./config.ts\";\nexport { createConfigLoader } from \"./loader.ts\";\nexport { resourceBasePath } from \"./resource-base-path.ts\";\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AACA,OAAO,EACH,yBAAyB,EACzB,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC","sourcesContent":["export type { McpSettings, ResolvedReactCompilerOptions } from \"./config.ts\";\nexport {\n APPLICATION_ID_MAX_LENGTH,\n isAgentReferenceEnabled,\n isAgentRulesEnabled,\n isValidApplicationId,\n resolveElementComponents,\n resolveElementProps,\n resolveLazyElements,\n resolveMcpSettings,\n resolveOmittedProps,\n} from \"./config.ts\";\nexport { createConfigLoader } from \"./loader.ts\";\nexport { assertSupportedNodeVersion, MINIMUM_NODE_VERSION } from \"./node-version.ts\";\nexport { resourceBasePath } from \"./resource-base-path.ts\";\n"]}
|
package/dist/loader.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ type LoadConfigOptions = {
|
|
|
15
15
|
* top-level values, and the name is passed to a config authored as a function.
|
|
16
16
|
*/
|
|
17
17
|
mode?: string | undefined;
|
|
18
|
-
}
|
|
18
|
+
} & Partial<Record<"configFile", string | undefined>>;
|
|
19
19
|
/** Reads a project's configuration once per directory, caching what it loads and what it resolves. */
|
|
20
20
|
type ConfigLoader = {
|
|
21
21
|
/** Loads the configuration file the given directory resolves to, as {@link loadConfig} does. */
|
package/dist/loader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,KAAK,MAAM,EAGX,KAAK,cAAc,EAEtB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,KAAK,MAAM,EAGX,KAAK,cAAc,EAEtB,MAAM,aAAa,CAAC;AAGrB,2DAA2D;AAC3D,KAAK,YAAY,GAAG;IAChB,8CAA8C;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,+DAA+D;IAC/D,UAAU,EAAE,MAAM,CAAC;IACnB,gFAAgF;IAChF,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,+FAA+F;AAC/F,KAAK,iBAAiB,GAAG;IACrB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;AAEtD,sGAAsG;AACtG,KAAK,YAAY,GAAG;IAChB,gGAAgG;IAChG,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;IAC7C,yGAAyG;IACzG,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;CACrD,CAAC;AAoCF;;;;;GAKG;AACH,QAAA,MAAM,UAAU,GAAU,KAAK,MAAM,EAAE,UAAS,iBAAsB,KAAG,OAAO,CAAC,YAAY,CAgC5F,CAAC;AAEF,QAAA,MAAM,kBAAkB,GAAI,UAAS,iBAAsB,KAAG,YAkB7D,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,CAAC"}
|
package/dist/loader.js
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
|
-
import { warn } from "@gtkx/utils";
|
|
1
|
+
import { isPathInside, warn } from "@gtkx/utils";
|
|
2
2
|
import { loadConfig as loadConfigFile } from "c12";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
import { resolve } from "node:path";
|
|
5
5
|
import { missingConfigFileError } from "./config-error.js";
|
|
6
6
|
import { graduatedFutureKeys, resolveConfig, validateConfig, } from "./config.js";
|
|
7
|
+
import { assertSupportedNodeVersion } from "./node-version.js";
|
|
7
8
|
const GRADUATED_FUTURE_ENV = "GTKX_GRADUATED_FUTURE_SHOWN";
|
|
8
9
|
const graduatedFutureWarnings = new Map();
|
|
10
|
+
const selectedConfigFile = (root, configured) => {
|
|
11
|
+
if (configured === undefined) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
const path = resolve(root, configured);
|
|
15
|
+
if (!isPathInside(root, path)) {
|
|
16
|
+
throw new Error(`Configuration file ${configured} must be inside the project root ${root}`);
|
|
17
|
+
}
|
|
18
|
+
return path;
|
|
19
|
+
};
|
|
9
20
|
const warnGraduatedFuture = (config, root) => {
|
|
10
21
|
const keys = graduatedFutureKeys(config);
|
|
11
22
|
const signature = keys.join(",");
|
|
@@ -25,7 +36,9 @@ const warnGraduatedFuture = (config, root) => {
|
|
|
25
36
|
* @throws When that directory holds no configuration file, or when the configuration fails validation.
|
|
26
37
|
*/
|
|
27
38
|
const loadConfig = async (cwd, options = {}) => {
|
|
39
|
+
assertSupportedNodeVersion();
|
|
28
40
|
const searched = resolve(cwd);
|
|
41
|
+
const requestedConfigFile = selectedConfigFile(searched, options.configFile);
|
|
29
42
|
const result = await loadConfigFile({
|
|
30
43
|
name: "gtkx",
|
|
31
44
|
cwd: searched,
|
|
@@ -33,15 +46,16 @@ const loadConfig = async (cwd, options = {}) => {
|
|
|
33
46
|
globalRc: false,
|
|
34
47
|
packageJson: false,
|
|
35
48
|
context: { mode: options.mode },
|
|
49
|
+
...(requestedConfigFile !== undefined && { configFile: requestedConfigFile }),
|
|
36
50
|
...((options.mode !== undefined) && { envName: options.mode }),
|
|
37
51
|
});
|
|
38
52
|
const configFile = result.configFile;
|
|
39
53
|
if (configFile === undefined || !existsSync(resolve(searched, configFile))) {
|
|
40
|
-
throw missingConfigFileError(searched);
|
|
54
|
+
throw missingConfigFileError(searched, requestedConfigFile);
|
|
41
55
|
}
|
|
42
56
|
const config = result.config;
|
|
43
57
|
const root = result.cwd ?? searched;
|
|
44
|
-
validateConfig(config);
|
|
58
|
+
validateConfig(config, configFile);
|
|
45
59
|
warnGraduatedFuture(config, root);
|
|
46
60
|
return {
|
|
47
61
|
config,
|
|
@@ -50,6 +64,7 @@ const loadConfig = async (cwd, options = {}) => {
|
|
|
50
64
|
};
|
|
51
65
|
};
|
|
52
66
|
const createConfigLoader = (options = {}) => {
|
|
67
|
+
assertSupportedNodeVersion();
|
|
53
68
|
const loaded = new Map();
|
|
54
69
|
const resolved = new Map();
|
|
55
70
|
const load = (cwd) => loaded.getOrInsertComputed(resolve(cwd), (root) => loadConfig(root, options));
|
package/dist/loader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.js","sourceRoot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,CAAC","sourcesContent":["import { isPathInside, warn } from \"@gtkx/utils\";\nimport { loadConfig as loadConfigFile } from \"c12\";\nimport { existsSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { missingConfigFileError } from \"./config-error.ts\";\nimport {\n type Config,\n graduatedFutureKeys,\n resolveConfig,\n type ResolvedConfig,\n validateConfig,\n} from \"./config.ts\";\nimport { assertSupportedNodeVersion } from \"./node-version.ts\";\n\n/** Result of loading a project's `gtkx.config.ts` file. */\ntype LoadedConfig = {\n /** The parsed and validated configuration. */\n config: Config;\n /** Absolute path of the configuration file that was loaded. */\n configFile: string;\n /** Absolute path of the project root the configuration was resolved against. */\n root: string;\n};\n\n/** How a configuration file is read, shared by {@link loadConfig} and `createConfigLoader`. */\ntype LoadConfigOptions = {\n /**\n * Environment name such as `development`: the config's matching `$<mode>` block is layered over the\n * top-level values, and the name is passed to a config authored as a function.\n */\n mode?: string | undefined;\n} & Partial<Record<\"configFile\", string | undefined>>;\n\n/** Reads a project's configuration once per directory, caching what it loads and what it resolves. */\ntype ConfigLoader = {\n /** Loads the configuration file the given directory resolves to, as {@link loadConfig} does. */\n load: (cwd: string) => Promise<LoadedConfig>;\n /** Loads the configuration for the given directory and reduces it to what the build and the app need. */\n resolve: (cwd: string) => Promise<ResolvedConfig>;\n};\n\nconst GRADUATED_FUTURE_ENV = \"GTKX_GRADUATED_FUTURE_SHOWN\";\nconst graduatedFutureWarnings: Map<string, string> = new Map();\n\nconst selectedConfigFile = (root: string, configured: string | undefined): string | undefined => {\n if (configured === undefined) {\n return undefined;\n }\n\n const path = resolve(root, configured);\n\n if (!isPathInside(root, path)) {\n throw new Error(`Configuration file ${configured} must be inside the project root ${root}`);\n }\n\n return path;\n};\n\nconst warnGraduatedFuture = (config: unknown, root: string): void => {\n const keys = graduatedFutureKeys(config);\n const signature = keys.join(\",\");\n\n if (\n keys.length === 0 ||\n graduatedFutureWarnings.get(root) === signature ||\n process.env[GRADUATED_FUTURE_ENV] === signature\n ) {\n return;\n }\n\n graduatedFutureWarnings.set(root, signature);\n process.env[GRADUATED_FUTURE_ENV] = signature;\n warn(`GTKX 2 ignores graduated future flags: ${keys.join(\", \")}. Remove them from gtkx.config.ts.`);\n};\n\n/**\n * Loads and validates the `gtkx.config.ts` file for a project.\n * @param cwd Directory the configuration file is looked up in; parent directories are not searched.\n * @param options Loading options, such as the environment mode whose overrides are applied.\n * @throws When that directory holds no configuration file, or when the configuration fails validation.\n */\nconst loadConfig = async (cwd: string, options: LoadConfigOptions = {}): Promise<LoadedConfig> => {\n assertSupportedNodeVersion();\n const searched = resolve(cwd);\n const requestedConfigFile = selectedConfigFile(searched, options.configFile);\n\n const result = await loadConfigFile<Config>({\n name: \"gtkx\",\n cwd: searched,\n rcFile: false,\n globalRc: false,\n packageJson: false,\n context: { mode: options.mode },\n ...(requestedConfigFile !== undefined && { configFile: requestedConfigFile }),\n ...((options.mode !== undefined) && { envName: options.mode }),\n });\n\n const configFile = result.configFile;\n\n if (configFile === undefined || !existsSync(resolve(searched, configFile))) {\n throw missingConfigFileError(searched, requestedConfigFile);\n }\n\n const config = result.config;\n const root = result.cwd ?? searched;\n validateConfig(config, configFile);\n warnGraduatedFuture(config, root);\n\n return {\n config,\n configFile,\n root,\n };\n};\n\nconst createConfigLoader = (options: LoadConfigOptions = {}): ConfigLoader => {\n assertSupportedNodeVersion();\n const loaded: Map<string, Promise<LoadedConfig>> = new Map();\n const resolved: Map<string, Promise<ResolvedConfig>> = new Map();\n\n const load = (cwd: string): Promise<LoadedConfig> =>\n loaded.getOrInsertComputed(resolve(cwd), (root) => loadConfig(root, options));\n\n const resolveAt = async (root: string): Promise<ResolvedConfig> => {\n const { config, root: configRoot } = await load(root);\n\n return resolveConfig(config, configRoot);\n };\n\n return {\n load,\n resolve: (cwd: string): Promise<ResolvedConfig> => resolved.getOrInsertComputed(resolve(cwd), resolveAt),\n };\n};\n\nexport { loadConfig, createConfigLoader, type LoadedConfig, type ConfigLoader };\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-version.d.ts","sourceRoot":"","sources":["../src/node-version.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,oBAAoB,WAAW,CAAC;AAEtC,QAAA,MAAM,0BAA0B,QAAO,IAStC,CAAC;AAEF,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const MINIMUM_NODE_MAJOR = 26;
|
|
2
|
+
const MINIMUM_NODE_MINOR = 7;
|
|
3
|
+
const MINIMUM_NODE_VERSION = "26.7.0";
|
|
4
|
+
const assertSupportedNodeVersion = () => {
|
|
5
|
+
const [major = 0, minor = 0] = process.versions.node.split(".").map(Number);
|
|
6
|
+
const isSupported = major > MINIMUM_NODE_MAJOR || (major === MINIMUM_NODE_MAJOR && minor >= MINIMUM_NODE_MINOR);
|
|
7
|
+
if (!isSupported) {
|
|
8
|
+
throw new Error(`GTKX requires Node.js ${MINIMUM_NODE_VERSION} or newer. Current version: ${process.versions.node}.`);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
export { assertSupportedNodeVersion, MINIMUM_NODE_VERSION };
|
|
12
|
+
//# sourceMappingURL=node-version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-version.js","sourceRoot":"","sources":["../src/node-version.ts"],"names":[],"mappings":"AAAA,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAC9B,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,oBAAoB,GAAG,QAAQ,CAAC;AAEtC,MAAM,0BAA0B,GAAG,GAAS,EAAE;IAC1C,MAAM,CAAC,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC5E,MAAM,WAAW,GAAG,KAAK,GAAG,kBAAkB,IAAI,CAAC,KAAK,KAAK,kBAAkB,IAAI,KAAK,IAAI,kBAAkB,CAAC,CAAC;IAEhH,IAAI,CAAC,WAAW,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACX,yBAAyB,oBAAoB,+BAA+B,OAAO,CAAC,QAAQ,CAAC,IAAI,GAAG,CACvG,CAAC;IACN,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,CAAC","sourcesContent":["const MINIMUM_NODE_MAJOR = 26;\nconst MINIMUM_NODE_MINOR = 7;\nconst MINIMUM_NODE_VERSION = \"26.7.0\";\n\nconst assertSupportedNodeVersion = (): void => {\n const [major = 0, minor = 0] = process.versions.node.split(\".\").map(Number);\n const isSupported = major > MINIMUM_NODE_MAJOR || (major === MINIMUM_NODE_MAJOR && minor >= MINIMUM_NODE_MINOR);\n\n if (!isSupported) {\n throw new Error(\n `GTKX requires Node.js ${MINIMUM_NODE_VERSION} or newer. Current version: ${process.versions.node}.`,\n );\n }\n};\n\nexport { assertSupportedNodeVersion, MINIMUM_NODE_VERSION };\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gtkx/config",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.3",
|
|
4
4
|
"description": "Config schema, loader, and element-prop mapping for the GTK toolchain.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"gtkx",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"node": ">=26.7.0"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@gtkx/utils": "2.0.0-beta.
|
|
67
|
+
"@gtkx/utils": "2.0.0-beta.3",
|
|
68
68
|
"c12": "^3.3.4",
|
|
69
69
|
"defu": "^6.1.7",
|
|
70
70
|
"vite": "^8.2.2",
|
package/src/config-error.ts
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const DEFAULT_CONFIG_FILE = "gtkx.config.ts";
|
|
4
4
|
|
|
5
5
|
const isRecord = (value: unknown): value is Record<string, unknown> =>
|
|
6
6
|
typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
new Error(`${CONFIG_PREFIX} no configuration file found in ${cwd}`);
|
|
8
|
+
const configPrefix = (configFile: string): string => `${configFile}:`;
|
|
10
9
|
|
|
11
|
-
const
|
|
10
|
+
const missingConfigFileError = (cwd: string, configFile?: string): Error =>
|
|
11
|
+
new Error(configFile === undefined
|
|
12
|
+
? `${configPrefix(DEFAULT_CONFIG_FILE)} no configuration file found in ${cwd}`
|
|
13
|
+
: `${configPrefix(configFile)} no configuration file found`);
|
|
14
|
+
|
|
15
|
+
const configError = (error: z.ZodError, configFile = DEFAULT_CONFIG_FILE): Error =>
|
|
16
|
+
new Error(`${configPrefix(configFile)}\n${z.prettifyError(error)}`);
|
|
12
17
|
|
|
13
18
|
export { isRecord, missingConfigFileError, configError };
|
package/src/config.ts
CHANGED
|
@@ -201,11 +201,11 @@ const resolveReactCompilerOptions = (setting: Config["reactCompiler"]): Resolved
|
|
|
201
201
|
};
|
|
202
202
|
};
|
|
203
203
|
|
|
204
|
-
const validateConfig = (config: unknown): void => {
|
|
204
|
+
const validateConfig = (config: unknown, configFile?: string): void => {
|
|
205
205
|
const result = validationSchema.safeParse(config);
|
|
206
206
|
|
|
207
207
|
if (!result.success) {
|
|
208
|
-
throw configError(result.error);
|
|
208
|
+
throw configError(result.error, configFile);
|
|
209
209
|
}
|
|
210
210
|
};
|
|
211
211
|
|
package/src/deploy.ts
CHANGED
|
@@ -37,15 +37,21 @@ const URL_KINDS = [
|
|
|
37
37
|
const BOOLEAN_ERROR = "must be a boolean";
|
|
38
38
|
const EPOCH_ERROR = "must be a non-negative integer";
|
|
39
39
|
const EXTRA_FILE_ERROR = "must be a source path or a { source, mode } entry";
|
|
40
|
-
const FILE_MODE_ERROR = "must be an octal file mode such as 755";
|
|
40
|
+
const FILE_MODE_ERROR = "must be an octal file mode without setuid or setgid bits, such as 755";
|
|
41
41
|
const FILE_MODE_PATTERN = /^[0-7]{3,4}$/;
|
|
42
|
+
const FILE_MODE_RADIX = 8;
|
|
43
|
+
const PRIVILEGED_FILE_MODE_MASK = 0o6000;
|
|
42
44
|
const HEX_COLOR_ERROR = "must be a #rrggbb color";
|
|
43
45
|
const HEX_COLOR_PATTERN = /^#[\dA-Fa-f]{6}$/;
|
|
44
46
|
const KEY_FILE_ERROR = "must be a path to a PGP key file";
|
|
45
47
|
const KEY_ID_ERROR = "must be a PGP key id";
|
|
48
|
+
const LAUNCHER_ENV_ERROR = "must be a record of POSIX environment names to values without null bytes";
|
|
49
|
+
const LAUNCHER_ENV_NAME_ERROR = "must be a POSIX environment name";
|
|
50
|
+
const LAUNCHER_ENV_NAME_PATTERN = /^[A-Za-z_]\w*$/;
|
|
46
51
|
const MINIMUM_LIBRARY_VERSION_ERROR = "must be a version such as 4.18";
|
|
47
52
|
const MINIMUM_LIBRARY_VERSION_PATTERN = /^\d+(?:\.\d+)*$/;
|
|
48
53
|
const MINIMUM_LIBRARY_VERSIONS_ERROR = "must be a record of GIR library ids to a minimum version";
|
|
54
|
+
const NODE_FLAG_ERROR = "must be a Node.js flag beginning with a hyphen and containing no null bytes";
|
|
49
55
|
const LIBRARY_ID_ERROR = 'must be a GIR library identifier of the form "Name-Version", such as "Gtk-4.0"';
|
|
50
56
|
const SCRIPT_ERROR = "must be a path to a shell script";
|
|
51
57
|
const SOURCE_PATH_ERROR = "must be a source path";
|
|
@@ -112,11 +118,30 @@ const brandingSchema = z.strictObject({
|
|
|
112
118
|
|
|
113
119
|
const extraFileSchema = z.strictObject({
|
|
114
120
|
source: text(SOURCE_PATH_ERROR),
|
|
115
|
-
mode: z
|
|
121
|
+
mode: z
|
|
122
|
+
.string({ error: FILE_MODE_ERROR })
|
|
123
|
+
.regex(FILE_MODE_PATTERN, { error: FILE_MODE_ERROR })
|
|
124
|
+
.refine((mode) => (Number.parseInt(mode, FILE_MODE_RADIX) & PRIVILEGED_FILE_MODE_MASK) === 0, {
|
|
125
|
+
error: FILE_MODE_ERROR,
|
|
126
|
+
})
|
|
127
|
+
.optional(),
|
|
116
128
|
});
|
|
117
129
|
|
|
118
130
|
const extraFileEntrySchema = z.union([text(SOURCE_PATH_ERROR), extraFileSchema], { error: EXTRA_FILE_ERROR });
|
|
119
131
|
|
|
132
|
+
const launcherEnvSchema = z.record(
|
|
133
|
+
z.string({ error: LAUNCHER_ENV_NAME_ERROR }).regex(LAUNCHER_ENV_NAME_PATTERN, { error: LAUNCHER_ENV_NAME_ERROR }),
|
|
134
|
+
z.string({ error: LAUNCHER_ENV_ERROR }).refine((value) => !value.includes("\0"), { error: LAUNCHER_ENV_ERROR }),
|
|
135
|
+
{ error: (issue) => issue.code === "invalid_key" ? LAUNCHER_ENV_NAME_ERROR : LAUNCHER_ENV_ERROR },
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
const nodeFlagsSchema = z.array(
|
|
139
|
+
z
|
|
140
|
+
.string({ error: NODE_FLAG_ERROR })
|
|
141
|
+
.refine((value) => value.startsWith("-") && !value.includes("\0"), { error: NODE_FLAG_ERROR }),
|
|
142
|
+
{ error: "must be an array of Node.js flags" },
|
|
143
|
+
);
|
|
144
|
+
|
|
120
145
|
const nodeRuntimeSchema = z.strictObject({
|
|
121
146
|
source: z.enum(NODE_SOURCES, { error: "must be one of download, host, path" }).optional(),
|
|
122
147
|
version: text("must be a Node.js version such as 26.7.0").optional(),
|
|
@@ -262,6 +287,8 @@ const deploySchema = z.strictObject({
|
|
|
262
287
|
.optional(),
|
|
263
288
|
releases: z.array(releaseSchema, { error: "must be an array of releases" }).optional(),
|
|
264
289
|
execArgs: textList("argument", "must be an array of arguments appended to Exec").optional(),
|
|
290
|
+
launcherEnv: launcherEnvSchema.optional(),
|
|
291
|
+
nodeFlags: nodeFlagsSchema.optional(),
|
|
265
292
|
fileAssociations: z
|
|
266
293
|
.array(fileAssociationSchema, { error: "must be an array of file associations" })
|
|
267
294
|
.optional(),
|
|
@@ -271,6 +298,7 @@ const deploySchema = z.strictObject({
|
|
|
271
298
|
.optional(),
|
|
272
299
|
desktopEntry: textRecord("must be a desktop entry value", "must be a record of desktop entry keys to values")
|
|
273
300
|
.optional(),
|
|
301
|
+
metainfoExtra: textList("AppStream XML fragment", "must be an array of AppStream XML fragments").optional(),
|
|
274
302
|
isDbusActivatable: flag(BOOLEAN_ERROR).optional(),
|
|
275
303
|
extraFiles: relativePathRecord(
|
|
276
304
|
"must be a destination path inside the install prefix, without a leading slash or a .. segment",
|
package/src/internal.ts
CHANGED
package/src/loader.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { warn } from "@gtkx/utils";
|
|
1
|
+
import { isPathInside, warn } from "@gtkx/utils";
|
|
2
2
|
import { loadConfig as loadConfigFile } from "c12";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
import { resolve } from "node:path";
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
type ResolvedConfig,
|
|
11
11
|
validateConfig,
|
|
12
12
|
} from "./config.ts";
|
|
13
|
+
import { assertSupportedNodeVersion } from "./node-version.ts";
|
|
13
14
|
|
|
14
15
|
/** Result of loading a project's `gtkx.config.ts` file. */
|
|
15
16
|
type LoadedConfig = {
|
|
@@ -28,7 +29,7 @@ type LoadConfigOptions = {
|
|
|
28
29
|
* top-level values, and the name is passed to a config authored as a function.
|
|
29
30
|
*/
|
|
30
31
|
mode?: string | undefined;
|
|
31
|
-
}
|
|
32
|
+
} & Partial<Record<"configFile", string | undefined>>;
|
|
32
33
|
|
|
33
34
|
/** Reads a project's configuration once per directory, caching what it loads and what it resolves. */
|
|
34
35
|
type ConfigLoader = {
|
|
@@ -41,6 +42,20 @@ type ConfigLoader = {
|
|
|
41
42
|
const GRADUATED_FUTURE_ENV = "GTKX_GRADUATED_FUTURE_SHOWN";
|
|
42
43
|
const graduatedFutureWarnings: Map<string, string> = new Map();
|
|
43
44
|
|
|
45
|
+
const selectedConfigFile = (root: string, configured: string | undefined): string | undefined => {
|
|
46
|
+
if (configured === undefined) {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const path = resolve(root, configured);
|
|
51
|
+
|
|
52
|
+
if (!isPathInside(root, path)) {
|
|
53
|
+
throw new Error(`Configuration file ${configured} must be inside the project root ${root}`);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return path;
|
|
57
|
+
};
|
|
58
|
+
|
|
44
59
|
const warnGraduatedFuture = (config: unknown, root: string): void => {
|
|
45
60
|
const keys = graduatedFutureKeys(config);
|
|
46
61
|
const signature = keys.join(",");
|
|
@@ -65,7 +80,9 @@ const warnGraduatedFuture = (config: unknown, root: string): void => {
|
|
|
65
80
|
* @throws When that directory holds no configuration file, or when the configuration fails validation.
|
|
66
81
|
*/
|
|
67
82
|
const loadConfig = async (cwd: string, options: LoadConfigOptions = {}): Promise<LoadedConfig> => {
|
|
83
|
+
assertSupportedNodeVersion();
|
|
68
84
|
const searched = resolve(cwd);
|
|
85
|
+
const requestedConfigFile = selectedConfigFile(searched, options.configFile);
|
|
69
86
|
|
|
70
87
|
const result = await loadConfigFile<Config>({
|
|
71
88
|
name: "gtkx",
|
|
@@ -74,18 +91,19 @@ const loadConfig = async (cwd: string, options: LoadConfigOptions = {}): Promise
|
|
|
74
91
|
globalRc: false,
|
|
75
92
|
packageJson: false,
|
|
76
93
|
context: { mode: options.mode },
|
|
94
|
+
...(requestedConfigFile !== undefined && { configFile: requestedConfigFile }),
|
|
77
95
|
...((options.mode !== undefined) && { envName: options.mode }),
|
|
78
96
|
});
|
|
79
97
|
|
|
80
98
|
const configFile = result.configFile;
|
|
81
99
|
|
|
82
100
|
if (configFile === undefined || !existsSync(resolve(searched, configFile))) {
|
|
83
|
-
throw missingConfigFileError(searched);
|
|
101
|
+
throw missingConfigFileError(searched, requestedConfigFile);
|
|
84
102
|
}
|
|
85
103
|
|
|
86
104
|
const config = result.config;
|
|
87
105
|
const root = result.cwd ?? searched;
|
|
88
|
-
validateConfig(config);
|
|
106
|
+
validateConfig(config, configFile);
|
|
89
107
|
warnGraduatedFuture(config, root);
|
|
90
108
|
|
|
91
109
|
return {
|
|
@@ -96,6 +114,7 @@ const loadConfig = async (cwd: string, options: LoadConfigOptions = {}): Promise
|
|
|
96
114
|
};
|
|
97
115
|
|
|
98
116
|
const createConfigLoader = (options: LoadConfigOptions = {}): ConfigLoader => {
|
|
117
|
+
assertSupportedNodeVersion();
|
|
99
118
|
const loaded: Map<string, Promise<LoadedConfig>> = new Map();
|
|
100
119
|
const resolved: Map<string, Promise<ResolvedConfig>> = new Map();
|
|
101
120
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const MINIMUM_NODE_MAJOR = 26;
|
|
2
|
+
const MINIMUM_NODE_MINOR = 7;
|
|
3
|
+
const MINIMUM_NODE_VERSION = "26.7.0";
|
|
4
|
+
|
|
5
|
+
const assertSupportedNodeVersion = (): void => {
|
|
6
|
+
const [major = 0, minor = 0] = process.versions.node.split(".").map(Number);
|
|
7
|
+
const isSupported = major > MINIMUM_NODE_MAJOR || (major === MINIMUM_NODE_MAJOR && minor >= MINIMUM_NODE_MINOR);
|
|
8
|
+
|
|
9
|
+
if (!isSupported) {
|
|
10
|
+
throw new Error(
|
|
11
|
+
`GTKX requires Node.js ${MINIMUM_NODE_VERSION} or newer. Current version: ${process.versions.node}.`,
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { assertSupportedNodeVersion, MINIMUM_NODE_VERSION };
|