@gtkx/config 2.0.0-beta.8 → 2.0.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.
Files changed (69) hide show
  1. package/README.md +11 -169
  2. package/dist/builtin-elements.d.ts +23 -0
  3. package/dist/builtin-elements.d.ts.map +1 -0
  4. package/dist/builtin-elements.js +366 -0
  5. package/dist/builtin-elements.js.map +1 -0
  6. package/dist/config-dependencies.d.ts +5 -3
  7. package/dist/config-dependencies.d.ts.map +1 -1
  8. package/dist/config-dependencies.js +57 -24
  9. package/dist/config-dependencies.js.map +1 -1
  10. package/dist/config-error.d.ts.map +1 -1
  11. package/dist/config-error.js.map +1 -1
  12. package/dist/config-reloader.d.ts +8 -0
  13. package/dist/config-reloader.d.ts.map +1 -0
  14. package/dist/config-reloader.js +32 -0
  15. package/dist/config-reloader.js.map +1 -0
  16. package/dist/config-source.d.ts +9 -0
  17. package/dist/config-source.d.ts.map +1 -0
  18. package/dist/config-source.js +35 -0
  19. package/dist/config-source.js.map +1 -0
  20. package/dist/config.d.ts +286 -53
  21. package/dist/config.d.ts.map +1 -1
  22. package/dist/config.js +42 -27
  23. package/dist/config.js.map +1 -1
  24. package/dist/deploy.d.ts +949 -20
  25. package/dist/deploy.d.ts.map +1 -1
  26. package/dist/deploy.js +17 -15
  27. package/dist/deploy.js.map +1 -1
  28. package/dist/index.d.ts +8 -3
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +6 -1
  31. package/dist/index.js.map +1 -1
  32. package/dist/internal.d.ts +5 -3
  33. package/dist/internal.d.ts.map +1 -1
  34. package/dist/internal.js +5 -3
  35. package/dist/internal.js.map +1 -1
  36. package/dist/loader.d.ts +23 -5
  37. package/dist/loader.d.ts.map +1 -1
  38. package/dist/loader.js +58 -42
  39. package/dist/loader.js.map +1 -1
  40. package/dist/node-version.d.ts +2 -1
  41. package/dist/node-version.d.ts.map +1 -1
  42. package/dist/node-version.js +2 -1
  43. package/dist/node-version.js.map +1 -1
  44. package/dist/resource-base-path.d.ts.map +1 -1
  45. package/dist/schema-text.d.ts.map +1 -1
  46. package/dist/user-event-signals.d.ts.map +1 -1
  47. package/dist/virtual.d.ts +1 -1
  48. package/dist/virtual.d.ts.map +1 -1
  49. package/dist/virtual.js +4 -4
  50. package/dist/virtual.js.map +1 -1
  51. package/dist/vite-plugin.d.ts +7 -0
  52. package/dist/vite-plugin.d.ts.map +1 -1
  53. package/dist/vite-plugin.js +13 -4
  54. package/dist/vite-plugin.js.map +1 -1
  55. package/dist/vite-root.d.ts.map +1 -1
  56. package/package.json +15 -16
  57. package/src/builtin-elements.ts +377 -0
  58. package/src/config-dependencies.ts +65 -29
  59. package/src/config-error.ts +5 -3
  60. package/src/config-reloader.ts +45 -0
  61. package/src/config-source.ts +52 -0
  62. package/src/config.ts +316 -49
  63. package/src/deploy.ts +1029 -59
  64. package/src/index.ts +47 -3
  65. package/src/internal.ts +6 -2
  66. package/src/loader.ts +103 -54
  67. package/src/node-version.ts +2 -1
  68. package/src/virtual.ts +6 -6
  69. package/src/vite-plugin.ts +24 -5
package/dist/config.d.ts CHANGED
@@ -1,11 +1,20 @@
1
1
  import { type DefineConfig } from "c12";
2
2
  import { z } from "zod";
3
+ import { type DeployOptions } from "./deploy.ts";
3
4
  /** Object form of the `reactCompiler` config key, forwarded to `babel-plugin-react-compiler`. */
4
5
  type ReactCompilerOptions = {
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];
6
+ /**
7
+ * Which functions the React Compiler processes.
8
+ *
9
+ * @defaultValue `"infer"`, the React Compiler's own default
10
+ */
11
+ compilationMode?: "all" | "annotation" | "infer" | "syntax" | undefined;
12
+ /**
13
+ * Which React Compiler diagnostics fail the build.
14
+ *
15
+ * @defaultValue `"none"`, the React Compiler's own default
16
+ */
17
+ panicThreshold?: "all_errors" | "critical_errors" | "none" | undefined;
9
18
  };
