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

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 (45) hide show
  1. package/README.md +2 -2
  2. package/dist/builtin-elements.d.ts +13 -1
  3. package/dist/builtin-elements.d.ts.map +1 -1
  4. package/dist/builtin-elements.js +47 -10
  5. package/dist/builtin-elements.js.map +1 -1
  6. package/dist/config-source.d.ts +2 -2
  7. package/dist/config-source.d.ts.map +1 -1
  8. package/dist/config-source.js +10 -7
  9. package/dist/config-source.js.map +1 -1
  10. package/dist/config.d.ts +256 -57
  11. package/dist/config.d.ts.map +1 -1
  12. package/dist/config.js +27 -72
  13. package/dist/config.js.map +1 -1
  14. package/dist/deploy.d.ts +930 -55
  15. package/dist/deploy.d.ts.map +1 -1
  16. package/dist/deploy.js +6 -161
  17. package/dist/deploy.js.map +1 -1
  18. package/dist/index.d.ts +8 -3
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +6 -1
  21. package/dist/index.js.map +1 -1
  22. package/dist/internal.d.ts +1 -1
  23. package/dist/internal.d.ts.map +1 -1
  24. package/dist/internal.js +1 -1
  25. package/dist/internal.js.map +1 -1
  26. package/dist/loader.d.ts +20 -4
  27. package/dist/loader.d.ts.map +1 -1
  28. package/dist/loader.js +51 -18
  29. package/dist/loader.js.map +1 -1
  30. package/dist/virtual.d.ts.map +1 -1
  31. package/dist/virtual.js +1 -0
  32. package/dist/virtual.js.map +1 -1
  33. package/dist/vite-plugin.d.ts +5 -0
  34. package/dist/vite-plugin.d.ts.map +1 -1
  35. package/dist/vite-plugin.js.map +1 -1
  36. package/package.json +5 -5
  37. package/src/builtin-elements.ts +49 -10
  38. package/src/config-source.ts +11 -7
  39. package/src/config.ts +289 -91
  40. package/src/deploy.ts +991 -199
  41. package/src/index.ts +39 -2
  42. package/src/internal.ts +1 -0
  43. package/src/loader.ts +96 -22
  44. package/src/virtual.ts +1 -0
  45. package/src/vite-plugin.ts +5 -0
package/src/config.ts CHANGED
@@ -3,16 +3,24 @@ import { defu } from "defu";
3
3
  import { resolve } from "node:path";
4
4
  import { z } from "zod";
5
5
  import { configError, isRecord } from "./config-error.ts";
6
- import { deploySchema } from "./deploy.ts";
6
+ import { type DeployOptions, deploySchema } from "./deploy.ts";
7
7
  import { girLibrary, text } from "./schema-text.ts";
8
8
  import { resolveUserEventSignals } from "./user-event-signals.ts";
9
9
 
10
10
  /** Object form of the `reactCompiler` config key, forwarded to `babel-plugin-react-compiler`. */
11
11
  type ReactCompilerOptions = {
12
- /** Which functions the compiler processes. */
13
- compilationMode?: (typeof COMPILATION_MODES)[number];
14
- /** Which compiler diagnostics fail the build. */
15
- panicThreshold?: (typeof PANIC_THRESHOLDS)[number];
12
+ /**
13
+ * Which functions the React Compiler processes.
14
+ *
15
+ * @defaultValue `"infer"`, the React Compiler's own default
16
+ */
17
+ compilationMode?: "all" | "annotation" | "infer" | "syntax" | undefined;
18
+ /**
19
+ * Which React Compiler diagnostics fail the build.
20
+ *
21
+ * @defaultValue `"none"`, the React Compiler's own default
22
+ */
23
+ panicThreshold?: "all_errors" | "critical_errors" | "none" | undefined;
16
24
  };
17
25
 
18
26
  /**
@@ -26,12 +34,229 @@ type ResolvedReactCompilerOptions = ReactCompilerOptions & {
26
34
 
27
35
  /**
28
36
  * GTKX project configuration authored in `gtkx.config.ts` and validated when loaded.
37
+ *
38
+ * [Configuration and Codegen](https://gtkx.dev/v2/guide/configuration-and-codegen) shows how to set up the file
39
+ * and what codegen generates from it.
29
40
  */
