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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +11 -169
  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 +57 -24
  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 +8 -0
  13. package/dist/config-reloader.d.ts.map +1 -0
  14. package/dist/config-reloader.js +32 -0
  15. package/dist/config-reloader.js.map +1 -0
  16. package/dist/config-source.d.ts +9 -0
  17. package/dist/config-source.d.ts.map +1 -0
  18. package/dist/config-source.js +32 -0
  19. package/dist/config-source.js.map +1 -0
  20. package/dist/config.d.ts +63 -29
  21. package/dist/config.d.ts.map +1 -1
  22. package/dist/config.js +72 -12
  23. package/dist/config.js.map +1 -1
  24. package/dist/deploy.d.ts +67 -13
  25. package/dist/deploy.d.ts.map +1 -1
  26. package/dist/deploy.js +169 -12
  27. package/dist/deploy.js.map +1 -1
  28. package/dist/index.d.ts +2 -2
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js.map +1 -1
  31. package/dist/internal.d.ts +5 -3
  32. package/dist/internal.d.ts.map +1 -1
  33. package/dist/internal.js +5 -3
  34. package/dist/internal.js.map +1 -1
  35. package/dist/loader.d.ts +3 -1
  36. package/dist/loader.d.ts.map +1 -1
  37. package/dist/loader.js +18 -35
  38. package/dist/loader.js.map +1 -1
  39. package/dist/node-version.d.ts +2 -1
  40. package/dist/node-version.d.ts.map +1 -1
  41. package/dist/node-version.js +2 -1
  42. package/dist/node-version.js.map +1 -1
  43. package/dist/resource-base-path.d.ts.map +1 -1
  44. package/dist/schema-text.d.ts.map +1 -1
  45. package/dist/user-event-signals.d.ts.map +1 -1
  46. package/dist/virtual.d.ts +1 -1
  47. package/dist/virtual.d.ts.map +1 -1
  48. package/dist/virtual.js +3 -4
  49. package/dist/virtual.js.map +1 -1
  50. package/dist/vite-plugin.d.ts +2 -0
  51. package/dist/vite-plugin.d.ts.map +1 -1
  52. package/dist/vite-plugin.js +4 -3
  53. package/dist/vite-plugin.js.map +1 -1
  54. package/dist/vite-root.d.ts.map +1 -1
  55. package/package.json +15 -16
  56. package/src/builtin-elements.ts +338 -0
  57. package/src/config-dependencies.ts +65 -29
  58. package/src/config-error.ts +5 -3
  59. package/src/config-reloader.ts +45 -0
  60. package/src/config-source.ts +48 -0
  61. package/src/config.ts +87 -18
  62. package/src/deploy.ts +207 -29
  63. package/src/index.ts +9 -2
  64. package/src/internal.ts +5 -2
  65. package/src/loader.ts +27 -52
  66. package/src/node-version.ts +2 -1
  67. package/src/virtual.ts +5 -6
  68. package/src/vite-plugin.ts +9 -4
@@ -1,11 +1,21 @@
1
+ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
2
+ if (typeof path === "string" && /^\.\.?\//.test(path)) {
3
+ return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
4
+ return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
5
+ });
6
+ }
7
+ return path;
8
+ };
1
9
  import { createJiti } from "jiti";
2
10
  import { AsyncLocalStorage } from "node:async_hooks";
3
- import { createRequire, registerHooks } from "node:module";
11
+ import { registerHooks } from "node:module";
4
12
  import { extname, sep } from "node:path";
5
- import { fileURLToPath } from "node:url";
13
+ import { fileURLToPath, pathToFileURL } from "node:url";
14
+ import { isRecord } from "./config-error.js";
15
+ import { configSourceCandidates } from "./config-source.js";
6
16
  const captureStorage = new AsyncLocalStorage();
7
17
  const dependenciesByValue = new WeakMap();
8
- const CACHE_BUSTED_EXTENSIONS = new Set([".cjs", ".js", ".json", ".mjs"]);
18
+ const CACHE_BUSTED_EXTENSIONS = new Set([".js", ".json", ".mjs", ".mts", ".ts"]);
9
19
  const isTrackedPath = (path) => !path.includes(`${sep}node_modules${sep}`);
