@gtkx/config 2.0.0-beta.2 → 2.0.0-beta.4

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.
@@ -0,0 +1,11 @@
1
+ import { type TransformOptions, type TransformResult } from "jiti";
2
+ type CapturedConfig<T> = {
3
+ dependencies: string[];
4
+ value: T;
5
+ };
6
+ declare const transformConfigModule: (options: TransformOptions) => TransformResult;
7
+ declare const setConfigDependencies: (value: object, dependencies: Iterable<string>) => void;
8
+ declare const configDependenciesFor: (value: unknown) => string[];
9
+ declare const captureConfigDependencies: <T>(operation: () => Promise<T>) => Promise<CapturedConfig<T>>;
10
+ export { captureConfigDependencies, configDependenciesFor, setConfigDependencies, transformConfigModule, };
11
+ //# sourceMappingURL=config-dependencies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-dependencies.d.ts","sourceRoot":"","sources":["../src/config-dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAE,MAAM,MAAM,CAAC;AAO1F,KAAK,cAAc,CAAC,CAAC,IAAI;IAAE,YAAY,EAAE,MAAM,EAAE,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAAC;AAuD9D,QAAA,MAAM,qBAAqB,GAAI,SAAS,gBAAgB,KAAG,eAY1D,CAAC;AAEF,QAAA,MAAM,qBAAqB,GAAI,OAAO,MAAM,EAAE,cAAc,QAAQ,CAAC,MAAM,CAAC,KAAG,IAI9E,CAAC;AAEF,QAAA,MAAM,qBAAqB,GAAI,OAAO,OAAO,KAAG,MAAM,EACqC,CAAC;AAE5F,QAAA,MAAM,yBAAyB,GAAU,CAAC,EAAE,WAAW,MAAM,OAAO,CAAC,CAAC,CAAC,KAAG,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAqBlG,CAAC;AAEF,OAAO,EACH,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GACxB,CAAC"}
@@ -0,0 +1,83 @@
1
+ import { createJiti } from "jiti";
2
+ import { AsyncLocalStorage } from "node:async_hooks";
3
+ import { createRequire, registerHooks } from "node:module";
4
+ import { extname, sep } from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ const captureStorage = new AsyncLocalStorage();
7
+ const dependenciesByValue = new WeakMap();
8
+ const CACHE_BUSTED_EXTENSIONS = new Set([".cjs", ".js", ".json", ".mjs"]);
9
+ const isTrackedPath = (path) => !path.includes(`${sep}node_modules${sep}`);
10
+ const addPath = (path) => {
11
+ if (isTrackedPath(path)) {
12
+ captureStorage.getStore()?.dependencies.add(path);
13
+ }
14
+ };
15
+ const addUrl = (url) => {
16
+ if (url.startsWith("file:")) {
17
+ addPath(fileURLToPath(url));
18
+ }
19
+ };
20
+ const cacheBustedUrl = (url) => {
21
+ if (!url.startsWith("file:")) {
22
+ return url;
23
+ }
24
+ const path = fileURLToPath(url);
25
+ if (!isTrackedPath(path) || !CACHE_BUSTED_EXTENSIONS.has(extname(path))) {
26
+ return url;
27
+ }
28
+ const parsed = new URL(url);
29
+ parsed.searchParams.set("gtkx-config-load", captureStorage.getStore()?.cacheKey ?? "uncaptured");
30
+ return parsed.href;
31
+ };
32
+ const registerResolutionHook = () => registerHooks({
33
+ resolve(specifier, context, nextResolve) {
34
+ const result = nextResolve(specifier, context);
35
+ addUrl(result.url);
36
+ return { ...result, url: cacheBustedUrl(result.url) };
37
+ },
38
+ });
39
+ const clearNativeModuleCache = (dependencies) => {
40
+ const cache = createRequire(import.meta.url).cache;
41
+ for (const path of dependencies) {
42
+ Reflect.deleteProperty(cache, path);
43
+ }
44
+ };
45
+ const transformConfigModule = (options) => {
46
+ const state = captureStorage.getStore();
47
+ if (state === undefined) {
48
+ throw new Error("Configuration transformation started outside a dependency capture");
49
+ }
50
+ if (options.filename !== undefined) {
51
+ addPath(options.filename);
52
+ }
53
+ return { code: state.transformer.transform(options) };
54
+ };
55
+ const setConfigDependencies = (value, dependencies) => {
56
+ const paths = [...new Set(dependencies)];
57
+ dependenciesByValue.set(value, paths);
58
+ clearNativeModuleCache(paths);
59
+ };
60
+ const configDependenciesFor = (value) => typeof value === "object" && value !== null ? dependenciesByValue.get(value) ?? [] : [];
61
+ const captureConfigDependencies = async (operation) => {
62
+ const state = {
63
+ cacheKey: process.hrtime.bigint().toString(),
64
+ dependencies: new Set(),
65
+ transformer: createJiti(import.meta.url, { fsCache: false, moduleCache: false }),
66
+ };
67
+ const hook = registerResolutionHook();
68
+ try {
69
+ const value = await captureStorage.run(state, operation);
70
+ return { dependencies: [...state.dependencies], value };
71
+ }
72
+ catch (error) {
73
+ if (typeof error === "object" && error !== null) {
74
+ setConfigDependencies(error, state.dependencies);
75
+ }
76
+ throw error;
77
+ }
78
+ finally {
79
+ hook.deregister();
80
+ }
81
+ };
82
+ export { captureConfigDependencies, configDependenciesFor, setConfigDependencies, transformConfigModule, };
83
+ //# sourceMappingURL=config-dependencies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-dependencies.js","sourceRoot":"","sources":["../src/config-dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA0D,MAAM,MAAM,CAAC;AAC1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAKzC,MAAM,cAAc,GAAoC,IAAI,iBAAiB,EAAE,CAAC;AAChF,MAAM,mBAAmB,GAA8B,IAAI,OAAO,EAAE,CAAC;AACrE,MAAM,uBAAuB,GAAwB,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AAE/F,MAAM,aAAa,GAAG,CAAC,IAAY,EAAW,EAAE,CAAC,CA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KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AAE5F,MAAM,yBAAyB,GAAG,KAAK,EAAK,SAA2B,EAA8B,EAAE;IACnG,MAAM,KAAK,GAAiB;QACxB,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC5C,YAAY,EAAE,IAAI,GAAG,EAAE;QACvB,WAAW,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;KACnF,CAAC;IACF,MAAM,IAAI,GAAG,sBAAsB,EAAE,CAAC;IAEtC,IAAI,CAAC;QACD,MAAM,KAAK,GAAG,MAAM,cAAc,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QAEzD,OAAO,EAAE,YAAY,EAAE,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,CAAC;IAC5D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YAC9C,qBAAqB,CAAC,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;QACrD,CAAC;QAED,MAAM,KAAK,CAAC;IAChB,CAAC;YAAS,CAAC;QACP,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,EACH,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GACxB,CAAC","sourcesContent":["import { createJiti, type Jiti, type TransformOptions, type TransformResult } from \"jiti\";\nimport { AsyncLocalStorage } from \"node:async_hooks\";\nimport { createRequire, registerHooks } from \"node:module\";\nimport { extname, sep } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\ntype CaptureState = { cacheKey: string; dependencies: Set<string>; transformer: Jiti };\ntype CapturedConfig<T> = { dependencies: string[]; value: T };\n\nconst captureStorage: AsyncLocalStorage<CaptureState> = new AsyncLocalStorage();\nconst dependenciesByValue: WeakMap<object, string[]> = new WeakMap();\nconst CACHE_BUSTED_EXTENSIONS: ReadonlySet<string> = new Set([\".cjs\", \".js\", \".json\", \".mjs\"]);\n\nconst isTrackedPath = (path: string): boolean => !path.includes(`${sep}node_modules${sep}`);\n\nconst addPath = (path: string): void => {\n if (isTrackedPath(path)) {\n captureStorage.getStore()?.dependencies.add(path);\n }\n};\n\nconst addUrl = (url: string): void => {\n if (url.startsWith(\"file:\")) {\n addPath(fileURLToPath(url));\n }\n};\n\nconst cacheBustedUrl = (url: string): string => {\n if (!url.startsWith(\"file:\")) {\n return url;\n }\n\n const path = fileURLToPath(url);\n\n if (!isTrackedPath(path) || !CACHE_BUSTED_EXTENSIONS.has(extname(path))) {\n return url;\n }\n\n const parsed = new URL(url);\n parsed.searchParams.set(\"gtkx-config-load\", captureStorage.getStore()?.cacheKey ?? \"uncaptured\");\n\n return parsed.href;\n};\n\nconst registerResolutionHook = (): ReturnType<typeof registerHooks> =>\n registerHooks({\n resolve(specifier, context, nextResolve) {\n const result = nextResolve(specifier, context);\n addUrl(result.url);\n\n return { ...result, url: cacheBustedUrl(result.url) };\n },\n });\n\nconst clearNativeModuleCache = (dependencies: Iterable<string>): void => {\n const cache = createRequire(import.meta.url).cache;\n\n for (const path of dependencies) {\n Reflect.deleteProperty(cache, path);\n }\n};\n\nconst transformConfigModule = (options: TransformOptions): TransformResult => {\n const state = captureStorage.getStore();\n\n if (state === undefined) {\n throw new Error(\"Configuration transformation started outside a dependency capture\");\n }\n\n if (options.filename !== undefined) {\n addPath(options.filename);\n }\n\n return { code: state.transformer.transform(options) };\n};\n\nconst setConfigDependencies = (value: object, dependencies: Iterable<string>): void => {\n const paths = [...new Set(dependencies)];\n dependenciesByValue.set(value, paths);\n clearNativeModuleCache(paths);\n};\n\nconst configDependenciesFor = (value: unknown): string[] =>\n typeof value === \"object\" && value !== null ? dependenciesByValue.get(value) ?? [] : [];\n\nconst captureConfigDependencies = async <T>(operation: () => Promise<T>): Promise<CapturedConfig<T>> => {\n const state: CaptureState = {\n cacheKey: process.hrtime.bigint().toString(),\n dependencies: new Set(),\n transformer: createJiti(import.meta.url, { fsCache: false, moduleCache: false }),\n };\n const hook = registerResolutionHook();\n\n try {\n const value = await captureStorage.run(state, operation);\n\n return { dependencies: [...state.dependencies], value };\n } catch (error) {\n if (typeof error === \"object\" && error !== null) {\n setConfigDependencies(error, state.dependencies);\n }\n\n throw error;\n } finally {\n hook.deregister();\n }\n};\n\nexport {\n captureConfigDependencies,\n configDependenciesFor,\n setConfigDependencies,\n transformConfigModule,\n};\n"]}
@@ -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;AAEzE,QAAA,MAAM,sBAAsB,GAAI,KAAK,MAAM,KAAG,KACyB,CAAC;AAExE,QAAA,MAAM,WAAW,GAAI,OAAO,CAAC,CAAC,QAAQ,KAAG,KAAiE,CAAC;AAE3G,OAAO,EAAE,QAAQ,EAAE,sBAAsB,EAAE,WAAW,EAAE,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,KAGW,CAAC;AAE/E,QAAA,MAAM,WAAW,GAAI,OAAO,CAAC,CAAC,QAAQ,EAAE,mBAAgC,KAAG,KACJ,CAAC;AAExE,OAAO,EAAE,QAAQ,EAAE,sBAAsB,EAAE,WAAW,EAAE,CAAC"}
@@ -1,7 +1,10 @@
1
1
  import { z } from "zod";