30
- type Config = z.infer<typeof configSchema>;
31
- type ModuleExport = z.infer<typeof moduleExportSchema>;
32
- type ElementPropsExport = z.infer<typeof elementPropsSchema>;
41
+ type Config = {
42
+ /**
43
+ * Additional GIR libraries to bind, such as `WebKit-6.0`.
44
+ * Adwaita and GTK are included implicitly and must not be listed.
45
+ *
46
+ * @defaultValue None: GTKX binds `Adw-1`, `Gtk-4.0` and the libraries they depend on
47
+ */
48
+ libraries?: string[] | undefined;
49
+ /**
50
+ * Additional GIR search directories, searched before the system ones. Relative paths are resolved from the
51
+ * project root.
52
+ *
53
+ * @defaultValue None: GTKX searches `/usr/share/gir-1.0` and the GIR directories pkg-config reports for
54
+ * `gobject-introspection-1.0`
55
+ */
56
+ girPath?: string[] | undefined;
57
+ /**
58
+ * GApplication identifier, such as `com.example.Tasks`. Required to run, build or deploy the project as an
59
+ * application; a package that is not an application, such as a component library, leaves it out.
60
+ *
61
+ * @defaultValue None: the project loads as a package, with `isApplication` set to `false`
62
+ */
63
+ applicationId?: string | undefined;
64
+ /**
65
+ * Whether to enable the React Compiler, or options passed to it. `false` disables it.
66
+ *
67
+ * @defaultValue `true`
68
+ * @example
69
+ * ```ts
70
+ * reactCompiler: { compilationMode: "annotation" },
71
+ * ```
72
+ */
73
+ reactCompiler?: boolean | ReactCompilerOptions | undefined;
74
+ /**
75
+ * Whether GTKX generates project bindings. Set to `false` to reuse an installed binding store.
76
+ *
77
+ * @defaultValue `true`
78
+ */
79
+ codegen?: boolean | undefined;
80
+ /**
81
+ * Additional signals to suppress during React property updates, keyed by GLib type name.
82
+ * Entries extend the built-in signal lists.
83
+ *
84
+ * @defaultValue `{}`: only the built-in lists
85
+ */
86
+ userEventSignals?: Record<string, string[]> | undefined;
87
+ /**
88
+ * Custom element behaviors and overrides for generated components, props, and documentation.
89
+ *
90
+ * @defaultValue `{}`: no custom behaviors or overrides
91
+ */
92
+ elements?: ElementsOptions | undefined;
93
+ /**
94
+ * Path to an icon theme directory or a single SVG, PNG or XPM application icon file, relative to the project
95
+ * root. Deployment requires an icon.
96
+ *
97
+ * @defaultValue The one `<applicationId>.svg`, `.png` or `.xpm` file in the project root, if exactly one
98
+ * exists
99
+ */
100
+ applicationIcon?: string | undefined;
101
+ /**
102
+ * Application metadata, bundled runtime settings, and packaging options used by `gtkx deploy`.
103
+ *
104
+ * @defaultValue `{}`: metadata comes from `package.json` and packaging builds a Flatpak
105
+ */
106
+ deploy?: DeployOptions | undefined;
107
+ /**
108
+ * Controls the project instructions and reference files generated for coding agents.
109
+ *
110
+ * @defaultValue `{}`: an application gets both, a package neither
111
+ */
112
+ agents?: AgentsOptions | undefined;
113
+ /**
114
+ * Default tool selection and access mode for the project's MCP server. The `gtkx mcp` flags `--tools` and
115
+ * `--read-only` take precedence.
116
+ *
117
+ * @defaultValue `{}`: every tool, app interactions included
118
+ */
119
+ mcp?: McpOptions | undefined;
120
+ /**
121
+ * Controls warnings for deprecated configuration and behavior.
122
+ *
123
+ * @defaultValue `{}`: every deprecation warning is shown
124
+ */
125
+ deprecations?: DeprecationsOptions | undefined;
126
+ };
127
+ /** A {@link Config} whose `applicationId` is known, as loaded for an application. */
128
+ type ApplicationConfig = Config & { applicationId: string };
129
+
130
+ /** A named export of a module, which `elements.config` entries reference for components and props. */
131
+ type ModuleExport = {
132
+ /** Module specifier containing the named export; relative paths start at the project root. */
133
+ module: string;
134
+ /** Name of the export to import from the module. */
135
+ export: string;
136
+ };
137
+
138
+ /** The props type an `elements.config` entry adds to a generated element, and how it combines with them. */
139
+ type ElementPropsExport = {
140
+ /** Module specifier containing the named export; relative paths start at the project root. */
141
+ module: string;
142
+ /** Name of the props type to import from the module. */
143
+ export: string;
144
+ /**
145
+ * How the exported props are combined: `intersection` is inherited; `factory` applies only to this type.
146
+ *
147
+ * @defaultValue `"intersection"`
148
+ */
149
+ composition?: "factory" | "intersection" | undefined;
150
+ /**
151
+ * Props that can only be set when the element is created; changing them afterward throws.
152
+ *
153
+ * @defaultValue `[]`
154
+ */
155
+ constructOnly?: string[] | undefined;
156
+ };
157
+
33
158
  /** Overrides for one GLib type in `elements.config`, keyed by its registered type name. */