10
20
  const addPath = (path) => {
11
21
  if (isTrackedPath(path)) {
@@ -17,8 +27,19 @@ const addUrl = (url) => {
17
27
  addPath(fileURLToPath(url));
18
28
  }
19
29
  };
30
+ const addConfigSource = (path) => {
31
+ for (const candidate of configSourceCandidates(path)) {
32
+ addPath(candidate);
33
+ }
34
+ };
35
+ const addFailedSource = (error) => {
36
+ if (isRecord(error) && typeof error.url === "string" && error.url.startsWith("file:")) {
37
+ addConfigSource(fileURLToPath(error.url));
38
+ }
39
+ };
20
40
  const cacheBustedUrl = (url) => {
21
- if (!url.startsWith("file:")) {
41
+ const state = captureStorage.getStore();
42
+ if (state === undefined || !url.startsWith("file:")) {
22
43
  return url;
23
44
  }
24
45
  const path = fileURLToPath(url);
@@ -26,43 +47,51 @@ const cacheBustedUrl = (url) => {
26
47
  return url;
27
48
  }
28
49
  const parsed = new URL(url);
29
- parsed.searchParams.set("gtkx-config-load", captureStorage.getStore()?.cacheKey ?? "uncaptured");
50
+ parsed.searchParams.set("gtkx-config-load", state.cacheKey);
30
51
  return parsed.href;
31
52
  };
32
53
  const registerResolutionHook = () => registerHooks({
33
54
  resolve(specifier, context, nextResolve) {
34
- const result = nextResolve(specifier, context);
55
+ let result;
56
+ try {
57
+ result = nextResolve(specifier, context);
58
+ }
59
+ catch (error) {
60
+ const state = captureStorage.getStore();
61
+ const fallback = captureStorage.exit(() => state?.resolver.esmResolve(specifier, {
62
+ ...(context.parentURL !== undefined && { parentURL: context.parentURL }),
63
+ try: true,
64
+ }));
65
+ if (fallback === undefined) {
66
+ addFailedSource(error);
67
+ throw error;
68
+ }
69
+ result = nextResolve(fallback, context);
70
+ }
35
71
  addUrl(result.url);
36
72
  return { ...result, url: cacheBustedUrl(result.url) };
37
73
  },
38
74
  });
39
- const clearNativeModuleCache = (dependencies) => {
40
- const cache = createRequire(import.meta.url).cache;
41
- for (const path of dependencies) {
42
- Reflect.deleteProperty(cache, path);
75
+ const importConfigModule = async (path, options) => {
76
+ if ([".cjs", ".cts"].includes(extname(path))) {
77
+ throw new Error(`Configuration modules must use ESM: ${path}`);
43
78
  }
79
+ const value = (await import(__rewriteRelativeImportExtension(pathToFileURL(path).href), {
80
+ ...(extname(path) === ".json" && { with: { type: "json" } }),
81
+ }));
82
+ return (options?.default ? (value.default ?? { ...value }) : value);
44
83
  };
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
- };
84
+ const createConfigImporter = () => Object.assign(createJiti(import.meta.url, { fsCache: false, moduleCache: false }), { import: importConfigModule });
55
85
  const setConfigDependencies = (value, dependencies) => {
56
86
  const paths = [...new Set(dependencies)];
57
87
  dependenciesByValue.set(value, paths);
58
- clearNativeModuleCache(paths);
59
88
  };
60
- const configDependenciesFor = (value) => typeof value === "object" && value !== null ? dependenciesByValue.get(value) ?? [] : [];
89
+ const configDependenciesFor = (value) => typeof value === "object" && value !== null ? (dependenciesByValue.get(value) ?? []) : [];
61
90
  const captureConfigDependencies = async (operation) => {
62
91
  const state = {
63
92
  cacheKey: process.hrtime.bigint().toString(),
64
93
  dependencies: new Set(),
65
- transformer: createJiti(import.meta.url, { fsCache: false, moduleCache: false }),
94
+ resolver: createJiti(import.meta.url, { fsCache: false, moduleCache: false }),
66
95
  };
67
96
  const hook = registerResolutionHook();
68
97
  try {
@@ -79,5 +108,9 @@ const captureConfigDependencies = async (operation) => {
79
108
  hook.deregister();
80
109
  }
81
110
  };
82
- export { captureConfigDependencies, configDependenciesFor, setConfigDependencies, transformConfigModule, };
111
+ const loadConfigModule = async (path) => {
112
+ const captured = await captureConfigDependencies(() => importConfigModule(path, { default: true }));
113
+ return captured.value;
114
+ };
115
+ export { addConfigSource, captureConfigDependencies, configDependenciesFor, createConfigImporter, loadConfigModule, setConfigDependencies, };
83
116
  //# sourceMappingURL=config-dependencies.js.map
@@ -1 +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,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,GAAG,eAAe,GAAG,EAAE,CAAC,CAAC;AAE5F,MAAM,OAAO,GAAG,CAAC,IAAY,EAAQ,EAAE;IACnC,IAAI,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,cAAc,CAAC,QAAQ,EAAE,EAAE,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,CAAC,GAAW,EAAQ,EAAE;IACjC,IAAI,GAAG,CAAC,UAAU,CAAC,OA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AC,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
+ {"version":3,"file":"config-dependencies.js","sourceRoot":"","sources":["../src/config-dependencies.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,MAAM,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAK5D,MAAM,cAAc,GAAoC,IAAI,iBAAiB,EAAE,CAAC;AAChF,MAAM,mBAAmB,GAA8B,IAAI,OAAO,EAAE,CAAC;AACrE,MAAM,uBAAuB,GAAwB,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;AAEtG,MAAM,aAAa,GAAG,CAAC,IAAY,EAAW,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,GAAG,eAAe,GAAG,EAAE,CAAC,CAAC;AAE5F,MAAM,OAAO,GAAG,CAAC,IAAY,EAAQ,EAAE;IACnC,IAAI,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,cAAc,CAAC,QAAQ,EAAE,EAAE,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,CAAC,GAAW,EAAQ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;QAC5C,YAAY,EAAE,IAAI,GAAG,EAAE;QACvB,QAAQ,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;KAChF,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,MAAM,gBAAgB,GAAG,KAAK,EAAE,IAAY,EAAoB,EAAE;IAC9D,MAAM,QAAQ,GAAG,MAAM,yBAAyB,CAAC,GAAG,EAAE,CAAC,kBAAkB,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAEpG,OAAO,QAAQ,CAAC,KAAK,CAAC;AAC1B,CAAC,CAAC;AAEF,OAAO,EACH,eAAe,EACf,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,GACxB,CAAC","sourcesContent":["import { createJiti, type Jiti } from \"jiti\";\nimport { AsyncLocalStorage } from \"node:async_hooks\";\nimport { registerHooks } from \"node:module\";\nimport { extname, sep } from \"node:path\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\nimport { isRecord } from \"./config-error.ts\";\nimport { configSourceCandidates } from \"./config-source.ts\";\n\ntype CaptureState = { cacheKey: string; dependencies: Set<string>; resolver: 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([\".js\", \".json\", \".mjs\", \".mts\", \".ts\"]);\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 addConfigSource = (path: string): void => {\n for (const candidate of configSourceCandidates(path)) {\n addPath(candidate);\n }\n};\n\nconst addFailedSource = (error: unknown): void => {\n if (isRecord(error) && typeof error.url === \"string\" && error.url.startsWith(\"file:\")) {\n addConfigSource(fileURLToPath(error.url));\n }\n};\n\nconst cacheBustedUrl = (url: string): string => {\n const state = captureStorage.getStore();\n\n if (state === undefined || !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\", state.cacheKey);\n\n return parsed.href;\n};\n\nconst registerResolutionHook = (): ReturnType<typeof registerHooks> =>\n registerHooks({\n resolve(specifier, context, nextResolve) {\n let result;\n\n try {\n result = nextResolve(specifier, context);\n } catch (error) {\n const state = captureStorage.getStore();\n const fallback = captureStorage.exit(() =>\n state?.resolver.esmResolve(specifier, {\n ...(context.parentURL !== undefined && { parentURL: context.parentURL }),\n try: true,\n }),\n );\n\n if (fallback === undefined) {\n addFailedSource(error);\n throw error;\n }\n\n result = nextResolve(fallback, context);\n }\n\n addUrl(result.url);\n\n return { ...result, url: cacheBustedUrl(result.url) };\n },\n });\n\nconst importConfigModule: Jiti[\"import\"] = async <T>(path: string, options?: { default?: true }): Promise<T> => {\n if ([\".cjs\", \".cts\"].includes(extname(path))) {\n throw new Error(`Configuration modules must use ESM: ${path}`);\n }\n\n const value = (await import(pathToFileURL(path).href, {\n ...(extname(path) === \".json\" && { with: { type: \"json\" } }),\n })) as Record<string, unknown>;\n\n return (options?.default ? (value.default ?? { ...value }) : value) as T;\n};\n\nconst createConfigImporter = (): Jiti =>\n Object.assign(createJiti(import.meta.url, { fsCache: false, moduleCache: false }), { import: importConfigModule });\n\nconst setConfigDependencies = (value: object, dependencies: Iterable<string>): void => {\n const paths = [...new Set(dependencies)];\n dependenciesByValue.set(value, 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 resolver: 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\nconst loadConfigModule = async (path: string): Promise<unknown> => {\n const captured = await captureConfigDependencies(() => importConfigModule(path, { default: true }));\n\n return captured.value;\n};\n\nexport {\n addConfigSource,\n captureConfigDependencies,\n configDependenciesFor,\n createConfigImporter,\n loadConfigModule,\n setConfigDependencies,\n};\n"]}
@@ -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;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
+ {"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,UAAW,OAAO,KAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CACM,CAAC;AAIzE,QAAA,MAAM,sBAAsB,QAAS,MAAM,eAAe,MAAM,KAAG,KAK9D,CAAC;AAEN,QAAA,MAAM,WAAW,UAAW,CAAC,CAAC,QAAQ,0BAAqC,KACJ,CAAC;AAExE,OAAO,EAAE,QAAQ,EAAE,sBAAsB,EAAE,WAAW,EAAE,CAAC"}
@@ -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,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"]}
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,CACL,UAAU,KAAK,SAAS;IACpB,CAAC,CAAC,GAAG,YAAY,CAAC,mBAAmB,CAAC,mCAAmC,GAAG,EAAE;IAC9E,CAAC,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,mCAAmC,GAAG,EAAE,CAC5E,CAAC;AAEN,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(\n configFile === undefined\n ? `${configPrefix(DEFAULT_CONFIG_FILE)} no configuration file found in ${cwd}`\n : `${configPrefix(configFile)} no configuration file found in ${cwd}`,\n );\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"]}
@@ -0,0 +1,8 @@
1
+ import { type LoadConfigOptions, type LoadedConfig } from "./loader.ts";
2
+ type ConfigReloader = {
3
+ reload: () => Promise<LoadedConfig>;
4
+ resolvePaths: () => string[];
5
+ };
6
+ declare const createConfigReloader: (cwd: string, options?: LoadConfigOptions, initialDependencies?: string[]) => Promise<ConfigReloader>;
7
+ export { createConfigReloader };
8
+ //# sourceMappingURL=config-reloader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-reloader.d.ts","sourceRoot":"","sources":["../src/config-reloader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,iBAAiB,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAEpF,KAAK,cAAc,GAAG;IAClB,MAAM,EAAE,MAAM,OAAO,CAAC,YAAY,CAAC,CAAC;IACpC,YAAY,EAAE,MAAM,MAAM,EAAE,CAAC;CAChC,CAAC;AAEF,QAAA,MAAM,oBAAoB,QACjB,MAAM,YACF,iBAAiB,wBACL,MAAM,EAAE,KAC9B,OAAO,CAAC,cAAc,CA6BxB,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { resolve } from "node:path";
2
+ import { configDependenciesFor } from "./config-dependencies.js";
3
+ import { loadConfig } from "./loader.js";
4
+ const createConfigReloader = async (cwd, options = {}, initialDependencies = []) => {
5
+ let selectedConfigFile;
6
+ let knownDependencies = initialDependencies;
7
+ if (options.configFile === undefined) {
8
+ const loaded = await loadConfig(cwd, options);
9
+ selectedConfigFile = loaded.configFile;
10
+ knownDependencies = [...knownDependencies, ...configDependenciesFor(loaded)];
11
+ }
12
+ else {
13
+ selectedConfigFile = resolve(cwd, options.configFile);
14
+ }
15
+ return {
16
+ resolvePaths: () => [...new Set([selectedConfigFile, ...knownDependencies])],
17
+ reload: async () => {
18
+ let loaded;
19
+ try {
20
+ loaded = await loadConfig(cwd, { ...options, configFile: selectedConfigFile });
21
+ }
22
+ catch (error) {
23
+ knownDependencies = [...new Set([...knownDependencies, ...configDependenciesFor(error)])];
24
+ throw error;
25
+ }
26
+ knownDependencies = configDependenciesFor(loaded);
27
+ return loaded;
28
+ },
29
+ };
30
+ };
31
+ export { createConfigReloader };
32
+ //# sourceMappingURL=config-reloader.js.map
@@ -0,0 +1 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,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"]}
@@ -0,0 +1,9 @@
1
+ type ConfigResolutionOptions = {
2
+ configFile?: string | undefined;
3
+ cwd?: string | undefined;
4
+ };
5
+ declare const configCandidatePaths: (directory: string) => string[];
6
+ declare const configSourceCandidates: (path: string) => string[];
7
+ declare const localConfigSourcePath: (source: string, options: ConfigResolutionOptions) => string | undefined;
8
+ export { configCandidatePaths, configSourceCandidates, localConfigSourcePath, type ConfigResolutionOptions };
9
+ //# sourceMappingURL=config-source.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,32 @@
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
+ };
17
+ const isLocalConfigSource = (source) => source.startsWith(".") || isAbsolute(source);
18
+ const isDirectoryConfigSource = (source) => {
19
+ const extension = extname(source);
20
+ return extension.length === 0 || extension === basename(source);
21
+ };
22
+ const localConfigSourcePath = (source, options) => {
23
+ if (source === "." || !isLocalConfigSource(source)) {
24
+ return undefined;
25
+ }
26
+ const cwd = options.cwd ?? process.cwd();
27
+ return isDirectoryConfigSource(source)
28
+ ? resolve(cwd, source, options.configFile ?? "gtkx.config")
29
+ : resolve(cwd, source);
30
+ };
31
+ export { configCandidatePaths, configSourceCandidates, localConfigSourcePath };
32
+ //# sourceMappingURL=config-source.js.map
@@ -0,0 +1 @@
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,IAAI,CAAC,CAAC;IAChC,MAAM,QAAQ,GAAG,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,KAAK,MAAM,CAAC,CAAC,C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E,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
@@ -16,13 +16,13 @@ type ResolvedReactCompilerOptions = ReactCompilerOptions & {
16
16
  target: "19";
17
17
  };
18
18
  /**
19
- * User-facing configuration for a GTKX project, as authored in `gtkx.config.ts`: the GIR libraries
20
- * to bind and where to find them, the GApplication id, per-element configuration, the React
21
- * Compiler, codegen, and user event signal settings, and the `agents` and `mcp` blocks controlling
22
- * what coding agents are given.
19
+ * GTKX project configuration authored in `gtkx.config.ts` and validated when loaded.
23
20
  */
24
21
  type Config = z.infer<typeof configSchema>;
25
22
  type ModuleExport = z.infer<typeof moduleExportSchema>;
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>;
26
26
  type McpSettings = {
27
27
  tools: string[];
28
28
  isReadOnly: boolean;
@@ -51,7 +51,35 @@ declare const PANIC_THRESHOLDS: readonly ["none", "critical_errors", "all_errors
51
51
  declare const moduleExportSchema: z.ZodObject<{
52
52
  module: z.ZodString;
53
53
  export: z.ZodString;
54
- }, z.core.$strip>;
54
+ }, z.core.$strict>;
55
+ declare const elementPropsSchema: z.ZodObject<{
56
+ module: z.ZodString;
57
+ export: z.ZodString;
58
+ composition: z.ZodOptional<z.ZodEnum<{
59
+ factory: "factory";
60
+ intersection: "intersection";
61
+ }>>;
62
+ constructOnly: z.ZodOptional<z.ZodArray<z.ZodString>>;
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>;
55
83
  /** Schema every `gtkx.config.ts` is validated against, and the source of the {@link Config} type. */
56
84
  declare const configSchema: z.ZodObject<{
57
85
  libraries: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -59,17 +87,17 @@ declare const configSchema: z.ZodObject<{
59
87
  applicationId: z.ZodString;
60
88
  reactCompiler: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
61
89
  compilationMode: z.ZodOptional<z.ZodEnum<{
90
+ all: "all";
91
+ annotation: "annotation";
62
92
  infer: "infer";
63
93
  syntax: "syntax";
64
- annotation: "annotation";
65
- all: "all";
66
94
  }>>;
67
95
  panicThreshold: z.ZodOptional<z.ZodEnum<{
68
- none: "none";
69
- critical_errors: "critical_errors";
70
96
  all_errors: "all_errors";
97
+ critical_errors: "critical_errors";
98
+ none: "none";
71
99
  }>>;
72
- }, z.core.$strip>]>>;
100
+ }, z.core.$strict>]>>;
73
101
  codegen: z.ZodOptional<z.ZodBoolean>;
74
102
  userEventSignals: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
75
103
  elements: z.ZodOptional<z.ZodObject<{
@@ -78,15 +106,21 @@ declare const configSchema: z.ZodObject<{
78
106
  component: z.ZodOptional<z.ZodObject<{
79
107
  module: z.ZodString;
80
108
  export: z.ZodString;
81
- }, z.core.$strip>>;
109
+ }, z.core.$strict>>;
82
110
  props: z.ZodOptional<z.ZodObject<{
83
111
  module: z.ZodString;
84
112
  export: z.ZodString;
85
- }, z.core.$strip>>;
113
+ composition: z.ZodOptional<z.ZodEnum<{
114
+ factory: "factory";
115
+ intersection: "intersection";
116
+ }>>;
117
+ constructOnly: z.ZodOptional<z.ZodArray<z.ZodString>>;
118
+ }, z.core.$strict>>;
86
119
  isLazy: z.ZodOptional<z.ZodBoolean>;
120
+ acceptedChildTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
87
121
  omittedProps: z.ZodOptional<z.ZodArray<z.ZodString>>;
88
- }, z.core.$strip>>>;
89
- }, z.core.$strip>>;
122
+ }, z.core.$strict>>>;
123
+ }, z.core.$strict>>;
90
124
  applicationIcon: z.ZodOptional<z.ZodString>;
