@gtkx/config 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -161,7 +161,7 @@ Explore the [example apps](https://github.com/gtkx-org/gtkx/tree/main/examples):
161
161
 
162
162
  ## Status
163
163
 
164
- GTKX 1.0 is released.
164
+ GTKX is stable and ready for production use.
165
165
 
166
166
  ## Contributing
167
167
 
@@ -11,6 +11,7 @@ declare const rawIssue: (input: unknown, path: IssuePath, message: string, isSta
11
11
  message: string;
12
12
  continue: true;
13
13
  };
14
+ declare const missingConfigFileError: (cwd: string) => Error;
14
15
  declare const configError: (error: z.ZodError) => Error;
15
- export { isRecord, rawIssue, configError };
16
+ export { isRecord, rawIssue, missingConfigFileError, configError };
16
17
  //# 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;AAIrC,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;AAwCH,QAAA,MAAM,WAAW,GAAI,OAAO,CAAC,CAAC,QAAQ,KAAG,KAQxC,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC"}
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,4 +1,5 @@
1
1
  const CONFIG_PREFIX = "gtkx.config.ts:";
2
+ const UNRECOGNIZED_KEY_REASON = "is not a recognized key";
2
3
  const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
3
4
  const rawIssue = (input, path, message, isStandalone = false) => ({
4
5
  code: "custom",
@@ -22,11 +23,21 @@ const dottedPath = (segments) => {
22
23
  return path;
23
24
  };
24
25
  const isStandaloneIssue = (issue) => "params" in issue && isRecord(issue.params) && issue.params.standalone === true;
25
- const formatIssue = (issue, fullPath) => {
26
+ const unrecognizedKeyPath = (issue, fullPath) => {
26
27
  if (issue.code === "unrecognized_keys") {
27
28
  const [key] = issue.keys;
28
- const path = dottedPath(key === undefined ? fullPath : [...fullPath, key]);
29
- return `${CONFIG_PREFIX} \`${path}\` is not a recognized key`;
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)}`;
30
41
  }
31
42
  if (isStandaloneIssue(issue)) {
32
43
  return `${CONFIG_PREFIX} ${issue.message}`;
@@ -34,6 +45,7 @@ const formatIssue = (issue, fullPath) => {
34
45
  const path = dottedPath(fullPath);
35
46
  return path === "" ? `${CONFIG_PREFIX} ${issue.message}` : `${CONFIG_PREFIX} \`${path}\` ${issue.message}`;
36
47
  };
48
+ const missingConfigFileError = (cwd) => new Error(`${CONFIG_PREFIX} no configuration file found in ${cwd}`);
37
49
  const configError = (error) => {
38
50
  const issue = error.issues[0];
39
51
  if (issue === undefined) {
@@ -41,5 +53,5 @@ const configError = (error) => {
41
53
  }
42
54
  return new Error(formatIssue(issue, issue.path));
43
55
  };
44
- export { isRecord, rawIssue, configError };
56
+ export { isRecord, rawIssue, missingConfigFileError, configError };
45
57
  //# 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;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,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,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C3B,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,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,WAAW,EAAE,CAAC","sourcesContent":["import type { z } from \"zod\";\n\ntype IssuePath = (string | number)[];\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 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 formatIssue = (issue: z.core.$ZodIssue, fullPath: PropertyKey[]): string => {\n if (issue.code === \"unrecognized_keys\") {\n const [key] = issue.keys;\n const path = dottedPath(key === undefined ? fullPath : [...fullPath, key]);\n\n return `${CONFIG_PREFIX} \\`${path}\\` is not a recognized key`;\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 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, configError };\n"]}
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,E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AK,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"]}
package/dist/config.d.ts CHANGED
@@ -21,8 +21,9 @@ type ResolvedReactCompilerOptions = ReactCompilerOptions & {
21
21
  };
22
22
  /**
23
23
  * User-facing configuration for a GTKX project, as authored in `gtkx.config.ts`: the GIR libraries
24
- * to bind and where to find them, the GApplication id, per-element configuration, and the React
25
- * Compiler, codegen, and user event signal settings.
24
+ * to bind and where to find them, the GApplication id, per-element configuration, the React
25
+ * Compiler, codegen, and user event signal settings, and the `future` block opting into behavior
26
+ * that becomes the default in the next major version.
26
27
  */
27
28
  type Config = z.infer<typeof configSchema>;
28
29
  type ModuleExport = z.infer<typeof moduleExportSchema>;
@@ -39,6 +40,7 @@ type ResolvedConfig = {
39
40
  /** GLib type names of the elements marked `isLazy`, whose GObject their parent container creates. */
40
41
  lazyElements: string[];
41
42
  };
43
+ declare const APPLICATION_ID_MAX_LENGTH = 255;
42
44
  /** Compilation modes `babel-plugin-react-compiler` accepts. */
43
45
  declare const COMPILATION_MODES: readonly ["infer", "syntax", "annotation", "all"];
44
46
  /** Panic thresholds `babel-plugin-react-compiler` accepts. */
@@ -49,6 +51,9 @@ declare const moduleExportSchema: z.ZodObject<{
49
51
  }, z.core.$strip>;
50
52
  /** Schema every `gtkx.config.ts` is validated against, and the source of the {@link Config} type. */
51
53
  declare const configSchema: z.ZodObject<{
54
+ future: z.ZodOptional<z.ZodObject<{
55
+ v2ByteArrays: z.ZodOptional<z.ZodBoolean>;
56
+ }, z.core.$strip>>;
52
57
  libraries: z.ZodOptional<z.ZodCustom<string[] | "*", string[] | "*">>;
53
58
  girPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
54
59
  applicationId: z.ZodCustom<string, string>;
@@ -70,6 +75,240 @@ declare const configSchema: z.ZodObject<{
70
75
  omittedProps: z.ZodOptional<z.ZodArray<z.ZodString>>;
71
76
  }, z.core.$strip>>>;
72
77
  }, z.core.$strip>>;
78
+ deploy: z.ZodOptional<z.ZodObject<{
79
+ targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
80
+ appimage: "appimage";
81
+ deb: "deb";
82
+ flatpak: "flatpak";
83
+ rpm: "rpm";
84
+ }>>>;
85
+ outDir: z.ZodOptional<z.ZodString>;
86
+ name: z.ZodOptional<z.ZodString>;
87
+ genericName: z.ZodOptional<z.ZodString>;
88
+ binaryName: z.ZodOptional<z.ZodString>;
89
+ version: z.ZodOptional<z.ZodString>;
90
+ release: z.ZodOptional<z.ZodString>;
91
+ epoch: z.ZodOptional<z.ZodInt>;
92
+ summary: z.ZodOptional<z.ZodString>;
93
+ description: z.ZodOptional<z.ZodArray<z.ZodString>>;
94
+ keywords: z.ZodOptional<z.ZodArray<z.ZodString>>;
95
+ categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
96
+ mimeTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
97
+ developer: z.ZodOptional<z.ZodObject<{
98
+ id: z.ZodOptional<z.ZodString>;
99
+ name: z.ZodOptional<z.ZodString>;
100
+ email: z.ZodOptional<z.ZodString>;
101
+ }, z.core.$strict>>;
102
+ license: z.ZodOptional<z.ZodString>;
103
+ licenseFile: z.ZodOptional<z.ZodString>;
104
+ metadataLicense: z.ZodOptional<z.ZodString>;
105
+ copyright: z.ZodOptional<z.ZodString>;
106
+ homepage: z.ZodOptional<z.ZodURL>;
107
+ urls: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
108
+ bugtracker: "bugtracker";
109
+ contact: "contact";
110
+ contribute: "contribute";
111
+ donation: "donation";
112
+ faq: "faq";
113
+ help: "help";
114
+ translate: "translate";
115
+ "vcs-browser": "vcs-browser";
116
+ }> & z.core.$partial, z.ZodURL>>;
117
+ icons: z.ZodOptional<z.ZodString>;
118
+ screenshots: z.ZodOptional<z.ZodArray<z.ZodObject<{
119
+ url: z.ZodOptional<z.ZodURL>;
120
+ file: z.ZodOptional<z.ZodString>;
121
+ caption: z.ZodOptional<z.ZodString>;
122
+ isDefault: z.ZodOptional<z.ZodBoolean>;
123
+ }, z.core.$strict>>>;
124
+ screenshotBaseUrl: z.ZodOptional<z.ZodURL>;
125
+ branding: z.ZodOptional<z.ZodObject<{
126
+ light: z.ZodString;
127
+ dark: z.ZodString;
128
+ }, z.core.$strict>>;
129
+ contentRating: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
130
+ none: "none";
131
+ intense: "intense";
132
+ mild: "mild";
133
+ moderate: "moderate";
134
+ }>>>;
135
+ releases: z.ZodOptional<z.ZodArray<z.ZodObject<{
136
+ version: z.ZodString;
137
+ date: z.ZodISODate;
138
+ type: z.ZodOptional<z.ZodEnum<{
139
+ development: "development";
140
+ snapshot: "snapshot";
141
+ stable: "stable";
142
+ }>>;
143
+ urgency: z.ZodOptional<z.ZodEnum<{
144
+ critical: "critical";
145
+ high: "high";
146
+ low: "low";
147
+ medium: "medium";
148
+ }>>;
149
+ notes: z.ZodOptional<z.ZodArray<z.ZodString>>;
150
+ url: z.ZodOptional<z.ZodURL>;
151
+ }, z.core.$strict>>>;
152
+ execArgs: z.ZodOptional<z.ZodArray<z.ZodString>>;
153
+ fileAssociations: z.ZodOptional<z.ZodArray<z.ZodObject<{
154
+ extension: z.ZodString;
155
+ mimeType: z.ZodString;
156
+ description: z.ZodOptional<z.ZodString>;
157
+ }, z.core.$strict>>>;
158
+ protocols: z.ZodOptional<z.ZodArray<z.ZodString>>;
159
+ desktopActions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
160
+ name: z.ZodString;
161
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
162
+ icon: z.ZodOptional<z.ZodString>;
163
+ }, z.core.$strict>>>;
164
+ desktopEntry: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
165
+ isDbusActivatable: z.ZodOptional<z.ZodBoolean>;
166
+ extraFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
167
+ depends: z.ZodOptional<z.ZodObject<{
168
+ deb: z.ZodOptional<z.ZodArray<z.ZodString>>;
169
+ rpm: z.ZodOptional<z.ZodArray<z.ZodString>>;
170
+ }, z.core.$strict>>;
171
+ relations: z.ZodOptional<z.ZodObject<{
172
+ recommends: z.ZodOptional<z.ZodObject<{
173
+ deb: z.ZodOptional<z.ZodArray<z.ZodString>>;
174
+ rpm: z.ZodOptional<z.ZodArray<z.ZodString>>;
175
+ }, z.core.$strict>>;
176
+ suggests: z.ZodOptional<z.ZodObject<{
177
+ deb: z.ZodOptional<z.ZodArray<z.ZodString>>;
178
+ rpm: z.ZodOptional<z.ZodArray<z.ZodString>>;
179
+ }, z.core.$strict>>;
180
+ provides: z.ZodOptional<z.ZodObject<{
181
+ deb: z.ZodOptional<z.ZodArray<z.ZodString>>;
182
+ rpm: z.ZodOptional<z.ZodArray<z.ZodString>>;
183
+ }, z.core.$strict>>;
184
+ conflicts: z.ZodOptional<z.ZodObject<{
185
+ deb: z.ZodOptional<z.ZodArray<z.ZodString>>;
186
+ rpm: z.ZodOptional<z.ZodArray<z.ZodString>>;
187
+ }, z.core.$strict>>;
188
+ replaces: z.ZodOptional<z.ZodObject<{
189
+ deb: z.ZodOptional<z.ZodArray<z.ZodString>>;
190
+ rpm: z.ZodOptional<z.ZodArray<z.ZodString>>;
191
+ }, z.core.$strict>>;
192
+ breaks: z.ZodOptional<z.ZodObject<{
193
+ deb: z.ZodOptional<z.ZodArray<z.ZodString>>;
194
+ rpm: z.ZodOptional<z.ZodArray<z.ZodString>>;
195
+ }, z.core.$strict>>;
196
+ preDepends: z.ZodOptional<z.ZodObject<{
197
+ deb: z.ZodOptional<z.ZodArray<z.ZodString>>;
198
+ rpm: z.ZodOptional<z.ZodArray<z.ZodString>>;
199
+ }, z.core.$strict>>;
200
+ }, z.core.$strict>>;
201
+ scripts: z.ZodOptional<z.ZodObject<{
202
+ preInstall: z.ZodOptional<z.ZodString>;
203
+ postInstall: z.ZodOptional<z.ZodString>;
204
+ preRemove: z.ZodOptional<z.ZodString>;
205
+ postRemove: z.ZodOptional<z.ZodString>;
206
+ }, z.core.$strict>>;
207
+ node: z.ZodOptional<z.ZodObject<{
208
+ source: z.ZodOptional<z.ZodEnum<{
209
+ path: "path";
210
+ download: "download";
211
+ host: "host";
212
+ }>>;
213
+ version: z.ZodOptional<z.ZodString>;
214
+ path: z.ZodOptional<z.ZodString>;
215
+ shouldStrip: z.ZodOptional<z.ZodBoolean>;
216
+ shouldUseCompileCache: z.ZodOptional<z.ZodBoolean>;
217
+ }, z.core.$strict>>;
218
+ signing: z.ZodOptional<z.ZodObject<{
219
+ appimage: z.ZodOptional<z.ZodObject<{
220
+ gpgKeyId: z.ZodString;
221
+ }, z.core.$strict>>;
222
+ deb: z.ZodOptional<z.ZodObject<{
223
+ keyFile: z.ZodString;
224
+ keyId: z.ZodOptional<z.ZodString>;
225
+ method: z.ZodOptional<z.ZodEnum<{
226
+ debsign: "debsign";
227
+ "dpkg-sig": "dpkg-sig";
228
+ }>>;
229
+ type: z.ZodOptional<z.ZodEnum<{
230
+ origin: "origin";
231
+ archive: "archive";
232
+ maint: "maint";
233
+ }>>;
234
+ signer: z.ZodOptional<z.ZodString>;
235
+ }, z.core.$strict>>;
236
+ flatpak: z.ZodOptional<z.ZodObject<{
237
+ gpgKeyId: z.ZodString;
238
+ gpgHomeDir: z.ZodOptional<z.ZodString>;
239
+ }, z.core.$strict>>;
240
+ rpm: z.ZodOptional<z.ZodObject<{
241
+ keyFile: z.ZodString;
242
+ keyId: z.ZodOptional<z.ZodString>;
243
+ }, z.core.$strict>>;
244
+ }, z.core.$strict>>;
245
+ appimage: z.ZodOptional<z.ZodObject<{
246
+ fileName: z.ZodOptional<z.ZodString>;
247
+ compression: z.ZodOptional<z.ZodEnum<{
248
+ gzip: "gzip";
249
+ xz: "xz";
250
+ zstd: "zstd";
251
+ }>>;
252
+ updateInformation: z.ZodOptional<z.ZodString>;
253
+ runtimeFile: z.ZodOptional<z.ZodString>;
254
+ }, z.core.$strict>>;
255
+ deb: z.ZodOptional<z.ZodObject<{
256
+ packageName: z.ZodOptional<z.ZodString>;
257
+ section: z.ZodOptional<z.ZodString>;
258
+ priority: z.ZodOptional<z.ZodString>;
259
+ compression: z.ZodOptional<z.ZodEnum<{
260
+ gzip: "gzip";
261
+ xz: "xz";
262
+ zstd: "zstd";
263
+ none: "none";
264
+ }>>;
265
+ fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
266
+ }, z.core.$strict>>;
267
+ flatpak: z.ZodOptional<z.ZodObject<{
268
+ mode: z.ZodOptional<z.ZodEnum<{
269
+ prebuilt: "prebuilt";
270
+ source: "source";
271
+ }>>;
272
+ runtime: z.ZodOptional<z.ZodString>;
273
+ runtimeVersion: z.ZodOptional<z.ZodString>;
274
+ sdk: z.ZodOptional<z.ZodString>;
275
+ nodeExtension: z.ZodOptional<z.ZodString>;
276
+ sdkExtensions: z.ZodOptional<z.ZodArray<z.ZodString>>;
277
+ base: z.ZodOptional<z.ZodString>;
278
+ baseVersion: z.ZodOptional<z.ZodString>;
279
+ branch: z.ZodOptional<z.ZodString>;
280
+ finishArgs: z.ZodOptional<z.ZodArray<z.ZodString>>;
281
+ cleanup: z.ZodOptional<z.ZodArray<z.ZodString>>;
282
+ buildCommands: z.ZodOptional<z.ZodArray<z.ZodString>>;
283
+ modules: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
284
+ source: z.ZodOptional<z.ZodObject<{
285
+ url: z.ZodOptional<z.ZodURL>;
286
+ tag: z.ZodOptional<z.ZodString>;
287
+ commit: z.ZodOptional<z.ZodString>;
288
+ }, z.core.$strict>>;
289
+ packageManager: z.ZodOptional<z.ZodEnum<{
290
+ npm: "npm";
291
+ pnpm: "pnpm";
292
+ yarn: "yarn";
293
+ }>>;
294
+ lockfile: z.ZodOptional<z.ZodString>;
295
+ runtimeRepo: z.ZodOptional<z.ZodURL>;
296
+ shouldEmitBundle: z.ZodOptional<z.ZodBoolean>;
297
+ shouldInstall: z.ZodOptional<z.ZodBoolean>;
298
+ shouldUseRofilesFuse: z.ZodOptional<z.ZodBoolean>;
299
+ }, z.core.$strict>>;
300
+ rpm: z.ZodOptional<z.ZodObject<{
301
+ packageName: z.ZodOptional<z.ZodString>;
302
+ group: z.ZodOptional<z.ZodString>;
303
+ compression: z.ZodOptional<z.ZodEnum<{
304
+ gzip: "gzip";
305
+ xz: "xz";
306
+ zstd: "zstd";
307
+ lzma: "lzma";
308
+ }>>;
309
+ prefixes: z.ZodOptional<z.ZodArray<z.ZodString>>;
310
+ }, z.core.$strict>>;
311
+ }, z.core.$strict>>;
73
312
  }, z.core.$strip>;