10
19
  /**
11
20
  * The React Compiler options the build hands to `babel-plugin-react-compiler`, with the React version
@@ -16,13 +25,225 @@ type ResolvedReactCompilerOptions = ReactCompilerOptions & {
16
25
  target: "19";
17
26
  };
18
27
  /**
19
- * User-facing configuration for a GTKX project, as authored in `gtkx.config.ts`: the GIR libraries
20
- * to bind and where to find them, the GApplication id, per-element configuration, the React
21
- * Compiler, codegen, and user event signal settings, and the `agents` and `mcp` blocks controlling
22
- * what coding agents are given.
28
+ * GTKX project configuration authored in `gtkx.config.ts` and validated when loaded.
29
+ *
30
+ * [Configuration and Codegen](https://gtkx.dev/v2/guide/configuration-and-codegen) shows how to set up the file
31
+ * and what codegen generates from it.
23
32
  */
24
- type Config = z.infer<typeof configSchema>;
25
- type ModuleExport = z.infer<typeof moduleExportSchema>;
33
+ type Config = {
34
+ /**
35
+ * Additional GIR libraries to bind, such as `WebKit-6.0`.
36
+ * Adwaita and GTK are included implicitly and must not be listed.
37
+ *
38
+ * @defaultValue None: GTKX binds `Adw-1`, `Gtk-4.0` and the libraries they depend on
39
+ */
40
+ libraries?: string[] | undefined;
41
+ /**
42
+ * Additional GIR search directories, searched before the system ones. Relative paths are resolved from the
43
+ * project root.
44
+ *
45
+ * @defaultValue None: GTKX searches `/usr/share/gir-1.0` and the GIR directories pkg-config reports for
46
+ * `gobject-introspection-1.0`
47
+ */
48
+ girPath?: string[] | undefined;
49
+ /**
50
+ * GApplication identifier, such as `com.example.Tasks`. Required to run, build or deploy the project as an
51
+ * application; a package that is not an application, such as a component library, leaves it out.
52
+ *
53
+ * @defaultValue None: the project loads as a package, with `isApplication` set to `false`
54
+ */
55
+ applicationId?: string | undefined;
56
+ /**
57
+ * Whether to enable the React Compiler, or options passed to it. `false` disables it.
58
+ *
59
+ * @defaultValue `true`
60
+ * @example
61
+ * ```ts
62
+ * reactCompiler: { compilationMode: "annotation" },
63
+ * ```
64
+ */
65
+ reactCompiler?: boolean | ReactCompilerOptions | undefined;
66
+ /**
67
+ * Whether GTKX generates project bindings. Set to `false` to reuse an installed binding store.
68
+ *
69
+ * @defaultValue `true`
70
+ */
71
+ codegen?: boolean | undefined;
72
+ /**
73
+ * Additional signals to suppress during React property updates, keyed by GLib type name.
74
+ * Entries extend the built-in signal lists.
75
+ *
76
+ * @defaultValue `{}`: only the built-in lists
77
+ */
78
+ userEventSignals?: Record<string, string[]> | undefined;
79
+ /**
80
+ * Custom element behaviors and overrides for generated components, props, and documentation.
81
+ *
82
+ * @defaultValue `{}`: no custom behaviors or overrides
83
+ */
84
+ elements?: ElementsOptions | undefined;
85
+ /**
86
+ * Path to an icon theme directory or a single SVG, PNG or XPM application icon file, relative to the project
87
+ * root. Deployment requires an icon.
88
+ *
89
+ * @defaultValue The one `<applicationId>.svg`, `.png` or `.xpm` file in the project root, if exactly one
90
+ * exists
91
+ */
92
+ applicationIcon?: string | undefined;
93
+ /**
94
+ * Application metadata, bundled runtime settings, and packaging options used by `gtkx deploy`.
95
+ *
96
+ * @defaultValue `{}`: metadata comes from `package.json` and packaging builds a Flatpak
97
+ */
98
+ deploy?: DeployOptions | undefined;
99
+ /**
100
+ * Controls the project instructions and reference files generated for coding agents.
101
+ *
102
+ * @defaultValue `{}`: an application gets both, a package neither
103
+ */
104
+ agents?: AgentsOptions | undefined;
105
+ /**
106
+ * Default tool selection and access mode for the project's MCP server. The `gtkx mcp` flags `--tools` and
107
+ * `--read-only` take precedence.
108
+ *
109
+ * @defaultValue `{}`: every tool, app interactions included
110
+ */
111
+ mcp?: McpOptions | undefined;
112
+ /**
113
+ * Controls warnings for deprecated configuration and behavior.
114
+ *
115
+ * @defaultValue `{}`: every deprecation warning is shown
116
+ */
117
+ deprecations?: DeprecationsOptions | undefined;
118
+ };
119
+ /** A {@link Config} whose `applicationId` is known, as loaded for an application. */
120
+ type ApplicationConfig = Config & {
121
+ applicationId: string;
122
+ };
123
+ /** A named export of a module, which `elements.config` entries reference for components and props. */
124
+ type ModuleExport = {
125
+ /** Module specifier containing the named export; relative paths start at the project root. */
126
+ module: string;
127
+ /** Name of the export to import from the module. */
128
+ export: string;
129
+ };
130
+ /** The props type an `elements.config` entry adds to a generated element, and how it combines with them. */
131
+ type ElementPropsExport = {
132
+ /** Module specifier containing the named export; relative paths start at the project root. */
133
+ module: string;
134
+ /** Name of the props type to import from the module. */
135
+ export: string;
136
+ /**
137
+ * How the exported props are combined: `intersection` is inherited; `factory` applies only to this type.
138
+ *
139
+ * @defaultValue `"intersection"`
140
+ */
141
+ composition?: "factory" | "intersection" | undefined;
142
+ /**
143
+ * Props that can only be set when the element is created; changing them afterward throws.
144
+ *
145
+ * @defaultValue `[]`
146
+ */
147
+ constructOnly?: string[] | undefined;
148
+ };
149
+ /** Overrides for one GLib type in `elements.config`, keyed by its registered type name. */
150
+ type ElementConfigOptions = {
151
+ /**
152
+ * Component export that wraps the generated element.
153
+ *
154
+ * @defaultValue None: no wrapper `component`
155
+ */
156
+ component?: ModuleExport | undefined;
157
+ /**
158
+ * Additional props type to combine with the generated element props.
159
+ *
160
+ * @defaultValue None: no extra `props` type
161
+ */
162
+ props?: ElementPropsExport | undefined;
163
+ /**
164
+ * Whether the parent container creates this element's GObject instead of the element constructing its own.
165
+ * Subtypes inherit the setting.
166
+ *
167
+ * @defaultValue `false`
168
+ */
169
+ isLazy?: boolean | undefined;
170
+ /**
171
+ * Accepted child GLib type names to show in the generated element documentation.
172
+ *
173
+ * @defaultValue `[]`
174
+ */
175
+ acceptedChildTypes?: string[] | undefined;
176
+ /**
177
+ * GObject properties to leave out of generated props, such as properties managed by an element behavior.
178
+ *
179
+ * @defaultValue `[]`: every GObject property becomes a prop
180
+ */
181
+ omittedProps?: string[] | undefined;
182
+ };
183
+ /** The `elements` options: custom element behaviors and per-type overrides for generated elements. */
184
+ type ElementsOptions = {
185
+ /**
186
+ * Path, relative to the project root, of the module exporting the element behavior map.
187
+ *
188
+ * @defaultValue None: only the behaviors built into `@gtkx/react` apply
189
+ */
190
+ behaviors?: string | undefined;
191
+ /**
192
+ * Element configuration overrides keyed by GLib type name, such as `GtkWidget`.
193
+ *
194
+ * @defaultValue `{}`
195
+ */
196
+ config?: Record<string, ElementConfigOptions> | undefined;
197
+ };
198
+ /** The `agents` options: which files codegen maintains for coding agents. */
199
+ type AgentsOptions = {
200
+ /**
201
+ * Whether codegen maintains the GTKX rules in `AGENTS.md` and creates a missing `CLAUDE.md` import.
202
+ * `false` removes rules written earlier, deleting `AGENTS.md` and the `CLAUDE.md` import when nothing else
203
+ * remains.
204
+ *
205
+ * @defaultValue `true` for an application, `false` for a package without an `applicationId`
206
+ */
207
+ rules?: boolean | undefined;
208
+ /**
209
+ * Whether codegen writes the generated element reference to `.gtkx/reference` and points the rules at it.
210
+ * `false` removes a reference generated earlier.
211
+ *
212
+ * @defaultValue `true` for an application, `false` for a package without an `applicationId`
213
+ */
214
+ reference?: boolean | undefined;
215
+ };
216
+ /** The `mcp` options: the tools `gtkx mcp` offers by default and whether it may interact with the app. */
217
+ type McpOptions = {
218
+ /**
219
+ * Tool name patterns applied in order: `*` matches any text and a leading `!` excludes matches.
220
+ * Omitted, empty, or exclusion-only lists start with all tools; other lists start with none.
221
+ * `gtkx mcp --tools` overrides it.
222
+ *
223
+ * @defaultValue `[]`: every tool
224
+ * @example
225
+ * ```ts
226
+ * tools: ["gtkx_*", "!gtkx_take_screenshot"],
227
+ * ```
228
+ */
229
+ tools?: string[] | undefined;
230
+ /**
231
+ * Whether the MCP server exposes only inspection and reference tools, excluding app interactions.
232
+ * `gtkx mcp --read-only` overrides it.
233
+ *
234
+ * @defaultValue `false`
235
+ */
236
+ readOnly?: boolean | undefined;
237
+ };
238
+ /** The `deprecations` options: which deprecation warnings stay silent. */
239
+ type DeprecationsOptions = {
240
+ /**
241
+ * Deprecation identifiers whose warnings are suppressed. There are currently no accepted identifiers.
242
+ *
243
+ * @defaultValue `[]`
244
+ */
245
+ silence?: never[] | undefined;
246
+ };
26
247
  type McpSettings = {
27
248
  tools: string[];
28
249
  isReadOnly: boolean;
@@ -31,6 +252,8 @@ type McpSettings = {
31
252
  type ResolvedConfig = {
32
253
  /** The GApplication identifier the app registers under. */
33
254
  applicationId: string;
255
+ /** The gettext domain, which is the `applicationId` production builds use. */
256
+ translationDomain: string;
34
257
  /** React Compiler options for the build, or `null` when the compiler is disabled. */
35
258
  reactCompiler: ResolvedReactCompilerOptions | null;
36
259
  /**
@@ -44,32 +267,25 @@ type ResolvedConfig = {
44
267
  lazyElements: string[];
45
268
  };
46
269
  declare const APPLICATION_ID_MAX_LENGTH = 255;
47
- /** Compilation modes `babel-plugin-react-compiler` accepts. */
48
- declare const COMPILATION_MODES: readonly ["infer", "syntax", "annotation", "all"];
49
- /** Panic thresholds `babel-plugin-react-compiler` accepts. */
50
- declare const PANIC_THRESHOLDS: readonly ["none", "critical_errors", "all_errors"];
51
- declare const moduleExportSchema: z.ZodObject<{
52
- module: z.ZodString;
53
- export: z.ZodString;
54
- }, z.core.$strip>;
55
- /** Schema every `gtkx.config.ts` is validated against, and the source of the {@link Config} type. */
270
+ declare const LIBRARY_APPLICATION_ID = "org.gtkx.Library";
271
+ /** Schema every `gtkx.config.ts` is validated against. */
56
272
  declare const configSchema: z.ZodObject<{
57
273
  libraries: z.ZodOptional<z.ZodArray<z.ZodString>>;
58
274
  girPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
59
- applicationId: z.ZodString;
275
+ applicationId: z.ZodOptional<z.ZodString>;
60
276
  reactCompiler: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
61
277
  compilationMode: z.ZodOptional<z.ZodEnum<{
278
+ all: "all";
279
+ annotation: "annotation";
62
280
  infer: "infer";
63
281
  syntax: "syntax";
64
- annotation: "annotation";
65
- all: "all";
66
282
  }>>;
67
283
  panicThreshold: z.ZodOptional<z.ZodEnum<{
68
- none: "none";
69
- critical_errors: "critical_errors";
70
284
  all_errors: "all_errors";
285
+ critical_errors: "critical_errors";
286
+ none: "none";
71
287
  }>>;
72
- }, z.core.$strip>]>>;
288
+ }, z.core.$strict>]>>;
73
289
  codegen: z.ZodOptional<z.ZodBoolean>;
