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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/README.md +2 -2
  2. package/dist/builtin-elements.d.ts +11 -0
  3. package/dist/builtin-elements.d.ts.map +1 -0
  4. package/dist/builtin-elements.js +329 -0
  5. package/dist/builtin-elements.js.map +1 -0
  6. package/dist/config-dependencies.d.ts +5 -3
  7. package/dist/config-dependencies.d.ts.map +1 -1
  8. package/dist/config-dependencies.js +54 -22
  9. package/dist/config-dependencies.js.map +1 -1
  10. package/dist/config-error.d.ts.map +1 -1
  11. package/dist/config-error.js.map +1 -1
  12. package/dist/config-reloader.d.ts.map +1 -1
  13. package/dist/config-reloader.js +2 -8
  14. package/dist/config-reloader.js.map +1 -1
  15. package/dist/config-source.d.ts +3 -1
  16. package/dist/config-source.d.ts.map +1 -1
  17. package/dist/config-source.js +17 -2
  18. package/dist/config-source.js.map +1 -1
  19. package/dist/config.d.ts +34 -10
  20. package/dist/config.d.ts.map +1 -1
  21. package/dist/config.js +56 -2
  22. package/dist/config.js.map +1 -1
  23. package/dist/deploy.d.ts +64 -6
  24. package/dist/deploy.d.ts.map +1 -1
  25. package/dist/deploy.js +168 -10
  26. package/dist/deploy.js.map +1 -1
  27. package/dist/index.d.ts +2 -2
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js.map +1 -1
  30. package/dist/internal.d.ts +2 -2
  31. package/dist/internal.d.ts.map +1 -1
  32. package/dist/internal.js +2 -2
  33. package/dist/internal.js.map +1 -1
  34. package/dist/loader.d.ts +2 -0
  35. package/dist/loader.d.ts.map +1 -1
  36. package/dist/loader.js +15 -20
  37. package/dist/loader.js.map +1 -1
  38. package/dist/resource-base-path.d.ts.map +1 -1
  39. package/dist/schema-text.d.ts.map +1 -1
  40. package/dist/user-event-signals.d.ts.map +1 -1
  41. package/dist/virtual.d.ts +1 -1
  42. package/dist/virtual.d.ts.map +1 -1
  43. package/dist/virtual.js +3 -2
  44. package/dist/virtual.js.map +1 -1
  45. package/dist/vite-plugin.d.ts +2 -0
  46. package/dist/vite-plugin.d.ts.map +1 -1
  47. package/dist/vite-plugin.js +4 -3
  48. package/dist/vite-plugin.js.map +1 -1
  49. package/dist/vite-root.d.ts.map +1 -1
  50. package/package.json +14 -29
  51. package/src/builtin-elements.ts +338 -0
  52. package/src/config-dependencies.ts +61 -27
  53. package/src/config-error.ts +5 -3
  54. package/src/config-reloader.ts +2 -11
  55. package/src/config-source.ts +25 -2
  56. package/src/config.ts +65 -4
  57. package/src/deploy.ts +204 -25
  58. package/src/index.ts +9 -2
  59. package/src/internal.ts +2 -2
  60. package/src/loader.ts +24 -29
  61. package/src/virtual.ts +5 -4
  62. package/src/vite-plugin.ts +9 -2
  63. package/dist/static-dependencies.d.ts +0 -3
  64. package/dist/static-dependencies.d.ts.map +0 -1
  65. package/dist/static-dependencies.js +0 -350
  66. package/dist/static-dependencies.js.map +0 -1
  67. package/src/static-dependencies.ts +0 -464
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Typed application configuration for GTKX.
4
4
 
5
- Use `defineConfig` in `gtkx.config.ts` to declare the application ID, native libraries, resources, and deployment settings. The CLI loads this configuration for development, code generation, and builds.
5
+ Use `defineConfig` in `gtkx.config.ts` to declare the application ID, additional native libraries, application icon, and deployment settings. The CLI loads this configuration for development, code generation, and builds.
6
6
 