74
313
  /**
75
314
  * Returns the given configuration unchanged, typed as {@link Config}, so `gtkx.config.ts` gets
@@ -77,7 +316,6 @@ declare const configSchema: z.ZodObject<{
77
316
  */
78
317
  declare const defineConfig: DefineConfig<Config>;
79
318
  declare const isValidApplicationId: (applicationId: string) => boolean;
80
- declare const resolveReactCompilerOptions: (setting: Config["reactCompiler"]) => ResolvedReactCompilerOptions | null;
81
319
  declare const validateConfig: (config: Config) => void;
82
320
  /**
83
321
  * Deep-merges two configurations. `override` wins over `base` on conflicting scalar and object keys, while
@@ -89,5 +327,5 @@ declare const resolveElementComponents: (elements: Config["elements"]) => Record
89
327
  declare const resolveElementProps: (elements: Config["elements"]) => Record<string, ModuleExport>;
90
328
  declare const resolveOmittedProps: (elements: Config["elements"]) => Record<string, string[]>;
91
329
  declare const resolveConfig: (config: Config, root?: string) => ResolvedConfig;
92
- export { defineConfig, isValidApplicationId, resolveReactCompilerOptions, validateConfig, mergeConfig, resolveLazyElements, resolveElementComponents, resolveElementProps, resolveOmittedProps, resolveConfig, type ResolvedReactCompilerOptions, type Config, type ResolvedConfig, };
330
+ export { APPLICATION_ID_MAX_LENGTH, defineConfig, isValidApplicationId, validateConfig, mergeConfig, resolveLazyElements, resolveElementComponents, resolveElementProps, resolveOmittedProps, resolveConfig, type ResolvedReactCompilerOptions, type Config, type ResolvedConfig, };
93
331
  //# 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;AAIxB,wGAAwG;AACxG,KAAK,4BAA4B,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AACvE,0GAA0G;AAC1G,KAAK,2BAA2B,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAErE,uGAAuG;AACvG,KAAK,oBAAoB,GAAG;IACxB,+FAA+F;IAC/F,eAAe,CAAC,EAAE,4BAA4B,CAAC;IAC/C,kGAAkG;IAClG,cAAc,CAAC,EAAE,2BAA2B,CAAC;CAChD,CAAC;AAEF;;;GAGG;AACH,KAAK,4BAA4B,GAAG,oBAAoB,GAAG;IACvD,kDAAkD;IAClD,MAAM,EAAE,IAAI,CAAC;CAChB,CAAC;AAEF;;;;GAIG;AACH,KAAK,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAC3C,KAAK,YAA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AACH,QAAA,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,UAAU,MAAM,KAAG,MAA8B,CAAC;AAUrF,QAAA,MAAM,mBAAmB,GAAI,UAAU,MAAM,CAAC,UAAU,CAAC,KAAG,MAAM,EAGpC,CAAC;AAc/B,QAAA,MAAM,wBAAwB,GAAI,UAAU,MAAM,CAAC,UAAU,CAAC,KAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAChC,CAAC;AAE7D,QAAA,MAAM,mBAAmB,GAAI,UAAU,MAAM,CAAC,UAAU,CAAC,KAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAC/B,CAAC;AAEzD,QAAA,MAAM,mBAAmB,GAAI,UAAU,MAAM,CAAC,UAAU,CAAC,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CACpB,CAAC;AAEhE,QAAA,MAAM,aAAa,GAAI,QAAQ,MAAM,EAAE,OAAO,MAAM,KAAG,cAMrD,CAAC;AAEH,OAAO,EACH,yBAAyB,EACzB,YAAY,EACZ,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,KAAK,4BAA4B,EACjC,KAAK,MAAM,EACX,KAAK,cAAc,GACtB,CAAC"}
package/dist/config.js CHANGED
@@ -3,6 +3,7 @@ import { defu } from "defu";
3
3
  import { resolve } from "node:path";
4
4
  import { z } from "zod";
5
5
  import { configError, isRecord, rawIssue } from "./config-error.js";
6
+ import { deploySchema } from "./deploy.js";
6
7
  import { resolveUserEventSignals } from "./user-event-signals.js";
7
8
  const LIBRARIES_WILDCARD = "*";
8
9
  const GIR_LIBRARY_PATTERN = /^[A-Za-z][A-Za-z0-9]*-\d+(?:\.\d+)*$/;
@@ -79,8 +80,12 @@ const elementsSchema = z.object({
79
80
  .optional(),
80
81
  config: z.record(z.string(), elementConfigSchema).optional(),
81
82
  });
83
+ const futureSchema = z.object({
84
+ v2ByteArrays: z.boolean({ error: "must be a boolean" }).optional(),
85
+ });
82
86
  /** Schema every `gtkx.config.ts` is validated against, and the source of the {@link Config} type. */