34
- type ElementConfigOptions = z.infer<typeof elementConfigSchema>;
159
+ type ElementConfigOptions = {
160
+ /**
161
+ * Component export that wraps the generated element.
162
+ *
163
+ * @defaultValue None: no wrapper `component`
164
+ */
165
+ component?: ModuleExport | undefined;
166
+ /**
167
+ * Additional props type to combine with the generated element props.
168
+ *
169
+ * @defaultValue None: no extra `props` type
170
+ */
171
+ props?: ElementPropsExport | undefined;
172
+ /**
173
+ * Whether the parent container creates this element's GObject instead of the element constructing its own.
174
+ * Subtypes inherit the setting.
175
+ *
176
+ * @defaultValue `false`
177
+ */
178
+ isLazy?: boolean | undefined;
179
+ /**
180
+ * Accepted child GLib type names to show in the generated element documentation.
181
+ *
182
+ * @defaultValue `[]`
183
+ */
184
+ acceptedChildTypes?: string[] | undefined;
185
+ /**
186
+ * GObject properties to leave out of generated props, such as properties managed by an element behavior.
187
+ *
188
+ * @defaultValue `[]`: every GObject property becomes a prop
189
+ */
190
+ omittedProps?: string[] | undefined;
191
+ };
192
+
193
+ /** The `elements` options: custom element behaviors and per-type overrides for generated elements. */
194
+ type ElementsOptions = {
195
+ /**
196
+ * Path, relative to the project root, of the module exporting the element behavior map.
197
+ *
198
+ * @defaultValue None: only the behaviors built into `@gtkx/react` apply
199
+ */
200
+ behaviors?: string | undefined;
201
+ /**
202
+ * Element configuration overrides keyed by GLib type name, such as `GtkWidget`.
203
+ *
204
+ * @defaultValue `{}`
205
+ */
206
+ config?: Record<string, ElementConfigOptions> | undefined;
207
+ };
208
+
209
+ /** The `agents` options: which files codegen maintains for coding agents. */
210
+ type AgentsOptions = {
211
+ /**
212
+ * Whether codegen maintains the GTKX rules in `AGENTS.md` and creates a missing `CLAUDE.md` import.
213
+ * `false` removes rules written earlier, deleting `AGENTS.md` and the `CLAUDE.md` import when nothing else
214
+ * remains.
215
+ *
216
+ * @defaultValue `true` for an application, `false` for a package without an `applicationId`
217
+ */
218
+ rules?: boolean | undefined;
219
+ /**
220
+ * Whether codegen writes the generated element reference to `.gtkx/reference` and points the rules at it.
221
+ * `false` removes a reference generated earlier.
222
+ *
223
+ * @defaultValue `true` for an application, `false` for a package without an `applicationId`
224
+ */
225
+ reference?: boolean | undefined;
226
+ };
227
+
228
+ /** The `mcp` options: the tools `gtkx mcp` offers by default and whether it may interact with the app. */
229
+ type McpOptions = {
230
+ /**
231
+ * Tool name patterns applied in order: `*` matches any text and a leading `!` excludes matches.
232
+ * Omitted, empty, or exclusion-only lists start with all tools; other lists start with none.
233
+ * `gtkx mcp --tools` overrides it.
234
+ *
235
+ * @defaultValue `[]`: every tool
236
+ * @example
237
+ * ```ts
238
+ * tools: ["gtkx_*", "!gtkx_take_screenshot"],
239
+ * ```
240
+ */
241
+ tools?: string[] | undefined;
242
+ /**
243
+ * Whether the MCP server exposes only inspection and reference tools, excluding app interactions.
244
+ * `gtkx mcp --read-only` overrides it.
245
+ *
246
+ * @defaultValue `false`
247
+ */
248
+ readOnly?: boolean | undefined;
249
+ };
250
+
251
+ /** The `deprecations` options: which deprecation warnings stay silent. */
252
+ type DeprecationsOptions = {
253
+ /**
254
+ * Deprecation identifiers whose warnings are suppressed. There are currently no accepted identifiers.
255
+ *
256
+ * @defaultValue `[]`
257
+ */
258
+ silence?: never[] | undefined;
259
+ };
35
260
 