91
125
  deploy: z.ZodOptional<z.ZodObject<{
92
126
  targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
@@ -143,10 +177,10 @@ declare const configSchema: z.ZodObject<{
143
177
  dark: z.ZodString;
144
178
  }, z.core.$strict>>;
145
179
  contentRating: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
146
- none: "none";
147
180
  intense: "intense";
148
181
  mild: "mild";
149
182
  moderate: "moderate";
183
+ none: "none";
150
184
  }>>>;
151
185
  releases: z.ZodOptional<z.ZodArray<z.ZodObject<{
152
186
  version: z.ZodString;
@@ -225,6 +259,9 @@ declare const configSchema: z.ZodObject<{
225
259
  postRemove: z.ZodOptional<z.ZodString>;
226
260
  }, z.core.$strict>>;
227
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>>;
228
265
  signing: z.ZodOptional<z.ZodObject<{
229
266
  appimage: z.ZodOptional<z.ZodObject<{
230
267
  gpgKeyId: z.ZodString;
@@ -237,9 +274,9 @@ declare const configSchema: z.ZodObject<{
237
274
  "dpkg-sig": "dpkg-sig";
238
275
  }>>;
239
276
  type: z.ZodOptional<z.ZodEnum<{
240
- origin: "origin";
241
277
  archive: "archive";
242
278
  maint: "maint";
279
+ origin: "origin";
243
280
  }>>;
244
281
  signer: z.ZodOptional<z.ZodString>;
245
282
  }, z.core.$strict>>;
@@ -254,11 +291,7 @@ declare const configSchema: z.ZodObject<{
254
291
  }, z.core.$strict>>;
255
292
  appimage: z.ZodOptional<z.ZodObject<{
256
293
  fileName: z.ZodOptional<z.ZodString>;
257
- compression: z.ZodOptional<z.ZodEnum<{
258
- gzip: "gzip";
259
- xz: "xz";
260
- zstd: "zstd";
261
- }>>;
294
+ compression: z.ZodOptional<z.ZodLiteral<"zstd">>;
262
295
  updateInformation: z.ZodOptional<z.ZodString>;
263
296
  runtimeFile: z.ZodOptional<z.ZodString>;
264
297
  }, z.core.$strict>>;
@@ -268,9 +301,9 @@ declare const configSchema: z.ZodObject<{
268
301
  priority: z.ZodOptional<z.ZodString>;
269
302
  compression: z.ZodOptional<z.ZodEnum<{
270
303
  gzip: "gzip";
304
+ none: "none";
271
305
  xz: "xz";
272
306
  zstd: "zstd";
273
- none: "none";
274
307
  }>>;
275
308
  fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
276
309
  }, z.core.$strict>>;
@@ -312,9 +345,9 @@ declare const configSchema: z.ZodObject<{
312
345
  group: z.ZodOptional<z.ZodString>;
313
346
  compression: z.ZodOptional<z.ZodEnum<{
314
347
  gzip: "gzip";
348
+ lzma: "lzma";
315
349
  xz: "xz";
316
350
  zstd: "zstd";
317
- lzma: "lzma";
318
351
  }>>;
319
352
  prefixes: z.ZodOptional<z.ZodArray<z.ZodString>>;
320
353
  }, z.core.$strict>>;
@@ -322,15 +355,15 @@ declare const configSchema: z.ZodObject<{
322
355
  agents: z.ZodOptional<z.ZodObject<{
323
356
  rules: z.ZodOptional<z.ZodBoolean>;
324
357
  reference: z.ZodOptional<z.ZodBoolean>;
325
- }, z.core.$strip>>;
358
+ }, z.core.$strict>>;
326
359
  mcp: z.ZodOptional<z.ZodObject<{
327
360
  tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
328
361
  readOnly: z.ZodOptional<z.ZodBoolean>;
329
- }, z.core.$strip>>;
362
+ }, z.core.$strict>>;
330
363
  deprecations: z.ZodOptional<z.ZodObject<{
331
364
  silence: z.ZodOptional<z.ZodArray<z.ZodNever>>;
332
- }, z.core.$strip>>;
333
- }, z.core.$strip>;
365
+ }, z.core.$strict>>;
366
+ }, z.core.$strict>;
334
367
  /**
335
368
  * Returns the given configuration unchanged, typed as {@link Config}, so `gtkx.config.ts` gets
336
369
  * autocompletion and type checking.
@@ -346,11 +379,12 @@ declare const graduatedFutureKeys: (config: unknown) => string[];
346
379
  declare const mergeConfig: (base: Config, override: Config) => Config;
347
380
  declare const resolveLazyElements: (elements: Config["elements"]) => string[];
348
381
  declare const resolveElementComponents: (elements: Config["elements"]) => Record<string, ModuleExport>;
349
- declare const resolveElementProps: (elements: Config["elements"]) => Record<string, ModuleExport>;
382
+ declare const resolveElementProps: (elements: Config["elements"]) => Record<string, ElementPropsExport>;
383
+ declare const resolveAcceptedChildTypes: (elements: Config["elements"]) => Record<string, string[]>;
350
384
  declare const resolveOmittedProps: (elements: Config["elements"]) => Record<string, string[]>;
351
385
  declare const isAgentRulesEnabled: (config: Config) => boolean;
352
386
  declare const isAgentReferenceEnabled: (config: Config) => boolean;
353
387
  declare const resolveMcpSettings: (config: Config) => McpSettings;
354
388
  declare const resolveConfig: (config: Config, root?: string) => ResolvedConfig;
355
- export { APPLICATION_ID_MAX_LENGTH, defineConfig, isAgentReferenceEnabled, isAgentRulesEnabled, isValidApplicationId, graduatedFutureKeys, validateConfig, mergeConfig, resolveLazyElements, resolveElementComponents, resolveElementProps, 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, };
356
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;;;;;GAKG;AACH,KAAK,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAC3C,KAAK,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAGvD,KAAK,WAAW,GAAG;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,2GAA2G;AAC3G,KAAK,cAAc,GAAG;IAClB,2DAA2D;IAC3D,aAAa,EAAE,MAAM,CAAC;IACtB,qFAAqF;IACrF,aAAa,EAAE,4BAA4B,GAAG,IAAI,CAAC;IACnD;;;OAGG;IACH,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAC3C,2FAA2F;IAC3F,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,qGAAqG;IACrG,YAAY,EAAE,MAAM,EAAE,CAAC;C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