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

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/dist/config.js CHANGED
@@ -8,6 +8,7 @@ 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"];
@@ -19,48 +20,35 @@ const librariesSchema = z
19
20
  .array(librarySchema, { error: "must be a non-empty string array or omitted" })
20
21
  .min(1, { error: "must be a non-empty string array or omitted" });
21
22
  const applicationIdSchema = z
22
- .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
+ })
23
28
  .refine((value) => isValidApplicationId(value), {
24
29
  error: 'must satisfy g_application_id_is_valid, such as "org.example.MyApp"',
25
30
  });
26
- const reactCompilerSchema = z.union([
27
- z.boolean(),
28
- z.strictObject({
29
- /** Which functions the React Compiler processes. */
30
- compilationMode: z.enum(COMPILATION_MODES).optional(),
31
- /** Which React Compiler diagnostics fail the build. */
32
- panicThreshold: z.enum(PANIC_THRESHOLDS).optional(),
33
- }),
34
- ]);
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]);
35
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" }), {
36
37
  error: "must be an array of signal names",
37
38
  }), { error: "must be a record of GLib type names to signal name arrays" });
38
39
  const moduleExportSchema = z.strictObject({
39
- /** Module specifier containing the named export. */
40
40
  module: z.string({ error: "must be a module specifier" }).min(1, { error: "must be a module specifier" }),
41
- /** Name of the export to import from the module. */
42
41
  export: z.string({ error: "must be an export name" }).min(1, { error: "must be an export name" }),
43
42
  }, { error: "must be a { module, export } object" });
44
43
  const elementPropsSchema = moduleExportSchema.extend({
45
- /**
46
- * How the exported props are combined: `intersection` is inherited; `factory` applies only to this type.
47
- * Defaults to `intersection`.
48
- */
49
44
  composition: z.enum(["factory", "intersection"]).optional(),
50
- /** Props that can only be set when the element is created; changing them afterward throws. */
51
45
  constructOnly: z.array(z.string()).optional(),
52
46
  });