36
261
  type McpSettings = {
37
262
  tools: string[];
@@ -42,6 +267,8 @@ type McpSettings = {
42
267
  type ResolvedConfig = {
43
268
  /** The GApplication identifier the app registers under. */
44
269
  applicationId: string;
270
+ /** The gettext domain, which is the `applicationId` production builds use. */
271
+ translationDomain: string;
45
272
  /** React Compiler options for the build, or `null` when the compiler is disabled. */
46
273
  reactCompiler: ResolvedReactCompilerOptions | null;
47
274
  /**
@@ -57,6 +284,7 @@ type ResolvedConfig = {
57
284
 
58
285
  const APPLICATION_ID_PATTERN = /^[A-Za-z_][A-Za-z0-9_-]*(\.[A-Za-z_][A-Za-z0-9_-]*)+$/;
59
286
  const APPLICATION_ID_MAX_LENGTH = 255;
287
+ const LIBRARY_APPLICATION_ID = "org.gtkx.Library";
60
288
  const IMPLICIT_LIBRARIES: Set<string> = new Set(["Adw-1", "Gtk-4.0"]);
61
289
  /** Compilation modes `babel-plugin-react-compiler` accepts. */
62
290
  const COMPILATION_MODES = ["infer", "syntax", "annotation", "all"] as const;
@@ -74,20 +302,22 @@ const librariesSchema = z
74
302
  .min(1, { error: "must be a non-empty string array or omitted" });
75
303
 
76
304
  const applicationIdSchema = z
77
- .string({ error: "must satisfy g_application_id_is_valid" })
305
+ .string({
306
+ error: (issue) =>
307
+ issue.input === undefined
308
+ ? 'is required to run, build or deploy an application, such as "org.example.MyApp"'
309
+ : "must satisfy g_application_id_is_valid",
310
+ })
78
311
  .refine((value) => isValidApplicationId(value), {
79
312
  error: 'must satisfy g_application_id_is_valid, such as "org.example.MyApp"',
80
313
  });
81
314
 
82
- const reactCompilerSchema = z.union([
83
- z.boolean(),
84
- z.strictObject({
85
- /** Which functions the React Compiler processes. */
86
- compilationMode: z.enum(COMPILATION_MODES).optional(),
87
- /** Which React Compiler diagnostics fail the build. */
88
- panicThreshold: z.enum(PANIC_THRESHOLDS).optional(),
89
- }),
90
- ]);
315
+ const reactCompilerOptionsSchema = z.strictObject({
316
+ compilationMode: z.enum(COMPILATION_MODES).optional(),
317
+ panicThreshold: z.enum(PANIC_THRESHOLDS).optional(),
318
+ }) satisfies z.ZodType<ReactCompilerOptions>;
319
+
320
+ const reactCompilerSchema = z.union([z.boolean(), reactCompilerOptionsSchema]);
91
321
 
92
322
  const userEventSignalsSchema = z.record(
93
323
  z.string(),
@@ -102,35 +332,22 @@ const userEventSignalsSchema = z.record(
102
332
 
103
333
  const moduleExportSchema = z.strictObject(
104
334
  {
105
- /** Module specifier containing the named export. */
106
335
  module: z.string({ error: "must be a module specifier" }).min(1, { error: "must be a module specifier" }),
107
- /** Name of the export to import from the module. */
108
336
  export: z.string({ error: "must be an export name" }).min(1, { error: "must be an export name" }),
109
337
  },
110
338
  { error: "must be a { module, export } object" },
111
- );
339
+ ) satisfies z.ZodType<ModuleExport>;
112
340
 
113
341
  const elementPropsSchema = moduleExportSchema.extend({
114
- /**
115
- * How the exported props are combined: `intersection` is inherited; `factory` applies only to this type.
116
- * Defaults to `intersection`.
117
- */
118
342
  composition: z.enum(["factory", "intersection"]).optional(),
119
- /** Props that can only be set when the element is created; changing them afterward throws. */
120
343
  constructOnly: z.array(z.string()).optional(),
121
- });
344
+ }) satisfies z.ZodType<ElementPropsExport>;
122
345
 
123
- /** Schema for one element override and the source of {@link ElementConfigOptions}. */
124
346
  const elementConfigSchema = z.strictObject({
125
- /** Component export that wraps the generated element. */
126
347
  component: moduleExportSchema.optional(),
127
- /** Additional props type to combine with the generated element props. */
128
348
  props: elementPropsSchema.optional(),
129
- /** Whether the parent container creates this element's GObject instead of the element constructing its own. */
130
349
  isLazy: z.boolean({ error: "must be a boolean" }).optional(),
131
- /** Accepted child GLib type names to show in the generated element documentation. */
132
350
  acceptedChildTypes: z.array(z.string()).optional(),
133
- /** GObject properties to leave out of generated props, such as properties managed by an element behavior. */
134
351
  omittedProps: z
135
352
  .array(
136
353
  z.string({ error: "must be a non-empty property name" }).min(1, {
@@ -139,47 +356,29 @@ const elementConfigSchema = z.strictObject({
139
356
  { error: "must be an array of property names" },
140
357
  )
141
358
  .optional(),
142
- });
359
+ }) satisfies z.ZodType<ElementConfigOptions>;
143
360
 
144
361
  const elementsSchema = z.strictObject({
145
- /** Path, relative to the project root, of the module exporting the element behavior map. */
146
362
  behaviors: z
147
363
  .string({ error: "must be a path to a module exporting element behaviors" })
148
364
  .min(1, { error: "must be a path to a module exporting element behaviors" })
149
365
  .optional(),
150
- /**
151
- * Element configuration overrides keyed by GLib type name, such as `GtkWidget`.
152
- * @see {@link ElementConfigOptions} for the fields accepted by each entry.
153
- */
154
366
  config: z.record(z.string(), elementConfigSchema).optional(),
155
- });
367
+ }) satisfies z.ZodType<ElementsOptions>;
156
368
 
157
369
  const agentsSchema = z.strictObject({
158
- /**
159
- * Whether codegen maintains the GTKX rules in `AGENTS.md` and creates a missing `CLAUDE.md` import.
160
- * Defaults to `true`.
161
- */
162
370
  rules: z.boolean({ error: "must be a boolean" }).optional(),
163
- /** Whether codegen writes the generated element reference to `.gtkx/reference`. Defaults to `true`. */
164
371
  reference: z.boolean({ error: "must be a boolean" }).optional(),
165
- });
372
+ }) satisfies z.ZodType<AgentsOptions>;
166
373
 
