vxrn 1.14.4 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/dist/cli.mjs +263 -248
  2. package/dist/cli.mjs.map +1 -1
  3. package/dist/cli.native.js +267 -252
  4. package/dist/cli.native.js.map +1 -1
  5. package/dist/config/getAdditionalViteConfig.mjs +8 -8
  6. package/dist/config/getAdditionalViteConfig.mjs.map +1 -1
  7. package/dist/config/getAdditionalViteConfig.native.js +8 -8
  8. package/dist/config/getAdditionalViteConfig.native.js.map +1 -1
  9. package/dist/config/getBaseViteConfigOnly.mjs +14 -12
  10. package/dist/config/getBaseViteConfigOnly.mjs.map +1 -1
  11. package/dist/config/getBaseViteConfigOnly.native.js +16 -14
  12. package/dist/config/getBaseViteConfigOnly.native.js.map +1 -1
  13. package/dist/config/getBaseVitePlugins.mjs +34 -19
  14. package/dist/config/getBaseVitePlugins.mjs.map +1 -1
  15. package/dist/config/getBaseVitePlugins.native.js +47 -32
  16. package/dist/config/getBaseVitePlugins.native.js.map +1 -1
  17. package/dist/config/getOptimizeDeps.mjs +12 -9
  18. package/dist/config/getOptimizeDeps.mjs.map +1 -1
  19. package/dist/config/getOptimizeDeps.native.js +12 -9
  20. package/dist/config/getOptimizeDeps.native.js.map +1 -1
  21. package/dist/config/getOptionsFilled.mjs +47 -41
  22. package/dist/config/getOptionsFilled.mjs.map +1 -1
  23. package/dist/config/getOptionsFilled.native.js +53 -50
  24. package/dist/config/getOptionsFilled.native.js.map +1 -1
  25. package/dist/config/getReactNativePlugins.mjs +5 -2
  26. package/dist/config/getReactNativePlugins.mjs.map +1 -1
  27. package/dist/config/getReactNativePlugins.native.js +8 -5
  28. package/dist/config/getReactNativePlugins.native.js.map +1 -1
  29. package/dist/config/getServerOptionsFilled.mjs +21 -14
  30. package/dist/config/getServerOptionsFilled.mjs.map +1 -1
  31. package/dist/config/getServerOptionsFilled.native.js +25 -21
  32. package/dist/config/getServerOptionsFilled.native.js.map +1 -1
  33. package/dist/config/getViteServerConfig.mjs +25 -16
  34. package/dist/config/getViteServerConfig.mjs.map +1 -1
  35. package/dist/config/getViteServerConfig.native.js +37 -28
  36. package/dist/config/getViteServerConfig.native.js.map +1 -1
  37. package/dist/config/mergeUserConfig.mjs +25 -7
  38. package/dist/config/mergeUserConfig.mjs.map +1 -1
  39. package/dist/config/mergeUserConfig.native.js +32 -14
  40. package/dist/config/mergeUserConfig.native.js.map +1 -1
  41. package/dist/config/mergeUserConfig.test.mjs +53 -26
  42. package/dist/config/mergeUserConfig.test.mjs.map +1 -1
  43. package/dist/config/mergeUserConfig.test.native.js +94 -74
  44. package/dist/config/mergeUserConfig.test.native.js.map +1 -1
  45. package/dist/constants.mjs +6 -6
  46. package/dist/constants.mjs.map +1 -1
  47. package/dist/constants.native.js +6 -6
  48. package/dist/constants.native.js.map +1 -1
  49. package/dist/exports/build.mjs +241 -191
  50. package/dist/exports/build.mjs.map +1 -1
  51. package/dist/exports/build.native.js +257 -221
  52. package/dist/exports/build.native.js.map +1 -1
  53. package/dist/exports/clean.mjs +17 -12
  54. package/dist/exports/clean.mjs.map +1 -1
  55. package/dist/exports/clean.native.js +22 -13
  56. package/dist/exports/clean.native.js.map +1 -1
  57. package/dist/exports/createServer.mjs +49 -35
  58. package/dist/exports/createServer.mjs.map +1 -1
  59. package/dist/exports/createServer.native.js +50 -34
  60. package/dist/exports/createServer.native.js.map +1 -1
  61. package/dist/exports/dev.mjs +119 -74
  62. package/dist/exports/dev.mjs.map +1 -1
  63. package/dist/exports/dev.native.js +131 -90
  64. package/dist/exports/dev.native.js.map +1 -1
  65. package/dist/exports/loadEnv.mjs +28 -19
  66. package/dist/exports/loadEnv.mjs.map +1 -1
  67. package/dist/exports/loadEnv.native.js +33 -28
  68. package/dist/exports/loadEnv.native.js.map +1 -1
  69. package/dist/exports/patch.mjs +4 -1
  70. package/dist/exports/patch.mjs.map +1 -1
  71. package/dist/exports/patch.native.js +4 -1
  72. package/dist/exports/patch.native.js.map +1 -1
  73. package/dist/exports/prebuild.mjs +106 -42
  74. package/dist/exports/prebuild.mjs.map +1 -1
  75. package/dist/exports/prebuild.native.js +116 -63
  76. package/dist/exports/prebuild.native.js.map +1 -1
  77. package/dist/exports/prebuildWithoutExpo.mjs +44 -39
  78. package/dist/exports/prebuildWithoutExpo.mjs.map +1 -1
  79. package/dist/exports/prebuildWithoutExpo.native.js +45 -42
  80. package/dist/exports/prebuildWithoutExpo.native.js.map +1 -1
  81. package/dist/exports/runAndroid.mjs +8 -5
  82. package/dist/exports/runAndroid.mjs.map +1 -1
  83. package/dist/exports/runAndroid.native.js +2 -1
  84. package/dist/exports/runAndroid.native.js.map +1 -1
  85. package/dist/exports/runIos.mjs +8 -5
  86. package/dist/exports/runIos.mjs.map +1 -1
  87. package/dist/exports/runIos.native.js +2 -1
  88. package/dist/exports/runIos.native.js.map +1 -1
  89. package/dist/exports/serve.mjs +14 -6
  90. package/dist/exports/serve.mjs.map +1 -1
  91. package/dist/exports/serve.native.js +21 -13
  92. package/dist/exports/serve.native.js.map +1 -1
  93. package/dist/exports/serveStaticAssets.mjs +37 -22
  94. package/dist/exports/serveStaticAssets.mjs.map +1 -1
  95. package/dist/exports/serveStaticAssets.native.js +65 -41
  96. package/dist/exports/serveStaticAssets.native.js.map +1 -1
  97. package/dist/patches/builtInDepPatches.mjs +145 -62
  98. package/dist/patches/builtInDepPatches.mjs.map +1 -1
  99. package/dist/patches/builtInDepPatches.native.js +116 -70
  100. package/dist/patches/builtInDepPatches.native.js.map +1 -1
  101. package/dist/plugins/autoDepOptimizePlugin.mjs +66 -42
  102. package/dist/plugins/autoDepOptimizePlugin.mjs.map +1 -1
  103. package/dist/plugins/autoDepOptimizePlugin.native.js +83 -63
  104. package/dist/plugins/autoDepOptimizePlugin.native.js.map +1 -1
  105. package/dist/plugins/autoDepOptimizePlugin.test.mjs +23 -17
  106. package/dist/plugins/autoDepOptimizePlugin.test.mjs.map +1 -1
  107. package/dist/plugins/autoDepOptimizePlugin.test.native.js +31 -27
  108. package/dist/plugins/autoDepOptimizePlugin.test.native.js.map +1 -1
  109. package/dist/plugins/defaultDepOptimizePlugin.mjs +6 -2
  110. package/dist/plugins/defaultDepOptimizePlugin.mjs.map +1 -1
  111. package/dist/plugins/defaultDepOptimizePlugin.native.js +6 -2
  112. package/dist/plugins/defaultDepOptimizePlugin.native.js.map +1 -1
  113. package/dist/plugins/expoManifestRequestHandlerPlugin.mjs +80 -36
  114. package/dist/plugins/expoManifestRequestHandlerPlugin.mjs.map +1 -1
  115. package/dist/plugins/expoManifestRequestHandlerPlugin.native.js +93 -46
  116. package/dist/plugins/expoManifestRequestHandlerPlugin.native.js.map +1 -1
  117. package/dist/plugins/getResolvedConfigSubset.mjs +3 -1
  118. package/dist/plugins/getResolvedConfigSubset.mjs.map +1 -1
  119. package/dist/plugins/getResolvedConfigSubset.native.js +3 -1
  120. package/dist/plugins/getResolvedConfigSubset.native.js.map +1 -1
  121. package/dist/plugins/reactNativeCommonJsPlugin.mjs +70 -46
  122. package/dist/plugins/reactNativeCommonJsPlugin.mjs.map +1 -1
  123. package/dist/plugins/reactNativeCommonJsPlugin.native.js +99 -68
  124. package/dist/plugins/reactNativeCommonJsPlugin.native.js.map +1 -1
  125. package/dist/plugins/reactNativeDevAssetPlugin.mjs +41 -27
  126. package/dist/plugins/reactNativeDevAssetPlugin.mjs.map +1 -1
  127. package/dist/plugins/reactNativeDevAssetPlugin.native.js +61 -48
  128. package/dist/plugins/reactNativeDevAssetPlugin.native.js.map +1 -1
  129. package/dist/plugins/reactNativeDevServer.mjs +126 -83
  130. package/dist/plugins/reactNativeDevServer.mjs.map +1 -1
  131. package/dist/plugins/reactNativeDevServer.native.js +156 -107
  132. package/dist/plugins/reactNativeDevServer.native.js.map +1 -1
  133. package/dist/plugins/resolveIdScan.test.mjs +22 -17
  134. package/dist/plugins/resolveIdScan.test.mjs.map +1 -1
  135. package/dist/plugins/resolveIdScan.test.native.js +25 -21
  136. package/dist/plugins/resolveIdScan.test.native.js.map +1 -1
  137. package/dist/plugins/serverExtensions.test.mjs +66 -38
  138. package/dist/plugins/serverExtensions.test.mjs.map +1 -1
  139. package/dist/plugins/serverExtensions.test.native.js +63 -49
  140. package/dist/plugins/serverExtensions.test.native.js.map +1 -1
  141. package/dist/rn-commands/bundle/buildBundle.mjs +48 -31
  142. package/dist/rn-commands/bundle/buildBundle.mjs.map +1 -1
  143. package/dist/rn-commands/bundle/buildBundle.native.js +52 -35
  144. package/dist/rn-commands/bundle/buildBundle.native.js.map +1 -1
  145. package/dist/runtime/hmr-client.mjs +59 -39
  146. package/dist/runtime/hmr-client.mjs.map +1 -1
  147. package/dist/runtime/hmr-client.native.js +132 -92
  148. package/dist/runtime/hmr-client.native.js.map +1 -1
  149. package/dist/runtime/hmr-runtime.mjs +65 -29
  150. package/dist/runtime/hmr-runtime.mjs.map +1 -1
  151. package/dist/runtime/hmr-runtime.native.js +361 -268
  152. package/dist/runtime/hmr-runtime.native.js.map +1 -1
  153. package/dist/runtime/react-refresh-utils.mjs +19 -9
  154. package/dist/runtime/react-refresh-utils.mjs.map +1 -1
  155. package/dist/runtime/react-refresh-utils.native.js +20 -10
  156. package/dist/runtime/react-refresh-utils.native.js.map +1 -1
  157. package/dist/serve/node.mjs +33 -19
  158. package/dist/serve/node.mjs.map +1 -1
  159. package/dist/serve/node.native.js +57 -39
  160. package/dist/serve/node.native.js.map +1 -1
  161. package/dist/user-interface/index.mjs +114 -61
  162. package/dist/user-interface/index.mjs.map +1 -1
  163. package/dist/user-interface/index.native.js +158 -111
  164. package/dist/user-interface/index.native.js.map +1 -1
  165. package/dist/utils/assert.mjs +6 -2
  166. package/dist/utils/assert.mjs.map +1 -1
  167. package/dist/utils/assert.native.js +12 -4
  168. package/dist/utils/assert.native.js.map +1 -1
  169. package/dist/utils/bindKeypressInput.mjs +38 -23
  170. package/dist/utils/bindKeypressInput.mjs.map +1 -1
  171. package/dist/utils/bindKeypressInput.native.js +38 -23
  172. package/dist/utils/bindKeypressInput.native.js.map +1 -1
  173. package/dist/utils/createNativeDevEngine.mjs +421 -319
  174. package/dist/utils/createNativeDevEngine.mjs.map +1 -1
  175. package/dist/utils/createNativeDevEngine.native.js +529 -425
  176. package/dist/utils/createNativeDevEngine.native.js.map +1 -1
  177. package/dist/utils/execSync.mjs +6 -4
  178. package/dist/utils/execSync.mjs.map +1 -1
  179. package/dist/utils/execSync.native.js.map +1 -1
  180. package/dist/utils/expoRun.mjs +5 -3
  181. package/dist/utils/expoRun.mjs.map +1 -1
  182. package/dist/utils/expoRun.native.js +13 -13
  183. package/dist/utils/expoRun.native.js.map +1 -1
  184. package/dist/utils/filterViteServerResolvedUrls.mjs +17 -5
  185. package/dist/utils/filterViteServerResolvedUrls.mjs.map +1 -1
  186. package/dist/utils/filterViteServerResolvedUrls.native.js +41 -23
  187. package/dist/utils/filterViteServerResolvedUrls.native.js.map +1 -1
  188. package/dist/utils/getServerEntry.mjs +6 -4
  189. package/dist/utils/getServerEntry.mjs.map +1 -1
  190. package/dist/utils/getServerEntry.native.js +9 -9
  191. package/dist/utils/getServerEntry.native.js.map +1 -1
  192. package/dist/utils/getVitePath.mjs +41 -17
  193. package/dist/utils/getVitePath.mjs.map +1 -1
  194. package/dist/utils/getVitePath.native.js +38 -16
  195. package/dist/utils/getVitePath.native.js.map +1 -1
  196. package/dist/utils/patches.mjs +143 -73
  197. package/dist/utils/patches.mjs.map +1 -1
  198. package/dist/utils/patches.native.js +299 -188
  199. package/dist/utils/patches.native.js.map +1 -1
  200. package/dist/utils/patches.test.mjs +106 -69
  201. package/dist/utils/patches.test.mjs.map +1 -1
  202. package/dist/utils/patches.test.native.js +100 -75
  203. package/dist/utils/patches.test.native.js.map +1 -1
  204. package/dist/utils/printServerUrls.mjs +6 -2
  205. package/dist/utils/printServerUrls.mjs.map +1 -1
  206. package/dist/utils/printServerUrls.native.js +28 -18
  207. package/dist/utils/printServerUrls.native.js.map +1 -1
  208. package/dist/utils/removeUndefined.mjs +5 -1
  209. package/dist/utils/removeUndefined.mjs.map +1 -1
  210. package/dist/utils/removeUndefined.native.js +5 -1
  211. package/dist/utils/removeUndefined.native.js.map +1 -1
  212. package/dist/utils/scanDepsToOptimize.mjs +131 -87
  213. package/dist/utils/scanDepsToOptimize.mjs.map +1 -1
  214. package/dist/utils/scanDepsToOptimize.native.js +163 -117
  215. package/dist/utils/scanDepsToOptimize.native.js.map +1 -1
  216. package/dist/utils/state.mjs +4 -2
  217. package/dist/utils/state.mjs.map +1 -1
  218. package/dist/utils/state.native.js +3 -2
  219. package/dist/utils/state.native.js.map +1 -1
  220. package/dist/utils/utils.mjs +4 -3
  221. package/dist/utils/utils.mjs.map +1 -1
  222. package/dist/utils/utils.native.js +22 -16
  223. package/dist/utils/utils.native.js.map +1 -1
  224. package/dist/vendor/debugger-app/src/index.css +1 -1
  225. package/dist/vendor/debugger-app/src/index.css.map +1 -1
  226. package/dist/vxrn-vite-plugin.mjs +10 -6
  227. package/dist/vxrn-vite-plugin.mjs.map +1 -1
  228. package/dist/vxrn-vite-plugin.native.js +25 -21
  229. package/dist/vxrn-vite-plugin.native.js.map +1 -1
  230. package/package.json +12 -12
  231. package/src/plugins/reactNativeDevServer.ts +0 -6
  232. package/src/utils/createNativeDevEngine.ts +55 -1
  233. package/types/plugins/reactNativeDevServer.d.ts.map +1 -1
  234. package/types/utils/createNativeDevEngine.d.ts.map +1 -1
