@gtkx/config 1.0.0-rc.4 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -108,7 +108,7 @@ React Native and similar frameworks hide the native toolkit so one API can run e
108
108
 
109
109
  ### Why Node.js, and why generated bindings
110
110
 
111
- GTKX runs on Node.js, which puts native modules, the npm ecosystem, and the tooling built for Node.js APIs within reach. GJS is GNOME's own runtime, built on SpiderMonkey rather than V8; node-gtk runs on Node.js but is lightly maintained, on the older nan/V8 ABI rather than N-API, and still centered on GTK3. The [Why GTKX guide](https://gtkx.dev/guide/why-gtkx) covers the comparison in full.
111
+ GTKX runs on Node.js, which puts native modules, the npm ecosystem, and the tooling built for Node.js APIs within reach. GJS is GNOME's own runtime, built on SpiderMonkey rather than V8; node-gtk runs on Node.js but is lightly maintained, on the older nan/V8 ABI rather than N-API, and still centered on GTK3. The [Why GTKX guide](https://gtkx.dev/guide/why-gtkx) covers what running on Node.js means day to day.
112
112
 
113
113
  GTKX generates the TypeScript types and the native FFI calls from the same GObject-Introspection data, so the types cannot drift from the calls they back. Codegen covers the whole GTK4 and Adwaita surface.
114
114
 
