@gtkx/config 1.6.0 → 2.0.0-beta.2

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 (51) hide show
  1. package/README.md +5 -5
  2. package/dist/config-error.d.ts +2 -13
  3. package/dist/config-error.d.ts.map +1 -1
  4. package/dist/config-error.js +3 -53
  5. package/dist/config-error.js.map +1 -1
  6. package/dist/config.d.ts +29 -46
  7. package/dist/config.d.ts.map +1 -1
  8. package/dist/config.js +47 -92
  9. package/dist/config.js.map +1 -1
  10. package/dist/deploy.d.ts +3 -0
  11. package/dist/deploy.d.ts.map +1 -1
  12. package/dist/deploy.js +22 -3
  13. package/dist/deploy.js.map +1 -1
  14. package/dist/index.d.ts +0 -2
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +0 -2
  17. package/dist/index.js.map +1 -1
  18. package/dist/internal.d.ts +3 -2
  19. package/dist/internal.d.ts.map +1 -1
  20. package/dist/internal.js +2 -1
  21. package/dist/internal.js.map +1 -1
  22. package/dist/loader.d.ts +2 -4
  23. package/dist/loader.d.ts.map +1 -1
  24. package/dist/loader.js +35 -9
  25. package/dist/loader.js.map +1 -1
  26. package/dist/node-version.d.ts +4 -0
  27. package/dist/node-version.d.ts.map +1 -0
  28. package/dist/node-version.js +12 -0
  29. package/dist/node-version.js.map +1 -0
  30. package/dist/schema-text.d.ts +1 -2
  31. package/dist/schema-text.d.ts.map +1 -1
  32. package/dist/schema-text.js +1 -1
  33. package/dist/schema-text.js.map +1 -1
  34. package/dist/virtual.d.ts.map +1 -1
  35. package/dist/virtual.js +1 -2
  36. package/dist/virtual.js.map +1 -1
  37. package/package.json +10 -4
  38. package/src/config-error.ts +3 -76
  39. package/src/config.ts +59 -165
  40. package/src/deploy.ts +31 -3
  41. package/src/index.ts +0 -2
  42. package/src/internal.ts +2 -3
  43. package/src/loader.ts +52 -10
  44. package/src/node-version.ts +16 -0
  45. package/src/schema-text.ts +1 -1
  46. package/src/virtual.ts +1 -4
  47. package/dist/deprecations.d.ts +0 -5
  48. package/dist/deprecations.d.ts.map +0 -1
  49. package/dist/deprecations.js +0 -97
  50. package/dist/deprecations.js.map +0 -1
  51. package/src/deprecations.ts +0 -130
package/README.md CHANGED
@@ -13,7 +13,7 @@
13
13
  <p align="center">
14
14
  <a href="https://www.npmjs.com/package/create-gtkx"><img src="https://img.shields.io/npm/v/create-gtkx?color=cb3837&logo=npm&label=create-gtkx" alt="npm version" /></a>
15
15
  <a href="https://www.npmjs.com/package/create-gtkx"><img src="https://img.shields.io/npm/dm/create-gtkx?color=cb3837&logo=npm&label=downloads" alt="npm downloads" /></a>
16
- <img src="https://img.shields.io/badge/node-%E2%89%A524-339933?logo=node.js&logoColor=white" alt="Node >= 24" />
16
+ <img src="https://img.shields.io/badge/node-%E2%89%A526.7-339933?logo=node.js&logoColor=white" alt="Node >= 26.7" />
17
17
  <a href="https://github.com/gtkx-org/gtkx/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MPL--2.0-blue.svg" alt="License: MPL-2.0" /></a>
18
18
  <a href="https://github.com/gtkx-org/gtkx/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/gtkx-org/gtkx/ci.yml?branch=main&logo=github&label=CI" alt="CI status" /></a>
19
19
  <img src="https://img.shields.io/badge/TypeScript-strict-3178c6?logo=typescript&logoColor=white" alt="TypeScript" />
@@ -116,7 +116,7 @@ At runtime, the native Rust core calls straight into the system GTK4, Adwaita, a
116
116
 
117
117
  ## Quick start
118
118
 