@@ -3,13 +3,17 @@ import { existsSync, readFileSync } from "fs";
3
3
  import { DEFAULT_ASSET_EXTS } from "../constants/defaults.native.js";
4
4
  import { getNativePrelude } from "../runtime/native-prelude.native.js";
5
5
  function _instanceof(left, right) {
6
- return right != null && typeof Symbol < "u" && right[Symbol.hasInstance] ? !!right[Symbol.hasInstance](left) : left instanceof right;
6
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
7
+ return !!right[Symbol.hasInstance](left);
8
+ } else {
9
+ return left instanceof right;
10
+ }
7
11
  }
8
12
  var FLOW_FILE_PATTERN = /node_modules[\\/](?:react-native|@react-native)[\\/].*\.js$/;
9
13
  function getResolveExtensions(platform) {
10
- var platformExts = platform === "ios" ? [".ios.tsx", ".ios.ts", ".ios.jsx", ".ios.js"] : [".android.tsx", ".android.ts", ".android.jsx", ".android.js"],
11
- nativeExts = [".native.tsx", ".native.ts", ".native.jsx", ".native.js"],
12
- defaultExts = [".tsx", ".ts", ".jsx", ".js", ".mjs", ".cjs", ".json"];
14
+ var platformExts = platform === "ios" ? [".ios.tsx", ".ios.ts", ".ios.jsx", ".ios.js"] : [".android.tsx", ".android.ts", ".android.jsx", ".android.js"];
15
+ var nativeExts = [".native.tsx", ".native.ts", ".native.jsx", ".native.js"];
16
+ var defaultExts = [".tsx", ".ts", ".jsx", ".js", ".mjs", ".cjs", ".json"];
13
17
  return [...platformExts, ...nativeExts, ...defaultExts];
14
18
  }
