react-native-gtkx 0.3.0-alpha.1 → 0.4.0-alpha.3

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 (169) hide show
  1. package/README.md +35 -96
  2. package/dist/adw/index.d.ts +3 -2
  3. package/dist/adw/index.js +24 -6
  4. package/dist/adw/index.js.map +1 -1
  5. package/dist/adw/widgets.generated.d.ts +1 -1
  6. package/dist/adw/widgets.generated.js +2 -2
  7. package/dist/adw/widgets.generated.js.map +1 -1
  8. package/dist/animated/create-animated.d.ts +2 -0
  9. package/dist/animated/create-animated.js +2 -0
  10. package/dist/animated/create-animated.js.map +1 -1
  11. package/dist/animated/event.d.ts +15 -0
  12. package/dist/animated/event.js +80 -0
  13. package/dist/animated/event.js.map +1 -0
  14. package/dist/animated/index.d.ts +4 -0
  15. package/dist/animated/index.js +8 -0
  16. package/dist/animated/index.js.map +1 -1
  17. package/dist/animated/spring.d.ts +10 -0
  18. package/dist/animated/spring.js +20 -6
  19. package/dist/animated/spring.js.map +1 -1
  20. package/dist/animated/timing.d.ts +10 -0
  21. package/dist/animated/timing.js +21 -13
  22. package/dist/animated/timing.js.map +1 -1
  23. package/dist/apis/host.gtkx.js +70 -11
  24. package/dist/apis/host.gtkx.js.map +1 -1
  25. package/dist/common/navigation-stack.d.ts +6 -3
  26. package/dist/common/navigation-stack.js +8 -1
  27. package/dist/common/navigation-stack.js.map +1 -1
  28. package/dist/common/widget.js +2 -11
  29. package/dist/common/widget.js.map +1 -1
  30. package/dist/components/animated.d.ts +1 -0
  31. package/dist/components/animated.js +28 -4
  32. package/dist/components/animated.js.map +1 -1
  33. package/dist/components/app-registry.js +32 -8
  34. package/dist/components/app-registry.js.map +1 -1
  35. package/dist/components/request-animation-frame.d.ts +33 -0
  36. package/dist/components/request-animation-frame.js +83 -0
  37. package/dist/components/request-animation-frame.js.map +1 -0
  38. package/dist/components/scroll-view.js +60 -2
  39. package/dist/components/scroll-view.js.map +1 -1
  40. package/dist/components/virtualized-list.js +1 -4
  41. package/dist/components/virtualized-list.js.map +1 -1
  42. package/dist/dnd/autoscroll.d.ts +44 -0
  43. package/dist/dnd/autoscroll.js +176 -0
  44. package/dist/dnd/autoscroll.js.map +1 -0
  45. package/dist/dnd/grid-order.d.ts +45 -0
  46. package/dist/dnd/grid-order.js +151 -0
  47. package/dist/dnd/grid-order.js.map +1 -0
  48. package/dist/dnd/grid.d.ts +44 -0
  49. package/dist/dnd/grid.js +397 -0
  50. package/dist/dnd/grid.js.map +1 -0
  51. package/dist/dnd/gtk-controllers.d.ts +16 -2
  52. package/dist/dnd/gtk-controllers.js +24 -4
  53. package/dist/dnd/gtk-controllers.js.map +1 -1
  54. package/dist/dnd/index.d.ts +4 -2
  55. package/dist/dnd/index.js +9 -2
  56. package/dist/dnd/index.js.map +1 -1
  57. package/dist/dnd/order-state.d.ts +14 -0
  58. package/dist/dnd/order-state.js +55 -0
  59. package/dist/dnd/order-state.js.map +1 -0
  60. package/dist/dnd/order.d.ts +19 -0
  61. package/dist/dnd/order.js +19 -0
  62. package/dist/dnd/order.js.map +1 -1
  63. package/dist/dnd/sortable.d.ts +29 -4
  64. package/dist/dnd/sortable.js +308 -115
  65. package/dist/dnd/sortable.js.map +1 -1
  66. package/dist/dnd/types.d.ts +236 -14
  67. package/dist/dnd/types.js +30 -0
  68. package/dist/dnd/types.js.map +1 -1
  69. package/dist/gesture-handler-compat/attach-context.d.ts +29 -0
  70. package/dist/gesture-handler-compat/attach-context.js +90 -0
  71. package/dist/gesture-handler-compat/attach-context.js.map +1 -0
  72. package/dist/gesture-handler-compat/detector-runtime.d.ts +14 -3
  73. package/dist/gesture-handler-compat/detector-runtime.js +15 -5
  74. package/dist/gesture-handler-compat/detector-runtime.js.map +1 -1
  75. package/dist/gesture-handler-compat/detector.js +57 -2
  76. package/dist/gesture-handler-compat/detector.js.map +1 -1
  77. package/dist/gesture-handler-compat/gesture-state-manager.d.ts +5 -0
  78. package/dist/gesture-handler-compat/gesture-state-manager.js +77 -0
  79. package/dist/gesture-handler-compat/gesture-state-manager.js.map +1 -0
  80. package/dist/gesture-handler-compat/index.d.ts +2 -2
  81. package/dist/gesture-handler-compat/index.js +38 -33
  82. package/dist/gesture-handler-compat/index.js.map +1 -1
  83. package/dist/gesture-handler-compat/recognizer.d.ts +12 -1
  84. package/dist/gesture-handler-compat/recognizer.js +23 -9
  85. package/dist/gesture-handler-compat/recognizer.js.map +1 -1
  86. package/dist/gesture-handler-compat/tag-registry.d.ts +14 -0
  87. package/dist/gesture-handler-compat/tag-registry.js +19 -0
  88. package/dist/gesture-handler-compat/tag-registry.js.map +1 -0
  89. package/dist/globals/index.d.ts +47 -0
  90. package/dist/globals/index.js +181 -0
  91. package/dist/globals/index.js.map +1 -0
  92. package/dist/globals/install.d.ts +1 -0
  93. package/dist/globals/install.js +14 -0
  94. package/dist/globals/install.js.map +1 -0
  95. package/dist/gtk/index.js +4 -3
  96. package/dist/gtk/index.js.map +1 -1
  97. package/dist/gtkx/bridge/adw-namespace.d.ts +2 -0
  98. package/dist/gtkx/bridge/adw-namespace.js +26 -0
  99. package/dist/gtkx/bridge/adw-namespace.js.map +1 -0
  100. package/dist/gtkx/bridge/adw.d.ts +23 -0
  101. package/dist/gtkx/bridge/adw.js +93 -0
  102. package/dist/gtkx/bridge/adw.js.map +1 -0
  103. package/dist/gtkx/bridge/color-scheme-parse.d.ts +11 -0
  104. package/dist/gtkx/bridge/color-scheme-parse.js +42 -0
  105. package/dist/gtkx/bridge/color-scheme-parse.js.map +1 -0
  106. package/dist/gtkx/bridge/color-scheme-portal.d.ts +24 -0
  107. package/dist/gtkx/bridge/color-scheme-portal.js +172 -0
  108. package/dist/gtkx/bridge/color-scheme-portal.js.map +1 -0
  109. package/dist/gtkx/bridge/core.d.ts +25 -0
  110. package/dist/gtkx/bridge/core.js +69 -0
  111. package/dist/gtkx/bridge/core.js.map +1 -0
  112. package/dist/gtkx/bridge/drag-layer.d.ts +27 -0
  113. package/dist/gtkx/bridge/drag-layer.js +177 -0
  114. package/dist/gtkx/bridge/drag-layer.js.map +1 -0
  115. package/dist/gtkx/bridge/index.d.ts +1 -27
  116. package/dist/gtkx/bridge/index.js +12 -71
  117. package/dist/gtkx/bridge/index.js.map +1 -1
  118. package/dist/gtkx/bridge/view-box.js +1 -1
  119. package/dist/gtkx/bridge/view-box.js.map +1 -1
  120. package/dist/gtkx/bridge/widgets.generated.adw.d.ts +1 -0
  121. package/dist/gtkx/bridge/widgets.generated.adw.js +16 -0
  122. package/dist/gtkx/bridge/widgets.generated.adw.js.map +1 -0
  123. package/dist/gtkx/bridge/widgets.generated.d.ts +0 -1
  124. package/dist/gtkx/bridge/widgets.generated.js +3 -3
  125. package/dist/gtkx/bridge/widgets.generated.js.map +1 -1
  126. package/dist/index.js +20 -0
  127. package/dist/index.js.map +1 -1
  128. package/dist/mcp/bin.js +1 -1
  129. package/dist/mcp/bin.js.map +1 -1
  130. package/dist/mcp/data/generated.d.ts +815 -481
  131. package/dist/mcp/data/generated.js +933 -513
  132. package/dist/mcp/data/generated.js.map +1 -1
  133. package/dist/mcp/resolve.d.ts +2 -2
  134. package/dist/mcp/resolve.js +2 -2
  135. package/dist/mcp/resolve.js.map +1 -1
  136. package/dist/mcp/server.js +2 -2
  137. package/dist/mcp/server.js.map +1 -1
  138. package/dist/metro/index.d.ts +1 -0
  139. package/dist/metro/index.js +12 -0
  140. package/dist/metro/index.js.map +1 -1
  141. package/dist/navigation/sidebar.js +2 -45
  142. package/dist/navigation/sidebar.js.map +1 -1
  143. package/dist/reanimated-compat/animatable-value.d.ts +158 -0
  144. package/dist/reanimated-compat/animatable-value.js +316 -0
  145. package/dist/reanimated-compat/animatable-value.js.map +1 -0
  146. package/dist/reanimated-compat/animation.d.ts +34 -13
  147. package/dist/reanimated-compat/animation.js +97 -25
  148. package/dist/reanimated-compat/animation.js.map +1 -1
  149. package/dist/reanimated-compat/mutable.js +6 -6
  150. package/dist/reanimated-compat/mutable.js.map +1 -1
  151. package/dist/reanimated-compat/updater-animations.js +32 -12
  152. package/dist/reanimated-compat/updater-animations.js.map +1 -1
  153. package/dist/runner/host-dev.js +5 -1
  154. package/dist/runner/host-dev.js.map +1 -1
  155. package/dist/runner/host.js +9 -1
  156. package/dist/runner/host.js.map +1 -1
  157. package/dist/sea/bundle.js +1 -1
  158. package/dist/sea/bundle.js.map +1 -1
  159. package/dist/sea/native-shim.js +3 -2
  160. package/dist/sea/native-shim.js.map +1 -1
  161. package/dist/vite/index.js +130 -0
  162. package/dist/vite/index.js.map +1 -1
  163. package/dist/vitest/index.d.ts +1 -1
  164. package/dist/vitest/index.js +1 -1
  165. package/dist/vitest/index.js.map +1 -1
  166. package/package.json +1 -1
  167. package/dist/gtkx/bridge/theme.d.ts +0 -4
  168. package/dist/gtkx/bridge/theme.js +0 -5
  169. package/dist/gtkx/bridge/theme.js.map +0 -1