2
- const CONFIG_PREFIX = "gtkx.config.ts:";
2
+ const DEFAULT_CONFIG_FILE = "gtkx.config.*";
3
3
  const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
4
- const missingConfigFileError = (cwd) => new Error(`${CONFIG_PREFIX} no configuration file found in ${cwd}`);
5
- const configError = (error) => new Error(`${CONFIG_PREFIX}\n${z.prettifyError(error)}`);
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 in ${cwd}`);
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
@@ -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,aAAa,GAAG,iBAAiB,CAAC;AAExC,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,sBAAsB,GAAG,CAAC,GAAW,EAAS,EAAE,CAClD,IAAI,KAAK,CAAC,GAAG,aAAa,mCAAmC,GAAG,EAAE,CAAC,CAAC;AAExE,MAAM,WAAW,GAAG,CAAC,KAAiB,EAAS,EAAE,CAAC,IAAI,KAAK,CAAC,GAAG,aAAa,KAAK,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAE3G,OAAO,EAAE,QAAQ,EAAE,sBAAsB,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { z } from \"zod\";\n\nconst CONFIG_PREFIX = \"gtkx.config.ts:\";\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst missingConfigFileError = (cwd: string): Error =>\n new Error(`${CONFIG_PREFIX} no configuration file found in ${cwd}`);\n\nconst configError = (error: z.ZodError): Error => new Error(`${CONFIG_PREFIX}\\n${z.prettifyError(error)}`);\n\nexport { isRecord, missingConfigFileError, configError };\n"]}
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,eAAe,CAAC;AAE5C,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,mCAAmC,GAAG,EAAE,CAAC,CAAC;AAE/E,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.*\";\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 in ${cwd}`);\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
@@ -178,10 +178,7 @@ declare const configSchema: z.ZodObject<{
178
178
  desktopEntry: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
179
179
  metainfoExtra: z.ZodOptional<z.ZodArray<z.ZodString>>;
180
180
  isDbusActivatable: z.ZodOptional<z.ZodBoolean>;
181
- extraFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
182
- source: z.ZodString;
183
- mode: z.ZodOptional<z.ZodString>;
184
- }, z.core.$strict>]>>>;
181
+ extraFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodType<import("./deploy.ts").DeployExtraFileOptions, unknown, z.core.$ZodTypeInternals<import("./deploy.ts").DeployExtraFileOptions, unknown>>]>>>;
185
182
  minimumLibraryVersions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
