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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +2 -2
  2. package/dist/builtin-elements.d.ts +23 -0
  3. package/dist/builtin-elements.d.ts.map +1 -0
  4. package/dist/builtin-elements.js +366 -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 +4 -2
  16. package/dist/config-source.d.ts.map +1 -1
  17. package/dist/config-source.js +26 -8
  18. package/dist/config-source.js.map +1 -1
  19. package/dist/config.d.ts +159 -45
  20. package/dist/config.d.ts.map +1 -1
  21. package/dist/config.js +28 -19
  22. package/dist/config.js.map +1 -1
  23. package/dist/deploy.d.ts +391 -13
  24. package/dist/deploy.d.ts.map +1 -1
  25. package/dist/deploy.js +16 -13
  26. package/dist/deploy.js.map +1 -1
  27. package/dist/index.d.ts +3 -3
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +1 -1
  30. package/dist/index.js.map +1 -1
  31. package/dist/internal.d.ts +3 -3
  32. package/dist/internal.d.ts.map +1 -1
  33. package/dist/internal.js +3 -3
  34. package/dist/internal.js.map +1 -1
  35. package/dist/loader.d.ts +22 -4
  36. package/dist/loader.d.ts.map +1 -1
  37. package/dist/loader.js +59 -31
  38. package/dist/loader.js.map +1 -1
  39. package/dist/resource-base-path.d.ts.map +1 -1
  40. package/dist/schema-text.d.ts.map +1 -1
  41. package/dist/user-event-signals.d.ts.map +1 -1
  42. package/dist/virtual.d.ts +1 -1
  43. package/dist/virtual.d.ts.map +1 -1
  44. package/dist/virtual.js +4 -2
  45. package/dist/virtual.js.map +1 -1
  46. package/dist/vite-plugin.d.ts +2 -0
  47. package/dist/vite-plugin.d.ts.map +1 -1
  48. package/dist/vite-plugin.js +4 -3
  49. package/dist/vite-plugin.js.map +1 -1
  50. package/dist/vite-root.d.ts.map +1 -1
  51. package/package.json +14 -29
  52. package/src/builtin-elements.ts +377 -0
  53. package/src/config-dependencies.ts +61 -27
  54. package/src/config-error.ts +5 -3
  55. package/src/config-reloader.ts +2 -11
  56. package/src/config-source.ts +35 -8
  57. package/src/config.ts +189 -39
  58. package/src/deploy.ts +471 -55
  59. package/src/index.ts +42 -3
  60. package/src/internal.ts +3 -2
  61. package/src/loader.ts +106 -37
  62. package/src/virtual.ts +6 -4
  63. package/src/vite-plugin.ts +9 -2
  64. package/dist/static-dependencies.d.ts +0 -3
  65. package/dist/static-dependencies.d.ts.map +0 -1
  66. package/dist/static-dependencies.js +0 -350
  67. package/dist/static-dependencies.js.map +0 -1
  68. 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,23 @@