@@ -9,6 +9,7 @@
9
9
  // — the pure resolution helpers live here rather than in a sibling module,
10
10
  // and the one import that does cross a file boundary spells out its `.js`.
11
11
  import { existsSync } from "node:fs";
12
+ import { createRequire } from "node:module";
12
13
  import { dirname, extname, isAbsolute, resolve } from "node:path";
13
14
  import { applyAliases, compileAliases, DEFAULT_ALIAS_TABLE, } from "../aliases/index.js";
14
15
  // Re-exported so an app configuring `aliases` never has to reach past the
@@ -98,6 +99,92 @@ export const resolvePlatformSpecifier = (source, importer, exists, options = {})
98
99
  }
99
100
  return null;
100
101
  };
102
+ // The bridge's Adw probe (gtkx/bridge/adw.ts) needs to know, AT BUILD TIME,
103
+ // whether this app's codegen store actually generated Adwaita bindings —
104
+ // see the epic's own regression notes (.claude/epics/adw-optional/006). A
105
+ // runtime-only check (a bare specifier assembled from string parts, so
106
+ // Rollup's build-time graph walk never reaches it) is invisible to the
107
+ // STATIC machinery every other gtkx import gets for free: `resolve.dedupe`
108
+ // (RC4-WORKAROUND(runtime-dedupe) above) and `gtkx build`'s own asset
109
+ // pipeline for the native addon (`@gtkx/cli`'s `gtkx:native` plugin, which
110
+ // rewrites every STATICALLY reachable `@gtkx/native` import onto the single
111
+ // `dist/gtkx.node` it emits) both only ever see specifiers Rollup's graph
112
+ // walk actually visits. A second, independently-resolved copy of the native
113
+ // addon double-initializes the gtkx runtime and aborts the process
114
+ // (`g_log_set_writer_func() called multiple times`) — the exact failure
115
+ // `runtime-dedupe` exists for, reached through a path dedupe cannot see.
116
+ //
117
+ // The fix: make the specifier a literal wherever Adw genuinely exists, so
118
+ // it gets the SAME static treatment as every other gtkx import — and prune
119
+ // it entirely wherever it does not, so `gtkx:undeclared-library` never
120
+ // throws on the plain-GTK profile. `__GTKX_ADW_AVAILABLE__` is that lever:
121
+ // a `define`d boolean CONSTANT (like `__DEV__` above), true only when this
122
+ // app's OWN codegen store actually has an "adw" entry. The bridge guards
123
+ // its probe on it; when the guard folds to a literal `false`, esbuild's
124
+ // dead-code elimination removes the whole probe body — literal specifiers
125
+ // and all — before Rollup's build ever walks the module graph, so the
126
+ // undeclared-library plugin never sees them either.
127
+ //
128
+ // require.resolve, not a static/dynamic import: this file is a vite CONFIG
129
+ // module (not part of the app's own bundle), so nothing here is subject to
130
+ // the eslint bridge fence or Rollup's build-time graph at all — it is a
131
+ // plain Node path lookup, run once while vite starts, mirroring exactly
132
+ // what `gtkx:undeclared-library`'s own resolveId does with `this.resolve`.
133
+ const hasAdwStore = (root) => {
134
+ try {
135
+ createRequire(resolve(root, "package.json")).resolve(["@gtkx", "gi", "adw"].join("/"));
136
+ return true;
137
+ }
138
+ catch {
139
+ return false;
140
+ }
141
+ };
142
+ // The two raw specifiers every Adw-dependent file in the bridge imports as a
143
+ // LITERAL (gtkx/bridge/adw.ts's own probe, gtkx/bridge/adw-namespace.ts,
144
+ // gtkx/bridge/widgets.generated.adw.ts) — needed as literals so `gtkx
145
+ // build`'s real Rollup graph gives them the same static treatment as every
146
+ // other gtkx import (see the doc above and .claude/epics/adw-optional/006.md).
147
+ // That literal-ness has a cost `gtkx build` never pays but `gtkx dev` and
148
+ // vitest do: both run every file through Vite's SSR module runner, which
149
+ // resolves every import() call it can find in a file's text — including one
150
+ // inside a dead `if (__GTKX_ADW_AVAILABLE__ === false)` branch — as part of
151
+ // loading that FILE, before any of the file's own code (the runtime guard,
152
+ // the try/catch around it) ever executes. `esbuild`'s dead-code elimination
153
+ // is what makes the literal safe for `gtkx build`, and it is a real BUNDLE
154
+ // optimization, not something the dev server or vitest's request-based
155
+ // transform ever performs — so on a store with no "Adw-1" declared, every
156
+ // one of those three files failed to even LOAD (a raw "'./adw' is not
157
+ // exported" resolver error out of Vite's own builtin:vite-resolve, not any
158
+ // message this package writes), which took the ENTIRE package down with it:
159
+ // gtkx/bridge/adw.ts is an ordinary dependency of apis/host.gtkx.ts,
160
+ // components/app-registry.tsx and common/navigation-stack.tsx, so nothing
161
+ // that reaches any of those — which is most of the surface — could load
162
+ // either. Found writing .claude/epics/adw-optional/005.md's own guard
163
+ // tests: spike/plain-gtk's PRE-EXISTING alert/appearance GTK tests (003.md,
164
+ // 004.md) failed the exact same way.
165
+ //
166
+ // Fixed the same way `gtkx:undeclared-library` itself is a resolveId hook,
167
+ // not a source change: intercept these two specifiers HERE, before Vite's
168
+ // own resolver (or gtkx's) ever sees them, whenever this app's store
169
+ // genuinely lacks Adw — resolving them to a tiny virtual module that THROWS
170
+ // ONLY WHEN ACTUALLY EVALUATED (i.e. lazily, exactly when something really
171
+ // awaits the dynamic import, or — for the two eager importers above — when
172
+ // something actually loads react-native-gtkx/adw). That is late enough for
173
+ // gtkx/bridge/adw.ts's own `try { ... } catch { return null }` to catch it
174
+ // as a genuine rejected promise, same as it always could for a specifier
175
+ // Node's own loader could not find; for the two EAGER importers, it turns
176
+ // what used to be a generic third-party resolver error into this package's
177
+ // own named, actionable throw (the ONE message text below, since neither
178
+ // eager importer has a call-site "feature" name available to it the way
179
+ // requireAdwGi/requireAdwJsx's callers do — see gtkx/bridge/adw.ts). When
180
+ // the store DOES have Adw, `hasAdwStore` is true and this hook falls
181
+ // through to real resolution, unchanged: `gtkx build`'s dedupe and native-
182
+ // asset rewrite still see a real, literal specifier.
183
+ const ADW_ONLY_SPECIFIERS = new Set(["@gtkx/gi/adw", "@gtkx/jsx/adw"]);
184
+ const ADW_UNAVAILABLE_PREFIX = "\0gtkx-adw-unavailable:";
185
+ const adwUnavailableMessage = (specifier) => `[react-native-gtkx] "${specifier}" requires "Adw-1" in this app's ` +
186
+ "gtkx.config.ts `libraries` — see docs/api.md (the plain-GTK profile) " +
187
+ "for what needs Adw unconditionally and what falls back without it.";
101
188
  /**
102
189
  * Vite plugin: aliases `react-native` (and subpaths) to `react-native-gtkx`
103
190
  * and resolves Metro-style platform extensions
@@ -126,6 +213,11 @@ export const reactNativeGtkx = (options = {}) => {
126
213
  // `gtkx build` in production, which is exactly the distinction RN draws.
127
214
  define: {
128
215
  __DEV__: JSON.stringify(env.mode !== "production"),
216
+ // See hasAdwStore's doc above — process.cwd(), not _config.root:
217
+ // `gtkx dev`/`gtkx build` always run from the app's own directory
218
+ // (root defaults there too), and this must be resolvable before the
219
+ // rest of the merged config is settled.
220
+ __GTKX_ADW_AVAILABLE__: JSON.stringify(hasAdwStore(process.cwd())),
129
221
  },
130
222
  ssr: {
131
223
  // `gtkx dev` runs vite with ssr.external: true, which would hand
@@ -200,8 +292,39 @@ export const reactNativeGtkx = (options = {}) => {
200
292
  "react",
201
293
  ],
202
294
  },
295
+ build: {
296
+ rolldownOptions: {
297
+ output: {
298
+ // A literal, code-split dynamic import (the Adw seam,
299
+ // gtkx/bridge/adw.ts — see its own doc and 006 above) lands its
300
+ // chunk under the Rolldown default `assets/[name]-[hash].js`
301
+ // UNLESS told otherwise. `@gtkx/cli`'s own `gtkx:native` plugin
302
+ // rewrites every reachable `@gtkx/native` import into
303
+ // `require("./gtkx.node")` — a path RELATIVE TO WHATEVER FILE
304
+ // THE REWRITE LANDS IN, correct only when that file sits next to
305
+ // the emitted `dist/gtkx.node` asset. The entry chunk is pinned
306
+ // there already (`entryFileNames: "bundle.js"`, set by
307
+ // `@gtkx/cli`'s own builder); a chunk placed one level down in
308
+ // `assets/` breaks the SAME relative path
309
+ // ("Cannot find module './gtkx.node'" — reproduced building
310
+ // examples/gallery with the Adw seam's dynamic import made
311
+ // literal). Keeping every chunk in `dist/` alongside the entry
312
+ // and the addon sidesteps the mismatch instead of guessing at
313
+ // gtkx's own relative-path assumption.
314
+ chunkFileNames: "[name]-[hash].js",
315
+ },
316
+ },
317
+ },
203
318
  }),
204
319
  async resolveId(source, importer) {
320
+ // See ADW_ONLY_SPECIFIERS' own doc above: on a store with no "Adw-1",
321
+ // resolving either of these for real fails the whole file that
322
+ // imports them, before that file's own code (a runtime guard, a
323
+ // try/catch) ever runs. Checked first, ahead of the alias table below
324
+ // (neither specifier is in it).
325
+ if (ADW_ONLY_SPECIFIERS.has(source) && !hasAdwStore(process.cwd())) {
326
+ return ADW_UNAVAILABLE_PREFIX + source;
327
+ }
205
328
  // The app's table, not the default one: a package dropped with `false`
206
329
  // falls through to vite's own resolution and the real package loads.
207
330
  const aliased = applyAliases(aliases, source);
@@ -213,6 +336,13 @@ export const reactNativeGtkx = (options = {}) => {
213
336
  }
214
337
  return resolvePlatformSpecifier(source, importer, existsSync, options);
215
338
  },
339
+ load(id) {
340
+ if (!id.startsWith(ADW_UNAVAILABLE_PREFIX)) {
341
+ return null;
342
+ }
343
+ const specifier = id.slice(ADW_UNAVAILABLE_PREFIX.length);
344
+ return `throw new Error(${JSON.stringify(adwUnavailableMessage(specifier))})`;
345
+ },
216
346
  };
217
347
  };
218
348
  export default reactNativeGtkx;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/vite/index.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,4EAA4E;AAC5E,0EAA0E;AAC1E,2EAA2E;AAC3E,4BAA4B;AAC5B,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,2EAA2E;AAC3E,2EAA2E;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,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MAAM,EAAE;oBACN,WAAW;oBACX,UAAU;oBACV,WAAW;oBACX,cAAc;oBACd,aAAa;oBACb,eAAe;oBACf,gEAAgE;oBAChE,kDAAkD;oBAClD,wBAAwB;oBACxB,0BAA0B;oBAC1B,OAAO;iBACR;aACF;SACF,CAAC;QAEF,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ;YAC9B,uEAAuE;YACvE,qEAAqE;YACrE,MAAM,OAAO,GAAG,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;YAC7C,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;gBACrB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE;oBACrD,QAAQ,EAAE,IAAI;iBACf,CAAC,CAAA;gBACF,OAAO,QAAQ,IAAI,OAAO,CAAA;YAC5B,CAAC;YACD,OAAO,wBAAwB,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;QACxE,CAAC;KACF,CAAA;AACH,CAAC,CAAA;AAED,eAAe,eAAe,CAAA","sourcesContent":["// react-native-gtkx/vite — makes a gtkx project React Native compatible.\n// The gtkx CLI (dev and build) starts vite with an inline config that never\n// sets `configFile: false`, so vite picks up the project's vite.config.ts\n// from the root and merges it beneath the CLI config; this preset plugs in\n// there as a single plugin.\n//\n// vite loads the config's imported packages with BARE Node, so this subpath\n// (like ./metro and ./runner) must not contain EXTENSIONLESS relative imports\n// — the pure resolution helpers live here rather than in a sibling module,\n// and the one import that does cross a file boundary spells out its `.js`.\nimport { existsSync } from \"node:fs\"\nimport { dirname, extname, isAbsolute, resolve } from \"node:path\"\nimport type { Plugin } from \"vite\"\nimport {\n applyAliases,\n compileAliases,\n DEFAULT_ALIAS_TABLE,\n type AliasOverrides,\n} from \"../aliases/index.js\"\n\n// Re-exported so an app configuring `aliases` never has to reach past the\n// preset subpath it already imports.\nexport {\n CONFIGURABLE_ALIASES,\n DEFAULT_ALIASES,\n PLATFORM_ALIAS,\n} from \"../aliases/index.js\"\nexport type {\n AliasOverride,\n AliasOverrides,\n AliasPattern,\n AliasTable,\n CompiledAlias,\n} from \"../aliases/index.js\"\n\n// --- pure resolution logic (unit-tested directly) -----------------------\n\n/** Options shared by the preset factory and the pure resolver helpers. */\nexport type PlatformResolutionOptions = {\n /** Platform suffix priority, most specific first. Default: [\"linux\", \"native\"]. */\n platforms?: readonly string[]\n /** Source extensions tried for every platform suffix. Default: [\"tsx\", \"ts\", \"jsx\", \"js\"]. */\n extensions?: readonly string[]\n}\n\n/** Predicate the plugin injects as fs.existsSync; tests inject fakes. */\nexport type FileExists = (filePath: string) => boolean\n\nexport const DEFAULT_PLATFORMS: readonly string[] = [\"linux\", \"native\"]\nexport const DEFAULT_EXTENSIONS: readonly string[] = [\"tsx\", \"ts\", \"jsx\", \"js\"]\n\nconst REACT_NATIVE_GTKX = \"react-native-gtkx\"\n\n/**\n * Applies the DEFAULT alias table (../aliases/index.ts) to one specifier:\n * `react-native` and its subpaths onto `react-native-gtkx`, and the five\n * package substitutions onto their compat subpaths. Returns null for every\n * other specifier, including `react-native-gtkx` itself.\n *\n * Exported for tests and for apps driving vite by hand. The plugin does NOT\n * call it — the plugin resolves through the table its own `aliases` option\n * produced, so an app's deltas apply.\n */\nexport const rewriteReactNativeImport = (source: string): string | null =>\n applyAliases(DEFAULT_ALIAS_TABLE, source)\n\n/** Splits a vite specifier into its path part and its `?query` suffix. */\nexport const splitQuery = (\n source: string,\n): { specifier: string; query: string } => {\n const index = source.indexOf(\"?\")\n if (index === -1) {\n return { specifier: source, query: \"\" }\n }\n return { specifier: source.slice(0, index), query: source.slice(index) }\n}\n\nconst isRelative = (specifier: string): boolean =>\n specifier.startsWith(\"./\") || specifier.startsWith(\"../\")\n\n/**\n * Ordered platform suffixes, platform-major: every extension of the first\n * platform is tried before any extension of the next one\n * (`.linux.tsx`, `.linux.ts`, …, `.native.tsx`, …).\n */\nexport const platformSuffixes = (\n options: PlatformResolutionOptions = {},\n): string[] => {\n const platforms = options.platforms ?? DEFAULT_PLATFORMS\n const extensions = options.extensions ?? DEFAULT_EXTENSIONS\n return platforms.flatMap((platform) =>\n extensions.map((extension) => `.${platform}.${extension}`),\n )\n}\n\n/**\n * Candidate file paths for an extensionless base path, in priority order:\n * direct platform files first, then platform index files of a directory —\n * mirroring Metro, which exhausts file resolution before directory resolution.\n * The base file itself is not a candidate: when no platform file exists the\n * plugin bails out and the default resolver picks the base module.\n */\nexport const platformCandidates = (\n base: string,\n options: PlatformResolutionOptions = {},\n): string[] => {\n const suffixes = platformSuffixes(options)\n return [\n ...suffixes.map((suffix) => `${base}${suffix}`),\n ...suffixes.map((suffix) => `${base}/index${suffix}`),\n ]\n}\n\n// Source extensions Metro strips before trying platform variants: an\n// import of \"./useLinking.js\" (the TS-ESM style react-navigation and most\n// compiled RN libraries use) must still find useLinking.native.tsx /\n// useLinking.native.js — Metro resolves the BASE name platform-first, the\n// literal file is only the fallback.\nconst STRIPPABLE_EXTENSIONS = new Set([\".js\", \".jsx\", \".mjs\", \".ts\", \".tsx\"])\n\n/**\n * Metro platform-extension resolution for a single import: relative (or\n * absolute) specifiers that are extensionless — or carry a strippable\n * source extension — try platform candidates first; the first existing\n * candidate wins; the `?query` suffix is carried over. Returns null when\n * the import is out of scope or no platform file exists, handing the\n * import back to the default resolver.\n */\nexport const resolvePlatformSpecifier = (\n source: string,\n importer: string | undefined,\n exists: FileExists,\n options: PlatformResolutionOptions = {},\n): string | null => {\n if (importer === undefined || source.startsWith(\"\\0\")) {\n return null\n }\n const { specifier, query } = splitQuery(source)\n if (!isRelative(specifier) && !isAbsolute(specifier)) {\n return null\n }\n const extension = extname(specifier)\n if (extension !== \"\" && !STRIPPABLE_EXTENSIONS.has(extension)) {\n return null\n }\n const withExtension = isAbsolute(specifier)\n ? specifier\n : resolve(dirname(splitQuery(importer).specifier), specifier)\n const base =\n extension === \"\" ? withExtension : withExtension.slice(0, -extension.length)\n for (const candidate of platformCandidates(base, options)) {\n if (exists(candidate)) {\n return candidate + query\n }\n }\n return null\n}\n\n// --- the vite plugin ----------------------------------------------------\n\nexport type ReactNativeGtkxOptions = PlatformResolutionOptions & {\n /**\n * Deltas over the preset's package aliases, keyed by package name — a\n * string target, a `{ pattern, replace }` rule, or `false` to drop one of\n * ours so the real package loads. Identical semantics to the Metro\n * preset's option of the same name: both compile the same table.\n * Invalid entries throw here, while the config is being read.\n */\n aliases?: AliasOverrides\n}\n\n/**\n * Vite plugin: aliases `react-native` (and subpaths) to `react-native-gtkx`\n * and resolves Metro-style platform extensions\n * (`.linux.tsx` → `.native.tsx` → base) for extensionless imports.\n */\nexport const reactNativeGtkx = (\n options: ReactNativeGtkxOptions = {},\n): Plugin => {\n // Throws on an unknown key, an overlapping pattern or an attempt to remove\n // the platform alias — at config load, naming what is valid.\n const aliases = compileAliases(options.aliases)\n return {\n name: \"react-native-gtkx:preset\",\n // Before vite's own resolver and the gtkx CLI plugins: the alias must win\n // over node resolution and platform files must win over the base file.\n enforce: \"pre\",\n\n config: (_config, env) => ({\n // `__DEV__` is part of the react-native runtime contract, not a Metro\n // detail: RN's own modules branch on it and so does every library\n // written against them (`@gorhom/bottom-sheet`'s logger and four of its\n // components read it at module scope). The Metro path gets it from the\n // app's stock RN preset; nothing supplied it on the vite path, so a\n // library that reads it crashed the bundle at startup with\n // \"ReferenceError: __DEV__ is not defined\" — found by building\n // spike/core-exports rather than by reading anything.\n //\n // vite's mode is the honest source: `gtkx dev` builds in development,\n // `gtkx build` in production, which is exactly the distinction RN draws.\n define: {\n __DEV__: JSON.stringify(env.mode !== \"production\"),\n },\n ssr: {\n // `gtkx dev` runs vite with ssr.external: true, which would hand\n // react-native-gtkx straight to node. Keep the package inside the\n // vite pipeline; noExternal wins over external: true.\n //\n // \"react-native\" must be listed too: with ssr.external: true vite\n // externalizes a bare import BEFORE the plugin pipeline whenever the\n // package resolves natively — and the real react-native (a Flow\n // codebase Node cannot parse) exists in RN monorepos. noExternal\n // forces the full plugin resolution, where the alias rewrites the\n // import to react-native-gtkx.\n // \"react-native-reanimated\" for the same reason as \"react-native\": an\n // app that also ships iOS/Android keeps the real package installed, it\n // resolves natively, and ssr.external: true would hand Node a codebase\n // built around a Babel plugin and a worklet runtime before the alias\n // ever gets a chance to rewrite the import.\n // \"react-native-worklets\" is the same case one package over — it is\n // where that worklet runtime actually lives since Reanimated 4.\n //\n // The rule those are instances of, stated once so the next alias does\n // not have to rediscover it: EVERY package name in the alias table must\n // be listed here. An alias is a resolveId hook, and a bare specifier\n // that vite externalizes never reaches one — so on the dev path the\n // alias silently loses to whatever is installed under the real name.\n // That is not hypothetical: an app that also ships iOS and Android has\n // all of them in node_modules, which is the case the alias exists to\n // serve. `react-native-gesture-handler` proved it — this list once held\n // three of the six names, its real package loaded, and it failed on an\n // extensionless internal import Node cannot resolve (found by running\n // the gallery's upstream-libraries section, which installs it).\n //\n // So the list is DERIVED rather than written out: it is exactly the\n // table's package names, and a name can no longer go missing from one\n // of the two places it has to appear.\n //\n // `aliases.names` includes the packages an app turned OFF with `false`,\n // deliberately. Dropping an alias means the REAL package loads, and the\n // real package imports `react-native` at module scope — an import that\n // only reaches the platform alias if Node never gets the package first.\n // Un-aliasing a package is therefore a reason to keep it inside the\n // pipeline, not a reason to let it out.\n noExternal: [\n REACT_NATIVE_GTKX,\n ...aliases.names,\n // @react-navigation is not aliased, but must go through the pipeline\n // too: it imports `react-native`, and an externalized copy resolves\n // that to the real Flow package (SyntaxError: Unexpected token\n // 'typeof') instead of our alias. Only bites on the dev path — a\n // production build inlines everything anyway.\n /^@react-navigation\\//,\n ],\n },\n resolve: {\n // RC4-WORKAROUND(runtime-dedupe): see docs/gtkx-rc4-notes.md\n // The gtkx runtime and react are single-instance hosts: when the app\n // and react-native-gtkx resolve them from different node_modules\n // (file:-installed package, nested installs), two bundled copies\n // double-init the runtime and GLib aborts. dedupe pins every copy to\n // the project's own resolution.\n dedupe: [\n \"@gtkx/css\",\n \"@gtkx/gi\",\n \"@gtkx/jsx\",\n \"@gtkx/native\",\n \"@gtkx/react\",\n \"@gtkx/runtime\",\n // react-navigation is context-based: two bundled copies of core\n // fail with \"couldn't find a navigation context\".\n \"@react-navigation/core\",\n \"@react-navigation/native\",\n \"react\",\n ],\n },\n }),\n\n async resolveId(source, importer) {\n // The app's table, not the default one: a package dropped with `false`\n // falls through to vite's own resolution and the real package loads.\n const aliased = applyAliases(aliases, source)\n if (aliased !== null) {\n const resolved = await this.resolve(aliased, importer, {\n skipSelf: true,\n })\n return resolved ?? aliased\n }\n return resolvePlatformSpecifier(source, importer, existsSync, options)\n },\n }\n}\n\nexport default reactNativeGtkx\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/vite/index.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,4EAA4E;AAC5E,0EAA0E;AAC1E,2EAA2E;AAC3E,4BAA4B;AAC5B,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,2EAA2E;AAC3E,2EAA2E;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEjE,OAAO,EACL,YAAY,EACZ,cAAc,EACd,mBAAmB,GAEpB,MAAM,qBAAqB,CAAA;AAE5B,0EAA0E;AAC1E,qCAAqC;AACrC,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,cAAc,GACf,MAAM,qBAAqB,CAAA;AAsB5B,MAAM,CAAC,MAAM,iBAAiB,GAAsB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;AACvE,MAAM,CAAC,MAAM,kBAAkB,GAAsB,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;AAE/E,MAAM,iBAAiB,GAAG,mBAAmB,CAAA;AAE7C;;;;;;;;;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C,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;QACxE,CAAC;QAED,IAAI,CAAC,EAAE;YACL,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,sBAAsB,CAAC,EAAE,CAAC;gBAC3C,OAAO,IAAI,CAAA;YACb,CAAC;YACD,MAAM,SAAS,GAAG,EAAE,CAAC,KAAK,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAA;YACzD,OAAO,mBAAmB,IAAI,CAAC,SAAS,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC,GAAG,CAAA;QAC/E,CAAC;KACF,CAAA;AACH,CAAC,CAAA;AAED,eAAe,eAAe,CAAA","sourcesContent":["// react-native-gtkx/vite — makes a gtkx project React Native compatible.\n// The gtkx CLI (dev and build) starts vite with an inline config that never\n// sets `configFile: false`, so vite picks up the project's vite.config.ts\n// from the root and merges it beneath the CLI config; this preset plugs in\n// there as a single plugin.\n//\n// vite loads the config's imported packages with BARE Node, so this subpath\n// (like ./metro and ./runner) must not contain EXTENSIONLESS relative imports\n// — the pure resolution helpers live here rather than in a sibling module,\n// and the one import that does cross a file boundary spells out its `.js`.\nimport { existsSync } from \"node:fs\"\nimport { createRequire } from \"node:module\"\nimport { dirname, extname, isAbsolute, resolve } from \"node:path\"\nimport type { Plugin } from \"vite\"\nimport {\n applyAliases,\n compileAliases,\n DEFAULT_ALIAS_TABLE,\n type AliasOverrides,\n} from \"../aliases/index.js\"\n\n// Re-exported so an app configuring `aliases` never has to reach past the\n// preset subpath it already imports.\nexport {\n CONFIGURABLE_ALIASES,\n DEFAULT_ALIASES,\n PLATFORM_ALIAS,\n} from \"../aliases/index.js\"\nexport type {\n AliasOverride,\n AliasOverrides,\n AliasPattern,\n AliasTable,\n CompiledAlias,\n} from \"../aliases/index.js\"\n\n// --- pure resolution logic (unit-tested directly) -----------------------\n\n/** Options shared by the preset factory and the pure resolver helpers. */\nexport type PlatformResolutionOptions = {\n /** Platform suffix priority, most specific first. Default: [\"linux\", \"native\"]. */\n platforms?: readonly string[]\n /** Source extensions tried for every platform suffix. Default: [\"tsx\", \"ts\", \"jsx\", \"js\"]. */\n extensions?: readonly string[]\n}\n\n/** Predicate the plugin injects as fs.existsSync; tests inject fakes. */\nexport type FileExists = (filePath: string) => boolean\n\nexport const DEFAULT_PLATFORMS: readonly string[] = [\"linux\", \"native\"]\nexport const DEFAULT_EXTENSIONS: readonly string[] = [\"tsx\", \"ts\", \"jsx\", \"js\"]\n\nconst REACT_NATIVE_GTKX = \"react-native-gtkx\"\n\n/**\n * Applies the DEFAULT alias table (../aliases/index.ts) to one specifier:\n * `react-native` and its subpaths onto `react-native-gtkx`, and the five\n * package substitutions onto their compat subpaths. Returns null for every\n * other specifier, including `react-native-gtkx` itself.\n *\n * Exported for tests and for apps driving vite by hand. The plugin does NOT\n * call it — the plugin resolves through the table its own `aliases` option\n * produced, so an app's deltas apply.\n */\nexport const rewriteReactNativeImport = (source: string): string | null =>\n applyAliases(DEFAULT_ALIAS_TABLE, source)\n\n/** Splits a vite specifier into its path part and its `?query` suffix. */\nexport const splitQuery = (\n source: string,\n): { specifier: string; query: string } => {\n const index = source.indexOf(\"?\")\n if (index === -1) {\n return { specifier: source, query: \"\" }\n }\n return { specifier: source.slice(0, index), query: source.slice(index) }\n}\n\nconst isRelative = (specifier: string): boolean =>\n specifier.startsWith(\"./\") || specifier.startsWith(\"../\")\n\n/**\n * Ordered platform suffixes, platform-major: every extension of the first\n * platform is tried before any extension of the next one\n * (`.linux.tsx`, `.linux.ts`, …, `.native.tsx`, …).\n */\nexport const platformSuffixes = (\n options: PlatformResolutionOptions = {},\n): string[] => {\n const platforms = options.platforms ?? DEFAULT_PLATFORMS\n const extensions = options.extensions ?? DEFAULT_EXTENSIONS\n return platforms.flatMap((platform) =>\n extensions.map((extension) => `.${platform}.${extension}`),\n )\n}\n\n/**\n * Candidate file paths for an extensionless base path, in priority order:\n * direct platform files first, then platform index files of a directory —\n * mirroring Metro, which exhausts file resolution before directory resolution.\n * The base file itself is not a candidate: when no platform file exists the\n * plugin bails out and the default resolver picks the base module.\n */\nexport const platformCandidates = (\n base: string,\n options: PlatformResolutionOptions = {},\n): string[] => {\n const suffixes = platformSuffixes(options)\n return [\n ...suffixes.map((suffix) => `${base}${suffix}`),\n ...suffixes.map((suffix) => `${base}/index${suffix}`),\n ]\n}\n\n// Source extensions Metro strips before trying platform variants: an\n// import of \"./useLinking.js\" (the TS-ESM style react-navigation and most\n// compiled RN libraries use) must still find useLinking.native.tsx /\n// useLinking.native.js — Metro resolves the BASE name platform-first, the\n// literal file is only the fallback.\nconst STRIPPABLE_EXTENSIONS = new Set([\".js\", \".jsx\", \".mjs\", \".ts\", \".tsx\"])\n\n/**\n * Metro platform-extension resolution for a single import: relative (or\n * absolute) specifiers that are extensionless — or carry a strippable\n * source extension — try platform candidates first; the first existing\n * candidate wins; the `?query` suffix is carried over. Returns null when\n * the import is out of scope or no platform file exists, handing the\n * import back to the default resolver.\n */\nexport const resolvePlatformSpecifier = (\n source: string,\n importer: string | undefined,\n exists: FileExists,\n options: PlatformResolutionOptions = {},\n): string | null => {\n if (importer === undefined || source.startsWith(\"\\0\")) {\n return null\n }\n const { specifier, query } = splitQuery(source)\n if (!isRelative(specifier) && !isAbsolute(specifier)) {\n return null\n }\n const extension = extname(specifier)\n if (extension !== \"\" && !STRIPPABLE_EXTENSIONS.has(extension)) {\n return null\n }\n const withExtension = isAbsolute(specifier)\n ? specifier\n : resolve(dirname(splitQuery(importer).specifier), specifier)\n const base =\n extension === \"\" ? withExtension : withExtension.slice(0, -extension.length)\n for (const candidate of platformCandidates(base, options)) {\n if (exists(candidate)) {\n return candidate + query\n }\n }\n return null\n}\n\n// The bridge's Adw probe (gtkx/bridge/adw.ts) needs to know, AT BUILD TIME,\n// whether this app's codegen store actually generated Adwaita bindings —\n// see the epic's own regression notes (.claude/epics/adw-optional/006). A\n// runtime-only check (a bare specifier assembled from string parts, so\n// Rollup's build-time graph walk never reaches it) is invisible to the\n// STATIC machinery every other gtkx import gets for free: `resolve.dedupe`\n// (RC4-WORKAROUND(runtime-dedupe) above) and `gtkx build`'s own asset\n// pipeline for the native addon (`@gtkx/cli`'s `gtkx:native` plugin, which\n// rewrites every STATICALLY reachable `@gtkx/native` import onto the single\n// `dist/gtkx.node` it emits) both only ever see specifiers Rollup's graph\n// walk actually visits. A second, independently-resolved copy of the native\n// addon double-initializes the gtkx runtime and aborts the process\n// (`g_log_set_writer_func() called multiple times`) — the exact failure\n// `runtime-dedupe` exists for, reached through a path dedupe cannot see.\n//\n// The fix: make the specifier a literal wherever Adw genuinely exists, so\n// it gets the SAME static treatment as every other gtkx import — and prune\n// it entirely wherever it does not, so `gtkx:undeclared-library` never\n// throws on the plain-GTK profile. `__GTKX_ADW_AVAILABLE__` is that lever:\n// a `define`d boolean CONSTANT (like `__DEV__` above), true only when this\n// app's OWN codegen store actually has an \"adw\" entry. The bridge guards\n// its probe on it; when the guard folds to a literal `false`, esbuild's\n// dead-code elimination removes the whole probe body — literal specifiers\n// and all — before Rollup's build ever walks the module graph, so the\n// undeclared-library plugin never sees them either.\n//\n// require.resolve, not a static/dynamic import: this file is a vite CONFIG\n// module (not part of the app's own bundle), so nothing here is subject to\n// the eslint bridge fence or Rollup's build-time graph at all — it is a\n// plain Node path lookup, run once while vite starts, mirroring exactly\n// what `gtkx:undeclared-library`'s own resolveId does with `this.resolve`.\nconst hasAdwStore = (root: string): boolean => {\n try {\n createRequire(resolve(root, \"package.json\")).resolve(\n [\"@gtkx\", \"gi\", \"adw\"].join(\"/\"),\n )\n return true\n } catch {\n return false\n }\n}\n\n// The two raw specifiers every Adw-dependent file in the bridge imports as a\n// LITERAL (gtkx/bridge/adw.ts's own probe, gtkx/bridge/adw-namespace.ts,\n// gtkx/bridge/widgets.generated.adw.ts) — needed as literals so `gtkx\n// build`'s real Rollup graph gives them the same static treatment as every\n// other gtkx import (see the doc above and .claude/epics/adw-optional/006.md).\n// That literal-ness has a cost `gtkx build` never pays but `gtkx dev` and\n// vitest do: both run every file through Vite's SSR module runner, which\n// resolves every import() call it can find in a file's text — including one\n// inside a dead `if (__GTKX_ADW_AVAILABLE__ === false)` branch — as part of\n// loading that FILE, before any of the file's own code (the runtime guard,\n// the try/catch around it) ever executes. `esbuild`'s dead-code elimination\n// is what makes the literal safe for `gtkx build`, and it is a real BUNDLE\n// optimization, not something the dev server or vitest's request-based\n// transform ever performs — so on a store with no \"Adw-1\" declared, every\n// one of those three files failed to even LOAD (a raw \"'./adw' is not\n// exported\" resolver error out of Vite's own builtin:vite-resolve, not any\n// message this package writes), which took the ENTIRE package down with it:\n// gtkx/bridge/adw.ts is an ordinary dependency of apis/host.gtkx.ts,\n// components/app-registry.tsx and common/navigation-stack.tsx, so nothing\n// that reaches any of those — which is most of the surface — could load\n// either. Found writing .claude/epics/adw-optional/005.md's own guard\n// tests: spike/plain-gtk's PRE-EXISTING alert/appearance GTK tests (003.md,\n// 004.md) failed the exact same way.\n//\n// Fixed the same way `gtkx:undeclared-library` itself is a resolveId hook,\n// not a source change: intercept these two specifiers HERE, before Vite's\n// own resolver (or gtkx's) ever sees them, whenever this app's store\n// genuinely lacks Adw — resolving them to a tiny virtual module that THROWS\n// ONLY WHEN ACTUALLY EVALUATED (i.e. lazily, exactly when something really\n// awaits the dynamic import, or — for the two eager importers above — when\n// something actually loads react-native-gtkx/adw). That is late enough for\n// gtkx/bridge/adw.ts's own `try { ... } catch { return null }` to catch it\n// as a genuine rejected promise, same as it always could for a specifier\n// Node's own loader could not find; for the two EAGER importers, it turns\n// what used to be a generic third-party resolver error into this package's\n// own named, actionable throw (the ONE message text below, since neither\n// eager importer has a call-site \"feature\" name available to it the way\n// requireAdwGi/requireAdwJsx's callers do — see gtkx/bridge/adw.ts). When\n// the store DOES have Adw, `hasAdwStore` is true and this hook falls\n// through to real resolution, unchanged: `gtkx build`'s dedupe and native-\n// asset rewrite still see a real, literal specifier.\nconst ADW_ONLY_SPECIFIERS = new Set([\"@gtkx/gi/adw\", \"@gtkx/jsx/adw\"])\nconst ADW_UNAVAILABLE_PREFIX = \"\\0gtkx-adw-unavailable:\"\nconst adwUnavailableMessage = (specifier: string): string =>\n `[react-native-gtkx] \"${specifier}\" requires \"Adw-1\" in this app's ` +\n \"gtkx.config.ts `libraries` — see docs/api.md (the plain-GTK profile) \" +\n \"for what needs Adw unconditionally and what falls back without it.\"\n\n// --- the vite plugin ----------------------------------------------------\n\nexport type ReactNativeGtkxOptions = PlatformResolutionOptions & {\n /**\n * Deltas over the preset's package aliases, keyed by package name — a\n * string target, a `{ pattern, replace }` rule, or `false` to drop one of\n * ours so the real package loads. Identical semantics to the Metro\n * preset's option of the same name: both compile the same table.\n * Invalid entries throw here, while the config is being read.\n */\n aliases?: AliasOverrides\n}\n\n/**\n * Vite plugin: aliases `react-native` (and subpaths) to `react-native-gtkx`\n * and resolves Metro-style platform extensions\n * (`.linux.tsx` → `.native.tsx` → base) for extensionless imports.\n */\nexport const reactNativeGtkx = (\n options: ReactNativeGtkxOptions = {},\n): Plugin => {\n // Throws on an unknown key, an overlapping pattern or an attempt to remove\n // the platform alias — at config load, naming what is valid.\n const aliases = compileAliases(options.aliases)\n return {\n name: \"react-native-gtkx:preset\",\n // Before vite's own resolver and the gtkx CLI plugins: the alias must win\n // over node resolution and platform files must win over the base file.\n enforce: \"pre\",\n\n config: (_config, env) => ({\n // `__DEV__` is part of the react-native runtime contract, not a Metro\n // detail: RN's own modules branch on it and so does every library\n // written against them (`@gorhom/bottom-sheet`'s logger and four of its\n // components read it at module scope). The Metro path gets it from the\n // app's stock RN preset; nothing supplied it on the vite path, so a\n // library that reads it crashed the bundle at startup with\n // \"ReferenceError: __DEV__ is not defined\" — found by building\n // spike/core-exports rather than by reading anything.\n //\n // vite's mode is the honest source: `gtkx dev` builds in development,\n // `gtkx build` in production, which is exactly the distinction RN draws.\n define: {\n __DEV__: JSON.stringify(env.mode !== \"production\"),\n // See hasAdwStore's doc above — process.cwd(), not _config.root:\n // `gtkx dev`/`gtkx build` always run from the app's own directory\n // (root defaults there too), and this must be resolvable before the\n // rest of the merged config is settled.\n __GTKX_ADW_AVAILABLE__: JSON.stringify(hasAdwStore(process.cwd())),\n },\n ssr: {\n // `gtkx dev` runs vite with ssr.external: true, which would hand\n // react-native-gtkx straight to node. Keep the package inside the\n // vite pipeline; noExternal wins over external: true.\n //\n // \"react-native\" must be listed too: with ssr.external: true vite\n // externalizes a bare import BEFORE the plugin pipeline whenever the\n // package resolves natively — and the real react-native (a Flow\n // codebase Node cannot parse) exists in RN monorepos. noExternal\n // forces the full plugin resolution, where the alias rewrites the\n // import to react-native-gtkx.\n // \"react-native-reanimated\" for the same reason as \"react-native\": an\n // app that also ships iOS/Android keeps the real package installed, it\n // resolves natively, and ssr.external: true would hand Node a codebase\n // built around a Babel plugin and a worklet runtime before the alias\n // ever gets a chance to rewrite the import.\n // \"react-native-worklets\" is the same case one package over — it is\n // where that worklet runtime actually lives since Reanimated 4.\n //\n // The rule those are instances of, stated once so the next alias does\n // not have to rediscover it: EVERY package name in the alias table must\n // be listed here. An alias is a resolveId hook, and a bare specifier\n // that vite externalizes never reaches one — so on the dev path the\n // alias silently loses to whatever is installed under the real name.\n // That is not hypothetical: an app that also ships iOS and Android has\n // all of them in node_modules, which is the case the alias exists to\n // serve. `react-native-gesture-handler` proved it — this list once held\n // three of the six names, its real package loaded, and it failed on an\n // extensionless internal import Node cannot resolve (found by running\n // the gallery's upstream-libraries section, which installs it).\n //\n // So the list is DERIVED rather than written out: it is exactly the\n // table's package names, and a name can no longer go missing from one\n // of the two places it has to appear.\n //\n // `aliases.names` includes the packages an app turned OFF with `false`,\n // deliberately. Dropping an alias means the REAL package loads, and the\n // real package imports `react-native` at module scope — an import that\n // only reaches the platform alias if Node never gets the package first.\n // Un-aliasing a package is therefore a reason to keep it inside the\n // pipeline, not a reason to let it out.\n noExternal: [\n REACT_NATIVE_GTKX,\n ...aliases.names,\n // @react-navigation is not aliased, but must go through the pipeline\n // too: it imports `react-native`, and an externalized copy resolves\n // that to the real Flow package (SyntaxError: Unexpected token\n // 'typeof') instead of our alias. Only bites on the dev path — a\n // production build inlines everything anyway.\n /^@react-navigation\\//,\n ],\n },\n resolve: {\n // RC4-WORKAROUND(runtime-dedupe): see docs/gtkx-rc4-notes.md\n // The gtkx runtime and react are single-instance hosts: when the app\n // and react-native-gtkx resolve them from different node_modules\n // (file:-installed package, nested installs), two bundled copies\n // double-init the runtime and GLib aborts. dedupe pins every copy to\n // the project's own resolution.\n dedupe: [\n \"@gtkx/css\",\n \"@gtkx/gi\",\n \"@gtkx/jsx\",\n \"@gtkx/native\",\n \"@gtkx/react\",\n \"@gtkx/runtime\",\n // react-navigation is context-based: two bundled copies of core\n // fail with \"couldn't find a navigation context\".\n \"@react-navigation/core\",\n \"@react-navigation/native\",\n \"react\",\n ],\n },\n build: {\n rolldownOptions: {\n output: {\n // A literal, code-split dynamic import (the Adw seam,\n // gtkx/bridge/adw.ts — see its own doc and 006 above) lands its\n // chunk under the Rolldown default `assets/[name]-[hash].js`\n // UNLESS told otherwise. `@gtkx/cli`'s own `gtkx:native` plugin\n // rewrites every reachable `@gtkx/native` import into\n // `require(\"./gtkx.node\")` — a path RELATIVE TO WHATEVER FILE\n // THE REWRITE LANDS IN, correct only when that file sits next to\n // the emitted `dist/gtkx.node` asset. The entry chunk is pinned\n // there already (`entryFileNames: \"bundle.js\"`, set by\n // `@gtkx/cli`'s own builder); a chunk placed one level down in\n // `assets/` breaks the SAME relative path\n // (\"Cannot find module './gtkx.node'\" — reproduced building\n // examples/gallery with the Adw seam's dynamic import made\n // literal). Keeping every chunk in `dist/` alongside the entry\n // and the addon sidesteps the mismatch instead of guessing at\n // gtkx's own relative-path assumption.\n chunkFileNames: \"[name]-[hash].js\",\n },\n },\n },\n }),\n\n async resolveId(source, importer) {\n // See ADW_ONLY_SPECIFIERS' own doc above: on a store with no \"Adw-1\",\n // resolving either of these for real fails the whole file that\n // imports them, before that file's own code (a runtime guard, a\n // try/catch) ever runs. Checked first, ahead of the alias table below\n // (neither specifier is in it).\n if (ADW_ONLY_SPECIFIERS.has(source) && !hasAdwStore(process.cwd())) {\n return ADW_UNAVAILABLE_PREFIX + source\n }\n // The app's table, not the default one: a package dropped with `false`\n // falls through to vite's own resolution and the real package loads.\n const aliased = applyAliases(aliases, source)\n if (aliased !== null) {\n const resolved = await this.resolve(aliased, importer, {\n skipSelf: true,\n })\n return resolved ?? aliased\n }\n return resolvePlatformSpecifier(source, importer, existsSync, options)\n },\n\n load(id) {\n if (!id.startsWith(ADW_UNAVAILABLE_PREFIX)) {\n return null\n }\n const specifier = id.slice(ADW_UNAVAILABLE_PREFIX.length)\n return `throw new Error(${JSON.stringify(adwUnavailableMessage(specifier))})`\n },\n }\n}\n\nexport default reactNativeGtkx\n"]}