74
290
  userEventSignals: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
75
291
  elements: z.ZodOptional<z.ZodObject<{
@@ -78,15 +294,21 @@ declare const configSchema: z.ZodObject<{
78
294
  component: z.ZodOptional<z.ZodObject<{
79
295
  module: z.ZodString;
80
296
  export: z.ZodString;
81
- }, z.core.$strip>>;
297
+ }, z.core.$strict>>;
82
298
  props: z.ZodOptional<z.ZodObject<{
83
299
  module: z.ZodString;
84
300
  export: z.ZodString;
85
- }, z.core.$strip>>;
301
+ composition: z.ZodOptional<z.ZodEnum<{
302
+ factory: "factory";
303
+ intersection: "intersection";
304
+ }>>;
305
+ constructOnly: z.ZodOptional<z.ZodArray<z.ZodString>>;
306
+ }, z.core.$strict>>;
86
307
  isLazy: z.ZodOptional<z.ZodBoolean>;
308
+ acceptedChildTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
87
309
  omittedProps: z.ZodOptional<z.ZodArray<z.ZodString>>;
88
- }, z.core.$strip>>>;
89
- }, z.core.$strip>>;
310
+ }, z.core.$strict>>>;
311
+ }, z.core.$strict>>;
90
312
  applicationIcon: z.ZodOptional<z.ZodString>;