83
87
  const configSchema = z.object({
88
+ future: futureSchema.optional(),
84
89
  libraries: librariesSchema.optional(),
85
90
  girPath: z.array(z.string(), { error: "must be an array of strings if provided" }).optional(),
86
91
  applicationId: applicationIdSchema,
@@ -88,6 +93,7 @@ const configSchema = z.object({
88
93
  codegen: z.boolean({ error: "must be a boolean" }).optional(),
89
94
  userEventSignals: userEventSignalsSchema.optional(),
90
95
  elements: elementsSchema.optional(),
96
+ deploy: deploySchema.optional(),
91
97
  });
92
98
  /**
93
99
  * Returns the given configuration unchanged, typed as {@link Config}, so `gtkx.config.ts` gets
@@ -155,5 +161,5 @@ const resolveConfig = (config, root) => ({
155
161
  elements: resolveElementsModule(config.elements?.behaviors, root),
156
162
  lazyElements: resolveLazyElements(config.elements),
157
163
  });
158
- export { defineConfig, isValidApplicationId, resolveReactCompilerOptions, validateConfig, mergeConfig, resolveLazyElements, resolveElementComponents, resolveElementProps, resolveOmittedProps, resolveConfig, };
164
+ export { APPLICATION_ID_MAX_LENGTH, defineConfig, isValidApplicationId, validateConfig, mergeConfig, resolveLazyElements, resolveElementComponents, resolveElementProps, resolveOmittedProps, resolveConfig, };
159
165
  //# 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,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AA+ClE,MAAM,k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ACnB,aAAa,GAIhB,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 { 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, and the React\n * Compiler, codegen, and user event signal settings.\n */\ntype Config = z.infer<typeof configSchema>;\ntype ModuleExport = z.infer<typeof moduleExportSchema>;\ntype ElementConfigEntry = z.infer<typeof elementConfigSchema>;\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 /** Signal names, keyed by GLib type name, that stay suppressed while a React commit runs. */\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 GIR_LIBRARY_PATTERN = /^[A-Za-z][A-Za-z0-9]*-\\d+(?:\\.\\d+)*$/;\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\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});\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\" && GIR_LIBRARY_PATTERN.test(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 two configurations. `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 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 defineConfig,\n isValidApplicationId,\n resolveReactCompilerOptions,\n validateConfig,\n mergeConfig,\n resolveLazyElements,\n resolveElementComponents,\n resolveElementProps,\n resolveOmittedProps,\n resolveConfig,\n type ResolvedReactCompilerOptions,\n type Config,\n type ResolvedConfig,\n};\n"]}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAqB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,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M,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,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,GAIhB,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 { 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, and the `future` block opting into behavior\n * that becomes the default in the next major version.\n */\ntype Config = z.infer<typeof configSchema>;\ntype ModuleExport = z.infer<typeof moduleExportSchema>;\ntype ElementConfigEntry = z.infer<typeof elementConfigSchema>;\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 /** Signal names, keyed by GLib type name, that stay suppressed while a React commit runs. */\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 GIR_LIBRARY_PATTERN = /^[A-Za-z][A-Za-z0-9]*-\\d+(?:\\.\\d+)*$/;\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 futureSchema = z.object({\n v2ByteArrays: z.boolean({ error: \"must be a boolean\" }).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 deploy: deploySchema.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\" && GIR_LIBRARY_PATTERN.test(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 two configurations. `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 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 isValidApplicationId,\n validateConfig,\n mergeConfig,\n resolveLazyElements,\n resolveElementComponents,\n resolveElementProps,\n resolveOmittedProps,\n resolveConfig,\n type ResolvedReactCompilerOptions,\n type Config,\n type ResolvedConfig,\n};\n"]}