@@ -121,10 +121,10 @@ GTKX is Linux-only and needs Node.js 24 or later. See [Requirements](#requiremen
121
121
  Scaffold a new app with the `create-gtkx` initializer:
122
122
 
123
123
  ```sh
124
- npm create gtkx@rc
124
+ npm create gtkx
125
125
  ```
126
126
 
127
- The same command works with other package managers: `pnpm create gtkx@rc` or `yarn create gtkx@rc`.
127
+ The same command works with other package managers: `pnpm create gtkx` or `yarn create gtkx`.
128
128
 
129
129
  Then run your new app:
130
130
 
@@ -145,7 +145,7 @@ The documentation at **[gtkx.dev](https://gtkx.dev)** includes a step-by-step tu
145
145
 
146
146
  GTKX is Linux-only. You need:
147
147
 
148
- - Linux with the GTK4 (4.20 or later), Adwaita (1.8 or later), and GLib development libraries
148
+ - Linux with the GTK4 (4.20 or later) and GLib development libraries, plus Adwaita (1.8 or later) once your project binds `Adw-1`
149
149
  - Node.js 24 or later
150
150
 
151
151
  The `@gtkx/native` addon ships prebuilt for x64 and arm64 glibc Linux; other targets need to build it from the GTKX repository, which requires a Rust toolchain.
@@ -161,7 +161,7 @@ Explore the [example apps](https://github.com/gtkx-org/gtkx/tree/main/examples):
161
161
 
162
162
  ## Status
163
163
 
164
- GTKX 1.0 is at the release candidate stage.
164
+ GTKX 1.0 is released.
165
165
 
166
166
  ## Contributing
167
167
 
package/dist/config.d.ts CHANGED
@@ -25,7 +25,6 @@ type ResolvedReactCompilerOptions = ReactCompilerOptions & {
25
25
  * Compiler, codegen, and user event signal settings.
26
26
  */
27
27
  type Config = z.infer<typeof configSchema>;
28
- /** A named export referenced as plain data, so codegen can emit an import for it without loading the module. */
29
28
  type ModuleExport = z.infer<typeof moduleExportSchema>;
30
29
  /** Configuration reduced to the values the app runtime and the build need, with paths already resolved. */
31
30
  type ResolvedConfig = {
@@ -40,14 +39,15 @@ type ResolvedConfig = {
40
39
  /** GLib type names of the elements marked `isLazy`, whose GObject their parent container creates. */
41
40
  lazyElements: string[];
42
41
  };
42
+ /** Compilation modes `babel-plugin-react-compiler` accepts. */
43
43
  declare const COMPILATION_MODES: readonly ["infer", "syntax", "annotation", "all"];
44
+ /** Panic thresholds `babel-plugin-react-compiler` accepts. */
44
45
  declare const PANIC_THRESHOLDS: readonly ["none", "critical_errors", "all_errors"];
45
- /** Validates a `{ module, export }` reference to a named export. */
46
46
  declare const moduleExportSchema: z.ZodObject<{
47
47
  module: z.ZodString;
48
48
  export: z.ZodString;
49
49
  }, z.core.$strip>;
50
- /** The shape every `gtkx.config.ts` is validated against, and the source of the {@link Config} type. */
50
+ /** Schema every `gtkx.config.ts` is validated against, and the source of the {@link Config} type. */
51
51
  declare const configSchema: z.ZodObject<{
52
52
  libraries: z.ZodOptional<z.ZodCustom<string[] | "*", string[] | "*">>;
53
53
  girPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -89,5 +89,5 @@ declare const resolveElementComponents: (elements: Config["elements"]) => Record
89
89
  declare const resolveElementProps: (elements: Config["elements"]) => Record<string, ModuleExport>;
90
90
  declare const resolveOmittedProps: (elements: Config["elements"]) => Record<string, string[]>;
91
91
  declare const resolveConfig: (config: Config, root?: string) => ResolvedConfig;
92
- export { defineConfig, isValidApplicationId, resolveReactCompilerOptions, validateConfig, mergeConfig, resolveLazyElements, resolveElementComponents, resolveElementProps, resolveOmittedProps, resolveConfig, type ResolvedReactCompilerOptions, type Config, type ModuleExport, type ResolvedConfig, };
92
+ export { defineConfig, isValidApplicationId, resolveReactCompilerOptions, validateConfig, mergeConfig, resolveLazyElements, resolveElementComponents, resolveElementProps, resolveOmittedProps, resolveConfig, type ResolvedReactCompilerOptions, type Config, type ResolvedConfig, };
93
93
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,KAAK,CAAC;AAG5D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,wGAAwG;AACxG,KAAK,4BAA4B,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AACvE,0GAA0G;AAC1G,KAAK,2BAA2B,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAErE,uGAAuG;AACvG,KAAK,oBAAoB,GAAG;IACxB,+FAA+F;IAC/F,eAAe,CAAC,EAAE,4BAA4B,CAAC;IAC/C,kGAAkG;IAClG,cAAc,CAAC,EAAE,2BAA2B,CAAC;CAChD,CAAC;AAEF;;;GAGG;AACH,KAAK,4BAA4B,GAAG,oBAAoB,GAAG;IACvD,kDAAkD;IAClD,MAAM,EAAE,IAAI,CAAC;CAChB,CAAC;AAEF;;;;GAIG;AACH,KAAK,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,Y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A,MAAM,wBAAwB,GAAI,UAAU,MAAM,CAAC,UAAU,CAAC,KAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAChC,CAAC;AAE7D,QAAA,MAAM,mBAAmB,GAAI,UAAU,MAAM,CAAC,UAAU,CAAC,KAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAC/B,CAAC;AAEzD,QAAA,MAAM,mBAAmB,GAAI,UAAU,MAAM,CAAC,UAAU,CAAC,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CACpB,CAAC;AAEhE,QAAA,MAAM,aAAa,GAAI,QAAQ,MAAM,EAAE,OAAO,MAAM,KAAG,cAMrD,CAAC;AAEH,OAAO,EACH,YAAY,EACZ,oBAAoB,EACpB,2BAA2B,EAC3B,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,KAAK,4BAA4B,EACjC,KAAK,MAAM,EACX,KAAK,cAAc,GACtB,CAAC"}
package/dist/config.js CHANGED
@@ -8,12 +8,13 @@ const LIBRARIES_WILDCARD = "*";
8
8
  const GIR_LIBRARY_PATTERN = /^[A-Za-z][A-Za-z0-9]*-\d+(?:\.\d+)*$/;
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
+ /** Compilation modes `babel-plugin-react-compiler` accepts. */
11
12
  const COMPILATION_MODES = ["infer", "syntax", "annotation", "all"];
13
+ /** Panic thresholds `babel-plugin-react-compiler` accepts. */
12
14
  const PANIC_THRESHOLDS = ["none", "critical_errors", "all_errors"];
13
15
  const REACT_COMPILER_TARGET = "19";
14
16
  const COMPILATION_MODE_SET = new Set(COMPILATION_MODES);
15
17
  const PANIC_THRESHOLD_SET = new Set(PANIC_THRESHOLDS);
16
- /** Validates `libraries`: the `"*"` wildcard on its own, or a non-empty array of `Name-Version` identifiers. */
17
18
  const librariesSchema = z.custom().check((ctx) => {
18
19
  const value = ctx.value;
19
20
  if (value === LIBRARIES_WILDCARD) {
@@ -27,7 +28,6 @@ const librariesSchema = z.custom().check((ctx) => {
27
28
  ctx.issues.push(...libraryEntryIssues(value, index, entry));
28
29
  }
29
30
  });
30
- /** Validates `applicationId` against the reverse-DNS form `g_application_id_is_valid` accepts. */
31
31
  const applicationIdSchema = z.custom().check((ctx) => {
32
32
  const value = ctx.value;
33
33
  if (typeof value !== "string" || !isValidApplicationId(value)) {
@@ -35,7 +35,6 @@ const applicationIdSchema = z.custom().check((ctx) => {
35
35
  '(e.g. "org.example.MyApp")', true));
36
36
  }
37
37
  });
38
- /** Validates `reactCompiler`: a boolean, or an options object whose mode and threshold are known values. */
39
38
  const reactCompilerSchema = z.custom().check((ctx) => {
40
39
  const value = ctx.value;
41
40
  if (typeof value === "boolean") {
@@ -56,66 +55,38 @@ const reactCompilerSchema = z.custom().check((ctx) => {
56
55
  `must be one of ${PANIC_THRESHOLDS.join(", ")}`, true));
57
56
  }
58
57
  });
59
- /** Validates `userEventSignals`: GLib type names mapped to arrays of non-empty signal names. */
60
58
  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" }), {
61
59
  error: "must be an array of signal names",
62
60
  }), { error: "must be a record of GLib type names to signal name arrays" });
63
- /** Validates a `{ module, export }` reference to a named export. */
64
61
  const moduleExportSchema = z.object({
65
- /** Specifier the export is imported from. */
66
62
  module: z.string({ error: "must be a module specifier" }).min(1, { error: "must be a module specifier" }),
67
- /** Identifier the module exports it under. */
68
63
  export: z.string({ error: "must be an export name" }).min(1, { error: "must be an export name" }),
69
64
  }, { error: "must be a { module, export } object" });
70
- /** Validates one entry of `elements.config`. */
71
65
  const elementConfigSchema = z.object({
72
- /** Component that wraps the generated element. */
73
66
  component: moduleExportSchema.optional(),
74
- /** Base props interface the generated element props extend. */
75
67
  props: moduleExportSchema.optional(),
76
- /** Marks the element as having no GObject of its own, its parent container creating one instead. */
77
68
  isLazy: z.boolean({ error: "must be a boolean" }).optional(),
78
- /** GObject properties to leave out of the generated element props, such as those a behavior fills. */
79
69
  omittedProps: z
80
70
  .array(z.string({ error: "must be a non-empty property name" }).min(1, {
81
71
  error: "must be a non-empty property name",
82
72
  }), { error: "must be an array of property names" })
83
73
  .optional(),
84
74
  });
85
- /** Validates `elements`: the behaviors module the app loads at runtime, plus the per-type entries. */
86
75
  const elementsSchema = z.object({
87
- /**
88
- * Path, resolved against the project root, of a module default-exporting element configs keyed by
89
- * GLib type name, as `defineElements` returns.
90
- */
91
76
  behaviors: z
92
77
  .string({ error: "must be a path to a module exporting element behaviors" })
93
78
  .min(1, { error: "must be a path to a module exporting element behaviors" })
94
79
  .optional(),
95
- /** Per-element entries, keyed by GLib type name. */
96
80
  config: z.record(z.string(), elementConfigSchema).optional(),
97
81
  });
98
- /** The shape every `gtkx.config.ts` is validated against, and the source of the {@link Config} type. */
82
+ /** Schema every `gtkx.config.ts` is validated against, and the source of the {@link Config} type. */
99
83
  const configSchema = z.object({
100
- /**
101
- * GIR namespaces to bind as `Name-Version`, or `"*"` for every one installed; omitting it gives
102
- * `Gtk-4.0`, which is also prepended to any list that names no Gtk version of its own.
103
- */
104
84
  libraries: librariesSchema.optional(),
105
- /** Directories searched for `.gir` files ahead of `GTKX_GIR_PATH` and the system locations. */
106
85
  girPath: z.array(z.string(), { error: "must be an array of strings if provided" }).optional(),
107
- /** Reverse-DNS GApplication identifier, and the default `applicationId` of the application element. */
108
86
  applicationId: applicationIdSchema,
109
- /** React Compiler settings; the compiler runs unless this is `false`. */
110
87
  reactCompiler: reactCompilerSchema.optional(),
111
- /** Whether to generate the binding stores; `false` makes the CLI resolve an already-installed one. */
112
88
  codegen: z.boolean({ error: "must be a boolean" }).optional(),
113
- /**
114
- * Signal names, keyed by GLib type name, that stay suppressed while a React commit applies props, so
115
- * their handlers only ever report user interaction. Unioned with the built-in GTK4 and Adwaita table.
116
- */
117
89
  userEventSignals: userEventSignalsSchema.optional(),
118
- /** Per-element customization: where the behaviors module lives and how each type's element is shaped. */
119
90
  elements: elementsSchema.optional(),
120
91
  });
121
92
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAqB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAiDlE,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,MAAM,mBAAmB,GAAG,sCAAsC,CAAC;AACnE,MAAM,sBAAsB,GAAG,uDAAuD,CAAC;AACvF,MAAM,yBAAyB,GAAG,GAAG,CAAC;AACtC,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,CAAU,CAAC;AAC5E,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,iBAAiB,EAAE,YAAY,CAAU,CAAC;AAC5E,MAAM,qBAAqB,GAAG,IAAI,CAAC;AACnC,MAAM,oBAAoB,GAAgB,IAAI,GAAG,CAAC,iBAAiB,CAAC,CAAC;AACrE,MAAM,mBAAmB,GAAgB,IAAI,GAAG,CAAC,gBAAgB,CAAC,CAAC;AAEnE,gHAAgH;AAChH,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,EAAwC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnF,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;IAExB,IAAI,KAAK,KAAK,kBAAkB,EAAE,CA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AAC,SAAS,CAAC,CAAC;AAE7D,MAAM,mBAAmB,GAAG,CAAC,QAA4B,EAAgC,EAAE,CACvF,kBAAkB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAEzD,MAAM,mBAAmB,GAAG,CAAC,QAA4B,EAA4B,EAAE,CACnF,kBAAkB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;AAEhE,MAAM,aAAa,GAAG,CAAC,MAAc,EAAE,IAAa,EAAkB,EAAE,CAAC,CAAC;IACtE,aAAa,EAAE,MAAM,CAAC,aAAa;IACnC,aAAa,EAAE,2BAA2B,CAAC,MAAM,CAAC,aAAa,CAAC;IAChE,gBAAgB,EAAE,uBAAuB,CAAC,MAAM,CAAC,gBAAgB,CAAC;IAClE,QAAQ,EAAE,qBAAqB,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC;IACjE,YAAY,EAAE,mBAAmB,CAAC,MAAM,CAAC,QAAQ,CAAC;CACrD,CAAC,CAAC;AAEH,OAAO,EACH,YAAY,EACZ,oBAAoB,EACpB,2BAA2B,EAC3B,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,GAKhB,CAAC","sourcesContent":["import { createDefineConfig, type DefineConfig } from \"c12\";\nimport { defu } from \"defu\";\nimport { resolve } from \"node:path\";\nimport { z } from \"zod\";\nimport { configError, isRecord, rawIssue } from \"./config-error.ts\";\nimport { resolveUserEventSignals } from \"./user-event-signals.ts\";\n\n/** Accepted `reactCompiler.compilationMode` values, choosing which functions the compiler processes. */\ntype ReactCompilerCompilationMode = (typeof COMPILATION_MODES)[number];\n/** Accepted `reactCompiler.panicThreshold` values, choosing which compiler diagnostics fail the build. */\ntype ReactCompilerPanicThreshold = (typeof PANIC_THRESHOLDS)[number];\n\n/** Object form of the `reactCompiler` config key, forwarded as-is to `babel-plugin-react-compiler`. */\ntype ReactCompilerOptions = {\n /** Which functions the compiler processes; left to the compiler's own default when omitted. */\n compilationMode?: ReactCompilerCompilationMode;\n /** Which compiler diagnostics fail the build; left to the compiler's own default when omitted. */\n panicThreshold?: ReactCompilerPanicThreshold;\n};\n\n/**\n * The React Compiler options the build hands to `babel-plugin-react-compiler`, with the React version\n * GTKX targets filled in.\n */\ntype ResolvedReactCompilerOptions = ReactCompilerOptions & {\n /** React major version the compiler emits for. */\n target: \"19\";\n};\n\n/**\n * User-facing configuration for a GTKX project, as authored in `gtkx.config.ts`: the GIR libraries\n * to bind and where to find them, the GApplication id, per-element configuration, and the React\n * Compiler, codegen, and user event signal settings.\n */\ntype Config = z.infer<typeof configSchema>;\n/** A named export referenced as plain data, so codegen can emit an import for it without loading the module. */\ntype ModuleExport = z.infer<typeof moduleExportSchema>;\n/** One `elements.config` entry, describing how a single GLib type's generated element is shaped. */\ntype ElementConfigEntry = z.infer<typeof elementConfigSchema>;\n\n/** Configuration reduced to the values the app runtime and the build need, with paths already resolved. */\ntype ResolvedConfig = {\n /** The GApplication identifier the app registers under. */\n applicationId: string;\n /** React Compiler options for the build, or `null` when the compiler is disabled. */\n reactCompiler: ResolvedReactCompilerOptions | null;\n /** Signal names, keyed by GLib type name, that stay suppressed while a React commit runs. */\n userEventSignals: Record<string, string[]>;\n /** Path of the module exporting per-element configs, or `null` when none is configured. */\n elements: string | null;\n /** GLib type names of the elements marked `isLazy`, whose GObject their parent container creates. */\n lazyElements: string[];\n};\n\nconst LIBRARIES_WILDCARD = \"*\";\nconst GIR_LIBRARY_PATTERN = /^[A-Za-z][A-Za-z0-9]*-\\d+(?:\\.\\d+)*$/;\nconst APPLICATION_ID_PATTERN = /^[A-Za-z_][A-Za-z0-9_-]*(\\.[A-Za-z_][A-Za-z0-9_-]*)+$/;\nconst APPLICATION_ID_MAX_LENGTH = 255;\nconst COMPILATION_MODES = [\"infer\", \"syntax\", \"annotation\", \"all\"] as const;\nconst PANIC_THRESHOLDS = [\"none\", \"critical_errors\", \"all_errors\"] as const;\nconst REACT_COMPILER_TARGET = \"19\";\nconst COMPILATION_MODE_SET: Set<string> = new Set(COMPILATION_MODES);\nconst PANIC_THRESHOLD_SET: Set<string> = new Set(PANIC_THRESHOLDS);\n\n/** Validates `libraries`: the `\"*\"` wildcard on its own, or a non-empty array of `Name-Version` identifiers. */\nconst librariesSchema = z.custom<typeof LIBRARIES_WILDCARD | string[]>().check((ctx) => {\n const value = ctx.value;\n\n if (value === LIBRARIES_WILDCARD) {\n return;\n }\n\n if (!Array.isArray(value) || value.length === 0) {\n ctx.issues.push(rawIssue(value, [], `must be \"${LIBRARIES_WILDCARD}\", a non-empty string array, or omitted`));\n\n return;\n }\n\n for (const [index, entry] of value.entries()) {\n ctx.issues.push(...libraryEntryIssues(value, index, entry));\n }\n});\n\n/** Validates `applicationId` against the reverse-DNS form `g_application_id_is_valid` accepts. */\nconst applicationIdSchema = z.custom<string>().check((ctx) => {\n const value = ctx.value;\n\n if (typeof value !== \"string\" || !isValidApplicationId(value)) {\n ctx.issues.push(\n rawIssue(\n value,\n [],\n `invalid \\`applicationId\\` \"${value}\", must satisfy g_application_id_is_valid ` +\n '(e.g. \"org.example.MyApp\")',\n true,\n ),\n );\n }\n});\n\n/** Validates `reactCompiler`: a boolean, or an options object whose mode and threshold are known values. */\nconst reactCompilerSchema = z.custom<boolean | ReactCompilerOptions>().check((ctx) => {\n const value = ctx.value;\n\n if (typeof value === \"boolean\") {\n return;\n }\n\n if (!isRecord(value)) {\n ctx.issues.push(rawIssue(value, [], \"must be a boolean or an options object\"));\n\n return;\n }\n\n const compilationMode = value.compilationMode;\n\n if (!isValidReactCompilerOption(compilationMode, COMPILATION_MODE_SET)) {\n ctx.issues.push(\n rawIssue(\n value,\n [],\n `invalid \\`reactCompiler.compilationMode\\` \"${String(compilationMode)}\", ` +\n `must be one of ${COMPILATION_MODES.join(\", \")}`,\n true,\n ),\n );\n }\n\n const panicThreshold = value.panicThreshold;\n\n if (!isValidReactCompilerOption(panicThreshold, PANIC_THRESHOLD_SET)) {\n ctx.issues.push(\n rawIssue(\n value,\n [],\n `invalid \\`reactCompiler.panicThreshold\\` \"${String(panicThreshold)}\", ` +\n `must be one of ${PANIC_THRESHOLDS.join(\", \")}`,\n true,\n ),\n );\n }\n});\n\n/** Validates `userEventSignals`: GLib type names mapped to arrays of non-empty signal names. */\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\n/** Validates a `{ module, export }` reference to a named export. */\nconst moduleExportSchema = z.object(\n {\n /** Specifier the export is imported from. */\n module: z.string({ error: \"must be a module specifier\" }).min(1, { error: \"must be a module specifier\" }),\n /** Identifier the module exports it under. */\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\n/** Validates one entry of `elements.config`. */\nconst elementConfigSchema = z.object({\n /** Component that wraps the generated element. */\n component: moduleExportSchema.optional(),\n /** Base props interface the generated element props extend. */\n props: moduleExportSchema.optional(),\n /** Marks the element as having no GObject of its own, its parent container creating one instead. */\n isLazy: z.boolean({ error: \"must be a boolean\" }).optional(),\n /** GObject properties to leave out of the generated element props, such as those a behavior fills. */\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\n/** Validates `elements`: the behaviors module the app loads at runtime, plus the per-type entries. */\nconst elementsSchema = z.object({\n /**\n * Path, resolved against the project root, of a module default-exporting element configs keyed by\n * GLib type name, as `defineElements` returns.\n */\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 /** Per-element entries, keyed by GLib type name. */\n config: z.record(z.string(), elementConfigSchema).optional(),\n});\n\n/** The shape every `gtkx.config.ts` is validated against, and the source of the {@link Config} type. */\nconst configSchema = z.object({\n /**\n * GIR namespaces to bind as `Name-Version`, or `\"*\"` for every one installed; omitting it gives\n * `Gtk-4.0`, which is also prepended to any list that names no Gtk version of its own.\n */\n libraries: librariesSchema.optional(),\n /** Directories searched for `.gir` files ahead of `GTKX_GIR_PATH` and the system locations. */\n girPath: z.array(z.string(), { error: \"must be an array of strings if provided\" }).optional(),\n /** Reverse-DNS GApplication identifier, and the default `applicationId` of the application element. */\n applicationId: applicationIdSchema,\n /** React Compiler settings; the compiler runs unless this is `false`. */\n reactCompiler: reactCompilerSchema.optional(),\n /** Whether to generate the binding stores; `false` makes the CLI resolve an already-installed one. */\n codegen: z.boolean({ error: \"must be a boolean\" }).optional(),\n /**\n * Signal names, keyed by GLib type name, that stay suppressed while a React commit applies props, so\n * their handlers only ever report user interaction. Unioned with the built-in GTK4 and Adwaita table.\n */\n userEventSignals: userEventSignalsSchema.optional(),\n /** Per-element customization: where the behaviors module lives and how each type's element is shaped. */\n elements: elementsSchema.optional(),\n});\n\n/**\n * Returns the given configuration unchanged, typed as {@link Config}, so `gtkx.config.ts` gets\n * autocompletion and type checking.\n */\nconst defineConfig: DefineConfig<Config> = createDefineConfig<Config>();\n\nconst libraryEntryIssues = (value: unknown[], index: number, entry: unknown): ReturnType<typeof rawIssue>[] => {\n if (typeof entry === \"string\" && GIR_LIBRARY_PATTERN.test(entry)) {\n return [];\n }\n\n if (entry === LIBRARIES_WILDCARD) {\n const message =\n `to generate every library, set \\`libraries: \"${LIBRARIES_WILDCARD}\"\\` as a bare string, ` +\n \"not an array entry\";\n\n return [rawIssue(value, [index], message, true)];\n }\n\n const message =\n `invalid library identifier \"${String(entry)}\", must be of the form \"Name-Version\" ` +\n '(e.g. \"Gtk-4.0\")';\n\n return [rawIssue(value, [index], message, true)];\n};\n\nconst isValidApplicationId = (applicationId: string): boolean => {\n if (applicationId.length === 0 || applicationId.length > APPLICATION_ID_MAX_LENGTH) {\n return false;\n }\n\n return APPLICATION_ID_PATTERN.test(applicationId);\n};\n\nconst resolveReactCompilerOptions = (setting: Config[\"reactCompiler\"]): ResolvedReactCompilerOptions | null => {\n if (setting === false) {\n return null;\n }\n\n const overrides = setting === undefined || setting === true ? {} : setting;\n\n return { ...overrides, target: REACT_COMPILER_TARGET };\n};\n\nconst isValidReactCompilerOption = (value: unknown, allowed: Set<string>): boolean =>\n value === undefined || (typeof value === \"string\" && allowed.has(value));\n\nconst validateConfig = (config: Config): void => {\n const result = configSchema.safeParse(config);\n\n if (!result.success) {\n throw configError(result.error);\n }\n};\n\n/**\n * Deep-merges two configurations. `override` wins over `base` on conflicting scalar and object keys, while\n * arrays are concatenated with the `override` entries first.\n */\nconst mergeConfig = (base: Config, override: Config): Config => defu(override, base);\n\nconst resolveElementsModule = (behaviors: string | undefined, root: string | undefined): string | null => {\n if (behaviors === undefined) {\n return null;\n }\n\n return root === undefined ? behaviors : resolve(root, behaviors);\n};\n\nconst resolveLazyElements = (elements: Config[\"elements\"]): string[] =>\n Object.entries(elements?.config ?? {})\n .filter(([, entry]) => entry.isLazy === true)\n .map(([type]) => type);\n\nconst elementEntryValues = <T>(\n elements: Config[\"elements\"],\n pick: (entry: ElementConfigEntry) => T | undefined,\n): Record<string, T> =>\n Object.fromEntries(\n Object.entries(elements?.config ?? {}).flatMap(([type, entry]) => {\n const value = pick(entry);\n\n return value === undefined ? [] : [[type, value] as const];\n }),\n );\n\nconst resolveElementComponents = (elements: Config[\"elements\"]): Record<string, ModuleExport> =>\n elementEntryValues(elements, (entry) => entry.component);\n\nconst resolveElementProps = (elements: Config[\"elements\"]): Record<string, ModuleExport> =>\n elementEntryValues(elements, (entry) => entry.props);\n\nconst resolveOmittedProps = (elements: Config[\"elements\"]): Record<string, string[]> =>\n elementEntryValues(elements, (entry) => entry.omittedProps);\n\nconst resolveConfig = (config: Config, root?: string): ResolvedConfig => ({\n applicationId: config.applicationId,\n reactCompiler: resolveReactCompilerOptions(config.reactCompiler),\n userEventSignals: resolveUserEventSignals(config.userEventSignals),\n elements: resolveElementsModule(config.elements?.behaviors, root),\n lazyElements: resolveLazyElements(config.elements),\n});\n\nexport {\n defineConfig,\n isValidApplicationId,\n resolveReactCompilerOptions,\n validateConfig,\n mergeConfig,\n resolveLazyElements,\n resolveElementComponents,\n resolveElementProps,\n resolveOmittedProps,\n resolveConfig,\n type ResolvedReactCompilerOptions,\n type Config,\n type 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,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AA+ClE,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,MAAM,mBAAmB,GAAG,sCAAsC,CAAC;AACnE,MAAM,sBAAsB,GAAG,uDAAuD,CAAC;AACvF,MAAM,yBAAyB,GAAG,GAAG,CAAC;AACtC,+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,CAAC;AACnC,MAAM,oBAAoB,GAAgB,IAAI,GAAG,CAAC,iBAAiB,CAAC,CAAC;AACr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B,EAAgC,EAAE,CACvF,kBAAkB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAEzD,MAAM,mBAAmB,GAAG,CAAC,QAA4B,EAA4B,EAAE,CACnF,kBAAkB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;AAEhE,MAAM,aAAa,GAAG,CAAC,MAAc,EAAE,IAAa,EAAkB,EAAE,CAAC,CAAC;IACtE,aAAa,EAAE,MAAM,CAAC,aAAa;IACnC,aAAa,EAAE,2BAA2B,CAAC,MAAM,CAAC,aAAa,CAAC;IAChE,gBAAgB,EAAE,uBAAuB,CAAC,MAAM,CAAC,gBAAgB,CAAC;IAClE,QAAQ,EAAE,qBAAqB,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC;IACjE,YAAY,EAAE,mBAAmB,CAAC,MAAM,CAAC,QAAQ,CAAC;CACrD,CAAC,CAAC;AAEH,OAAO,EACH,YAAY,EACZ,oBAAoB,EACpB,2BAA2B,EAC3B,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,GAIhB,CAAC","sourcesContent":["import { createDefineConfig, type DefineConfig } from \"c12\";\nimport { defu } from \"defu\";\nimport { resolve } from \"node:path\";\nimport { z } from \"zod\";\nimport { configError, isRecord, rawIssue } from \"./config-error.ts\";\nimport { resolveUserEventSignals } from \"./user-event-signals.ts\";\n\n/** Accepted `reactCompiler.compilationMode` values, choosing which functions the compiler processes. */\ntype ReactCompilerCompilationMode = (typeof COMPILATION_MODES)[number];\n/** Accepted `reactCompiler.panicThreshold` values, choosing which compiler diagnostics fail the build. */\ntype ReactCompilerPanicThreshold = (typeof PANIC_THRESHOLDS)[number];\n\n/** Object form of the `reactCompiler` config key, forwarded as-is to `babel-plugin-react-compiler`. */\ntype ReactCompilerOptions = {\n /** Which functions the compiler processes; left to the compiler's own default when omitted. */\n compilationMode?: ReactCompilerCompilationMode;\n /** Which compiler diagnostics fail the build; left to the compiler's own default when omitted. */\n panicThreshold?: ReactCompilerPanicThreshold;\n};\n\n/**\n * The React Compiler options the build hands to `babel-plugin-react-compiler`, with the React version\n * GTKX targets filled in.\n */\ntype ResolvedReactCompilerOptions = ReactCompilerOptions & {\n /** React major version the compiler emits for. */\n target: \"19\";\n};\n\n/**\n * User-facing configuration for a GTKX project, as authored in `gtkx.config.ts`: the GIR libraries\n * to bind and where to find them, the GApplication id, per-element configuration, and the React\n * Compiler, codegen, and user event signal settings.\n */\ntype Config = z.infer<typeof configSchema>;\ntype ModuleExport = z.infer<typeof moduleExportSchema>;\ntype ElementConfigEntry = z.infer<typeof elementConfigSchema>;\n\n/** Configuration reduced to the values the app runtime and the build need, with paths already resolved. */\ntype ResolvedConfig = {\n /** The GApplication identifier the app registers under. */\n applicationId: string;\n /** React Compiler options for the build, or `null` when the compiler is disabled. */\n reactCompiler: ResolvedReactCompilerOptions | null;\n /** Signal names, keyed by GLib type name, that stay suppressed while a React commit runs. */\n userEventSignals: Record<string, string[]>;\n /** Path of the module exporting per-element configs, or `null` when none is configured. */\n elements: string | null;\n /** GLib type names of the elements marked `isLazy`, whose GObject their parent container creates. */\n lazyElements: string[];\n};\n\nconst LIBRARIES_WILDCARD = \"*\";\nconst GIR_LIBRARY_PATTERN = /^[A-Za-z][A-Za-z0-9]*-\\d+(?:\\.\\d+)*$/;\nconst APPLICATION_ID_PATTERN = /^[A-Za-z_][A-Za-z0-9_-]*(\\.[A-Za-z_][A-Za-z0-9_-]*)+$/;\nconst APPLICATION_ID_MAX_LENGTH = 255;\n/** Compilation modes `babel-plugin-react-compiler` accepts. */\nconst COMPILATION_MODES = [\"infer\", \"syntax\", \"annotation\", \"all\"] as const;\n/** Panic thresholds `babel-plugin-react-compiler` accepts. */\nconst PANIC_THRESHOLDS = [\"none\", \"critical_errors\", \"all_errors\"] as const;\nconst REACT_COMPILER_TARGET = \"19\";\nconst COMPILATION_MODE_SET: Set<string> = new Set(COMPILATION_MODES);\nconst PANIC_THRESHOLD_SET: Set<string> = new Set(PANIC_THRESHOLDS);\n\nconst librariesSchema = z.custom<typeof LIBRARIES_WILDCARD | string[]>().check((ctx) => {\n const value = ctx.value;\n\n if (value === LIBRARIES_WILDCARD) {\n return;\n }\n\n if (!Array.isArray(value) || value.length === 0) {\n ctx.issues.push(rawIssue(value, [], `must be \"${LIBRARIES_WILDCARD}\", a non-empty string array, or omitted`));\n\n return;\n }\n\n for (const [index, entry] of value.entries()) {\n ctx.issues.push(...libraryEntryIssues(value, index, entry));\n }\n});\n\nconst applicationIdSchema = z.custom<string>().check((ctx) => {\n const value = ctx.value;\n\n if (typeof value !== \"string\" || !isValidApplicationId(value)) {\n ctx.issues.push(\n rawIssue(\n value,\n [],\n `invalid \\`applicationId\\` \"${value}\", must satisfy g_application_id_is_valid ` +\n '(e.g. \"org.example.MyApp\")',\n true,\n ),\n );\n }\n});\n\nconst reactCompilerSchema = z.custom<boolean | ReactCompilerOptions>().check((ctx) => {\n const value = ctx.value;\n\n if (typeof value === \"boolean\") {\n return;\n }\n\n if (!isRecord(value)) {\n ctx.issues.push(rawIssue(value, [], \"must be a boolean or an options object\"));\n\n return;\n }\n\n const compilationMode = value.compilationMode;\n\n if (!isValidReactCompilerOption(compilationMode, COMPILATION_MODE_SET)) {\n ctx.issues.push(\n rawIssue(\n value,\n [],\n `invalid \\`reactCompiler.compilationMode\\` \"${String(compilationMode)}\", ` +\n `must be one of ${COMPILATION_MODES.join(\", \")}`,\n true,\n ),\n );\n }\n\n const panicThreshold = value.panicThreshold;\n\n if (!isValidReactCompilerOption(panicThreshold, PANIC_THRESHOLD_SET)) {\n ctx.issues.push(\n rawIssue(\n value,\n [],\n `invalid \\`reactCompiler.panicThreshold\\` \"${String(panicThreshold)}\", ` +\n `must be one of ${PANIC_THRESHOLDS.join(\", \")}`,\n true,\n ),\n );\n }\n});\n\nconst userEventSignalsSchema = z.record(\n z.string(),\n z.array(\n z.string({ error: \"must be a non-empty signal name\" }).min(1, { error: \"must be a non-empty signal name\" }),\n {\n error: \"must be an array of signal names\",\n },\n ),\n { error: \"must be a record of GLib type names to signal name arrays\" },\n);\n\nconst moduleExportSchema = z.object(\n {\n module: z.string({ error: \"must be a module specifier\" }).min(1, { error: \"must be a module specifier\" }),\n export: z.string({ error: \"must be an export name\" }).min(1, { error: \"must be an export name\" }),\n },\n { error: \"must be a { module, export } object\" },\n);\n\nconst elementConfigSchema = z.object({\n component: moduleExportSchema.optional(),\n props: moduleExportSchema.optional(),\n isLazy: z.boolean({ error: \"must be a boolean\" }).optional(),\n omittedProps: z\n .array(\n z.string({ error: \"must be a non-empty property name\" }).min(1, {\n error: \"must be a non-empty property name\",\n }),\n { error: \"must be an array of property names\" },\n )\n .optional(),\n});\n\nconst elementsSchema = z.object({\n behaviors: z\n .string({ error: \"must be a path to a module exporting element behaviors\" })\n .min(1, { error: \"must be a path to a module exporting element behaviors\" })\n .optional(),\n config: z.record(z.string(), elementConfigSchema).optional(),\n});\n\n/** Schema every `gtkx.config.ts` is validated against, and the source of the {@link Config} type. */\nconst configSchema = z.object({\n libraries: librariesSchema.optional(),\n girPath: z.array(z.string(), { error: \"must be an array of strings if provided\" }).optional(),\n applicationId: applicationIdSchema,\n reactCompiler: reactCompilerSchema.optional(),\n codegen: z.boolean({ error: \"must be a boolean\" }).optional(),\n userEventSignals: userEventSignalsSchema.optional(),\n elements: elementsSchema.optional(),\n});\n\n/**\n * Returns the given configuration unchanged, typed as {@link Config}, so `gtkx.config.ts` gets\n * autocompletion and type checking.\n */\nconst defineConfig: DefineConfig<Config> = createDefineConfig<Config>();\n\nconst libraryEntryIssues = (value: unknown[], index: number, entry: unknown): ReturnType<typeof rawIssue>[] => {\n if (typeof entry === \"string\" && GIR_LIBRARY_PATTERN.test(entry)) {\n return [];\n }\n\n if (entry === LIBRARIES_WILDCARD) {\n const message =\n `to generate every library, set \\`libraries: \"${LIBRARIES_WILDCARD}\"\\` as a bare string, ` +\n \"not an array entry\";\n\n return [rawIssue(value, [index], message, true)];\n }\n\n const message =\n `invalid library identifier \"${String(entry)}\", must be of the form \"Name-Version\" ` +\n '(e.g. \"Gtk-4.0\")';\n\n return [rawIssue(value, [index], message, true)];\n};\n\nconst isValidApplicationId = (applicationId: string): boolean => {\n if (applicationId.length === 0 || applicationId.length > APPLICATION_ID_MAX_LENGTH) {\n return false;\n }\n\n return APPLICATION_ID_PATTERN.test(applicationId);\n};\n\nconst resolveReactCompilerOptions = (setting: Config[\"reactCompiler\"]): ResolvedReactCompilerOptions | null => {\n if (setting === false) {\n return null;\n }\n\n const overrides = setting === undefined || setting === true ? {} : setting;\n\n return { ...overrides, target: REACT_COMPILER_TARGET };\n};\n\nconst isValidReactCompilerOption = (value: unknown, allowed: Set<string>): boolean =>\n value === undefined || (typeof value === \"string\" && allowed.has(value));\n\nconst validateConfig = (config: Config): void => {\n const result = configSchema.safeParse(config);\n\n if (!result.success) {\n throw configError(result.error);\n }\n};\n\n/**\n * Deep-merges two configurations. `override` wins over `base` on conflicting scalar and object keys, while\n * arrays are concatenated with the `override` entries first.\n */\nconst mergeConfig = (base: Config, override: Config): Config => defu(override, base);\n\nconst resolveElementsModule = (behaviors: string | undefined, root: string | undefined): string | null => {\n if (behaviors === undefined) {\n return null;\n }\n\n return root === undefined ? behaviors : resolve(root, behaviors);\n};\n\nconst resolveLazyElements = (elements: Config[\"elements\"]): string[] =>\n Object.entries(elements?.config ?? {})\n .filter(([, entry]) => entry.isLazy === true)\n .map(([type]) => type);\n\nconst elementEntryValues = <T>(\n elements: Config[\"elements\"],\n pick: (entry: ElementConfigEntry) => T | undefined,\n): Record<string, T> =>\n Object.fromEntries(\n Object.entries(elements?.config ?? {}).flatMap(([type, entry]) => {\n const value = pick(entry);\n\n return value === undefined ? [] : [[type, value] as const];\n }),\n );\n\nconst resolveElementComponents = (elements: Config[\"elements\"]): Record<string, ModuleExport> =>\n elementEntryValues(elements, (entry) => entry.component);\n\nconst resolveElementProps = (elements: Config[\"elements\"]): Record<string, ModuleExport> =>\n elementEntryValues(elements, (entry) => entry.props);\n\nconst resolveOmittedProps = (elements: Config[\"elements\"]): Record<string, string[]> =>\n elementEntryValues(elements, (entry) => entry.omittedProps);\n\nconst resolveConfig = (config: Config, root?: string): ResolvedConfig => ({\n applicationId: config.applicationId,\n reactCompiler: resolveReactCompilerOptions(config.reactCompiler),\n userEventSignals: resolveUserEventSignals(config.userEventSignals),\n elements: resolveElementsModule(config.elements?.behaviors, root),\n lazyElements: resolveLazyElements(config.elements),\n});\n\nexport {\n defineConfig,\n isValidApplicationId,\n resolveReactCompilerOptions,\n validateConfig,\n mergeConfig,\n resolveLazyElements,\n resolveElementComponents,\n resolveElementProps,\n resolveOmittedProps,\n resolveConfig,\n type ResolvedReactCompilerOptions,\n type Config,\n type ResolvedConfig,\n};\n"]}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /** @public */
2
2
  export { type Config, defineConfig, mergeConfig, type ResolvedConfig } from "./config.ts";
3
3
  /** @public */
4
- export { type LoadedConfig, loadConfig } from "./loader.ts";
4
+ export { type ConfigLoader, type LoadedConfig, loadConfig } from "./loader.ts";
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,EAAE,KAAK,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC1F,cAAc;AACd,OAAO,EAAE,KAAK,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,EAAE,KAAK,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC1F,cAAc;AACd,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,EAAe,YAAY,EAAE,WAAW,EAAuB,MAAM,aAAa,CAAC;AAC1F,cAAc;AACd,OAAO,EAAqB,UAAU,EAAE,MAAM,aAAa,CAAC","sourcesContent":["/** @public */\nexport { type Config, defineConfig, mergeConfig, type ResolvedConfig } from \"./config.ts\";\n/** @public */\nexport { type LoadedConfig, loadConfig } from \"./loader.ts\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,EAAe,YAAY,EAAE,WAAW,EAAuB,MAAM,aAAa,CAAC;AAC1F,cAAc;AACd,OAAO,EAAwC,UAAU,EAAE,MAAM,aAAa,CAAC","sourcesContent":["/** @public */\nexport { type Config, defineConfig, mergeConfig, type ResolvedConfig } from \"./config.ts\";\n/** @public */\nexport { type ConfigLoader, type LoadedConfig, loadConfig } from \"./loader.ts\";\n"]}
@@ -1,4 +1,4 @@
1
1
  export type { ResolvedReactCompilerOptions } from "./config.ts";
2
2
  export { isValidApplicationId, resolveElementComponents, resolveElementProps, resolveLazyElements, resolveOmittedProps, } from "./config.ts";
3
- export { type ConfigLoader, createConfigLoader } from "./loader.ts";
3
+ export { createConfigLoader } from "./loader.ts";
4
4
  //# sourceMappingURL=internal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EACH,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EACH,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AACA,OAAO,EACH,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAqB,kBAAkB,EAAE,MAAM,aAAa,CAAC","sourcesContent":["export type { ResolvedReactCompilerOptions } from \"./config.ts\";\nexport {\n isValidApplicationId,\n resolveElementComponents,\n resolveElementProps,\n resolveLazyElements,\n resolveOmittedProps,\n} from \"./config.ts\";\nexport { type ConfigLoader, createConfigLoader } from \"./loader.ts\";\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AACA,OAAO,EACH,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC","sourcesContent":["export type { ResolvedReactCompilerOptions } from \"./config.ts\";\nexport {\n isValidApplicationId,\n resolveElementComponents,\n resolveElementProps,\n resolveLazyElements,\n resolveOmittedProps,\n} from \"./config.ts\";\nexport { createConfigLoader } from \"./loader.ts\";\n"]}
package/dist/loader.d.ts CHANGED
@@ -16,8 +16,11 @@ type LoadConfigOptions = {
16
16
  */
17
17
  mode?: string | undefined;
18
18
  };
19
+ /** Reads a project's configuration once per directory, caching what it loads and what it resolves. */
19
20
  type ConfigLoader = {
21
+ /** Loads the configuration file the given directory resolves to, as {@link loadConfig} does. */
20
22
  load: (cwd: string) => Promise<LoadedConfig>;
23
+ /** Loads the configuration for the given directory and reduces it to what the build and the app need. */
21
24
  resolve: (cwd: string) => Promise<ResolvedConfig>;
22
25
  };
23
26
  /**
@@ -28,5 +31,5 @@ type ConfigLoader = {
28
31
  */
29
32
  declare const loadConfig: (cwd: string, options?: LoadConfigOptions) => Promise<LoadedConfig>;
30
33
  declare const createConfigLoader: (options?: LoadConfigOptions) => ConfigLoader;
31
- export { loadConfig, createConfigLoader, type LoadedConfig, type LoadConfigOptions, type ConfigLoader };
34
+ export { loadConfig, createConfigLoader, type LoadedConfig, type ConfigLoader };
32
35
  //# sourceMappingURL=loader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,MAAM,EAAiB,KAAK,cAAc,EAAkB,MAAM,aAAa,CAAC;AAE9F,2DAA2D;AAC3D,KAAK,YAAY,GAAG;IAChB,8CAA8C;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,+DAA+D;IAC/D,UAAU,EAAE,MAAM,CAAC;IACnB,gFAAgF;IAChF,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,+FAA+F;AAC/F,KAAK,iBAAiB,GAAG;IACrB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B,CAAC;AAEF,KAAK,YAAY,GAAG;IAChB,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;IAC7C,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;GAKG;AACH,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AC,UAA6B,EAAE,EAAgB,EAAE;IACzE,MAAM,MAAM,GAAuC,IAAI,GAAG,EAAE,CAAC;IAC7D,MAAM,QAAQ,GAAyC,IAAI,GAAG,EAAE,CAAC;IAEjE,MAAM,IAAI,GAAG,CAAC,GAAW,EAAyB,EAAE,CAChD,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IAE3E,MAAM,SAAS,GAAG,KAAK,EAAE,IAAY,EAA2B,EAAE;QAC9D,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;QAEtD,OAAO,aAAa,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC7C,CAAC,CAAC;IAEF,OAAO;QACH,IAAI;QACJ,OAAO,EAAE,CAAC,GAAW,EAA2B,EAAE,CAAC,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC;KACpG,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAgE,CAAC","sourcesContent":["import { getOrInsert } from \"@gtkx/utils\";\nimport { loadConfig as loadConfigFile } from \"c12\";\nimport { existsSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { type Config, resolveConfig, type ResolvedConfig, validateConfig } from \"./config.ts\";\n\n/** Result of loading a project's `gtkx.config.ts` file. */\ntype LoadedConfig = {\n /** The parsed and validated configuration. */\n config: Config;\n /** Absolute path of the configuration file that was loaded. */\n configFile: string;\n /** Absolute path of the project root the configuration was resolved against. */\n root: string;\n};\n\n/** How a configuration file is read, shared by {@link loadConfig} and `createConfigLoader`. */\ntype LoadConfigOptions = {\n /**\n * Environment name such as `development`: the config's matching `$<mode>` block is layered over the\n * top-level values, and the name is passed to a config authored as a function.\n */\n mode?: string | undefined;\n};\n\ntype ConfigLoader = {\n load: (cwd: string) => Promise<LoadedConfig>;\n resolve: (cwd: string) => Promise<ResolvedConfig>;\n};\n\n/**\n * Loads and validates the `gtkx.config.ts` file for a project.\n * @param cwd Directory the configuration file is looked up in.\n * @param options Loading options, such as the environment mode whose overrides are applied.\n * @throws When the configuration fails validation, or when no configuration file is found.\n */\nconst loadConfig = async (cwd: string, options: LoadConfigOptions = {}): Promise<LoadedConfig> => {\n const result = await loadConfigFile<Config>({\n name: \"gtkx\",\n cwd,\n rcFile: false,\n globalRc: false,\n packageJson: false,\n context: { mode: options.mode },\n ...((options.mode !== undefined) && { envName: options.mode }),\n });\n\n const config = result.config;\n const configFile = result.configFile;\n validateConfig(config);\n\n if (configFile === undefined || !existsSync(resolve(cwd, configFile))) {\n throw new Error(`gtkx.config.ts: no configuration file was found from ${cwd}`);\n }\n\n return {\n config,\n configFile,\n root: result.cwd ?? cwd,\n };\n};\n\nconst createConfigLoader = (options: LoadConfigOptions = {}): ConfigLoader => {\n const loaded: Map<string, Promise<LoadedConfig>> = new Map();\n const resolved: Map<string, Promise<ResolvedConfig>> = new Map();\n\n const load = (cwd: string): Promise<LoadedConfig> =>\n getOrInsert(loaded, resolve(cwd), (root) => loadConfig(root, options));\n\n const resolveAt = async (root: string): Promise<ResolvedConfig> => {\n const { config, root: configRoot } = await load(root);\n\n return resolveConfig(config, configRoot);\n };\n\n return {\n load,\n resolve: (cwd: string): Promise<ResolvedConfig> => getOrInsert(resolved, resolve(cwd), resolveAt),\n };\n};\n\nexport { loadConfig, createConfigLoader, type LoadedConfig, type LoadConfigOptions, type ConfigLoader };\n"]}
1
+ {"version":3,"file":"loader.js","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,KAAK,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CA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G,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IAE3E,MAAM,SAAS,GAAG,KAAK,EAAE,IAAY,EAA2B,EAAE;QAC9D,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;QAEtD,OAAO,aAAa,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC7C,CAAC,CAAC;IAEF,OAAO;QACH,IAAI;QACJ,OAAO,EAAE,CAAC,GAAW,EAA2B,EAAE,CAAC,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC;KACpG,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAwC,CAAC","sourcesContent":["import { getOrInsert } from \"@gtkx/utils\";\nimport { loadConfig as loadConfigFile } from \"c12\";\nimport { existsSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { type Config, resolveConfig, type ResolvedConfig, validateConfig } from \"./config.ts\";\n\n/** Result of loading a project's `gtkx.config.ts` file. */\ntype LoadedConfig = {\n /** The parsed and validated configuration. */\n config: Config;\n /** Absolute path of the configuration file that was loaded. */\n configFile: string;\n /** Absolute path of the project root the configuration was resolved against. */\n root: string;\n};\n\n/** How a configuration file is read, shared by {@link loadConfig} and `createConfigLoader`. */\ntype LoadConfigOptions = {\n /**\n * Environment name such as `development`: the config's matching `$<mode>` block is layered over the\n * top-level values, and the name is passed to a config authored as a function.\n */\n mode?: string | undefined;\n};\n\n/** Reads a project's configuration once per directory, caching what it loads and what it resolves. */\ntype ConfigLoader = {\n /** Loads the configuration file the given directory resolves to, as {@link loadConfig} does. */\n load: (cwd: string) => Promise<LoadedConfig>;\n /** Loads the configuration for the given directory and reduces it to what the build and the app need. */\n resolve: (cwd: string) => Promise<ResolvedConfig>;\n};\n\n/**\n * Loads and validates the `gtkx.config.ts` file for a project.\n * @param cwd Directory the configuration file is looked up in.\n * @param options Loading options, such as the environment mode whose overrides are applied.\n * @throws When the configuration fails validation, or when no configuration file is found.\n */\nconst loadConfig = async (cwd: string, options: LoadConfigOptions = {}): Promise<LoadedConfig> => {\n const result = await loadConfigFile<Config>({\n name: \"gtkx\",\n cwd,\n rcFile: false,\n globalRc: false,\n packageJson: false,\n context: { mode: options.mode },\n ...((options.mode !== undefined) && { envName: options.mode }),\n });\n\n const config = result.config;\n const configFile = result.configFile;\n validateConfig(config);\n\n if (configFile === undefined || !existsSync(resolve(cwd, configFile))) {\n throw new Error(`gtkx.config.ts: no configuration file was found from ${cwd}`);\n }\n\n return {\n config,\n configFile,\n root: result.cwd ?? cwd,\n };\n};\n\nconst createConfigLoader = (options: LoadConfigOptions = {}): ConfigLoader => {\n const loaded: Map<string, Promise<LoadedConfig>> = new Map();\n const resolved: Map<string, Promise<ResolvedConfig>> = new Map();\n\n const load = (cwd: string): Promise<LoadedConfig> =>\n getOrInsert(loaded, resolve(cwd), (root) => loadConfig(root, options));\n\n const resolveAt = async (root: string): Promise<ResolvedConfig> => {\n const { config, root: configRoot } = await load(root);\n\n return resolveConfig(config, configRoot);\n };\n\n return {\n load,\n resolve: (cwd: string): Promise<ResolvedConfig> => getOrInsert(resolved, resolve(cwd), resolveAt),\n };\n};\n\nexport { loadConfig, createConfigLoader, type LoadedConfig, type ConfigLoader };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"user-event-signals.d.ts","sourceRoot":"","sources":["../src/user-event-signals.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CA2CxD,CAAC;AAEF,QAAA,MAAM,uBAAuB,GAAI,WAAW,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,SAAS,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CASzG,CAAC;AAEF,OAAO,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,CAAC"}
1
+ {"version":3,"file":"user-event-signals.d.ts","sourceRoot":"","sources":["../src/user-event-signals.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAqCxD,CAAC;AAEF,QAAA,MAAM,uBAAuB,GAAI,WAAW,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,SAAS,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CASzG,CAAC;AAEF,OAAO,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,CAAC"}
@@ -6,15 +6,11 @@ const DEFAULT_USER_EVENT_SIGNALS = {
6
6
  AdwTabView: ["close-page", "page-attached", "page-detached", "page-reordered"],
7
7
  GObject: ["notify"],
8
8
  GtkAdjustment: ["changed", "value-changed"],
9
- GtkAppChooserButton: ["changed"],
10
- GtkAppChooserWidget: ["application-selected"],
11
9
  GtkCalendar: ["day-selected"],
12
10
  GtkCheckButton: ["toggled"],
13
- GtkComboBox: ["changed"],
14
11
  GtkEditable: ["changed", "delete-text", "insert-text"],
15
12
  GtkEntryBuffer: ["deleted-text", "inserted-text"],
16
13
  GtkFlowBox: ["selected-children-changed"],
17
- GtkIconView: ["selection-changed"],
18
14
  GtkListBox: ["row-selected", "selected-rows-changed"],
19
15
  GtkNotebook: ["page-added", "page-removed", "page-reordered", "switch-page"],
20
16
  GtkPopover: ["closed"],
@@ -38,8 +34,6 @@ const DEFAULT_USER_EVENT_SIGNALS = {
38
34
  "remove-tag",
39
35
  ],
40
36
  GtkToggleButton: ["toggled"],
41
- GtkTreeSelection: ["changed"],
42
- GtkTreeView: ["columns-changed", "cursor-changed", "row-collapsed", "row-expanded"],
43
37
  GtkWidget: ["state-flags-changed"],
44
38
  };
45
39
  const resolveUserEventSignals = (overrides) => {
@@ -1 +1 @@
1
- {"version":3,"file":"user-event-signals.js","sourceRoot":"","sources":["../src/user-event-signals.ts"],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BAAkB;QAClB,aAAa;QACb,cAAc;QACd,UAAU;QACV,kBAAkB;QAClB,YAAY;KACf;IACD,eAAe,EAAE,CAAC,SAAS,CAAC;IAC5B,gBAAgB,EAAE,CAAC,SAAS,CAAC;IAC7B,WAAW,EAAE,CAAC,iBAAiB,EAAE,gBAAgB,EAAE,eAAe,EAAE,cAAc,CAAC;IACnF,SAAS,EAAE,CAAC,qBAAqB,CAAC;CACrC,CAAC;AAEF,MAAM,uBAAuB,GAAG,CAAC,SAA+C,EAA4B,EAAE;IAC1G,MAAM,QAAQ,GAA6B,EAAE,GAAG,0BAA0B,EAAE,CAAC;IAC7E,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;IAExD,KAAK,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,eAAe,EAAE,CAAC;QAChD,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACnF,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC,CAAC;AAEF,OAAO,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,CAAC","sourcesContent":["const DEFAULT_USER_EVENT_SIGNALS: Record<string, string[]> = {\n AdwAlertDialog: [\"response\"],\n AdwCarousel: [\"page-changed\"],\n AdwDialog: [\"closed\"],\n AdwNavigationView: [\"pushed\"],\n AdwTabView: [\"close-page\", \"page-attached\", \"page-detached\", \"page-reordered\"],\n GObject: [\"notify\"],\n GtkAdjustment: [\"changed\", \"value-changed\"],\n GtkAppChooserButton: [\"changed\"],\n GtkAppChooserWidget: [\"application-selected\"],\n GtkCalendar: [\"day-selected\"],\n GtkCheckButton: [\"toggled\"],\n GtkComboBox: [\"changed\"],\n GtkEditable: [\"changed\", \"delete-text\", \"insert-text\"],\n GtkEntryBuffer: [\"deleted-text\", \"inserted-text\"],\n GtkFlowBox: [\"selected-children-changed\"],\n GtkIconView: [\"selection-changed\"],\n GtkListBox: [\"row-selected\", \"selected-rows-changed\"],\n GtkNotebook: [\"page-added\", \"page-removed\", \"page-reordered\", \"switch-page\"],\n GtkPopover: [\"closed\"],\n GtkRange: [\"value-changed\"],\n GtkScaleButton: [\"value-changed\"],\n GtkScrolledWindow: [\"edge-reached\"],\n GtkSearchEntry: [\"search-changed\"],\n GtkSelectionModel: [\"selection-changed\"],\n GtkSpinButton: [\"value-changed\"],\n GtkSwitch: [\"state-set\"],\n GtkTextBuffer: [\n \"apply-tag\",\n \"changed\",\n \"delete-range\",\n \"insert-child-anchor\",\n \"insert-paintable\",\n \"insert-text\",\n \"mark-deleted\",\n \"mark-set\",\n \"modified-changed\",\n \"remove-tag\",\n ],\n GtkToggleButton: [\"toggled\"],\n GtkTreeSelection: [\"changed\"],\n GtkTreeView: [\"columns-changed\", \"cursor-changed\", \"row-collapsed\", \"row-expanded\"],\n GtkWidget: [\"state-flags-changed\"],\n};\n\nconst resolveUserEventSignals = (overrides: Record<string, string[]> | undefined): Record<string, string[]> => {\n const resolved: Record<string, string[]> = { ...DEFAULT_USER_EVENT_SIGNALS };\n const overrideEntries = Object.entries(overrides ?? {});\n\n for (const [typeName, signals] of overrideEntries) {\n resolved[typeName] = [...new Set([...(resolved[typeName] ?? []), ...signals])];\n }\n\n return resolved;\n};\n\nexport { DEFAULT_USER_EVENT_SIGNALS, resolveUserEventSignals };\n"]}
1
+ {"version":3,"file":"user-event-signals.js","sourceRoot":"","sources":["../src/user-event-signals.ts"],"names":[],"mappings":"AAAA,MAAM,0BAA0B,GAA6B;IACzD,cAAc,EAAE,CAAC,UAAU,CAAC;IAC5B,WAAW,EAAE,CAAC,cAAc,CAAC;IAC7B,SAAS,EAAE,CAAC,QAAQ,CAAC;IACrB,iBAAiB,EAAE,CAAC,QAAQ,CAAC;IAC7B,UAAU,EAAE,CAAC,YAA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AQ,EAAE,OAAO,CAAC,IAAI,eAAe,EAAE,CAAC;QAChD,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACnF,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC,CAAC;AAEF,OAAO,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,CAAC","sourcesContent":["const DEFAULT_USER_EVENT_SIGNALS: Record<string, string[]> = {\n AdwAlertDialog: [\"response\"],\n AdwCarousel: [\"page-changed\"],\n AdwDialog: [\"closed\"],\n AdwNavigationView: [\"pushed\"],\n AdwTabView: [\"close-page\", \"page-attached\", \"page-detached\", \"page-reordered\"],\n GObject: [\"notify\"],\n GtkAdjustment: [\"changed\", \"value-changed\"],\n GtkCalendar: [\"day-selected\"],\n GtkCheckButton: [\"toggled\"],\n GtkEditable: [\"changed\", \"delete-text\", \"insert-text\"],\n GtkEntryBuffer: [\"deleted-text\", \"inserted-text\"],\n GtkFlowBox: [\"selected-children-changed\"],\n GtkListBox: [\"row-selected\", \"selected-rows-changed\"],\n GtkNotebook: [\"page-added\", \"page-removed\", \"page-reordered\", \"switch-page\"],\n GtkPopover: [\"closed\"],\n GtkRange: [\"value-changed\"],\n GtkScaleButton: [\"value-changed\"],\n GtkScrolledWindow: [\"edge-reached\"],\n GtkSearchEntry: [\"search-changed\"],\n GtkSelectionModel: [\"selection-changed\"],\n GtkSpinButton: [\"value-changed\"],\n GtkSwitch: [\"state-set\"],\n GtkTextBuffer: [\n \"apply-tag\",\n \"changed\",\n \"delete-range\",\n \"insert-child-anchor\",\n \"insert-paintable\",\n \"insert-text\",\n \"mark-deleted\",\n \"mark-set\",\n \"modified-changed\",\n \"remove-tag\",\n ],\n GtkToggleButton: [\"toggled\"],\n GtkWidget: [\"state-flags-changed\"],\n};\n\nconst resolveUserEventSignals = (overrides: Record<string, string[]> | undefined): Record<string, string[]> => {\n const resolved: Record<string, string[]> = { ...DEFAULT_USER_EVENT_SIGNALS };\n const overrideEntries = Object.entries(overrides ?? {});\n\n for (const [typeName, signals] of overrideEntries) {\n resolved[typeName] = [...new Set([...(resolved[typeName] ?? []), ...signals])];\n }\n\n return resolved;\n};\n\nexport { DEFAULT_USER_EVENT_SIGNALS, resolveUserEventSignals };\n"]}
@@ -1,8 +1,15 @@
1
1
  import type { Plugin, UserConfig } from "vite";
2
2
  import { type ConfigLoader } from "./loader.ts";
3
+ /**
4
+ * Creates a Vite plugin serving `virtual:gtkx-config`, the module carrying the project's resolved
5
+ * `gtkx.config.ts`.
6
+ */
3
7
  declare const createConfigPlugin: (options: {
8
+ /** Name the plugin is registered under in Vite. */
4
9
  name: string;
10
+ /** Loader the configuration is resolved through, defaulting to a fresh caching loader. */
5
11
  loadConfig?: ConfigLoader;
12
+ /** Extra Vite configuration contributed from the plugin's `config` hook. */
6
13
  config?: () => Omit<UserConfig, "plugins">;
7
14
  }) => Plugin;
8
15
  export default createConfigPlugin;
@@ -1 +1 @@
1
- {"version":3,"file":"vite-plugin.d.ts","sourceRoot":"","sources":["../src/vite-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,EAAE,KAAK,YAAY,EAAsB,MAAM,aAAa,CAAC;AAsBpE,QAAA,MAAM,kBAAkB,GAAI,SAAS;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;CAC9C,KAAG,MAcH,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"vite-plugin.d.ts","sourceRoot":"","sources":["../src/vite-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,EAAE,KAAK,YAAY,EAAsB,MAAM,aAAa,CAAC;AAwBpE;;;GAGG;AACH,QAAA,MAAM,kBAAkB,GAAI,SAAS;IACjC,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,0FAA0F;IAC1F,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,4EAA4E;IAC5E,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;CAC9C,KAAG,MAcH,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -7,6 +7,10 @@ const loadVirtualModule = async (id, loadConfig, state) => {
7
7
  }
8
8
  return renderConfigModule(await loadConfig.resolve(state.root ?? process.cwd()));
9
9
  };
10
+ /**
11
+ * Creates a Vite plugin serving `virtual:gtkx-config`, the module carrying the project's resolved
12
+ * `gtkx.config.ts`.
13
+ */
10
14
  const createConfigPlugin = (options) => {
11
15
  const loadConfig = options.loadConfig ?? createConfigLoader();
12
16
  const state = { root: undefined };
@@ -1 +1 @@
1
- {"version":3,"file":"vite-plugin.js","sourceRoot":"","sources":["../src/vite-plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,+BAA+B,EAAE,MAAM,cAAc,CAAC;AAM3G,MAAM,gBAAgB,GAAG,CAAC,EAAU,EAAiB,EAAE,CACnD,EAAE,KAAK,sBAAsB,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC,CAAC,IAAI,CAAC;AAE3E,MAAM,iBAAiB,GAAG,KAAK,EAC3B,EAAU,EACV,UAAwB,EACxB,KAAkB,EACS,EAAE;IAC7B,IAAI,EAAE,KAAK,+BAA+B,EAAE,CAAC;QACzC,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,OAAO,kBAAkB,CAAC,MAAM,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AACrF,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,OAI3B,EAAU,EAAE;IACT,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,kBAAkB,EAAE,CAAC;IAC9D,MAAM,KAAK,GAAgB,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IAE/C,OAAO;QACH,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,MAAM,CAAC,MAAkB;YACrB,KAAK,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC;YAEvC,OAAO,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;QAC9B,CAAC;QACD,SAAS,EAAE,CAAC,EAAU,EAAE,EAAE,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAC/C,IAAI,EAAE,CAAC,EAAU,EAAE,EAAE,CAAC,iBAAiB,CAAC,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC;KACjE,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["import type { Plugin, UserConfig } from \"vite\";\nimport { type ConfigLoader, createConfigLoader } from \"./loader.ts\";\nimport { GTKX_CONFIG_VIRTUAL_ID, renderConfigModule, RESOLVED_GTKX_CONFIG_VIRTUAL_ID } from \"./virtual.ts\";\n\ntype PluginState = {\n root: string | undefined;\n};\n\nconst resolveVirtualId = (id: string): string | null =>\n id === GTKX_CONFIG_VIRTUAL_ID ? RESOLVED_GTKX_CONFIG_VIRTUAL_ID : null;\n\nconst loadVirtualModule = async (\n id: string,\n loadConfig: ConfigLoader,\n state: PluginState,\n): Promise<string | undefined> => {\n if (id !== RESOLVED_GTKX_CONFIG_VIRTUAL_ID) {\n return undefined;\n }\n\n return renderConfigModule(await loadConfig.resolve(state.root ?? process.cwd()));\n};\n\nconst createConfigPlugin = (options: {\n name: string;\n loadConfig?: ConfigLoader;\n config?: () => Omit<UserConfig, \"plugins\">;\n}): Plugin => {\n const loadConfig = options.loadConfig ?? createConfigLoader();\n const state: PluginState = { root: undefined };\n\n return {\n name: options.name,\n config(config: UserConfig) {\n state.root = config.root ?? state.root;\n\n return options.config?.();\n },\n resolveId: (id: string) => resolveVirtualId(id),\n load: (id: string) => loadVirtualModule(id, loadConfig, state),\n };\n};\n\nexport default createConfigPlugin;\n"]}
1
+ {"version":3,"file":"vite-plugin.js","sourceRoot":"","sources":["../src/vite-plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,+BAA+B,EAAE,MAAM,cAAc,CAAC;AAQ3G,MAAM,gBAAgB,GAAG,CAAC,EAAU,EAAiB,EAAE,CACnD,EAAE,KAAK,sBAAsB,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC,CAAC,IAAI,CAAC;AAE3E,MAAM,iBAAiB,GAAG,KAAK,EAC3B,EAAU,EACV,UAAwB,EACxB,KAAkB,EACS,EAAE;IAC7B,IAAI,EAAE,KAAK,+BAA+B,EAAE,CAAC;QACzC,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,OAAO,kBAAkB,CAAC,MAAM,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AACrF,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,kBAAkB,GAAG,CAAC,OAO3B,EAAU,EAAE;IACT,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,kBAAkB,EAAE,CAAC;IAC9D,MAAM,KAAK,GAAgB,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IAE/C,OAAO;QACH,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,MAAM,CAAC,MAAkB;YACrB,KAAK,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC;YAEvC,OAAO,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;QAC9B,CAAC;QACD,SAAS,EAAE,CAAC,EAAU,EAAE,EAAE,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAC/C,IAAI,EAAE,CAAC,EAAU,EAAE,EAAE,CAAC,iBAAiB,CAAC,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC;KACjE,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["import type { Plugin, UserConfig } from \"vite\";\nimport { type ConfigLoader, createConfigLoader } from \"./loader.ts\";\nimport { GTKX_CONFIG_VIRTUAL_ID, renderConfigModule, RESOLVED_GTKX_CONFIG_VIRTUAL_ID } from \"./virtual.ts\";\n\n/** State the plugin carries from Vite's `config` hook to the virtual module it serves. */\ntype PluginState = {\n /** Project root taken from Vite's `config` hook, undefined when the user config leaves it unset. */\n root: string | undefined;\n};\n\nconst resolveVirtualId = (id: string): string | null =>\n id === GTKX_CONFIG_VIRTUAL_ID ? RESOLVED_GTKX_CONFIG_VIRTUAL_ID : null;\n\nconst loadVirtualModule = async (\n id: string,\n loadConfig: ConfigLoader,\n state: PluginState,\n): Promise<string | undefined> => {\n if (id !== RESOLVED_GTKX_CONFIG_VIRTUAL_ID) {\n return undefined;\n }\n\n return renderConfigModule(await loadConfig.resolve(state.root ?? process.cwd()));\n};\n\n/**\n * Creates a Vite plugin serving `virtual:gtkx-config`, the module carrying the project's resolved\n * `gtkx.config.ts`.\n */\nconst createConfigPlugin = (options: {\n /** Name the plugin is registered under in Vite. */\n name: string;\n /** Loader the configuration is resolved through, defaulting to a fresh caching loader. */\n loadConfig?: ConfigLoader;\n /** Extra Vite configuration contributed from the plugin's `config` hook. */\n config?: () => Omit<UserConfig, \"plugins\">;\n}): Plugin => {\n const loadConfig = options.loadConfig ?? createConfigLoader();\n const state: PluginState = { root: undefined };\n\n return {\n name: options.name,\n config(config: UserConfig) {\n state.root = config.root ?? state.root;\n\n return options.config?.();\n },\n resolveId: (id: string) => resolveVirtualId(id),\n load: (id: string) => loadVirtualModule(id, loadConfig, state),\n };\n};\n\nexport default createConfigPlugin;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gtkx/config",
3
- "version": "1.0.0-rc.4",
3
+ "version": "1.0.0",
4
4
  "description": "gtkx.config.ts schema, loader, and the element-prop mapping language shared across the GTKX toolchain",
5
5
  "keywords": [
6
6
  "gtkx",
@@ -50,9 +50,9 @@
50
50
  "dependencies": {
51
51
  "c12": "^3.3.4",
52
52
  "defu": "^6.1.7",
53
- "vite": "^8.2.0",
53
+ "vite": "^8.2.1",
54
54
  "zod": "^4.4.3",
55
- "@gtkx/utils": "1.0.0-rc.4"
55
+ "@gtkx/utils": "1.0.0"
56
56
  },
57
57
  "scripts": {
58
58
  "release": "tsx ../../scripts/release-package.ts"
package/src/config.ts CHANGED
@@ -33,9 +33,7 @@ type ResolvedReactCompilerOptions = ReactCompilerOptions & {
33
33
  * Compiler, codegen, and user event signal settings.
34
34
  */
35
35
  type Config = z.infer<typeof configSchema>;
36
- /** A named export referenced as plain data, so codegen can emit an import for it without loading the module. */
37
36
  type ModuleExport = z.infer<typeof moduleExportSchema>;
38
- /** One `elements.config` entry, describing how a single GLib type's generated element is shaped. */
39
37
  type ElementConfigEntry = z.infer<typeof elementConfigSchema>;
40
38
 
41
39
  /** Configuration reduced to the values the app runtime and the build need, with paths already resolved. */
@@ -56,13 +54,14 @@ const LIBRARIES_WILDCARD = "*";
56
54
  const GIR_LIBRARY_PATTERN = /^[A-Za-z][A-Za-z0-9]*-\d+(?:\.\d+)*$/;
57
55
  const APPLICATION_ID_PATTERN = /^[A-Za-z_][A-Za-z0-9_-]*(\.[A-Za-z_][A-Za-z0-9_-]*)+$/;
58
56
  const APPLICATION_ID_MAX_LENGTH = 255;
57
+ /** Compilation modes `babel-plugin-react-compiler` accepts. */
59
58
  const COMPILATION_MODES = ["infer", "syntax", "annotation", "all"] as const;
59
+ /** Panic thresholds `babel-plugin-react-compiler` accepts. */
60
60
  const PANIC_THRESHOLDS = ["none", "critical_errors", "all_errors"] as const;
61
61
  const REACT_COMPILER_TARGET = "19";
62
62
  const COMPILATION_MODE_SET: Set<string> = new Set(COMPILATION_MODES);
63
63
  const PANIC_THRESHOLD_SET: Set<string> = new Set(PANIC_THRESHOLDS);
64
64
 
65
- /** Validates `libraries`: the `"*"` wildcard on its own, or a non-empty array of `Name-Version` identifiers. */
66
65
  const librariesSchema = z.custom<typeof LIBRARIES_WILDCARD | string[]>().check((ctx) => {
67
66
  const value = ctx.value;
68
67
 
@@ -81,7 +80,6 @@ const librariesSchema = z.custom<typeof LIBRARIES_WILDCARD | string[]>().check((
81
80
  }
82
81
  });
83
82
 
84
- /** Validates `applicationId` against the reverse-DNS form `g_application_id_is_valid` accepts. */
85
83
  const applicationIdSchema = z.custom<string>().check((ctx) => {
86
84
  const value = ctx.value;
87
85
 
@@ -98,7 +96,6 @@ const applicationIdSchema = z.custom<string>().check((ctx) => {
98
96
  }
99
97
  });
100
98
 
101
- /** Validates `reactCompiler`: a boolean, or an options object whose mode and threshold are known values. */
102
99
  const reactCompilerSchema = z.custom<boolean | ReactCompilerOptions>().check((ctx) => {
103
100
  const value = ctx.value;
104
101
 
@@ -141,7 +138,6 @@ const reactCompilerSchema = z.custom<boolean | ReactCompilerOptions>().check((ct
141
138
  }
142
139
  });
143
140
 
144
- /** Validates `userEventSignals`: GLib type names mapped to arrays of non-empty signal names. */
145
141
  const userEventSignalsSchema = z.record(
146
142
  z.string(),
147
143
  z.array(
@@ -153,26 +149,18 @@ const userEventSignalsSchema = z.record(
153
149
  { error: "must be a record of GLib type names to signal name arrays" },
154
150
  );
155
151
 
156
- /** Validates a `{ module, export }` reference to a named export. */
157
152
  const moduleExportSchema = z.object(
158
153
  {
159
- /** Specifier the export is imported from. */
160
154
  module: z.string({ error: "must be a module specifier" }).min(1, { error: "must be a module specifier" }),
161
- /** Identifier the module exports it under. */
162
155
  export: z.string({ error: "must be an export name" }).min(1, { error: "must be an export name" }),
163
156
  },
164
157
  { error: "must be a { module, export } object" },
165
158
  );
166
159
 
167
- /** Validates one entry of `elements.config`. */
168
160
  const elementConfigSchema = z.object({
169
- /** Component that wraps the generated element. */
170
161
  component: moduleExportSchema.optional(),
171
- /** Base props interface the generated element props extend. */
172
162
  props: moduleExportSchema.optional(),
173
- /** Marks the element as having no GObject of its own, its parent container creating one instead. */
174
163
  isLazy: z.boolean({ error: "must be a boolean" }).optional(),
175
- /** GObject properties to leave out of the generated element props, such as those a behavior fills. */
176
164
  omittedProps: z
177
165
  .array(
178
166
  z.string({ error: "must be a non-empty property name" }).min(1, {
@@ -183,41 +171,22 @@ const elementConfigSchema = z.object({
183
171
  .optional(),
184
172
  });
185
173
 
186
- /** Validates `elements`: the behaviors module the app loads at runtime, plus the per-type entries. */
187
174
  const elementsSchema = z.object({
188
- /**
189
- * Path, resolved against the project root, of a module default-exporting element configs keyed by
190
- * GLib type name, as `defineElements` returns.
191
- */
192
175
  behaviors: z
193
176
  .string({ error: "must be a path to a module exporting element behaviors" })
194
177
  .min(1, { error: "must be a path to a module exporting element behaviors" })
195
178
  .optional(),
196
- /** Per-element entries, keyed by GLib type name. */
197
179
  config: z.record(z.string(), elementConfigSchema).optional(),
198
180
  });
199
181
 
200
- /** The shape every `gtkx.config.ts` is validated against, and the source of the {@link Config} type. */
182
+ /** Schema every `gtkx.config.ts` is validated against, and the source of the {@link Config} type. */
201
183
  const configSchema = z.object({
202
- /**
203
- * GIR namespaces to bind as `Name-Version`, or `"*"` for every one installed; omitting it gives
204
- * `Gtk-4.0`, which is also prepended to any list that names no Gtk version of its own.
205
- */
206
184
  libraries: librariesSchema.optional(),
207
- /** Directories searched for `.gir` files ahead of `GTKX_GIR_PATH` and the system locations. */
208
185
  girPath: z.array(z.string(), { error: "must be an array of strings if provided" }).optional(),
209
- /** Reverse-DNS GApplication identifier, and the default `applicationId` of the application element. */
210
186
  applicationId: applicationIdSchema,
211
- /** React Compiler settings; the compiler runs unless this is `false`. */
212
187
  reactCompiler: reactCompilerSchema.optional(),
213
- /** Whether to generate the binding stores; `false` makes the CLI resolve an already-installed one. */
214
188
  codegen: z.boolean({ error: "must be a boolean" }).optional(),
215
- /**
216
- * Signal names, keyed by GLib type name, that stay suppressed while a React commit applies props, so
217
- * their handlers only ever report user interaction. Unioned with the built-in GTK4 and Adwaita table.
218
- */
219
189
  userEventSignals: userEventSignalsSchema.optional(),
220
- /** Per-element customization: where the behaviors module lives and how each type's element is shaped. */
221
190
  elements: elementsSchema.optional(),
222
191
  });
223
192
 
@@ -337,6 +306,5 @@ export {
337
306
  resolveConfig,
338
307
  type ResolvedReactCompilerOptions,
339
308
  type Config,
340
- type ModuleExport,
341
309
  type ResolvedConfig,
342
310
  };
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  /** @public */
2
2
  export { type Config, defineConfig, mergeConfig, type ResolvedConfig } from "./config.ts";
3
3
  /** @public */
4
- export { type LoadedConfig, loadConfig } from "./loader.ts";
4
+ export { type ConfigLoader, type LoadedConfig, loadConfig } from "./loader.ts";
package/src/internal.ts CHANGED
@@ -6,4 +6,4 @@ export {
6
6
  resolveLazyElements,
7
7
  resolveOmittedProps,
8
8
  } from "./config.ts";
9
- export { type ConfigLoader, createConfigLoader } from "./loader.ts";
9
+ export { createConfigLoader } from "./loader.ts";
package/src/loader.ts CHANGED
@@ -23,8 +23,11 @@ type LoadConfigOptions = {
23
23
  mode?: string | undefined;
24
24
  };
25
25
 
26
+ /** Reads a project's configuration once per directory, caching what it loads and what it resolves. */
26
27
  type ConfigLoader = {
28
+ /** Loads the configuration file the given directory resolves to, as {@link loadConfig} does. */
27
29
  load: (cwd: string) => Promise<LoadedConfig>;
30
+ /** Loads the configuration for the given directory and reduces it to what the build and the app need. */
28
31
  resolve: (cwd: string) => Promise<ResolvedConfig>;
29
32
  };
30
33
 
@@ -79,4 +82,4 @@ const createConfigLoader = (options: LoadConfigOptions = {}): ConfigLoader => {
79
82
  };
80
83
  };
81
84
 
82
- export { loadConfig, createConfigLoader, type LoadedConfig, type LoadConfigOptions, type ConfigLoader };
85
+ export { loadConfig, createConfigLoader, type LoadedConfig, type ConfigLoader };
@@ -6,15 +6,11 @@ const DEFAULT_USER_EVENT_SIGNALS: Record<string, string[]> = {
6
6
  AdwTabView: ["close-page", "page-attached", "page-detached", "page-reordered"],
7
7
  GObject: ["notify"],
8
8
  GtkAdjustment: ["changed", "value-changed"],
9
- GtkAppChooserButton: ["changed"],
10
- GtkAppChooserWidget: ["application-selected"],
11
9
  GtkCalendar: ["day-selected"],
12
10
  GtkCheckButton: ["toggled"],
13
- GtkComboBox: ["changed"],
14
11
  GtkEditable: ["changed", "delete-text", "insert-text"],
15
12
  GtkEntryBuffer: ["deleted-text", "inserted-text"],
16
13
  GtkFlowBox: ["selected-children-changed"],
17
- GtkIconView: ["selection-changed"],
18
14
  GtkListBox: ["row-selected", "selected-rows-changed"],
19
15
  GtkNotebook: ["page-added", "page-removed", "page-reordered", "switch-page"],
20
16
  GtkPopover: ["closed"],
@@ -38,8 +34,6 @@ const DEFAULT_USER_EVENT_SIGNALS: Record<string, string[]> = {
38
34
  "remove-tag",
39
35
  ],
40
36
  GtkToggleButton: ["toggled"],
41
- GtkTreeSelection: ["changed"],
42
- GtkTreeView: ["columns-changed", "cursor-changed", "row-collapsed", "row-expanded"],
43
37
  GtkWidget: ["state-flags-changed"],
44
38
  };
45
39
 
@@ -2,7 +2,9 @@ import type { Plugin, UserConfig } from "vite";
2
2
  import { type ConfigLoader, createConfigLoader } from "./loader.ts";
3
3
  import { GTKX_CONFIG_VIRTUAL_ID, renderConfigModule, RESOLVED_GTKX_CONFIG_VIRTUAL_ID } from "./virtual.ts";
4
4
 
5
+ /** State the plugin carries from Vite's `config` hook to the virtual module it serves. */
5
6
  type PluginState = {
7
+ /** Project root taken from Vite's `config` hook, undefined when the user config leaves it unset. */
6
8
  root: string | undefined;
7
9
  };
8
10
 
@@ -21,9 +23,16 @@ const loadVirtualModule = async (
21
23
  return renderConfigModule(await loadConfig.resolve(state.root ?? process.cwd()));
22
24
  };
23
25
 
26
+ /**
27
+ * Creates a Vite plugin serving `virtual:gtkx-config`, the module carrying the project's resolved
28
+ * `gtkx.config.ts`.
29
+ */
24
30
  const createConfigPlugin = (options: {
31
+ /** Name the plugin is registered under in Vite. */
25
32
  name: string;
33
+ /** Loader the configuration is resolved through, defaulting to a fresh caching loader. */
26
34
  loadConfig?: ConfigLoader;
35
+ /** Extra Vite configuration contributed from the plugin's `config` hook. */
27
36
  config?: () => Omit<UserConfig, "plugins">;
28
37
  }): Plugin => {
29
38
  const loadConfig = options.loadConfig ?? createConfigLoader();