91
313
  deploy: z.ZodOptional<z.ZodObject<{
92
314
  targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
@@ -143,10 +365,10 @@ declare const configSchema: z.ZodObject<{
143
365
  dark: z.ZodString;
144
366
  }, z.core.$strict>>;
145
367
  contentRating: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
146
- none: "none";
147
368
  intense: "intense";
148
369
  mild: "mild";
149
370
  moderate: "moderate";
371
+ none: "none";
150
372
  }>>>;
151
373
  releases: z.ZodOptional<z.ZodArray<z.ZodObject<{
152
374
  version: z.ZodString;
@@ -182,7 +404,10 @@ declare const configSchema: z.ZodObject<{
182
404
  desktopEntry: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
183
405
  metainfoExtra: z.ZodOptional<z.ZodArray<z.ZodString>>;
184
406
  isDbusActivatable: z.ZodOptional<z.ZodBoolean>;
185
- extraFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodType<import("./deploy.ts").DeployExtraFileOptions, unknown, z.core.$ZodTypeInternals<import("./deploy.ts").DeployExtraFileOptions, unknown>>]>>>;
407
+ extraFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
408
+ source: z.ZodString;
409
+ mode: z.ZodOptional<z.ZodString>;
410
+ }, z.core.$strict>]>>>;
186
411
  minimumLibraryVersions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