167
374
  const mcpSchema = z.strictObject({
168
- /**
169
- * Tool name patterns applied in order: `*` matches any text and a leading `!` excludes matches.
170
- * Omitted, empty, or exclusion-only lists start with all tools; other lists start with none.
171
- */
172
375
  tools: z
173
376
  .array(z.string({ error: "must be a tool name pattern" }).min(1, { error: "must be a tool name pattern" }), {
174
377
  error: "must be an array of tool name patterns",
175
378
  })
176
379
  .optional(),
177
- /**
178
- * Whether the MCP server exposes only inspection and reference tools, excluding app interactions.
179
- * Defaults to `false`.
180
- */
181
380
  readOnly: z.boolean({ error: "must be a boolean" }).optional(),
182
- });
381
+ }) satisfies z.ZodType<McpOptions>;
183
382
 
184
383
  const graduatedFutureSchema = z
185
384
  .object({
@@ -194,57 +393,38 @@ const graduatedFutureSchema = z
194
393
  .strict();
195
394
 
196
395
  const deprecationsSchema = z.strictObject({
197
- /** Deprecation identifiers whose warnings are suppressed. There are currently no accepted identifiers. */
198
396
  silence: z
199
397
  .array(z.never({ error: "does not name a current deprecation" }), {
200
398
  error: "must be an array of current deprecation ids",
201
399
  })
202
400
  .optional(),
203
- });
401
+ }) satisfies z.ZodType<DeprecationsOptions>;
204
402
 
