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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/README.md +2 -2
  2. package/dist/builtin-elements.d.ts +11 -0
  3. package/dist/builtin-elements.d.ts.map +1 -0
  4. package/dist/builtin-elements.js +329 -0
  5. package/dist/builtin-elements.js.map +1 -0
  6. package/dist/config-dependencies.d.ts +5 -3
  7. package/dist/config-dependencies.d.ts.map +1 -1
  8. package/dist/config-dependencies.js +54 -22
  9. package/dist/config-dependencies.js.map +1 -1
  10. package/dist/config-error.d.ts.map +1 -1
  11. package/dist/config-error.js.map +1 -1
  12. package/dist/config-reloader.d.ts.map +1 -1
  13. package/dist/config-reloader.js +2 -8
  14. package/dist/config-reloader.js.map +1 -1
  15. package/dist/config-source.d.ts +3 -1
  16. package/dist/config-source.d.ts.map +1 -1
  17. package/dist/config-source.js +17 -2
  18. package/dist/config-source.js.map +1 -1
  19. package/dist/config.d.ts +34 -10
  20. package/dist/config.d.ts.map +1 -1
  21. package/dist/config.js +56 -2
  22. package/dist/config.js.map +1 -1
  23. package/dist/deploy.d.ts +64 -6
  24. package/dist/deploy.d.ts.map +1 -1
  25. package/dist/deploy.js +168 -10
  26. package/dist/deploy.js.map +1 -1
  27. package/dist/index.d.ts +2 -2
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js.map +1 -1
  30. package/dist/internal.d.ts +2 -2
  31. package/dist/internal.d.ts.map +1 -1
  32. package/dist/internal.js +2 -2
  33. package/dist/internal.js.map +1 -1
  34. package/dist/loader.d.ts +2 -0
  35. package/dist/loader.d.ts.map +1 -1
  36. package/dist/loader.js +15 -20
  37. package/dist/loader.js.map +1 -1
  38. package/dist/resource-base-path.d.ts.map +1 -1
  39. package/dist/schema-text.d.ts.map +1 -1
  40. package/dist/user-event-signals.d.ts.map +1 -1
  41. package/dist/virtual.d.ts +1 -1
  42. package/dist/virtual.d.ts.map +1 -1
  43. package/dist/virtual.js +3 -2
  44. package/dist/virtual.js.map +1 -1
  45. package/dist/vite-plugin.d.ts +2 -0
  46. package/dist/vite-plugin.d.ts.map +1 -1
  47. package/dist/vite-plugin.js +4 -3
  48. package/dist/vite-plugin.js.map +1 -1
  49. package/dist/vite-root.d.ts.map +1 -1
  50. package/package.json +14 -29
  51. package/src/builtin-elements.ts +338 -0
  52. package/src/config-dependencies.ts +61 -27
  53. package/src/config-error.ts +5 -3
  54. package/src/config-reloader.ts +2 -11
  55. package/src/config-source.ts +25 -2
  56. package/src/config.ts +65 -4
  57. package/src/deploy.ts +204 -25
  58. package/src/index.ts +9 -2
  59. package/src/internal.ts +2 -2
  60. package/src/loader.ts +24 -29
  61. package/src/virtual.ts +5 -4
  62. package/src/vite-plugin.ts +9 -2
  63. package/dist/static-dependencies.d.ts +0 -3
  64. package/dist/static-dependencies.d.ts.map +0 -1
  65. package/dist/static-dependencies.js +0 -350
  66. package/dist/static-dependencies.js.map +0 -1
  67. package/src/static-dependencies.ts +0 -464