186
183
  depends: z.ZodOptional<z.ZodObject<{
187
184
  deb: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -223,17 +220,7 @@ declare const configSchema: z.ZodObject<{
223
220
  preRemove: z.ZodOptional<z.ZodString>;
224
221
  postRemove: z.ZodOptional<z.ZodString>;
225
222
  }, z.core.$strict>>;
226
- node: z.ZodOptional<z.ZodObject<{
227
- source: z.ZodOptional<z.ZodEnum<{
228
- path: "path";
229
- download: "download";
230
- host: "host";
231
- }>>;
232
- version: z.ZodOptional<z.ZodString>;
233
- path: z.ZodOptional<z.ZodString>;
234
- shouldStrip: z.ZodOptional<z.ZodBoolean>;
235
- shouldUseCompileCache: z.ZodOptional<z.ZodBoolean>;
236
- }, z.core.$strict>>;
223
+ node: z.ZodOptional<z.ZodType<import("./deploy.ts").DeployNodeOptions, unknown, z.core.$ZodTypeInternals<import("./deploy.ts").DeployNodeOptions, unknown>>>;
237
224
  signing: z.ZodOptional<z.ZodObject<{
238
225
  appimage: z.ZodOptional<z.ZodObject<{
239
226
  gpgKeyId: z.ZodString;
@@ -346,7 +333,7 @@ declare const configSchema: z.ZodObject<{
346
333
  */
347
334
  declare const defineConfig: DefineConfig<Config>;
348
335
  declare const isValidApplicationId: (applicationId: string) => boolean;
349
- declare const validateConfig: (config: unknown) => void;
336
+ declare const validateConfig: (config: unknown, configFile?: string) => void;
350
337
  declare const graduatedFutureKeys: (config: unknown) => string[];
351
338
  /**
352
339
  * Deep-merges a configuration over a base. `override` wins over `base` on conflicting scalar and object keys, while
@@ -1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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) => {
@@ -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,aA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BAAgB,EAAE,uBAAuB,CAAC,MAAM,CAAC,gBAAgB,CAAC;IAClE,QAAQ,EAAE,qBAAqB,CAAC,MAAM,CAAC,QAAQ,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;KAC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BAAuB,CAAC,MAAM,CAAC,gBAAgB,CAAC;IAClE,QAAQ,EAAE,qBAAqB,CAAC,MAAM,CAAC,QAAQ,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, 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
@@ -1,4 +1,14 @@
1
1
  import { z } from "zod";
2
+ /** Deployment extra-file options, including its safe file mode. */
3
+ type DeployExtraFileOptions = Record<"source", string> & {
4
+ /** Octal file mode. Setuid and setgid bits are rejected. */
5
+ mode?: string | undefined;
6
+ };
7
+ /** Deployment Node.js runtime options, including its version default. */
8
+ type DeployNodeOptions = Partial<Record<"source", "download" | "host" | "path" | undefined> & Record<"path", string | undefined> & Record<"shouldStrip" | "shouldUseCompileCache", boolean | undefined>> & {
9
+ /** Expected Node.js version. Downloaded runtimes default to exactly 26.7.0 when omitted. */
10
+ version?: string | undefined;
11
+ };
2
12
  declare const deploySchema: z.ZodObject<{
3
13
  targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
4
14
  appimage: "appimage";
@@ -89,10 +99,7 @@ declare const deploySchema: z.ZodObject<{
89
99
  desktopEntry: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
90
100
  metainfoExtra: z.ZodOptional<z.ZodArray<z.ZodString>>;
91
101
  isDbusActivatable: z.ZodOptional<z.ZodBoolean>;
92
- extraFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
93
- source: z.ZodString;
94
- mode: z.ZodOptional<z.ZodString>;
95
- }, z.core.$strict>]>>>;
102
+ extraFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodType<DeployExtraFileOptions, unknown, z.core.$ZodTypeInternals<DeployExtraFileOptions, unknown>>]>>>;
96
103
  minimumLibraryVersions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
97
104
  depends: z.ZodOptional<z.ZodObject<{
98
105
  deb: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -134,17 +141,7 @@ declare const deploySchema: z.ZodObject<{
134
141
  preRemove: z.ZodOptional<z.ZodString>;
135
142
  postRemove: z.ZodOptional<z.ZodString>;
136
143
  }, z.core.$strict>>;
137
- node: z.ZodOptional<z.ZodObject<{
138
- source: z.ZodOptional<z.ZodEnum<{
139
- path: "path";
140
- download: "download";
141
- host: "host";
142
- }>>;
143
- version: z.ZodOptional<z.ZodString>;
144
- path: z.ZodOptional<z.ZodString>;
145
- shouldStrip: z.ZodOptional<z.ZodBoolean>;
146
- shouldUseCompileCache: z.ZodOptional<z.ZodBoolean>;
147
- }, z.core.$strict>>;
144
+ node: z.ZodOptional<z.ZodType<DeployNodeOptions, unknown, z.core.$ZodTypeInternals<DeployNodeOptions, unknown>>>;
148
145
  signing: z.ZodOptional<z.ZodObject<{
149
146
  appimage: z.ZodOptional<z.ZodObject<{
150
147
  gpgKeyId: z.ZodString;
@@ -239,5 +236,5 @@ declare const deploySchema: z.ZodObject<{
239
236
  prefixes: z.ZodOptional<z.ZodArray<z.ZodString>>;
240
237
  }, z.core.$strict>>;
241
238
  }, z.core.$strict>;
242
- export { deploySchema };
239
+ export { deploySchema, type DeployExtraFileOptions, type DeployNodeOptions };
243
240
  //# sourceMappingURL=deploy.d.ts.map
@@ -1 +1 @@
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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-105,7 +105,7 @@ const extraFileSchema = z.strictObject({
105
105
  .optional(),
106
106
  });
107
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: LAUNCHER_ENV_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
109
  const nodeFlagsSchema = z.array(z
110
110
  .string({ error: NODE_FLAG_ERROR })
111
111
  .refine((value) => value.startsWith("-") && !value.includes("\0"), { error: NODE_FLAG_ERROR }), { error: "must be an array of Node.js flags" });
@@ -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,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,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.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: 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"]}
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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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,EAAuD,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\n/** Deployment extra-file options, including its safe file mode. */\ntype DeployExtraFileOptions = Record<\"source\", string> & {\n /** Octal file mode. Setuid and setgid bits are rejected. */\n mode?: string | undefined;\n};\nconst extraFileSchema: z.ZodType<DeployExtraFileOptions> = 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\n/** Deployment Node.js runtime options, including its version default. */\ntype DeployNodeOptions = Partial<\n Record<\"source\", \"download\" | \"host\" | \"path\" | undefined> &\n Record<\"path\", string | undefined> &\n Record<\"shouldStrip\" | \"shouldUseCompileCache\", boolean | undefined>\n> & {\n /** Expected Node.js version. Downloaded runtimes default to exactly 26.7.0 when omitted. */\n version?: string | undefined;\n};\nconst nodeRuntimeSchema: z.ZodType<DeployNodeOptions> = 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, type DeployExtraFileOptions, type DeployNodeOptions };\n"]}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export { type Config, defineConfig, mergeConfig, type ResolvedConfig } from "./config.ts";
2
+ export { type DeployExtraFileOptions, type DeployNodeOptions } from "./deploy.ts";
2
3
  export { type ConfigLoader, type LoadedConfig, loadConfig } from "./loader.ts";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC1F,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC1F,OAAO,EAAE,KAAK,sBAAsB,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAClF,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export { defineConfig, mergeConfig } from "./config.js";
2
+ export {} from "./deploy.js";
2
3
  export { loadConfig } from "./loader.js";
3
4
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,YAAY,EAAE,WAAW,EAAuB,MAAM,aAAa,CAAC;AAC1F,OAAO,EAAwC,UAAU,EAAE,MAAM,aAAa,CAAC","sourcesContent":["export { type Config, defineConfig, mergeConfig, type ResolvedConfig } from \"./config.ts\";\nexport { type ConfigLoader, type LoadedConfig, loadConfig } from \"./loader.ts\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,YAAY,EAAE,WAAW,EAAuB,MAAM,aAAa,CAAC;AAC1F,OAAO,EAAuD,MAAM,aAAa,CAAC;AAClF,OAAO,EAAwC,UAAU,EAAE,MAAM,aAAa,CAAC","sourcesContent":["export { type Config, defineConfig, mergeConfig, type ResolvedConfig } from \"./config.ts\";\nexport { type DeployExtraFileOptions, type DeployNodeOptions } from \"./deploy.ts\";\nexport { type ConfigLoader, type LoadedConfig, loadConfig } from \"./loader.ts\";\n"]}
@@ -1,3 +1,4 @@
1
+ export { configDependenciesFor } from "./config-dependencies.ts";
1
2
  export type { McpSettings, ResolvedReactCompilerOptions } from "./config.ts";
2
3
  export { APPLICATION_ID_MAX_LENGTH, isAgentReferenceEnabled, isAgentRulesEnabled, isValidApplicationId, resolveElementComponents, resolveElementProps, resolveLazyElements, resolveMcpSettings, resolveOmittedProps, } from "./config.ts";
3
4
  export { createConfigLoader } from "./loader.ts";
@@ -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,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,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,3 +1,4 @@
1
+ export { configDependenciesFor } from "./config-dependencies.js";
1
2
  export { APPLICATION_ID_MAX_LENGTH, isAgentReferenceEnabled, isAgentRulesEnabled, isValidApplicationId, resolveElementComponents, resolveElementProps, resolveLazyElements, resolveMcpSettings, resolveOmittedProps, } from "./config.js";
2
3
  export { createConfigLoader } from "./loader.js";
3
4
  export { assertSupportedNodeVersion, MINIMUM_NODE_VERSION } from "./node-version.js";
@@ -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,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"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,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 { configDependenciesFor } from \"./config-dependencies.ts\";\nexport 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"]}
@@ -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;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,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CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,CAAC"}
package/dist/loader.js CHANGED
@@ -1,12 +1,44 @@
1
1
  import { isPathInside, warn } from "@gtkx/utils";