187
412
  depends: z.ZodOptional<z.ZodObject<{
188
413
  deb: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -211,11 +436,9 @@ declare const configSchema: z.ZodObject<{
211
436
  }, z.core.$strict>>;
212
437
  breaks: z.ZodOptional<z.ZodObject<{
213
438
  deb: z.ZodOptional<z.ZodArray<z.ZodString>>;
214
- rpm: z.ZodOptional<z.ZodArray<z.ZodString>>;
215
439
  }, z.core.$strict>>;
216
440
  preDepends: z.ZodOptional<z.ZodObject<{
217
441
  deb: z.ZodOptional<z.ZodArray<z.ZodString>>;
218
- rpm: z.ZodOptional<z.ZodArray<z.ZodString>>;
219
442
  }, z.core.$strict>>;
220
443
  }, z.core.$strict>>;
221
444
  scripts: z.ZodOptional<z.ZodObject<{
@@ -224,7 +447,20 @@ declare const configSchema: z.ZodObject<{
224
447
  preRemove: z.ZodOptional<z.ZodString>;
225
448
  postRemove: z.ZodOptional<z.ZodString>;
226
449
  }, z.core.$strict>>;
227
- node: z.ZodOptional<z.ZodType<import("./deploy.ts").DeployNodeOptions, unknown, z.core.$ZodTypeInternals<import("./deploy.ts").DeployNodeOptions, unknown>>>;
450
+ node: z.ZodOptional<z.ZodObject<{
451
+ source: z.ZodOptional<z.ZodEnum<{
452
+ download: "download";
453
+ host: "host";
454
+ path: "path";
455
+ }>>;
456
+ version: z.ZodOptional<z.ZodString>;
457
+ path: z.ZodOptional<z.ZodString>;
458
+ shouldStrip: z.ZodOptional<z.ZodBoolean>;
459
+ shouldUseCompileCache: z.ZodOptional<z.ZodBoolean>;
460
+ }, z.core.$strict>>;
461
+ tools: z.ZodOptional<z.ZodObject<{
462
+ nfpm: z.ZodOptional<z.ZodString>;
463
+ }, z.core.$strict>>;
228
464
  signing: z.ZodOptional<z.ZodObject<{
229
465
  appimage: z.ZodOptional<z.ZodObject<{
230
466
  gpgKeyId: z.ZodString;
@@ -237,9 +473,9 @@ declare const configSchema: z.ZodObject<{
237
473
  "dpkg-sig": "dpkg-sig";
238
474
  }>>;
239
475
  type: z.ZodOptional<z.ZodEnum<{
240
- origin: "origin";
241
476
  archive: "archive";
242
477
  maint: "maint";
478
+ origin: "origin";
243
479
  }>>;
244
480
  signer: z.ZodOptional<z.ZodString>;
245
481
  }, z.core.$strict>>;
@@ -254,11 +490,7 @@ declare const configSchema: z.ZodObject<{
254
490
  }, z.core.$strict>>;
255
491
  appimage: z.ZodOptional<z.ZodObject<{
256
492
  fileName: z.ZodOptional<z.ZodString>;
257
- compression: z.ZodOptional<z.ZodEnum<{
258
- gzip: "gzip";
259
- xz: "xz";
260
- zstd: "zstd";
261
- }>>;
493
+ compression: z.ZodOptional<z.ZodLiteral<"zstd">>;
262
494
  updateInformation: z.ZodOptional<z.ZodString>;
263
495
  runtimeFile: z.ZodOptional<z.ZodString>;
264
496
  }, z.core.$strict>>;
@@ -268,9 +500,9 @@ declare const configSchema: z.ZodObject<{
268
500
  priority: z.ZodOptional<z.ZodString>;
269
501
  compression: z.ZodOptional<z.ZodEnum<{
270
502
  gzip: "gzip";
503
+ none: "none";
271
504
  xz: "xz";
272
505
  zstd: "zstd";
273
- none: "none";
274
506
  }>>;
275
507
  fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
276
508
  }, z.core.$strict>>;
@@ -312,9 +544,9 @@ declare const configSchema: z.ZodObject<{
312
544
  group: z.ZodOptional<z.ZodString>;
313
545
  compression: z.ZodOptional<z.ZodEnum<{
314
546
  gzip: "gzip";
547
+ lzma: "lzma";
315
548
  xz: "xz";
316
549
  zstd: "zstd";
317
- lzma: "lzma";
318
550
  }>>;
319
551
  prefixes: z.ZodOptional<z.ZodArray<z.ZodString>>;
320
552
  }, z.core.$strict>>;
@@ -322,22 +554,22 @@ declare const configSchema: z.ZodObject<{
322
554
  agents: z.ZodOptional<z.ZodObject<{
323
555
  rules: z.ZodOptional<z.ZodBoolean>;
324
556
  reference: z.ZodOptional<z.ZodBoolean>;
325
- }, z.core.$strip>>;
557
+ }, z.core.$strict>>;
326
558
  mcp: z.ZodOptional<z.ZodObject<{
327
559
  tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
328
560
  readOnly: z.ZodOptional<z.ZodBoolean>;
329
- }, z.core.$strip>>;
561
+ }, z.core.$strict>>;
330
562
  deprecations: z.ZodOptional<z.ZodObject<{
331
563
  silence: z.ZodOptional<z.ZodArray<z.ZodNever>>;
332
- }, z.core.$strip>>;
333
- }, z.core.$strip>;
564
+ }, z.core.$strict>>;
565
+ }, z.core.$strict>;
334
566
  /**
335
567
  * Returns the given configuration unchanged, typed as {@link Config}, so `gtkx.config.ts` gets
336
568
  * autocompletion and type checking.
337
569
  */