7
7
  ```ts
8
8
  import { defineConfig } from "@gtkx/config";
@@ -14,6 +14,6 @@ export default defineConfig({
14
14
 
15
15
  [Guide](https://gtkx.dev/v2/guide/configuration-and-codegen) · [API reference](https://gtkx.dev/v2/reference/@gtkx/config/) · [GTKX](https://gtkx.dev)
16
16
 
17
- GTKX runs on Linux with Node.js and system native libraries. See [Getting Started](https://gtkx.dev/v2/guide/getting-started) for supported versions and installation. This README describes the 2.0 beta.
17
+ GTKX requires Linux, Node.js, and the [native prerequisites](https://gtkx.dev/v2/guide/getting-started).
18
18
 
19
19
  [MPL-2.0](https://github.com/gtkx-org/gtkx/blob/main/LICENSE).
@@ -0,0 +1,11 @@
1
+ import type { ElementConfigOptions } from "./config.ts";
2
+ declare const SINGLE_CHILD_TYPES: string[];
3
+ declare const CONTENT_SETTER_TYPES: string[];
4
+ /**
5
+ * Built-in GTK and Adwaita element metadata: base props, component wrappers, omitted properties,
6
+ * and parent-created objects. Contains no behaviors and can be imported without loading GI bindings.
7
+ */
8
+ declare const BUILTIN_ELEMENTS: Record<string, ElementConfigOptions>;
9
+ export { SINGLE_CHILD_TYPES, CONTENT_SETTER_TYPES, BUILTIN_ELEMENTS };
10
+ export type { ElementConfigOptions, ElementPropsExport, ModuleExport } from "./config.ts";
11
+ //# sourceMappingURL=builtin-elements.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtin-elements.d.ts","sourceRoot":"","sources":["../src/builtin-elements.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAgB,MAAM,aAAa,CAAC;AAOtE,QAAA,MAAM,kBAAkB,EAAE,MAAM,EA6B/B,CAAC;AAEF,QAAA,MAAM,oBAAoB,EAAE,MAAM,EAA8C,CAAC;AAEjF;;;GAGG;AACH,QAAA,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAiS1D,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,CAAC;AAEtE,YAAY,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,329 @@
1
+ const forTypes = (types, config) => Object.fromEntries(types.map((type) => [type, config]));
2
+ const internal = (name) => ({ module: "@gtkx/react/internal", export: name });
3
+ const SINGLE_CHILD_TYPES = [
4
+ "AdwBin",
5
+ "AdwClamp",
6
+ "AdwNavigationPage",
7
+ "AdwSplitButton",
8
+ "AdwStatusPage",
9
+ "AdwTabOverview",
10
+ "AdwToastOverlay",
11
+ "AdwToggle",
12
+ "GtkAspectFrame",
13
+ "GtkButton",
14
+ "GtkCheckButton",
15
+ "GtkDragIcon",
16
+ "GtkExpander",
17
+ "GtkFlowBoxChild",
18
+ "GtkFrame",
19
+ "GtkGraphicsOffload",
20
+ "GtkListBoxRow",
21
+ "GtkListHeader",
22
+ "GtkListItem",
23
+ "GtkMenuButton",
24
+ "GtkPopover",
25
+ "GtkPopoverBin",
26
+ "GtkRevealer",
27
+ "GtkScrolledWindow",
28
+ "GtkSearchBar",
29
+ "GtkTreeExpander",
30
+ "GtkViewport",
31
+ "GtkWindowHandle",
32
+ ];
33
+ const CONTENT_SETTER_TYPES = ["AdwBottomSheet", "AdwOverlaySplitView"];
34
+ /**
35
+ * Built-in GTK and Adwaita element metadata: base props, component wrappers, omitted properties,
36
+ * and parent-created objects. Contains no behaviors and can be imported without loading GI bindings.
37
+ */
38
+ const BUILTIN_ELEMENTS = {
39
+ ...forTypes(SINGLE_CHILD_TYPES, {
40
+ props: internal("ChildrenProps"),
41
+ omittedProps: ["child"],
42
+ }),
43
+ ...forTypes(["GtkHeaderBar", "GtkActionBar"], {
44
+ props: internal("GtkHeaderBarProps"),
45
+ }),
46
+ GtkWindow: {
47
+ props: internal("ChildrenProps"),
48
+ component: internal("createWindowComponent"),
49
+ omittedProps: ["child"],
50
+ },
51
+ GtkApplicationWindow: {
52
+ component: internal("createApplicationWindowComponent"),
53
+ },
54
+ GtkLabel: {
55
+ props: internal("ChildrenProps"),
56
+ },
57
+ GtkTextBuffer: {
58
+ props: internal("ChildrenProps"),
59
+ },
60
+ GtkTextTag: {
61
+ props: internal("ChildrenProps"),
62
+ },
63
+ GtkTextChildAnchor: {
64
+ props: { ...internal("GtkTextChildAnchorProps"), constructOnly: ["replacement"] },
65
+ },
66
+ GtkGridLayoutChild: {
67
+ isLazy: true,
68
+ },
69
+ GtkFixedLayoutChild: {
70
+ isLazy: true,
71
+ },
72
+ GtkOverlayLayoutChild: {
73
+ isLazy: true,
74
+ },
75
+ GtkStackPage: {
76
+ isLazy: true,
77
+ },
78
+ GtkNotebookPage: {
79
+ isLazy: true,
80
+ },
81
+ GActionGroup: {
82
+ props: internal("ActionGroupProps"),
83
+ },
84
+ GtkAccessible: {
85
+ props: { module: "@gtkx/react", export: "AccessibleProps" },
86
+ },
87
+ GtkWidget: {
88
+ props: { ...internal("GtkWidgetProps"), constructOnly: ["textChildAnchor"] },
89
+ },
90
+ GtkBox: {
91
+ props: internal("ChildrenProps"),
92
+ },
93
+ GtkListBox: {
94
+ props: internal("GtkListBoxProps"),
95
+ component: internal("createListBoxComponent"),
96
+ },
97
+ GtkFlowBox: {
98
+ props: internal("ChildrenProps"),
99
+ },
100
+ GtkOverlay: {
101
+ props: internal("GtkOverlayProps"),
102
+ omittedProps: ["child"],
103
+ },
104
+ GtkShortcutController: {
105
+ props: internal("GtkShortcutControllerProps"),
106
+ },
107
+ GtkCallbackAction: {
108
+ component: internal("createCallbackActionComponent"),
109
+ props: {
110
+ ...internal("GtkCallbackActionElementProps"),
111
+ composition: "factory",
112
+ constructOnly: ["callback"],
113
+ },
114
+ },
115
+ GtkCustomLayout: {
116
+ component: internal("createCustomLayoutComponent"),
117
+ props: {
118
+ ...internal("GtkCustomLayoutElementProps"),
119
+ composition: "factory",
120
+ constructOnly: ["requestMode", "measure", "allocate"],
121
+ },
122
+ },
123
+ GtkShortcutTrigger: {
124
+ component: internal("createShortcutTriggerComponent"),
125
+ props: {
126
+ ...internal("GtkShortcutTriggerElementProps"),
127
+ composition: "factory",
128
+ constructOnly: ["accelerator"],
129
+ },
130
+ },
131
+ GtkTextView: {
132
+ acceptedChildTypes: ["GtkTextBuffer", "GtkWidget"],
133
+ props: internal("ChildrenProps"),
134
+ },
135
+ GActionMap: {
136
+ props: internal("ActionMapProps"),
137
+ },
138
+ GMenu: {
139
+ acceptedChildTypes: ["GMenuItem"],
140
+ props: internal("MenuProps"),
141
+ component: internal("createMenuComponent"),
142
+ },
143
+ GMenuItem: {
144
+ component: internal("createMenuItemComponent"),
145
+ props: { ...internal("MenuItemProps"), constructOnly: ["label", "action"] },
146
+ },
147
+ GtkColumnView: {
148
+ acceptedChildTypes: ["GtkColumnViewColumn"],
149
+ props: internal("ChildrenProps"),
150
+ },
151
+ GtkGrid: {
152
+ props: internal("ChildrenProps"),
153
+ },
154
+ GtkFixed: {
155
+ props: internal("ChildrenProps"),
156
+ },
157
+ GtkSizeGroup: {
158
+ props: internal("GtkSizeGroupProps"),
159
+ component: internal("createPortaledComponent"),
160
+ },
161
+ GtkConstraintLayout: {
162
+ component: internal("createConstraintLayoutComponent"),
163
+ props: internal("GtkConstraintLayoutProps"),
164
+ },
165
+ GtkStack: {
166
+ props: internal("ChildrenProps"),
167
+ component: internal("createStackComponent"),
168
+ },
169
+ GtkNotebook: {
170
+ props: internal("ChildrenProps"),
171
+ },
172
+ GtkApplication: {
173
+ acceptedChildTypes: ["GtkWindow"],
174
+ props: { ...internal("GtkApplicationProps"), constructOnly: ["mainOptions"] },
175
+ component: internal("createApplicationComponent"),
176
+ },
177
+ GtkAboutDialog: {
178
+ props: { ...internal("GtkAboutDialogProps"), constructOnly: ["creditSections"] },
179
+ },
180
+ GtkScale: {
181
+ props: internal("GtkScaleProps"),
182
+ },
183
+ GtkCalendar: {
184
+ props: internal("GtkCalendarProps"),
185
+ },
186
+ GtkLevelBar: {
187
+ props: internal("GtkLevelBarProps"),
188
+ },
189
+ GtkDropTarget: {
190
+ props: internal("GtkDropTargetProps"),
191
+ },
192
+ GtkDrawingArea: {
193
+ props: internal("GtkDrawingAreaProps"),
194
+ },
195
+ GtkDragSource: {
196
+ props: internal("GtkDragSourceProps"),
197
+ },
198
+ ...forTypes(CONTENT_SETTER_TYPES, {
199
+ props: internal("ChildrenProps"),
200
+ omittedProps: ["content"],
201
+ }),
202
+ AdwClampScrollable: {
203
+ props: internal("ChildrenProps"),
204
+ omittedProps: ["child"],
205
+ },
206
+ AdwViewStackPage: {
207
+ isLazy: true,
208
+ },
209
+ AdwTabPage: {
210
+ isLazy: true,
211
+ props: { ...internal("AdwTabPageProps"), constructOnly: ["parent"] },
212
+ },
213
+ AdwTabBar: {
214
+ props: internal("AdwTabDropProps"),
215
+ },
216
+ AdwTabOverview: {
217
+ props: internal("AdwTabDropProps"),
218
+ omittedProps: ["child"],
219
+ },
220
+ AdwAboutDialog: {
221
+ props: {
222
+ ...internal("AdwAboutDialogProps"),
223
+ constructOnly: ["links", "creditSections", "acknowledgementSections", "legalSections", "otherApps"],
224
+ },
225
+ },
226
+ AdwLayout: {
227
+ isLazy: true,
228
+ },
229
+ AdwSidebar: {
230
+ acceptedChildTypes: ["AdwSidebarSection"],
231
+ props: internal("ChildrenProps"),
232
+ },
233
+ AdwSidebarSection: {
234
+ acceptedChildTypes: ["AdwSidebarItem"],
235
+ props: internal("ChildrenProps"),
236
+ },
237
+ AdwMultiLayoutView: {
238
+ props: internal("AdwMultiLayoutViewProps"),
239
+ component: internal("createMultiLayoutViewComponent"),
240
+ },
241
+ AdwPreferencesRow: {
242
+ props: internal("AdwPreferencesRowProps"),
243
+ },
244
+ AdwDialog: {
245
+ props: internal("AdwBreakpointsProps"),
246
+ component: internal("createDialogComponent"),
247
+ omittedProps: ["child"],
248
+ },
249
+ AdwApplicationWindow: {
250
+ props: internal("AdwBreakpointsProps"),
251
+ omittedProps: ["content"],
252
+ },
253
+ AdwWindow: {
254
+ props: internal("AdwBreakpointsProps"),
255
+ omittedProps: ["content"],
256
+ },
257
+ AdwBreakpointBin: {
258
+ props: internal("AdwBreakpointsProps"),
259
+ omittedProps: ["child"],
260
+ },
261
+ AdwActionRow: {
262
+ props: internal("AdwPreferencesRowProps"),
263
+ },
264
+ AdwEntryRow: {
265
+ props: internal("AdwPreferencesRowProps"),
266
+ },
267
+ AdwExpanderRow: {
268
+ props: internal("AdwExpanderRowProps"),
269
+ },
270
+ AdwNavigationSplitView: {
271
+ acceptedChildTypes: ["AdwNavigationPage"],
272
+ props: internal("ChildrenProps"),
273
+ omittedProps: ["content"],
274
+ },
275
+ AdwWrapBox: {
276
+ props: internal("ChildrenProps"),
277
+ },
278
+ AdwCarousel: {
279
+ props: internal("ChildrenProps"),
280
+ },
281
+ AdwPreferencesPage: {
282
+ acceptedChildTypes: ["AdwPreferencesGroup"],
283
+ props: internal("ChildrenProps"),
284
+ },
285
+ AdwPreferencesDialog: {
286
+ acceptedChildTypes: ["AdwPreferencesPage"],
287
+ props: internal("ChildrenProps"),
288
+ },
289
+ AdwPreferencesGroup: {
290
+ props: internal("ChildrenProps"),
291
+ },
292
+ AdwTabView: {
293
+ props: internal("ChildrenProps"),
294
+ },
295
+ AdwNavigationView: {
296
+ acceptedChildTypes: ["AdwNavigationPage"],
297
+ props: internal("ChildrenProps"),
298
+ },
299
+ AdwViewStack: {
300
+ props: internal("ChildrenProps"),
301
+ component: internal("createViewStackComponent"),
302
+ },
303
+ AdwToolbarView: {
304
+ props: internal("AdwToolbarViewProps"),
305
+ omittedProps: ["content"],
306
+ },
307
+ AdwHeaderBar: {
308
+ props: internal("GtkHeaderBarProps"),
309
+ },
310
+ AdwShortcutsDialog: {
311
+ acceptedChildTypes: ["AdwShortcutsSection"],
312
+ props: internal("ChildrenProps"),
313
+ },
314
+ AdwShortcutsSection: {
315
+ acceptedChildTypes: ["AdwShortcutsItem"],
316
+ props: internal("ChildrenProps"),
317
+ },
318
+ AdwToggleGroup: {
319
+ props: { ...internal("AdwToggleGroupProps"), composition: "intersection" },
320
+ acceptedChildTypes: ["AdwToggle"],
321
+ component: internal("createToggleGroupComponent"),
322
+ },
323
+ AdwAlertDialog: {
324
+ props: internal("AdwAlertDialogProps"),
325
+ omittedProps: ["extraChild"],
326
+ },
327
+ };
328
+ export { SINGLE_CHILD_TYPES, CONTENT_SETTER_TYPES, BUILTIN_ELEMENTS };
329
+ //# sourceMappingURL=builtin-elements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtin-elements.js","sourceRoot":"","sources":["../src/builtin-elements.ts"],"names":[],"mappings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, ModuleExport } from \"./config.ts\";\n\nconst forTypes = (types: string[], config: ElementConfigOptions): Record<string, ElementConfigOptions> =>\n Object.fromEntries(types.map((type) => [type, config]));\n\nconst internal = (name: string): ModuleExport => ({ module: \"@gtkx/react/internal\", export: name });\n\nconst SINGLE_CHILD_TYPES: string[] = [\n \"AdwBin\",\n \"AdwClamp\",\n \"AdwNavigationPage\",\n \"AdwSplitButton\",\n \"AdwStatusPage\",\n \"AdwTabOverview\",\n \"AdwToastOverlay\",\n \"AdwToggle\",\n \"GtkAspectFrame\",\n \"GtkButton\",\n \"GtkCheckButton\",\n \"GtkDragIcon\",\n \"GtkExpander\",\n \"GtkFlowBoxChild\",\n \"GtkFrame\",\n \"GtkGraphicsOffload\",\n \"GtkListBoxRow\",\n \"GtkListHeader\",\n \"GtkListItem\",\n \"GtkMenuButton\",\n \"GtkPopover\",\n \"GtkPopoverBin\",\n \"GtkRevealer\",\n \"GtkScrolledWindow\",\n \"GtkSearchBar\",\n \"GtkTreeExpander\",\n \"GtkViewport\",\n \"GtkWindowHandle\",\n];\n\nconst CONTENT_SETTER_TYPES: string[] = [\"AdwBottomSheet\", \"AdwOverlaySplitView\"];\n\n/**\n * Built-in GTK and Adwaita element metadata: base props, component wrappers, omitted properties,\n * and parent-created objects. Contains no behaviors and can be imported without loading GI bindings.\n */\nconst BUILTIN_ELEMENTS: Record<string, ElementConfigOptions> = {\n ...forTypes(SINGLE_CHILD_TYPES, {\n props: internal(\"ChildrenProps\"),\n omittedProps: [\"child\"],\n }),\n ...forTypes([\"GtkHeaderBar\", \"GtkActionBar\"], {\n props: internal(\"GtkHeaderBarProps\"),\n }),\n GtkWindow: {\n props: internal(\"ChildrenProps\"),\n component: internal(\"createWindowComponent\"),\n omittedProps: [\"child\"],\n },\n GtkApplicationWindow: {\n component: internal(\"createApplicationWindowComponent\"),\n },\n GtkLabel: {\n props: internal(\"ChildrenProps\"),\n },\n GtkTextBuffer: {\n props: internal(\"ChildrenProps\"),\n },\n GtkTextTag: {\n props: internal(\"ChildrenProps\"),\n },\n GtkTextChildAnchor: {\n props: { ...internal(\"GtkTextChildAnchorProps\"), constructOnly: [\"replacement\"] },\n },\n GtkGridLayoutChild: {\n isLazy: true,\n },\n GtkFixedLayoutChild: {\n isLazy: true,\n },\n GtkOverlayLayoutChild: {\n isLazy: true,\n },\n GtkStackPage: {\n isLazy: true,\n },\n GtkNotebookPage: {\n isLazy: true,\n },\n GActionGroup: {\n props: internal(\"ActionGroupProps\"),\n },\n GtkAccessible: {\n props: { module: \"@gtkx/react\", export: \"AccessibleProps\" },\n },\n GtkWidget: {\n props: { ...internal(\"GtkWidgetProps\"), constructOnly: [\"textChildAnchor\"] },\n },\n GtkBox: {\n props: internal(\"ChildrenProps\"),\n },\n GtkListBox: {\n props: internal(\"GtkListBoxProps\"),\n component: internal(\"createListBoxComponent\"),\n },\n GtkFlowBox: {\n props: internal(\"ChildrenProps\"),\n },\n GtkOverlay: {\n props: internal(\"GtkOverlayProps\"),\n omittedProps: [\"child\"],\n },\n GtkShortcutController: {\n props: internal(\"GtkShortcutControllerProps\"),\n },\n GtkCallbackAction: {\n component: internal(\"createCallbackActionComponent\"),\n props: {\n ...internal(\"GtkCallbackActionElementProps\"),\n composition: \"factory\",\n constructOnly: [\"callback\"],\n },\n },\n GtkCustomLayout: {\n component: internal(\"createCustomLayoutComponent\"),\n props: {\n ...internal(\"GtkCustomLayoutElementProps\"),\n composition: \"factory\",\n constructOnly: [\"requestMode\", \"measure\", \"allocate\"],\n },\n },\n GtkShortcutTrigger: {\n component: internal(\"createShortcutTriggerComponent\"),\n props: {\n ...internal(\"GtkShortcutTriggerElementProps\"),\n composition: \"factory\",\n constructOnly: [\"accelerator\"],\n },\n },\n GtkTextView: {\n acceptedChildTypes: [\"GtkTextBuffer\", \"GtkWidget\"],\n props: internal(\"ChildrenProps\"),\n },\n GActionMap: {\n props: internal(\"ActionMapProps\"),\n },\n GMenu: {\n acceptedChildTypes: [\"GMenuItem\"],\n props: internal(\"MenuProps\"),\n component: internal(\"createMenuComponent\"),\n },\n GMenuItem: {\n component: internal(\"createMenuItemComponent\"),\n props: { ...internal(\"MenuItemProps\"), constructOnly: [\"label\", \"action\"] },\n },\n GtkColumnView: {\n acceptedChildTypes: [\"GtkColumnViewColumn\"],\n props: internal(\"ChildrenProps\"),\n },\n GtkGrid: {\n props: internal(\"ChildrenProps\"),\n },\n GtkFixed: {\n props: internal(\"ChildrenProps\"),\n },\n GtkSizeGroup: {\n props: internal(\"GtkSizeGroupProps\"),\n component: internal(\"createPortaledComponent\"),\n },\n GtkConstraintLayout: {\n component: internal(\"createConstraintLayoutComponent\"),\n props: internal(\"GtkConstraintLayoutProps\"),\n },\n GtkStack: {\n props: internal(\"ChildrenProps\"),\n component: internal(\"createStackComponent\"),\n },\n GtkNotebook: {\n props: internal(\"ChildrenProps\"),\n },\n GtkApplication: {\n acceptedChildTypes: [\"GtkWindow\"],\n props: { ...internal(\"GtkApplicationProps\"), constructOnly: [\"mainOptions\"] },\n component: internal(\"createApplicationComponent\"),\n },\n GtkAboutDialog: {\n props: { ...internal(\"GtkAboutDialogProps\"), constructOnly: [\"creditSections\"] },\n },\n GtkScale: {\n props: internal(\"GtkScaleProps\"),\n },\n GtkCalendar: {\n props: internal(\"GtkCalendarProps\"),\n },\n GtkLevelBar: {\n props: internal(\"GtkLevelBarProps\"),\n },\n GtkDropTarget: {\n props: internal(\"GtkDropTargetProps\"),\n },\n GtkDrawingArea: {\n props: internal(\"GtkDrawingAreaProps\"),\n },\n GtkDragSource: {\n props: internal(\"GtkDragSourceProps\"),\n },\n ...forTypes(CONTENT_SETTER_TYPES, {\n props: internal(\"ChildrenProps\"),\n omittedProps: [\"content\"],\n }),\n AdwClampScrollable: {\n props: internal(\"ChildrenProps\"),\n omittedProps: [\"child\"],\n },\n AdwViewStackPage: {\n isLazy: true,\n },\n AdwTabPage: {\n isLazy: true,\n props: { ...internal(\"AdwTabPageProps\"), constructOnly: [\"parent\"] },\n },\n AdwTabBar: {\n props: internal(\"AdwTabDropProps\"),\n },\n AdwTabOverview: {\n props: internal(\"AdwTabDropProps\"),\n omittedProps: [\"child\"],\n },\n AdwAboutDialog: {\n props: {\n ...internal(\"AdwAboutDialogProps\"),\n constructOnly: [\"links\", \"creditSections\", \"acknowledgementSections\", \"legalSections\", \"otherApps\"],\n },\n },\n AdwLayout: {\n isLazy: true,\n },\n AdwSidebar: {\n acceptedChildTypes: [\"AdwSidebarSection\"],\n props: internal(\"ChildrenProps\"),\n },\n AdwSidebarSection: {\n acceptedChildTypes: [\"AdwSidebarItem\"],\n props: internal(\"ChildrenProps\"),\n },\n AdwMultiLayoutView: {\n props: internal(\"AdwMultiLayoutViewProps\"),\n component: internal(\"createMultiLayoutViewComponent\"),\n },\n AdwPreferencesRow: {\n props: internal(\"AdwPreferencesRowProps\"),\n },\n AdwDialog: {\n props: internal(\"AdwBreakpointsProps\"),\n component: internal(\"createDialogComponent\"),\n omittedProps: [\"child\"],\n },\n AdwApplicationWindow: {\n props: internal(\"AdwBreakpointsProps\"),\n omittedProps: [\"content\"],\n },\n AdwWindow: {\n props: internal(\"AdwBreakpointsProps\"),\n omittedProps: [\"content\"],\n },\n AdwBreakpointBin: {\n props: internal(\"AdwBreakpointsProps\"),\n omittedProps: [\"child\"],\n },\n AdwActionRow: {\n props: internal(\"AdwPreferencesRowProps\"),\n },\n AdwEntryRow: {\n props: internal(\"AdwPreferencesRowProps\"),\n },\n AdwExpanderRow: {\n props: internal(\"AdwExpanderRowProps\"),\n },\n AdwNavigationSplitView: {\n acceptedChildTypes: [\"AdwNavigationPage\"],\n props: internal(\"ChildrenProps\"),\n omittedProps: [\"content\"],\n },\n AdwWrapBox: {\n props: internal(\"ChildrenProps\"),\n },\n AdwCarousel: {\n props: internal(\"ChildrenProps\"),\n },\n AdwPreferencesPage: {\n acceptedChildTypes: [\"AdwPreferencesGroup\"],\n props: internal(\"ChildrenProps\"),\n },\n AdwPreferencesDialog: {\n acceptedChildTypes: [\"AdwPreferencesPage\"],\n props: internal(\"ChildrenProps\"),\n },\n AdwPreferencesGroup: {\n props: internal(\"ChildrenProps\"),\n },\n AdwTabView: {\n props: internal(\"ChildrenProps\"),\n },\n AdwNavigationView: {\n acceptedChildTypes: [\"AdwNavigationPage\"],\n props: internal(\"ChildrenProps\"),\n },\n AdwViewStack: {\n props: internal(\"ChildrenProps\"),\n component: internal(\"createViewStackComponent\"),\n },\n AdwToolbarView: {\n props: internal(\"AdwToolbarViewProps\"),\n omittedProps: [\"content\"],\n },\n AdwHeaderBar: {\n props: internal(\"GtkHeaderBarProps\"),\n },\n AdwShortcutsDialog: {\n acceptedChildTypes: [\"AdwShortcutsSection\"],\n props: internal(\"ChildrenProps\"),\n },\n AdwShortcutsSection: {\n acceptedChildTypes: [\"AdwShortcutsItem\"],\n props: internal(\"ChildrenProps\"),\n },\n AdwToggleGroup: {\n props: { ...internal(\"AdwToggleGroupProps\"), composition: \"intersection\" },\n acceptedChildTypes: [\"AdwToggle\"],\n component: internal(\"createToggleGroupComponent\"),\n },\n AdwAlertDialog: {\n props: internal(\"AdwAlertDialogProps\"),\n omittedProps: [\"extraChild\"],\n },\n};\n\nexport { SINGLE_CHILD_TYPES, CONTENT_SETTER_TYPES, BUILTIN_ELEMENTS };\n\nexport type { ElementConfigOptions, ElementPropsExport, ModuleExport } from \"./config.ts\";\n"]}
@@ -1,11 +1,13 @@
1
- import { type TransformOptions, type TransformResult } from "jiti";
1
+ import { type Jiti } from "jiti";
2
2
  type CapturedConfig<T> = {
3
3
  dependencies: string[];
4
4
  value: T;
5
5
  };
6
- declare const transformConfigModule: (options: TransformOptions) => TransformResult;
6
+ declare const addConfigSource: (path: string) => void;
7
+ declare const createConfigImporter: () => Jiti;
7
8
  declare const setConfigDependencies: (value: object, dependencies: Iterable<string>) => void;
8
9
  declare const configDependenciesFor: (value: unknown) => string[];
9
10
  declare const captureConfigDependencies: <T>(operation: () => Promise<T>) => Promise<CapturedConfig<T>>;
10
- export { captureConfigDependencies, configDependenciesFor, setConfigDependencies, transformConfigModule, };
11
+ declare const loadConfigModule: (path: string) => Promise<unknown>;
12
+ export { addConfigSource, captureConfigDependencies, configDependenciesFor, createConfigImporter, loadConfigModule, setConfigDependencies, };
11
13
  //# sourceMappingURL=config-dependencies.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config-dependencies.d.ts","sourceRoot":"","sources":["../src/config-dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAE,MAAM,MAAM,CAAC;AAO1F,KAAK,cAAc,CAAC,CAAC,IAAI;IAAE,YAAY,EAAE,MAAM,EAAE,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAAC;AAyD9D,QAAA,MAAM,qBAAqB,GAAI,SAAS,gBAAgB,KAAG,eAY1D,CAAC;AAEF,QAAA,MAAM,qBAAqB,GAAI,OAAO,MAAM,EAAE,cAAc,QAAQ,CAAC,MAAM,CAAC,KAAG,IAI9E,CAAC;AAEF,QAAA,MAAM,qBAAqB,GAAI,OAAO,OAAO,KAAG,MAAM,EACqC,CAAC;AAE5F,QAAA,MAAM,yBAAyB,GAAU,CAAC,EAAE,WAAW,MAAM,OAAO,CAAC,CAAC,CAAC,KAAG,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAqBlG,CAAC;AAEF,OAAO,EACH,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GACxB,CAAC"}
1
+ {"version":3,"file":"config-dependencies.d.ts","sourceRoot":"","sources":["../src/config-dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,MAAM,CAAC;AAS7C,KAAK,cAAc,CAAC,CAAC,IAAI;IAAE,YAAY,EAAE,MAAM,EAAE,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAAC;AAoB9D,QAAA,MAAM,eAAe,SAAU,MAAM,KAAG,IAIvC,CAAC;AAqEF,QAAA,MAAM,oBAAoB,QAAO,IACqF,CAAC;AAEvH,QAAA,MAAM,qBAAqB,UAAW,MAAM,gBAAgB,QAAQ,CAAC,MAAM,CAAC,KAAG,IAG9E,CAAC;AAEF,QAAA,MAAM,qBAAqB,UAAW,OAAO,KAAG,MAAM,EACuC,CAAC;AAE9F,QAAA,MAAM,yBAAyB,GAAU,CAAC,aAAa,MAAM,OAAO,CAAC,CAAC,CAAC,KAAG,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAqBlG,CAAC;AAEF,QAAA,MAAM,gBAAgB,SAAgB,MAAM,KAAG,OAAO,CAAC,OAAO,CAI7D,CAAC;AAEF,OAAO,EACH,eAAe,EACf,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,GACxB,CAAC"}
@@ -1,11 +1,21 @@
1
+ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
2
+ if (typeof path === "string" && /^\.\.?\//.test(path)) {
3
+ return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
4
+ return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
5
+ });
6
+ }
7
+ return path;
8
+ };
1
9
  import { createJiti } from "jiti";
2
10
  import { AsyncLocalStorage } from "node:async_hooks";
3
- import { createRequire, registerHooks } from "node:module";
11
+ import { registerHooks } from "node:module";
4
12
  import { extname, sep } from "node:path";
5
- import { fileURLToPath } from "node:url";
13
+ import { fileURLToPath, pathToFileURL } from "node:url";
14
+ import { isRecord } from "./config-error.js";
15
+ import { configSourceCandidates } from "./config-source.js";
6
16
  const captureStorage = new AsyncLocalStorage();
7
17
  const dependenciesByValue = new WeakMap();
8
- const CACHE_BUSTED_EXTENSIONS = new Set([".cjs", ".js", ".json", ".mjs"]);
18
+ const CACHE_BUSTED_EXTENSIONS = new Set([".js", ".json", ".mjs", ".mts", ".ts"]);
9
19
  const isTrackedPath = (path) => !path.includes(`${sep}node_modules${sep}`);
10
20
  const addPath = (path) => {
11
21
  if (isTrackedPath(path)) {
@@ -17,6 +27,16 @@ const addUrl = (url) => {
17
27
  addPath(fileURLToPath(url));
18
28
  }
19
29
  };
30
+ const addConfigSource = (path) => {
31
+ for (const candidate of configSourceCandidates(path)) {
32
+ addPath(candidate);
33
+ }
34
+ };
35
+ const addFailedSource = (error) => {
36
+ if (isRecord(error) && typeof error.url === "string" && error.url.startsWith("file:")) {
37
+ addConfigSource(fileURLToPath(error.url));
38
+ }
39
+ };
20
40
  const cacheBustedUrl = (url) => {
21
41
  const state = captureStorage.getStore();
22
42
  if (state === undefined || !url.startsWith("file:")) {
@@ -32,38 +52,46 @@ const cacheBustedUrl = (url) => {
32
52
  };
33
53
  const registerResolutionHook = () => registerHooks({
34
54
  resolve(specifier, context, nextResolve) {
35
- const result = nextResolve(specifier, context);
55
+ let result;
56
+ try {
57
+ result = nextResolve(specifier, context);
58
+ }
59
+ catch (error) {
60
+ const state = captureStorage.getStore();
61
+ const fallback = captureStorage.exit(() => state?.resolver.esmResolve(specifier, {
62
+ ...(context.parentURL !== undefined && { parentURL: context.parentURL }),
63
+ try: true,
64
+ }));
65
+ if (fallback === undefined) {
66
+ addFailedSource(error);
67
+ throw error;
68
+ }
69
+ result = nextResolve(fallback, context);
70
+ }
36
71
  addUrl(result.url);
37
72
  return { ...result, url: cacheBustedUrl(result.url) };
38
73
  },
39
74
  });
40
- const clearNativeModuleCache = (dependencies) => {
41
- const cache = createRequire(import.meta.url).cache;
42
- for (const path of dependencies) {
43
- Reflect.deleteProperty(cache, path);
44
- }
45
- };
46
- const transformConfigModule = (options) => {
47
- const state = captureStorage.getStore();
48
- if (state === undefined) {
49
- throw new Error("Configuration transformation started outside a dependency capture");
50
- }
51
- if (options.filename !== undefined) {
52
- addPath(options.filename);
75
+ const importConfigModule = async (path, options) => {
76
+ if ([".cjs", ".cts"].includes(extname(path))) {
77
+ throw new Error(`Configuration modules must use ESM: ${path}`);
53
78
  }
54
- return { code: state.transformer.transform(options) };
79
+ const value = (await import(__rewriteRelativeImportExtension(pathToFileURL(path).href), {
80
+ ...(extname(path) === ".json" && { with: { type: "json" } }),
81
+ }));
82
+ return (options?.default ? (value.default ?? { ...value }) : value);
55
83
  };
84
+ const createConfigImporter = () => Object.assign(createJiti(import.meta.url, { fsCache: false, moduleCache: false }), { import: importConfigModule });
56
85
  const setConfigDependencies = (value, dependencies) => {
57
86
  const paths = [...new Set(dependencies)];
58
87
  dependenciesByValue.set(value, paths);
59
- clearNativeModuleCache(paths);
60
88
  };
61
- const configDependenciesFor = (value) => typeof value === "object" && value !== null ? dependenciesByValue.get(value) ?? [] : [];
89
+ const configDependenciesFor = (value) => typeof value === "object" && value !== null ? (dependenciesByValue.get(value) ?? []) : [];
62
90
  const captureConfigDependencies = async (operation) => {
63
91
  const state = {
64
92
  cacheKey: process.hrtime.bigint().toString(),
65
93
  dependencies: new Set(),
66
- transformer: createJiti(import.meta.url, { fsCache: false, moduleCache: false }),
94
+ resolver: createJiti(import.meta.url, { fsCache: false, moduleCache: false }),
67
95
  };
68
96
  const hook = registerResolutionHook();
69
97
  try {
@@ -80,5 +108,9 @@ const captureConfigDependencies = async (operation) => {
80
108
  hook.deregister();
81
109
  }
82
110
  };
83
- export { captureConfigDependencies, configDependenciesFor, setConfigDependencies, transformConfigModule, };
111
+ const loadConfigModule = async (path) => {
112
+ const captured = await captureConfigDependencies(() => importConfigModule(path, { default: true }));
113
+ return captured.value;
114
+ };
115
+ export { addConfigSource, captureConfigDependencies, configDependenciesFor, createConfigImporter, loadConfigModule, setConfigDependencies, };
84
116
  //# sourceMappingURL=config-dependencies.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config-dependencies.js","sourceRoot":"","sources":["../src/config-dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA0D,MAAM,MAAM,CAAC;AAC1F,OAAO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AK,EAAE,CAAC;IAC5D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YAC9C,qBAAqB,CAAC,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;QACrD,CAAC;QAED,MAAM,KAAK,CAAC;IAChB,CAAC;YAAS,CAAC;QACP,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,EACH,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GACxB,CAAC","sourcesContent":["import { createJiti, type Jiti, type TransformOptions, type TransformResult } from \"jiti\";\nimport { AsyncLocalStorage } from \"node:async_hooks\";\nimport { createRequire, registerHooks } from \"node:module\";\nimport { extname, sep } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\ntype CaptureState = { cacheKey: string; dependencies: Set<string>; transformer: Jiti };\ntype CapturedConfig<T> = { dependencies: string[]; value: T };\n\nconst captureStorage: AsyncLocalStorage<CaptureState> = new AsyncLocalStorage();\nconst dependenciesByValue: WeakMap<object, string[]> = new WeakMap();\nconst CACHE_BUSTED_EXTENSIONS: ReadonlySet<string> = new Set([\".cjs\", \".js\", \".json\", \".mjs\"]);\n\nconst isTrackedPath = (path: string): boolean => !path.includes(`${sep}node_modules${sep}`);\n\nconst addPath = (path: string): void => {\n if (isTrackedPath(path)) {\n captureStorage.getStore()?.dependencies.add(path);\n }\n};\n\nconst addUrl = (url: string): void => {\n if (url.startsWith(\"file:\")) {\n addPath(fileURLToPath(url));\n }\n};\n\nconst cacheBustedUrl = (url: string): string => {\n const state = captureStorage.getStore();\n\n if (state === undefined || !url.startsWith(\"file:\")) {\n return url;\n }\n\n const path = fileURLToPath(url);\n\n if (!isTrackedPath(path) || !CACHE_BUSTED_EXTENSIONS.has(extname(path))) {\n return url;\n }\n\n const parsed = new URL(url);\n parsed.searchParams.set(\"gtkx-config-load\", state.cacheKey);\n\n return parsed.href;\n};\n\nconst registerResolutionHook = (): ReturnType<typeof registerHooks> =>\n registerHooks({\n resolve(specifier, context, nextResolve) {\n const result = nextResolve(specifier, context);\n addUrl(result.url);\n\n return { ...result, url: cacheBustedUrl(result.url) };\n },\n });\n\nconst clearNativeModuleCache = (dependencies: Iterable<string>): void => {\n const cache = createRequire(import.meta.url).cache;\n\n for (const path of dependencies) {\n Reflect.deleteProperty(cache, path);\n }\n};\n\nconst transformConfigModule = (options: TransformOptions): TransformResult => {\n const state = captureStorage.getStore();\n\n if (state === undefined) {\n throw new Error(\"Configuration transformation started outside a dependency capture\");\n }\n\n if (options.filename !== undefined) {\n addPath(options.filename);\n }\n\n return { code: state.transformer.transform(options) };\n};\n\nconst setConfigDependencies = (value: object, dependencies: Iterable<string>): void => {\n const paths = [...new Set(dependencies)];\n dependenciesByValue.set(value, paths);\n clearNativeModuleCache(paths);\n};\n\nconst configDependenciesFor = (value: unknown): string[] =>\n typeof value === \"object\" && value !== null ? dependenciesByValue.get(value) ?? [] : [];\n\nconst captureConfigDependencies = async <T>(operation: () => Promise<T>): Promise<CapturedConfig<T>> => {\n const state: CaptureState = {\n cacheKey: process.hrtime.bigint().toString(),\n dependencies: new Set(),\n transformer: createJiti(import.meta.url, { fsCache: false, moduleCache: false }),\n };\n const hook = registerResolutionHook();\n\n try {\n const value = await captureStorage.run(state, operation);\n\n return { dependencies: [...state.dependencies], value };\n } catch (error) {\n if (typeof error === \"object\" && error !== null) {\n setConfigDependencies(error, state.dependencies);\n }\n\n throw error;\n } finally {\n hook.deregister();\n }\n};\n\nexport {\n captureConfigDependencies,\n configDependenciesFor,\n setConfigDependencies,\n transformConfigModule,\n};\n"]}
1
+ {"version":3,"file":"config-dependencies.js","sourceRoot":"","sources":["../src/config-dependencies.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,MAAM,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,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EAAE,YAAY,EAAE,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,CAAC;IAC5D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YAC9C,qBAAqB,CAAC,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;QACrD,CAAC;QAED,MAAM,KAAK,CAAC;IAChB,CAAC;YAAS,CAAC;QACP,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,KAAK,EAAE,IAAY,EAAoB,EAAE;IAC9D,MAAM,QAAQ,GAAG,MAAM,yBAAyB,CAAC,GAAG,EAAE,CAAC,kBAAkB,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAEpG,OAAO,QAAQ,CAAC,KAAK,CAAC;AAC1B,CAAC,CAAC;AAEF,OAAO,EACH,eAAe,EACf,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,GACxB,CAAC","sourcesContent":["import { createJiti, type Jiti } from \"jiti\";\nimport { AsyncLocalStorage } from \"node:async_hooks\";\nimport { registerHooks } from \"node:module\";\nimport { extname, sep } from \"node:path\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\nimport { isRecord } from \"./config-error.ts\";\nimport { configSourceCandidates } from \"./config-source.ts\";\n\ntype CaptureState = { cacheKey: string; dependencies: Set<string>; resolver: Jiti };\ntype CapturedConfig<T> = { dependencies: string[]; value: T };\n\nconst captureStorage: AsyncLocalStorage<CaptureState> = new AsyncLocalStorage();\nconst dependenciesByValue: WeakMap<object, string[]> = new WeakMap();\nconst CACHE_BUSTED_EXTENSIONS: ReadonlySet<string> = new Set([\".js\", \".json\", \".mjs\", \".mts\", \".ts\"]);\n\nconst isTrackedPath = (path: string): boolean => !path.includes(`${sep}node_modules${sep}`);\n\nconst addPath = (path: string): void => {\n if (isTrackedPath(path)) {\n captureStorage.getStore()?.dependencies.add(path);\n }\n};\n\nconst addUrl = (url: string): void => {\n if (url.startsWith(\"file:\")) {\n addPath(fileURLToPath(url));\n }\n};\n\nconst addConfigSource = (path: string): void => {\n for (const candidate of configSourceCandidates(path)) {\n addPath(candidate);\n }\n};\n\nconst addFailedSource = (error: unknown): void => {\n if (isRecord(error) && typeof error.url === \"string\" && error.url.startsWith(\"file:\")) {\n addConfigSource(fileURLToPath(error.url));\n }\n};\n\nconst cacheBustedUrl = (url: string): string => {\n const state = captureStorage.getStore();\n\n if (state === undefined || !url.startsWith(\"file:\")) {\n return url;\n }\n\n const path = fileURLToPath(url);\n\n if (!isTrackedPath(path) || !CACHE_BUSTED_EXTENSIONS.has(extname(path))) {\n return url;\n }\n\n const parsed = new URL(url);\n parsed.searchParams.set(\"gtkx-config-load\", state.cacheKey);\n\n return parsed.href;\n};\n\nconst registerResolutionHook = (): ReturnType<typeof registerHooks> =>\n registerHooks({\n resolve(specifier, context, nextResolve) {\n let result;\n\n try {\n result = nextResolve(specifier, context);\n } catch (error) {\n const state = captureStorage.getStore();\n const fallback = captureStorage.exit(() =>\n state?.resolver.esmResolve(specifier, {\n ...(context.parentURL !== undefined && { parentURL: context.parentURL }),\n try: true,\n }),\n );\n\n if (fallback === undefined) {\n addFailedSource(error);\n throw error;\n }\n\n result = nextResolve(fallback, context);\n }\n\n addUrl(result.url);\n\n return { ...result, url: cacheBustedUrl(result.url) };\n },\n });\n\nconst importConfigModule: Jiti[\"import\"] = async <T>(path: string, options?: { default?: true }): Promise<T> => {\n if ([\".cjs\", \".cts\"].includes(extname(path))) {\n throw new Error(`Configuration modules must use ESM: ${path}`);\n }\n\n const value = (await import(pathToFileURL(path).href, {\n ...(extname(path) === \".json\" && { with: { type: \"json\" } }),\n })) as Record<string, unknown>;\n\n return (options?.default ? (value.default ?? { ...value }) : value) as T;\n};\n\nconst createConfigImporter = (): Jiti =>\n Object.assign(createJiti(import.meta.url, { fsCache: false, moduleCache: false }), { import: importConfigModule });\n\nconst setConfigDependencies = (value: object, dependencies: Iterable<string>): void => {\n const paths = [...new Set(dependencies)];\n dependenciesByValue.set(value, paths);\n};\n\nconst configDependenciesFor = (value: unknown): string[] =>\n typeof value === \"object\" && value !== null ? (dependenciesByValue.get(value) ?? []) : [];\n\nconst captureConfigDependencies = async <T>(operation: () => Promise<T>): Promise<CapturedConfig<T>> => {\n const state: CaptureState = {\n cacheKey: process.hrtime.bigint().toString(),\n dependencies: new Set(),\n resolver: createJiti(import.meta.url, { fsCache: false, moduleCache: false }),\n };\n const hook = registerResolutionHook();\n\n try {\n const value = await captureStorage.run(state, operation);\n\n return { dependencies: [...state.dependencies], value };\n } catch (error) {\n if (typeof error === \"object\" && error !== null) {\n setConfigDependencies(error, state.dependencies);\n }\n\n throw error;\n } finally {\n hook.deregister();\n }\n};\n\nconst loadConfigModule = async (path: string): Promise<unknown> => {\n const captured = await captureConfigDependencies(() => importConfigModule(path, { default: true }));\n\n return captured.value;\n};\n\nexport {\n addConfigSource,\n captureConfigDependencies,\n configDependenciesFor,\n createConfigImporter,\n loadConfigModule,\n setConfigDependencies,\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"config-error.d.ts","sourceRoot":"","sources":["../src/config-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,QAAA,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CACM,CAAC;AAIzE,QAAA,MAAM,sBAAsB,GAAI,KAAK,MAAM,EAAE,aAAa,MAAM,KAAG,KAGW,CAAC;AAE/E,QAAA,MAAM,WAAW,GAAI,OAAO,CAAC,CAAC,QAAQ,EAAE,mBAAgC,KAAG,KACJ,CAAC;AAExE,OAAO,EAAE,QAAQ,EAAE,sBAAsB,EAAE,WAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"config-error.d.ts","sourceRoot":"","sources":["../src/config-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,QAAA,MAAM,QAAQ,UAAW,OAAO,KAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CACM,CAAC;AAIzE,QAAA,MAAM,sBAAsB,QAAS,MAAM,eAAe,MAAM,KAAG,KAK9D,CAAC;AAEN,QAAA,MAAM,WAAW,UAAW,CAAC,CAAC,QAAQ,0BAAqC,KACJ,CAAC;AAExE,OAAO,EAAE,QAAQ,EAAE,sBAAsB,EAAE,WAAW,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"config-error.js","sourceRoot":"","sources":["../src/config-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,mBAAmB,GAAG,eAAe,CAAC;AAE5C,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CAClE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAEzE,MAAM,YAAY,GAAG,CAAC,UAAkB,EAAU,EAAE,CAAC,GAAG,UAAU,GAAG,CAAC;AAEtE,MAAM,sBAAsB,GAAG,CAAC,GAAW,EAAE,UAAmB,EAAS,EAAE,CACvE,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS;IAC9B,CAAC,CAAC,GAAG,YAAY,CAAC,mBAAmB,CAAC,mCAAmC,GAAG,EAAE;IAC9E,CAAC,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,mCAAmC,GAAG,EAAE,CAAC,CAAC;AAE/E,MAAM,WAAW,GAAG,CAAC,KAAiB,EAAE,UAAU,GAAG,mBAAmB,EAAS,EAAE,CAC/E,IAAI,KAAK,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAExE,OAAO,EAAE,QAAQ,EAAE,sBAAsB,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { z } from \"zod\";\n\nconst DEFAULT_CONFIG_FILE = \"gtkx.config.*\";\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst configPrefix = (configFile: string): string => `${configFile}:`;\n\nconst missingConfigFileError = (cwd: string, configFile?: string): Error =>\n new Error(configFile === undefined\n ? `${configPrefix(DEFAULT_CONFIG_FILE)} no configuration file found in ${cwd}`\n : `${configPrefix(configFile)} no configuration file found in ${cwd}`);\n\nconst configError = (error: z.ZodError, configFile = DEFAULT_CONFIG_FILE): Error =>\n new Error(`${configPrefix(configFile)}\\n${z.prettifyError(error)}`);\n\nexport { isRecord, missingConfigFileError, configError };\n"]}
1
+ {"version":3,"file":"config-error.js","sourceRoot":"","sources":["../src/config-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,mBAAmB,GAAG,eAAe,CAAC;AAE5C,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CAClE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAEzE,MAAM,YAAY,GAAG,CAAC,UAAkB,EAAU,EAAE,CAAC,GAAG,UAAU,GAAG,CAAC;AAEtE,MAAM,sBAAsB,GAAG,CAAC,GAAW,EAAE,UAAmB,EAAS,EAAE,CACvE,IAAI,KAAK,CACL,UAAU,KAAK,SAAS;IACpB,CAAC,CAAC,GAAG,YAAY,CAAC,mBAAmB,CAAC,mCAAmC,GAAG,EAAE;IAC9E,CAAC,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,mCAAmC,GAAG,EAAE,CAC5E,CAAC;AAEN,MAAM,WAAW,GAAG,CAAC,KAAiB,EAAE,UAAU,GAAG,mBAAmB,EAAS,EAAE,CAC/E,IAAI,KAAK,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAExE,OAAO,EAAE,QAAQ,EAAE,sBAAsB,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { z } from \"zod\";\n\nconst DEFAULT_CONFIG_FILE = \"gtkx.config.*\";\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst configPrefix = (configFile: string): string => `${configFile}:`;\n\nconst missingConfigFileError = (cwd: string, configFile?: string): Error =>\n new Error(\n configFile === undefined\n ? `${configPrefix(DEFAULT_CONFIG_FILE)} no configuration file found in ${cwd}`\n : `${configPrefix(configFile)} no configuration file found in ${cwd}`,\n );\n\nconst configError = (error: z.ZodError, configFile = DEFAULT_CONFIG_FILE): Error =>\n new Error(`${configPrefix(configFile)}\\n${z.prettifyError(error)}`);\n\nexport { isRecord, missingConfigFileError, configError };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"config-reloader.d.ts","sourceRoot":"","sources":["../src/config-reloader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,iBAAiB,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAGpF,KAAK,cAAc,GAAG;IAClB,MAAM,EAAE,MAAM,OAAO,CAAC,YAAY,CAAC,CAAC;IACpC,YAAY,EAAE,MAAM,MAAM,EAAE,CAAC;CAChC,CAAC;AAEF,QAAA,MAAM,oBAAoB,GACtB,KAAK,MAAM,EACX,UAAS,iBAAsB,EAC/B,sBAAqB,MAAM,EAAO,KACnC,OAAO,CAAC,cAAc,CAqCxB,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
1
+ {"version":3,"file":"config-reloader.d.ts","sourceRoot":"","sources":["../src/config-reloader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,iBAAiB,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAEpF,KAAK,cAAc,GAAG;IAClB,MAAM,EAAE,MAAM,OAAO,CAAC,YAAY,CAAC,CAAC;IACpC,YAAY,EAAE,MAAM,MAAM,EAAE,CAAC;CAChC,CAAC;AAEF,QAAA,MAAM,oBAAoB,QACjB,MAAM,YACF,iBAAiB,wBACL,MAAM,EAAE,KAC9B,OAAO,CAAC,cAAc,CA6BxB,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
@@ -1,7 +1,6 @@
1
- import { relative, resolve } from "node:path";
1
+ import { resolve } from "node:path";
2
2
  import { configDependenciesFor } from "./config-dependencies.js";
3
3
  import { loadConfig } from "./loader.js";
4
- import { resolveConfigDependencies } from "./static-dependencies.js";
5
4
  const createConfigReloader = async (cwd, options = {}, initialDependencies = []) => {
6
5
  let selectedConfigFile;
7
6
  let knownDependencies = initialDependencies;
@@ -13,13 +12,8 @@ const createConfigReloader = async (cwd, options = {}, initialDependencies = [])
13
12
  else {
14
13
  selectedConfigFile = resolve(cwd, options.configFile);
15
14
  }
16
- const selectedConfigName = relative(cwd, selectedConfigFile);
17
- const resolvePaths = () => [
18
- ...new Set([selectedConfigFile, ...knownDependencies]
19
- .flatMap((path) => resolveConfigDependencies(path, selectedConfigName, cwd))),
20
- ];
21
15
  return {
22
- resolvePaths,
16
+ resolvePaths: () => [...new Set([selectedConfigFile, ...knownDependencies])],
23
17
  reload: async () => {
24
18
  let loaded;
25
19
  try {