2
2
  import { loadConfig as loadConfigFile } from "c12";
3
3
  import { existsSync } from "node:fs";
4
- import { resolve } from "node:path";
4
+ import { basename, extname, isAbsolute, relative, resolve } from "node:path";
5
+ import { captureConfigDependencies, setConfigDependencies, transformConfigModule, } from "./config-dependencies.js";
5
6
  import { missingConfigFileError } from "./config-error.js";
6
7
  import { graduatedFutureKeys, resolveConfig, validateConfig, } from "./config.js";
7
8
  import { assertSupportedNodeVersion } from "./node-version.js";
8
9
  const GRADUATED_FUTURE_ENV = "GTKX_GRADUATED_FUTURE_SHOWN";
9
10
  const graduatedFutureWarnings = new Map();
11
+ const isLocalConfigSource = (source) => source.startsWith(".") || isAbsolute(source);
12
+ const isDirectoryConfigSource = (source) => {
13
+ const extension = extname(source);
14
+ return extension.length === 0 || extension === basename(source);
15
+ };
16
+ const localConfigSourcePath = (source, options) => {
17
+ if (source === "." || !isLocalConfigSource(source)) {
18
+ return undefined;
19
+ }
20
+ const cwd = options.cwd ?? process.cwd();
21
+ return isDirectoryConfigSource(source)
22
+ ? resolve(cwd, source, options.configFile ?? "gtkx.config")
23
+ : resolve(cwd, source);
24
+ };
25
+ const rejectMissingLocalConfig = (source, options) => {
26
+ const path = localConfigSourcePath(source, options);
27
+ if (path !== undefined && !existsSync(path)) {
28
+ throw new Error(`Extended configuration does not exist at ${path}`);
29
+ }
30
+ };
31
+ const withConfigDependencies = (dependencies, operation) => {
32
+ try {
33
+ return operation();
34
+ }
35
+ catch (error) {
36
+ if (typeof error === "object" && error !== null) {
37
+ setConfigDependencies(error, dependencies);
38
+ }
39
+ throw error;
40
+ }
41
+ };
10
42
  const selectedConfigFile = (root, configured) => {
11
43
  if (configured === undefined) {
12
44
  return undefined;
@@ -15,7 +47,7 @@ const selectedConfigFile = (root, configured) => {
15
47
  if (!isPathInside(root, path)) {
16
48
  throw new Error(`Configuration file ${configured} must be inside the project root ${root}`);
17
49
  }
18
- return path;
50
+ return relative(root, path);
19
51
  };
20
52
  const warnGraduatedFuture = (config, root) => {
21
53
  const keys = graduatedFutureKeys(config);
@@ -39,29 +71,45 @@ const loadConfig = async (cwd, options = {}) => {
39
71
  assertSupportedNodeVersion();
40
72
  const searched = resolve(cwd);
41
73
  const requestedConfigFile = selectedConfigFile(searched, options.configFile);
42
- const result = await loadConfigFile({
74
+ const captured = await captureConfigDependencies(() => loadConfigFile({
43
75
  name: "gtkx",
44
76
  cwd: searched,
45
77
  rcFile: false,
46
78
  globalRc: false,
47
79
  packageJson: false,
48
80
  context: { mode: options.mode },
81
+ jitiOptions: { fsCache: false, transform: transformConfigModule },
82
+ resolve: rejectMissingLocalConfig,
49
83
  ...(requestedConfigFile !== undefined && { configFile: requestedConfigFile }),
50
84
  ...((options.mode !== undefined) && { envName: options.mode }),
51
- });
85
+ }));
86
+ const result = captured.value;
52
87
  const configFile = result.configFile;
53
- if (configFile === undefined || !existsSync(resolve(searched, configFile))) {
54
- throw missingConfigFileError(searched);
55
- }
56
- const config = result.config;
57
88
  const root = result.cwd ?? searched;
58
- validateConfig(config);
59
- warnGraduatedFuture(config, root);
60
- return {
61
- config,
62
- configFile,
63
- root,
64
- };
89
+ const layerFiles = (result.layers ?? [])
90
+ .flatMap((layer) => layer.configFile === undefined
91
+ ? []
92
+ : [resolve(layer.cwd ?? root, layer.configFile)]);
93
+ const dependencies = [
94
+ ...(configFile === undefined ? [] : [configFile]),
95
+ ...layerFiles,
96
+ ...captured.dependencies,
97
+ ];
98
+ return withConfigDependencies(dependencies, () => {
99
+ if (configFile === undefined || !existsSync(resolve(searched, configFile))) {
100
+ throw missingConfigFileError(searched, requestedConfigFile);
101
+ }
102
+ const config = result.config;
103
+ validateConfig(config, configFile);
104
+ warnGraduatedFuture(config, root);
105
+ const loaded = {
106
+ config,
107
+ configFile,
108
+ root,
109
+ };
110
+ setConfigDependencies(loaded, dependencies);
111
+ return loaded;
112
+ });
65
113
  };
66
114
  const createConfigLoader = (options = {}) => {
67
115
  assertSupportedNodeVersion();
@@ -1 +1 @@
1
- {"version":3,"file":"loader.js","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,KAAK,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAEH,mBAAmB,EACnB,aAAa,EAEb,cAAc,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AA6B/D,MAAM,oBAAoB,GAAG,6BAA6B,CAAC;AAC3D,MAAM,uBAAuB,GAAwB,IAAI,GAAG,EAAE,CAAC;AAE/D,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAE,UAA8B,EAAsB,EAAE;IAC5F,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAEvC,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,sBAAsB,UAAU,oCAAoC,IAAI,EAAE,CAAC,CAAC;IAChG,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,MAAe,EAAE,IAAY,EAAQ,EAAE;IAChE,MAAM,IAAI,GAAG,mBAAmB,CAAC,MAAM,CAAC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O,EAAE,UAAU,EAAE,kBAAkB,EAAwC,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);\n }\n\n const config = result.config;\n const root = result.cwd ?? searched;\n validateConfig(config);\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 };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s\";\nimport { basename, extname, isAbsolute, relative, resolve } from \"node:path\";\nimport {\n captureConfigDependencies,\n setConfigDependencies,\n transformConfigModule,\n} from \"./config-dependencies.ts\";\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\ntype ConfigResolutionOptions = { configFile?: string | undefined; cwd?: string | undefined };\n\nconst isLocalConfigSource = (source: string): boolean => source.startsWith(\".\") || isAbsolute(source);\n\nconst isDirectoryConfigSource = (source: string): boolean => {\n const extension = extname(source);\n\n return extension.length === 0 || extension === basename(source);\n};\n\nconst localConfigSourcePath = (source: string, options: ConfigResolutionOptions): string | undefined => {\n if (source === \".\" || !isLocalConfigSource(source)) {\n return undefined;\n }\n\n const cwd = options.cwd ?? process.cwd();\n\n return isDirectoryConfigSource(source)\n ? resolve(cwd, source, options.configFile ?? \"gtkx.config\")\n : resolve(cwd, source);\n};\n\nconst rejectMissingLocalConfig = (source: string, options: ConfigResolutionOptions): undefined => {\n const path = localConfigSourcePath(source, options);\n\n if (path !== undefined && !existsSync(path)) {\n throw new Error(`Extended configuration does not exist at ${path}`);\n }\n};\n\nconst withConfigDependencies = <T>(dependencies: string[], operation: () => T): T => {\n try {\n return operation();\n } catch (error) {\n if (typeof error === \"object\" && error !== null) {\n setConfigDependencies(error, dependencies);\n }\n\n throw error;\n }\n};\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 relative(root, 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 captured = await captureConfigDependencies(() =>\n loadConfigFile<Config>({\n name: \"gtkx\",\n cwd: searched,\n rcFile: false,\n globalRc: false,\n packageJson: false,\n context: { mode: options.mode },\n jitiOptions: { fsCache: false, transform: transformConfigModule },\n resolve: rejectMissingLocalConfig,\n ...(requestedConfigFile !== undefined && { configFile: requestedConfigFile }),\n ...((options.mode !== undefined) && { envName: options.mode }),\n }));\n const result = captured.value;\n\n const configFile = result.configFile;\n const root = result.cwd ?? searched;\n const layerFiles = (result.layers ?? [])\n .flatMap((layer) => layer.configFile === undefined\n ? []\n : [resolve(layer.cwd ?? root, layer.configFile)]);\n const dependencies = [\n ...(configFile === undefined ? [] : [configFile]),\n ...layerFiles,\n ...captured.dependencies,\n ];\n\n return withConfigDependencies(dependencies, () => {\n if (configFile === undefined || !existsSync(resolve(searched, configFile))) {\n throw missingConfigFileError(searched, requestedConfigFile);\n }\n\n const config = result.config;\n validateConfig(config, configFile);\n warnGraduatedFuture(config, root);\n\n const loaded = {\n config,\n configFile,\n root,\n };\n setConfigDependencies(loaded, dependencies);\n\n return loaded;\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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gtkx/config",
3
- "version": "2.0.0-beta.2",
3
+ "version": "2.0.0-beta.4",
4
4
  "description": "Config schema, loader, and element-prop mapping for the GTK toolchain.",
5
5
  "keywords": [
6
6
  "gtkx",
@@ -64,9 +64,10 @@
64
64
  "node": ">=26.7.0"
65
65
  },
66
66
  "dependencies": {
67
- "@gtkx/utils": "2.0.0-beta.2",
67
+ "@gtkx/utils": "2.0.0-beta.4",
68
68
  "c12": "^3.3.4",
69
69
  "defu": "^6.1.7",
70
+ "jiti": "^2.7.0",
70
71
  "vite": "^8.2.2",
71
72
  "zod": "^4.5.4"
72
73
  },
@@ -0,0 +1,114 @@
1
+ import { createJiti, type Jiti, type TransformOptions, type TransformResult } from "jiti";
2
+ import { AsyncLocalStorage } from "node:async_hooks";
3
+ import { createRequire, registerHooks } from "node:module";
4
+ import { extname, sep } from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+
7
+ type CaptureState = { cacheKey: string; dependencies: Set<string>; transformer: Jiti };
8
+ type CapturedConfig<T> = { dependencies: string[]; value: T };
9
+
10
+ const captureStorage: AsyncLocalStorage<CaptureState> = new AsyncLocalStorage();
11
+ const dependenciesByValue: WeakMap<object, string[]> = new WeakMap();
12
+ const CACHE_BUSTED_EXTENSIONS: ReadonlySet<string> = new Set([".cjs", ".js", ".json", ".mjs"]);
13
+
14
+ const isTrackedPath = (path: string): boolean => !path.includes(`${sep}node_modules${sep}`);
15
+
16
+ const addPath = (path: string): void => {
17
+ if (isTrackedPath(path)) {
18
+ captureStorage.getStore()?.dependencies.add(path);
19
+ }
20
+ };
21
+
22
+ const addUrl = (url: string): void => {
23
+ if (url.startsWith("file:")) {
24
+ addPath(fileURLToPath(url));
25
+ }
26
+ };
27
+
28
+ const cacheBustedUrl = (url: string): string => {
29
+ if (!url.startsWith("file:")) {
30
+ return url;
31
+ }
32
+
33
+ const path = fileURLToPath(url);
34
+
35
+ if (!isTrackedPath(path) || !CACHE_BUSTED_EXTENSIONS.has(extname(path))) {
36
+ return url;
37
+ }
38
+
39
+ const parsed = new URL(url);
40
+ parsed.searchParams.set("gtkx-config-load", captureStorage.getStore()?.cacheKey ?? "uncaptured");
41
+
42
+ return parsed.href;
43
+ };
44
+
45
+ const registerResolutionHook = (): ReturnType<typeof registerHooks> =>
46
+ registerHooks({
47
+ resolve(specifier, context, nextResolve) {
48
+ const result = nextResolve(specifier, context);
49
+ addUrl(result.url);
50
+
51
+ return { ...result, url: cacheBustedUrl(result.url) };
52
+ },
53
+ });
54
+
55
+ const clearNativeModuleCache = (dependencies: Iterable<string>): void => {
56
+ const cache = createRequire(import.meta.url).cache;
57
+
58
+ for (const path of dependencies) {
59
+ Reflect.deleteProperty(cache, path);
60
+ }
61
+ };
62
+
63
+ const transformConfigModule = (options: TransformOptions): TransformResult => {
64
+ const state = captureStorage.getStore();
65
+
66
+ if (state === undefined) {
67
+ throw new Error("Configuration transformation started outside a dependency capture");
68
+ }
69
+
70
+ if (options.filename !== undefined) {
71
+ addPath(options.filename);
72
+ }
73
+
74
+ return { code: state.transformer.transform(options) };
75
+ };
76
+
77
+ const setConfigDependencies = (value: object, dependencies: Iterable<string>): void => {
78
+ const paths = [...new Set(dependencies)];
79
+ dependenciesByValue.set(value, paths);
80
+ clearNativeModuleCache(paths);
81
+ };
82
+
83
+ const configDependenciesFor = (value: unknown): string[] =>
84
+ typeof value === "object" && value !== null ? dependenciesByValue.get(value) ?? [] : [];
85
+
86
+ const captureConfigDependencies = async <T>(operation: () => Promise<T>): Promise<CapturedConfig<T>> => {
87
+ const state: CaptureState = {
88
+ cacheKey: process.hrtime.bigint().toString(),
89
+ dependencies: new Set(),
90
+ transformer: createJiti(import.meta.url, { fsCache: false, moduleCache: false }),
91
+ };
92
+ const hook = registerResolutionHook();
93
+
94
+ try {
95
+ const value = await captureStorage.run(state, operation);
96
+
97
+ return { dependencies: [...state.dependencies], value };
98
+ } catch (error) {
99
+ if (typeof error === "object" && error !== null) {
100
+ setConfigDependencies(error, state.dependencies);
101
+ }
102
+
103
+ throw error;
104
+ } finally {
105
+ hook.deregister();
106
+ }
107
+ };
108
+
109
+ export {
110
+ captureConfigDependencies,
111
+ configDependenciesFor,
112
+ setConfigDependencies,
113
+ transformConfigModule,
114
+ };
@@ -1,13 +1,18 @@
1
1
  import { z } from "zod";
2
2
 
3
- const CONFIG_PREFIX = "gtkx.config.ts:";
3
+ const DEFAULT_CONFIG_FILE = "gtkx.config.*";
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 missingConfigFileError = (cwd: string): Error =>
9
- new Error(`${CONFIG_PREFIX} no configuration file found in ${cwd}`);
8
+ const configPrefix = (configFile: string): string => `${configFile}:`;
10
9
 
11
- const configError = (error: z.ZodError): Error => new Error(`${CONFIG_PREFIX}\n${z.prettifyError(error)}`);
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 in ${cwd}`);
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
@@ -116,7 +116,12 @@ const brandingSchema = z.strictObject({
116
116
  dark: hexColorSchema,
117
117
  });
118
118
 
119
- const extraFileSchema = z.strictObject({
119
+ /** Deployment extra-file options, including its safe file mode. */
120
+ type DeployExtraFileOptions = Record<"source", string> & {
121
+ /** Octal file mode. Setuid and setgid bits are rejected. */
122
+ mode?: string | undefined;
123
+ };
124
+ const extraFileSchema: z.ZodType<DeployExtraFileOptions> = z.strictObject({
120
125
  source: text(SOURCE_PATH_ERROR),
121
126
  mode: z
122
127
  .string({ error: FILE_MODE_ERROR })
@@ -132,7 +137,7 @@ const extraFileEntrySchema = z.union([text(SOURCE_PATH_ERROR), extraFileSchema],
132
137
  const launcherEnvSchema = z.record(
133
138
  z.string({ error: LAUNCHER_ENV_NAME_ERROR }).regex(LAUNCHER_ENV_NAME_PATTERN, { error: LAUNCHER_ENV_NAME_ERROR }),
134
139
  z.string({ error: LAUNCHER_ENV_ERROR }).refine((value) => !value.includes("\0"), { error: LAUNCHER_ENV_ERROR }),
135
- { error: LAUNCHER_ENV_ERROR },
140
+ { error: (issue) => issue.code === "invalid_key" ? LAUNCHER_ENV_NAME_ERROR : LAUNCHER_ENV_ERROR },
136
141
  );
137
142
 
138
143
  const nodeFlagsSchema = z.array(
@@ -142,7 +147,16 @@ const nodeFlagsSchema = z.array(
142
147
  { error: "must be an array of Node.js flags" },
143
148
  );
144
149
 
145
- const nodeRuntimeSchema = z.strictObject({
150
+ /** Deployment Node.js runtime options, including its version default. */
151
+ type DeployNodeOptions = Partial<
152
+ Record<"source", "download" | "host" | "path" | undefined> &
153
+ Record<"path", string | undefined> &
154
+ Record<"shouldStrip" | "shouldUseCompileCache", boolean | undefined>
155
+ > & {
156
+ /** Expected Node.js version. Downloaded runtimes default to exactly 26.7.0 when omitted. */
157
+ version?: string | undefined;
158
+ };
159
+ const nodeRuntimeSchema: z.ZodType<DeployNodeOptions> = z.strictObject({
146
160
  source: z.enum(NODE_SOURCES, { error: "must be one of download, host, path" }).optional(),
147
161
  version: text("must be a Node.js version such as 26.7.0").optional(),
148
162
  path: text("must be a path to a node binary").optional(),
@@ -317,4 +331,4 @@ const deploySchema = z.strictObject({
317
331
  rpm: rpmSchema.optional(),
318
332
  });
319
333
 
320
- export { deploySchema };
334
+ export { deploySchema, type DeployExtraFileOptions, type DeployNodeOptions };
package/src/index.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export { type Config, defineConfig, mergeConfig, type ResolvedConfig } from "./config.ts";
2
+ export { type DeployExtraFileOptions, type DeployNodeOptions } from "./deploy.ts";
2
3
  export { type ConfigLoader, type LoadedConfig, loadConfig } from "./loader.ts";
package/src/internal.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export { configDependenciesFor } from "./config-dependencies.ts";
1
2
  export type { McpSettings, ResolvedReactCompilerOptions } from "./config.ts";
2
3
  export {
3
4
  APPLICATION_ID_MAX_LENGTH,
package/src/loader.ts CHANGED
@@ -1,7 +1,12 @@
1
1
  import { isPathInside, warn } from "@gtkx/utils";
2
2
  import { loadConfig as loadConfigFile } from "c12";
3
3
  import { existsSync } from "node:fs";
4
- import { resolve } from "node:path";
4
+ import { basename, extname, isAbsolute, relative, resolve } from "node:path";
5
+ import {
6
+ captureConfigDependencies,
7
+ setConfigDependencies,
8
+ transformConfigModule,
9
+ } from "./config-dependencies.ts";
5
10
  import { missingConfigFileError } from "./config-error.ts";
6
11
  import {
7
12
  type Config,
@@ -42,6 +47,48 @@ type ConfigLoader = {
42
47
  const GRADUATED_FUTURE_ENV = "GTKX_GRADUATED_FUTURE_SHOWN";
43
48
  const graduatedFutureWarnings: Map<string, string> = new Map();
44
49
 
50
+ type ConfigResolutionOptions = { configFile?: string | undefined; cwd?: string | undefined };
51
+
52
+ const isLocalConfigSource = (source: string): boolean => source.startsWith(".") || isAbsolute(source);
53
+
54
+ const isDirectoryConfigSource = (source: string): boolean => {
55
+ const extension = extname(source);
56
+
57
+ return extension.length === 0 || extension === basename(source);
58
+ };
59
+
60
+ const localConfigSourcePath = (source: string, options: ConfigResolutionOptions): string | undefined => {
61
+ if (source === "." || !isLocalConfigSource(source)) {
62
+ return undefined;
63
+ }
64
+
65
+ const cwd = options.cwd ?? process.cwd();
66
+
67
+ return isDirectoryConfigSource(source)
68
+ ? resolve(cwd, source, options.configFile ?? "gtkx.config")
69
+ : resolve(cwd, source);
70
+ };
71
+
72
+ const rejectMissingLocalConfig = (source: string, options: ConfigResolutionOptions): undefined => {
73
+ const path = localConfigSourcePath(source, options);
74
+
75
+ if (path !== undefined && !existsSync(path)) {
76
+ throw new Error(`Extended configuration does not exist at ${path}`);
77
+ }
78
+ };
79
+
80
+ const withConfigDependencies = <T>(dependencies: string[], operation: () => T): T => {
81
+ try {
82
+ return operation();
83
+ } catch (error) {
84
+ if (typeof error === "object" && error !== null) {
85
+ setConfigDependencies(error, dependencies);
86
+ }
87
+
88
+ throw error;
89
+ }
90
+ };
91
+
45
92
  const selectedConfigFile = (root: string, configured: string | undefined): string | undefined => {
46
93
  if (configured === undefined) {
47
94
  return undefined;
@@ -53,7 +100,7 @@ const selectedConfigFile = (root: string, configured: string | undefined): strin
53
100
  throw new Error(`Configuration file ${configured} must be inside the project root ${root}`);
54
101
  }
55
102
 
56
- return path;
103
+ return relative(root, path);
57
104
  };
58
105
 
59
106
  const warnGraduatedFuture = (config: unknown, root: string): void => {
@@ -84,33 +131,51 @@ const loadConfig = async (cwd: string, options: LoadConfigOptions = {}): Promise
84
131
  const searched = resolve(cwd);
85
132
  const requestedConfigFile = selectedConfigFile(searched, options.configFile);
86
133
 
87
- const result = await loadConfigFile<Config>({
88
- name: "gtkx",
89
- cwd: searched,
90
- rcFile: false,
91
- globalRc: false,
92
- packageJson: false,
93
- context: { mode: options.mode },
94
- ...(requestedConfigFile !== undefined && { configFile: requestedConfigFile }),
95
- ...((options.mode !== undefined) && { envName: options.mode }),
96
- });
134
+ const captured = await captureConfigDependencies(() =>
135
+ loadConfigFile<Config>({
136
+ name: "gtkx",
137
+ cwd: searched,
138
+ rcFile: false,
139
+ globalRc: false,
140
+ packageJson: false,
141
+ context: { mode: options.mode },
142
+ jitiOptions: { fsCache: false, transform: transformConfigModule },
143
+ resolve: rejectMissingLocalConfig,
144
+ ...(requestedConfigFile !== undefined && { configFile: requestedConfigFile }),
145
+ ...((options.mode !== undefined) && { envName: options.mode }),
146
+ }));
147
+ const result = captured.value;
97
148
 
98
149
  const configFile = result.configFile;
99
-
100
- if (configFile === undefined || !existsSync(resolve(searched, configFile))) {
101
- throw missingConfigFileError(searched);
102
- }
103
-
104
- const config = result.config;
105
150
  const root = result.cwd ?? searched;
106
- validateConfig(config);
107
- warnGraduatedFuture(config, root);
108
-
109
- return {
110
- config,
111
- configFile,
112
- root,
113
- };
151
+ const layerFiles = (result.layers ?? [])
152
+ .flatMap((layer) => layer.configFile === undefined
153
+ ? []
154
+ : [resolve(layer.cwd ?? root, layer.configFile)]);
155
+ const dependencies = [
156
+ ...(configFile === undefined ? [] : [configFile]),
157
+ ...layerFiles,
158
+ ...captured.dependencies,
159
+ ];
160
+
161
+ return withConfigDependencies(dependencies, () => {
162
+ if (configFile === undefined || !existsSync(resolve(searched, configFile))) {
163
+ throw missingConfigFileError(searched, requestedConfigFile);
164
+ }
165
+
166
+ const config = result.config;
167
+ validateConfig(config, configFile);
168
+ warnGraduatedFuture(config, root);
169
+
170
+ const loaded = {
171
+ config,
172
+ configFile,
173
+ root,
174
+ };
175
+ setConfigDependencies(loaded, dependencies);
176
+
177
+ return loaded;
178
+ });
114
179
  };
115
180
 
116
181
  const createConfigLoader = (options: LoadConfigOptions = {}): ConfigLoader => {