@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.
- package/README.md +2 -2
- package/dist/builtin-elements.d.ts +13 -1
- package/dist/builtin-elements.d.ts.map +1 -1
- package/dist/builtin-elements.js +47 -10
- package/dist/builtin-elements.js.map +1 -1
- package/dist/config-source.d.ts +2 -2
- package/dist/config-source.d.ts.map +1 -1
- package/dist/config-source.js +10 -7
- package/dist/config-source.js.map +1 -1
- package/dist/config.d.ts +256 -57
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +27 -72
- package/dist/config.js.map +1 -1
- package/dist/deploy.d.ts +930 -55
- package/dist/deploy.d.ts.map +1 -1
- package/dist/deploy.js +6 -161
- package/dist/deploy.js.map +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +1 -1
- package/dist/internal.js.map +1 -1
- package/dist/loader.d.ts +20 -4
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +51 -18
- package/dist/loader.js.map +1 -1
- package/dist/virtual.d.ts.map +1 -1
- package/dist/virtual.js +1 -0
- package/dist/virtual.js.map +1 -1
- package/dist/vite-plugin.d.ts +5 -0
- package/dist/vite-plugin.d.ts.map +1 -1
- package/dist/vite-plugin.js.map +1 -1
- package/package.json +5 -5
- package/src/builtin-elements.ts +49 -10
- package/src/config-source.ts +11 -7
- package/src/config.ts +289 -91
- package/src/deploy.ts +991 -199
- package/src/index.ts +39 -2
- package/src/internal.ts +1 -0
- package/src/loader.ts +96 -22
- package/src/virtual.ts +1 -0
- package/src/vite-plugin.ts +5 -0
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
|
-
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
|
@@ -17,12 +26,224 @@ type ResolvedReactCompilerOptions = ReactCompilerOptions & {
|
|
|
17
26
|
};
|
|
18
27
|
/**
|
|
19
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.
|
|
20
32
|
*/
|
|
21
|
-
type Config =
|
|
22
|
-
|
|
23
|
-
|
|
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
|
+
};
|
|
24
149
|
/** Overrides for one GLib type in `elements.config`, keyed by its registered type name. */
|
|
25
|
-
type ElementConfigOptions =
|
|
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,47 +267,12 @@ type ResolvedConfig = {
|
|
|
44
267
|
lazyElements: string[];
|
|
45
268
|
};
|
|
46
269
|
declare const APPLICATION_ID_MAX_LENGTH = 255;
|
|
47
|
-
|
|
48
|
-
|
|
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.$strict>;
|
|
55
|
-
declare const elementPropsSchema: z.ZodObject<{
|
|
56
|
-
module: z.ZodString;
|
|
57
|
-
export: z.ZodString;
|
|
58
|
-
composition: z.ZodOptional<z.ZodEnum<{
|
|
59
|
-
factory: "factory";
|
|
60
|
-
intersection: "intersection";
|
|
61
|
-
}>>;
|
|
62
|
-
constructOnly: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
63
|
-
}, z.core.$strict>;
|
|
64
|
-
/** Schema for one element override and the source of {@link ElementConfigOptions}. */
|
|
65
|
-
declare const elementConfigSchema: z.ZodObject<{
|
|
66
|
-
component: z.ZodOptional<z.ZodObject<{
|
|
67
|
-
module: z.ZodString;
|
|
68
|
-
export: z.ZodString;
|
|
69
|
-
}, z.core.$strict>>;
|
|
70
|
-
props: z.ZodOptional<z.ZodObject<{
|
|
71
|
-
module: z.ZodString;
|
|
72
|
-
export: z.ZodString;
|
|
73
|
-
composition: z.ZodOptional<z.ZodEnum<{
|
|
74
|
-
factory: "factory";
|
|
75
|
-
intersection: "intersection";
|
|
76
|
-
}>>;
|
|
77
|
-
constructOnly: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
78
|
-
}, z.core.$strict>>;
|
|
79
|
-
isLazy: z.ZodOptional<z.ZodBoolean>;
|
|
80
|
-
acceptedChildTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
81
|
-
omittedProps: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
82
|
-
}, z.core.$strict>;
|
|
83
|
-
/** 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. */
|
|
84
272
|
declare const configSchema: z.ZodObject<{
|
|
85
273
|
libraries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
86
274
|
girPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
87
|
-
applicationId: z.ZodString
|
|
275
|
+
applicationId: z.ZodOptional<z.ZodString>;
|
|
88
276
|
reactCompiler: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
89
277
|
compilationMode: z.ZodOptional<z.ZodEnum<{
|
|
90
278
|
all: "all";
|
|
@@ -216,7 +404,10 @@ declare const configSchema: z.ZodObject<{
|
|
|
216
404
|
desktopEntry: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
217
405
|
metainfoExtra: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
218
406
|
isDbusActivatable: z.ZodOptional<z.ZodBoolean>;
|
|
219
|
-
extraFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.
|
|
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>]>>>;
|
|
220
411
|
minimumLibraryVersions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
221
412
|
depends: z.ZodOptional<z.ZodObject<{
|
|
222
413
|
deb: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -245,11 +436,9 @@ declare const configSchema: z.ZodObject<{
|
|
|
245
436
|
}, z.core.$strict>>;
|
|
246
437
|
breaks: z.ZodOptional<z.ZodObject<{
|
|
247
438
|
deb: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
248
|
-
rpm: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
249
439
|
}, z.core.$strict>>;
|
|
250
440
|
preDepends: z.ZodOptional<z.ZodObject<{
|
|
251
441
|
deb: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
252
|
-
rpm: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
253
442
|
}, z.core.$strict>>;
|
|
254
443
|
}, z.core.$strict>>;
|
|
255
444
|
scripts: z.ZodOptional<z.ZodObject<{
|
|
@@ -258,7 +447,17 @@ declare const configSchema: z.ZodObject<{
|
|
|
258
447
|
preRemove: z.ZodOptional<z.ZodString>;
|
|
259
448
|
postRemove: z.ZodOptional<z.ZodString>;
|
|
260
449
|
}, z.core.$strict>>;
|
|
261
|
-
node: z.ZodOptional<z.
|
|
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>>;
|
|
262
461
|
tools: z.ZodOptional<z.ZodObject<{
|
|
263
462
|
nfpm: z.ZodOptional<z.ZodString>;
|
|
264
463
|
}, z.core.$strict>>;
|
|
@@ -370,7 +569,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
370
569
|
*/
|
|
371
570
|
declare const defineConfig: DefineConfig<Config>;
|
|
372
571
|
declare const isValidApplicationId: (applicationId: string) => boolean;
|
|
373
|
-
declare const validateConfig: (config: unknown, configFile?: string) =>
|
|
572
|
+
declare const validateConfig: (config: unknown, configFile?: string) => asserts config is ApplicationConfig;
|
|
374
573
|
declare const graduatedFutureKeys: (config: unknown) => string[];
|
|
375
574
|
/**
|
|
376
575
|
* Deep-merges a configuration over a base. `override` wins over `base` on conflicting scalar and object keys, while
|
|
@@ -378,13 +577,13 @@ declare const graduatedFutureKeys: (config: unknown) => string[];
|
|
|
378
577
|
*/
|
|
379
578
|
declare const mergeConfig: (base: Config, override: Config) => Config;
|
|
380
579
|
declare const resolveLazyElements: (elements: Config["elements"]) => string[];
|
|
381
|
-
declare const resolveElementComponents: (elements: Config["elements"]) => Record<string, ModuleExport>;
|
|
382
|
-
declare const resolveElementProps: (elements: Config["elements"]) => Record<string, ElementPropsExport>;
|
|
580
|
+
declare const resolveElementComponents: (elements: Config["elements"], root: string) => Record<string, ModuleExport>;
|
|
581
|
+
declare const resolveElementProps: (elements: Config["elements"], root: string) => Record<string, ElementPropsExport>;
|
|
383
582
|
declare const resolveAcceptedChildTypes: (elements: Config["elements"]) => Record<string, string[]>;
|
|
384
583
|
declare const resolveOmittedProps: (elements: Config["elements"]) => Record<string, string[]>;
|
|
385
|
-
declare const isAgentRulesEnabled: (config: Config) => boolean;
|
|
386
|
-
declare const isAgentReferenceEnabled: (config: Config) => boolean;
|
|
584
|
+
declare const isAgentRulesEnabled: (config: Config, isApplication: boolean) => boolean;
|
|
585
|
+
declare const isAgentReferenceEnabled: (config: Config, isApplication: boolean) => boolean;
|
|
387
586
|
declare const resolveMcpSettings: (config: Config) => McpSettings;
|
|
388
|
-
declare const resolveConfig: (config:
|
|
389
|
-
export { APPLICATION_ID_MAX_LENGTH, defineConfig, isAgentReferenceEnabled, isAgentRulesEnabled, isValidApplicationId, graduatedFutureKeys, validateConfig, mergeConfig, resolveLazyElements, resolveElementComponents, resolveElementProps, resolveAcceptedChildTypes, resolveMcpSettings, resolveOmittedProps, resolveConfig, type McpSettings, type ResolvedReactCompilerOptions, type Config, type ElementConfigOptions, type ElementPropsExport, type ModuleExport, 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 ResolvedConfig, };
|
|
390
589
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,KAAK,CAAC;AAG5D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,KAAK,CAAC;AAG5D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,aAAa,EAAgB,MAAM,aAAa,CAAC;AAI/D,iGAAiG;AACjG,KAAK,oBAAoB,GAAG;IACxB;;;;OAIG;IACH,eAAe,CAAC,EAAE,KAAK,GAAG,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;IACxE;;;;OAIG;IACH,cAAc,CAAC,EAAE,YAAY,GAAG,iBAAiB,GAAG,MAAM,GAAG,SAAS,CAAC;CAC1E,CAAC;AAEF;;;GAGG;AACH,KAAK,4BAA4B,GAAG,oBAAoB,GAAG;IACvD,kDAAkD;IAClD,MAAM,EAAE,IAAI,CAAC;CAChB,CAAC;AAEF;;;;;GAKG;AACH,KAAK,MAAM,GAAG;IACV;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,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xB,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,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({
|
|
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
|
|
27
|
-
z.
|
|
28
|
-
z.
|
|
29
|
-
|
|
30
|
-
|
|
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
|
|
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
|
-
|
|
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({
|
|
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
|
|
211
|
-
|
|
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
|
|
215
|
-
const isAgentReferenceEnabled = (config) => config.agents?.reference
|
|
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
|