@@ -41,7 +41,7 @@ export type ReactNativeGtkxTestOptions = {
41
41
  * `test.projects` alongside a portable "unit" project.
42
42
  *
43
43
  * Requires a headless Wayland compositor on PATH (`sway` by default —
44
- * `apt install sway xwayland dbus`, see docs/getting-started.md) and
44
+ * `apt install sway xwayland dbus`, see docs/guide/toolchains.md) and
45
45
  * `gtkx codegen` to have already generated the project's `@gtkx/gi`
46
46
  * bindings — a bare `vitest run` does not trigger codegen itself, unlike
47
47
  * `gtkx dev`/`gtkx build`. A missing compositor or codegen store fails with
@@ -26,7 +26,7 @@ const SETUP_FILE = fileURLToPath(new URL("./setup.js", import.meta.url));
26
26
  * `test.projects` alongside a portable "unit" project.
27
27
  *
28
28
  * Requires a headless Wayland compositor on PATH (`sway` by default —
29
- * `apt install sway xwayland dbus`, see docs/getting-started.md) and
29
+ * `apt install sway xwayland dbus`, see docs/guide/toolchains.md) and
30
30
  * `gtkx codegen` to have already generated the project's `@gtkx/gi`
31
31
  * bindings — a bare `vitest run` does not trigger codegen itself, unlike