1
+ import type { ElementConfigOptions } from "./config.ts";
2
+ declare const SINGLE_CHILD_TYPES: string[];
3
+ declare const CONTENT_SETTER_TYPES: string[];
4
+ /** `GMenuItem` props written as the GtkBuilder menu attribute of the same name, keyed by prop. */
5
+ declare const MENU_ITEM_ATTRIBUTES: {
6
+ readonly custom: "custom";
7
+ readonly hiddenWhen: "hidden-when";
8
+ readonly accel: "accel";
9
+ readonly icon: "icon";
10
+ readonly verbIcon: "verb-icon";
11
+ readonly useMarkup: "use-markup";
12
+ readonly submenuAction: "submenu-action";
13
+ readonly displayHint: "display-hint";
14
+ readonly textDirection: "text-direction";
15
+ };
16
+ /**
17
+ * Built-in GTK and Adwaita element metadata: base props, component wrappers, omitted properties,
18
+ * and parent-created objects. Contains no behaviors and can be imported without loading GI bindings.
19
+ */
20
+ declare const BUILTIN_ELEMENTS: Record<string, ElementConfigOptions>;
21
+ export { SINGLE_CHILD_TYPES, CONTENT_SETTER_TYPES, MENU_ITEM_ATTRIBUTES, BUILTIN_ELEMENTS };
22
+ export type { ElementConfigOptions, ElementPropsExport, ModuleExport } from "./config.ts";
23
+ //# 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;AAKjF,kGAAkG;AAClG,QAAA,MAAM,oBAAoB;qBACd,QAAQ;yBACJ,aAAa;oBAClB,OAAO;mBACR,MAAM;uBACF,WAAW;wBACV,YAAY;4BACR,gBAAgB;0BAClB,cAAc;4BACZ,gBAAgB;CACQ,CAAC;AAE5C;;;GAGG;AACH,QAAA,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAwT1D,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,CAAC;AAE5F,YAAY,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,366 @@
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
+ const SINGLE_CHILD_CONFIG = { props: internal("ChildrenProps"), omittedProps: ["child"] };
35
+ const CONTENT_SETTER_CONFIG = { props: internal("ChildrenProps"), omittedProps: ["content"] };
36
+ /** `GMenuItem` props written as the GtkBuilder menu attribute of the same name, keyed by prop. */
37
+ const MENU_ITEM_ATTRIBUTES = {
38
+ custom: "custom",
39
+ hiddenWhen: "hidden-when",
40
+ accel: "accel",
41
+ icon: "icon",
42
+ verbIcon: "verb-icon",
43
+ useMarkup: "use-markup",
44
+ submenuAction: "submenu-action",
45
+ displayHint: "display-hint",
46
+ textDirection: "text-direction",
47
+ };
48
+ /**
49
+ * Built-in GTK and Adwaita element metadata: base props, component wrappers, omitted properties,
50
+ * and parent-created objects. Contains no behaviors and can be imported without loading GI bindings.
51
+ */
52
+ const BUILTIN_ELEMENTS = {
53
+ ...forTypes(SINGLE_CHILD_TYPES, SINGLE_CHILD_CONFIG),
54
+ GtkSearchBar: {
55
+ ...SINGLE_CHILD_CONFIG,
56
+ component: internal("createSearchBarComponent"),
57
+ },
58
+ ...forTypes(["GtkHeaderBar", "GtkActionBar"], {
59
+ props: internal("GtkHeaderBarProps"),
60
+ }),
61
+ GtkMenuButton: {
62
+ props: internal("GtkMenuButtonProps"),
63
+ component: internal("createCustomChildrenComponent"),
64
+ omittedProps: ["child"],
65
+ },
66
+ GtkPopoverMenu: {
67
+ props: internal("CustomChildrenProps"),
68
+ component: internal("createCustomChildrenComponent"),
69
+ },
70
+ GtkPopoverMenuBar: {
71
+ props: internal("CustomChildrenProps"),
72
+ component: internal("createCustomChildrenComponent"),
73
+ },
74
+ GtkWindow: {
75
+ props: internal("ChildrenProps"),
76
+ component: internal("createWindowComponent"),
77
+ omittedProps: ["child"],
78
+ },
79
+ GtkApplicationWindow: {
80
+ component: internal("createApplicationWindowComponent"),
81
+ },
82
+ GtkLabel: {
83
+ props: internal("ChildrenProps"),
84
+ },
85
+ GtkTextBuffer: {
86
+ props: internal("ChildrenProps"),
87
+ },
88
+ GtkTextTag: {
89
+ props: internal("ChildrenProps"),
90
+ },
91
+ GtkTextChildAnchor: {
92
+ props: { ...internal("GtkTextChildAnchorProps"), constructOnly: ["replacement"] },
93
+ },
94
+ GtkGridLayoutChild: {
95
+ isLazy: true,
96
+ },
97
+ GtkFixedLayoutChild: {
98
+ isLazy: true,
99
+ },
100
+ GtkOverlayLayoutChild: {
101
+ isLazy: true,
102
+ },
103
+ GtkStackPage: {
104
+ isLazy: true,
105
+ },
106
+ GtkNotebookPage: {
107
+ isLazy: true,
108
+ },
109
+ GActionGroup: {
110
+ props: internal("ActionGroupProps"),
111
+ },
112
+ GtkAccessible: {
113
+ props: { module: "@gtkx/react", export: "AccessibleProps" },
114
+ },
115
+ GtkWidget: {
116
+ props: { ...internal("GtkWidgetProps"), constructOnly: ["textChildAnchor"] },
117
+ },
118
+ GtkBox: {
119
+ props: internal("ChildrenProps"),
120
+ },
121
+ GtkListBox: {
122
+ props: internal("GtkListBoxProps"),
123
+ component: internal("createListBoxComponent"),
124
+ },
125
+ GtkFlowBox: {
126
+ props: internal("ChildrenProps"),
127
+ },
128
+ GtkOverlay: {
129
+ props: internal("GtkOverlayProps"),
130
+ omittedProps: ["child"],
131
+ },
132
+ GtkShortcutController: {
133
+ props: internal("GtkShortcutControllerProps"),
134
+ },
135
+ GtkCallbackAction: {
136
+ component: internal("createCallbackActionComponent"),
137
+ props: {
138
+ ...internal("GtkCallbackActionElementProps"),
139
+ composition: "factory",
140
+ constructOnly: ["callback"],
141
+ },
142
+ },
143
+ GtkCustomLayout: {
144
+ component: internal("createCustomLayoutComponent"),
145
+ props: {
146
+ ...internal("GtkCustomLayoutElementProps"),
147
+ composition: "factory",
148
+ constructOnly: ["requestMode", "measure", "allocate"],
149
+ },
150
+ },
151
+ GtkShortcutTrigger: {
152
+ component: internal("createShortcutTriggerComponent"),
153
+ props: {
154
+ ...internal("GtkShortcutTriggerElementProps"),
155
+ composition: "factory",
156
+ constructOnly: ["accelerator"],
157
+ },
158
+ },
159
+ GtkTextView: {
160
+ acceptedChildTypes: ["GtkTextBuffer", "GtkWidget"],
161
+ props: internal("ChildrenProps"),
162
+ },
163
+ GActionMap: {
164
+ props: internal("ActionMapProps"),
165
+ },
166
+ GMenu: {
167
+ acceptedChildTypes: ["GMenuItem"],
168
+ props: internal("MenuProps"),
169
+ component: internal("createMenuComponent"),
170
+ },
171
+ GMenuItem: {
172
+ component: internal("createMenuItemComponent"),
173
+ props: {
174
+ ...internal("MenuItemProps"),
175
+ constructOnly: ["label", "action", ...Object.keys(MENU_ITEM_ATTRIBUTES)],
176
+ },
177
+ },
178
+ GtkColumnView: {
179
+ acceptedChildTypes: ["GtkColumnViewColumn"],
180
+ props: internal("ChildrenProps"),
181
+ },
182
+ GtkGrid: {
183
+ props: internal("ChildrenProps"),
184
+ },
185
+ GtkFixed: {
186
+ props: internal("ChildrenProps"),
187
+ },
188
+ GtkSizeGroup: {
189
+ props: internal("GtkSizeGroupProps"),
190
+ component: internal("createPortaledComponent"),
191
+ },
192
+ GtkConstraintLayout: {
193
+ component: internal("createConstraintLayoutComponent"),
194
+ props: internal("GtkConstraintLayoutProps"),
195
+ },
196
+ GtkStack: {
197
+ props: internal("ChildrenProps"),
198
+ component: internal("createStackComponent"),
199
+ },
200
+ GtkNotebook: {
201
+ props: internal("ChildrenProps"),
202
+ },
203
+ GtkApplication: {
204
+ acceptedChildTypes: ["GtkWindow"],
205
+ props: { ...internal("GtkApplicationProps"), constructOnly: ["mainOptions"] },
206
+ component: internal("createApplicationComponent"),
207
+ },
208
+ GtkAboutDialog: {
209
+ props: { ...internal("GtkAboutDialogProps"), constructOnly: ["creditSections"] },
210
+ },
211
+ GtkScale: {
212
+ props: internal("GtkScaleProps"),
213
+ },
214
+ GtkCalendar: {
215
+ props: internal("GtkCalendarProps"),
216
+ },
217
+ GtkLevelBar: {
218
+ props: internal("GtkLevelBarProps"),
219
+ },
220
+ GtkDropTarget: {
221
+ props: internal("GtkDropTargetProps"),
222
+ },
223
+ GtkDrawingArea: {
224
+ props: internal("GtkDrawingAreaProps"),
225
+ },
226
+ GtkDragSource: {
227
+ props: internal("GtkDragSourceProps"),
228
+ },
229
+ AdwBottomSheet: {
230
+ ...CONTENT_SETTER_CONFIG,
231
+ component: internal("createBottomSheetComponent"),
232
+ },
233
+ AdwOverlaySplitView: {
234
+ ...CONTENT_SETTER_CONFIG,
235
+ component: internal("createOverlaySplitViewComponent"),
236
+ },
237
+ AdwClampScrollable: {
238
+ props: internal("ChildrenProps"),
239
+ omittedProps: ["child"],
240
+ },
241
+ AdwViewStackPage: {
242
+ isLazy: true,
243
+ },
244
+ AdwTabPage: {
245
+ isLazy: true,
246
+ props: { ...internal("AdwTabPageProps"), constructOnly: ["parent"] },
247
+ },
248
+ AdwTabBar: {
249
+ props: internal("AdwTabDropProps"),
250
+ },
251
+ AdwTabOverview: {
252
+ props: internal("AdwTabDropProps"),
253
+ component: internal("createTabOverviewComponent"),
254
+ omittedProps: ["child"],
255
+ },
256
+ AdwAboutDialog: {
257
+ props: {
258
+ ...internal("AdwAboutDialogProps"),
259
+ constructOnly: ["links", "creditSections", "acknowledgementSections", "legalSections", "otherApps"],
260
+ },
261
+ },
262
+ AdwLayout: {
263
+ isLazy: true,
264
+ },
265
+ AdwSidebar: {
266
+ acceptedChildTypes: ["AdwSidebarSection"],
267
+ props: internal("ChildrenProps"),
268
+ },
269
+ AdwSidebarSection: {
270
+ acceptedChildTypes: ["AdwSidebarItem"],
271
+ props: internal("ChildrenProps"),
272
+ },
273
+ AdwMultiLayoutView: {
274
+ props: internal("AdwMultiLayoutViewProps"),
275
+ component: internal("createMultiLayoutViewComponent"),
276
+ },
277
+ AdwPreferencesRow: {
278
+ props: internal("AdwPreferencesRowProps"),
279
+ },
280
+ AdwDialog: {
281
+ props: internal("AdwBreakpointsProps"),
282
+ component: internal("createDialogComponent"),
283
+ omittedProps: ["child"],
284
+ },
285
+ AdwApplicationWindow: {
286
+ props: internal("AdwBreakpointsProps"),
287
+ omittedProps: ["content"],
288
+ },
289
+ AdwWindow: {
290
+ props: internal("AdwBreakpointsProps"),
291
+ omittedProps: ["content"],
292
+ },
293
+ AdwBreakpointBin: {
294
+ props: internal("AdwBreakpointsProps"),
295
+ omittedProps: ["child"],
296
+ },
297
+ AdwActionRow: {
298
+ props: internal("AdwPreferencesRowProps"),
299
+ },
300
+ AdwEntryRow: {
301
+ props: internal("AdwPreferencesRowProps"),
302
+ },
303
+ AdwExpanderRow: {
304
+ props: internal("AdwExpanderRowProps"),
305
+ },
306
+ AdwNavigationSplitView: {
307
+ acceptedChildTypes: ["AdwNavigationPage"],
308
+ props: internal("ChildrenProps"),
309
+ component: internal("createNavigationSplitViewComponent"),
310
+ omittedProps: ["content"],
311
+ },
312
+ AdwWrapBox: {
313
+ props: internal("ChildrenProps"),
314
+ },
315
+ AdwCarousel: {
316
+ props: internal("ChildrenProps"),
317
+ },
318
+ AdwPreferencesPage: {
319
+ acceptedChildTypes: ["AdwPreferencesGroup"],
320
+ props: internal("ChildrenProps"),
321
+ },
322
+ AdwPreferencesDialog: {
323
+ acceptedChildTypes: ["AdwPreferencesPage"],
324
+ props: internal("ChildrenProps"),
325
+ },
326
+ AdwPreferencesGroup: {
327
+ props: internal("ChildrenProps"),
328
+ },
329
+ AdwTabView: {
330
+ props: internal("ChildrenProps"),
331
+ },
332
+ AdwNavigationView: {
333
+ acceptedChildTypes: ["AdwNavigationPage"],
334
+ props: internal("ChildrenProps"),
335
+ },
336
+ AdwViewStack: {
337
+ props: internal("ChildrenProps"),
338
+ component: internal("createViewStackComponent"),
339
+ },
340
+ AdwToolbarView: {
341
+ props: internal("AdwToolbarViewProps"),
342
+ omittedProps: ["content"],
343
+ },
344
+ AdwHeaderBar: {
345
+ props: internal("GtkHeaderBarProps"),
346
+ },
347
+ AdwShortcutsDialog: {
348
+ acceptedChildTypes: ["AdwShortcutsSection"],
349
+ props: internal("ChildrenProps"),
350
+ },
351
+ AdwShortcutsSection: {
352
+ acceptedChildTypes: ["AdwShortcutsItem"],
353
+ props: internal("ChildrenProps"),
354
+ },
355
+ AdwToggleGroup: {
356
+ props: { ...internal("AdwToggleGroupProps"), composition: "intersection" },
357
+ acceptedChildTypes: ["AdwToggle"],
358
+ component: internal("createToggleGroupComponent"),
359
+ },
360
+ AdwAlertDialog: {
361
+ props: internal("AdwAlertDialogProps"),
362
+ omittedProps: ["extraChild"],
363
+ },
364
+ };
365
+ export { SINGLE_CHILD_TYPES, CONTENT_SETTER_TYPES, MENU_ITEM_ATTRIBUTES, BUILTIN_ELEMENTS };
366
+ //# sourceMappingURL=builtin-elements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtin-elements.js","sourceRoot":"","sources":["../src/builtin-elements.ts"],"names":[],"mappings":"AAEA,MAAM,QAAQ,GAAG,CAAC,KAAe,EAAE,MAA4B,EAAwC,EAAE,CACrG,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;AAE5D,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAgB,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AAEpG,MAAM,kBAAkB,GAAa;IACjC,QAAQ;IACR,UAAU;IACV,mBAAmB;IACnB,gBAAgB;IAChB,eAAe;IACf,gBAAgB;IAChB,iBAAiB;IACjB,WAAW;IACX,gBAAgB;IAChB,WAAW;IACX,gBAAgB;IAChB,aAAa;IACb,aAAa;IACb,iBAAiB;IACjB,UAAU;IACV,oBAAoB;IACpB,eAAe;IACf,eAAe;IACf,aAAa;IACb,eAAe;IACf,YAAY;IACZ,eAAe;IACf,aAAa;IACb,mBAAmB;IACnB,cAAc;IACd,iBAAiB;IACjB,aAAa;IACb,iBAAiB;CACpB,CAAC;AAEF,MAAM,oBAAoB,GAAa,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAAC;AAEjF,MAAM,mBAAmB,GAAyB,EAAE,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC,EAAE,YAAY,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;AAChH,MAAM,qBAAqB,GAAyB,EAAE,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC,EAAE,YAAY,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC;AAEpH,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kB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,CAAC","sourcesContent":["import type { ElementConfigOptions, 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\nconst SINGLE_CHILD_CONFIG: ElementConfigOptions = { props: internal(\"ChildrenProps\"), omittedProps: [\"child\"] };\nconst CONTENT_SETTER_CONFIG: ElementConfigOptions = { props: internal(\"ChildrenProps\"), omittedProps: [\"content\"] };\n\n/** `GMenuItem` props written as the GtkBuilder menu attribute of the same name, keyed by prop. */\nconst MENU_ITEM_ATTRIBUTES = {\n custom: \"custom\",\n hiddenWhen: \"hidden-when\",\n accel: \"accel\",\n icon: \"icon\",\n verbIcon: \"verb-icon\",\n useMarkup: \"use-markup\",\n submenuAction: \"submenu-action\",\n displayHint: \"display-hint\",\n textDirection: \"text-direction\",\n} as const satisfies Record<string, string>;\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, SINGLE_CHILD_CONFIG),\n GtkSearchBar: {\n ...SINGLE_CHILD_CONFIG,\n component: internal(\"createSearchBarComponent\"),\n },\n ...forTypes([\"GtkHeaderBar\", \"GtkActionBar\"], {\n props: internal(\"GtkHeaderBarProps\"),\n }),\n GtkMenuButton: {\n props: internal(\"GtkMenuButtonProps\"),\n component: internal(\"createCustomChildrenComponent\"),\n omittedProps: [\"child\"],\n },\n GtkPopoverMenu: {\n props: internal(\"CustomChildrenProps\"),\n component: internal(\"createCustomChildrenComponent\"),\n },\n GtkPopoverMenuBar: {\n props: internal(\"CustomChildrenProps\"),\n component: internal(\"createCustomChildrenComponent\"),\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: {\n ...internal(\"MenuItemProps\"),\n constructOnly: [\"label\", \"action\", ...Object.keys(MENU_ITEM_ATTRIBUTES)],\n },\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 AdwBottomSheet: {\n ...CONTENT_SETTER_CONFIG,\n component: internal(\"createBottomSheetComponent\"),\n },\n AdwOverlaySplitView: {\n ...CONTENT_SETTER_CONFIG,\n component: internal(\"createOverlaySplitViewComponent\"),\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 component: internal(\"createTabOverviewComponent\"),\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 component: internal(\"createNavigationSplitViewComponent\"),\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, MENU_ITEM_ATTRIBUTES, 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":"A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AAG,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,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAKzC,MAAM,cAAc,GAAoC,IAAI,iBAAiB,EAAE,CAA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I,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,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,s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,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"}