338
570
  declare const defineConfig: DefineConfig<Config>;
339
571
  declare const isValidApplicationId: (applicationId: string) => boolean;
340
- declare const validateConfig: (config: unknown, configFile?: string) => void;
572
+ declare const validateConfig: (config: unknown, configFile?: string) => asserts config is ApplicationConfig;
341
573
  declare const graduatedFutureKeys: (config: unknown) => string[];
342
574
  /**
343
575
  * Deep-merges a configuration over a base. `override` wins over `base` on conflicting scalar and object keys, while
@@ -345,12 +577,13 @@ declare const graduatedFutureKeys: (config: unknown) => string[];
345
577
  */
346
578
  declare const mergeConfig: (base: Config, override: Config) => Config;
347
579
  declare const resolveLazyElements: (elements: Config["elements"]) => string[];
348
- declare const resolveElementComponents: (elements: Config["elements"]) => Record<string, ModuleExport>;
349
- declare const resolveElementProps: (elements: Config["elements"]) => Record<string, ModuleExport>;
580
+ declare const resolveElementComponents: (elements: Config["elements"], root: string) => Record<string, ModuleExport>;
581
+ declare const resolveElementProps: (elements: Config["elements"], root: string) => Record<string, ElementPropsExport>;
582
+ declare const resolveAcceptedChildTypes: (elements: Config["elements"]) => Record<string, string[]>;
350
583
  declare const resolveOmittedProps: (elements: Config["elements"]) => Record<string, string[]>;
351
- declare const isAgentRulesEnabled: (config: Config) => boolean;
352
- declare const isAgentReferenceEnabled: (config: Config) => boolean;
584
+ declare const isAgentRulesEnabled: (config: Config, isApplication: boolean) => boolean;
585
+ declare const isAgentReferenceEnabled: (config: Config, isApplication: boolean) => boolean;
353
586
  declare const resolveMcpSettings: (config: Config) => McpSettings;