119
- GTKX is Linux-only and needs Node.js 24 or later. See [Requirements](#requirements).
119
+ GTKX is Linux-only and needs Node.js 26.7 or later. See [Requirements](#requirements).
120
120
 
121
121
  Scaffold a new app with the `create-gtkx` initializer:
122
122
 
@@ -145,8 +145,8 @@ The documentation at **[gtkx.dev](https://gtkx.dev)** includes a step-by-step tu
145
145
 
146
146
  GTKX is Linux-only. You need:
147
147
 
148
- - Linux with the GTK4 (4.20 or later) and GLib development libraries, plus Adwaita (1.8 or later) once your project binds `Adw-1`
149
- - Node.js 24 or later
148
+ - Linux with the GTK4 (4.20 or later), Adwaita (1.8 or later), and GLib development libraries
149
+ - Node.js 26.7 or later
150
150
 
151
151
  The `@gtkx/native` addon ships prebuilt for x64 and arm64 glibc Linux; other targets need to build it from the GTKX repository, which requires a Rust toolchain.
152
152
 
@@ -167,7 +167,7 @@ GTKX is stable and ready for production use.
167
167
 
168
168
  ## Contributing
169
169
 
170
- Contributions are welcome. See [CONTRIBUTING.md](https://github.com/gtkx-org/gtkx/blob/main/CONTRIBUTING.md), the [Code of Conduct](https://github.com/gtkx-org/gtkx/blob/main/CODE_OF_CONDUCT.md), and the [security policy](https://github.com/gtkx-org/gtkx/blob/main/SECURITY.md). Building the repo needs Node.js 24 or later, pnpm, and a Rust toolchain.
170
+ Contributions are welcome. See [CONTRIBUTING.md](https://github.com/gtkx-org/gtkx/blob/main/CONTRIBUTING.md), the [Code of Conduct](https://github.com/gtkx-org/gtkx/blob/main/CODE_OF_CONDUCT.md), and the [security policy](https://github.com/gtkx-org/gtkx/blob/main/SECURITY.md). Building the repo needs Node.js 26.7 or later, pnpm, and a Rust toolchain.
171
171
 
172
172
  ## License
173
173
 
@@ -1,17 +1,6 @@
1
- import type { z } from "zod";
2
- type IssuePath = (string | number)[];
1
+ import { z } from "zod";
3
2
  declare const isRecord: (value: unknown) => value is Record<string, unknown>;
4
- declare const rawIssue: (input: unknown, path: IssuePath, message: string, isStandalone?: boolean) => {
5
- params?: {
6
- standalone: boolean;
7
- };
8
- code: "custom";
9
- input: unknown;
10
- path: IssuePath;
11
- message: string;
12
- continue: true;
13
- };
14
3
  declare const missingConfigFileError: (cwd: string) => Error;
15
4
  declare const configError: (error: z.ZodError) => Error;
16
- export { isRecord, rawIssue, missingConfigFileError, configError };
5
+ export { isRecord, missingConfigFileError, configError };
17
6
  //# sourceMappingURL=config-error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config-error.d.ts","sourceRoot":"","sources":["../src/config-error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,KAAK,SAAS,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;AAKrC,QAAA,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CACM,CAAC;AAEzE,QAAA,MAAM,QAAQ,GAAI,OAAO,OAAO,EAAE,MAAM,SAAS,EAAE,SAAS,MAAM,EAAE,sBAAoB;;;;;;;;;CAOtF,CAAC;AAuDH,QAAA,MAAM,sBAAsB,GAAI,KAAK,MAAM,KAAG,KACyB,CAAC;AAExE,QAAA,MAAM,WAAW,GAAI,OAAO,CAAC,CAAC,QAAQ,KAAG,KAQxC,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,sBAAsB,EAAE,WAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"config-error.d.ts","sourceRoot":"","sources":["../src/config-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,QAAA,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CACM,CAAC;AAEzE,QAAA,MAAM,sBAAsB,GAAI,KAAK,MAAM,KAAG,KACyB,CAAC;AAExE,QAAA,MAAM,WAAW,GAAI,OAAO,CAAC,CAAC,QAAQ,KAAG,KAAiE,CAAC;AAE3G,OAAO,EAAE,QAAQ,EAAE,sBAAsB,EAAE,WAAW,EAAE,CAAC"}
@@ -1,57 +1,7 @@
1
+ import { z } from "zod";
1
2
  const CONFIG_PREFIX = "gtkx.config.ts:";
2
- const UNRECOGNIZED_KEY_REASON = "is not a recognized key";
3
3
  const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
4
- const rawIssue = (input, path, message, isStandalone = false) => ({
5
- code: "custom",
6
- input,
7
- path,
8
- message,
9
- continue: true,
10
- ...(isStandalone && { params: { standalone: true } }),
11
- });
12
- const appendSegment = (path, segment) => {
13
- if (typeof segment === "number") {
14
- return `${path}[${String(segment)}]`;
15
- }
16
- return path === "" ? String(segment) : `${path}.${String(segment)}`;
17
- };
18
- const dottedPath = (segments) => {
19
- let path = "";
20
- for (const segment of segments) {
21
- path = appendSegment(path, segment);
22
- }
23
- return path;
24
- };
25
- const isStandaloneIssue = (issue) => "params" in issue && isRecord(issue.params) && issue.params.standalone === true;
26
- const unrecognizedKeyPath = (issue, fullPath) => {
27
- if (issue.code === "unrecognized_keys") {
28
- const [key] = issue.keys;
29
- return dottedPath(key === undefined ? fullPath : [...fullPath, key]);
30
- }
31
- return issue.code === "invalid_key" ? dottedPath(fullPath) : undefined;
32
- };
33
- const keyRejectionReason = (issue) => {
34
- const nested = issue.code === "invalid_key" ? issue.issues[0] : undefined;
35
- return nested?.code === "custom" ? nested.message : UNRECOGNIZED_KEY_REASON;
36
- };
37
- const formatIssue = (issue, fullPath) => {
38
- const unrecognized = unrecognizedKeyPath(issue, fullPath);
39
- if (unrecognized !== undefined) {
40
- return `${CONFIG_PREFIX} \`${unrecognized}\` ${keyRejectionReason(issue)}`;
41
- }
42
- if (isStandaloneIssue(issue)) {
43
- return `${CONFIG_PREFIX} ${issue.message}`;
44
- }
45
- const path = dottedPath(fullPath);
46
- return path === "" ? `${CONFIG_PREFIX} ${issue.message}` : `${CONFIG_PREFIX} \`${path}\` ${issue.message}`;
47
- };
48
4
  const missingConfigFileError = (cwd) => new Error(`${CONFIG_PREFIX} no configuration file found in ${cwd}`);
49
- const configError = (error) => {
50
- const issue = error.issues[0];
51
- if (issue === undefined) {
52
- return new Error(`${CONFIG_PREFIX} invalid configuration`);
53
- }
54
- return new Error(formatIssue(issue, issue.path));
55
- };
56
- export { isRecord, rawIssue, missingConfigFileError, configError };
5
+ const configError = (error) => new Error(`${CONFIG_PREFIX}\n${z.prettifyError(error)}`);
6
+ export { isRecord, missingConfigFileError, configError };
57
7
  //# sourceMappingURL=config-error.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config-error.js","sourceRoot":"","sources":["../src/config-error.ts"],"names":[],"mappings":"AAIA,MAAM,aAAa,GAAG,iBAAiB,CAAC;AACxC,MAAM,uBAAuB,GAAG,yBAAyB,CAAC;AAE1D,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,QAAQ,GAAG,CAAC,KAAc,EAAE,IAAe,EAAE,OAAe,EAAE,YAAY,GAAG,KAAK,EAAE,EAAE,CAAC,CAAC;IAC1F,IAAI,EAAE,QAAiB;IACvB,KAAK;IACL,IAAI;IACJ,OAAO;IACP,QAAQ,EAAE,IAAa;IACvB,GAAG,CAAC,YAAY,IAAI,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC;CACxD,CAAC,CAAC;AAEH,MAAM,aAAa,GAAG,CAAC,IAAY,EAAE,OAAoB,EAAU,EAAE;IACjE,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,GAAG,IAAI,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC;IACzC,CAAC;IAED,OAAO,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;AACxE,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,QAAuB,EAAU,EAAE;IACnD,IAAI,IAAI,GAAG,EAAE,CAAC;IAEd,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC7B,IAAI,GAAG,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;I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CAAC,KAAK,CAAC,EAAE,CAAC;IAC/E,CAAC;IAED,IAAI,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,GAAG,aAAa,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;IAC/C,CAAC;IAED,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;IAElC,OAAO,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,aAAa,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,GAAG,aAAa,MAAM,IAAI,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC;AAC/G,CAAC,CAAC;AAEF,MAAM,sBAAsB,GAAG,CAAC,GAAW,EAAS,EAAE,CAClD,IAAI,KAAK,CAAC,GAAG,aAAa,mCAAmC,GAAG,EAAE,CAAC,CAAC;AAExE,MAAM,WAAW,GAAG,CAAC,KAAiB,EAAS,EAAE;IAC7C,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAE9B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACtB,OAAO,IAAI,KAAK,CAAC,GAAG,aAAa,wBAAwB,CAAC,CAAC;IAC/D,CAAC;IAED,OAAO,IAAI,KAAK,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AACrD,CAAC,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,sBAAsB,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import type { z } from \"zod\";\n\ntype IssuePath = (string | number)[];\n\nconst CONFIG_PREFIX = \"gtkx.config.ts:\";\nconst UNRECOGNIZED_KEY_REASON = \"is not a recognized key\";\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst rawIssue = (input: unknown, path: IssuePath, message: string, isStandalone = false) => ({\n code: \"custom\" as const,\n input,\n path,\n message,\n continue: true as const,\n ...(isStandalone && { params: { standalone: true } }),\n});\n\nconst appendSegment = (path: string, segment: PropertyKey): string => {\n if (typeof segment === \"number\") {\n return `${path}[${String(segment)}]`;\n }\n\n return path === \"\" ? String(segment) : `${path}.${String(segment)}`;\n};\n\nconst dottedPath = (segments: PropertyKey[]): string => {\n let path = \"\";\n\n for (const segment of segments) {\n path = appendSegment(path, segment);\n }\n\n return path;\n};\n\nconst isStandaloneIssue = (issue: z.core.$ZodIssue): boolean =>\n \"params\" in issue && isRecord(issue.params) && issue.params.standalone === true;\n\nconst unrecognizedKeyPath = (issue: z.core.$ZodIssue, fullPath: PropertyKey[]): string | undefined => {\n if (issue.code === \"unrecognized_keys\") {\n const [key] = issue.keys;\n\n return dottedPath(key === undefined ? fullPath : [...fullPath, key]);\n }\n\n return issue.code === \"invalid_key\" ? dottedPath(fullPath) : undefined;\n};\n\nconst keyRejectionReason = (issue: z.core.$ZodIssue): string => {\n const nested = issue.code === \"invalid_key\" ? issue.issues[0] : undefined;\n\n return nested?.code === \"custom\" ? nested.message : UNRECOGNIZED_KEY_REASON;\n};\n\nconst formatIssue = (issue: z.core.$ZodIssue, fullPath: PropertyKey[]): string => {\n const unrecognized = unrecognizedKeyPath(issue, fullPath);\n\n if (unrecognized !== undefined) {\n return `${CONFIG_PREFIX} \\`${unrecognized}\\` ${keyRejectionReason(issue)}`;\n }\n\n if (isStandaloneIssue(issue)) {\n return `${CONFIG_PREFIX} ${issue.message}`;\n }\n\n const path = dottedPath(fullPath);\n\n return path === \"\" ? `${CONFIG_PREFIX} ${issue.message}` : `${CONFIG_PREFIX} \\`${path}\\` ${issue.message}`;\n};\n\nconst missingConfigFileError = (cwd: string): Error =>\n new Error(`${CONFIG_PREFIX} no configuration file found in ${cwd}`);\n\nconst configError = (error: z.ZodError): Error => {\n const issue = error.issues[0];\n\n if (issue === undefined) {\n return new Error(`${CONFIG_PREFIX} invalid configuration`);\n }\n\n return new Error(formatIssue(issue, issue.path));\n};\n\nexport { isRecord, rawIssue, 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,aAAa,GAAG,iBAAiB,CAAC;AAExC,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CAClE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAEzE,MAAM,sBAAsB,GAAG,CAAC,GAAW,EAAS,EAAE,CAClD,IAAI,KAAK,CAAC,GAAG,aAAa,mCAAmC,GAAG,EAAE,CAAC,CAAC;AAExE,MAAM,WAAW,GAAG,CAAC,KAAiB,EAAS,EAAE,CAAC,IAAI,KAAK,CAAC,GAAG,aAAa,KAAK,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAE3G,OAAO,EAAE,QAAQ,EAAE,sBAAsB,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { z } from \"zod\";\n\nconst CONFIG_PREFIX = \"gtkx.config.ts:\";\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst missingConfigFileError = (cwd: string): Error =>\n new Error(`${CONFIG_PREFIX} no configuration file found in ${cwd}`);\n\nconst configError = (error: z.ZodError): Error => new Error(`${CONFIG_PREFIX}\\n${z.prettifyError(error)}`);\n\nexport { isRecord, missingConfigFileError, configError };\n"]}
package/dist/config.d.ts CHANGED
@@ -1,15 +1,11 @@
1
1
  import { type DefineConfig } from "c12";
2
2
  import { z } from "zod";
3
- /** Accepted `reactCompiler.compilationMode` values, choosing which functions the compiler processes. */
4
- type ReactCompilerCompilationMode = (typeof COMPILATION_MODES)[number];
5
- /** Accepted `reactCompiler.panicThreshold` values, choosing which compiler diagnostics fail the build. */
6
- type ReactCompilerPanicThreshold = (typeof PANIC_THRESHOLDS)[number];
7
- /** Object form of the `reactCompiler` config key, forwarded as-is to `babel-plugin-react-compiler`. */
3
+ /** Object form of the `reactCompiler` config key, forwarded to `babel-plugin-react-compiler`. */
8
4
  type ReactCompilerOptions = {
9
- /** Which functions the compiler processes; left to the compiler's own default when omitted. */
10
- compilationMode?: ReactCompilerCompilationMode;
11
- /** Which compiler diagnostics fail the build; left to the compiler's own default when omitted. */
12
- panicThreshold?: ReactCompilerPanicThreshold;
5
+ /** Which functions the compiler processes. */
6
+ compilationMode?: (typeof COMPILATION_MODES)[number];
7
+ /** Which compiler diagnostics fail the build. */
8
+ panicThreshold?: (typeof PANIC_THRESHOLDS)[number];
13
9
  };
14
10
  /**
15
11
  * The React Compiler options the build hands to `babel-plugin-react-compiler`, with the React version
@@ -22,9 +18,8 @@ type ResolvedReactCompilerOptions = ReactCompilerOptions & {
22
18
  /**
23
19
  * User-facing configuration for a GTKX project, as authored in `gtkx.config.ts`: the GIR libraries
24
20
  * to bind and where to find them, the GApplication id, per-element configuration, the React
25
- * Compiler, codegen, and user event signal settings, the `agents` and `mcp` blocks controlling what
26
- * coding agents are given, the `future` block opting into behavior that becomes the default in the
27
- * next major version, and the `deprecations` block silencing the warnings about flags left unset.
21
+ * Compiler, codegen, and user event signal settings, and the `agents` and `mcp` blocks controlling
22
+ * what coding agents are given.
28
23
  */
29
24
  type Config = z.infer<typeof configSchema>;
30
25
  type ModuleExport = z.infer<typeof moduleExportSchema>;
@@ -32,15 +27,6 @@ type McpSettings = {
32
27
  tools: string[];
33
28
  isReadOnly: boolean;
34
29
  };
35
- type ResolvedFuture = {
36
- isByteArrayTyped: boolean;
37
- isValueUnwrapped: boolean;
38
- isFinishTrimmed: boolean;
39
- isInoutInPlace: boolean;
40
- isResourceImported: boolean;
41
- isAdwaitaDefault: boolean;
42
- isTreeShaken: boolean;
43
- };
44
30
  /** Configuration reduced to the values the app runtime and the build need, with paths already resolved. */
45
31
  type ResolvedConfig = {
46
32
  /** The GApplication identifier the app registers under. */
@@ -68,19 +54,22 @@ declare const moduleExportSchema: z.ZodObject<{
68
54
  }, z.core.$strip>;
69
55
  /** Schema every `gtkx.config.ts` is validated against, and the source of the {@link Config} type. */
70
56
  declare const configSchema: z.ZodObject<{
71
- future: z.ZodOptional<z.ZodObject<{
72
- v2ByteArrays: z.ZodOptional<z.ZodBoolean>;
73
- v2ValueReturns: z.ZodOptional<z.ZodBoolean>;
74
- v2FinishResults: z.ZodOptional<z.ZodBoolean>;
75
- v2InoutReturns: z.ZodOptional<z.ZodBoolean>;
76
- v2ResourceImports: z.ZodOptional<z.ZodBoolean>;
77
- v2DefaultLibraries: z.ZodOptional<z.ZodBoolean>;
78
- v2TreeShaking: z.ZodOptional<z.ZodBoolean>;
79
- }, z.core.$strip>>;
80
- libraries: z.ZodOptional<z.ZodCustom<string[] | "*", string[] | "*">>;
57
+ libraries: z.ZodOptional<z.ZodArray<z.ZodString>>;
81
58
  girPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
82
- applicationId: z.ZodCustom<string, string>;
83
- reactCompiler: z.ZodOptional<z.ZodCustom<boolean | ReactCompilerOptions, boolean | ReactCompilerOptions>>;
59
+ applicationId: z.ZodString;
60
+ reactCompiler: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
61
+ compilationMode: z.ZodOptional<z.ZodEnum<{
62
+ infer: "infer";
63
+ syntax: "syntax";
64
+ annotation: "annotation";
65
+ all: "all";
66
+ }>>;
67
+ panicThreshold: z.ZodOptional<z.ZodEnum<{
68
+ none: "none";
69
+ critical_errors: "critical_errors";
70
+ all_errors: "all_errors";
71
+ }>>;
72
+ }, z.core.$strip>]>>;
84
73
  codegen: z.ZodOptional<z.ZodBoolean>;
85
74
  userEventSignals: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
86
75
  elements: z.ZodOptional<z.ZodObject<{
@@ -173,6 +162,8 @@ declare const configSchema: z.ZodObject<{
173
162
  url: z.ZodOptional<z.ZodURL>;
174
163
  }, z.core.$strict>>>;
175
164
  execArgs: z.ZodOptional<z.ZodArray<z.ZodString>>;
165
+ launcherEnv: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
166
+ nodeFlags: z.ZodOptional<z.ZodArray<z.ZodString>>;
176
167
  fileAssociations: z.ZodOptional<z.ZodArray<z.ZodObject<{
177
168
  extension: z.ZodString;
178
169
  mimeType: z.ZodString;
@@ -185,6 +176,7 @@ declare const configSchema: z.ZodObject<{
185
176
  icon: z.ZodOptional<z.ZodString>;
186
177
  }, z.core.$strict>>>;
187
178
  desktopEntry: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
179
+ metainfoExtra: z.ZodOptional<z.ZodArray<z.ZodString>>;
188
180
  isDbusActivatable: z.ZodOptional<z.ZodBoolean>;
189
181
  extraFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
190
182
  source: z.ZodString;
@@ -345,15 +337,7 @@ declare const configSchema: z.ZodObject<{
345
337
  readOnly: z.ZodOptional<z.ZodBoolean>;
346
338
  }, z.core.$strip>>;
347
339
  deprecations: z.ZodOptional<z.ZodObject<{
348
- silence: z.ZodOptional<z.ZodArray<z.ZodEnum<{
349
- "gtkx-v2-byte-arrays": "gtkx-v2-byte-arrays";
350
- "gtkx-v2-value-returns": "gtkx-v2-value-returns";
351
- "gtkx-v2-finish-results": "gtkx-v2-finish-results";
352
- "gtkx-v2-inout-returns": "gtkx-v2-inout-returns";
353
- "gtkx-v2-resource-imports": "gtkx-v2-resource-imports";
354
- "gtkx-v2-default-libraries": "gtkx-v2-default-libraries";
355
- "gtkx-v2-tree-shaking": "gtkx-v2-tree-shaking";
356
- }>>>;
340
+ silence: z.ZodOptional<z.ZodArray<z.ZodNever>>;
357
341
  }, z.core.$strip>>;
358
342
  }, z.core.$strip>;
359
343
  /**
@@ -362,7 +346,8 @@ declare const configSchema: z.ZodObject<{
362
346
  */
363
347
  declare const defineConfig: DefineConfig<Config>;
364
348
  declare const isValidApplicationId: (applicationId: string) => boolean;
365
- declare const validateConfig: (config: Config) => void;
349
+ declare const validateConfig: (config: unknown) => void;
350
+ declare const graduatedFutureKeys: (config: unknown) => string[];
366
351
  /**
367
352
  * Deep-merges a configuration over a base. `override` wins over `base` on conflicting scalar and object keys, while
368
353
  * arrays are concatenated with the `override` entries first.
@@ -375,8 +360,6 @@ declare const resolveOmittedProps: (elements: Config["elements"]) => Record<stri
375
360
  declare const isAgentRulesEnabled: (config: Config) => boolean;
376
361
  declare const isAgentReferenceEnabled: (config: Config) => boolean;
377
362
  declare const resolveMcpSettings: (config: Config) => McpSettings;
378
- declare const resolveFuture: (future: Config["future"]) => ResolvedFuture;
379
- declare const unknownFutureKeys: (future: Config["future"]) => string[];
380
363
  declare const resolveConfig: (config: Config, root?: string) => ResolvedConfig;
381
- export { APPLICATION_ID_MAX_LENGTH, defineConfig, isAgentReferenceEnabled, isAgentRulesEnabled, isValidApplicationId, validateConfig, mergeConfig, resolveLazyElements, resolveElementComponents, resolveElementProps, resolveMcpSettings, resolveOmittedProps, resolveConfig, resolveFuture, unknownFutureKeys, type McpSettings, type ResolvedReactCompilerOptions, type Config, type ResolvedConfig, type ResolvedFuture, };
364
+ 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, };
382
365
  //# 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;AAOxB,wGAA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GAAI,QAAQ,MAAM,EAAE,OAAO,MAAM,KAAG,cAMrD,CAAC;AAEH,OAAO,EACH,yBAAyB,EACzB,YAAY,EACZ,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EACb,KAAK,WAAW,EAChB,KAAK,4BAA4B,EACjC,KAAK,MAAM,EACX,KAAK,cAAc,GACtB,CAAC"}
package/dist/config.js CHANGED
@@ -2,61 +2,35 @@ import { createDefineConfig } from "c12";
2
2
  import { defu } from "defu";
3
3
  import { resolve } from "node:path";
4
4
  import { z } from "zod";
5
- import { configError, isRecord, rawIssue } from "./config-error.js";
5
+ import { configError, isRecord } from "./config-error.js";
6
6
  import { deploySchema } from "./deploy.js";
7
- import { DEPRECATION_IDS } from "./deprecations.js";
8
- import { isGirLibrary, text } from "./schema-text.js";
7
+ import { girLibrary, text } from "./schema-text.js";
9
8
  import { resolveUserEventSignals } from "./user-event-signals.js";
10
- const LIBRARIES_WILDCARD = "*";
11
9
  const APPLICATION_ID_PATTERN = /^[A-Za-z_][A-Za-z0-9_-]*(\.[A-Za-z_][A-Za-z0-9_-]*)+$/;
12
10
  const APPLICATION_ID_MAX_LENGTH = 255;
11
+ const DEFAULT_LIBRARIES = new Set(["Gtk-4.0", "Adw-1"]);
13
12
  /** Compilation modes `babel-plugin-react-compiler` accepts. */
14
13
  const COMPILATION_MODES = ["infer", "syntax", "annotation", "all"];
15
14
  /** Panic thresholds `babel-plugin-react-compiler` accepts. */
16
15
  const PANIC_THRESHOLDS = ["none", "critical_errors", "all_errors"];
17
16
  const REACT_COMPILER_TARGET = "19";
18
- const COMPILATION_MODE_SET = new Set(COMPILATION_MODES);
19
- const PANIC_THRESHOLD_SET = new Set(PANIC_THRESHOLDS);
20
- const librariesSchema = z.custom().check((ctx) => {
21
- const value = ctx.value;
22
- if (value === LIBRARIES_WILDCARD) {
23
- return;
24
- }
25
- if (!Array.isArray(value) || value.length === 0) {
26
- ctx.issues.push(rawIssue(value, [], `must be "${LIBRARIES_WILDCARD}", a non-empty string array, or omitted`));
27
- return;
28
- }
29
- for (const [index, entry] of value.entries()) {
30
- ctx.issues.push(...libraryEntryIssues(value, index, entry));
31
- }
32
- });
33
- const applicationIdSchema = z.custom().check((ctx) => {
34
- const value = ctx.value;
35
- if (typeof value !== "string" || !isValidApplicationId(value)) {
36
- ctx.issues.push(rawIssue(value, [], `invalid \`applicationId\` "${value}", must satisfy g_application_id_is_valid ` +
37
- '(e.g. "org.example.MyApp")', true));
38
- }
39
- });
40
- const reactCompilerSchema = z.custom().check((ctx) => {
41
- const value = ctx.value;
42
- if (typeof value === "boolean") {
43
- return;
44
- }
45
- if (!isRecord(value)) {
46
- ctx.issues.push(rawIssue(value, [], "must be a boolean or an options object"));
47
- return;
48
- }
49
- const compilationMode = value.compilationMode;
50
- if (!isValidReactCompilerOption(compilationMode, COMPILATION_MODE_SET)) {
51
- ctx.issues.push(rawIssue(value, [], `invalid \`reactCompiler.compilationMode\` "${String(compilationMode)}", ` +
52
- `must be one of ${COMPILATION_MODES.join(", ")}`, true));
53
- }
54
- const panicThreshold = value.panicThreshold;
55
- if (!isValidReactCompilerOption(panicThreshold, PANIC_THRESHOLD_SET)) {
56
- ctx.issues.push(rawIssue(value, [], `invalid \`reactCompiler.panicThreshold\` "${String(panicThreshold)}", ` +
57
- `must be one of ${PANIC_THRESHOLDS.join(", ")}`, true));
58
- }
17
+ const librarySchema = girLibrary('must be of the form "Name-Version", such as "Gtk-4.0"')
18
+ .refine((library) => !DEFAULT_LIBRARIES.has(library), { error: "is bound by default; remove it" });
19
+ const librariesSchema = z
20
+ .array(librarySchema, { error: "must be a non-empty string array or omitted" })
21
+ .min(1, { error: "must be a non-empty string array or omitted" });
22
+ const applicationIdSchema = z
23
+ .string({ error: "must satisfy g_application_id_is_valid" })
24
+ .refine((value) => isValidApplicationId(value), {
25
+ error: 'must satisfy g_application_id_is_valid, such as "org.example.MyApp"',
59
26
  });
27
+ const reactCompilerSchema = z.union([
28
+ z.boolean(),
29
+ z.object({
30
+ compilationMode: z.enum(COMPILATION_MODES).optional(),
31
+ panicThreshold: z.enum(PANIC_THRESHOLDS).optional(),
32
+ }),
33
+ ]);
60
34
  const userEventSignalsSchema = z.record(z.string(), z.array(z.string({ error: "must be a non-empty signal name" }).min(1, { error: "must be a non-empty signal name" }), {
61
35
  error: "must be an array of signal names",
62
36
  }), { error: "must be a record of GLib type names to signal name arrays" });
@@ -93,27 +67,26 @@ const mcpSchema = z.object({
93
67
  .optional(),
94
68
  readOnly: z.boolean({ error: "must be a boolean" }).optional(),
95
69
  });
96
- const futureSchema = z.object({
97
- v2ByteArrays: z.boolean({ error: "must be a boolean" }).optional(),
98
- v2ValueReturns: z.boolean({ error: "must be a boolean" }).optional(),
99
- v2FinishResults: z.boolean({ error: "must be a boolean" }).optional(),
100
- v2InoutReturns: z.boolean({ error: "must be a boolean" }).optional(),
101
- v2ResourceImports: z.boolean({ error: "must be a boolean" }).optional(),
102
- v2DefaultLibraries: z.boolean({ error: "must be a boolean" }).optional(),
103
- v2TreeShaking: z.boolean({ error: "must be a boolean" }).optional(),
104
- });
105
- const FUTURE_KEYS = new Set(Object.keys(futureSchema.shape));
106
- const DEPRECATION_ID_ERROR = `must be one of ${DEPRECATION_IDS.join(", ")}`;
70
+ const graduatedFutureSchema = z
71
+ .object({
72
+ v2ByteArrays: z.literal(true, { error: "can only be true; remove the flag" }).optional(),
73
+ v2ValueReturns: z.literal(true, { error: "can only be true; remove the flag" }).optional(),
74
+ v2FinishResults: z.literal(true, { error: "can only be true; remove the flag" }).optional(),
75
+ v2InoutReturns: z.literal(true, { error: "can only be true; remove the flag" }).optional(),
76
+ v2ResourceImports: z.literal(true, { error: "can only be true; remove the flag" }).optional(),
77
+ v2DefaultLibraries: z.literal(true, { error: "can only be true; remove the flag" }).optional(),
78
+ v2TreeShaking: z.literal(true, { error: "can only be true; remove the flag" }).optional(),
79
+ })
80
+ .strict();
107
81
  const deprecationsSchema = z.object({
108
82
  silence: z
109
- .array(z.enum(DEPRECATION_IDS, { error: DEPRECATION_ID_ERROR }), {
110
- error: "must be an array of deprecation ids",
83
+ .array(z.never({ error: "does not name a current deprecation" }), {
84
+ error: "must be an array of current deprecation ids",
111
85
  })
112
86
  .optional(),
113
87
  });
114
88
  /** Schema every `gtkx.config.ts` is validated against, and the source of the {@link Config} type. */
115
89
  const configSchema = z.object({
116
- future: futureSchema.optional(),
117
90
  libraries: librariesSchema.optional(),
118
91
  girPath: z.array(z.string(), { error: "must be an array of strings if provided" }).optional(),
119
92
  applicationId: applicationIdSchema,
@@ -132,39 +105,31 @@ const configSchema = z.object({
132
105
  * autocompletion and type checking.
133
106
  */
134
107
  const defineConfig = createDefineConfig();
135
- const libraryEntryIssues = (value, index, entry) => {
136
- if (typeof entry === "string" && isGirLibrary(entry)) {
137
- return [];
138
- }
139
- if (entry === LIBRARIES_WILDCARD) {
140
- const message = `to generate every library, set \`libraries: "${LIBRARIES_WILDCARD}"\` as a bare string, ` +
141
- "not an array entry";
142
- return [rawIssue(value, [index], message, true)];
143
- }
144
- const message = `invalid library identifier "${String(entry)}", must be of the form "Name-Version" ` +
145
- '(e.g. "Gtk-4.0")';
146
- return [rawIssue(value, [index], message, true)];
147
- };
148
- const isValidApplicationId = (applicationId) => {
149
- if (applicationId.length === 0 || applicationId.length > APPLICATION_ID_MAX_LENGTH) {
150
- return false;
151
- }
152
- return APPLICATION_ID_PATTERN.test(applicationId);
153
- };
108
+ const validationSchema = configSchema.extend({ future: graduatedFutureSchema.optional() });
109
+ const isValidApplicationId = (applicationId) => applicationId.length <= APPLICATION_ID_MAX_LENGTH && APPLICATION_ID_PATTERN.test(applicationId);
154
110
  const resolveReactCompilerOptions = (setting) => {
155
111
  if (setting === false) {
156
112
  return null;
157
113
  }
158
114
  const overrides = setting === undefined || setting === true ? {} : setting;
159
- return { ...overrides, target: REACT_COMPILER_TARGET };
115
+ return {
116
+ ...(overrides.compilationMode !== undefined && { compilationMode: overrides.compilationMode }),
117
+ ...(overrides.panicThreshold !== undefined && { panicThreshold: overrides.panicThreshold }),
118
+ target: REACT_COMPILER_TARGET,
119
+ };
160
120
  };
161
- const isValidReactCompilerOption = (value, allowed) => value === undefined || (typeof value === "string" && allowed.has(value));
162
121
  const validateConfig = (config) => {
163
- const result = configSchema.safeParse(config);
122
+ const result = validationSchema.safeParse(config);
164
123
  if (!result.success) {
165
124
  throw configError(result.error);
166
125
  }
167
126
  };
127
+ const graduatedFutureKeys = (config) => {
128
+ if (!isRecord(config) || !isRecord(config.future)) {
129
+ return [];
130
+ }
131
+ return Object.keys(config.future).toSorted((first, second) => first.localeCompare(second));
132
+ };
168
133
  /**
169
134
  * Deep-merges a configuration over a base. `override` wins over `base` on conflicting scalar and object keys, while
170
135
  * arrays are concatenated with the `override` entries first.
@@ -192,16 +157,6 @@ const resolveMcpSettings = (config) => ({
192
157
  tools: config.mcp?.tools ?? [],
193
158
  isReadOnly: config.mcp?.readOnly === true,
194
159
  });
195
- const resolveFuture = (future) => ({
196
- isByteArrayTyped: future?.v2ByteArrays === true,
197
- isValueUnwrapped: future?.v2ValueReturns === true,
198
- isFinishTrimmed: future?.v2FinishResults === true,
199
- isInoutInPlace: future?.v2InoutReturns === true,
200
- isResourceImported: future?.v2ResourceImports === true,
201
- isAdwaitaDefault: future?.v2DefaultLibraries === true,
202
- isTreeShaken: future?.v2TreeShaking === true,
203
- });
204
- const unknownFutureKeys = (future) => Object.keys(future ?? {}).filter((key) => !FUTURE_KEYS.has(key));
205
160
  const resolveConfig = (config, root) => ({
206
161
  applicationId: config.applicationId,
207
162
  reactCompiler: resolveReactCompilerOptions(config.reactCompiler),
@@ -209,5 +164,5 @@ const resolveConfig = (config, root) => ({
209
164
  elements: resolveElementsModule(config.elements?.behaviors, root),
210
165
  lazyElements: resolveLazyElements(config.elements),
211
166
  });
212
- export { APPLICATION_ID_MAX_LENGTH, defineConfig, isAgentReferenceEnabled, isAgentRulesEnabled, isValidApplicationId, validateConfig, mergeConfig, resolveLazyElements, resolveElementComponents, resolveElementProps, resolveMcpSettings, resolveOmittedProps, resolveConfig, resolveFuture, unknownFutureKeys, };
167
+ export { APPLICATION_ID_MAX_LENGTH, defineConfig, isAgentReferenceEnabled, isAgentRulesEnabled, isValidApplicationId, graduatedFutureKeys, validateConfig, mergeConfig, resolveLazyElements, resolveElementComponents, resolveElementProps, resolveMcpSettings, resolveOmittedProps, resolveConfig, };
213
168
  //# sourceMappingURL=config.js.map
@@ -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,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAmElE,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,MAAM,sBAAsB,GAAG,uDAAuD,CAAC;AACvF,MAAM,yBAAyB,GAAG,GAAG,CAAC;AACtC,+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,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AM,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,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,iBAAiB,GAMpB,CAAC","sourcesContent":["import { createDefineConfig, type DefineConfig } from \"c12\";\nimport { defu } from \"defu\";\nimport { resolve } from \"node:path\";\nimport { z } from \"zod\";\nimport { configError, isRecord, rawIssue } from \"./config-error.ts\";\nimport { deploySchema } from \"./deploy.ts\";\nimport { DEPRECATION_IDS } from \"./deprecations.ts\";\nimport { isGirLibrary, text } from \"./schema-text.ts\";\nimport { resolveUserEventSignals } from \"./user-event-signals.ts\";\n\n/** Accepted `reactCompiler.compilationMode` values, choosing which functions the compiler processes. */\ntype ReactCompilerCompilationMode = (typeof COMPILATION_MODES)[number];\n/** Accepted `reactCompiler.panicThreshold` values, choosing which compiler diagnostics fail the build. */\ntype ReactCompilerPanicThreshold = (typeof PANIC_THRESHOLDS)[number];\n\n/** Object form of the `reactCompiler` config key, forwarded as-is to `babel-plugin-react-compiler`. */\ntype ReactCompilerOptions = {\n /** Which functions the compiler processes; left to the compiler's own default when omitted. */\n compilationMode?: ReactCompilerCompilationMode;\n /** Which compiler diagnostics fail the build; left to the compiler's own default when omitted. */\n panicThreshold?: ReactCompilerPanicThreshold;\n};\n\n/**\n * The React Compiler options the build hands to `babel-plugin-react-compiler`, with the React version\n * GTKX targets filled in.\n */\ntype ResolvedReactCompilerOptions = ReactCompilerOptions & {\n /** React major version the compiler emits for. */\n target: \"19\";\n};\n\n/**\n * User-facing configuration for a GTKX project, as authored in `gtkx.config.ts`: the GIR libraries\n * to bind and where to find them, the GApplication id, per-element configuration, the React\n * Compiler, codegen, and user event signal settings, the `agents` and `mcp` blocks controlling what\n * coding agents are given, the `future` block opting into behavior that becomes the default in the\n * next major version, and the `deprecations` block silencing the warnings about flags left unset.\n */\ntype Config = z.infer<typeof configSchema>;\ntype ModuleExport = z.infer<typeof moduleExportSchema>;\ntype ElementConfigEntry = z.infer<typeof elementConfigSchema>;\n\ntype McpSettings = {\n tools: string[];\n isReadOnly: boolean;\n};\n\ntype ResolvedFuture = {\n isByteArrayTyped: boolean;\n isValueUnwrapped: boolean;\n isFinishTrimmed: boolean;\n isInoutInPlace: boolean;\n isResourceImported: boolean;\n isAdwaitaDefault: boolean;\n isTreeShaken: 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 LIBRARIES_WILDCARD = \"*\";\nconst APPLICATION_ID_PATTERN = /^[A-Za-z_][A-Za-z0-9_-]*(\\.[A-Za-z_][A-Za-z0-9_-]*)+$/;\nconst APPLICATION_ID_MAX_LENGTH = 255;\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\";\nconst COMPILATION_MODE_SET: Set<string> = new Set(COMPILATION_MODES);\nconst PANIC_THRESHOLD_SET: Set<string> = new Set(PANIC_THRESHOLDS);\n\nconst librariesSchema = z.custom<typeof LIBRARIES_WILDCARD | string[]>().check((ctx) => {\n const value = ctx.value;\n\n if (value === LIBRARIES_WILDCARD) {\n return;\n }\n\n if (!Array.isArray(value) || value.length === 0) {\n ctx.issues.push(rawIssue(value, [], `must be \"${LIBRARIES_WILDCARD}\", a non-empty string array, or omitted`));\n\n return;\n }\n\n for (const [index, entry] of value.entries()) {\n ctx.issues.push(...libraryEntryIssues(value, index, entry));\n }\n});\n\nconst applicationIdSchema = z.custom<string>().check((ctx) => {\n const value = ctx.value;\n\n if (typeof value !== \"string\" || !isValidApplicationId(value)) {\n ctx.issues.push(\n rawIssue(\n value,\n [],\n `invalid \\`applicationId\\` \"${value}\", must satisfy g_application_id_is_valid ` +\n '(e.g. \"org.example.MyApp\")',\n true,\n ),\n );\n }\n});\n\nconst reactCompilerSchema = z.custom<boolean | ReactCompilerOptions>().check((ctx) => {\n const value = ctx.value;\n\n if (typeof value === \"boolean\") {\n return;\n }\n\n if (!isRecord(value)) {\n ctx.issues.push(rawIssue(value, [], \"must be a boolean or an options object\"));\n\n return;\n }\n\n const compilationMode = value.compilationMode;\n\n if (!isValidReactCompilerOption(compilationMode, COMPILATION_MODE_SET)) {\n ctx.issues.push(\n rawIssue(\n value,\n [],\n `invalid \\`reactCompiler.compilationMode\\` \"${String(compilationMode)}\", ` +\n `must be one of ${COMPILATION_MODES.join(\", \")}`,\n true,\n ),\n );\n }\n\n const panicThreshold = value.panicThreshold;\n\n if (!isValidReactCompilerOption(panicThreshold, PANIC_THRESHOLD_SET)) {\n ctx.issues.push(\n rawIssue(\n value,\n [],\n `invalid \\`reactCompiler.panicThreshold\\` \"${String(panicThreshold)}\", ` +\n `must be one of ${PANIC_THRESHOLDS.join(\", \")}`,\n true,\n ),\n );\n }\n});\n\nconst userEventSignalsSchema = z.record(\n z.string(),\n z.array(\n z.string({ error: \"must be a non-empty signal name\" }).min(1, { error: \"must be a non-empty signal name\" }),\n {\n error: \"must be an array of signal names\",\n },\n ),\n { error: \"must be a record of GLib type names to signal name arrays\" },\n);\n\nconst moduleExportSchema = z.object(\n {\n module: z.string({ error: \"must be a module specifier\" }).min(1, { error: \"must be a module specifier\" }),\n export: z.string({ error: \"must be an export name\" }).min(1, { error: \"must be an export name\" }),\n },\n { error: \"must be a { module, export } object\" },\n);\n\nconst elementConfigSchema = z.object({\n component: moduleExportSchema.optional(),\n props: moduleExportSchema.optional(),\n isLazy: z.boolean({ error: \"must be a boolean\" }).optional(),\n omittedProps: z\n .array(\n z.string({ error: \"must be a non-empty property name\" }).min(1, {\n error: \"must be a non-empty property name\",\n }),\n { error: \"must be an array of property names\" },\n )\n .optional(),\n});\n\nconst elementsSchema = z.object({\n behaviors: z\n .string({ error: \"must be a path to a module exporting element behaviors\" })\n .min(1, { error: \"must be a path to a module exporting element behaviors\" })\n .optional(),\n config: z.record(z.string(), elementConfigSchema).optional(),\n});\n\nconst agentsSchema = z.object({\n rules: z.boolean({ error: \"must be a boolean\" }).optional(),\n reference: z.boolean({ error: \"must be a boolean\" }).optional(),\n});\n\nconst mcpSchema = z.object({\n tools: z\n .array(z.string({ error: \"must be a tool name pattern\" }).min(1, { error: \"must be a tool name pattern\" }), {\n error: \"must be an array of tool name patterns\",\n })\n .optional(),\n readOnly: z.boolean({ error: \"must be a boolean\" }).optional(),\n});\n\nconst futureSchema = z.object({\n v2ByteArrays: z.boolean({ error: \"must be a boolean\" }).optional(),\n v2ValueReturns: z.boolean({ error: \"must be a boolean\" }).optional(),\n v2FinishResults: z.boolean({ error: \"must be a boolean\" }).optional(),\n v2InoutReturns: z.boolean({ error: \"must be a boolean\" }).optional(),\n v2ResourceImports: z.boolean({ error: \"must be a boolean\" }).optional(),\n v2DefaultLibraries: z.boolean({ error: \"must be a boolean\" }).optional(),\n v2TreeShaking: z.boolean({ error: \"must be a boolean\" }).optional(),\n});\n\nconst FUTURE_KEYS: Set<string> = new Set(Object.keys(futureSchema.shape));\nconst DEPRECATION_ID_ERROR = `must be one of ${DEPRECATION_IDS.join(\", \")}`;\n\nconst deprecationsSchema = z.object({\n silence: z\n .array(z.enum(DEPRECATION_IDS, { error: DEPRECATION_ID_ERROR }), {\n error: \"must be an array of deprecation ids\",\n })\n .optional(),\n});\n\n/** Schema every `gtkx.config.ts` is validated against, and the source of the {@link Config} type. */\nconst configSchema = z.object({\n future: futureSchema.optional(),\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>();\n\nconst libraryEntryIssues = (value: unknown[], index: number, entry: unknown): ReturnType<typeof rawIssue>[] => {\n if (typeof entry === \"string\" && isGirLibrary(entry)) {\n return [];\n }\n\n if (entry === LIBRARIES_WILDCARD) {\n const message =\n `to generate every library, set \\`libraries: \"${LIBRARIES_WILDCARD}\"\\` as a bare string, ` +\n \"not an array entry\";\n\n return [rawIssue(value, [index], message, true)];\n }\n\n const message =\n `invalid library identifier \"${String(entry)}\", must be of the form \"Name-Version\" ` +\n '(e.g. \"Gtk-4.0\")';\n\n return [rawIssue(value, [index], message, true)];\n};\n\nconst isValidApplicationId = (applicationId: string): boolean => {\n if (applicationId.length === 0 || applicationId.length > APPLICATION_ID_MAX_LENGTH) {\n return false;\n }\n\n return APPLICATION_ID_PATTERN.test(applicationId);\n};\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 { ...overrides, target: REACT_COMPILER_TARGET };\n};\n\nconst isValidReactCompilerOption = (value: unknown, allowed: Set<string>): boolean =>\n value === undefined || (typeof value === \"string\" && allowed.has(value));\n\nconst validateConfig = (config: Config): void => {\n const result = configSchema.safeParse(config);\n\n if (!result.success) {\n throw configError(result.error);\n }\n};\n\n/**\n * Deep-merges a configuration over a base. `override` wins over `base` on conflicting scalar and object keys, while\n * arrays are concatenated with the `override` entries first.\n */\nconst mergeConfig = (base: Config, override: Config): Config => defu(override, base);\n\nconst resolveElementsModule = (behaviors: string | undefined, root: string | undefined): string | null => {\n if (behaviors === undefined) {\n return null;\n }\n\n return root === undefined ? behaviors : resolve(root, behaviors);\n};\n\nconst resolveLazyElements = (elements: Config[\"elements\"]): string[] =>\n Object.entries(elements?.config ?? {})\n .filter(([, entry]) => entry.isLazy === true)\n .map(([type]) => type);\n\nconst elementEntryValues = <T>(\n elements: Config[\"elements\"],\n pick: (entry: ElementConfigEntry) => T | undefined,\n): Record<string, T> =>\n Object.fromEntries(\n Object.entries(elements?.config ?? {}).flatMap(([type, entry]) => {\n const value = pick(entry);\n\n return value === undefined ? [] : [[type, value] as const];\n }),\n );\n\nconst resolveElementComponents = (elements: Config[\"elements\"]): Record<string, ModuleExport> =>\n elementEntryValues(elements, (entry) => entry.component);\n\nconst resolveElementProps = (elements: Config[\"elements\"]): Record<string, ModuleExport> =>\n elementEntryValues(elements, (entry) => entry.props);\n\nconst resolveOmittedProps = (elements: Config[\"elements\"]): Record<string, string[]> =>\n elementEntryValues(elements, (entry) => entry.omittedProps);\n\nconst isAgentRulesEnabled = (config: Config): boolean => config.agents?.rules !== false;\nconst isAgentReferenceEnabled = (config: Config): boolean => config.agents?.reference !== false;\n\nconst resolveMcpSettings = (config: Config): McpSettings => ({\n tools: config.mcp?.tools ?? [],\n isReadOnly: config.mcp?.readOnly === true,\n});\n\nconst resolveFuture = (future: Config[\"future\"]): ResolvedFuture => ({\n isByteArrayTyped: future?.v2ByteArrays === true,\n isValueUnwrapped: future?.v2ValueReturns === true,\n isFinishTrimmed: future?.v2FinishResults === true,\n isInoutInPlace: future?.v2InoutReturns === true,\n isResourceImported: future?.v2ResourceImports === true,\n isAdwaitaDefault: future?.v2DefaultLibraries === true,\n isTreeShaken: future?.v2TreeShaking === true,\n});\n\nconst unknownFutureKeys = (future: Config[\"future\"]): string[] =>\n Object.keys(future ?? {}).filter((key) => !FUTURE_KEYS.has(key));\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 validateConfig,\n mergeConfig,\n resolveLazyElements,\n resolveElementComponents,\n resolveElementProps,\n resolveMcpSettings,\n resolveOmittedProps,\n resolveConfig,\n resolveFuture,\n unknownFutureKeys,\n type McpSettings,\n type ResolvedReactCompilerOptions,\n type Config,\n type ResolvedConfig,\n type ResolvedFuture,\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,CAA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,kBAAkB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;AAEhE,MAAM,mBAAmB,GAAG,CAAC,MAAc,EAAW,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,KAAK,KAAK,CAAC;AACxF,MAAM,uBAAuB,GAAG,CAAC,MAAc,EAAW,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,KAAK,KAAK,CAAC;AAEhG,MAAM,kBAAkB,GAAG,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,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,GAKhB,CAAC","sourcesContent":["import { createDefineConfig, type DefineConfig } from \"c12\";\nimport { defu } from \"defu\";\nimport { resolve } from \"node:path\";\nimport { z } from \"zod\";\nimport { configError, isRecord } from \"./config-error.ts\";\nimport { deploySchema } from \"./deploy.ts\";\nimport { girLibrary, text } from \"./schema-text.ts\";\nimport { resolveUserEventSignals } from \"./user-event-signals.ts\";\n\n/** Object form of the `reactCompiler` config key, forwarded to `babel-plugin-react-compiler`. */\ntype ReactCompilerOptions = {\n /** Which functions the compiler processes. */\n compilationMode?: (typeof COMPILATION_MODES)[number];\n /** Which compiler diagnostics fail the build. */\n panicThreshold?: (typeof PANIC_THRESHOLDS)[number];\n};\n\n/**\n * The React Compiler options the build hands to `babel-plugin-react-compiler`, with the React version\n * GTKX targets filled in.\n */\ntype ResolvedReactCompilerOptions = ReactCompilerOptions & {\n /** React major version the compiler emits for. */\n target: \"19\";\n};\n\n/**\n * User-facing configuration for a GTKX project, as authored in `gtkx.config.ts`: the GIR libraries\n * to bind and where to find them, the GApplication id, per-element configuration, the React\n * Compiler, codegen, and user event signal settings, and the `agents` and `mcp` blocks controlling\n * what coding agents are given.\n */\ntype Config = z.infer<typeof configSchema>;\ntype ModuleExport = z.infer<typeof moduleExportSchema>;\ntype ElementConfigEntry = z.infer<typeof elementConfigSchema>;\n\ntype McpSettings = {\n tools: string[];\n isReadOnly: boolean;\n};\n\n/** Configuration reduced to the values the app runtime and the build need, with paths already resolved. */\ntype ResolvedConfig = {\n /** The GApplication identifier the app registers under. */\n applicationId: string;\n /** React Compiler options for the build, or `null` when the compiler is disabled. */\n reactCompiler: ResolvedReactCompilerOptions | null;\n /**\n * Signal names, keyed by GLib type name, that stay suppressed while a React commit writes to a widget.\n * `notify` stays suppressed only for the property being written.\n */\n userEventSignals: Record<string, string[]>;\n /** Path of the module exporting per-element configs, or `null` when none is configured. */\n elements: string | null;\n /** GLib type names of the elements marked `isLazy`, whose GObject their parent container creates. */\n lazyElements: string[];\n};\n\nconst APPLICATION_ID_PATTERN = /^[A-Za-z_][A-Za-z0-9_-]*(\\.[A-Za-z_][A-Za-z0-9_-]*)+$/;\nconst APPLICATION_ID_MAX_LENGTH = 255;\nconst DEFAULT_LIBRARIES: Set<string> = new Set([\"Gtk-4.0\", \"Adw-1\"]);\n/** Compilation modes `babel-plugin-react-compiler` accepts. */\nconst COMPILATION_MODES = [\"infer\", \"syntax\", \"annotation\", \"all\"] as const;\n/** Panic thresholds `babel-plugin-react-compiler` accepts. */\nconst PANIC_THRESHOLDS = [\"none\", \"critical_errors\", \"all_errors\"] as const;\nconst REACT_COMPILER_TARGET = \"19\";\n\nconst librarySchema = girLibrary('must be of the form \"Name-Version\", such as \"Gtk-4.0\"')\n .refine((library) => !DEFAULT_LIBRARIES.has(library), { error: \"is bound by default; remove it\" });\n\nconst librariesSchema = z\n .array(librarySchema, { error: \"must be a non-empty string array or omitted\" })\n .min(1, { error: \"must be a non-empty string array or omitted\" });\n\nconst applicationIdSchema = z\n .string({ error: \"must satisfy g_application_id_is_valid\" })\n .refine((value) => isValidApplicationId(value), {\n error: 'must satisfy g_application_id_is_valid, such as \"org.example.MyApp\"',\n });\n\nconst reactCompilerSchema = z.union([\n z.boolean(),\n z.object({\n compilationMode: z.enum(COMPILATION_MODES).optional(),\n panicThreshold: z.enum(PANIC_THRESHOLDS).optional(),\n }),\n]);\n\nconst userEventSignalsSchema = z.record(\n z.string(),\n z.array(\n z.string({ error: \"must be a non-empty signal name\" }).min(1, { error: \"must be a non-empty signal name\" }),\n {\n error: \"must be an array of signal names\",\n },\n ),\n { error: \"must be a record of GLib type names to signal name arrays\" },\n);\n\nconst moduleExportSchema = z.object(\n {\n module: z.string({ error: \"must be a module specifier\" }).min(1, { error: \"must be a module specifier\" }),\n export: z.string({ error: \"must be an export name\" }).min(1, { error: \"must be an export name\" }),\n },\n { error: \"must be a { module, export } object\" },\n);\n\nconst elementConfigSchema = z.object({\n component: moduleExportSchema.optional(),\n props: moduleExportSchema.optional(),\n isLazy: z.boolean({ error: \"must be a boolean\" }).optional(),\n omittedProps: z\n .array(\n z.string({ error: \"must be a non-empty property name\" }).min(1, {\n error: \"must be a non-empty property name\",\n }),\n { error: \"must be an array of property names\" },\n )\n .optional(),\n});\n\nconst elementsSchema = z.object({\n behaviors: z\n .string({ error: \"must be a path to a module exporting element behaviors\" })\n .min(1, { error: \"must be a path to a module exporting element behaviors\" })\n .optional(),\n config: z.record(z.string(), elementConfigSchema).optional(),\n});\n\nconst agentsSchema = z.object({\n rules: z.boolean({ error: \"must be a boolean\" }).optional(),\n reference: z.boolean({ error: \"must be a boolean\" }).optional(),\n});\n\nconst mcpSchema = z.object({\n tools: z\n .array(z.string({ error: \"must be a tool name pattern\" }).min(1, { error: \"must be a tool name pattern\" }), {\n error: \"must be an array of tool name patterns\",\n })\n .optional(),\n readOnly: z.boolean({ error: \"must be a boolean\" }).optional(),\n});\n\nconst graduatedFutureSchema = z\n .object({\n v2ByteArrays: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n v2ValueReturns: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n v2FinishResults: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n v2InoutReturns: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n v2ResourceImports: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n v2DefaultLibraries: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n v2TreeShaking: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n })\n .strict();\n\nconst deprecationsSchema = z.object({\n silence: z\n .array(z.never({ error: \"does not name a current deprecation\" }), {\n error: \"must be an array of current deprecation ids\",\n })\n .optional(),\n});\n\n/** Schema every `gtkx.config.ts` is validated against, and the source of the {@link Config} type. */\nconst configSchema = z.object({\n libraries: librariesSchema.optional(),\n girPath: z.array(z.string(), { error: \"must be an array of strings if provided\" }).optional(),\n applicationId: applicationIdSchema,\n reactCompiler: reactCompilerSchema.optional(),\n codegen: z.boolean({ error: \"must be a boolean\" }).optional(),\n userEventSignals: userEventSignalsSchema.optional(),\n elements: elementsSchema.optional(),\n applicationIcon: text(\"must be a path to an icon theme directory or a single icon file\").optional(),\n deploy: deploySchema.optional(),\n agents: agentsSchema.optional(),\n mcp: mcpSchema.optional(),\n deprecations: deprecationsSchema.optional(),\n});\n\n/**\n * Returns the given configuration unchanged, typed as {@link Config}, so `gtkx.config.ts` gets\n * autocompletion and type checking.\n */\nconst defineConfig: DefineConfig<Config> = createDefineConfig<Config>();\nconst validationSchema = configSchema.extend({ future: graduatedFutureSchema.optional() });\n\nconst isValidApplicationId = (applicationId: string): boolean =>\n applicationId.length <= APPLICATION_ID_MAX_LENGTH && APPLICATION_ID_PATTERN.test(applicationId);\n\nconst resolveReactCompilerOptions = (setting: Config[\"reactCompiler\"]): ResolvedReactCompilerOptions | null => {\n if (setting === false) {\n return null;\n }\n\n const overrides = setting === undefined || setting === true ? {} : setting;\n\n return {\n ...(overrides.compilationMode !== undefined && { compilationMode: overrides.compilationMode }),\n ...(overrides.panicThreshold !== undefined && { panicThreshold: overrides.panicThreshold }),\n target: REACT_COMPILER_TARGET,\n };\n};\n\nconst validateConfig = (config: unknown): void => {\n const result = validationSchema.safeParse(config);\n\n if (!result.success) {\n throw configError(result.error);\n }\n};\n\nconst graduatedFutureKeys = (config: unknown): string[] => {\n if (!isRecord(config) || !isRecord(config.future)) {\n return [];\n }\n\n return Object.keys(config.future).toSorted((first, second) => first.localeCompare(second));\n};\n\n/**\n * Deep-merges a configuration over a base. `override` wins over `base` on conflicting scalar and object keys, while\n * arrays are concatenated with the `override` entries first.\n */\nconst mergeConfig = (base: Config, override: Config): Config => defu(override, base);\n\nconst resolveElementsModule = (behaviors: string | undefined, root: string | undefined): string | null => {\n if (behaviors === undefined) {\n return null;\n }\n\n return root === undefined ? behaviors : resolve(root, behaviors);\n};\n\nconst resolveLazyElements = (elements: Config[\"elements\"]): string[] =>\n Object.entries(elements?.config ?? {})\n .filter(([, entry]) => entry.isLazy === true)\n .map(([type]) => type);\n\nconst elementEntryValues = <T>(\n elements: Config[\"elements\"],\n pick: (entry: ElementConfigEntry) => T | undefined,\n): Record<string, T> =>\n Object.fromEntries(\n Object.entries(elements?.config ?? {}).flatMap(([type, entry]) => {\n const value = pick(entry);\n\n return value === undefined ? [] : [[type, value] as const];\n }),\n );\n\nconst resolveElementComponents = (elements: Config[\"elements\"]): Record<string, ModuleExport> =>\n elementEntryValues(elements, (entry) => entry.component);\n\nconst resolveElementProps = (elements: Config[\"elements\"]): Record<string, ModuleExport> =>\n elementEntryValues(elements, (entry) => entry.props);\n\nconst resolveOmittedProps = (elements: Config[\"elements\"]): Record<string, string[]> =>\n elementEntryValues(elements, (entry) => entry.omittedProps);\n\nconst isAgentRulesEnabled = (config: Config): boolean => config.agents?.rules !== false;\nconst isAgentReferenceEnabled = (config: Config): boolean => config.agents?.reference !== false;\n\nconst resolveMcpSettings = (config: Config): McpSettings => ({\n tools: config.mcp?.tools ?? [],\n isReadOnly: config.mcp?.readOnly === true,\n});\n\nconst resolveConfig = (config: Config, root?: string): ResolvedConfig => ({\n applicationId: config.applicationId,\n reactCompiler: resolveReactCompilerOptions(config.reactCompiler),\n userEventSignals: resolveUserEventSignals(config.userEventSignals),\n elements: resolveElementsModule(config.elements?.behaviors, root),\n lazyElements: resolveLazyElements(config.elements),\n});\n\nexport {\n APPLICATION_ID_MAX_LENGTH,\n defineConfig,\n isAgentReferenceEnabled,\n isAgentRulesEnabled,\n isValidApplicationId,\n graduatedFutureKeys,\n validateConfig,\n mergeConfig,\n resolveLazyElements,\n resolveElementComponents,\n resolveElementProps,\n resolveMcpSettings,\n resolveOmittedProps,\n resolveConfig,\n type McpSettings,\n type ResolvedReactCompilerOptions,\n type Config,\n type ResolvedConfig,\n};\n"]}