205
- /** Schema every `gtkx.config.ts` is validated against, and the source of the {@link Config} type. */
403
+ /** Schema every `gtkx.config.ts` is validated against. */
206
404
  const configSchema = z.strictObject({
207
- /**
208
- * Additional GIR libraries to bind, such as `WebKit-6.0`.
209
- * Adwaita and GTK are included implicitly and must not be listed.
210
- */
211
405
  libraries: librariesSchema.optional(),
212
- /** Additional GIR search directories. Relative paths are resolved from the project root. */
213
406
  girPath: z.array(z.string(), { error: "must be an array of strings if provided" }).optional(),
214
- /** Required GApplication identifier, such as `com.example.Tasks`. */
215
- applicationId: applicationIdSchema,
216
- /** Whether to enable the React Compiler, or options passed to it. Enabled by default. */
407
+ applicationId: applicationIdSchema.optional(),
217
408
  reactCompiler: reactCompilerSchema.optional(),
218
- /**
219
- * Whether GTKX generates project bindings. Set to `false` to reuse an installed binding store.
220
- * Defaults to `true`.
221
- */
222
409
  codegen: z.boolean({ error: "must be a boolean" }).optional(),
223
- /**
224
- * Additional signals to suppress during React property updates, keyed by GLib type name.
225
- * Entries extend the built-in signal lists.
226
- */
227
410
  userEventSignals: userEventSignalsSchema.optional(),
228
- /** Custom element behaviors and overrides for generated components, props, and documentation. */
229
411
  elements: elementsSchema.optional(),
230
- /** Path to an icon theme directory or a single application icon file, relative to the project root. */
231
412
  applicationIcon: text("must be a path to an icon theme directory or a single icon file").optional(),
232
- /** Application metadata, bundled runtime settings, and packaging options used by `gtkx deploy`. */
233
413
  deploy: deploySchema.optional(),
234
- /** Controls the project instructions and reference files generated for coding agents. */
235
414
  agents: agentsSchema.optional(),
236
- /** Default tool selection and access mode for the project's MCP server. Command-line flags take precedence. */
237
415
  mcp: mcpSchema.optional(),
238
- /** Controls warnings for deprecated configuration and behavior. */
239
416
  deprecations: deprecationsSchema.optional(),
240
- });
417
+ }) satisfies z.ZodType<Config>;
241
418
 
242
419
  /**
243
420
  * Returns the given configuration unchanged, typed as {@link Config}, so `gtkx.config.ts` gets
244
421
  * autocompletion and type checking.
245
422
  */
246
423
  const defineConfig: DefineConfig<Config> = createDefineConfig<Config>();
247
- const validationSchema = configSchema.extend({ future: graduatedFutureSchema.optional() });
424
+ const validationSchema = configSchema.extend({
425
+ applicationId: applicationIdSchema,
426
+ future: graduatedFutureSchema.optional(),
427
+ });
248
428
 
249
429
  const isValidApplicationId = (applicationId: string): boolean =>
250
430
  applicationId.length <= APPLICATION_ID_MAX_LENGTH && APPLICATION_ID_PATTERN.test(applicationId);
@@ -263,7 +443,10 @@ const resolveReactCompilerOptions = (setting: Config["reactCompiler"]): Resolved
263
443
  };
264
444
  };
265
445
 