354
- declare const resolveConfig: (config: Config, root?: string) => ResolvedConfig;
355
- export { APPLICATION_ID_MAX_LENGTH, defineConfig, isAgentReferenceEnabled, isAgentRulesEnabled, isValidApplicationId, graduatedFutureKeys, validateConfig, mergeConfig, resolveLazyElements, resolveElementComponents, resolveElementProps, resolveMcpSettings, resolveOmittedProps, resolveConfig, type McpSettings, type ResolvedReactCompilerOptions, type Config, type ResolvedConfig, };
587
+ declare const resolveConfig: (config: ApplicationConfig, translationDomain: string, root?: string) => ResolvedConfig;
588
+ export { configSchema, APPLICATION_ID_MAX_LENGTH, LIBRARY_APPLICATION_ID, defineConfig, isAgentReferenceEnabled, isAgentRulesEnabled, isValidApplicationId, graduatedFutureKeys, validateConfig, mergeConfig, resolveLazyElements, resolveElementComponents, resolveElementProps, resolveAcceptedChildTypes, resolveMcpSettings, resolveOmittedProps, resolveConfig, type AgentsOptions, type DeprecationsOptions, type ElementsOptions, type McpOptions, type McpSettings, type ReactCompilerOptions, type ResolvedReactCompilerOptions, type ApplicationConfig, type Config, type ElementConfigOptions, type ElementPropsExport, type ModuleExport, type Resolved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ACnB,wBAAwB,EACxB,mBAAmB,EACnB,yBAAyB,EACzB,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EACb,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EACjC,KAAK,iBAAiB,EACtB,KAAK,MAAM,EACX,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,cAAc,GACtB,CAAC"}
package/dist/config.js CHANGED
@@ -8,58 +8,65 @@ import { girLibrary, text } from "./schema-text.js";
8
8
  import { resolveUserEventSignals } from "./user-event-signals.js";
9
9
  const APPLICATION_ID_PATTERN = /^[A-Za-z_][A-Za-z0-9_-]*(\.[A-Za-z_][A-Za-z0-9_-]*)+$/;
10
10
  const APPLICATION_ID_MAX_LENGTH = 255;
11
+ const LIBRARY_APPLICATION_ID = "org.gtkx.Library";
11
12
  const IMPLICIT_LIBRARIES = new Set(["Adw-1", "Gtk-4.0"]);
12
13
  /** Compilation modes `babel-plugin-react-compiler` accepts. */
13
14
  const COMPILATION_MODES = ["infer", "syntax", "annotation", "all"];
14
15
  /** Panic thresholds `babel-plugin-react-compiler` accepts. */
15
16
  const PANIC_THRESHOLDS = ["none", "critical_errors", "all_errors"];
16
17
  const REACT_COMPILER_TARGET = "19";
17
- const librarySchema = girLibrary('must be of the form "Name-Version", such as "Adw-1"')
18
- .refine((library) => !IMPLICIT_LIBRARIES.has(library), { error: "is bound implicitly; remove it" });
18
+ const librarySchema = girLibrary('must be of the form "Name-Version", such as "Adw-1"').refine((library) => !IMPLICIT_LIBRARIES.has(library), { error: "is bound implicitly; remove it" });
19
19
  const librariesSchema = z
20
20
  .array(librarySchema, { error: "must be a non-empty string array or omitted" })
21
21
  .min(1, { error: "must be a non-empty string array or omitted" });
22
22
  const applicationIdSchema = z
23
- .string({ error: "must satisfy g_application_id_is_valid" })
23
+ .string({
24
+ error: (issue) => issue.input === undefined
25
+ ? 'is required to run, build or deploy an application, such as "org.example.MyApp"'
26
+ : "must satisfy g_application_id_is_valid",
27
+ })
24
28
  .refine((value) => isValidApplicationId(value), {
25
29
  error: 'must satisfy g_application_id_is_valid, such as "org.example.MyApp"',
26
30
  });
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
- ]);
31
+ const reactCompilerOptionsSchema = z.strictObject({
32
+ compilationMode: z.enum(COMPILATION_MODES).optional(),
33
+ panicThreshold: z.enum(PANIC_THRESHOLDS).optional(),
34
+ });
35
+ const reactCompilerSchema = z.union([z.boolean(), reactCompilerOptionsSchema]);
34
36
  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" }), {
35
37
  error: "must be an array of signal names",
36
38
  }), { error: "must be a record of GLib type names to signal name arrays" });