53
- /** Schema for one element override and the source of {@link ElementConfigOptions}. */
54
47
  const elementConfigSchema = z.strictObject({
55
- /** Component export that wraps the generated element. */
56
48
  component: moduleExportSchema.optional(),
57
- /** Additional props type to combine with the generated element props. */
58
49
  props: elementPropsSchema.optional(),
59
- /** Whether the parent container creates this element's GObject instead of the element constructing its own. */
60
50
  isLazy: z.boolean({ error: "must be a boolean" }).optional(),
61
- /** Accepted child GLib type names to show in the generated element documentation. */
62
51
  acceptedChildTypes: z.array(z.string()).optional(),
63
- /** GObject properties to leave out of generated props, such as properties managed by an element behavior. */
64
52
  omittedProps: z
65
53
  .array(z.string({ error: "must be a non-empty property name" }).min(1, {
66
54
  error: "must be a non-empty property name",
@@ -68,40 +56,22 @@ const elementConfigSchema = z.strictObject({
68
56
  .optional(),
69
57
  });
70
58
  const elementsSchema = z.strictObject({
71
- /** Path, relative to the project root, of the module exporting the element behavior map. */
72
59
  behaviors: z
73
60
  .string({ error: "must be a path to a module exporting element behaviors" })
74
61
  .min(1, { error: "must be a path to a module exporting element behaviors" })
75
62
  .optional(),
76
- /**
77
- * Element configuration overrides keyed by GLib type name, such as `GtkWidget`.
78
- * @see {@link ElementConfigOptions} for the fields accepted by each entry.
79
- */
80
63
  config: z.record(z.string(), elementConfigSchema).optional(),
81
64
  });
82
65
  const agentsSchema = z.strictObject({
83
- /**
84
- * Whether codegen maintains the GTKX rules in `AGENTS.md` and creates a missing `CLAUDE.md` import.
85
- * Defaults to `true`.
86
- */
87
66
  rules: z.boolean({ error: "must be a boolean" }).optional(),
88
- /** Whether codegen writes the generated element reference to `.gtkx/reference`. Defaults to `true`. */
89
67
  reference: z.boolean({ error: "must be a boolean" }).optional(),
90
68
  });
91
69
  const mcpSchema = z.strictObject({
92
- /**
93
- * Tool name patterns applied in order: `*` matches any text and a leading `!` excludes matches.
94
- * Omitted, empty, or exclusion-only lists start with all tools; other lists start with none.
95
- */
96
70
  tools: z
97
71
  .array(z.string({ error: "must be a tool name pattern" }).min(1, { error: "must be a tool name pattern" }), {
98
72
  error: "must be an array of tool name patterns",
99
73
  })
100
74
  .optional(),
101
- /**
102
- * Whether the MCP server exposes only inspection and reference tools, excluding app interactions.
103
- * Defaults to `false`.
104
- */
105
75
  readOnly: z.boolean({ error: "must be a boolean" }).optional(),
106
76
  });
107
77
  const graduatedFutureSchema = z
@@ -116,47 +86,25 @@ const graduatedFutureSchema = z
116
86
  })
117
87
  .strict();
118
88
  const deprecationsSchema = z.strictObject({
119
- /** Deprecation identifiers whose warnings are suppressed. There are currently no accepted identifiers. */
120
89
  silence: z
121
90
  .array(z.never({ error: "does not name a current deprecation" }), {
122
91
  error: "must be an array of current deprecation ids",
123
92
  })
124
93
  .optional(),
125
94
  });
126
- /** Schema every `gtkx.config.ts` is validated against, and the source of the {@link Config} type. */
95
+ /** Schema every `gtkx.config.ts` is validated against. */
127
96
  const configSchema = z.strictObject({
128
- /**
129
- * Additional GIR libraries to bind, such as `WebKit-6.0`.
130
- * Adwaita and GTK are included implicitly and must not be listed.
131
- */
132
97
  libraries: librariesSchema.optional(),
133
- /** Additional GIR search directories. Relative paths are resolved from the project root. */
134
98
  girPath: z.array(z.string(), { error: "must be an array of strings if provided" }).optional(),
135
- /** Required GApplication identifier, such as `com.example.Tasks`. */
136
- applicationId: applicationIdSchema,
137
- /** Whether to enable the React Compiler, or options passed to it. Enabled by default. */
99
+ applicationId: applicationIdSchema.optional(),
138
100
  reactCompiler: reactCompilerSchema.optional(),
139
- /**
140
- * Whether GTKX generates project bindings. Set to `false` to reuse an installed binding store.
141
- * Defaults to `true`.
142
- */
143
101
  codegen: z.boolean({ error: "must be a boolean" }).optional(),
144
- /**
145
- * Additional signals to suppress during React property updates, keyed by GLib type name.
146
- * Entries extend the built-in signal lists.
147
- */
148
102
  userEventSignals: userEventSignalsSchema.optional(),
149
- /** Custom element behaviors and overrides for generated components, props, and documentation. */
150
103
  elements: elementsSchema.optional(),
151
- /** Path to an icon theme directory or a single application icon file, relative to the project root. */
152
104
  applicationIcon: text("must be a path to an icon theme directory or a single icon file").optional(),
153
- /** Application metadata, bundled runtime settings, and packaging options used by `gtkx deploy`. */
154
105
  deploy: deploySchema.optional(),
155
- /** Controls the project instructions and reference files generated for coding agents. */
156
106
  agents: agentsSchema.optional(),
157
- /** Default tool selection and access mode for the project's MCP server. Command-line flags take precedence. */
158
107
  mcp: mcpSchema.optional(),
159
- /** Controls warnings for deprecated configuration and behavior. */
160
108
  deprecations: deprecationsSchema.optional(),
161
109
  });
162
110
  /**
@@ -164,7 +112,10 @@ const configSchema = z.strictObject({
164
112
  * autocompletion and type checking.
165
113
  */
166
114
  const defineConfig = createDefineConfig();
167
- const validationSchema = configSchema.extend({ future: graduatedFutureSchema.optional() });
115
+ const validationSchema = configSchema.extend({
116
+ applicationId: applicationIdSchema,
117
+ future: graduatedFutureSchema.optional(),
118
+ });
168
119
  const isValidApplicationId = (applicationId) => applicationId.length <= APPLICATION_ID_MAX_LENGTH && APPLICATION_ID_PATTERN.test(applicationId);
169
120
  const resolveReactCompilerOptions = (setting) => {
170
121
  if (setting === false) {
@@ -207,22 +158,26 @@ const elementEntryValues = (elements, pick) => Object.fromEntries(Object.entries
207
158
  const value = pick(entry);
208
159
  return value === undefined ? [] : [[type, value]];
209
160
  }));
210
- const resolveElementComponents = (elements) => elementEntryValues(elements, (entry) => entry.component);
211
- 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));
212
166
  const resolveAcceptedChildTypes = (elements) => elementEntryValues(elements, (entry) => entry.acceptedChildTypes);
213
167
  const resolveOmittedProps = (elements) => elementEntryValues(elements, (entry) => entry.omittedProps);
214
- const isAgentRulesEnabled = (config) => config.agents?.rules !== false;
215
- 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;
216
170
  const resolveMcpSettings = (config) => ({
217
171
  tools: config.mcp?.tools ?? [],
218
172
  isReadOnly: config.mcp?.readOnly === true,
219
173
  });
220
- const resolveConfig = (config, root) => ({
174
+ const resolveConfig = (config, translationDomain, root) => ({
221
175
  applicationId: config.applicationId,
176
+ translationDomain,
222
177
  reactCompiler: resolveReactCompilerOptions(config.reactCompiler),
223
178
  userEventSignals: resolveUserEventSignals(config.userEventSignals),
224
179
  elements: resolveElementsModule(config.elements?.behaviors, root),
225
180
  lazyElements: resolveLazyElements(config.elements),
226
181
  });
227
- export { APPLICATION_ID_MAX_LENGTH, defineConfig, isAgentReferenceEnabled, isAgentRulesEnabled, isValidApplicationId, graduatedFutureKeys, validateConfig, mergeConfig, resolveLazyElements, resolveElementComponents, resolveElementProps, resolveAcceptedChildTypes, 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, };
228
183
  //# 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,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAkDlE,MAAM,sBAAsB,GAAG,uDAAuD,CAAC;AACvF,MAAM,yBAAyB,GAAG,GAAG,CAAC;AACtC,MAAM,kBAAkB,GAAgB,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC;AACtE,+DAA+D;AAC/D,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,CAAU,CAAC;AAC5E,8DAA8D;AAC9D,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,iBAAiB,EAAE,YAAY,CAAU,CAAC;AAC5E,MAAM,qBAAqB,GAAG,IAAI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AyB,EACzB,YAAY,EACZ,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,yBAAyB,EACzB,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,GAQhB,CAAC","sourcesContent":["import { createDefineConfig, type DefineConfig } from \"c12\";\nimport { defu } from \"defu\";\nimport { resolve } from \"node:path\";\nimport { z } from \"zod\";\nimport { configError, isRecord } from \"./config-error.ts\";\nimport { deploySchema } from \"./deploy.ts\";\nimport { girLibrary, text } from \"./schema-text.ts\";\nimport { resolveUserEventSignals } from \"./user-event-signals.ts\";\n\n/** Object form of the `reactCompiler` config key, forwarded to `babel-plugin-react-compiler`. */\ntype ReactCompilerOptions = {\n /** Which functions the compiler processes. */\n compilationMode?: (typeof COMPILATION_MODES)[number];\n /** Which compiler diagnostics fail the build. */\n panicThreshold?: (typeof PANIC_THRESHOLDS)[number];\n};\n\n/**\n * The React Compiler options the build hands to `babel-plugin-react-compiler`, with the React version\n * GTKX targets filled in.\n */\ntype ResolvedReactCompilerOptions = ReactCompilerOptions & {\n /** React major version the compiler emits for. */\n target: \"19\";\n};\n\n/**\n * GTKX project configuration authored in `gtkx.config.ts` and validated when loaded.\n */\ntype Config = z.infer<typeof configSchema>;\ntype ModuleExport = z.infer<typeof moduleExportSchema>;\ntype ElementPropsExport = z.infer<typeof elementPropsSchema>;\n/** Overrides for one GLib type in `elements.config`, keyed by its registered type name. */\ntype ElementConfigOptions = z.infer<typeof elementConfigSchema>;\n\ntype McpSettings = {\n tools: string[];\n isReadOnly: boolean;\n};\n\n/** Configuration reduced to the values the app runtime and the build need, with paths already resolved. */\ntype ResolvedConfig = {\n /** The GApplication identifier the app registers under. */\n applicationId: string;\n /** React Compiler options for the build, or `null` when the compiler is disabled. */\n reactCompiler: ResolvedReactCompilerOptions | null;\n /**\n * Signal names, keyed by GLib type name, that stay suppressed while a React commit writes to a widget.\n * `notify` stays suppressed only for the property being written.\n */\n userEventSignals: Record<string, string[]>;\n /** Path of the module exporting per-element configs, or `null` when none is configured. */\n elements: string | null;\n /** GLib type names of the elements marked `isLazy`, whose GObject their parent container creates. */\n lazyElements: string[];\n};\n\nconst APPLICATION_ID_PATTERN = /^[A-Za-z_][A-Za-z0-9_-]*(\\.[A-Za-z_][A-Za-z0-9_-]*)+$/;\nconst APPLICATION_ID_MAX_LENGTH = 255;\nconst IMPLICIT_LIBRARIES: Set<string> = new Set([\"Adw-1\", \"Gtk-4.0\"]);\n/** Compilation modes `babel-plugin-react-compiler` accepts. */\nconst COMPILATION_MODES = [\"infer\", \"syntax\", \"annotation\", \"all\"] as const;\n/** Panic thresholds `babel-plugin-react-compiler` accepts. */\nconst PANIC_THRESHOLDS = [\"none\", \"critical_errors\", \"all_errors\"] as const;\nconst REACT_COMPILER_TARGET = \"19\";\n\nconst librarySchema = girLibrary('must be of the form \"Name-Version\", such as \"Adw-1\"').refine(\n (library) => !IMPLICIT_LIBRARIES.has(library),\n { error: \"is bound implicitly; remove it\" },\n);\n\nconst librariesSchema = z\n .array(librarySchema, { error: \"must be a non-empty string array or omitted\" })\n .min(1, { error: \"must be a non-empty string array or omitted\" });\n\nconst applicationIdSchema = z\n .string({ error: \"must satisfy g_application_id_is_valid\" })\n .refine((value) => isValidApplicationId(value), {\n error: 'must satisfy g_application_id_is_valid, such as \"org.example.MyApp\"',\n });\n\nconst reactCompilerSchema = z.union([\n z.boolean(),\n z.strictObject({\n /** Which functions the React Compiler processes. */\n compilationMode: z.enum(COMPILATION_MODES).optional(),\n /** Which React Compiler diagnostics fail the build. */\n panicThreshold: z.enum(PANIC_THRESHOLDS).optional(),\n }),\n]);\n\nconst userEventSignalsSchema = z.record(\n z.string(),\n z.array(\n z.string({ error: \"must be a non-empty signal name\" }).min(1, { error: \"must be a non-empty signal name\" }),\n {\n error: \"must be an array of signal names\",\n },\n ),\n { error: \"must be a record of GLib type names to signal name arrays\" },\n);\n\nconst moduleExportSchema = z.strictObject(\n {\n /** Module specifier containing the named export. */\n module: z.string({ error: \"must be a module specifier\" }).min(1, { error: \"must be a module specifier\" }),\n /** Name of the export to import from the module. */\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 elementPropsSchema = moduleExportSchema.extend({\n /**\n * How the exported props are combined: `intersection` is inherited; `factory` applies only to this type.\n * Defaults to `intersection`.\n */\n composition: z.enum([\"factory\", \"intersection\"]).optional(),\n /** Props that can only be set when the element is created; changing them afterward throws. */\n constructOnly: z.array(z.string()).optional(),\n});\n\n/** Schema for one element override and the source of {@link ElementConfigOptions}. */\nconst elementConfigSchema = z.strictObject({\n /** Component export that wraps the generated element. */\n component: moduleExportSchema.optional(),\n /** Additional props type to combine with the generated element props. */\n props: elementPropsSchema.optional(),\n /** Whether the parent container creates this element's GObject instead of the element constructing its own. */\n isLazy: z.boolean({ error: \"must be a boolean\" }).optional(),\n /** Accepted child GLib type names to show in the generated element documentation. */\n acceptedChildTypes: z.array(z.string()).optional(),\n /** GObject properties to leave out of generated props, such as properties managed by an element behavior. */\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.strictObject({\n /** Path, relative to the project root, of the module exporting the element behavior map. */\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 /**\n * Element configuration overrides keyed by GLib type name, such as `GtkWidget`.\n * @see {@link ElementConfigOptions} for the fields accepted by each entry.\n */\n config: z.record(z.string(), elementConfigSchema).optional(),\n});\n\nconst agentsSchema = z.strictObject({\n /**\n * Whether codegen maintains the GTKX rules in `AGENTS.md` and creates a missing `CLAUDE.md` import.\n * Defaults to `true`.\n */\n rules: z.boolean({ error: \"must be a boolean\" }).optional(),\n /** Whether codegen writes the generated element reference to `.gtkx/reference`. Defaults to `true`. */\n reference: z.boolean({ error: \"must be a boolean\" }).optional(),\n});\n\nconst mcpSchema = z.strictObject({\n /**\n * Tool name patterns applied in order: `*` matches any text and a leading `!` excludes matches.\n * Omitted, empty, or exclusion-only lists start with all tools; other lists start with none.\n */\n tools: z\n .array(z.string({ error: \"must be a tool name pattern\" }).min(1, { error: \"must be a tool name pattern\" }), {\n error: \"must be an array of tool name patterns\",\n })\n .optional(),\n /**\n * Whether the MCP server exposes only inspection and reference tools, excluding app interactions.\n * Defaults to `false`.\n */\n readOnly: z.boolean({ error: \"must be a boolean\" }).optional(),\n});\n\nconst graduatedFutureSchema = z\n .object({\n v2ByteArrays: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n v2ValueReturns: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n v2FinishResults: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n v2InoutReturns: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n v2ResourceImports: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n v2DefaultLibraries: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n v2TreeShaking: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n })\n .strict();\n\nconst deprecationsSchema = z.strictObject({\n /** Deprecation identifiers whose warnings are suppressed. There are currently no accepted identifiers. */\n silence: z\n .array(z.never({ error: \"does not name a current deprecation\" }), {\n error: \"must be an array of current deprecation ids\",\n })\n .optional(),\n});\n\n/** Schema every `gtkx.config.ts` is validated against, and the source of the {@link Config} type. */\nconst configSchema = z.strictObject({\n /**\n * Additional GIR libraries to bind, such as `WebKit-6.0`.\n * Adwaita and GTK are included implicitly and must not be listed.\n */\n libraries: librariesSchema.optional(),\n /** Additional GIR search directories. Relative paths are resolved from the project root. */\n girPath: z.array(z.string(), { error: \"must be an array of strings if provided\" }).optional(),\n /** Required GApplication identifier, such as `com.example.Tasks`. */\n applicationId: applicationIdSchema,\n /** Whether to enable the React Compiler, or options passed to it. Enabled by default. */\n reactCompiler: reactCompilerSchema.optional(),\n /**\n * Whether GTKX generates project bindings. Set to `false` to reuse an installed binding store.\n * Defaults to `true`.\n */\n codegen: z.boolean({ error: \"must be a boolean\" }).optional(),\n /**\n * Additional signals to suppress during React property updates, keyed by GLib type name.\n * Entries extend the built-in signal lists.\n */\n userEventSignals: userEventSignalsSchema.optional(),\n /** Custom element behaviors and overrides for generated components, props, and documentation. */\n elements: elementsSchema.optional(),\n /** Path to an icon theme directory or a single application icon file, relative to the project root. */\n applicationIcon: text(\"must be a path to an icon theme directory or a single icon file\").optional(),\n /** Application metadata, bundled runtime settings, and packaging options used by `gtkx deploy`. */\n deploy: deploySchema.optional(),\n /** Controls the project instructions and reference files generated for coding agents. */\n agents: agentsSchema.optional(),\n /** Default tool selection and access mode for the project's MCP server. Command-line flags take precedence. */\n mcp: mcpSchema.optional(),\n /** Controls warnings for deprecated configuration and behavior. */\n deprecations: deprecationsSchema.optional(),\n});\n\n/**\n * Returns the given configuration unchanged, typed as {@link Config}, so `gtkx.config.ts` gets\n * autocompletion and type checking.\n */\nconst defineConfig: DefineConfig<Config> = createDefineConfig<Config>();\nconst validationSchema = configSchema.extend({ future: graduatedFutureSchema.optional() });\n\nconst isValidApplicationId = (applicationId: string): boolean =>\n applicationId.length <= APPLICATION_ID_MAX_LENGTH && APPLICATION_ID_PATTERN.test(applicationId);\n\nconst resolveReactCompilerOptions = (setting: Config[\"reactCompiler\"]): ResolvedReactCompilerOptions | null => {\n if (setting === false) {\n return null;\n }\n\n const overrides = setting === undefined || setting === true ? {} : setting;\n\n return {\n ...(overrides.compilationMode !== undefined && { compilationMode: overrides.compilationMode }),\n ...(overrides.panicThreshold !== undefined && { panicThreshold: overrides.panicThreshold }),\n target: REACT_COMPILER_TARGET,\n };\n};\n\nconst validateConfig = (config: unknown, configFile?: string): void => {\n const result = validationSchema.safeParse(config);\n\n if (!result.success) {\n throw configError(result.error, configFile);\n }\n};\n\nconst graduatedFutureKeys = (config: unknown): string[] => {\n if (!isRecord(config) || !isRecord(config.future)) {\n return [];\n }\n\n return Object.keys(config.future).toSorted((first, second) => first.localeCompare(second));\n};\n\n/**\n * Deep-merges a configuration over a base. `override` wins over `base` on conflicting scalar and object keys, while\n * arrays are concatenated with the `override` entries first.\n */\nconst mergeConfig = (base: Config, override: Config): Config => defu(override, base);\n\nconst resolveElementsModule = (behaviors: string | undefined, root: string | undefined): string | null => {\n if (behaviors === undefined) {\n return null;\n }\n\n return root === undefined ? behaviors : resolve(root, behaviors);\n};\n\nconst resolveLazyElements = (elements: Config[\"elements\"]): string[] =>\n Object.entries(elements?.config ?? {})\n .filter(([, entry]) => entry.isLazy === true)\n .map(([type]) => type);\n\nconst elementEntryValues = <T>(\n elements: Config[\"elements\"],\n pick: (entry: ElementConfigOptions) => 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, ElementPropsExport> =>\n elementEntryValues(elements, (entry) => entry.props);\n\nconst resolveAcceptedChildTypes = (elements: Config[\"elements\"]): Record<string, string[]> =>\n elementEntryValues(elements, (entry) => entry.acceptedChildTypes);\n\nconst resolveOmittedProps = (elements: Config[\"elements\"]): Record<string, string[]> =>\n elementEntryValues(elements, (entry) => entry.omittedProps);\n\nconst isAgentRulesEnabled = (config: Config): boolean => config.agents?.rules !== false;\nconst isAgentReferenceEnabled = (config: Config): boolean => config.agents?.reference !== false;\n\nconst resolveMcpSettings = (config: Config): McpSettings => ({\n tools: config.mcp?.tools ?? [],\n isReadOnly: config.mcp?.readOnly === true,\n});\n\nconst resolveConfig = (config: Config, root?: string): ResolvedConfig => ({\n applicationId: config.applicationId,\n reactCompiler: resolveReactCompilerOptions(config.reactCompiler),\n userEventSignals: resolveUserEventSignals(config.userEventSignals),\n elements: resolveElementsModule(config.elements?.behaviors, root),\n lazyElements: resolveLazyElements(config.elements),\n});\n\nexport {\n APPLICATION_ID_MAX_LENGTH,\n defineConfig,\n isAgentReferenceEnabled,\n isAgentRulesEnabled,\n isValidApplicationId,\n graduatedFutureKeys,\n validateConfig,\n mergeConfig,\n resolveLazyElements,\n resolveElementComponents,\n resolveElementProps,\n resolveAcceptedChildTypes,\n resolveMcpSettings,\n resolveOmittedProps,\n resolveConfig,\n type McpSettings,\n type ResolvedReactCompilerOptions,\n type Config,\n type ElementConfigOptions,\n type ElementPropsExport,\n type ModuleExport,\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,WAAW,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAsB,YAAY,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAwKlE,MAAM,sBAAsB,GAAG,uDAAuD,CAAC;AACvF,MAAM,yBAAyB,GAAG,GAAG,CAAC;AACtC,MAAM,sBAAsB,GAAG,kBAAkB,CAAC;AAClD,MAAM,kBAAkB,GAAgB,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC;AACtE,+DAA+D;AAC/D,MAAM,iBAAiB,GAAG,CAAC,OAAO,EA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AC,CAAC;AAEH,MAAM,aAAa,GAAG,CAAC,MAAyB,EAAE,iBAAyB,EAAE,IAAa,EAAkB,EAAE,CAAC,CAAC;IAC5G,aAAa,EAAE,MAAM,CAAC,aAAa;IACnC,iBAAiB;IACjB,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,YAAY,EACZ,yBAAyB,EACzB,sBAAsB,EACtB,YAAY,EACZ,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,yBAAyB,EACzB,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,GAchB,CAAC","sourcesContent":["import { createDefineConfig, type DefineConfig } from \"c12\";\nimport { defu } from \"defu\";\nimport { resolve } from \"node:path\";\nimport { z } from \"zod\";\nimport { configError, isRecord } from \"./config-error.ts\";\nimport { type DeployOptions, deploySchema } from \"./deploy.ts\";\nimport { girLibrary, text } from \"./schema-text.ts\";\nimport { resolveUserEventSignals } from \"./user-event-signals.ts\";\n\n/** Object form of the `reactCompiler` config key, forwarded to `babel-plugin-react-compiler`. */\ntype ReactCompilerOptions = {\n /** Which functions the React Compiler processes. */\n compilationMode?: \"all\" | \"annotation\" | \"infer\" | \"syntax\" | undefined;\n /** Which React Compiler diagnostics fail the build. */\n panicThreshold?: \"all_errors\" | \"critical_errors\" | \"none\" | undefined;\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 * GTKX project configuration authored in `gtkx.config.ts` and validated when loaded.\n */\ntype Config = {\n /**\n * Additional GIR libraries to bind, such as `WebKit-6.0`.\n * Adwaita and GTK are included implicitly and must not be listed.\n */\n libraries?: string[] | undefined;\n /** Additional GIR search directories. Relative paths are resolved from the project root. */\n girPath?: string[] | undefined;\n /**\n * GApplication identifier, such as `com.example.Tasks`. Required to run, build or deploy the project as an\n * application; a package that is not an application, such as a component library, leaves it out.\n */\n applicationId?: string | undefined;\n /** Whether to enable the React Compiler, or options passed to it. Enabled by default. */\n reactCompiler?: boolean | ReactCompilerOptions | undefined;\n /**\n * Whether GTKX generates project bindings. Set to `false` to reuse an installed binding store.\n * Defaults to `true`.\n */\n codegen?: boolean | undefined;\n /**\n * Additional signals to suppress during React property updates, keyed by GLib type name.\n * Entries extend the built-in signal lists.\n */\n userEventSignals?: Record<string, string[]> | undefined;\n /** Custom element behaviors and overrides for generated components, props, and documentation. */\n elements?: ElementsOptions | undefined;\n /** Path to an icon theme directory or a single application icon file, relative to the project root. */\n applicationIcon?: string | undefined;\n /** Application metadata, bundled runtime settings, and packaging options used by `gtkx deploy`. */\n deploy?: DeployOptions | undefined;\n /** Controls the project instructions and reference files generated for coding agents. */\n agents?: AgentsOptions | undefined;\n /** Default tool selection and access mode for the project's MCP server. Command-line flags take precedence. */\n mcp?: McpOptions | undefined;\n /** Controls warnings for deprecated configuration and behavior. */\n deprecations?: DeprecationsOptions | undefined;\n};\n/** A {@link Config} whose `applicationId` is known, as loaded for an application. */\ntype ApplicationConfig = Config & { applicationId: string };\n\n/** A named export of a module, which `elements.config` entries reference for components and props. */\ntype ModuleExport = {\n /** Module specifier containing the named export; relative paths start at the project root. */\n module: string;\n /** Name of the export to import from the module. */\n export: string;\n};\n\n/** The props type an `elements.config` entry adds to a generated element, and how it combines with them. */\ntype ElementPropsExport = {\n /** Module specifier containing the named export; relative paths start at the project root. */\n module: string;\n /** Name of the props type to import from the module. */\n export: string;\n /**\n * How the exported props are combined: `intersection` is inherited; `factory` applies only to this type.\n * Defaults to `intersection`.\n */\n composition?: \"factory\" | \"intersection\" | undefined;\n /** Props that can only be set when the element is created; changing them afterward throws. */\n constructOnly?: string[] | undefined;\n};\n\n/** Overrides for one GLib type in `elements.config`, keyed by its registered type name. */\ntype ElementConfigOptions = {\n /** Component export that wraps the generated element. */\n component?: ModuleExport | undefined;\n /** Additional props type to combine with the generated element props. */\n props?: ElementPropsExport | undefined;\n /** Whether the parent container creates this element's GObject instead of the element constructing its own. */\n isLazy?: boolean | undefined;\n /** Accepted child GLib type names to show in the generated element documentation. */\n acceptedChildTypes?: string[] | undefined;\n /** GObject properties to leave out of generated props, such as properties managed by an element behavior. */\n omittedProps?: string[] | undefined;\n};\n\n/** The `elements` options: custom element behaviors and per-type overrides for generated elements. */\ntype ElementsOptions = {\n /** Path, relative to the project root, of the module exporting the element behavior map. */\n behaviors?: string | undefined;\n /** Element configuration overrides keyed by GLib type name, such as `GtkWidget`. */\n config?: Record<string, ElementConfigOptions> | undefined;\n};\n\n/** The `agents` options: which files codegen maintains for coding agents. */\ntype AgentsOptions = {\n /**\n * Whether codegen maintains the GTKX rules in `AGENTS.md` and creates a missing `CLAUDE.md` import.\n * `false` removes rules written earlier, deleting `AGENTS.md` and the `CLAUDE.md` import when nothing else\n * remains. Defaults to `true` for an application and `false` for a package without an `applicationId`.\n */\n rules?: boolean | undefined;\n /**\n * Whether codegen writes the generated element reference to `.gtkx/reference` and points the rules at it.\n * `false` removes a reference generated earlier. Defaults to `true` for an application and `false` for a\n * package without an `applicationId`.\n */\n reference?: boolean | undefined;\n};\n\n/** The `mcp` options: the tools `gtkx mcp` offers by default and whether it may interact with the app. */\ntype McpOptions = {\n /**\n * Tool name patterns applied in order: `*` matches any text and a leading `!` excludes matches.\n * Omitted, empty, or exclusion-only lists start with all tools; other lists start with none.\n */\n tools?: string[] | undefined;\n /**\n * Whether the MCP server exposes only inspection and reference tools, excluding app interactions.\n * Defaults to `false`.\n */\n readOnly?: boolean | undefined;\n};\n\n/** The `deprecations` options: which deprecation warnings stay silent. */\ntype DeprecationsOptions = {\n /** Deprecation identifiers whose warnings are suppressed. There are currently no accepted identifiers. */\n silence?: never[] | undefined;\n};\n\ntype McpSettings = {\n tools: string[];\n isReadOnly: boolean;\n};\n\n/** Configuration reduced to the values the app runtime and the build need, with paths already resolved. */\ntype ResolvedConfig = {\n /** The GApplication identifier the app registers under. */\n applicationId: string;\n /** The gettext domain, which is the `applicationId` production builds use. */\n translationDomain: string;\n /** React Compiler options for the build, or `null` when the compiler is disabled. */\n reactCompiler: ResolvedReactCompilerOptions | null;\n /**\n * Signal names, keyed by GLib type name, that stay suppressed while a React commit writes to a widget.\n * `notify` stays suppressed only for the property being written.\n */\n userEventSignals: Record<string, string[]>;\n /** Path of the module exporting per-element configs, or `null` when none is configured. */\n elements: string | null;\n /** GLib type names of the elements marked `isLazy`, whose GObject their parent container creates. */\n lazyElements: string[];\n};\n\nconst APPLICATION_ID_PATTERN = /^[A-Za-z_][A-Za-z0-9_-]*(\\.[A-Za-z_][A-Za-z0-9_-]*)+$/;\nconst APPLICATION_ID_MAX_LENGTH = 255;\nconst LIBRARY_APPLICATION_ID = \"org.gtkx.Library\";\nconst IMPLICIT_LIBRARIES: Set<string> = new Set([\"Adw-1\", \"Gtk-4.0\"]);\n/** Compilation modes `babel-plugin-react-compiler` accepts. */\nconst COMPILATION_MODES = [\"infer\", \"syntax\", \"annotation\", \"all\"] as const;\n/** Panic thresholds `babel-plugin-react-compiler` accepts. */\nconst PANIC_THRESHOLDS = [\"none\", \"critical_errors\", \"all_errors\"] as const;\nconst REACT_COMPILER_TARGET = \"19\";\n\nconst librarySchema = girLibrary('must be of the form \"Name-Version\", such as \"Adw-1\"').refine(\n (library) => !IMPLICIT_LIBRARIES.has(library),\n { error: \"is bound implicitly; remove it\" },\n);\n\nconst librariesSchema = z\n .array(librarySchema, { error: \"must be a non-empty string array or omitted\" })\n .min(1, { error: \"must be a non-empty string array or omitted\" });\n\nconst applicationIdSchema = z\n .string({\n error: (issue) =>\n issue.input === undefined\n ? 'is required to run, build or deploy an application, such as \"org.example.MyApp\"'\n : \"must satisfy g_application_id_is_valid\",\n })\n .refine((value) => isValidApplicationId(value), {\n error: 'must satisfy g_application_id_is_valid, such as \"org.example.MyApp\"',\n });\n\nconst reactCompilerOptionsSchema = z.strictObject({\n compilationMode: z.enum(COMPILATION_MODES).optional(),\n panicThreshold: z.enum(PANIC_THRESHOLDS).optional(),\n}) satisfies z.ZodType<ReactCompilerOptions>;\n\nconst reactCompilerSchema = z.union([z.boolean(), reactCompilerOptionsSchema]);\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.strictObject(\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) satisfies z.ZodType<ModuleExport>;\n\nconst elementPropsSchema = moduleExportSchema.extend({\n composition: z.enum([\"factory\", \"intersection\"]).optional(),\n constructOnly: z.array(z.string()).optional(),\n}) satisfies z.ZodType<ElementPropsExport>;\n\nconst elementConfigSchema = z.strictObject({\n component: moduleExportSchema.optional(),\n props: elementPropsSchema.optional(),\n isLazy: z.boolean({ error: \"must be a boolean\" }).optional(),\n acceptedChildTypes: z.array(z.string()).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}) satisfies z.ZodType<ElementConfigOptions>;\n\nconst elementsSchema = z.strictObject({\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}) satisfies z.ZodType<ElementsOptions>;\n\nconst agentsSchema = z.strictObject({\n rules: z.boolean({ error: \"must be a boolean\" }).optional(),\n reference: z.boolean({ error: \"must be a boolean\" }).optional(),\n}) satisfies z.ZodType<AgentsOptions>;\n\nconst mcpSchema = z.strictObject({\n tools: z\n .array(z.string({ error: \"must be a tool name pattern\" }).min(1, { error: \"must be a tool name pattern\" }), {\n error: \"must be an array of tool name patterns\",\n })\n .optional(),\n readOnly: z.boolean({ error: \"must be a boolean\" }).optional(),\n}) satisfies z.ZodType<McpOptions>;\n\nconst graduatedFutureSchema = z\n .object({\n v2ByteArrays: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n v2ValueReturns: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n v2FinishResults: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n v2InoutReturns: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n v2ResourceImports: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n v2DefaultLibraries: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n v2TreeShaking: z.literal(true, { error: \"can only be true; remove the flag\" }).optional(),\n })\n .strict();\n\nconst deprecationsSchema = z.strictObject({\n silence: z\n .array(z.never({ error: \"does not name a current deprecation\" }), {\n error: \"must be an array of current deprecation ids\",\n })\n .optional(),\n}) satisfies z.ZodType<DeprecationsOptions>;\n\n/** Schema every `gtkx.config.ts` is validated against. */\nconst configSchema = z.strictObject({\n libraries: librariesSchema.optional(),\n girPath: z.array(z.string(), { error: \"must be an array of strings if provided\" }).optional(),\n applicationId: applicationIdSchema.optional(),\n reactCompiler: reactCompilerSchema.optional(),\n codegen: z.boolean({ error: \"must be a boolean\" }).optional(),\n userEventSignals: userEventSignalsSchema.optional(),\n elements: elementsSchema.optional(),\n applicationIcon: text(\"must be a path to an icon theme directory or a single icon file\").optional(),\n deploy: deploySchema.optional(),\n agents: agentsSchema.optional(),\n mcp: mcpSchema.optional(),\n deprecations: deprecationsSchema.optional(),\n}) satisfies z.ZodType<Config>;\n\n/**\n * Returns the given configuration unchanged, typed as {@link Config}, so `gtkx.config.ts` gets\n * autocompletion and type checking.\n */\nconst defineConfig: DefineConfig<Config> = createDefineConfig<Config>();\nconst validationSchema = configSchema.extend({\n applicationId: applicationIdSchema,\n future: graduatedFutureSchema.optional(),\n});\n\nconst isValidApplicationId = (applicationId: string): boolean =>\n applicationId.length <= APPLICATION_ID_MAX_LENGTH && APPLICATION_ID_PATTERN.test(applicationId);\n\nconst resolveReactCompilerOptions = (setting: Config[\"reactCompiler\"]): ResolvedReactCompilerOptions | null => {\n if (setting === false) {\n return null;\n }\n\n const overrides = setting === undefined || setting === true ? {} : setting;\n\n return {\n ...(overrides.compilationMode !== undefined && { compilationMode: overrides.compilationMode }),\n ...(overrides.panicThreshold !== undefined && { panicThreshold: overrides.panicThreshold }),\n target: REACT_COMPILER_TARGET,\n };\n};\n\nconst validateConfig: (config: unknown, configFile?: string) => asserts config is ApplicationConfig = (\n config,\n configFile,\n) => {\n const result = validationSchema.safeParse(config);\n\n if (!result.success) {\n throw configError(result.error, configFile);\n }\n};\n\nconst graduatedFutureKeys = (config: unknown): string[] => {\n if (!isRecord(config) || !isRecord(config.future)) {\n return [];\n }\n\n return Object.keys(config.future).toSorted((first, second) => first.localeCompare(second));\n};\n\n/**\n * Deep-merges a configuration over a base. `override` wins over `base` on conflicting scalar and object keys, while\n * arrays are concatenated with the `override` entries first.\n */\nconst mergeConfig = (base: Config, override: Config): Config => defu(override, base);\n\nconst resolveElementsModule = (behaviors: string | undefined, root: string | undefined): string | null => {\n if (behaviors === undefined) {\n return null;\n }\n\n return root === undefined ? behaviors : resolve(root, behaviors);\n};\n\nconst resolveLazyElements = (elements: Config[\"elements\"]): string[] =>\n Object.entries(elements?.config ?? {})\n .filter(([, entry]) => entry.isLazy === true)\n .map(([type]) => type);\n\nconst elementEntryValues = <T>(\n elements: Config[\"elements\"],\n pick: (entry: ElementConfigOptions) => 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 resolveModuleSpecifier = <T extends { module: string }>(reference: T, root: string): T =>\n reference.module.startsWith(\"./\") || reference.module.startsWith(\"../\")\n ? { ...reference, module: resolve(root, reference.module) }\n : reference;\n\nconst resolveElementComponents = (elements: Config[\"elements\"], root: string): Record<string, ModuleExport> =>\n elementEntryValues(elements, (entry) => entry.component && resolveModuleSpecifier(entry.component, root));\n\nconst resolveElementProps = (elements: Config[\"elements\"], root: string): Record<string, ElementPropsExport> =>\n elementEntryValues(elements, (entry) => entry.props && resolveModuleSpecifier(entry.props, root));\n\nconst resolveAcceptedChildTypes = (elements: Config[\"elements\"]): Record<string, string[]> =>\n elementEntryValues(elements, (entry) => entry.acceptedChildTypes);\n\nconst resolveOmittedProps = (elements: Config[\"elements\"]): Record<string, string[]> =>\n elementEntryValues(elements, (entry) => entry.omittedProps);\n\nconst isAgentRulesEnabled = (config: Config, isApplication: boolean): boolean => config.agents?.rules ?? isApplication;\nconst isAgentReferenceEnabled = (config: Config, isApplication: boolean): boolean =>\n config.agents?.reference ?? isApplication;\n\nconst resolveMcpSettings = (config: Config): McpSettings => ({\n tools: config.mcp?.tools ?? [],\n isReadOnly: config.mcp?.readOnly === true,\n});\n\nconst resolveConfig = (config: ApplicationConfig, translationDomain: string, root?: string): ResolvedConfig => ({\n applicationId: config.applicationId,\n translationDomain,\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 configSchema,\n APPLICATION_ID_MAX_LENGTH,\n LIBRARY_APPLICATION_ID,\n defineConfig,\n isAgentReferenceEnabled,\n isAgentRulesEnabled,\n isValidApplicationId,\n graduatedFutureKeys,\n validateConfig,\n mergeConfig,\n resolveLazyElements,\n resolveElementComponents,\n resolveElementProps,\n resolveAcceptedChildTypes,\n resolveMcpSettings,\n resolveOmittedProps,\n resolveConfig,\n type AgentsOptions,\n type DeprecationsOptions,\n type ElementsOptions,\n type McpOptions,\n type McpSettings,\n type ReactCompilerOptions,\n type ResolvedReactCompilerOptions,\n type ApplicationConfig,\n type Config,\n type ElementConfigOptions,\n type ElementPropsExport,\n type ModuleExport,\n type ResolvedConfig,\n};\n"]}