266
- const validateConfig = (config: unknown, configFile?: string): void => {
446
+ const validateConfig: (config: unknown, configFile?: string) => asserts config is ApplicationConfig = (
447
+ config,
448
+ configFile,
449
+ ) => {
267
450
  const result = validationSchema.safeParse(config);
268
451
 
269
452
  if (!result.success) {
@@ -310,11 +493,16 @@ const elementEntryValues = <T>(
310
493
  }),
311
494
  );
312
495
 
313
- const resolveElementComponents = (elements: Config["elements"]): Record<string, ModuleExport> =>
314
- elementEntryValues(elements, (entry) => entry.component);
496
+ const resolveModuleSpecifier = <T extends { module: string }>(reference: T, root: string): T =>
497
+ reference.module.startsWith("./") || reference.module.startsWith("../")
498
+ ? { ...reference, module: resolve(root, reference.module) }
499
+ : reference;
500
+
501
+ const resolveElementComponents = (elements: Config["elements"], root: string): Record<string, ModuleExport> =>
502
+ elementEntryValues(elements, (entry) => entry.component && resolveModuleSpecifier(entry.component, root));
315
503
 
316
- const resolveElementProps = (elements: Config["elements"]): Record<string, ElementPropsExport> =>
317
- elementEntryValues(elements, (entry) => entry.props);
504
+ const resolveElementProps = (elements: Config["elements"], root: string): Record<string, ElementPropsExport> =>
505
+ elementEntryValues(elements, (entry) => entry.props && resolveModuleSpecifier(entry.props, root));
318
506
 
319
507
  const resolveAcceptedChildTypes = (elements: Config["elements"]): Record<string, string[]> =>
320
508
  elementEntryValues(elements, (entry) => entry.acceptedChildTypes);
@@ -322,16 +510,18 @@ const resolveAcceptedChildTypes = (elements: Config["elements"]): Record<string,
322
510
  const resolveOmittedProps = (elements: Config["elements"]): Record<string, string[]> =>
323
511
  elementEntryValues(elements, (entry) => entry.omittedProps);
324
512
 
325
- const isAgentRulesEnabled = (config: Config): boolean => config.agents?.rules !== false;
326
- const isAgentReferenceEnabled = (config: Config): boolean => config.agents?.reference !== false;
513
+ const isAgentRulesEnabled = (config: Config, isApplication: boolean): boolean => config.agents?.rules ?? isApplication;
514
+ const isAgentReferenceEnabled = (config: Config, isApplication: boolean): boolean =>
515
+ config.agents?.reference ?? isApplication;
327
516
 
328
517
  const resolveMcpSettings = (config: Config): McpSettings => ({
329
518
  tools: config.mcp?.tools ?? [],
330
519
  isReadOnly: config.mcp?.readOnly === true,
331
520
  });
332
521
 
333
- const resolveConfig = (config: Config, root?: string): ResolvedConfig => ({
522
+ const resolveConfig = (config: ApplicationConfig, translationDomain: string, root?: string): ResolvedConfig => ({
334
523
  applicationId: config.applicationId,
524
+ translationDomain,
335
525
  reactCompiler: resolveReactCompilerOptions(config.reactCompiler),
336
526
  userEventSignals: resolveUserEventSignals(config.userEventSignals),
337
527
  elements: resolveElementsModule(config.elements?.behaviors, root),
@@ -339,7 +529,9 @@ const resolveConfig = (config: Config, root?: string): ResolvedConfig => ({
339
529
  });
340
530
 
341
531
  export {
532
+ configSchema,
342
533
  APPLICATION_ID_MAX_LENGTH,
534
+ LIBRARY_APPLICATION_ID,
343
535
  defineConfig,
344
536
  isAgentReferenceEnabled,
345
537
  isAgentRulesEnabled,
@@ -354,8 +546,14 @@ export {
354
546
  resolveMcpSettings,
355
547
  resolveOmittedProps,
356
548
  resolveConfig,
549
+ type AgentsOptions,
550
+ type DeprecationsOptions,
551
+ type ElementsOptions,
552
+ type McpOptions,
357
553
  type McpSettings,
554
+ type ReactCompilerOptions,
358
555
  type ResolvedReactCompilerOptions,
556
+ type ApplicationConfig,
359
557
  type Config,
360
558
  type ElementConfigOptions,
361
559
  type ElementPropsExport,