@@ -1 +1 @@
1
- {"version":3,"file":"config-reloader.js","sourceRoot":"","sources":["../src/config-reloader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,UAAU,EAA6C,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAOrE,MAAM,oBAAoB,GAAG,KAAK,EAC9B,GAAW,EACX,UAA6B,EAAE,EAC/B,sBAAgC,EAAE,EACX,EAAE;IACzB,IAAI,kBAA0B,CAAC;IAC/B,IAAI,iBAAiB,GAAG,mBAAmB,CAAC;IAE5C,IAAI,OAAO,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QACnC,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAC9C,kBAAkB,GAAG,MAAM,CAAC,UAAU,CAAC;QACvC,iBAAiB,GAAG,CAAC,GAAG,iBAAiB,EAAE,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC;IACjF,CAAC;SAAM,CAAC;QACJ,kBAAkB,GAAG,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAC1D,CAAC;IAED,MAAM,kBAAkB,GAAG,QAAQ,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC;IAC7D,MAAM,YAAY,GAAG,GAAa,EAAE,CAAC;QACjC,GAAG,IAAI,GAAG,CACN,CAAC,kBAAkB,EAAE,GAAG,iBAAiB,CAAC;aACrC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,yBAAyB,CAAC,IAAI,EAAE,kBAAkB,EAAE,GAAG,CAAC,CAAC,CACnF;KACJ,CAAC;IAEF,OAAO;QACH,YAAY;QACZ,MAAM,EAAE,KAAK,IAAI,EAAE;YACf,IAAI,MAAoB,CAAC;YAEzB,IAAI,CAAC;gBACD,MAAM,GAAG,MAAM,UAAU,CAAC,GAAG,EAAE,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,CAAC,CAAC;YACnF,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,iBAAiB,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,iBAAiB,EAAE,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC1F,MAAM,KAAK,CAAC;YAChB,CAAC;YAED,iBAAiB,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;YAElD,OAAO,MAAM,CAAC;QAClB,CAAC;KACJ,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,CAAC","sourcesContent":["import { relative, resolve } from \"node:path\";\nimport { configDependenciesFor } from \"./config-dependencies.ts\";\nimport { loadConfig, type LoadConfigOptions, type LoadedConfig } from \"./loader.ts\";\nimport { resolveConfigDependencies } from \"./static-dependencies.ts\";\n\ntype ConfigReloader = {\n reload: () => Promise<LoadedConfig>;\n resolvePaths: () => string[];\n};\n\nconst createConfigReloader = async (\n cwd: string,\n options: LoadConfigOptions = {},\n initialDependencies: string[] = [],\n): Promise<ConfigReloader> => {\n let selectedConfigFile: string;\n let knownDependencies = initialDependencies;\n\n if (options.configFile === undefined) {\n const loaded = await loadConfig(cwd, options);\n selectedConfigFile = loaded.configFile;\n knownDependencies = [...knownDependencies, ...configDependenciesFor(loaded)];\n } else {\n selectedConfigFile = resolve(cwd, options.configFile);\n }\n\n const selectedConfigName = relative(cwd, selectedConfigFile);\n const resolvePaths = (): string[] => [\n ...new Set(\n [selectedConfigFile, ...knownDependencies]\n .flatMap((path) => resolveConfigDependencies(path, selectedConfigName, cwd)),\n ),\n ];\n\n return {\n resolvePaths,\n reload: async () => {\n let loaded: LoadedConfig;\n\n try {\n loaded = await loadConfig(cwd, { ...options, configFile: selectedConfigFile });\n } catch (error) {\n knownDependencies = [...new Set([...knownDependencies, ...configDependenciesFor(error)])];\n throw error;\n }\n\n knownDependencies = configDependenciesFor(loaded);\n\n return loaded;\n },\n };\n};\n\nexport { createConfigReloader };\n"]}
1
+ {"version":3,"file":"config-reloader.js","sourceRoot":"","sources":["../src/config-reloader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,UAAU,EAA6C,MAAM,aAAa,CAAC;AAOpF,MAAM,oBAAoB,GAAG,KAAK,EAC9B,GAAW,EACX,OAAO,GAAsB,EAAE,EAC/B,mBAAmB,GAAa,EAAE,EACX,EAAE;IACzB,IAAI,kBAA0B,CAAC;IAC/B,IAAI,iBAAiB,GAAG,mBAAmB,CAAC;IAE5C,IAAI,OAAO,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QACnC,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAC9C,kBAAkB,GAAG,MAAM,CAAC,UAAU,CAAC;QACvC,iBAAiB,GAAG,CAAC,GAAG,iBAAiB,EAAE,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC;IACjF,CAAC;SAAM,CAAC;QACJ,kBAAkB,GAAG,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAC1D,CAAC;IAED,OAAO;QACH,YAAY,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,kBAAkB,EAAE,GAAG,iBAAiB,CAAC,CAAC,CAAC;QAC5E,MAAM,EAAE,KAAK,IAAI,EAAE;YACf,IAAI,MAAoB,CAAC;YAEzB,IAAI,CAAC;gBACD,MAAM,GAAG,MAAM,UAAU,CAAC,GAAG,EAAE,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,CAAC,CAAC;YACnF,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,iBAAiB,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,iBAAiB,EAAE,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC1F,MAAM,KAAK,CAAC;YAChB,CAAC;YAED,iBAAiB,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;YAElD,OAAO,MAAM,CAAC;QAClB,CAAC;KACJ,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,CAAC","sourcesContent":["import { resolve } from \"node:path\";\nimport { configDependenciesFor } from \"./config-dependencies.ts\";\nimport { loadConfig, type LoadConfigOptions, type LoadedConfig } from \"./loader.ts\";\n\ntype ConfigReloader = {\n reload: () => Promise<LoadedConfig>;\n resolvePaths: () => string[];\n};\n\nconst createConfigReloader = async (\n cwd: string,\n options: LoadConfigOptions = {},\n initialDependencies: string[] = [],\n): Promise<ConfigReloader> => {\n let selectedConfigFile: string;\n let knownDependencies = initialDependencies;\n\n if (options.configFile === undefined) {\n const loaded = await loadConfig(cwd, options);\n selectedConfigFile = loaded.configFile;\n knownDependencies = [...knownDependencies, ...configDependenciesFor(loaded)];\n } else {\n selectedConfigFile = resolve(cwd, options.configFile);\n }\n\n return {\n resolvePaths: () => [...new Set([selectedConfigFile, ...knownDependencies])],\n reload: async () => {\n let loaded: LoadedConfig;\n\n try {\n loaded = await loadConfig(cwd, { ...options, configFile: selectedConfigFile });\n } catch (error) {\n knownDependencies = [...new Set([...knownDependencies, ...configDependenciesFor(error)])];\n throw error;\n }\n\n knownDependencies = configDependenciesFor(loaded);\n\n return loaded;\n },\n };\n};\n\nexport { createConfigReloader };\n"]}
@@ -2,6 +2,8 @@ type ConfigResolutionOptions = {
2
2
  configFile?: string | undefined;
3
3
  cwd?: string | undefined;
4
4
  };
5
+ declare const configCandidatePaths: (directory: string) => string[];
6
+ declare const configSourceCandidates: (path: string) => string[];
5
7
  declare const localConfigSourcePath: (source: string, options: ConfigResolutionOptions) => string | undefined;
6
- export { localConfigSourcePath, type ConfigResolutionOptions };
8
+ export { configCandidatePaths, configSourceCandidates, localConfigSourcePath, type ConfigResolutionOptions };
7
9
  //# sourceMappingURL=config-source.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config-source.d.ts","sourceRoot":"","sources":["../src/config-source.ts"],"names":[],"mappings":"AAEA,KAAK,uBAAuB,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAU7F,QAAA,MAAM,qBAAqB,GAAI,QAAQ,MAAM,EAAE,SAAS,uBAAuB,KAAG,MAAM,GAAG,SAU1F,CAAC;AAEF,OAAO,EAAE,qBAAqB,EAAE,KAAK,uBAAuB,EAAE,CAAC"}
1
+ {"version":3,"file":"config-source.d.ts","sourceRoot":"","sources":["../src/config-source.ts"],"names":[],"mappings":"AAGA,KAAK,uBAAuB,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAK7F,QAAA,MAAM,oBAAoB,cAAe,MAAM,KAAG,MAAM,EAGnD,CAAC;AAEN,QAAA,MAAM,sBAAsB,SAAU,MAAM,KAAG,MAAM,EAYpD,CAAC;AAUF,QAAA,MAAM,qBAAqB,WAAY,MAAM,WAAW,uBAAuB,KAAG,MAAM,GAAG,SAU1F,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,KAAK,uBAAuB,EAAE,CAAC"}
@@ -1,4 +1,19 @@
1
- import { basename, extname, isAbsolute, resolve } from "node:path";
1
+ import { SUPPORTED_EXTENSIONS } from "c12";
2
+ import { basename, extname, isAbsolute, join, resolve } from "node:path";
3
+ const CONFIG_LOCATIONS = ["gtkx.config", ".config/gtkx", ".config/gtkx.config"];
4
+ const CONFIG_EXTENSIONS = SUPPORTED_EXTENSIONS.filter((extension) => extension !== ".cjs" && extension !== ".cts");
5
+ const configCandidatePaths = (directory) => CONFIG_LOCATIONS.flatMap((location) => CONFIG_EXTENSIONS.map((extension) => join(directory, `${location}${extension}`)));
6
+ const configSourceCandidates = (path) => {
7
+ const extension = extname(path);
8
+ const fallback = extension === ".js" ? ".ts" : extension === ".mjs" ? ".mts" : undefined;
9
+ if (extension.length > 0) {
10
+ return fallback === undefined ? [path] : [path, `${path.slice(0, -extension.length)}${fallback}`];
11
+ }
12
+ return [
13
+ path,
14
+ ...CONFIG_EXTENSIONS.flatMap((candidate) => [`${path}${candidate}`, join(path, `index${candidate}`)]),
15
+ ];
16
+ };
2
17
  const isLocalConfigSource = (source) => source.startsWith(".") || isAbsolute(source);
3
18
  const isDirectoryConfigSource = (source) => {
4
19
  const extension = extname(source);
@@ -13,5 +28,5 @@ const localConfigSourcePath = (source, options) => {
13
28
  ? resolve(cwd, source, options.configFile ?? "gtkx.config")
14
29
  : resolve(cwd, source);
15
30
  };
16
- export { localConfigSourcePath };
31
+ export { configCandidatePaths, configSourceCandidates, localConfigSourcePath };
17
32
  //# sourceMappingURL=config-source.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config-source.js","sourceRoot":"","sources":["../src/config-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAInE,MAAM,mBAAmB,GAAG,CAAC,MAAc,EAAW,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;AAEtG,MAAM,uBAAuB,GAAG,CAAC,MAAc,EAAW,EAAE;IACxD,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAElC,OAAO,SAAS,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,KAAK,QAAQ,CAAC,MAAM,CAAC,CAAC;AACpE,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAG,CAAC,MAAc,EAAE,OAAgC,EAAsB,EAAE;IACnG,IAAI,MAAM,KAAK,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,EAAE,CAAC;QACjD,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAEzC,OAAO,uBAAuB,CAAC,MAAM,CAAC;QAClC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,UAAU,IAAI,aAAa,CAAC;QAC3D,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AAC/B,CAAC,CAAC;AAEF,OAAO,EAAE,qBAAqB,EAAgC,CAAC","sourcesContent":["import { basename, extname, isAbsolute, resolve } from \"node:path\";\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\nexport { localConfigSourcePath, type ConfigResolutionOptions };\n"]}
1
+ {"version":3,"file":"config-source.js","sourceRoot":"","sources":["../src/config-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,KAAK,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzE,MAAM,gBAAgB,GAAG,CAAC,aAAa,EAAE,cAAc,EAAE,qBAAqB,CAAC,CAAC;AAChF,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,MAAM,IAAI,SAAS,KAAK,MAAM,CAAC,CAAC;AAEnH,MAAM,oBAAoB,GAAG,CAAC,SAAiB,EAAY,EAAE,CACzD,gBAAgB,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAClC,iBAAiB,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,QAAQ,GAAG,SAAS,EAAE,CAAC,CAAC,CACnF,CAAC;AAEN,MAAM,sBAAsB,GAAG,CAAC,IAAY,EAAY,EAAE;IACtD,MAAM,SAAS,GAAG,OAAO,CAAC,I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GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAEzC,OAAO,uBAAuB,CAAC,MAAM,CAAC;QAClC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,UAAU,IAAI,aAAa,CAAC;QAC3D,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AAC/B,CAAC,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,qBAAqB,EAAgC,CAAC","sourcesContent":["import { SUPPORTED_EXTENSIONS } from \"c12\";\nimport { basename, extname, isAbsolute, join, resolve } from \"node:path\";\n\ntype ConfigResolutionOptions = { configFile?: string | undefined; cwd?: string | undefined };\n\nconst CONFIG_LOCATIONS = [\"gtkx.config\", \".config/gtkx\", \".config/gtkx.config\"];\nconst CONFIG_EXTENSIONS = SUPPORTED_EXTENSIONS.filter((extension) => extension !== \".cjs\" && extension !== \".cts\");\n\nconst configCandidatePaths = (directory: string): string[] =>\n CONFIG_LOCATIONS.flatMap((location) =>\n CONFIG_EXTENSIONS.map((extension) => join(directory, `${location}${extension}`)),\n );\n\nconst configSourceCandidates = (path: string): string[] => {\n const extension = extname(path);\n const fallback = extension === \".js\" ? \".ts\" : extension === \".mjs\" ? \".mts\" : undefined;\n\n if (extension.length > 0) {\n return fallback === undefined ? [path] : [path, `${path.slice(0, -extension.length)}${fallback}`];\n }\n\n return [\n path,\n ...CONFIG_EXTENSIONS.flatMap((candidate) => [`${path}${candidate}`, join(path, `index${candidate}`)]),\n ];\n};\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\nexport { configCandidatePaths, configSourceCandidates, localConfigSourcePath, type ConfigResolutionOptions };\n"]}
package/dist/config.d.ts CHANGED
@@ -21,6 +21,8 @@ type ResolvedReactCompilerOptions = ReactCompilerOptions & {
21
21
  type Config = z.infer<typeof configSchema>;
22
22
  type ModuleExport = z.infer<typeof moduleExportSchema>;
23
23
  type ElementPropsExport = z.infer<typeof elementPropsSchema>;
24
+ /** Overrides for one GLib type in `elements.config`, keyed by its registered type name. */
25
+ type ElementConfigOptions = z.infer<typeof elementConfigSchema>;
24
26
  type McpSettings = {
25
27
  tools: string[];
26
28
  isReadOnly: boolean;
@@ -54,11 +56,30 @@ declare const elementPropsSchema: z.ZodObject<{
54
56
  module: z.ZodString;
55
57
  export: z.ZodString;
56
58
  composition: z.ZodOptional<z.ZodEnum<{
57
- intersection: "intersection";
58
59
  factory: "factory";
60
+ intersection: "intersection";
59
61
  }>>;
60
62
  constructOnly: z.ZodOptional<z.ZodArray<z.ZodString>>;
61
63
  }, z.core.$strict>;
64
+ /** Schema for one element override and the source of {@link ElementConfigOptions}. */
65
+ declare const elementConfigSchema: z.ZodObject<{
66
+ component: z.ZodOptional<z.ZodObject<{
67
+ module: z.ZodString;
68
+ export: z.ZodString;
69
+ }, z.core.$strict>>;
70
+ props: z.ZodOptional<z.ZodObject<{
71
+ module: z.ZodString;
72
+ export: z.ZodString;
73
+ composition: z.ZodOptional<z.ZodEnum<{
74
+ factory: "factory";
75
+ intersection: "intersection";
76
+ }>>;
77
+ constructOnly: z.ZodOptional<z.ZodArray<z.ZodString>>;
78
+ }, z.core.$strict>>;
79
+ isLazy: z.ZodOptional<z.ZodBoolean>;
80
+ acceptedChildTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
81
+ omittedProps: z.ZodOptional<z.ZodArray<z.ZodString>>;
82
+ }, z.core.$strict>;
62
83
  /** Schema every `gtkx.config.ts` is validated against, and the source of the {@link Config} type. */
63
84
  declare const configSchema: z.ZodObject<{
64
85
  libraries: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -66,15 +87,15 @@ declare const configSchema: z.ZodObject<{
66
87
  applicationId: z.ZodString;
67
88
  reactCompiler: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
68
89
  compilationMode: z.ZodOptional<z.ZodEnum<{
90
+ all: "all";
91
+ annotation: "annotation";
69
92
  infer: "infer";
70
93
  syntax: "syntax";
71
- annotation: "annotation";
72
- all: "all";
73
94
  }>>;
74
95
  panicThreshold: z.ZodOptional<z.ZodEnum<{
75
- none: "none";
76
- critical_errors: "critical_errors";
77
96
  all_errors: "all_errors";
97
+ critical_errors: "critical_errors";
98
+ none: "none";
78
99
  }>>;
79
100
  }, z.core.$strict>]>>;
80
101
  codegen: z.ZodOptional<z.ZodBoolean>;
@@ -90,8 +111,8 @@ declare const configSchema: z.ZodObject<{
90
111
  module: z.ZodString;
91
112
  export: z.ZodString;
92
113
  composition: z.ZodOptional<z.ZodEnum<{
93
- intersection: "intersection";
94
114
  factory: "factory";
115
+ intersection: "intersection";
95
116
  }>>;
96
117
  constructOnly: z.ZodOptional<z.ZodArray<z.ZodString>>;
97
118
  }, z.core.$strict>>;
@@ -156,10 +177,10 @@ declare const configSchema: z.ZodObject<{
156
177
  dark: z.ZodString;
157
178
  }, z.core.$strict>>;
158
179
  contentRating: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
159
- none: "none";
160
180
  intense: "intense";
161
181
  mild: "mild";
162
182
  moderate: "moderate";
183
+ none: "none";
163
184
  }>>>;
164
185
  releases: z.ZodOptional<z.ZodArray<z.ZodObject<{
165
186
  version: z.ZodString;
@@ -238,6 +259,9 @@ declare const configSchema: z.ZodObject<{
238
259
  postRemove: z.ZodOptional<z.ZodString>;
239
260
  }, z.core.$strict>>;
240
261
  node: z.ZodOptional<z.ZodType<import("./deploy.ts").DeployNodeOptions, unknown, z.core.$ZodTypeInternals<import("./deploy.ts").DeployNodeOptions, unknown>>>;
262
+ tools: z.ZodOptional<z.ZodObject<{
263
+ nfpm: z.ZodOptional<z.ZodString>;
264
+ }, z.core.$strict>>;
241
265
  signing: z.ZodOptional<z.ZodObject<{
242
266
  appimage: z.ZodOptional<z.ZodObject<{
243
267
  gpgKeyId: z.ZodString;
@@ -250,9 +274,9 @@ declare const configSchema: z.ZodObject<{
250
274
  "dpkg-sig": "dpkg-sig";
251
275
  }>>;
252
276
  type: z.ZodOptional<z.ZodEnum<{
253
- origin: "origin";
254
277
  archive: "archive";
255
278
  maint: "maint";
279
+ origin: "origin";
256
280
  }>>;
257
281
  signer: z.ZodOptional<z.ZodString>;
258
282
  }, z.core.$strict>>;
@@ -321,9 +345,9 @@ declare const configSchema: z.ZodObject<{
321
345
  group: z.ZodOptional<z.ZodString>;
322
346
  compression: z.ZodOptional<z.ZodEnum<{
323
347
  gzip: "gzip";
348
+ lzma: "lzma";
324
349
  xz: "xz";
325
350
  zstd: "zstd";
326
- lzma: "lzma";
327
351
  }>>;
328
352
  prefixes: z.ZodOptional<z.ZodArray<z.ZodString>>;
329
353
  }, z.core.$strict>>;
@@ -362,5 +386,5 @@ declare const isAgentRulesEnabled: (config: Config) => boolean;
362
386
  declare const isAgentReferenceEnabled: (config: Config) => boolean;
363
387
  declare const resolveMcpSettings: (config: Config) => McpSettings;
364
388
  declare const resolveConfig: (config: Config, root?: string) => ResolvedConfig;
365
- export { APPLICATION_ID_MAX_LENGTH, defineConfig, isAgentReferenceEnabled, isAgentRulesEnabled, isValidApplicationId, graduatedFutureKeys, validateConfig, mergeConfig, resolveLazyElements, resolveElementComponents, resolveElementProps, resolveAcceptedChildTypes, resolveMcpSettings, resolveOmittedProps, resolveConfig, type McpSettings, type ResolvedReactCompilerOptions, type Config, type ResolvedConfig, };
389
+ export { APPLICATION_ID_MAX_LENGTH, defineConfig, isAgentReferenceEnabled, isAgentRulesEnabled, isValidApplicationId, graduatedFutureKeys, validateConfig, mergeConfig, resolveLazyElements, resolveElementComponents, resolveElementProps, resolveAcceptedChildTypes, resolveMcpSettings, resolveOmittedProps, resolveConfig, type McpSettings, type ResolvedReactCompilerOptions, type Config, type ElementConfigOptions, type ElementPropsExport, type ModuleExport, type ResolvedConfig, };
366
390
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,KAAK,CAAC;AAG5D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,iGAAiG;AACjG,KAAK,oBAAoB,GAAG;IACxB,8CAA8C;IAC9C,eAAe,CAAC,EAAE,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;IACrD,iDAAiD;IACjD,cAAc,CAAC,EAAE,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;CACtD,CAAC;AAEF;;;GAGG;AACH,KAAK,4BAA4B,GAAG,oBAAoB,GAAG;IACvD,kDAAkD;IAClD,MAAM,EAAE,IAAI,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,KAAK,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAC3C,KAAK,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AACvD,KAAK,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAG7D,KAAK,WAAW,GAAG;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,2GAA2G;AAC3G,KAAK,cAAc,GAAG;IAClB,2DAA2D;IAC3D,aAAa,EAAE,MAAM,CAAC;IACtB,qFAAqF;IACrF,aAAa,EAAE,4BAA4B,GAAG,IAAI,CAAC;IACnD;;;OAGG;IAC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C,KAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAChC,CAAC;AAE7D,QAAA,MAAM,mBAAmB,aAAc,MAAM,CAAC,UAAU,CAAC,KAAG,MAAM,CAAC,MAAM,EAAE,kBAAkB,CACrC,CAAC;AAEzD,QAAA,MAAM,yBAAyB,aAAc,MAAM,CAAC,UAAU,CAAC,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CACpB,CAAC;AAEtE,QAAA,MAAM,mBAAmB,aAAc,MAAM,CAAC,UAAU,CAAC,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CACpB,CAAC;AAEhE,QAAA,MAAM,mBAAmB,WAAY,MAAM,KAAG,OAAyC,CAAC;AACxF,QAAA,MAAM,uBAAuB,WAAY,MAAM,KAAG,OAA6C,CAAC;AAEhG,QAAA,MAAM,kBAAkB,WAAY,MAAM,KAAG,WAG3C,CAAC;AAEH,QAAA,MAAM,aAAa,WAAY,MAAM,SAAS,MAAM,KAAG,cAMrD,CAAC;AAEH,OAAO,EACH,yBAAyB,EACzB,YAAY,EACZ,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,yBAAyB,EACzB,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EACb,KAAK,WAAW,EAChB,KAAK,4BAA4B,EACjC,KAAK,MAAM,EACX,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,cAAc,GACtB,CAAC"}
package/dist/config.js CHANGED
@@ -14,8 +14,7 @@ const COMPILATION_MODES = ["infer", "syntax", "annotation", "all"];
14
14
  /** Panic thresholds `babel-plugin-react-compiler` accepts. */
15
15
  const PANIC_THRESHOLDS = ["none", "critical_errors", "all_errors"];
16
16
  const REACT_COMPILER_TARGET = "19";
17
- const librarySchema = girLibrary('must be of the form "Name-Version", such as "Adw-1"')
18
- .refine((library) => !IMPLICIT_LIBRARIES.has(library), { error: "is bound implicitly; remove it" });
17
+ const librarySchema = girLibrary('must be of the form "Name-Version", such as "Adw-1"').refine((library) => !IMPLICIT_LIBRARIES.has(library), { error: "is bound implicitly; remove it" });
19
18
  const librariesSchema = z
20
19
  .array(librarySchema, { error: "must be a non-empty string array or omitted" })
21
20
  .min(1, { error: "must be a non-empty string array or omitted" });
@@ -27,7 +26,9 @@ const applicationIdSchema = z
27
26
  const reactCompilerSchema = z.union([
28
27
  z.boolean(),
29
28
  z.strictObject({
29
+ /** Which functions the React Compiler processes. */
30
30
  compilationMode: z.enum(COMPILATION_MODES).optional(),
31
+ /** Which React Compiler diagnostics fail the build. */
31
32
  panicThreshold: z.enum(PANIC_THRESHOLDS).optional(),
32
33
  }),
33
34
  ]);
@@ -35,18 +36,31 @@ const userEventSignalsSchema = z.record(z.string(), z.array(z.string({ error: "m
35
36
  error: "must be an array of signal names",
36
37
  }), { error: "must be a record of GLib type names to signal name arrays" });
37
38
  const moduleExportSchema = z.strictObject({
39
+ /** Module specifier containing the named export. */
38
40
  module: z.string({ error: "must be a module specifier" }).min(1, { error: "must be a module specifier" }),
41
+ /** Name of the export to import from the module. */
39
42
  export: z.string({ error: "must be an export name" }).min(1, { error: "must be an export name" }),
40
43
  }, { error: "must be a { module, export } object" });
41
44
  const elementPropsSchema = moduleExportSchema.extend({
45
+ /**
46
+ * How the exported props are combined: `intersection` is inherited; `factory` applies only to this type.
47
+ * Defaults to `intersection`.
48
+ */
42
49
  composition: z.enum(["factory", "intersection"]).optional(),
50
+ /** Props that can only be set when the element is created; changing them afterward throws. */
43
51
  constructOnly: z.array(z.string()).optional(),
44
52
  });
53
+ /** Schema for one element override and the source of {@link ElementConfigOptions}. */
45
54
  const elementConfigSchema = z.strictObject({
55
+ /** Component export that wraps the generated element. */
46
56
  component: moduleExportSchema.optional(),
57
+ /** Additional props type to combine with the generated element props. */
47
58
  props: elementPropsSchema.optional(),
59
+ /** Whether the parent container creates this element's GObject instead of the element constructing its own. */
48
60
  isLazy: z.boolean({ error: "must be a boolean" }).optional(),
61
+ /** Accepted child GLib type names to show in the generated element documentation. */
49
62
  acceptedChildTypes: z.array(z.string()).optional(),
63
+ /** GObject properties to leave out of generated props, such as properties managed by an element behavior. */
50
64
  omittedProps: z
51
65
  .array(z.string({ error: "must be a non-empty property name" }).min(1, {
52
66
  error: "must be a non-empty property name",
@@ -54,22 +68,40 @@ const elementConfigSchema = z.strictObject({
54
68
  .optional(),
55
69
  });
56
70
  const elementsSchema = z.strictObject({
71
+ /** Path, relative to the project root, of the module exporting the element behavior map. */
57
72
  behaviors: z
58
73
  .string({ error: "must be a path to a module exporting element behaviors" })
59
74
  .min(1, { error: "must be a path to a module exporting element behaviors" })
60
75
  .optional(),
76
+ /**
77
+ * Element configuration overrides keyed by GLib type name, such as `GtkWidget`.
78
+ * @see {@link ElementConfigOptions} for the fields accepted by each entry.
79
+ */
61
80
  config: z.record(z.string(), elementConfigSchema).optional(),
62
81
  });
63
82
  const agentsSchema = z.strictObject({
83
+ /**
84
+ * Whether codegen maintains the GTKX rules in `AGENTS.md` and creates a missing `CLAUDE.md` import.
85
+ * Defaults to `true`.
86
+ */
64
87
  rules: z.boolean({ error: "must be a boolean" }).optional(),
88
+ /** Whether codegen writes the generated element reference to `.gtkx/reference`. Defaults to `true`. */
65
89
  reference: z.boolean({ error: "must be a boolean" }).optional(),
66
90
  });
67
91
  const mcpSchema = z.strictObject({
92
+ /**
93
+ * Tool name patterns applied in order: `*` matches any text and a leading `!` excludes matches.
94
+ * Omitted, empty, or exclusion-only lists start with all tools; other lists start with none.
95
+ */
68
96
  tools: z
69
97
  .array(z.string({ error: "must be a tool name pattern" }).min(1, { error: "must be a tool name pattern" }), {
70
98
  error: "must be an array of tool name patterns",
71
99
  })
72
100
  .optional(),
101
+ /**
102
+ * Whether the MCP server exposes only inspection and reference tools, excluding app interactions.
103
+ * Defaults to `false`.
104
+ */
73
105
  readOnly: z.boolean({ error: "must be a boolean" }).optional(),
74
106
  });
75
107
  const graduatedFutureSchema = z
@@ -84,6 +116,7 @@ const graduatedFutureSchema = z
84
116
  })
85
117
  .strict();
86
118
  const deprecationsSchema = z.strictObject({
119
+ /** Deprecation identifiers whose warnings are suppressed. There are currently no accepted identifiers. */
87
120
  silence: z
88
121
  .array(z.never({ error: "does not name a current deprecation" }), {
89
122
  error: "must be an array of current deprecation ids",
@@ -92,17 +125,38 @@ const deprecationsSchema = z.strictObject({
92
125
  });
93
126
  /** Schema every `gtkx.config.ts` is validated against, and the source of the {@link Config} type. */
94
127
  const configSchema = z.strictObject({
128
+ /**
129
+ * Additional GIR libraries to bind, such as `WebKit-6.0`.
130
+ * Adwaita and GTK are included implicitly and must not be listed.
131
+ */
95
132
  libraries: librariesSchema.optional(),
133
+ /** Additional GIR search directories. Relative paths are resolved from the project root. */
96
134
  girPath: z.array(z.string(), { error: "must be an array of strings if provided" }).optional(),
135
+ /** Required GApplication identifier, such as `com.example.Tasks`. */
97
136
  applicationId: applicationIdSchema,
137
+ /** Whether to enable the React Compiler, or options passed to it. Enabled by default. */
98
138
  reactCompiler: reactCompilerSchema.optional(),
139
+ /**
140
+ * Whether GTKX generates project bindings. Set to `false` to reuse an installed binding store.
141
+ * Defaults to `true`.
142
+ */
99
143
  codegen: z.boolean({ error: "must be a boolean" }).optional(),
144
+ /**
145
+ * Additional signals to suppress during React property updates, keyed by GLib type name.
146
+ * Entries extend the built-in signal lists.
147
+ */
100
148
  userEventSignals: userEventSignalsSchema.optional(),
149
+ /** Custom element behaviors and overrides for generated components, props, and documentation. */
101
150
  elements: elementsSchema.optional(),
151
+ /** Path to an icon theme directory or a single application icon file, relative to the project root. */
102
152
  applicationIcon: text("must be a path to an icon theme directory or a single icon file").optional(),
153
+ /** Application metadata, bundled runtime settings, and packaging options used by `gtkx deploy`. */
103
154
  deploy: deploySchema.optional(),
155
+ /** Controls the project instructions and reference files generated for coding agents. */
104
156
  agents: agentsSchema.optional(),
157
+ /** Default tool selection and access mode for the project's MCP server. Command-line flags take precedence. */
105
158
  mcp: mcpSchema.optional(),
159
+ /** Controls warnings for deprecated configuration and behavior. */
106
160
  deprecations: deprecationsSchema.optional(),
107
161
  });
108
162
  /**
@@ -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;AAiDlE,MAAM,sBAAsB,GAAG,uDAAuD,CAAC;AACvF,MAAM,yBAAyB,GAAG,GAAG,CAAC;AACtC,MAAM,kBAAkB,GAAgB,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC;AACtE,+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,qDAAqD,CAAC;KAClF,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,gCAAgC,EAAE,CAAC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G,CAAC,MAAc,EAAe,EAAE,CAAC,CAAC;IACzD,KAAK,EAAE,MAAM,CAAC,GAAG,EAAE,KAAK,IAAI,EAAE;IAC9B,UAAU,EAAE,MAAM,CAAC,GAAG,EAAE,QAAQ,KAAK,IAAI;CAC5C,CAAC,CAAC;AAEH,MAAM,aAAa,GAAG,CAAC,MAAc,EAAE,IAAa,EAAkB,EAAE,CAAC,CAAC;IACtE,aAAa,EAAE,MAAM,CAAC,aAAa;IACnC,aAAa,EAAE,2BAA2B,CAAC,MAAM,CAAC,aAAa,CAAC;IAChE,gBAAgB,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,yBAAyB,EACzB,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 * GTKX project configuration authored in `gtkx.config.ts` and validated when loaded.\n */\ntype Config = z.infer<typeof configSchema>;\ntype ModuleExport = z.infer<typeof moduleExportSchema>;\ntype ElementPropsExport = z.infer<typeof elementPropsSchema>;\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 IMPLICIT_LIBRARIES: Set<string> = new Set([\"Adw-1\", \"Gtk-4.0\"]);\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 \"Adw-1\"')\n .refine((library) => !IMPLICIT_LIBRARIES.has(library), { error: \"is bound implicitly; 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.strictObject({\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.strictObject(\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 elementPropsSchema = moduleExportSchema.extend({\n composition: z.enum([\"factory\", \"intersection\"]).optional(),\n constructOnly: z.array(z.string()).optional(),\n});\n\nconst elementConfigSchema = z.strictObject({\n component: moduleExportSchema.optional(),\n props: elementPropsSchema.optional(),\n isLazy: z.boolean({ error: \"must be a boolean\" }).optional(),\n acceptedChildTypes: z.array(z.string()).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.strictObject({\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.strictObject({\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.strictObject({\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.strictObject({\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.strictObject({\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, ElementPropsExport> =>\n elementEntryValues(elements, (entry) => entry.props);\n\nconst resolveAcceptedChildTypes = (elements: Config[\"elements\"]): Record<string, string[]> =>\n elementEntryValues(elements, (entry) => entry.acceptedChildTypes);\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 resolveAcceptedChildTypes,\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,aA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,CAAC,GAAG,EAAE,KAAK,IAAI,EAAE;IAC9B,UAAU,EAAE,MAAM,CAAC,GAAG,EAAE,QAAQ,KAAK,IAAI;CAC5C,CAAC,CAAC;AAEH,MAAM,aAAa,GAAG,CAAC,MAAc,EAAE,IAAa,EAAkB,EAAE,CAAC,CAAC;IACtE,aAAa,EAAE,MAAM,CAAC,aAAa;IACnC,aAAa,EAAE,2BAA2B,CAAC,MAAM,CAAC,aAAa,CAAC;IAChE,gBAAgB,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,yBAAyB,EACzB,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,GAQhB,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 * GTKX project configuration authored in `gtkx.config.ts` and validated when loaded.\n */\ntype Config = z.infer<typeof configSchema>;\ntype ModuleExport = z.infer<typeof moduleExportSchema>;\ntype ElementPropsExport = z.infer<typeof elementPropsSchema>;\n/** Overrides for one GLib type in `elements.config`, keyed by its registered type name. */\ntype ElementConfigOptions = 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 IMPLICIT_LIBRARIES: Set<string> = new Set([\"Adw-1\", \"Gtk-4.0\"]);\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 \"Adw-1\"').refine(\n (library) => !IMPLICIT_LIBRARIES.has(library),\n { error: \"is bound implicitly; remove it\" },\n);\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.strictObject({\n /** Which functions the React Compiler processes. */\n compilationMode: z.enum(COMPILATION_MODES).optional(),\n /** Which React Compiler diagnostics fail the build. */\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.strictObject(\n {\n /** Module specifier containing the named export. */\n module: z.string({ error: \"must be a module specifier\" }).min(1, { error: \"must be a module specifier\" }),\n /** Name of the export to import from the module. */\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 elementPropsSchema = moduleExportSchema.extend({\n /**\n * How the exported props are combined: `intersection` is inherited; `factory` applies only to this type.\n * Defaults to `intersection`.\n */\n composition: z.enum([\"factory\", \"intersection\"]).optional(),\n /** Props that can only be set when the element is created; changing them afterward throws. */\n constructOnly: z.array(z.string()).optional(),\n});\n\n/** Schema for one element override and the source of {@link ElementConfigOptions}. */\nconst elementConfigSchema = z.strictObject({\n /** Component export that wraps the generated element. */\n component: moduleExportSchema.optional(),\n /** Additional props type to combine with the generated element props. */\n props: elementPropsSchema.optional(),\n /** Whether the parent container creates this element's GObject instead of the element constructing its own. */\n isLazy: z.boolean({ error: \"must be a boolean\" }).optional(),\n /** Accepted child GLib type names to show in the generated element documentation. */\n acceptedChildTypes: z.array(z.string()).optional(),\n /** GObject properties to leave out of generated props, such as properties managed by an element behavior. */\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.strictObject({\n /** Path, relative to the project root, of the module exporting the element behavior map. */\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 /**\n * Element configuration overrides keyed by GLib type name, such as `GtkWidget`.\n * @see {@link ElementConfigOptions} for the fields accepted by each entry.\n */\n config: z.record(z.string(), elementConfigSchema).optional(),\n});\n\nconst agentsSchema = z.strictObject({\n /**\n * Whether codegen maintains the GTKX rules in `AGENTS.md` and creates a missing `CLAUDE.md` import.\n * Defaults to `true`.\n */\n rules: z.boolean({ error: \"must be a boolean\" }).optional(),\n /** Whether codegen writes the generated element reference to `.gtkx/reference`. Defaults to `true`. */\n reference: z.boolean({ error: \"must be a boolean\" }).optional(),\n});\n\nconst mcpSchema = z.strictObject({\n /**\n * Tool name patterns applied in order: `*` matches any text and a leading `!` excludes matches.\n * Omitted, empty, or exclusion-only lists start with all tools; other lists start with none.\n */\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 /**\n * Whether the MCP server exposes only inspection and reference tools, excluding app interactions.\n * Defaults to `false`.\n */\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.strictObject({\n /** Deprecation identifiers whose warnings are suppressed. There are currently no accepted identifiers. */\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.strictObject({\n /**\n * Additional GIR libraries to bind, such as `WebKit-6.0`.\n * Adwaita and GTK are included implicitly and must not be listed.\n */\n libraries: librariesSchema.optional(),\n /** Additional GIR search directories. Relative paths are resolved from the project root. */\n girPath: z.array(z.string(), { error: \"must be an array of strings if provided\" }).optional(),\n /** Required GApplication identifier, such as `com.example.Tasks`. */\n applicationId: applicationIdSchema,\n /** Whether to enable the React Compiler, or options passed to it. Enabled by default. */\n reactCompiler: reactCompilerSchema.optional(),\n /**\n * Whether GTKX generates project bindings. Set to `false` to reuse an installed binding store.\n * Defaults to `true`.\n */\n codegen: z.boolean({ error: \"must be a boolean\" }).optional(),\n /**\n * Additional signals to suppress during React property updates, keyed by GLib type name.\n * Entries extend the built-in signal lists.\n */\n userEventSignals: userEventSignalsSchema.optional(),\n /** Custom element behaviors and overrides for generated components, props, and documentation. */\n elements: elementsSchema.optional(),\n /** Path to an icon theme directory or a single application icon file, relative to the project root. */\n applicationIcon: text(\"must be a path to an icon theme directory or a single icon file\").optional(),\n /** Application metadata, bundled runtime settings, and packaging options used by `gtkx deploy`. */\n deploy: deploySchema.optional(),\n /** Controls the project instructions and reference files generated for coding agents. */\n agents: agentsSchema.optional(),\n /** Default tool selection and access mode for the project's MCP server. Command-line flags take precedence. */\n mcp: mcpSchema.optional(),\n /** Controls warnings for deprecated configuration and behavior. */\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: ElementConfigOptions) => 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, ElementPropsExport> =>\n elementEntryValues(elements, (entry) => entry.props);\n\nconst resolveAcceptedChildTypes = (elements: Config[\"elements\"]): Record<string, string[]> =>\n elementEntryValues(elements, (entry) => entry.acceptedChildTypes);\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 resolveAcceptedChildTypes,\n resolveMcpSettings,\n resolveOmittedProps,\n resolveConfig,\n type McpSettings,\n type ResolvedReactCompilerOptions,\n type Config,\n type ElementConfigOptions,\n type ElementPropsExport,\n type ModuleExport,\n type ResolvedConfig,\n};\n"]}
package/dist/deploy.d.ts CHANGED
@@ -1,9 +1,56 @@
1
1
  import { z } from "zod";
2
+ /** One software-center screenshot in `deploy.screenshots`. Either `url` or `file` must be set. */
3
+ type DeployScreenshotOptions = z.infer<typeof screenshotSchema>;
4
+ /** Screenshot entry schema and the source of {@link DeployScreenshotOptions}. */
5
+ declare const screenshotSchema: z.ZodObject<{
6
+ url: z.ZodOptional<z.ZodURL>;
7
+ file: z.ZodOptional<z.ZodString>;
8
+ caption: z.ZodOptional<z.ZodString>;
9
+ isDefault: z.ZodOptional<z.ZodBoolean>;
10
+ }, z.core.$strict>;
11
+ /** One AppStream release-history entry in `deploy.releases`. */
12
+ type DeployReleaseOptions = z.infer<typeof releaseSchema>;
13
+ /** Release-history entry schema and the source of {@link DeployReleaseOptions}. */
14
+ declare const releaseSchema: z.ZodObject<{
15
+ version: z.ZodString;
16
+ date: z.ZodISODate;
17
+ type: z.ZodOptional<z.ZodEnum<{
18
+ development: "development";
19
+ snapshot: "snapshot";
20
+ stable: "stable";
21
+ }>>;
22
+ urgency: z.ZodOptional<z.ZodEnum<{
23
+ critical: "critical";
24
+ high: "high";
25
+ low: "low";
26
+ medium: "medium";
27
+ }>>;
28
+ notes: z.ZodOptional<z.ZodArray<z.ZodString>>;
29
+ url: z.ZodOptional<z.ZodURL>;
30
+ }, z.core.$strict>;
31
+ /** One file extension and MIME type registered through `deploy.fileAssociations`. */
32
+ type DeployFileAssociationOptions = z.infer<typeof fileAssociationSchema>;
33
+ /** File association schema and the source of {@link DeployFileAssociationOptions}. */
34
+ declare const fileAssociationSchema: z.ZodObject<{
35
+ extension: z.ZodString;
36
+ mimeType: z.ZodString;
37
+ description: z.ZodOptional<z.ZodString>;
38
+ }, z.core.$strict>;
39
+ /** One desktop launcher action in `deploy.desktopActions`, keyed by its action ID. */
40
+ type DeployDesktopActionOptions = z.infer<typeof desktopActionSchema>;
41
+ /** Desktop launcher action schema and the source of {@link DeployDesktopActionOptions}. */
42
+ declare const desktopActionSchema: z.ZodObject<{
43
+ name: z.ZodString;
44
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
45
+ icon: z.ZodOptional<z.ZodString>;
46
+ }, z.core.$strict>;
2
47
  /**
3
48
  * A `deploy.extraFiles` entry in object form: the source file, resolved against the project root, that is
4
49
  * installed at the entry's prefix-relative destination, and the octal mode it is installed with.
5
50
  */
6
- type DeployExtraFileOptions = Record<"source", string> & {
51
+ type DeployExtraFileOptions = {
52
+ /** Source file path, resolved relative to the project root. */
53
+ source: string;
7
54
  /** Octal file mode. Setuid and setgid bits are rejected. */
8
55
  mode?: string | undefined;
9
56
  };
@@ -11,9 +58,17 @@ type DeployExtraFileOptions = Record<"source", string> & {
11
58
  * The `deploy.node` options: where the Node.js runtime bundled with the application comes from, the version it
12
59
  * is expected to be, whether its binary is stripped, and whether the launcher enables the compile cache.
13
60
  */
14
- type DeployNodeOptions = Partial<Record<"source", "download" | "host" | "path" | undefined> & Record<"path", string | undefined> & Record<"shouldStrip" | "shouldUseCompileCache", boolean | undefined>> & {
61
+ type DeployNodeOptions = {
62
+ /** Runtime source: an official download, the running Node.js executable, or `path`. Defaults to `download`. */
63
+ source?: "download" | "host" | "path" | undefined;
15
64
  /** Expected Node.js version. Downloaded runtimes default to exactly 26.8.2 when omitted. */
16
65
  version?: string | undefined;
66
+ /** Node.js executable path relative to the project root, required when `source` is `path`. */
67
+ path?: string | undefined;
68
+ /** Strip the runtime when its architecture matches the host and `strip` is available. Defaults to `true`. */
69
+ shouldStrip?: boolean | undefined;
70
+ /** Enable Node.js compile caching in the generated launcher. Defaults to `true`. */
71
+ shouldUseCompileCache?: boolean | undefined;
17
72
  };
18
73
  declare const deploySchema: z.ZodObject<{
19
74
  targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
@@ -70,10 +125,10 @@ declare const deploySchema: z.ZodObject<{
70
125
  dark: z.ZodString;
71
126
  }, z.core.$strict>>;
72
127
  contentRating: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
73
- none: "none";
74
128
  intense: "intense";
75
129
  mild: "mild";
76
130
  moderate: "moderate";
131
+ none: "none";
77
132
  }>>>;
78
133
  releases: z.ZodOptional<z.ZodArray<z.ZodObject<{
79
134
  version: z.ZodString;
@@ -152,6 +207,9 @@ declare const deploySchema: z.ZodObject<{
152
207
  postRemove: z.ZodOptional<z.ZodString>;
153
208
  }, z.core.$strict>>;
154
209
  node: z.ZodOptional<z.ZodType<DeployNodeOptions, unknown, z.core.$ZodTypeInternals<DeployNodeOptions, unknown>>>;
210
+ tools: z.ZodOptional<z.ZodObject<{
211
+ nfpm: z.ZodOptional<z.ZodString>;
212
+ }, z.core.$strict>>;
155
213
  signing: z.ZodOptional<z.ZodObject<{
156
214
  appimage: z.ZodOptional<z.ZodObject<{
157
215
  gpgKeyId: z.ZodString;
@@ -164,9 +222,9 @@ declare const deploySchema: z.ZodObject<{
164
222
  "dpkg-sig": "dpkg-sig";
165
223
  }>>;
166
224
  type: z.ZodOptional<z.ZodEnum<{
167
- origin: "origin";
168
225
  archive: "archive";
169
226
  maint: "maint";
227
+ origin: "origin";
170
228
  }>>;
171
229
  signer: z.ZodOptional<z.ZodString>;
172
230
  }, z.core.$strict>>;
@@ -235,12 +293,12 @@ declare const deploySchema: z.ZodObject<{
235
293
  group: z.ZodOptional<z.ZodString>;
236
294
  compression: z.ZodOptional<z.ZodEnum<{
237
295
  gzip: "gzip";
296
+ lzma: "lzma";
238
297
  xz: "xz";
239
298
  zstd: "zstd";
240
- lzma: "lzma";
241
299
  }>>;
242
300
  prefixes: z.ZodOptional<z.ZodArray<z.ZodString>>;
243
301
  }, z.core.$strict>>;
244
302
  }, z.core.$strict>;
245
- export { deploySchema, type DeployExtraFileOptions, type DeployNodeOptions };
303
+ export { deploySchema, type DeployDesktopActionOptions, type DeployExtraFileOptions, type DeployFileAssociationOptions, type DeployNodeOptions, type DeployReleaseOptions, type DeployScreenshotOptions, };
246
304
  //# 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;AAsHxB;;;GAGG;AACH,KAAK,sBAAsB,GAAG,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,GAAG;IACrD,4DAA4D;IAC5D,IAAI,CAAC,E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