32
32
  * `gtkx dev`/`gtkx build`. A missing compositor or codegen store fails with
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/vitest/index.ts"],"names":[],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YACD,eAAe,EAAE,OAAO,CAAC,eAAe,IAAI,KAAK;SAClD;KACF,CAAA;AACH,CAAC,CAAA;AAED,eAAe,mBAAmB,CAAA","sourcesContent":["// react-native-gtkx/vitest — the vitest recipe this repo's own test suite\n// runs on (see vitest.config.ts's \"gtk\" project), packaged for a consumer\n// app: the @gtkx/vitest headless-compositor plugin, the react-native-gtkx\n// vite preset (react-native alias + Metro-style platform extensions), a\n// default inline-deps list for RN libraries that import \"react-native\"\n// themselves, and the React act-environment setup.\n//\n// Self-contained like ./vite, ./metro and ./runner: a consumer's\n// vitest.config.ts is loaded the same way vite.config.ts is (vite's config\n// loader bundles only the user's own relative import graph; node_modules\n// imports stay bare specifiers, resolved afterwards by plain Node ESM) — so\n// this file must not contain extensionless relative imports. The one\n// relative import below carries an explicit \".js\" extension, which a real\n// sibling file on disk resolves under plain Node without any bundler.\nimport { fileURLToPath, URL } from \"node:url\"\nimport type { PluginOptions as GtkxPluginOptions } from \"@gtkx/vitest\"\nimport type { Plugin } from \"vite\"\nimport type { UserWorkspaceConfig } from \"vitest/config\"\nimport { reactNativeGtkx, type ReactNativeGtkxOptions } from \"../vite/index.js\"\n\n/**\n * Options accepted by {@link reactNativeGtkxTest}. Every field is optional\n * and falls back to the recipe this repo's own test suite runs on.\n */\nexport type ReactNativeGtkxTestOptions = {\n /** Vitest project name. Default: \"gtk\". */\n name?: string\n /** Test file glob(s), relative to the project root. Default: `[\"**\\/*.gtk.test.{ts,tsx}\"]`. */\n include?: string[]\n /** Headless compositor size/compositor, forwarded to @gtkx/vitest's plugin. */\n headless?: GtkxPluginOptions\n /** Metro-style platform resolution options, forwarded to the vite preset. */\n platform?: ReactNativeGtkxOptions\n /**\n * Extra `server.deps.inline` patterns, merged after the default\n * (`/@react-navigation/`). Needed for any node_modules library that\n * itself imports \"react-native\" — Vitest externalizes node_modules code\n * by default, a path the react-native alias cannot reach.\n */\n inlineDeps?: (string | RegExp)[]\n /** Extra setup files, run after the built-in React act-environment setup. */\n setupFiles?: string[]\n /**\n * Run this project's test files serially. Default: false — window-resize\n * signal delivery races when several per-worker headless compositors run\n * at once (see docs/gtkx-rc4-notes.md); the suite this recipe is proven\n * on takes seconds, so serial execution is the cheap fix. Override once a\n * suite is large enough for parallelism to matter more than that race.\n */\n fileParallelism?: boolean\n}\n\nconst DEFAULT_INCLUDE = [\"**/*.gtk.test.{ts,tsx}\"]\nconst DEFAULT_INLINE_DEPS: (string | RegExp)[] = [/@react-navigation/]\nconst SETUP_FILE = fileURLToPath(new URL(\"./setup.js\", import.meta.url))\n\n/**\n * A ready Vitest project config for react-native-gtkx component tests: the\n * headless Wayland compositor, the react-native alias and platform\n * extensions, and the React act-environment setup — the same recipe this\n * repo's own suite runs on. Use the result as a whole config\n * (`defineConfig(reactNativeGtkxTest())`) or as one entry of\n * `test.projects` alongside a portable \"unit\" project.\n *\n * Requires a headless Wayland compositor on PATH (`sway` by default —\n * `apt install sway xwayland dbus`, see docs/getting-started.md) and\n * `gtkx codegen` to have already generated the project's `@gtkx/gi`\n * bindings — a bare `vitest run` does not trigger codegen itself, unlike\n * `gtkx dev`/`gtkx build`. A missing compositor or codegen store fails with\n * a readable error (e.g. `Cannot find the \"sway\" executable on PATH`), not\n * a hang.\n */\nexport const reactNativeGtkxTest = async (\n options: ReactNativeGtkxTestOptions = {},\n): Promise<UserWorkspaceConfig> => {\n const gtkx = (await import(\"@gtkx/vitest\")).default\n const plugins: Plugin[] = [\n gtkx(options.headless),\n reactNativeGtkx(options.platform),\n ]\n return {\n plugins,\n test: {\n name: options.name ?? \"gtk\",\n include: options.include ?? DEFAULT_INCLUDE,\n setupFiles: [SETUP_FILE, ...(options.setupFiles ?? [])],\n server: {\n deps: {\n inline: [...DEFAULT_INLINE_DEPS, ...(options.inlineDeps ?? [])],\n },\n },\n fileParallelism: options.fileParallelism ?? false,\n },\n }\n}\n\nexport default reactNativeGtkxTest\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/vitest/index.ts"],"names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ACF;YACD,eAAe,EAAE,OAAO,CAAC,eAAe,IAAI,KAAK;SAClD;KACF,CAAA;AACH,CAAC,CAAA;AAED,eAAe,mBAAmB,CAAA","sourcesContent":["// react-native-gtkx/vitest — the vitest recipe this repo's own test suite\n// runs on (see vitest.config.ts's \"gtk\" project), packaged for a consumer\n// app: the @gtkx/vitest headless-compositor plugin, the react-native-gtkx\n// vite preset (react-native alias + Metro-style platform extensions), a\n// default inline-deps list for RN libraries that import \"react-native\"\n// themselves, and the React act-environment setup.\n//\n// Self-contained like ./vite, ./metro and ./runner: a consumer's\n// vitest.config.ts is loaded the same way vite.config.ts is (vite's config\n// loader bundles only the user's own relative import graph; node_modules\n// imports stay bare specifiers, resolved afterwards by plain Node ESM) — so\n// this file must not contain extensionless relative imports. The one\n// relative import below carries an explicit \".js\" extension, which a real\n// sibling file on disk resolves under plain Node without any bundler.\nimport { fileURLToPath, URL } from \"node:url\"\nimport type { PluginOptions as GtkxPluginOptions } from \"@gtkx/vitest\"\nimport type { Plugin } from \"vite\"\nimport type { UserWorkspaceConfig } from \"vitest/config\"\nimport { reactNativeGtkx, type ReactNativeGtkxOptions } from \"../vite/index.js\"\n\n/**\n * Options accepted by {@link reactNativeGtkxTest}. Every field is optional\n * and falls back to the recipe this repo's own test suite runs on.\n */\nexport type ReactNativeGtkxTestOptions = {\n /** Vitest project name. Default: \"gtk\". */\n name?: string\n /** Test file glob(s), relative to the project root. Default: `[\"**\\/*.gtk.test.{ts,tsx}\"]`. */\n include?: string[]\n /** Headless compositor size/compositor, forwarded to @gtkx/vitest's plugin. */\n headless?: GtkxPluginOptions\n /** Metro-style platform resolution options, forwarded to the vite preset. */\n platform?: ReactNativeGtkxOptions\n /**\n * Extra `server.deps.inline` patterns, merged after the default\n * (`/@react-navigation/`). Needed for any node_modules library that\n * itself imports \"react-native\" — Vitest externalizes node_modules code\n * by default, a path the react-native alias cannot reach.\n */\n inlineDeps?: (string | RegExp)[]\n /** Extra setup files, run after the built-in React act-environment setup. */\n setupFiles?: string[]\n /**\n * Run this project's test files serially. Default: false — window-resize\n * signal delivery races when several per-worker headless compositors run\n * at once (see docs/gtkx-rc4-notes.md); the suite this recipe is proven\n * on takes seconds, so serial execution is the cheap fix. Override once a\n * suite is large enough for parallelism to matter more than that race.\n */\n fileParallelism?: boolean\n}\n\nconst DEFAULT_INCLUDE = [\"**/*.gtk.test.{ts,tsx}\"]\nconst DEFAULT_INLINE_DEPS: (string | RegExp)[] = [/@react-navigation/]\nconst SETUP_FILE = fileURLToPath(new URL(\"./setup.js\", import.meta.url))\n\n/**\n * A ready Vitest project config for react-native-gtkx component tests: the\n * headless Wayland compositor, the react-native alias and platform\n * extensions, and the React act-environment setup — the same recipe this\n * repo's own suite runs on. Use the result as a whole config\n * (`defineConfig(reactNativeGtkxTest())`) or as one entry of\n * `test.projects` alongside a portable \"unit\" project.\n *\n * Requires a headless Wayland compositor on PATH (`sway` by default —\n * `apt install sway xwayland dbus`, see docs/guide/toolchains.md) and\n * `gtkx codegen` to have already generated the project's `@gtkx/gi`\n * bindings — a bare `vitest run` does not trigger codegen itself, unlike\n * `gtkx dev`/`gtkx build`. A missing compositor or codegen store fails with\n * a readable error (e.g. `Cannot find the \"sway\" executable on PATH`), not\n * a hang.\n */\nexport const reactNativeGtkxTest = async (\n options: ReactNativeGtkxTestOptions = {},\n): Promise<UserWorkspaceConfig> => {\n const gtkx = (await import(\"@gtkx/vitest\")).default\n const plugins: Plugin[] = [\n gtkx(options.headless),\n reactNativeGtkx(options.platform),\n ]\n return {\n plugins,\n test: {\n name: options.name ?? \"gtk\",\n include: options.include ?? DEFAULT_INCLUDE,\n setupFiles: [SETUP_FILE, ...(options.setupFiles ?? [])],\n server: {\n deps: {\n inline: [...DEFAULT_INLINE_DEPS, ...(options.inlineDeps ?? [])],\n },\n },\n fileParallelism: options.fileParallelism ?? false,\n },\n }\n}\n\nexport default reactNativeGtkxTest\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-gtkx",
3
- "version": "0.3.0-alpha.1",
3
+ "version": "0.4.0-alpha.3",
4
4
  "description": "React Native components and APIs for Linux desktop, rendered as native GTK4 widgets via gtkx",
5
5
  "license": "MIT",
6
6
  "author": "Anton Petrov <anton@itsmepetrov.com>",
@@ -1,4 +0,0 @@
1
- import * as Adw from "@gtkx/gi/adw";
2
- export type ColorScheme = "light" | "dark";
3
- export declare const styleManager: () => Adw.StyleManager;
4
- export declare const colorScheme: () => ColorScheme;
@@ -1,5 +0,0 @@
1
- import * as Adw from "@gtkx/gi/adw";
2
- export const styleManager = () => Adw.StyleManager.getDefault();
3
- // The Appearance API subscribes to notify::dark on the style manager.
4
- export const colorScheme = () => styleManager().getDark() ? "dark" : "light";
5
- //# sourceMappingURL=theme.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"theme.js","sourceRoot":"","sources":["../../../src/gtkx/bridge/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AAInC,MAAM,CAAC,MAAM,YAAY,GAAG,GAAqB,EAAE,CACjD,GAAG,CAAC,YAAY,CAAC,UAAU,EAAE,CAAA;AAE/B,sEAAsE;AACtE,MAAM,CAAC,MAAM,WAAW,GAAG,GAAgB,EAAE,CAC3C,YAAY,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAA","sourcesContent":["import * as Adw from \"@gtkx/gi/adw\"\n\nexport type ColorScheme = \"light\" | \"dark\"\n\nexport const styleManager = (): Adw.StyleManager =>\n Adw.StyleManager.getDefault()\n\n// The Appearance API subscribes to notify::dark on the style manager.\nexport const colorScheme = (): ColorScheme =>\n styleManager().getDark() ? \"dark\" : \"light\"\n"]}