15
19
  function getNativeResolveConfig(platform) {
@@ -20,102 +24,114 @@ function getNativeResolveConfig(platform) {
20
24
  };
21
25
  }
22
26
  function getNativeTransformConfig(platform, dev, root) {
23
- var entryConfig = globalThis.__vxrnNativeEntryConfig || {},
24
- setupFileDefines = function () {
25
- var sf = entryConfig.setupFile;
26
- if (!sf) return {};
27
- var files = typeof sf == "string" ? {
28
- client: sf,
29
- server: sf,
30
- ios: sf,
31
- android: sf
32
- } : "native" in sf ? {
33
- client: sf.client,
34
- server: sf.server,
35
- ios: sf.native,
36
- android: sf.native
37
- } : sf;
38
- return {
39
- ...(files.client && {
40
- "process.env.ONE_SETUP_FILE_CLIENT": JSON.stringify(files.client)
41
- }),
42
- ...(files.server && {
43
- "process.env.ONE_SETUP_FILE_SERVER": JSON.stringify(files.server)
44
- }),
45
- ...(files.ios && {
46
- "process.env.ONE_SETUP_FILE_IOS": JSON.stringify(files.ios)
47
- }),
48
- ...(files.android && {
49
- "process.env.ONE_SETUP_FILE_ANDROID": JSON.stringify(files.android)
50
- })
51
- };
52
- }(),
53
- envDefines = function () {
54
- var defines = {};
55
- try {
56
- for (var mode2 = dev ? "development" : "production", _i = 0, _iter = [".env", ".env.local", `.env.${mode2}`, `.env.${mode2}.local`]; _i < _iter.length; _i++) {
57
- var envFile = _iter[_i],
58
- envPath = join(root, envFile);
59
- if (existsSync(envPath)) {
60
- var content = readFileSync(envPath, "utf8"),
61
- _iteratorNormalCompletion2 = !0,
62
- _didIteratorError2 = !1,
63
- _iteratorError2 = void 0;
64
- try {
65
- for (var _iterator2 = content.split(`
66
- `)[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = !0) {
67
- var line = _step2.value,
68
- match2 = line.match(/^\s*(VITE_\w+)\s*=\s*(.*)$/);
69
- if (match2) {
70
- var [, key2, rawVal] = match2,
71
- val2 = rawVal.replace(/^['"]|['"]$/g, "").trim();
72
- defines[`import.meta.env.${key2}`] = JSON.stringify(val2), defines[`process.env.${key2}`] = JSON.stringify(val2);
73
- }
74
- }
75
- } catch (err) {
76
- _didIteratorError2 = !0, _iteratorError2 = err;
77
- } finally {
78
- try {
79
- !_iteratorNormalCompletion2 && _iterator2.return != null && _iterator2.return();
80
- } finally {
81
- if (_didIteratorError2) throw _iteratorError2;
82
- }
27
+ var entryConfig = globalThis.__vxrnNativeEntryConfig || {};
28
+ var setupFileDefines = function () {
29
+ var sf = entryConfig.setupFile;
30
+ if (!sf) return {};
31
+ var files = typeof sf === "string" ? {
32
+ client: sf,
33
+ server: sf,
34
+ ios: sf,
35
+ android: sf
36
+ } : "native" in sf ? {
37
+ client: sf.client,
38
+ server: sf.server,
39
+ ios: sf.native,
40
+ android: sf.native
41
+ } : sf;
42
+ return {
43
+ ...(files.client && {
44
+ "process.env.ONE_SETUP_FILE_CLIENT": JSON.stringify(files.client)
45
+ }),
46
+ ...(files.server && {
47
+ "process.env.ONE_SETUP_FILE_SERVER": JSON.stringify(files.server)
48
+ }),
49
+ ...(files.ios && {
50
+ "process.env.ONE_SETUP_FILE_IOS": JSON.stringify(files.ios)
51
+ }),
52
+ ...(files.android && {
53
+ "process.env.ONE_SETUP_FILE_ANDROID": JSON.stringify(files.android)
54
+ })
55
+ };
56
+ }();
57
+ var envDefines = function () {
58
+ var defines = {};
59
+ try {
60
+ var mode2 = dev ? "development" : "production";
61
+ for (var _i = 0, _iter = [".env", ".env.local", `.env.${mode2}`, `.env.${mode2}.local`]; _i < _iter.length; _i++) {
62
+ var envFile = _iter[_i];
63
+ var envPath = join(root, envFile);
64
+ if (!existsSync(envPath)) continue;
65
+ var content = readFileSync(envPath, "utf8");
66
+ var _iteratorNormalCompletion2 = true,
67
+ _didIteratorError2 = false,
68
+ _iteratorError2 = void 0;
69
+ try {
70
+ for (var _iterator2 = content.split("\n")[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
71
+ var line = _step2.value;
72
+ var match2 = line.match(/^\s*(VITE_\w+)\s*=\s*(.*)$/);
73
+ if (match2) {
74
+ var [, key2, rawVal] = match2;
75
+ var val2 = rawVal.replace(/^['"]|['"]$/g, "").trim();
76
+ defines[`import.meta.env.${key2}`] = JSON.stringify(val2);
77
+ defines[`process.env.${key2}`] = JSON.stringify(val2);
78
+ }
79
+ }
80
+ } catch (err) {
81
+ _didIteratorError2 = true;
82
+ _iteratorError2 = err;
83
+ } finally {
84
+ try {
85
+ if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
86
+ _iterator2.return();
87
+ }
88
+ } finally {
89
+ if (_didIteratorError2) {
90
+ throw _iteratorError2;
83
91
  }
84
92
  }
85
93
  }
86
- } catch {}
87
- return defines;
88
- }(),
89
- mode = dev ? "development" : "production",
90
- envObject = {
91
- MODE: mode,
92
- DEV: dev,
93
- PROD: !dev,
94
- SSR: !1,
95
- VITE_ENVIRONMENT: platform,
96
- VITE_NATIVE: "1",
97
- EXPO_OS: platform
98
- },
99
- _iteratorNormalCompletion = !0,
100
- _didIteratorError = !1,
94
+ }
95
+ } catch (unused) {}
96
+ return defines;
97
+ }();
98
+ var mode = dev ? "development" : "production";
99
+ var envObject = {
100
+ MODE: mode,
101
+ DEV: dev,
102
+ PROD: !dev,
103
+ SSR: false,
104
+ VITE_ENVIRONMENT: platform,
105
+ VITE_NATIVE: "1",
106
+ EXPO_OS: platform
107
+ };
108
+ var _iteratorNormalCompletion = true,
109
+ _didIteratorError = false,
101
110
  _iteratorError = void 0;
102
111
  try {
103
- for (var _iterator = Object.entries(envDefines)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
104
- var [key, val] = _step.value,
105
- match = key.match(/^import\.meta\.env\.(.+)$/);
106
- if (match) try {
107
- envObject[match[1]] = JSON.parse(val);
108
- } catch {
109
- envObject[match[1]] = val;
112
+ for (var _iterator = Object.entries(envDefines)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
113
+ var [key, val] = _step.value;
114
+ var match = key.match(/^import\.meta\.env\.(.+)$/);
115
+ if (match) {
116
+ try {
117
+ envObject[match[1]] = JSON.parse(val);
118
+ } catch (unused) {
119
+ envObject[match[1]] = val;
120
+ }
110
121
  }
111
122
  }
112
123
  } catch (err) {
113
- _didIteratorError = !0, _iteratorError = err;
124
+ _didIteratorError = true;
125
+ _iteratorError = err;
114
126
  } finally {
115
127
  try {
116
- !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
128
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
129
+ _iterator.return();
130
+ }
117
131
  } finally {
118
- if (_didIteratorError) throw _iteratorError;
132
+ if (_didIteratorError) {
133
+ throw _iteratorError;
134
+ }
119
135
  }
120
136
  }
121
137
  return {
@@ -167,6 +183,8 @@ function getNativePlugins(root, platform, viteImportGlobPlugin, dev) {
167
183
  }),
168
184
  // strip Flow types from react-native and @react-native packages
169
185
  flowStripPlugin(),
186
+ // guard undefined native methods in NativeAnimatedHelper
187
+ nativeAnimatedGuardPlugin(),
170
188
  // handle asset imports (.png, .jpg, .ttf, etc.)
171
189
  assetPlugin({
172
190
  root,
@@ -181,115 +199,140 @@ function getNativePlugins(root, platform, viteImportGlobPlugin, dev) {
181
199
  function getNativeOutputOptions(prelude) {
182
200
  return {
183
201
  format: "esm",
184
- sourcemap: !0,
202
+ sourcemap: true,
185
203
  intro: prelude,
186
- codeSplitting: !1,
187
- strictExecutionOrder: !0
204
+ codeSplitting: false,
205
+ strictExecutionOrder: true
188
206
  };
189
207
  }
190
208
  function postProcessNativeBundle(code) {
191
- return code = code.replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm, ""), code = code.replace(/^if \(import\.meta\.hot\).*$/gm, ""), code;
209
+ code = code.replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm, "");
210
+ code = code.replace(/^if \(import\.meta\.hot\).*$/gm, "");
211
+ {
212
+ var marker = "NativeAnimatedModule_default ?? NativeAnimatedTurboModule_default;";
213
+ var idx = code.indexOf(marker);
214
+ if (idx !== -1) {
215
+ var beforeMarker = code.lastIndexOf("NativeAnimatedModule = ", idx);
216
+ if (beforeMarker !== -1) {
217
+ var lineStart = code.lastIndexOf("\n", beforeMarker);
218
+ var snippet = code.slice(lineStart + 1, beforeMarker + 50);
219
+ if (snippet.includes("(function()") || snippet.includes("new Proxy")) {
220
+ var afterMarker = code.indexOf("})();", idx);
221
+ if (afterMarker !== -1) {
222
+ var end = afterMarker + "})();".length;
223
+ code = code.slice(0, beforeMarker) + "NativeAnimatedModule = NativeAnimatedModule_default ?? NativeAnimatedTurboModule_default;" + code.slice(end);
224
+ }
225
+ }
226
+ }
227
+ }
228
+ }
229
+ return code;
192
230
  }
193
231
  async function downlevelClassFieldsInBundle(code) {
194
- var startMarker = "//#region \\0rolldown/runtime.js",
195
- endMarker = "//#endregion",
196
- startIdx = code.indexOf(startMarker);
232
+ var startMarker = "//#region \\0rolldown/runtime.js";
233
+ var endMarker = "//#endregion";
234
+ var startIdx = code.indexOf(startMarker);
197
235
  if (startIdx === -1) return code;
198
236
  var endIdx = code.indexOf(endMarker, startIdx);
199
237
  if (endIdx === -1) return code;
200
- var runtimeEnd = endIdx + endMarker.length,
201
- runtimeSection = code.slice(startIdx, runtimeEnd);
238
+ var runtimeEnd = endIdx + endMarker.length;
239
+ var runtimeSection = code.slice(startIdx, runtimeEnd);
202
240
  try {
203
- var swc = await import("@swc/core"),
204
- result = await swc.transform(runtimeSection, {
205
- filename: "rolldown-runtime.js",
206
- configFile: !1,
207
- swcrc: !1,
208
- sourceMaps: !1,
209
- inputSourceMap: !1,
210
- isModule: !1,
211
- env: {
212
- targets: {
213
- node: 9999
214
- },
215
- include: ["transform-class-properties", "transform-class-static-block", "transform-private-methods", "transform-private-property-in-object"]
241
+ var swc = await import("@swc/core");
242
+ var result = await swc.transform(runtimeSection, {
243
+ filename: "rolldown-runtime.js",
244
+ configFile: false,
245
+ swcrc: false,
246
+ sourceMaps: false,
247
+ inputSourceMap: false,
248
+ isModule: false,
249
+ env: {
250
+ targets: {
251
+ node: 9999
216
252
  },
217
- jsc: {
218
- parser: {
219
- syntax: "ecmascript"
220
- },
221
- transform: {
222
- react: {
223
- runtime: "preserve"
224
- }
225
- },
226
- externalHelpers: !1,
227
- assumptions: {
228
- setPublicClassFields: !0,
229
- privateFieldsAsProperties: !0
253
+ include: ["transform-class-properties", "transform-class-static-block", "transform-private-methods", "transform-private-property-in-object"]
254
+ },
255
+ jsc: {
256
+ parser: {
257
+ syntax: "ecmascript"
258
+ },
259
+ transform: {
260
+ react: {
261
+ runtime: "preserve"
230
262
  }
263
+ },
264
+ externalHelpers: false,
265
+ assumptions: {
266
+ setPublicClassFields: true,
267
+ privateFieldsAsProperties: true
231
268
  }
232
- });
269
+ }
270
+ });
233
271
  return code.slice(0, startIdx) + result.code + code.slice(runtimeEnd);
234
272
  } catch (err) {
235
- return console.warn("[vxrn] downlevelClassFieldsInBundle failed, returning original:", err), code;
273
+ console.warn("[vxrn] downlevelClassFieldsInBundle failed, returning original:", err);
274
+ return code;
236
275
  }
237
276
  }
238
277
  async function createNativeDevEngine(options) {
239
278
  var {
240
- root,
241
- port,
242
- host = "localhost",
243
- platform,
244
- serverUrl,
245
- plugins: userPlugins = [],
246
- onHmrUpdate
247
- } = options,
248
- {
249
- dev,
250
- viteImportGlobPlugin
251
- } = await import("rolldown/experimental"),
252
- hmrRuntimeSource = getHmrRuntimeSource(),
253
- prelude = getNativePrelude({
254
- dev: !0,
255
- platform,
256
- serverUrl: serverUrl || `http://${host}:${port}`
257
- }),
258
- currentBundle = null,
259
- bundleResolve = null,
260
- bundlePromise = null,
261
- resolvedHost = host === "0.0.0.0" ? "localhost" : host,
262
- inputOptions = {
263
- input: VIRTUAL_NATIVE_ENTRY,
264
- cwd: root,
265
- platform: "neutral",
266
- resolve: getNativeResolveConfig(platform),
267
- transform: getNativeTransformConfig(platform, !0, root),
268
- experimental: {
269
- devMode: {
270
- implement: hmrRuntimeSource,
271
- host,
272
- port
273
- },
274
- incrementalBuild: !0
275
- },
276
- treeshake: !1,
277
- // some react-native ecosystem packages import symbols that don't exist in
278
- // the declared entry (e.g. @react-navigation/elements imports NavigationProvider
279
- // from @react-navigation/native which doesn't export it). metro silently shims
280
- // these — rolldown needs an explicit opt-in.
281
- shimMissingExports: !0,
282
- moduleTypes: {
283
- ".js": "jsx"
279
+ root,
280
+ port,
281
+ host = "localhost",
282
+ platform,
283
+ serverUrl,
284
+ plugins: userPlugins = [],
285
+ onHmrUpdate
286
+ } = options;
287
+ var {
288
+ dev,
289
+ viteImportGlobPlugin
290
+ } = await import("rolldown/experimental");
291
+ var hmrRuntimeSource = getHmrRuntimeSource();
292
+ var prelude = getNativePrelude({
293
+ dev: true,
294
+ platform,
295
+ serverUrl: serverUrl || `http://${host}:${port}`
296
+ });
297
+ var currentBundle = null;
298
+ var bundleResolve = null;
299
+ var bundlePromise = null;
300
+ var resolvedHost = host === "0.0.0.0" ? "localhost" : host;
301
+ var inputOptions = {
302
+ input: VIRTUAL_NATIVE_ENTRY,
303
+ cwd: root,
304
+ platform: "neutral",
305
+ resolve: getNativeResolveConfig(platform),
306
+ transform: getNativeTransformConfig(platform, true, root),
307
+ experimental: {
308
+ devMode: {
309
+ implement: hmrRuntimeSource,
310
+ host,
311
+ port
284
312
  },
285
- plugins: [nativeVirtualEntryPlugin(root, {
286
- dev: !0
287
- }), ...getNativePlugins(root, platform, viteImportGlobPlugin, !0), ...userPlugins]
313
+ incrementalBuild: true,
314
+ // lazyBarrel defers barrel re-export initialization — needed in dev mode
315
+ // to avoid breaking worklet closure serialization order.
316
+ // removed from prod builds (buildNativeBundle) where it caused build errors.
317
+ lazyBarrel: true
288
318
  },
289
- outputOptions = {
290
- ...getNativeOutputOptions(prelude),
291
- // connect HMR WebSocket using RN's WebSocket module (not the global)
292
- outro: `
319
+ treeshake: false,
320
+ // some react-native ecosystem packages import symbols that don't exist in
321
+ // the declared entry (e.g. @react-navigation/elements imports NavigationProvider
322
+ // from @react-navigation/native which doesn't export it). metro silently shims
323
+ // these — rolldown needs an explicit opt-in.
324
+ shimMissingExports: true,
325
+ moduleTypes: {
326
+ ".js": "jsx"
327
+ },
328
+ plugins: [nativeVirtualEntryPlugin(root, {
329
+ dev: true
330
+ }), ...getNativePlugins(root, platform, viteImportGlobPlugin, true), ...userPlugins]
331
+ };
332
+ var outputOptions = {
333
+ ...getNativeOutputOptions(prelude),
334
+ // connect HMR WebSocket using RN's WebSocket module (not the global)
335
+ outro: `
293
336
  try {
294
337
  var __WS = (init_WebSocket(), __toCommonJS(WebSocket_exports)).default;
295
338
  var __hmrUrl = 'ws://${resolvedHost}:${port}/hot';
@@ -318,69 +361,89 @@ try {
318
361
  __hmrWS.onerror = function(e) { console.warn('[vxrn] HMR connection error:', e.message || e); };
319
362
  } catch(e) {}
320
363
  `
321
- },
322
- engine = await dev(inputOptions, outputOptions, {
323
- onOutput: async function (result) {
324
- if (_instanceof(result, Error)) {
325
- console.error("[vxrn] native bundle error:", result.message);
326
- return;
327
- }
328
- var output = result,
329
- chunk = output.output.find(function (o) {
330
- return o.type === "chunk" && o.isEntry;
331
- });
332
- if (chunk && "code" in chunk) {
333
- var _chunk_map,
334
- code = postProcessNativeBundle(chunk.code);
335
- code = await downlevelClassFieldsInBundle(code);
336
- var hmrClientStub = 'registerCallableModule("HMRClient",{setup:function(){},enable:function(){},disable:function(){},registerBundle:function(){},log:function(){}})';
337
- code = code.replace(/registerCallableModule\s*\(\s*["']AppRegistry["']/, function (match) {
338
- return hmrClientStub + "," + match;
339
- }), currentBundle = {
340
- code,
341
- map: (_chunk_map = chunk.map) === null || _chunk_map === void 0 ? void 0 : _chunk_map.toString()
342
- }, console.info(`[vxrn] native bundle ready (${Math.round(chunk.code.length / 1024)}KB)`), bundleResolve && (bundleResolve(currentBundle), bundleResolve = null, bundlePromise = null);
343
- }
344
- },
345
- onHmrUpdates: async function (result) {
346
- if (_instanceof(result, Error)) {
347
- console.error("[vxrn] HMR error:", result.message), onHmrUpdate?.({
348
- type: "hmr:error"
349
- });
350
- return;
364
+ };
365
+ var engine = await dev(inputOptions, outputOptions, {
366
+ onOutput: async function (result) {
367
+ if (_instanceof(result, Error)) {
368
+ console.error("[vxrn] native bundle error:", result.message);
369
+ return;
370
+ }
371
+ var output = result;
372
+ var chunk = output.output.find(function (o) {
373
+ return o.type === "chunk" && o.isEntry;
374
+ });
375
+ if (chunk && "code" in chunk) {
376
+ var _chunk_map;
377
+ var code = postProcessNativeBundle(chunk.code);
378
+ code = await downlevelClassFieldsInBundle(code);
379
+ var hmrClientStub = `registerCallableModule("HMRClient",{setup:function(){},enable:function(){},disable:function(){},registerBundle:function(){},log:function(){}})`;
380
+ code = code.replace(/registerCallableModule\s*\(\s*["']AppRegistry["']/, function (match) {
381
+ return hmrClientStub + "," + match;
382
+ });
383
+ currentBundle = {
384
+ code,
385
+ map: (_chunk_map = chunk.map) === null || _chunk_map === void 0 ? void 0 : _chunk_map.toString()
386
+ };
387
+ console.info(`[vxrn] native bundle ready (${Math.round(chunk.code.length / 1024)}KB)`);
388
+ if (bundleResolve) {
389
+ bundleResolve(currentBundle);
390
+ bundleResolve = null;
391
+ bundlePromise = null;
351
392
  }
352
- var updates = result.updates || [],
353
- _iteratorNormalCompletion = !0,
354
- _didIteratorError = !1,
355
- _iteratorError = void 0;
356
- try {
357
- for (var _iterator = updates[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
358
- var item = _step.value,
359
- update = item.update || item;
360
- update.type === "Patch" && update.code ? onHmrUpdate?.({
393
+ }
394
+ },
395
+ onHmrUpdates: async function (result) {
396
+ if (_instanceof(result, Error)) {
397
+ console.error("[vxrn] HMR error:", result.message);
398
+ onHmrUpdate === null || onHmrUpdate === void 0 ? void 0 : onHmrUpdate({
399
+ type: "hmr:error"
400
+ });
401
+ return;
402
+ }
403
+ var updates = result.updates || [];
404
+ var _iteratorNormalCompletion = true,
405
+ _didIteratorError = false,
406
+ _iteratorError = void 0;
407
+ try {
408
+ for (var _iterator = updates[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
409
+ var item = _step.value;
410
+ var update = item.update || item;
411
+ if (update.type === "Patch" && update.code) {
412
+ onHmrUpdate === null || onHmrUpdate === void 0 ? void 0 : onHmrUpdate({
361
413
  type: "hmr:update",
362
414
  code: update.code
363
- }) : update.type === "FullReload" && onHmrUpdate?.({
415
+ });
416
+ } else if (update.type === "FullReload") {
417
+ onHmrUpdate === null || onHmrUpdate === void 0 ? void 0 : onHmrUpdate({
364
418
  type: "hmr:reload"
365
419
  });
366
420
  }
367
- } catch (err) {
368
- _didIteratorError = !0, _iteratorError = err;
421
+ }
422
+ } catch (err) {
423
+ _didIteratorError = true;
424
+ _iteratorError = err;
425
+ } finally {
426
+ try {
427
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
428
+ _iterator.return();
429
+ }
369
430
  } finally {
370
- try {
371
- !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
372
- } finally {
373
- if (_didIteratorError) throw _iteratorError;
431
+ if (_didIteratorError) {
432
+ throw _iteratorError;
374
433
  }
375
434
  }
376
- updates.length === 0 && onHmrUpdate?.({
435
+ }
436
+ if (updates.length === 0) {
437
+ onHmrUpdate === null || onHmrUpdate === void 0 ? void 0 : onHmrUpdate({
377
438
  type: "hmr:reload"
378
439
  });
379
- },
380
- rebuildStrategy: "auto",
381
- watch: {}
382
- });
383
- return await engine.run(), {
440
+ }
441
+ },
442
+ rebuildStrategy: "auto",
443
+ watch: {}
444
+ });
445
+ await engine.run();
446
+ return {
384
447
  engine,
385
448
  async getBundle() {
386
449
  if (currentBundle) return currentBundle;
@@ -388,13 +451,17 @@ try {
388
451
  var timeoutId;
389
452
  bundlePromise = new Promise(function (resolve2, reject) {
390
453
  bundleResolve = function (value) {
391
- clearTimeout(timeoutId), resolve2(value);
392
- }, timeoutId = setTimeout(function () {
454
+ clearTimeout(timeoutId);
455
+ resolve2(value);
456
+ };
457
+ timeoutId = setTimeout(function () {
393
458
  return reject(new Error("[vxrn] bundle build timed out after 120s"));
394
459
  }, 12e4);
395
460
  });
396
461
  }
397
- return await engine.ensureLatestBuildOutput(), currentBundle || bundlePromise;
462
+ await engine.ensureLatestBuildOutput();
463
+ if (currentBundle) return currentBundle;
464
+ return bundlePromise;
398
465
  },
399
466
  async close() {
400
467
  await engine.close();
@@ -402,72 +469,75 @@ try {
402
469
  };
403
470
  }
404
471
  async function buildNativeBundle(options) {
405
- var _chunk_map,
406
- {
407
- root,
408
- platform,
409
- dev = !1,
410
- serverUrl,
411
- plugins: userPlugins = []
412
- } = options,
413
- {
414
- build
415
- } = await import("rolldown"),
416
- {
417
- viteImportGlobPlugin
418
- } = await import("rolldown/experimental"),
419
- prelude = getNativePrelude({
420
- dev,
421
- platform,
422
- serverUrl
423
- }),
424
- result = await build({
425
- input: VIRTUAL_NATIVE_ENTRY,
426
- cwd: root,
427
- platform: "neutral",
428
- resolve: getNativeResolveConfig(platform),
429
- transform: getNativeTransformConfig(platform, dev, root),
430
- treeshake: !dev,
431
- shimMissingExports: !0,
432
- moduleTypes: {
433
- ".js": "jsx"
434
- },
435
- plugins: [nativeVirtualEntryPlugin(root, {
436
- dev
437
- }), ...getNativePlugins(root, platform, viteImportGlobPlugin, dev), ...userPlugins],
438
- output: getNativeOutputOptions(prelude)
439
- }),
440
- chunk = result.output.find(function (o) {
441
- return o.type === "chunk" && o.isEntry;
442
- });
443
- if (!chunk || !("code" in chunk)) throw new Error("[vxrn] production build produced no output");
472
+ var _chunk_map;
473
+ var {
474
+ root,
475
+ platform,
476
+ dev = false,
477
+ serverUrl,
478
+ plugins: userPlugins = []
479
+ } = options;
480
+ var {
481
+ build
482
+ } = await import("rolldown");
483
+ var {
484
+ viteImportGlobPlugin
485
+ } = await import("rolldown/experimental");
486
+ var prelude = getNativePrelude({
487
+ dev,
488
+ platform,
489
+ serverUrl
490
+ });
491
+ var result = await build({
492
+ input: VIRTUAL_NATIVE_ENTRY,
493
+ cwd: root,
494
+ platform: "neutral",
495
+ resolve: getNativeResolveConfig(platform),
496
+ transform: getNativeTransformConfig(platform, dev, root),
497
+ treeshake: !dev,
498
+ shimMissingExports: true,
499
+ moduleTypes: {
500
+ ".js": "jsx"
501
+ },
502
+ plugins: [nativeVirtualEntryPlugin(root, {
503
+ dev
504
+ }), ...getNativePlugins(root, platform, viteImportGlobPlugin, dev), ...userPlugins],
505
+ output: getNativeOutputOptions(prelude)
506
+ });
507
+ var chunk = result.output.find(function (o) {
508
+ return o.type === "chunk" && o.isEntry;
509
+ });
510
+ if (!chunk || !("code" in chunk)) {
511
+ throw new Error("[vxrn] production build produced no output");
512
+ }
444
513
  var code = postProcessNativeBundle(chunk.code);
445
- return code = await downlevelClassFieldsInBundle(code), {
514
+ code = await downlevelClassFieldsInBundle(code);
515
+ return {
446
516
  code,
447
517
  map: (_chunk_map = chunk.map) === null || _chunk_map === void 0 ? void 0 : _chunk_map.toString()
448
518
  };
449
519
  }
450
520
  var VIRTUAL_NATIVE_ENTRY = "virtual:native-entry";
451
521
  function nativeVirtualEntryPlugin(root, opts) {
452
- var isDev = opts?.dev !== !1,
453
- resolvedId = resolve(root, "__virtual-native-entry.tsx"),
454
- entryConfig = globalThis.__vxrnNativeEntryConfig || {},
455
- routerRoot = entryConfig.routerRoot || "app",
456
- flags = entryConfig.flags || {},
457
- setupFileImport = function () {
458
- var sf = entryConfig.setupFile;
459
- if (!sf) return "";
460
- var file = typeof sf == "string" ? sf : "native" in sf ? sf.native : sf.ios;
461
- if (!file) return "";
462
- var resolved = resolve(root, file);
463
- return `import ${JSON.stringify(resolved)};`;
464
- }(),
465
- routeGlobs = [`./${routerRoot}/**/*.tsx`, `./${routerRoot}/**/*.ts`, `!./${routerRoot}/**/*+api.*`, `!./${routerRoot}/**/*.test.*`, `!./${routerRoot}/**/*.d.ts`, `!./${routerRoot}/**/*.server.*`, `!./${routerRoot}/**/_middleware.*`, `!./${routerRoot}/**/*.web.*`,
466
- // ignoredRouteFiles from One's router config
467
- ...(entryConfig.ignoredRouteFiles || []).map(function (pattern) {
468
- return `!./${routerRoot}/${pattern}`;
469
- })],
470
- refreshSetup = isDev ? `
522
+ var isDev = (opts === null || opts === void 0 ? void 0 : opts.dev) !== false;
523
+ var resolvedId = resolve(root, "__virtual-native-entry.tsx");
524
+ var entryConfig = globalThis.__vxrnNativeEntryConfig || {};
525
+ var routerRoot = entryConfig.routerRoot || "app";
526
+ var flags = entryConfig.flags || {};
527
+ var setupFileImport = function () {
528
+ var sf = entryConfig.setupFile;
529
+ if (!sf) return "";
530
+ var file = typeof sf === "string" ? sf : "native" in sf ? sf.native : sf.ios;
531
+ if (!file) return "";
532
+ var resolved = resolve(root, file);
533
+ return `import ${JSON.stringify(resolved)};`;
534
+ }();
535
+ var routeGlobs = [`./${routerRoot}/**/*.tsx`, `./${routerRoot}/**/*.ts`, `!./${routerRoot}/**/*+api.*`, `!./${routerRoot}/**/*.test.*`, `!./${routerRoot}/**/*.d.ts`, `!./${routerRoot}/**/*.server.*`, `!./${routerRoot}/**/_middleware.*`, `!./${routerRoot}/**/*.web.*`,
536
+ // ignoredRouteFiles from One's router config
537
+ ...(entryConfig.ignoredRouteFiles || []).map(function (pattern) {
538
+ return `!./${routerRoot}/${pattern}`;
539
+ })];
540
+ var refreshSetup = isDev ? `
471
541
  // react-refresh/runtime MUST initialize before React loads
472
542
  import RefreshRuntime from 'react-refresh/runtime';
473
543
  RefreshRuntime.injectIntoGlobalHook(globalThis);
@@ -476,8 +546,8 @@ globalThis.$RefreshReg$ = function(type, id) {
476
546
  RefreshRuntime.register(type, id);
477
547
  };
478
548
  globalThis.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;
479
- ` : "",
480
- entryCode = `
549
+ ` : "";
550
+ var entryCode = `
481
551
  ${refreshSetup}
482
552
  ${setupFileImport}
483
553
  import { createApp } from 'one';
@@ -498,10 +568,28 @@ createApp({
498
568
  return {
499
569
  name: "vxrn:native-virtual-entry",
500
570
  resolveId(id) {
501
- if (id === VIRTUAL_NATIVE_ENTRY) return resolvedId;
571
+ if (id === VIRTUAL_NATIVE_ENTRY) {
572
+ return resolvedId;
573
+ }
502
574
  },
503
575
  load(id) {
504
- if (id === resolvedId) return entryCode;
576
+ if (id === resolvedId) {
577
+ return entryCode;
578
+ }
579
+ }
580
+ };
581
+ }
582
+ function nativeAnimatedGuardPlugin() {
583
+ return {
584
+ name: "vxrn:native-animated-guard",
585
+ transform(code, id) {
586
+ if (!id.includes("animated/NativeAnimatedHelper")) return;
587
+ var target = "const method = nullthrows(NativeAnimatedModule)[methodName];";
588
+ if (!code.includes(target)) return;
589
+ return {
590
+ code: code.replace(target, `const method = nullthrows(NativeAnimatedModule)[methodName];
591
+ if (typeof method !== 'function') return;`)
592
+ };
505
593
  }
506
594
  };
507
595
  }
@@ -509,35 +597,39 @@ function serverFileExclusionPlugin() {
509
597
  return {
510
598
  name: "vxrn:server-file-exclusion",
511
599
  load(id) {
512
- if (/\.server\.\w+$/.test(id)) return {
513
- code: "export default undefined;",
514
- moduleType: "js"
515
- };
516
- if (/[\\/]_middleware\.\w+$/.test(id)) return {
517
- code: "export default undefined;",
518
- moduleType: "js"
519
- };
600
+ if (/\.server\.\w+$/.test(id)) {
601
+ return {
602
+ code: "export default undefined;",
603
+ moduleType: "js"
604
+ };
605
+ }
606
+ if (/[\\/]_middleware\.\w+$/.test(id)) {
607
+ return {
608
+ code: "export default undefined;",
609
+ moduleType: "js"
610
+ };
611
+ }
520
612
  }
521
613
  };
522
614
  }
523
615
  function environmentGuardPlugin() {
524
- var THROWING = ["server-only", "client-only", "web-only"],
525
- NOOP = ["native-only"];
616
+ var THROWING = ["server-only", "client-only", "web-only"];
617
+ var NOOP = ["native-only"];
526
618
  return {
527
619
  name: "vxrn:environment-guard",
528
620
  resolveId(source) {
529
621
  if (THROWING.includes(source)) return {
530
622
  id: `\0env-guard-throw:${source}`,
531
- external: !1
623
+ external: false
532
624
  };
533
625
  if (NOOP.includes(source)) return {
534
626
  id: `\0env-guard-noop:${source}`,
535
- external: !1
627
+ external: false
536
628
  };
537
629
  },
538
630
  load(id) {
539
631
  if (id.startsWith("\0env-guard-throw:")) {
540
- var pkg = id.slice(17);
632
+ var pkg = id.slice("\0env-guard-throw:".length);
541
633
  return {
542
634
  code: `throw new Error("Cannot import '${pkg}' in a native bundle.");`,
543
635
  moduleType: "js"
@@ -555,48 +647,51 @@ function cssStubPlugin() {
555
647
  name: "vxrn:css-stub",
556
648
  load: {
557
649
  handler(id) {
558
- if (/\.css$/.test(id)) return {
559
- code: "",
560
- moduleType: "js"
561
- };
650
+ if (id.endsWith(".css")) {
651
+ return {
652
+ code: "",
653
+ moduleType: "js"
654
+ };
655
+ }
562
656
  }
563
657
  }
564
658
  };
565
659
  }
566
660
  function vxrnCompilerPlugin(platform, dev) {
567
- var compiler = null,
568
- isRefreshCandidate = function (id) {
569
- return dev && !id.includes("node_modules") && !id.includes("__virtual-native-entry") && /\.[tj]sx?$/.test(id);
570
- };
661
+ var compiler = null;
662
+ var isRefreshCandidate = function (id) {
663
+ return dev && !id.includes("node_modules") && !id.includes("__virtual-native-entry") && /\.[tj]sx?$/.test(id);
664
+ };
571
665
  return {
572
666
  name: "vxrn:compiler",
573
667
  async transform(code, id) {
574
- if (/\.[cm]?[jt]sx?$/.test(id) && !(id.includes("\0") || id.includes("virtual:"))) {
575
- var needsRefresh = isRefreshCandidate(id);
576
- try {
577
- compiler || (compiler = await import("@vxrn/compiler"));
578
- var props = {
579
- id,
580
- code,
581
- development: dev,
582
- environment: platform,
583
- reactForRNVersion: "19"
584
- },
585
- babelOptions = compiler.getBabelOptions(props);
668
+ if (!/\.[cm]?[jt]sx?$/.test(id)) return;
669
+ if (id.includes("\0") || id.includes("virtual:")) return;
670
+ var needsRefresh = isRefreshCandidate(id);
671
+ try {
672
+ if (!compiler) compiler = await import("@vxrn/compiler");
673
+ var props = {
674
+ id,
675
+ code,
676
+ development: dev,
677
+ environment: platform,
678
+ reactForRNVersion: "19"
679
+ };
680
+ var babelOptions = compiler.getBabelOptions(props);
681
+ if (needsRefresh) {
682
+ var existingPlugins = (babelOptions === null || babelOptions === void 0 ? void 0 : babelOptions.plugins) || [];
683
+ babelOptions = {
684
+ ...babelOptions,
685
+ plugins: [...existingPlugins, "react-refresh/babel"]
686
+ };
687
+ }
688
+ if (!babelOptions) return;
689
+ var result = await compiler.transformBabel(id, code, babelOptions);
690
+ if (result === null || result === void 0 ? void 0 : result.code) {
691
+ var out = result.code;
586
692
  if (needsRefresh) {
587
- var existingPlugins = babelOptions?.plugins || [];
588
- babelOptions = {
589
- ...babelOptions,
590
- plugins: [...existingPlugins, "react-refresh/babel"]
591
- };
592
- }
593
- if (!babelOptions) return;
594
- var result = await compiler.transformBabel(id, code, babelOptions);
595
- if (result?.code) {
596
- var out = result.code;
597
- if (needsRefresh) {
598
- var escapedId = id.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
599
- out = `
693
+ var escapedId = id.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
694
+ out = `
600
695
  var __prevRefreshReg = globalThis.$RefreshReg$;
601
696
  var __prevRefreshSig = globalThis.$RefreshSig$;
602
697
  if (globalThis.__ReactRefresh) {
@@ -618,13 +713,17 @@ if (import.meta.hot) {
618
713
  });
619
714
  }
620
715
  `;
621
- }
622
- return {
623
- code: out
624
- };
625
716
  }
626
- } catch (err) {
627
- if (dev && console.warn(`[vxrn:compiler] ${id}: ${err.message || err}`), needsRefresh) return {
717
+ return {
718
+ code: out
719
+ };
720
+ }
721
+ } catch (err) {
722
+ if (dev) {
723
+ console.warn(`[vxrn:compiler] ${id}: ${err.message || err}`);
724
+ }
725
+ if (needsRefresh) {
726
+ return {
628
727
  code: code + `
629
728
  if (import.meta.hot) { import.meta.hot.accept(); }
630
729
  `
@@ -639,15 +738,16 @@ function flowStripPlugin() {
639
738
  name: "vxrn:flow-strip",
640
739
  transform: {
641
740
  async handler(code, id) {
642
- if (FLOW_FILE_PATTERN.test(id)) try {
643
- var fft = await import("fast-flow-transform"),
644
- result = await fft.default({
645
- filename: id,
646
- source: code,
647
- sourcemap: !0,
648
- dialect: "flow",
649
- format: "pretty"
650
- });
741
+ if (!FLOW_FILE_PATTERN.test(id)) return;
742
+ try {
743
+ var fft = await import("fast-flow-transform");
744
+ var result = await fft.default({
745
+ filename: id,
746
+ source: code,
747
+ sourcemap: true,
748
+ dialect: "flow",
749
+ format: "pretty"
750
+ });
651
751
  return {
652
752
  code: result.code,
653
753
  map: result.map
@@ -665,36 +765,38 @@ function assetPlugin(opts) {
665
765
  name: "vxrn:asset",
666
766
  load: {
667
767
  async handler(id) {
668
- if (assetRegex.test(id)) {
669
- var ext = extname(id).slice(1),
670
- name = basename(id, `.${ext}`),
671
- dir = dirname(id),
672
- relativePath = relative(opts.root, id),
673
- httpLocation = "/assets/" + dirname(relativePath),
674
- assetData = {
675
- __packager_asset: !0,
676
- name,
677
- type: ext,
678
- scales: [1],
679
- httpServerLocation: httpLocation,
680
- fileSystemLocation: dir,
681
- hash: "",
682
- width: void 0,
683
- height: void 0
684
- };
685
- if (["png", "jpg", "jpeg", "gif", "webp", "bmp"].includes(ext)) try {
768
+ if (!assetRegex.test(id)) return;
769
+ var ext = extname(id).slice(1);
770
+ var name = basename(id, `.${ext}`);
771
+ var dir = dirname(id);
772
+ var relativePath = relative(opts.root, id);
773
+ var httpLocation = "/assets/" + dirname(relativePath);
774
+ var assetData = {
775
+ __packager_asset: true,
776
+ name,
777
+ type: ext,
778
+ scales: [1],
779
+ httpServerLocation: httpLocation,
780
+ fileSystemLocation: dir,
781
+ hash: "",
782
+ width: void 0,
783
+ height: void 0
784
+ };
785
+ if (["png", "jpg", "jpeg", "gif", "webp", "bmp"].includes(ext)) {
786
+ try {
686
787
  var {
687
- imageSize
688
- } = await import("image-size"),
689
- dims = imageSize(id);
690
- assetData.width = dims.width, assetData.height = dims.height;
691
- } catch {}
692
- var code = `module.exports = require('react-native/Libraries/Image/AssetRegistry').registerAsset(${JSON.stringify(assetData)});`;
693
- return {
694
- code,
695
- moduleType: "js"
696
- };
788
+ imageSize
789
+ } = await import("image-size");
790
+ var dims = imageSize(id);
791
+ assetData.width = dims.width;
792
+ assetData.height = dims.height;
793
+ } catch (unused) {}
697
794
  }
795
+ var code = `module.exports = require('react-native/Libraries/Image/AssetRegistry').registerAsset(${JSON.stringify(assetData)});`;
796
+ return {
797
+ code,
798
+ moduleType: "js"
799
+ };
698
800
  }
699
801
  }
700
802
  };
@@ -704,47 +806,49 @@ function hermesCompatSWCPlugin(dev) {
704
806
  return {
705
807
  name: "vxrn:hermes-compat",
706
808
  async transform(code, id) {
707
- if (/\.[cm]?[jt]sx?$/.test(id) && !(id.includes("\0") || id.includes("virtual:"))) {
708
- var hasClass = code.includes("class ") || code.includes("class{"),
709
- hasAsync = !dev && code.includes("async ");
710
- if (!(!hasClass && !hasAsync) && !(code.length > 5e5)) try {
711
- swc || (swc = await import("@swc/core"));
712
- var envIncludes = ["transform-class-properties", "transform-class-static-block", "transform-private-methods", "transform-private-property-in-object", ...(dev ? [] : ["transform-classes", "transform-async-to-generator"])],
713
- result = await swc.transform(code, {
714
- filename: id,
715
- configFile: !1,
716
- swcrc: !1,
717
- sourceMaps: !1,
718
- inputSourceMap: !1,
719
- env: {
720
- targets: {
721
- node: 9999
722
- },
723
- include: envIncludes
724
- },
725
- jsc: {
726
- parser: {
727
- syntax: "typescript",
728
- tsx: !0
729
- },
730
- transform: {
731
- react: {
732
- runtime: "preserve"
733
- }
734
- },
735
- externalHelpers: !1,
736
- assumptions: {
737
- setPublicClassFields: !0,
738
- privateFieldsAsProperties: !0
739
- }
740
- },
741
- isModule: !id.endsWith(".cjs")
742
- });
743
- return {
744
- code: result.code
745
- };
746
- } catch {}
747
- }
809
+ if (!/\.[cm]?[jt]sx?$/.test(id)) return;
810
+ if (id.includes("\0") || id.includes("virtual:")) return;
811
+ var hasClass = code.includes("class ") || code.includes("class{");
812
+ var hasAsync = !dev && code.includes("async ");
813
+ if (!hasClass && !hasAsync) return;
814
+ if (code.length > 5e5) return;
815
+ try {
816
+ if (!swc) swc = await import("@swc/core");
817
+ var envIncludes = ["transform-class-properties", "transform-class-static-block", "transform-private-methods", "transform-private-property-in-object", ...(!dev ? ["transform-classes", "transform-async-to-generator"] : [])];
818
+ var result = await swc.transform(code, {
819
+ filename: id,
820
+ configFile: false,
821
+ swcrc: false,
822
+ sourceMaps: false,
823
+ inputSourceMap: false,
824
+ env: {
825
+ targets: {
826
+ node: 9999
827
+ },
828
+ include: envIncludes
829
+ },
830
+ jsc: {
831
+ parser: {
832
+ syntax: "typescript",
833
+ tsx: true
834
+ },
835
+ transform: {
836
+ react: {
837
+ runtime: "preserve"
838
+ }
839
+ },
840
+ externalHelpers: false,
841
+ assumptions: {
842
+ setPublicClassFields: true,
843
+ privateFieldsAsProperties: true
844
+ }
845
+ },
846
+ isModule: !id.endsWith(".cjs")
847
+ });
848
+ return {
849
+ code: result.code
850
+ };
851
+ } catch (err) {}
748
852
  }
749
853
  };
750
854
  }