37
- const moduleExportSchema = z.object({
39
+ const moduleExportSchema = z.strictObject({
38
40
  module: z.string({ error: "must be a module specifier" }).min(1, { error: "must be a module specifier" }),
39
41
  export: z.string({ error: "must be an export name" }).min(1, { error: "must be an export name" }),
40
42
  }, { error: "must be a { module, export } object" });
41
- const elementConfigSchema = z.object({
43
+ const elementPropsSchema = moduleExportSchema.extend({
44
+ composition: z.enum(["factory", "intersection"]).optional(),
45
+ constructOnly: z.array(z.string()).optional(),
46
+ });
47
+ const elementConfigSchema = z.strictObject({
42
48
  component: moduleExportSchema.optional(),
43
- props: moduleExportSchema.optional(),
49
+ props: elementPropsSchema.optional(),
44
50
  isLazy: z.boolean({ error: "must be a boolean" }).optional(),
51
+ acceptedChildTypes: z.array(z.string()).optional(),
45
52
  omittedProps: z
46
53
  .array(z.string({ error: "must be a non-empty property name" }).min(1, {
47
54
  error: "must be a non-empty property name",
48
55
  }), { error: "must be an array of property names" })
49
56
  .optional(),
50
57
  });
51
- const elementsSchema = z.object({
58
+ const elementsSchema = z.strictObject({
52
59
  behaviors: z
53
60
  .string({ error: "must be a path to a module exporting element behaviors" })
54
61
  .min(1, { error: "must be a path to a module exporting element behaviors" })
55
62
  .optional(),
56
63
  config: z.record(z.string(), elementConfigSchema).optional(),
57
64
  });
58
- const agentsSchema = z.object({
65
+ const agentsSchema = z.strictObject({
59
66
  rules: z.boolean({ error: "must be a boolean" }).optional(),
60
67
  reference: z.boolean({ error: "must be a boolean" }).optional(),
61
68
  });
62
- const mcpSchema = z.object({
69
+ const mcpSchema = z.strictObject({
63
70
  tools: z
64
71
  .array(z.string({ error: "must be a tool name pattern" }).min(1, { error: "must be a tool name pattern" }), {
65
72
  error: "must be an array of tool name patterns",
@@ -78,18 +85,18 @@ const graduatedFutureSchema = z
78
85
  v2TreeShaking: z.literal(true, { error: "can only be true; remove the flag" }).optional(),
79
86
  })
80
87
  .strict();
81
- const deprecationsSchema = z.object({
88
+ const deprecationsSchema = z.strictObject({
82
89
  silence: z
83
90
  .array(z.never({ error: "does not name a current deprecation" }), {
84
91
  error: "must be an array of current deprecation ids",
85
92
  })
86
93
  .optional(),
87
94
  });
88
- /** Schema every `gtkx.config.ts` is validated against, and the source of the {@link Config} type. */
89
- const configSchema = z.object({
95
+ /** Schema every `gtkx.config.ts` is validated against. */
96
+ const configSchema = z.strictObject({
90
97
  libraries: librariesSchema.optional(),
91
98
  girPath: z.array(z.string(), { error: "must be an array of strings if provided" }).optional(),
92
- applicationId: applicationIdSchema,
99
+ applicationId: applicationIdSchema.optional(),
93
100
  reactCompiler: reactCompilerSchema.optional(),
94
101
  codegen: z.boolean({ error: "must be a boolean" }).optional(),
95
102
  userEventSignals: userEventSignalsSchema.optional(),
@@ -105,7 +112,10 @@ const configSchema = z.object({
105
112
  * autocompletion and type checking.
106
113
  */
107
114
  const defineConfig = createDefineConfig();
108
- const validationSchema = configSchema.extend({ future: graduatedFutureSchema.optional() });
115
+ const validationSchema = configSchema.extend({
116
+ applicationId: applicationIdSchema,
117
+ future: graduatedFutureSchema.optional(),
118
+ });
109
119
  const isValidApplicationId = (applicationId) => applicationId.length <= APPLICATION_ID_MAX_LENGTH && APPLICATION_ID_PATTERN.test(applicationId);
110
120
  const resolveReactCompilerOptions = (setting) => {
111
121
  if (setting === false) {
@@ -148,21 +158,26 @@ const elementEntryValues = (elements, pick) => Object.fromEntries(Object.entries
148
158
  const value = pick(entry);
149
159
  return value === undefined ? [] : [[type, value]];
150
160
  }));
151
- const resolveElementComponents = (elements) => elementEntryValues(elements, (entry) => entry.component);
152
- const resolveElementProps = (elements) => elementEntryValues(elements, (entry) => entry.props);
161
+ const resolveModuleSpecifier = (reference, root) => reference.module.startsWith("./") || reference.module.startsWith("../")
162
+ ? { ...reference, module: resolve(root, reference.module) }
163
+ : reference;
164
+ const resolveElementComponents = (elements, root) => elementEntryValues(elements, (entry) => entry.component && resolveModuleSpecifier(entry.component, root));
165
+ const resolveElementProps = (elements, root) => elementEntryValues(elements, (entry) => entry.props && resolveModuleSpecifier(entry.props, root));
166
+ const resolveAcceptedChildTypes = (elements) => elementEntryValues(elements, (entry) => entry.acceptedChildTypes);
153
167
  const resolveOmittedProps = (elements) => elementEntryValues(elements, (entry) => entry.omittedProps);
154
- const isAgentRulesEnabled = (config) => config.agents?.rules !== false;
155
- const isAgentReferenceEnabled = (config) => config.agents?.reference !== false;
168
+ const isAgentRulesEnabled = (config, isApplication) => config.agents?.rules ?? isApplication;
169
+ const isAgentReferenceEnabled = (config, isApplication) => config.agents?.reference ?? isApplication;
156
170
  const resolveMcpSettings = (config) => ({
157
171
  tools: config.mcp?.tools ?? [],
158
172
  isReadOnly: config.mcp?.readOnly === true,
159
173
  });
160
- const resolveConfig = (config, root) => ({
174
+ const resolveConfig = (config, translationDomain, root) => ({
161
175
  applicationId: config.applicationId,
176
+ translationDomain,
162
177
  reactCompiler: resolveReactCompilerOptions(config.reactCompiler),
163
178
  userEventSignals: resolveUserEventSignals(config.userEventSignals),
164
179
  elements: resolveElementsModule(config.elements?.behaviors, root),
165
180
  lazyElements: resolveLazyElements(config.elements),
166
181
  });
167
- export { APPLICATION_ID_MAX_LENGTH, defineConfig, isAgentReferenceEnabled, isAgentRulesEnabled, isValidApplicationId, graduatedFutureKeys, validateConfig, mergeConfig, resolveLazyElements, resolveElementComponents, resolveElementProps, resolveMcpSettings, resolveOmittedProps, resolveConfig, };
182
+ export { configSchema, APPLICATION_ID_MAX_LENGTH, LIBRARY_APPLICATION_ID, defineConfig, isAgentReferenceEnabled, isAgentRulesEnabled, isValidApplicationId, graduatedFutureKeys, validateConfig, mergeConfig, resolveLazyElements, resolveElementComponents, resolveElementProps, resolveAcceptedChildTypes, resolveMcpSettings, resolveOmittedProps, resolveConfig, };
168
183
  //# sourceMappingURL=config.js.map