vxrn 1.27.1 → 2.0.0-beta.45.1

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 (456) hide show
  1. package/dist/cli.mjs +212 -261
  2. package/dist/cli.mjs.map +1 -1
  3. package/dist/cli.native.js +216 -265
  4. package/dist/cli.native.js.map +1 -1
  5. package/dist/config/getAdditionalViteConfig.mjs +33 -62
  6. package/dist/config/getAdditionalViteConfig.mjs.map +1 -1
  7. package/dist/config/getAdditionalViteConfig.native.js +33 -62
  8. package/dist/config/getAdditionalViteConfig.native.js.map +1 -1
  9. package/dist/config/getBaseViteConfigOnly.mjs +84 -77
  10. package/dist/config/getBaseViteConfigOnly.mjs.map +1 -1
  11. package/dist/config/getBaseViteConfigOnly.native.js +86 -79
  12. package/dist/config/getBaseViteConfigOnly.native.js.map +1 -1
  13. package/dist/config/getBaseViteConfigWithPlugins.mjs +6 -4
  14. package/dist/config/getBaseViteConfigWithPlugins.mjs.map +1 -1
  15. package/dist/config/getBaseViteConfigWithPlugins.native.js +6 -4
  16. package/dist/config/getBaseViteConfigWithPlugins.native.js.map +1 -1
  17. package/dist/config/getBaseVitePlugins.mjs +102 -130
  18. package/dist/config/getBaseVitePlugins.mjs.map +1 -1
  19. package/dist/config/getBaseVitePlugins.native.js +123 -152
  20. package/dist/config/getBaseVitePlugins.native.js.map +1 -1
  21. package/dist/config/getNonCliModeOnlyVitePlugins.mjs +3 -3
  22. package/dist/config/getNonCliModeOnlyVitePlugins.mjs.map +1 -1
  23. package/dist/config/getNonCliModeOnlyVitePlugins.native.js +3 -1
  24. package/dist/config/getNonCliModeOnlyVitePlugins.native.js.map +1 -1
  25. package/dist/config/getOptimizeDeps.mjs +138 -42
  26. package/dist/config/getOptimizeDeps.mjs.map +1 -1
  27. package/dist/config/getOptimizeDeps.native.js +138 -42
  28. package/dist/config/getOptimizeDeps.native.js.map +1 -1
  29. package/dist/config/getOptionsFilled.mjs +48 -52
  30. package/dist/config/getOptionsFilled.mjs.map +1 -1
  31. package/dist/config/getOptionsFilled.native.js +51 -55
  32. package/dist/config/getOptionsFilled.native.js.map +1 -1
  33. package/dist/config/getReactNativePlugins.mjs +23 -15
  34. package/dist/config/getReactNativePlugins.mjs.map +1 -1
  35. package/dist/config/getReactNativePlugins.native.js +25 -16
  36. package/dist/config/getReactNativePlugins.native.js.map +1 -1
  37. package/dist/config/getServerOptionsFilled.mjs +33 -35
  38. package/dist/config/getServerOptionsFilled.mjs.map +1 -1
  39. package/dist/config/getServerOptionsFilled.native.js +35 -38
  40. package/dist/config/getServerOptionsFilled.native.js.map +1 -1
  41. package/dist/config/getViteServerConfig.mjs +34 -45
  42. package/dist/config/getViteServerConfig.mjs.map +1 -1
  43. package/dist/config/getViteServerConfig.native.js +35 -46
  44. package/dist/config/getViteServerConfig.native.js.map +1 -1
  45. package/dist/config/mergeUserConfig.mjs +50 -28
  46. package/dist/config/mergeUserConfig.mjs.map +1 -1
  47. package/dist/config/mergeUserConfig.native.js +60 -38
  48. package/dist/config/mergeUserConfig.native.js.map +1 -1
  49. package/dist/constants/defaults.mjs +29 -12
  50. package/dist/constants/defaults.mjs.map +1 -1
  51. package/dist/constants/defaults.native.js +29 -12
  52. package/dist/constants/defaults.native.js.map +1 -1
  53. package/dist/constants.mjs +41 -6
  54. package/dist/constants.mjs.map +1 -1
  55. package/dist/constants.native.js +41 -6
  56. package/dist/constants.native.js.map +1 -1
  57. package/dist/exports/build.mjs +218 -270
  58. package/dist/exports/build.mjs.map +1 -1
  59. package/dist/exports/build.native.js +226 -283
  60. package/dist/exports/build.native.js.map +1 -1
  61. package/dist/exports/clean.mjs +71 -78
  62. package/dist/exports/clean.mjs.map +1 -1
  63. package/dist/exports/clean.native.js +76 -90
  64. package/dist/exports/clean.native.js.map +1 -1
  65. package/dist/exports/createServer.mjs +43 -46
  66. package/dist/exports/createServer.mjs.map +1 -1
  67. package/dist/exports/createServer.native.js +45 -48
  68. package/dist/exports/createServer.native.js.map +1 -1
  69. package/dist/exports/dev.mjs +177 -201
  70. package/dist/exports/dev.mjs.map +1 -1
  71. package/dist/exports/dev.native.js +191 -215
  72. package/dist/exports/dev.native.js.map +1 -1
  73. package/dist/exports/loadEnv.mjs +51 -48
  74. package/dist/exports/loadEnv.mjs.map +1 -1
  75. package/dist/exports/loadEnv.native.js +59 -57
  76. package/dist/exports/loadEnv.native.js.map +1 -1
  77. package/dist/exports/patch.mjs +9 -7
  78. package/dist/exports/patch.mjs.map +1 -1
  79. package/dist/exports/patch.native.js +9 -7
  80. package/dist/exports/patch.native.js.map +1 -1
  81. package/dist/exports/prebuild.mjs +177 -157
  82. package/dist/exports/prebuild.mjs.map +1 -1
  83. package/dist/exports/prebuild.native.js +197 -160
  84. package/dist/exports/prebuild.native.js.map +1 -1
  85. package/dist/exports/prebuildWithoutExpo.mjs +46 -44
  86. package/dist/exports/prebuildWithoutExpo.mjs.map +1 -1
  87. package/dist/exports/prebuildWithoutExpo.native.js +48 -46
  88. package/dist/exports/prebuildWithoutExpo.native.js.map +1 -1
  89. package/dist/exports/runAndroid.mjs +9 -10
  90. package/dist/exports/runAndroid.mjs.map +1 -1
  91. package/dist/exports/runAndroid.native.js +10 -11
  92. package/dist/exports/runAndroid.native.js.map +1 -1
  93. package/dist/exports/runIos.mjs +9 -10
  94. package/dist/exports/runIos.mjs.map +1 -1
  95. package/dist/exports/runIos.native.js +10 -11
  96. package/dist/exports/runIos.native.js.map +1 -1
  97. package/dist/exports/serve.mjs +23 -31
  98. package/dist/exports/serve.mjs.map +1 -1
  99. package/dist/exports/serve.native.js +26 -34
  100. package/dist/exports/serve.native.js.map +1 -1
  101. package/dist/exports/serveStaticAssets.mjs +109 -113
  102. package/dist/exports/serveStaticAssets.mjs.map +1 -1
  103. package/dist/exports/serveStaticAssets.native.js +180 -192
  104. package/dist/exports/serveStaticAssets.native.js.map +1 -1
  105. package/dist/index.js +25 -14
  106. package/dist/index.mjs +25 -14
  107. package/dist/index.native.js +25 -14
  108. package/dist/patches/builtInDepPatches.mjs +346 -435
  109. package/dist/patches/builtInDepPatches.mjs.map +1 -1
  110. package/dist/patches/builtInDepPatches.native.js +349 -438
  111. package/dist/patches/builtInDepPatches.native.js.map +1 -1
  112. package/dist/plugins/applyBuiltInPatchesPlugin.mjs +11 -11
  113. package/dist/plugins/applyBuiltInPatchesPlugin.mjs.map +1 -1
  114. package/dist/plugins/applyBuiltInPatchesPlugin.native.js +11 -11
  115. package/dist/plugins/applyBuiltInPatchesPlugin.native.js.map +1 -1
  116. package/dist/plugins/autoDepOptimizePlugin.mjs +87 -90
  117. package/dist/plugins/autoDepOptimizePlugin.mjs.map +1 -1
  118. package/dist/plugins/autoDepOptimizePlugin.native.js +99 -102
  119. package/dist/plugins/autoDepOptimizePlugin.native.js.map +1 -1
  120. package/dist/plugins/clientInjectPlugin.mjs +13 -11
  121. package/dist/plugins/clientInjectPlugin.mjs.map +1 -1
  122. package/dist/plugins/clientInjectPlugin.native.js +13 -11
  123. package/dist/plugins/clientInjectPlugin.native.js.map +1 -1
  124. package/dist/plugins/defaultDepOptimizePlugin.mjs +15 -23
  125. package/dist/plugins/defaultDepOptimizePlugin.mjs.map +1 -1
  126. package/dist/plugins/defaultDepOptimizePlugin.native.js +15 -23
  127. package/dist/plugins/defaultDepOptimizePlugin.native.js.map +1 -1
  128. package/dist/plugins/expoManifestRequestHandlerPlugin.mjs +163 -179
  129. package/dist/plugins/expoManifestRequestHandlerPlugin.mjs.map +1 -1
  130. package/dist/plugins/expoManifestRequestHandlerPlugin.native.js +169 -191
  131. package/dist/plugins/expoManifestRequestHandlerPlugin.native.js.map +1 -1
  132. package/dist/plugins/getResolvedConfigSubset.mjs +6 -5
  133. package/dist/plugins/getResolvedConfigSubset.mjs.map +1 -1
  134. package/dist/plugins/getResolvedConfigSubset.native.js +6 -5
  135. package/dist/plugins/getResolvedConfigSubset.native.js.map +1 -1
  136. package/dist/plugins/reactNativeCommonJsPlugin.mjs +210 -178
  137. package/dist/plugins/reactNativeCommonJsPlugin.mjs.map +1 -1
  138. package/dist/plugins/reactNativeCommonJsPlugin.native.js +283 -259
  139. package/dist/plugins/reactNativeCommonJsPlugin.native.js.map +1 -1
  140. package/dist/plugins/reactNativeDevAssetPlugin.mjs +72 -83
  141. package/dist/plugins/reactNativeDevAssetPlugin.mjs.map +1 -1
  142. package/dist/plugins/reactNativeDevAssetPlugin.native.js +75 -92
  143. package/dist/plugins/reactNativeDevAssetPlugin.native.js.map +1 -1
  144. package/dist/plugins/reactNativeDevServer.mjs +283 -328
  145. package/dist/plugins/reactNativeDevServer.mjs.map +1 -1
  146. package/dist/plugins/reactNativeDevServer.native.js +332 -391
  147. package/dist/plugins/reactNativeDevServer.native.js.map +1 -1
  148. package/dist/plugins/rnCodegenPlugin.mjs +13 -12
  149. package/dist/plugins/rnCodegenPlugin.mjs.map +1 -1
  150. package/dist/plugins/rnCodegenPlugin.native.js +13 -12
  151. package/dist/plugins/rnCodegenPlugin.native.js.map +1 -1
  152. package/dist/plugins/rollupRemoveUnusedImports.mjs +8 -7
  153. package/dist/plugins/rollupRemoveUnusedImports.mjs.map +1 -1
  154. package/dist/plugins/rollupRemoveUnusedImports.native.js +8 -7
  155. package/dist/plugins/rollupRemoveUnusedImports.native.js.map +1 -1
  156. package/dist/plugins/workletImportsPlugin.mjs +127 -132
  157. package/dist/plugins/workletImportsPlugin.mjs.map +1 -1
  158. package/dist/plugins/workletImportsPlugin.native.js +192 -203
  159. package/dist/plugins/workletImportsPlugin.native.js.map +1 -1
  160. package/dist/rn-commands/bundle/buildBundle.mjs +45 -79
  161. package/dist/rn-commands/bundle/buildBundle.mjs.map +1 -1
  162. package/dist/rn-commands/bundle/buildBundle.native.js +45 -85
  163. package/dist/rn-commands/bundle/buildBundle.native.js.map +1 -1
  164. package/dist/runtime/hmr-client.mjs +133 -140
  165. package/dist/runtime/hmr-client.mjs.map +1 -1
  166. package/dist/runtime/hmr-client.native.js +223 -222
  167. package/dist/runtime/hmr-client.native.js.map +1 -1
  168. package/dist/runtime/hmr-runtime.mjs +192 -194
  169. package/dist/runtime/hmr-runtime.mjs.map +1 -1
  170. package/dist/runtime/hmr-runtime.native.js +424 -411
  171. package/dist/runtime/hmr-runtime.native.js.map +1 -1
  172. package/dist/runtime/hmr-types.mjs +0 -2
  173. package/dist/runtime/hmr-types.native.js +0 -2
  174. package/dist/runtime/native-prelude.mjs +2 -1
  175. package/dist/runtime/native-prelude.mjs.map +1 -1
  176. package/dist/runtime/native-prelude.native.js +2 -1
  177. package/dist/runtime/native-prelude.native.js.map +1 -1
  178. package/dist/runtime/react-refresh-utils.mjs +23 -22
  179. package/dist/runtime/react-refresh-utils.mjs.map +1 -1
  180. package/dist/runtime/react-refresh-utils.native.js +23 -27
  181. package/dist/runtime/react-refresh-utils.native.js.map +1 -1
  182. package/dist/serve/node.mjs +49 -49
  183. package/dist/serve/node.mjs.map +1 -1
  184. package/dist/serve/node.native.js +92 -96
  185. package/dist/serve/node.native.js.map +1 -1
  186. package/dist/types.mjs +0 -2
  187. package/dist/types.native.js +0 -2
  188. package/dist/user-interface/index.mjs +245 -262
  189. package/dist/user-interface/index.mjs.map +1 -1
  190. package/dist/user-interface/index.native.js +274 -298
  191. package/dist/user-interface/index.native.js.map +1 -1
  192. package/dist/utils/assert.mjs +7 -6
  193. package/dist/utils/assert.mjs.map +1 -1
  194. package/dist/utils/assert.native.js +7 -18
  195. package/dist/utils/assert.native.js.map +1 -1
  196. package/dist/utils/bindKeypressInput.mjs +36 -38
  197. package/dist/utils/bindKeypressInput.mjs.map +1 -1
  198. package/dist/utils/bindKeypressInput.native.js +36 -38
  199. package/dist/utils/bindKeypressInput.native.js.map +1 -1
  200. package/dist/utils/coerceToArray.mjs +2 -1
  201. package/dist/utils/coerceToArray.mjs.map +1 -1
  202. package/dist/utils/coerceToArray.native.js +2 -1
  203. package/dist/utils/coerceToArray.native.js.map +1 -1
  204. package/dist/utils/connectedNativeClients.mjs +3 -2
  205. package/dist/utils/connectedNativeClients.mjs.map +1 -1
  206. package/dist/utils/connectedNativeClients.native.js +3 -2
  207. package/dist/utils/connectedNativeClients.native.js.map +1 -1
  208. package/dist/utils/createNativeDevEngine.mjs +992 -966
  209. package/dist/utils/createNativeDevEngine.mjs.map +1 -1
  210. package/dist/utils/createNativeDevEngine.native.js +1184 -1179
  211. package/dist/utils/createNativeDevEngine.native.js.map +1 -1
  212. package/dist/utils/dispose.mjs +4 -3
  213. package/dist/utils/dispose.mjs.map +1 -1
  214. package/dist/utils/dispose.native.js +6 -5
  215. package/dist/utils/dispose.native.js.map +1 -1
  216. package/dist/utils/environmentUtils.mjs +5 -4
  217. package/dist/utils/environmentUtils.mjs.map +1 -1
  218. package/dist/utils/environmentUtils.native.js +5 -4
  219. package/dist/utils/environmentUtils.native.js.map +1 -1
  220. package/dist/utils/execSync.mjs +7 -5
  221. package/dist/utils/execSync.mjs.map +1 -1
  222. package/dist/utils/execSync.native.js +8 -6
  223. package/dist/utils/execSync.native.js.map +1 -1
  224. package/dist/utils/expoRun.mjs +27 -35
  225. package/dist/utils/expoRun.mjs.map +1 -1
  226. package/dist/utils/expoRun.native.js +27 -35
  227. package/dist/utils/expoRun.native.js.map +1 -1
  228. package/dist/utils/filterViteServerResolvedUrls.mjs +24 -22
  229. package/dist/utils/filterViteServerResolvedUrls.mjs.map +1 -1
  230. package/dist/utils/filterViteServerResolvedUrls.native.js +61 -63
  231. package/dist/utils/filterViteServerResolvedUrls.native.js.map +1 -1
  232. package/dist/utils/getBoundPort.mjs +6 -5
  233. package/dist/utils/getBoundPort.mjs.map +1 -1
  234. package/dist/utils/getBoundPort.native.js +8 -12
  235. package/dist/utils/getBoundPort.native.js.map +1 -1
  236. package/dist/utils/getCacheDir.mjs +3 -1
  237. package/dist/utils/getCacheDir.mjs.map +1 -1
  238. package/dist/utils/getCacheDir.native.js +3 -1
  239. package/dist/utils/getCacheDir.native.js.map +1 -1
  240. package/dist/utils/getServerEntry.mjs +6 -4
  241. package/dist/utils/getServerEntry.mjs.map +1 -1
  242. package/dist/utils/getServerEntry.native.js +8 -11
  243. package/dist/utils/getServerEntry.native.js.map +1 -1
  244. package/dist/utils/getVitePath.mjs +42 -42
  245. package/dist/utils/getVitePath.mjs.map +1 -1
  246. package/dist/utils/getVitePath.native.js +43 -41
  247. package/dist/utils/getVitePath.native.js.map +1 -1
  248. package/dist/utils/globDir.mjs +7 -11
  249. package/dist/utils/globDir.mjs.map +1 -1
  250. package/dist/utils/globDir.native.js +10 -14
  251. package/dist/utils/globDir.native.js.map +1 -1
  252. package/dist/utils/isWithin.mjs +4 -2
  253. package/dist/utils/isWithin.mjs.map +1 -1
  254. package/dist/utils/isWithin.native.js +4 -2
  255. package/dist/utils/isWithin.native.js.map +1 -1
  256. package/dist/utils/patches.mjs +233 -255
  257. package/dist/utils/patches.mjs.map +1 -1
  258. package/dist/utils/patches.native.js +415 -460
  259. package/dist/utils/patches.native.js.map +1 -1
  260. package/dist/utils/printServerUrls.mjs +9 -7
  261. package/dist/utils/printServerUrls.mjs.map +1 -1
  262. package/dist/utils/printServerUrls.native.js +48 -51
  263. package/dist/utils/printServerUrls.native.js.map +1 -1
  264. package/dist/utils/removeUndefined.mjs +8 -7
  265. package/dist/utils/removeUndefined.mjs.map +1 -1
  266. package/dist/utils/removeUndefined.native.js +8 -7
  267. package/dist/utils/removeUndefined.native.js.map +1 -1
  268. package/dist/utils/scanDepsToOptimize.mjs +194 -161
  269. package/dist/utils/scanDepsToOptimize.mjs.map +1 -1
  270. package/dist/utils/scanDepsToOptimize.native.js +227 -197
  271. package/dist/utils/scanDepsToOptimize.native.js.map +1 -1
  272. package/dist/utils/state.mjs +18 -18
  273. package/dist/utils/state.mjs.map +1 -1
  274. package/dist/utils/state.native.js +18 -18
  275. package/dist/utils/state.native.js.map +1 -1
  276. package/dist/utils/symbolicateNativeStack.mjs +54 -54
  277. package/dist/utils/symbolicateNativeStack.mjs.map +1 -1
  278. package/dist/utils/symbolicateNativeStack.native.js +58 -58
  279. package/dist/utils/symbolicateNativeStack.native.js.map +1 -1
  280. package/dist/utils/uniq.mjs +2 -1
  281. package/dist/utils/uniq.mjs.map +1 -1
  282. package/dist/utils/uniq.native.js +2 -1
  283. package/dist/utils/uniq.native.js.map +1 -1
  284. package/dist/utils/utils.mjs +19 -19
  285. package/dist/utils/utils.mjs.map +1 -1
  286. package/dist/utils/utils.native.js +38 -40
  287. package/dist/utils/utils.native.js.map +1 -1
  288. package/dist/vendor/debugger-app/index.mjs +0 -2
  289. package/dist/vendor/debugger-app/index.native.js +0 -2
  290. package/dist/vendor/debugger-app/src/debuggerWorker.mjs +0 -2
  291. package/dist/vendor/debugger-app/src/debuggerWorker.native.js +0 -2
  292. package/dist/vendor/debugger-app/src/index.mjs +0 -2
  293. package/dist/vendor/debugger-app/src/index.native.js +0 -2
  294. package/dist/vxrn-vite-plugin.mjs +34 -33
  295. package/dist/vxrn-vite-plugin.mjs.map +1 -1
  296. package/dist/vxrn-vite-plugin.native.js +35 -34
  297. package/dist/vxrn-vite-plugin.native.js.map +1 -1
  298. package/expo-plugin.cjs +12 -6
  299. package/package.json +12 -13
  300. package/src/config/getBaseViteConfigOnly.ts +6 -0
  301. package/src/exports/prebuild.ts +40 -12
  302. package/src/patches/builtInDepPatches.ts +24 -48
  303. package/src/utils/createNativeDevEngine.test.ts +1 -1
  304. package/src/utils/createNativeDevEngine.ts +15 -9
  305. package/src/utils/scanDepsToOptimize.ts +0 -3
  306. package/types/config/getBaseViteConfigOnly.d.ts.map +1 -1
  307. package/types/config/getOptimizeDeps.d.ts.map +1 -1
  308. package/types/config/getOptionsFilled.d.ts +15 -15
  309. package/types/config/getOptionsFilled.d.ts.map +1 -1
  310. package/types/exports/build.d.ts +11 -11
  311. package/types/exports/build.d.ts.map +1 -1
  312. package/types/exports/clean.d.ts +1 -1
  313. package/types/exports/clean.d.ts.map +1 -1
  314. package/types/exports/createServer.d.ts.map +1 -1
  315. package/types/exports/dev.d.ts.map +1 -1
  316. package/types/exports/patch.d.ts.map +1 -1
  317. package/types/exports/prebuild.d.ts +3 -3
  318. package/types/exports/prebuild.d.ts.map +1 -1
  319. package/types/exports/prebuildWithoutExpo.d.ts +1 -1
  320. package/types/exports/prebuildWithoutExpo.d.ts.map +1 -1
  321. package/types/exports/runAndroid.d.ts.map +1 -1
  322. package/types/exports/runIos.d.ts.map +1 -1
  323. package/types/exports/serve.d.ts.map +1 -1
  324. package/types/patches/builtInDepPatches.d.ts.map +1 -1
  325. package/types/plugins/autoDepOptimizePlugin.d.ts.map +1 -1
  326. package/types/plugins/rollupRemoveUnusedImports.d.ts.map +1 -1
  327. package/types/runtime/hmr-client.d.ts.map +1 -1
  328. package/types/runtime/hmr-runtime.d.ts.map +1 -1
  329. package/types/runtime/hmr-types.d.ts.map +1 -1
  330. package/types/utils/createNativeDevEngine.d.ts +1 -1
  331. package/types/utils/createNativeDevEngine.d.ts.map +1 -1
  332. package/types/utils/execSync.d.ts.map +1 -1
  333. package/types/utils/getServerEntry.d.ts.map +1 -1
  334. package/types/utils/scanDepsToOptimize.d.ts.map +1 -1
  335. package/types/vxrn-vite-plugin.d.ts.map +1 -1
  336. package/dist/config/getOptimizeDeps.test.mjs +0 -20
  337. package/dist/config/getOptimizeDeps.test.mjs.map +0 -1
  338. package/dist/config/getOptimizeDeps.test.native.js +0 -39
  339. package/dist/config/getOptimizeDeps.test.native.js.map +0 -1
  340. package/dist/config/getServerOptionsFilled.test.mjs +0 -20
  341. package/dist/config/getServerOptionsFilled.test.mjs.map +0 -1
  342. package/dist/config/getServerOptionsFilled.test.native.js +0 -20
  343. package/dist/config/getServerOptionsFilled.test.native.js.map +0 -1
  344. package/dist/config/getViteServerConfig.test.mjs +0 -26
  345. package/dist/config/getViteServerConfig.test.mjs.map +0 -1
  346. package/dist/config/getViteServerConfig.test.native.js +0 -26
  347. package/dist/config/getViteServerConfig.test.native.js.map +0 -1
  348. package/dist/config/mergeUserConfig.test.mjs +0 -108
  349. package/dist/config/mergeUserConfig.test.mjs.map +0 -1
  350. package/dist/config/mergeUserConfig.test.native.js +0 -108
  351. package/dist/config/mergeUserConfig.test.native.js.map +0 -1
  352. package/dist/exports/clean.test.mjs +0 -81
  353. package/dist/exports/clean.test.mjs.map +0 -1
  354. package/dist/exports/clean.test.native.js +0 -88
  355. package/dist/exports/clean.test.native.js.map +0 -1
  356. package/dist/exports/loadEnv.test.mjs +0 -65
  357. package/dist/exports/loadEnv.test.mjs.map +0 -1
  358. package/dist/exports/loadEnv.test.native.js +0 -65
  359. package/dist/exports/loadEnv.test.native.js.map +0 -1
  360. package/dist/index.js.map +0 -1
  361. package/dist/index.mjs.map +0 -1
  362. package/dist/index.native.js.map +0 -1
  363. package/dist/plugins/autoDepOptimizePlugin.test.mjs +0 -31
  364. package/dist/plugins/autoDepOptimizePlugin.test.mjs.map +0 -1
  365. package/dist/plugins/autoDepOptimizePlugin.test.native.js +0 -39
  366. package/dist/plugins/autoDepOptimizePlugin.test.native.js.map +0 -1
  367. package/dist/plugins/resolveIdScan.test.mjs +0 -31
  368. package/dist/plugins/resolveIdScan.test.mjs.map +0 -1
  369. package/dist/plugins/resolveIdScan.test.native.js +0 -38
  370. package/dist/plugins/resolveIdScan.test.native.js.map +0 -1
  371. package/dist/plugins/rnCodegenPlugin.test.mjs +0 -239
  372. package/dist/plugins/rnCodegenPlugin.test.mjs.map +0 -1
  373. package/dist/plugins/rnCodegenPlugin.test.native.js +0 -242
  374. package/dist/plugins/rnCodegenPlugin.test.native.js.map +0 -1
  375. package/dist/plugins/serverExtensions.test.mjs +0 -106
  376. package/dist/plugins/serverExtensions.test.mjs.map +0 -1
  377. package/dist/plugins/serverExtensions.test.native.js +0 -117
  378. package/dist/plugins/serverExtensions.test.native.js.map +0 -1
  379. package/dist/runtime/hmr-types.mjs.map +0 -1
  380. package/dist/runtime/hmr-types.native.js.map +0 -1
  381. package/dist/serve/node.test.mjs +0 -60
  382. package/dist/serve/node.test.mjs.map +0 -1
  383. package/dist/serve/node.test.native.js +0 -72
  384. package/dist/serve/node.test.native.js.map +0 -1
  385. package/dist/types.mjs.map +0 -1
  386. package/dist/types.native.js.map +0 -1
  387. package/dist/utils/bindKeypressInput.test.mjs +0 -48
  388. package/dist/utils/bindKeypressInput.test.mjs.map +0 -1
  389. package/dist/utils/bindKeypressInput.test.native.js +0 -48
  390. package/dist/utils/bindKeypressInput.test.native.js.map +0 -1
  391. package/dist/utils/createNativeDevEngine.test.mjs +0 -1788
  392. package/dist/utils/createNativeDevEngine.test.mjs.map +0 -1
  393. package/dist/utils/createNativeDevEngine.test.native.js +0 -1942
  394. package/dist/utils/createNativeDevEngine.test.native.js.map +0 -1
  395. package/dist/utils/createNativeDevEngineFailure.test.mjs +0 -44
  396. package/dist/utils/createNativeDevEngineFailure.test.mjs.map +0 -1
  397. package/dist/utils/createNativeDevEngineFailure.test.native.js +0 -54
  398. package/dist/utils/createNativeDevEngineFailure.test.native.js.map +0 -1
  399. package/dist/utils/getBoundPort.test.mjs +0 -71
  400. package/dist/utils/getBoundPort.test.mjs.map +0 -1
  401. package/dist/utils/getBoundPort.test.native.js +0 -82
  402. package/dist/utils/getBoundPort.test.native.js.map +0 -1
  403. package/dist/utils/imageSizePatch.test.mjs +0 -29
  404. package/dist/utils/imageSizePatch.test.mjs.map +0 -1
  405. package/dist/utils/imageSizePatch.test.native.js +0 -30
  406. package/dist/utils/imageSizePatch.test.native.js.map +0 -1
  407. package/dist/utils/patches.test.mjs +0 -242
  408. package/dist/utils/patches.test.mjs.map +0 -1
  409. package/dist/utils/patches.test.native.js +0 -271
  410. package/dist/utils/patches.test.native.js.map +0 -1
  411. package/dist/utils/symbolicateNativeStack.test.mjs +0 -96
  412. package/dist/utils/symbolicateNativeStack.test.mjs.map +0 -1
  413. package/dist/utils/symbolicateNativeStack.test.native.js +0 -96
  414. package/dist/utils/symbolicateNativeStack.test.native.js.map +0 -1
  415. package/dist/vendor/debugger-app/index.mjs.map +0 -1
  416. package/dist/vendor/debugger-app/index.native.js.map +0 -1
  417. package/dist/vendor/debugger-app/src/debuggerWorker.mjs.map +0 -1
  418. package/dist/vendor/debugger-app/src/debuggerWorker.native.js.map +0 -1
  419. package/dist/vendor/debugger-app/src/index.mjs.map +0 -1
  420. package/dist/vendor/debugger-app/src/index.native.js.map +0 -1
  421. package/types/config/getOptimizeDeps.test.d.ts +0 -2
  422. package/types/config/getOptimizeDeps.test.d.ts.map +0 -1
  423. package/types/config/getServerOptionsFilled.test.d.ts +0 -2
  424. package/types/config/getServerOptionsFilled.test.d.ts.map +0 -1
  425. package/types/config/getViteServerConfig.test.d.ts +0 -2
  426. package/types/config/getViteServerConfig.test.d.ts.map +0 -1
  427. package/types/config/mergeUserConfig.test.d.ts +0 -2
  428. package/types/config/mergeUserConfig.test.d.ts.map +0 -1
  429. package/types/exports/clean.test.d.ts +0 -2
  430. package/types/exports/clean.test.d.ts.map +0 -1
  431. package/types/exports/loadEnv.test.d.ts +0 -2
  432. package/types/exports/loadEnv.test.d.ts.map +0 -1
  433. package/types/plugins/autoDepOptimizePlugin.test.d.ts +0 -2
  434. package/types/plugins/autoDepOptimizePlugin.test.d.ts.map +0 -1
  435. package/types/plugins/resolveIdScan.test.d.ts +0 -2
  436. package/types/plugins/resolveIdScan.test.d.ts.map +0 -1
  437. package/types/plugins/rnCodegenPlugin.test.d.ts +0 -2
  438. package/types/plugins/rnCodegenPlugin.test.d.ts.map +0 -1
  439. package/types/plugins/serverExtensions.test.d.ts +0 -2
  440. package/types/plugins/serverExtensions.test.d.ts.map +0 -1
  441. package/types/serve/node.test.d.ts +0 -2
  442. package/types/serve/node.test.d.ts.map +0 -1
  443. package/types/utils/bindKeypressInput.test.d.ts +0 -2
  444. package/types/utils/bindKeypressInput.test.d.ts.map +0 -1
  445. package/types/utils/createNativeDevEngine.test.d.ts +0 -2
  446. package/types/utils/createNativeDevEngine.test.d.ts.map +0 -1
  447. package/types/utils/createNativeDevEngineFailure.test.d.ts +0 -2
  448. package/types/utils/createNativeDevEngineFailure.test.d.ts.map +0 -1
  449. package/types/utils/getBoundPort.test.d.ts +0 -2
  450. package/types/utils/getBoundPort.test.d.ts.map +0 -1
  451. package/types/utils/imageSizePatch.test.d.ts +0 -2
  452. package/types/utils/imageSizePatch.test.d.ts.map +0 -1
  453. package/types/utils/patches.test.d.ts +0 -2
  454. package/types/utils/patches.test.d.ts.map +0 -1
  455. package/types/utils/symbolicateNativeStack.test.d.ts +0 -2
  456. package/types/utils/symbolicateNativeStack.test.d.ts.map +0 -1
@@ -9,334 +9,355 @@ import { resolvePath } from "@vxrn/resolve";
9
9
  import { DEFAULT_ASSET_EXTS } from "../constants/defaults.native.js";
10
10
  import { getNativePrelude } from "../runtime/native-prelude.native.js";
11
11
  import { rnCodegenPlugin } from "../plugins/rnCodegenPlugin.native.js";
12
- function _instanceof(left, right) {
13
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) return !!right[Symbol.hasInstance](left);else return left instanceof right;
14
- }
15
- var HERMES_CLASS_TRANSFORMS = ["transform-classes", "transform-parameters", "transform-block-scoping", "transform-class-properties", "transform-class-static-block", "transform-private-methods", "transform-private-property-in-object"];
12
+
13
+ var HERMES_CLASS_TRANSFORMS = [
14
+ "transform-classes",
15
+ "transform-parameters",
16
+ "transform-block-scoping",
17
+ "transform-class-properties",
18
+ "transform-class-static-block",
19
+ "transform-private-methods",
20
+ "transform-private-property-in-object"
21
+ ];
16
22
  var HERMES_ASYNC_TRANSFORMS = ["transform-async-to-generator"];
17
23
  function getHermesSWCIncludes(dev) {
18
- return [...HERMES_CLASS_TRANSFORMS, ...HERMES_ASYNC_TRANSFORMS];
24
+ return [...HERMES_CLASS_TRANSFORMS, ...HERMES_ASYNC_TRANSFORMS];
19
25
  }
20
26
  function getResolveExtensions(platform) {
21
- var platformExts = platform === "ios" ? [".ios.tsx", ".ios.ts", ".ios.jsx", ".ios.js"] : [".android.tsx", ".android.ts", ".android.jsx", ".android.js"];
22
- var nativeExts = [".native.tsx", ".native.ts", ".native.jsx", ".native.js"];
23
- var defaultExts = [".tsx", ".ts", ".jsx", ".js", ".mjs", ".cjs", ".json"];
24
- return [...platformExts, ...nativeExts, ...defaultExts];
27
+ var platformExts = platform === "ios" ? [
28
+ ".ios.tsx",
29
+ ".ios.ts",
30
+ ".ios.jsx",
31
+ ".ios.js"
32
+ ] : [
33
+ ".android.tsx",
34
+ ".android.ts",
35
+ ".android.jsx",
36
+ ".android.js"
37
+ ];
38
+ var nativeExts = [
39
+ ".native.tsx",
40
+ ".native.ts",
41
+ ".native.jsx",
42
+ ".native.js"
43
+ ];
44
+ var defaultExts = [
45
+ ".tsx",
46
+ ".ts",
47
+ ".jsx",
48
+ ".js",
49
+ ".mjs",
50
+ ".cjs",
51
+ ".json"
52
+ ];
53
+ return [
54
+ ...platformExts,
55
+ ...nativeExts,
56
+ ...defaultExts
57
+ ];
25
58
  }
26
59
  function getNativeResolveConfig(platform) {
27
- return {
28
- extensions: getResolveExtensions(platform),
29
- conditionNames: ["react-native"],
30
- mainFields: ["react-native", "module", "main"]
31
- };
60
+ return {
61
+ extensions: getResolveExtensions(platform),
62
+ conditionNames: ["react-native"],
63
+ mainFields: [
64
+ "react-native",
65
+ "module",
66
+ "main"
67
+ ]
68
+ };
32
69
  }
33
70
  function getNativeTransformConfig(platform, dev, root) {
34
- var entryConfig = globalThis.__vxrnNativeEntryConfig || {};
35
- var setupFileDefines = function () {
36
- var sf = entryConfig.setupFile;
37
- if (!sf) return {};
38
- var files = typeof sf === "string" ? {
39
- client: sf,
40
- server: sf,
41
- ios: sf,
42
- android: sf
43
- } : "native" in sf ? {
44
- client: sf.client,
45
- server: sf.server,
46
- ios: sf.native,
47
- android: sf.native
48
- } : sf;
49
- return {
50
- ...(files.client && {
51
- "process.env.ONE_SETUP_FILE_CLIENT": JSON.stringify(files.client)
52
- }),
53
- ...(files.server && {
54
- "process.env.ONE_SETUP_FILE_SERVER": JSON.stringify(files.server)
55
- }),
56
- ...(files.ios && {
57
- "process.env.ONE_SETUP_FILE_IOS": JSON.stringify(files.ios)
58
- }),
59
- ...(files.android && {
60
- "process.env.ONE_SETUP_FILE_ANDROID": JSON.stringify(files.android)
61
- })
62
- };
63
- }();
64
- var userDefines = {};
65
- var _iteratorNormalCompletion = true,
66
- _didIteratorError = false,
67
- _iteratorError = void 0;
68
- try {
69
- for (var _iterator = Object.entries(globalThis.__vxrnNativeUserDefine || {})[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
70
- var [key, value] = _step.value;
71
- userDefines[key] = typeof value === "string" ? value : JSON.stringify(value);
72
- }
73
- } catch (err) {
74
- _didIteratorError = true;
75
- _iteratorError = err;
76
- } finally {
77
- try {
78
- if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
79
- } finally {
80
- if (_didIteratorError) throw _iteratorError;
81
- }
82
- }
83
- var mode = dev ? "development" : "production";
84
- var publicEnv = loadEnv(mode, root, ["VITE_", "EXPO_PUBLIC_"]);
85
- var envDefines = {};
86
- var _iteratorNormalCompletion1 = true,
87
- _didIteratorError1 = false,
88
- _iteratorError1 = void 0;
89
- try {
90
- for (var _iterator1 = Object.entries(publicEnv)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
91
- var [key1, value1] = _step1.value;
92
- envDefines[`import.meta.env.${key1}`] = JSON.stringify(value1);
93
- envDefines[`process.env.${key1}`] = JSON.stringify(value1);
94
- }
95
- } catch (err) {
96
- _didIteratorError1 = true;
97
- _iteratorError1 = err;
98
- } finally {
99
- try {
100
- if (!_iteratorNormalCompletion1 && _iterator1.return != null) _iterator1.return();
101
- } finally {
102
- if (_didIteratorError1) throw _iteratorError1;
103
- }
104
- }
105
- var envObject = {
106
- ...publicEnv,
107
- MODE: mode,
108
- DEV: dev,
109
- PROD: !dev,
110
- SSR: false,
111
- VITE_ENVIRONMENT: platform,
112
- VITE_NATIVE: "1",
113
- EXPO_OS: platform,
114
- TAMAGUI_TARGET: "native",
115
- TAMAGUI_ENVIRONMENT: platform
116
- };
117
- return {
118
- jsx: {
119
- runtime: "classic"
120
- },
121
- define: {
122
- ...userDefines,
123
- ...envDefines,
124
- "process.env.NODE_ENV": JSON.stringify(mode),
125
- "process.env.VXRN_REACT_19": "false",
126
- "process.env.VITE_ENVIRONMENT": JSON.stringify(platform),
127
- "process.env.VITE_NATIVE": "\"1\"",
128
- "process.env.EXPO_OS": JSON.stringify(platform),
129
- "process.env.TAMAGUI_TARGET": "\"native\"",
130
- "process.env.TAMAGUI_ENVIRONMENT": JSON.stringify(platform),
131
- __DEV__: dev ? "true" : "false",
132
- "import.meta.env": JSON.stringify(envObject),
133
- "import.meta.env.MODE": JSON.stringify(mode),
134
- "import.meta.env.DEV": dev ? "true" : "false",
135
- "import.meta.env.PROD": dev ? "false" : "true",
136
- "import.meta.env.SSR": "false",
137
- "import.meta.env.VITE_ENVIRONMENT": JSON.stringify(platform),
138
- "import.meta.env.VITE_NATIVE": "\"1\"",
139
- "import.meta.env.EXPO_OS": JSON.stringify(platform),
140
- "import.meta.env.TAMAGUI_TARGET": "\"native\"",
141
- "import.meta.env.TAMAGUI_ENVIRONMENT": JSON.stringify(platform),
142
- ...setupFileDefines
143
- },
144
- inject: {
145
- React: "react"
146
- }
147
- };
71
+ var entryConfig = globalThis.__vxrnNativeEntryConfig || {};
72
+ var setupFileDefines = (function() {
73
+ var sf = entryConfig.setupFile;
74
+ if (!sf) return {};
75
+ var files = typeof sf === "string" ? {
76
+ client: sf,
77
+ server: sf,
78
+ ios: sf,
79
+ android: sf
80
+ } : "native" in sf ? {
81
+ client: sf.client,
82
+ server: sf.server,
83
+ ios: sf.native,
84
+ android: sf.native
85
+ } : sf;
86
+ return {
87
+ ...files.client && { "process.env.ONE_SETUP_FILE_CLIENT": JSON.stringify(files.client) },
88
+ ...files.server && { "process.env.ONE_SETUP_FILE_SERVER": JSON.stringify(files.server) },
89
+ ...files.ios && { "process.env.ONE_SETUP_FILE_IOS": JSON.stringify(files.ios) },
90
+ ...files.android && { "process.env.ONE_SETUP_FILE_ANDROID": JSON.stringify(files.android) }
91
+ };
92
+ })();
93
+ var userDefines = {};
94
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
95
+ try {
96
+ for (var _iterator = Object.entries(globalThis.__vxrnNativeUserDefine || {})[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
97
+ var [key, value] = _step.value;
98
+ userDefines[key] = typeof value === "string" ? value : JSON.stringify(value);
99
+ }
100
+ } catch (err) {
101
+ _didIteratorError = true;
102
+ _iteratorError = err;
103
+ } finally {
104
+ try {
105
+ if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
106
+ } finally {
107
+ if (_didIteratorError) throw _iteratorError;
108
+ }
109
+ }
110
+ var mode = dev ? "development" : "production";
111
+ var publicEnv = loadEnv(mode, root, ["VITE_", "EXPO_PUBLIC_"]);
112
+ var envDefines = {};
113
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
114
+ try {
115
+ for (var _iterator1 = Object.entries(publicEnv)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
116
+ var [key1, value1] = _step1.value;
117
+ envDefines[`import.meta.env.${key1}`] = JSON.stringify(value1);
118
+ envDefines[`process.env.${key1}`] = JSON.stringify(value1);
119
+ }
120
+ } catch (err) {
121
+ _didIteratorError1 = true;
122
+ _iteratorError1 = err;
123
+ } finally {
124
+ try {
125
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) _iterator1.return();
126
+ } finally {
127
+ if (_didIteratorError1) throw _iteratorError1;
128
+ }
129
+ }
130
+ var envObject = {
131
+ ...publicEnv,
132
+ MODE: mode,
133
+ DEV: dev,
134
+ PROD: !dev,
135
+ SSR: false,
136
+ VITE_ENVIRONMENT: platform,
137
+ VITE_NATIVE: "1",
138
+ EXPO_OS: platform,
139
+ TAMAGUI_TARGET: "native",
140
+ TAMAGUI_ENVIRONMENT: platform
141
+ };
142
+ return {
143
+ jsx: { runtime: "classic" },
144
+ define: {
145
+ ...userDefines,
146
+ ...envDefines,
147
+ "process.env.NODE_ENV": JSON.stringify(mode),
148
+ "process.env.VXRN_REACT_19": "false",
149
+ "process.env.VITE_ENVIRONMENT": JSON.stringify(platform),
150
+ "process.env.VITE_NATIVE": "\"1\"",
151
+ "process.env.EXPO_OS": JSON.stringify(platform),
152
+ "process.env.TAMAGUI_TARGET": "\"native\"",
153
+ "process.env.TAMAGUI_ENVIRONMENT": JSON.stringify(platform),
154
+ __DEV__: dev ? "true" : "false",
155
+ "import.meta.env": JSON.stringify(envObject),
156
+ "import.meta.env.MODE": JSON.stringify(mode),
157
+ "import.meta.env.DEV": dev ? "true" : "false",
158
+ "import.meta.env.PROD": dev ? "false" : "true",
159
+ "import.meta.env.SSR": "false",
160
+ "import.meta.env.VITE_ENVIRONMENT": JSON.stringify(platform),
161
+ "import.meta.env.VITE_NATIVE": "\"1\"",
162
+ "import.meta.env.EXPO_OS": JSON.stringify(platform),
163
+ "import.meta.env.TAMAGUI_TARGET": "\"native\"",
164
+ "import.meta.env.TAMAGUI_ENVIRONMENT": JSON.stringify(platform),
165
+ ...setupFileDefines
166
+ },
167
+ inject: { React: "react" }
168
+ };
148
169
  }
149
170
  function getNativePlugins(root, platform, viteImportGlobPlugin, dev, assetsDest, onAsset) {
150
- var sourceMaps = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : false,
151
- userPlugins = arguments.length > 7 && arguments[7] !== void 0 ? arguments[7] : [];
152
- var context = {
153
- root,
154
- platform,
155
- dev
156
- };
157
- return [...(globalThis.__vxrnAddNativePlugins || []), serverFileExclusionPlugin(), environmentGuardPlugin(), hmrClientNoopPlugin(), ...(dev ? [reactNativeDedupePlugin(root)] : []), cssStubPlugin(), viteImportGlobPlugin({
158
- root
159
- }), vxrnCompilerPlugin(platform, dev, root, sourceMaps), rnCodegenPlugin({
160
- projectRoot: root
161
- }), flowStripPlugin(), nativeAnimatedGuardPlugin(), assetPlugin({
162
- root,
163
- platform,
164
- assetsDest,
165
- onAsset
166
- }), hermesCompatSWCPlugin(dev, sourceMaps), hermesLoopsPlugin(sourceMaps), ...userPlugins].map(function (plugin) {
167
- var _plugin_api;
168
- return ((_plugin_api = plugin.api) === null || _plugin_api === void 0 ? void 0 : _plugin_api.vxrnNative) ? plugin.api.vxrnNative(context) : plugin;
169
- });
171
+ var sourceMaps = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : false, userPlugins = arguments.length > 7 && arguments[7] !== void 0 ? arguments[7] : [];
172
+ var context = {
173
+ root,
174
+ platform,
175
+ dev
176
+ };
177
+ return [
178
+ ...globalThis.__vxrnAddNativePlugins || [],
179
+ serverFileExclusionPlugin(),
180
+ environmentGuardPlugin(),
181
+ hmrClientNoopPlugin(),
182
+ {
183
+ name: "vxrn:legacy-asset-registry",
184
+ resolveId(source, importer) {
185
+ if (source === "@react-native/assets-registry/registry") return this.resolve("react-native/asset-registry", importer, { skipSelf: true });
186
+ }
187
+ },
188
+ ...dev ? [reactNativeDedupePlugin(root)] : [],
189
+ cssStubPlugin(),
190
+ viteImportGlobPlugin({ root }),
191
+ vxrnCompilerPlugin(platform, dev, root, sourceMaps),
192
+ rnCodegenPlugin({ projectRoot: root }),
193
+ flowStripPlugin(),
194
+ nativeAnimatedGuardPlugin(),
195
+ assetPlugin({
196
+ root,
197
+ platform,
198
+ assetsDest,
199
+ onAsset
200
+ }),
201
+ hermesCompatSWCPlugin(dev, sourceMaps),
202
+ hermesLoopsPlugin(sourceMaps),
203
+ ...userPlugins
204
+ ].map(function(plugin) {
205
+ var _plugin_api;
206
+ return ((_plugin_api = plugin.api) === null || _plugin_api === void 0 ? void 0 : _plugin_api.vxrnNative) ? plugin.api.vxrnNative(context) : plugin;
207
+ });
170
208
  }
171
209
  function getNativeOutputOptions(prelude, sourcemap, minify) {
172
- return {
173
- format: "esm",
174
- sourcemap,
175
- sourcemapPathTransform: function (relativeSourcePath, sourcemapPath) {
176
- return normalizePath(resolve(dirname(sourcemapPath), relativeSourcePath));
177
- },
178
- intro: prelude,
179
- codeSplitting: false,
180
- strictExecutionOrder: true,
181
- minify: minify || "dce-only"
182
- };
210
+ return {
211
+ format: "esm",
212
+ sourcemap,
213
+ sourcemapPathTransform: function(relativeSourcePath, sourcemapPath) {
214
+ return normalizePath(resolve(dirname(sourcemapPath), relativeSourcePath));
215
+ },
216
+ intro: prelude,
217
+ codeSplitting: false,
218
+ strictExecutionOrder: true,
219
+ minify: minify || "dce-only"
220
+ };
183
221
  }
184
222
  function normalizeNativeCommonJSInterop(code) {
185
- return code.replace(/(\b__toESM(?:\$\d+)?\(\s*(?:require[\w$]*\(\)|__rolldown_runtime__\.loadExports\("(?:\\.|[^"\\])*"\))\s*),\s*1(\s*\))/g, "$1$2");
223
+ return code.replace(/(\b__toESM(?:\$\d+)?\(\s*(?:require[\w$]*\(\)|__rolldown_runtime__\.loadExports\("(?:\\.|[^"\\])*"\))\s*),\s*1(\s*\))/g, "$1$2");
186
224
  }
187
225
  function blankPreservingLines(match) {
188
- var _ref;
189
- var _match_match;
190
- return "\n".repeat((_ref = (_match_match = match.match(/\n/g)) === null || _match_match === void 0 ? void 0 : _match_match.length) !== null && _ref !== void 0 ? _ref : 0);
226
+ var _ref;
227
+ var _match_match;
228
+ return "\n".repeat((_ref = (_match_match = match.match(/\n/g)) === null || _match_match === void 0 ? void 0 : _match_match.length) !== null && _ref !== void 0 ? _ref : 0);
191
229
  }
192
230
  function countLines(code) {
193
- var _ref;
194
- var _code_match;
195
- return ((_ref = (_code_match = code.match(/\n/g)) === null || _code_match === void 0 ? void 0 : _code_match.length) !== null && _ref !== void 0 ? _ref : 0) + 1;
231
+ var _ref;
232
+ var _code_match;
233
+ return ((_ref = (_code_match = code.match(/\n/g)) === null || _code_match === void 0 ? void 0 : _code_match.length) !== null && _ref !== void 0 ? _ref : 0) + 1;
196
234
  }
197
235
  function assertBundleLinesPreserved(before, after, stage) {
198
- var beforeLines = countLines(before);
199
- var afterLines = countLines(after);
200
- if (beforeLines !== afterLines) throw new Error(`[vxrn] native bundle post-processing (${stage}) changed the line count (${beforeLines} -> ${afterLines}), which invalidates the source map. Every pass after Rolldown emits the map must preserve lines.`);
236
+ var beforeLines = countLines(before);
237
+ var afterLines = countLines(after);
238
+ if (beforeLines !== afterLines) throw new Error(`[vxrn] native bundle post-processing (${stage}) changed the line count (${beforeLines} -> ${afterLines}), which invalidates the source map. Every pass after Rolldown emits the map must preserve lines.`);
201
239
  }
202
240
  function postProcessNativeBundle(code) {
203
- code = normalizeNativeCommonJSInterop(code);
204
- code = code.replace(/\btypeof\s+import\.meta\b/g, "\"object\"");
205
- code = code.replace(/^[^\S\n]*export[^\S\n]*\{[^}]*\}[^\S\n]*;?[^\S\n]*$/gm, blankPreservingLines);
206
- code = code.replace(/^([^\S\n]*)export[^\S\n]+default[^\S\n]+([^;\n]+);?[^\S\n]*$/gm, "$1$2;");
207
- code = code.replace(/^if \(import\.meta\.hot\).*$/gm, "");
208
- var idx = code.indexOf("NativeAnimatedModule_default ?? NativeAnimatedTurboModule_default;");
209
- if (idx !== -1) {
210
- var beforeMarker = code.lastIndexOf("NativeAnimatedModule = ", idx);
211
- if (beforeMarker !== -1) {
212
- var lineStart = code.lastIndexOf("\n", beforeMarker);
213
- var snippet = code.slice(lineStart + 1, beforeMarker + 50);
214
- if (snippet.includes("(function()") || snippet.includes("new Proxy")) {
215
- var afterMarker = code.indexOf("})();", idx);
216
- if (afterMarker !== -1) {
217
- var end = afterMarker + 5;
218
- var removed = code.slice(beforeMarker, end);
219
- code = code.slice(0, beforeMarker) + "NativeAnimatedModule = NativeAnimatedModule_default ?? NativeAnimatedTurboModule_default;" + blankPreservingLines(removed) + code.slice(end);
220
- }
221
- }
222
- }
223
- }
224
- return code;
241
+ code = normalizeNativeCommonJSInterop(code);
242
+ code = code.replace(/\btypeof\s+import\.meta\b/g, "\"object\"");
243
+ code = code.replace(/^[^\S\n]*export[^\S\n]*\{[^}]*\}[^\S\n]*;?[^\S\n]*$/gm, blankPreservingLines);
244
+ code = code.replace(/^([^\S\n]*)export[^\S\n]+default[^\S\n]+([^;\n]+);?[^\S\n]*$/gm, "$1$2;");
245
+ code = code.replace(/^if \(import\.meta\.hot\).*$/gm, "");
246
+ var idx = code.indexOf("NativeAnimatedModule_default ?? NativeAnimatedTurboModule_default;");
247
+ if (idx !== -1) {
248
+ var beforeMarker = code.lastIndexOf("NativeAnimatedModule = ", idx);
249
+ if (beforeMarker !== -1) {
250
+ var lineStart = code.lastIndexOf("\n", beforeMarker);
251
+ var snippet = code.slice(lineStart + 1, beforeMarker + 50);
252
+ if (snippet.includes("(function()") || snippet.includes("new Proxy")) {
253
+ var afterMarker = code.indexOf("})();", idx);
254
+ if (afterMarker !== -1) {
255
+ var end = afterMarker + 5;
256
+ var removed = code.slice(beforeMarker, end);
257
+ code = code.slice(0, beforeMarker) + "NativeAnimatedModule = NativeAnimatedModule_default ?? NativeAnimatedTurboModule_default;" + blankPreservingLines(removed) + code.slice(end);
258
+ }
259
+ }
260
+ }
261
+ }
262
+ return code;
225
263
  }
226
264
  function wrapNativeBundleModuleScope(code) {
227
- var idx = code.indexOf("//#region \\0rolldown/runtime.js");
228
- if (idx === -1) return code;
229
- return code.slice(0, idx) + ";(function() {" + code.slice(idx) + "\n})();\n";
265
+ var idx = code.indexOf("//#region \\0rolldown/runtime.js");
266
+ if (idx === -1) return code;
267
+ return code.slice(0, idx) + ";(function() {" + code.slice(idx) + "\n})();\n";
230
268
  }
231
269
  async function downlevelClassFieldsInBundle(code) {
232
- var _ref, _ref1;
233
- var _runtimeSection_match, _result_errors, _transformed_match;
234
- var startMarker = "//#region \\0rolldown/runtime.js";
235
- var endMarker = "//#endregion";
236
- var startIdx = code.indexOf(startMarker);
237
- if (startIdx === -1) return code;
238
- var endIdx = code.indexOf(endMarker, startIdx);
239
- if (endIdx === -1) return code;
240
- var runtimeEnd = endIdx + endMarker.length;
241
- var runtimeSection = code.slice(startIdx, runtimeEnd);
242
- var originalNewlines = (_ref = (_runtimeSection_match = runtimeSection.match(/\n/g)) === null || _runtimeSection_match === void 0 ? void 0 : _runtimeSection_match.length) !== null && _ref !== void 0 ? _ref : 0;
243
- var {
244
- transformSync
245
- } = await import("oxc-transform");
246
- var result = transformSync("rolldown-runtime.js", runtimeSection, {
247
- target: "es2020",
248
- assumptions: {
249
- setPublicClassFields: true
250
- }
251
- });
252
- if ((_result_errors = result.errors) === null || _result_errors === void 0 ? void 0 : _result_errors.length) throw new Error(result.errors.map(function (e) {
253
- return e.message;
254
- }).join("\n"));
255
- var transformedCode = result.code.trimEnd();
256
- var transformed = transformedCode.includes(startMarker) ? transformedCode : `${startMarker}
270
+ var _ref, _ref1;
271
+ var _runtimeSection_match, _result_errors, _transformed_match;
272
+ var startMarker = "//#region \\0rolldown/runtime.js";
273
+ var endMarker = "//#endregion";
274
+ var startIdx = code.indexOf(startMarker);
275
+ if (startIdx === -1) return code;
276
+ var endIdx = code.indexOf(endMarker, startIdx);
277
+ if (endIdx === -1) return code;
278
+ var runtimeEnd = endIdx + endMarker.length;
279
+ var runtimeSection = code.slice(startIdx, runtimeEnd);
280
+ var originalNewlines = (_ref = (_runtimeSection_match = runtimeSection.match(/\n/g)) === null || _runtimeSection_match === void 0 ? void 0 : _runtimeSection_match.length) !== null && _ref !== void 0 ? _ref : 0;
281
+ var { transformSync } = await import("oxc-transform");
282
+ var result = transformSync("rolldown-runtime.js", runtimeSection, {
283
+ target: "es2020",
284
+ assumptions: { setPublicClassFields: true }
285
+ });
286
+ if ((_result_errors = result.errors) === null || _result_errors === void 0 ? void 0 : _result_errors.length) throw new Error(result.errors.map(function(e) {
287
+ return e.message;
288
+ }).join("\n"));
289
+ var transformedCode = result.code.trimEnd();
290
+ var transformed = transformedCode.includes(startMarker) ? transformedCode : `${startMarker}
257
291
  ${transformedCode}`;
258
- var transformedNewlines = (_ref1 = (_transformed_match = transformed.match(/\n/g)) === null || _transformed_match === void 0 ? void 0 : _transformed_match.length) !== null && _ref1 !== void 0 ? _ref1 : 0;
259
- if (transformedNewlines > originalNewlines) throw new Error("[vxrn] Hermes runtime transform added lines and would invalidate the production source map");
260
- var linePreservingRuntime = transformed + "\n".repeat(originalNewlines - transformedNewlines);
261
- return code.slice(0, startIdx) + linePreservingRuntime + code.slice(runtimeEnd);
292
+ var transformedNewlines = (_ref1 = (_transformed_match = transformed.match(/\n/g)) === null || _transformed_match === void 0 ? void 0 : _transformed_match.length) !== null && _ref1 !== void 0 ? _ref1 : 0;
293
+ if (transformedNewlines > originalNewlines) throw new Error("[vxrn] Hermes runtime transform added lines and would invalidate the production source map");
294
+ var linePreservingRuntime = transformed + "\n".repeat(originalNewlines - transformedNewlines);
295
+ return code.slice(0, startIdx) + linePreservingRuntime + code.slice(runtimeEnd);
262
296
  }
263
297
  function nativeBundlePostProcessPlugin() {
264
- return {
265
- name: "vxrn:native-post-process",
266
- async renderChunk(code) {
267
- var processed = await downlevelClassFieldsInBundle(postProcessNativeBundle(code));
268
- assertBundleLinesPreserved(code, processed, "production");
269
- return {
270
- code: processed,
271
- map: null
272
- };
273
- }
274
- };
298
+ return {
299
+ name: "vxrn:native-post-process",
300
+ async renderChunk(code) {
301
+ var processed = await downlevelClassFieldsInBundle(postProcessNativeBundle(code));
302
+ assertBundleLinesPreserved(code, processed, "production");
303
+ return {
304
+ code: processed,
305
+ map: null
306
+ };
307
+ }
308
+ };
275
309
  }
276
310
  async function createNativeDevEngine(options) {
277
- var _statSync;
278
- var {
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 assetRegistry = createNativeDevAssetRegistry();
298
- var currentBundle = null;
299
- var firstBuildError = null;
300
- var bundleResolve = null;
301
- var bundleReject = null;
302
- var bundlePromise = null;
303
- var resolvedHost = host === "0.0.0.0" ? "localhost" : host;
304
- var virtualEntry = nativeVirtualEntryPlugin(root, {
305
- dev: true,
306
- platform,
307
- dynamicRoutes: true
308
- });
309
- var engineWork = Promise.resolve();
310
- var queueEngineWork = function (work) {
311
- var result = engineWork.then(work, work);
312
- engineWork = result.catch(function () {});
313
- return result;
314
- };
315
- var inputOptions = {
316
- input: VIRTUAL_NATIVE_ENTRY,
317
- cwd: root,
318
- platform: "neutral",
319
- resolve: getNativeResolveConfig(platform),
320
- transform: getNativeTransformConfig(platform, true, root),
321
- experimental: {
322
- devMode: {
323
- implement: hmrRuntimeSource,
324
- host,
325
- port
326
- },
327
- incrementalBuild: true,
328
- lazyBarrel: true
329
- },
330
- treeshake: false,
331
- shimMissingExports: true,
332
- moduleTypes: {
333
- ".js": "jsx"
334
- },
335
- plugins: [virtualEntry.plugin, ...getNativePlugins(root, platform, viteImportGlobPlugin, true, void 0, assetRegistry.register, true, userPlugins)]
336
- };
337
- var outputOptions = {
338
- ...getNativeOutputOptions(prelude, true, false),
339
- outro: `
311
+ var _statSync;
312
+ var { root, port, host = "localhost", platform, serverUrl, plugins: userPlugins = [], onHmrUpdate } = options;
313
+ var { dev, viteImportGlobPlugin } = await import("rolldown/experimental");
314
+ var hmrRuntimeSource = getHmrRuntimeSource();
315
+ var prelude = getNativePrelude({
316
+ dev: true,
317
+ platform,
318
+ serverUrl: serverUrl || `http://${host}:${port}`
319
+ });
320
+ var assetRegistry = createNativeDevAssetRegistry();
321
+ var currentBundle = null;
322
+ var firstBuildError = null;
323
+ var bundleResolve = null;
324
+ var bundleReject = null;
325
+ var bundlePromise = null;
326
+ var resolvedHost = host === "0.0.0.0" ? "localhost" : host;
327
+ var virtualEntry = nativeVirtualEntryPlugin(root, {
328
+ dev: true,
329
+ platform,
330
+ dynamicRoutes: true
331
+ });
332
+ var engineWork = Promise.resolve();
333
+ var queueEngineWork = function(work) {
334
+ var result = engineWork.then(work, work);
335
+ engineWork = result.catch(function() {});
336
+ return result;
337
+ };
338
+ var inputOptions = {
339
+ input: VIRTUAL_NATIVE_ENTRY,
340
+ cwd: root,
341
+ platform: "neutral",
342
+ resolve: getNativeResolveConfig(platform),
343
+ transform: getNativeTransformConfig(platform, true, root),
344
+ experimental: {
345
+ devMode: {
346
+ implement: hmrRuntimeSource,
347
+ host,
348
+ port
349
+ },
350
+ incrementalBuild: true,
351
+ lazyBarrel: true
352
+ },
353
+ treeshake: false,
354
+ shimMissingExports: true,
355
+ moduleTypes: { ".js": "jsx" },
356
+ plugins: [virtualEntry.plugin, ...getNativePlugins(root, platform, viteImportGlobPlugin, true, void 0, assetRegistry.register, true, userPlugins)]
357
+ };
358
+ var outputOptions = {
359
+ ...getNativeOutputOptions(prelude, true, false),
360
+ outro: `
340
361
  try {
341
362
  var __WS = (init_WebSocket(), __toCommonJS(WebSocket_exports)).default;
342
363
  var __hmrUrl = 'ws://${resolvedHost}:${port}/hot?platform=${platform}&clientId=' + encodeURIComponent(__rolldown_runtime__.clientId);
@@ -347,256 +368,238 @@ try {
347
368
  console.error('[vxrn] HMR client failed to start:', (e && e.message) || e);
348
369
  }
349
370
  `
350
- };
351
- var outputProcessed = Promise.resolve();
352
- var engine;
353
- var routeWatcher;
354
- var rebuildIfRouteGraphChanged = function () {
355
- return queueEngineWork(async function () {
356
- var {
357
- files: knownRoutes,
358
- scanFiles,
359
- updateFiles
360
- } = virtualEntry.routes;
361
- var currentRoutes = scanFiles();
362
- if (!(currentRoutes.size !== knownRoutes.size || [...currentRoutes].some(function (route) {
363
- return !knownRoutes.has(route);
364
- }))) return false;
365
- updateFiles(currentRoutes);
366
- return true;
367
- });
368
- };
369
- engine = await dev(inputOptions, outputOptions, {
370
- onOutput: async function (result) {
371
- var finishOutput = function () {};
372
- outputProcessed = new Promise(function (resolve2) {
373
- finishOutput = resolve2;
374
- });
375
- try {
376
- await handleOutput(result);
377
- } finally {
378
- finishOutput();
379
- }
380
- },
381
- onHmrUpdates: async function (result) {
382
- if (_instanceof(result, Error)) {
383
- console.error("[vxrn] HMR error:", result.message);
384
- onHmrUpdate === null || onHmrUpdate === void 0 || onHmrUpdate({
385
- type: "hmr:error"
386
- });
387
- return;
388
- }
389
- if (await rebuildIfRouteGraphChanged()) return;
390
- var _iteratorNormalCompletion = true,
391
- _didIteratorError = false,
392
- _iteratorError = void 0;
393
- try {
394
- for (var _iterator = result.updates[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
395
- var {
396
- clientId,
397
- update
398
- } = _step.value;
399
- if (update.type === "Patch" && update.code) onHmrUpdate === null || onHmrUpdate === void 0 || onHmrUpdate({
400
- type: "hmr:update",
401
- clientId,
402
- code: normalizeNativeCommonJSInterop(update.code),
403
- changedIds: update.changedIds,
404
- seq: update.seq
405
- });else if (update.type === "FullReload") onHmrUpdate === null || onHmrUpdate === void 0 || onHmrUpdate({
406
- type: "hmr:reload",
407
- clientId
408
- });
409
- }
410
- } catch (err) {
411
- _didIteratorError = true;
412
- _iteratorError = err;
413
- } finally {
414
- try {
415
- if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
416
- } finally {
417
- if (_didIteratorError) throw _iteratorError;
418
- }
419
- }
420
- },
421
- rebuildStrategy: "never",
422
- watch: {}
423
- });
424
- async function handleOutput(result) {
425
- if (_instanceof(result, Error)) {
426
- console.error("[vxrn] native bundle error:", result.message);
427
- if (/panic/i.test(result.message)) console.error("[vxrn] rolldown itself panicked. Fast Refresh will full-reload until you restart the dev server.");
428
- if (!currentBundle) {
429
- firstBuildError || (firstBuildError = result);
430
- if (bundleReject) {
431
- var reject = bundleReject;
432
- bundleResolve = null;
433
- bundleReject = null;
434
- bundlePromise = null;
435
- reject(firstBuildError);
436
- }
437
- }
438
- return;
439
- }
440
- var chunk = result.output.find(function (o) {
441
- return o.type === "chunk" && o.isEntry;
442
- });
443
- if (chunk && "code" in chunk) {
444
- firstBuildError = null;
445
- var code = postProcessNativeBundle(chunk.code);
446
- code = await downlevelClassFieldsInBundle(code);
447
- assertBundleLinesPreserved(chunk.code, code, "dev");
448
- code = wrapNativeBundleModuleScope(code);
449
- if (!chunk.map) throw new Error("[vxrn] rolldown produced no source map for the dev bundle, so /symbolicate cannot resolve a frame");
450
- currentBundle = {
451
- code,
452
- map: chunk.map.toString()
453
- };
454
- console.info(`[vxrn] native bundle ready (${Math.round(code.length / 1024)}KB)`);
455
- if (bundleResolve) {
456
- bundleResolve(currentBundle);
457
- bundleResolve = null;
458
- bundleReject = null;
459
- bundlePromise = null;
460
- }
461
- }
462
- }
463
- await engine.run();
464
- var routeWatchTarget = virtualEntry.routes.routeRoot;
465
- while (!((_statSync = statSync(routeWatchTarget, {
466
- throwIfNoEntry: false
467
- })) === null || _statSync === void 0 ? void 0 : _statSync.isDirectory())) {
468
- var parent = dirname(routeWatchTarget);
469
- if (parent === routeWatchTarget) break;
470
- routeWatchTarget = parent;
471
- }
472
- var normalizedRouteRoot = normalizePath(virtualEntry.routes.routeRoot);
473
- routeWatcher = watch(routeWatchTarget, {
474
- recursive: true
475
- }, function (_eventType, file) {
476
- if (file === null) return;
477
- var changed = normalizePath(resolve(routeWatchTarget, file.toString()));
478
- if (changed !== normalizedRouteRoot && !changed.startsWith(`${normalizedRouteRoot}/`)) return;
479
- rebuildIfRouteGraphChanged().catch(function (error) {
480
- console.error(`[vxrn] rebuilding the native route map failed`, error);
481
- });
482
- });
483
- routeWatcher.on("error", function (error) {
484
- console.error(`[vxrn] watching the native route map failed`, error);
485
- });
486
- await rebuildIfRouteGraphChanged();
487
- return {
488
- engine,
489
- async getBundle() {
490
- await queueEngineWork(async function () {
491
- await engine.ensureLatestBuildOutput();
492
- await outputProcessed;
493
- });
494
- if (currentBundle) return currentBundle;
495
- if (firstBuildError) throw firstBuildError;
496
- if (!bundlePromise) {
497
- var timeoutId;
498
- bundlePromise = new Promise(function (resolve2, reject) {
499
- bundleResolve = function (value) {
500
- clearTimeout(timeoutId);
501
- resolve2(value);
502
- };
503
- bundleReject = function (error) {
504
- clearTimeout(timeoutId);
505
- reject(error);
506
- };
507
- timeoutId = setTimeout(function () {
508
- bundleResolve = null;
509
- bundleReject = null;
510
- bundlePromise = null;
511
- reject(/* @__PURE__ */new Error("[vxrn] bundle build timed out after 120s"));
512
- }, 12e4);
513
- });
514
- }
515
- return bundlePromise;
516
- },
517
- getAsset(pathname, hash) {
518
- return assetRegistry.resolve(pathname, hash);
519
- },
520
- async close() {
521
- routeWatcher === null || routeWatcher === void 0 || routeWatcher.close();
522
- await engine.close();
523
- }
524
- };
371
+ };
372
+ var outputProcessed = Promise.resolve();
373
+ var engine;
374
+ var routeWatcher;
375
+ var rebuildIfRouteGraphChanged = function() {
376
+ return queueEngineWork(async function() {
377
+ var { files: knownRoutes, scanFiles, updateFiles } = virtualEntry.routes;
378
+ var currentRoutes = scanFiles();
379
+ if (!(currentRoutes.size !== knownRoutes.size || [...currentRoutes].some(function(route) {
380
+ return !knownRoutes.has(route);
381
+ }))) return false;
382
+ updateFiles(currentRoutes);
383
+ return true;
384
+ });
385
+ };
386
+ engine = await dev(inputOptions, outputOptions, {
387
+ onOutput: async function(result) {
388
+ var finishOutput = function() {};
389
+ outputProcessed = new Promise(function(resolve2) {
390
+ finishOutput = resolve2;
391
+ });
392
+ try {
393
+ await handleOutput(result);
394
+ } finally {
395
+ finishOutput();
396
+ }
397
+ },
398
+ onHmrUpdates: async function(result) {
399
+ if (result instanceof Error) {
400
+ console.error("[vxrn] HMR error:", result.message);
401
+ onHmrUpdate === null || onHmrUpdate === void 0 || onHmrUpdate({ type: "hmr:error" });
402
+ return;
403
+ }
404
+ if (await rebuildIfRouteGraphChanged()) return;
405
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
406
+ try {
407
+ for (var _iterator = result.updates[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
408
+ var { clientId, update } = _step.value;
409
+ if (update.type === "Patch" && update.code) onHmrUpdate === null || onHmrUpdate === void 0 || onHmrUpdate({
410
+ type: "hmr:update",
411
+ clientId,
412
+ code: normalizeNativeCommonJSInterop(update.code),
413
+ changedIds: update.changedIds,
414
+ seq: update.seq
415
+ });
416
+ else if (update.type === "FullReload") onHmrUpdate === null || onHmrUpdate === void 0 || onHmrUpdate({
417
+ type: "hmr:reload",
418
+ clientId
419
+ });
420
+ }
421
+ } catch (err) {
422
+ _didIteratorError = true;
423
+ _iteratorError = err;
424
+ } finally {
425
+ try {
426
+ if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
427
+ } finally {
428
+ if (_didIteratorError) throw _iteratorError;
429
+ }
430
+ }
431
+ },
432
+ rebuildStrategy: "never",
433
+ watch: {}
434
+ });
435
+ async function handleOutput(result) {
436
+ if (result instanceof Error) {
437
+ console.error("[vxrn] native bundle error:", result.message);
438
+ if (/panic/i.test(result.message)) console.error("[vxrn] rolldown itself panicked. Fast Refresh will full-reload until you restart the dev server.");
439
+ if (!currentBundle) {
440
+ firstBuildError || (firstBuildError = result);
441
+ if (bundleReject) {
442
+ var reject = bundleReject;
443
+ bundleResolve = null;
444
+ bundleReject = null;
445
+ bundlePromise = null;
446
+ reject(firstBuildError);
447
+ }
448
+ }
449
+ return;
450
+ }
451
+ var chunk = result.output.find(function(o) {
452
+ return o.type === "chunk" && o.isEntry;
453
+ });
454
+ if (chunk && "code" in chunk) {
455
+ firstBuildError = null;
456
+ var code = postProcessNativeBundle(chunk.code);
457
+ code = await downlevelClassFieldsInBundle(code);
458
+ assertBundleLinesPreserved(chunk.code, code, "dev");
459
+ code = wrapNativeBundleModuleScope(code);
460
+ if (!chunk.map) throw new Error("[vxrn] rolldown produced no source map for the dev bundle, so /symbolicate cannot resolve a frame");
461
+ currentBundle = {
462
+ code,
463
+ map: chunk.map.toString()
464
+ };
465
+ console.info(`[vxrn] native bundle ready (${Math.round(code.length / 1024)}KB)`);
466
+ if (bundleResolve) {
467
+ bundleResolve(currentBundle);
468
+ bundleResolve = null;
469
+ bundleReject = null;
470
+ bundlePromise = null;
471
+ }
472
+ }
473
+ }
474
+ await engine.run();
475
+ var routeWatchTarget = virtualEntry.routes.routeRoot;
476
+ while (!((_statSync = statSync(routeWatchTarget, { throwIfNoEntry: false })) === null || _statSync === void 0 ? void 0 : _statSync.isDirectory())) {
477
+ var parent = dirname(routeWatchTarget);
478
+ if (parent === routeWatchTarget) break;
479
+ routeWatchTarget = parent;
480
+ }
481
+ var normalizedRouteRoot = normalizePath(virtualEntry.routes.routeRoot);
482
+ routeWatcher = watch(routeWatchTarget, { recursive: true }, function(_eventType, file) {
483
+ if (file === null) return;
484
+ var changed = normalizePath(resolve(routeWatchTarget, file.toString()));
485
+ if (changed !== normalizedRouteRoot && !changed.startsWith(`${normalizedRouteRoot}/`)) return;
486
+ rebuildIfRouteGraphChanged().catch(function(error) {
487
+ console.error(`[vxrn] rebuilding the native route map failed`, error);
488
+ });
489
+ });
490
+ routeWatcher.on("error", function(error) {
491
+ console.error(`[vxrn] watching the native route map failed`, error);
492
+ });
493
+ await rebuildIfRouteGraphChanged();
494
+ return {
495
+ engine,
496
+ async getBundle() {
497
+ await queueEngineWork(async function() {
498
+ await engine.ensureLatestBuildOutput();
499
+ await outputProcessed;
500
+ });
501
+ if (currentBundle) return currentBundle;
502
+ if (firstBuildError) throw firstBuildError;
503
+ if (!bundlePromise) {
504
+ var timeoutId;
505
+ bundlePromise = new Promise(function(resolve2, reject) {
506
+ bundleResolve = function(value) {
507
+ clearTimeout(timeoutId);
508
+ resolve2(value);
509
+ };
510
+ bundleReject = function(error) {
511
+ clearTimeout(timeoutId);
512
+ reject(error);
513
+ };
514
+ timeoutId = setTimeout(function() {
515
+ bundleResolve = null;
516
+ bundleReject = null;
517
+ bundlePromise = null;
518
+ reject(/* @__PURE__ */ new Error("[vxrn] bundle build timed out after 120s"));
519
+ }, 12e4);
520
+ });
521
+ }
522
+ return bundlePromise;
523
+ },
524
+ getAsset(pathname, hash) {
525
+ return assetRegistry.resolve(pathname, hash);
526
+ },
527
+ async close() {
528
+ routeWatcher === null || routeWatcher === void 0 || routeWatcher.close();
529
+ await engine.close();
530
+ }
531
+ };
525
532
  }
526
533
  async function buildNativeBundle(options) {
527
- var _chunk_map;
528
- var {
529
- root,
530
- platform,
531
- dev = false,
532
- serverUrl,
533
- entryFile,
534
- assetsDest,
535
- plugins: userPlugins = [],
536
- sourcemap = false,
537
- minify = !dev
538
- } = options;
539
- var {
540
- build
541
- } = await import("rolldown");
542
- var {
543
- viteImportGlobPlugin
544
- } = await import("rolldown/experimental");
545
- var prelude = getNativePrelude({
546
- dev,
547
- platform,
548
- serverUrl
549
- });
550
- var chunk = (await build({
551
- input: entryFile ? normalizePath(resolve(root, entryFile)) : VIRTUAL_NATIVE_ENTRY,
552
- cwd: root,
553
- platform: "neutral",
554
- resolve: getNativeResolveConfig(platform),
555
- transform: getNativeTransformConfig(platform, dev, root),
556
- treeshake: !dev,
557
- experimental: {
558
- lazyBarrel: false
559
- },
560
- shimMissingExports: true,
561
- moduleTypes: {
562
- ".js": "jsx"
563
- },
564
- plugins: [...(entryFile ? [] : [nativeVirtualEntryPlugin(root, {
565
- dev,
566
- platform
567
- }).plugin]), ...getNativePlugins(root, platform, viteImportGlobPlugin, dev, assetsDest, void 0, sourcemap, userPlugins), nativeBundlePostProcessPlugin()],
568
- output: getNativeOutputOptions(prelude, sourcemap, minify)
569
- })).output.find(function (o) {
570
- return o.type === "chunk" && o.isEntry;
571
- });
572
- if (!chunk || !("code" in chunk)) throw new Error("[vxrn] production build produced no output");
573
- if (sourcemap && !chunk.map) throw new Error("[vxrn] a source map was requested but rolldown produced none for the production bundle");
574
- return {
575
- code: chunk.code,
576
- map: sourcemap ? (_chunk_map = chunk.map) === null || _chunk_map === void 0 ? void 0 : _chunk_map.toString() : void 0
577
- };
534
+ var _chunk_map;
535
+ var { root, platform, dev = false, serverUrl, entryFile, assetsDest, plugins: userPlugins = [], sourcemap = false, minify = !dev } = options;
536
+ var { build } = await import("rolldown");
537
+ var { viteImportGlobPlugin } = await import("rolldown/experimental");
538
+ var prelude = getNativePrelude({
539
+ dev,
540
+ platform,
541
+ serverUrl
542
+ });
543
+ var chunk = (await build({
544
+ input: entryFile ? normalizePath(resolve(root, entryFile)) : VIRTUAL_NATIVE_ENTRY,
545
+ cwd: root,
546
+ platform: "neutral",
547
+ resolve: getNativeResolveConfig(platform),
548
+ transform: getNativeTransformConfig(platform, dev, root),
549
+ treeshake: !dev,
550
+ experimental: { lazyBarrel: false },
551
+ shimMissingExports: true,
552
+ moduleTypes: { ".js": "jsx" },
553
+ plugins: [
554
+ ...entryFile ? [] : [nativeVirtualEntryPlugin(root, {
555
+ dev,
556
+ platform
557
+ }).plugin],
558
+ ...getNativePlugins(root, platform, viteImportGlobPlugin, dev, assetsDest, void 0, sourcemap, userPlugins),
559
+ nativeBundlePostProcessPlugin()
560
+ ],
561
+ output: getNativeOutputOptions(prelude, sourcemap, minify)
562
+ })).output.find(function(o) {
563
+ return o.type === "chunk" && o.isEntry;
564
+ });
565
+ if (!chunk || !("code" in chunk)) throw new Error("[vxrn] production build produced no output");
566
+ if (sourcemap && !chunk.map) throw new Error("[vxrn] a source map was requested but rolldown produced none for the production bundle");
567
+ return {
568
+ code: chunk.code,
569
+ map: sourcemap ? (_chunk_map = chunk.map) === null || _chunk_map === void 0 ? void 0 : _chunk_map.toString() : void 0
570
+ };
578
571
  }
579
572
  var VIRTUAL_NATIVE_ENTRY = "virtual:native-entry";
580
573
  function nativeVirtualEntryPlugin(root, opts) {
581
- var isDev = (opts === null || opts === void 0 ? void 0 : opts.dev) !== false;
582
- var useDynamicRouteRegistry = opts.dynamicRoutes === true;
583
- var resolvedId = normalizePath(resolve(root, "__virtual-native-entry.tsx"));
584
- var entryConfig = globalThis.__vxrnNativeEntryConfig || {};
585
- var routerRoot = entryConfig.routerRoot || "app";
586
- var flags = entryConfig.flags || {};
587
- var linking = entryConfig.linking;
588
- var setupFileImport = function () {
589
- var sf = entryConfig.setupFile;
590
- if (!sf) return "";
591
- var file = typeof sf === "string" ? sf : "native" in sf ? sf.native : sf.ios;
592
- if (!file) return "";
593
- var resolved = pathToFileURL(resolve(root, file)).href;
594
- return `import ${JSON.stringify(resolved)};`;
595
- }();
596
- var routeGlobs = [`./${routerRoot}/**/*.tsx`, `./${routerRoot}/**/*.ts`, `!./${routerRoot}/**/*+api.*`, `!./${routerRoot}/**/*.test.*`, `!./${routerRoot}/**/*.d.ts`, `!./${routerRoot}/**/*.server.*`, `!./${routerRoot}/**/_middleware.*`, `!./${routerRoot}/**/*.web.*`, ...(entryConfig.ignoredRouteFiles || []).map(function (pattern) {
597
- return `!./${routerRoot}/${pattern}`;
598
- })];
599
- var refreshSetup = isDev ? `
574
+ var isDev = (opts === null || opts === void 0 ? void 0 : opts.dev) !== false;
575
+ var useDynamicRouteRegistry = opts.dynamicRoutes === true;
576
+ var resolvedId = normalizePath(resolve(root, "__virtual-native-entry.tsx"));
577
+ var entryConfig = globalThis.__vxrnNativeEntryConfig || {};
578
+ var routerRoot = entryConfig.routerRoot || "app";
579
+ var flags = entryConfig.flags || {};
580
+ var linking = entryConfig.linking;
581
+ var setupFileImport = (function() {
582
+ var sf = entryConfig.setupFile;
583
+ if (!sf) return "";
584
+ var file = typeof sf === "string" ? sf : "native" in sf ? sf.native : sf.ios;
585
+ if (!file) return "";
586
+ var resolved = pathToFileURL(resolve(root, file)).href;
587
+ return `import ${JSON.stringify(resolved)};`;
588
+ })();
589
+ var routeGlobs = [
590
+ `./${routerRoot}/**/*.tsx`,
591
+ `./${routerRoot}/**/*.ts`,
592
+ `!./${routerRoot}/**/*+api.*`,
593
+ `!./${routerRoot}/**/*.test.*`,
594
+ `!./${routerRoot}/**/*.d.ts`,
595
+ `!./${routerRoot}/**/*.server.*`,
596
+ `!./${routerRoot}/**/_middleware.*`,
597
+ `!./${routerRoot}/**/*.web.*`,
598
+ ...(entryConfig.ignoredRouteFiles || []).map(function(pattern) {
599
+ return `!./${routerRoot}/${pattern}`;
600
+ })
601
+ ];
602
+ var refreshSetup = isDev ? `
600
603
  // react-refresh/runtime MUST initialize before React loads
601
604
  import RefreshRuntime from 'react-refresh/runtime';
602
605
  RefreshRuntime.injectIntoGlobalHook(globalThis);
@@ -606,8 +609,8 @@ globalThis.$RefreshReg$ = function(type, id) {
606
609
  };
607
610
  globalThis.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;
608
611
  ` : "";
609
- var entryCode = function () {
610
- return `
612
+ var entryCode = function() {
613
+ return `
611
614
  ${refreshSetup}
612
615
  import * as ReactNativeInitializeCore from 'react-native/Libraries/Core/InitializeCore';
613
616
  import NativeWebSocket from 'react-native/Libraries/WebSocket/WebSocket';
@@ -635,365 +638,357 @@ createApp({
635
638
 
636
639
  ${routeHmr}
637
640
  `;
638
- };
639
- var routeRoot = resolve(root, routerRoot);
640
- var stripDot = function (pattern) {
641
- return pattern.replace(/^\.\//, "");
642
- };
643
- var includeGlobs = routeGlobs.filter(function (p) {
644
- return !p.startsWith("!");
645
- }).map(stripDot);
646
- var excludeGlobs = routeGlobs.filter(function (p) {
647
- return p.startsWith("!");
648
- }).map(function (p) {
649
- return stripDot(p.slice(1));
650
- });
651
- var isRouteFile = function (file) {
652
- var relativeToRoot = normalizePath(relative(root, file));
653
- return micromatch.isMatch(relativeToRoot, includeGlobs) && !micromatch.isMatch(relativeToRoot, excludeGlobs);
654
- };
655
- var scanFiles = function () {
656
- var _statSync;
657
- var files = /* @__PURE__ */new Set();
658
- var walkRouteRoot = function (dir) {
659
- var _iteratorNormalCompletion = true,
660
- _didIteratorError = false,
661
- _iteratorError = void 0;
662
- try {
663
- for (var _iterator = readdirSync(dir, {
664
- withFileTypes: true
665
- })[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
666
- var entry = _step.value;
667
- var child = resolve(dir, entry.name);
668
- if (entry.isDirectory()) walkRouteRoot(child);else if (isRouteFile(child)) files.add(normalizePath(child));
669
- }
670
- } catch (err) {
671
- _didIteratorError = true;
672
- _iteratorError = err;
673
- } finally {
674
- try {
675
- if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
676
- } finally {
677
- if (_didIteratorError) throw _iteratorError;
678
- }
679
- }
680
- };
681
- if ((_statSync = statSync(routeRoot, {
682
- throwIfNoEntry: false
683
- })) === null || _statSync === void 0 ? void 0 : _statSync.isDirectory()) walkRouteRoot(routeRoot);
684
- return files;
685
- };
686
- var registrySpecifier = `./node_modules/.vxrn/native-routes-${opts.platform}.mjs`;
687
- var registryPath = resolve(root, registrySpecifier);
688
- var routes = {
689
- routeRoot,
690
- files: /* @__PURE__ */new Set(),
691
- isRouteFile,
692
- scanFiles,
693
- updateFiles(files) {
694
- routes.files = files;
695
- if (!useDynamicRouteRegistry) return;
696
- var source = `export const routes = {
697
- ${[...files].sort().map(function (file) {
698
- var routeKey = `/${normalizePath(relative(root, file))}`;
699
- var importPath = normalizePath(relative(dirname(registryPath), file));
700
- if (!importPath.startsWith(".")) importPath = `./${importPath}`;
701
- return ` ${JSON.stringify(routeKey)}: () => import(${JSON.stringify(importPath)})`;
702
- }).join(",\n")}
641
+ };
642
+ var routeRoot = resolve(root, routerRoot);
643
+ var stripDot = function(pattern) {
644
+ return pattern.replace(/^\.\//, "");
645
+ };
646
+ var includeGlobs = routeGlobs.filter(function(p) {
647
+ return !p.startsWith("!");
648
+ }).map(stripDot);
649
+ var excludeGlobs = routeGlobs.filter(function(p) {
650
+ return p.startsWith("!");
651
+ }).map(function(p) {
652
+ return stripDot(p.slice(1));
653
+ });
654
+ var isRouteFile = function(file) {
655
+ var relativeToRoot = normalizePath(relative(root, file));
656
+ return micromatch.isMatch(relativeToRoot, includeGlobs) && !micromatch.isMatch(relativeToRoot, excludeGlobs);
657
+ };
658
+ var scanFiles = function() {
659
+ var _statSync;
660
+ var files = /* @__PURE__ */ new Set();
661
+ var walkRouteRoot = function(dir) {
662
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
663
+ try {
664
+ for (var _iterator = readdirSync(dir, { withFileTypes: true })[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
665
+ var entry = _step.value;
666
+ var child = resolve(dir, entry.name);
667
+ if (entry.isDirectory()) walkRouteRoot(child);
668
+ else if (isRouteFile(child)) files.add(normalizePath(child));
669
+ }
670
+ } catch (err) {
671
+ _didIteratorError = true;
672
+ _iteratorError = err;
673
+ } finally {
674
+ try {
675
+ if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
676
+ } finally {
677
+ if (_didIteratorError) throw _iteratorError;
678
+ }
679
+ }
680
+ };
681
+ if ((_statSync = statSync(routeRoot, { throwIfNoEntry: false })) === null || _statSync === void 0 ? void 0 : _statSync.isDirectory()) walkRouteRoot(routeRoot);
682
+ return files;
683
+ };
684
+ var registrySpecifier = `./node_modules/.vxrn/native-routes-${opts.platform}.mjs`;
685
+ var registryPath = resolve(root, registrySpecifier);
686
+ var routes = {
687
+ routeRoot,
688
+ files: /* @__PURE__ */ new Set(),
689
+ isRouteFile,
690
+ scanFiles,
691
+ updateFiles(files) {
692
+ routes.files = files;
693
+ if (!useDynamicRouteRegistry) return;
694
+ var source = `export const routes = {
695
+ ${[...files].sort().map(function(file) {
696
+ var routeKey = `/${normalizePath(relative(root, file))}`;
697
+ var importPath = normalizePath(relative(dirname(registryPath), file));
698
+ if (!importPath.startsWith(".")) importPath = `./${importPath}`;
699
+ return ` ${JSON.stringify(routeKey)}: () => import(${JSON.stringify(importPath)})`;
700
+ }).join(",\n")}
703
701
  }
704
702
  `;
705
- mkdirSync(dirname(registryPath), {
706
- recursive: true
707
- });
708
- if (!existsSync(registryPath) || readFileSync(registryPath, "utf8") !== source) writeFileSync(registryPath, source);
709
- }
710
- };
711
- routes.updateFiles(routes.scanFiles());
712
- var routeImports = useDynamicRouteRegistry ? `import { routes } from ${JSON.stringify(registrySpecifier)};` : `var _routes = import.meta.glob(${JSON.stringify(routeGlobs)}, { exhaustive: true });
703
+ mkdirSync(dirname(registryPath), { recursive: true });
704
+ if (!existsSync(registryPath) || readFileSync(registryPath, "utf8") !== source) writeFileSync(registryPath, source);
705
+ }
706
+ };
707
+ routes.updateFiles(routes.scanFiles());
708
+ var routeImports = useDynamicRouteRegistry ? `import { routes } from ${JSON.stringify(registrySpecifier)};` : `var _routes = import.meta.glob(${JSON.stringify(routeGlobs)}, { exhaustive: true });
713
709
  // fix route keys: One expects '/${routerRoot}/...' prefix but import.meta.glob returns './${routerRoot}/...'
714
710
  var routes = {};
715
711
  Object.keys(_routes).forEach(function(key) {
716
712
  var normalizedKey = key.replace(/^\\.\\//, '');
717
713
  routes['/' + normalizedKey] = _routes[key];
718
714
  });`;
719
- var routeHmr = useDynamicRouteRegistry ? `if (import.meta.hot) {
715
+ var routeHmr = useDynamicRouteRegistry ? `if (import.meta.hot) {
720
716
  import.meta.hot.accept(${JSON.stringify(registrySpecifier)}, function(next) {
721
717
  if (globalThis.__VXRN_UPDATE_NATIVE_ROUTES__) {
722
718
  globalThis.__VXRN_UPDATE_NATIVE_ROUTES__(next.routes);
723
719
  }
724
720
  });
725
721
  }` : "";
726
- return {
727
- routes,
728
- plugin: {
729
- name: "vxrn:native-virtual-entry",
730
- resolveId(id) {
731
- if (id === VIRTUAL_NATIVE_ENTRY) return resolvedId;
732
- },
733
- load(id) {
734
- if (id !== resolvedId) return;
735
- return entryCode();
736
- }
737
- }
738
- };
722
+ return {
723
+ routes,
724
+ plugin: {
725
+ name: "vxrn:native-virtual-entry",
726
+ resolveId(id) {
727
+ if (id === VIRTUAL_NATIVE_ENTRY) return resolvedId;
728
+ },
729
+ load(id) {
730
+ if (id !== resolvedId) return;
731
+ return entryCode();
732
+ }
733
+ }
734
+ };
739
735
  }
740
736
  function nativeAnimatedGuardPlugin() {
741
- return {
742
- name: "vxrn:native-animated-guard",
743
- transform(code, id) {
744
- if (!id.includes("animated/NativeAnimatedHelper")) return;
745
- var target = "const method = nullthrows(NativeAnimatedModule)[methodName];";
746
- if (!code.includes(target)) return;
747
- return {
748
- code: code.replace(target, `${target} if (typeof method !== 'function') return;`),
749
- map: {
750
- version: 3,
751
- sources: [id],
752
- sourcesContent: [code],
753
- names: [],
754
- mappings: code.split("\n").map(function (_, index) {
755
- return index === 0 ? "AAAA" : "AACA";
756
- }).join(";")
757
- }
758
- };
759
- }
760
- };
737
+ return {
738
+ name: "vxrn:native-animated-guard",
739
+ transform(code, id) {
740
+ if (!id.includes("animated/NativeAnimatedHelper")) return;
741
+ var target = "const method = nullthrows(NativeAnimatedModule)[methodName];";
742
+ if (!code.includes(target)) return;
743
+ return {
744
+ code: code.replace(target, `${target} if (typeof method !== 'function') return;`),
745
+ map: {
746
+ version: 3,
747
+ sources: [id],
748
+ sourcesContent: [code],
749
+ names: [],
750
+ mappings: code.split("\n").map(function(_, index) {
751
+ return index === 0 ? "AAAA" : "AACA";
752
+ }).join(";")
753
+ }
754
+ };
755
+ }
756
+ };
761
757
  }
762
758
  function serverFileExclusionPlugin() {
763
- return {
764
- name: "vxrn:server-file-exclusion",
765
- load(id) {
766
- if (/\.server\.\w+$/.test(id)) return {
767
- code: "export default undefined;",
768
- moduleType: "js"
769
- };
770
- if (/[\\/]_middleware\.\w+$/.test(id)) return {
771
- code: "export default undefined;",
772
- moduleType: "js"
773
- };
774
- }
775
- };
759
+ return {
760
+ name: "vxrn:server-file-exclusion",
761
+ load(id) {
762
+ if (/\.server\.\w+$/.test(id)) return {
763
+ code: "export default undefined;",
764
+ moduleType: "js"
765
+ };
766
+ if (/[\\/]_middleware\.\w+$/.test(id)) return {
767
+ code: "export default undefined;",
768
+ moduleType: "js"
769
+ };
770
+ }
771
+ };
776
772
  }
777
773
  function environmentGuardPlugin() {
778
- var THROWING = ["server-only", "client-only", "web-only"];
779
- var NOOP = ["native-only"];
780
- return {
781
- name: "vxrn:environment-guard",
782
- resolveId(source) {
783
- if (THROWING.includes(source)) return {
784
- id: `\0env-guard-throw:${source}`,
785
- external: false
786
- };
787
- if (NOOP.includes(source)) return {
788
- id: `\0env-guard-noop:${source}`,
789
- external: false
790
- };
791
- },
792
- load(id) {
793
- if (id.startsWith("\0env-guard-throw:")) return {
794
- code: `throw new Error("Cannot import '${id.slice(17)}' in a native bundle.");`,
795
- moduleType: "js"
796
- };
797
- if (id.startsWith("\0env-guard-noop:")) return {
798
- code: "",
799
- moduleType: "js"
800
- };
801
- }
802
- };
774
+ var THROWING = [
775
+ "server-only",
776
+ "client-only",
777
+ "web-only"
778
+ ];
779
+ var NOOP = ["native-only"];
780
+ return {
781
+ name: "vxrn:environment-guard",
782
+ resolveId(source) {
783
+ if (THROWING.includes(source)) return {
784
+ id: `\0env-guard-throw:${source}`,
785
+ external: false
786
+ };
787
+ if (NOOP.includes(source)) return {
788
+ id: `\0env-guard-noop:${source}`,
789
+ external: false
790
+ };
791
+ },
792
+ load(id) {
793
+ if (id.startsWith("\0env-guard-throw:")) return {
794
+ code: `throw new Error("Cannot import '${id.slice(17)}' in a native bundle.");`,
795
+ moduleType: "js"
796
+ };
797
+ if (id.startsWith("\0env-guard-noop:")) return {
798
+ code: "",
799
+ moduleType: "js"
800
+ };
801
+ }
802
+ };
803
803
  }
804
804
  function hmrClientNoopPlugin() {
805
- var RN_HMR_CLIENT_RE = /(^|[\\/])Utilities[\\/]HMRClient(\.[cm]?[jt]sx?)?$/;
806
- return {
807
- name: "vxrn:hmr-client-noop",
808
- resolveId(source, importer) {
809
- if ((source.startsWith("react-native/") || importer != null && /(^|[\\/])react-native[\\/]/.test(importer)) && RN_HMR_CLIENT_RE.test(source)) return {
810
- id: "\0vxrn-hmr-client-noop",
811
- external: false
812
- };
813
- },
814
- load(id) {
815
- if (id === "\0vxrn-hmr-client-noop") return {
816
- code: `const HMRClient = { setup() {}, enable() {}, disable() {}, registerBundle() {}, log() {}, isEnabled() { return false } }
805
+ var RN_HMR_CLIENT_RE = /(^|[\\/])Utilities[\\/]HMRClient(\.[cm]?[jt]sx?)?$/;
806
+ return {
807
+ name: "vxrn:hmr-client-noop",
808
+ resolveId(source, importer) {
809
+ if ((source.startsWith("react-native/") || importer != null && /(^|[\\/])react-native[\\/]/.test(importer)) && RN_HMR_CLIENT_RE.test(source)) return {
810
+ id: "\0vxrn-hmr-client-noop",
811
+ external: false
812
+ };
813
+ },
814
+ load(id) {
815
+ if (id === "\0vxrn-hmr-client-noop") return {
816
+ code: `const HMRClient = { setup() {}, enable() {}, disable() {}, registerBundle() {}, log() {}, isEnabled() { return false } }
817
817
  export default HMRClient`,
818
- moduleType: "js"
819
- };
820
- }
821
- };
818
+ moduleType: "js"
819
+ };
820
+ }
821
+ };
822
822
  }
823
823
  function reactNativeDedupePlugin(root) {
824
- var reactNativeRoot;
825
- return {
826
- name: "vxrn:react-native-dedupe",
827
- async resolveId(source, importer) {
828
- if (source !== "react-native" && !source.startsWith("react-native/")) return;
829
- reactNativeRoot || (reactNativeRoot = realpathSync(dirname(resolvePath("react-native/package.json", root))));
830
- var subpath = source === "react-native" ? "index.js" : source.slice(13);
831
- return this.resolve(normalizePath(resolve(reactNativeRoot, subpath)), importer, {
832
- skipSelf: true
833
- });
834
- }
835
- };
824
+ var reactNativeRoot;
825
+ return {
826
+ name: "vxrn:react-native-dedupe",
827
+ async resolveId(source, importer) {
828
+ if (source !== "react-native" && !source.startsWith("react-native/")) return;
829
+ reactNativeRoot || (reactNativeRoot = realpathSync(dirname(resolvePath("react-native/package.json", root))));
830
+ var subpath = source === "react-native" ? "index.js" : source.slice(13);
831
+ return this.resolve(normalizePath(resolve(reactNativeRoot, subpath)), importer, { skipSelf: true });
832
+ }
833
+ };
836
834
  }
837
835
  function cssStubPlugin() {
838
- return {
839
- name: "vxrn:css-stub",
840
- load: {
841
- handler(id) {
842
- if (id.endsWith(".css")) return {
843
- code: "",
844
- moduleType: "js"
845
- };
846
- }
847
- }
848
- };
836
+ return {
837
+ name: "vxrn:css-stub",
838
+ load: { handler(id) {
839
+ if (id.endsWith(".css")) return {
840
+ code: "",
841
+ moduleType: "js"
842
+ };
843
+ } }
844
+ };
849
845
  }
850
846
  function vxrnCompilerPlugin(platform, dev) {
851
- var projectRoot = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : process.cwd(),
852
- sourceMaps = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;
853
- var compiler = null;
854
- var isRefreshCandidate = function (id) {
855
- return dev && !id.includes("node_modules") && !id.includes("__virtual-native-entry") && /\.[tj]sx?$/.test(id);
856
- };
857
- return {
858
- name: "vxrn:compiler",
859
- async transform(code, id) {
860
- var _ref;
861
- var _babelOptions_plugins, _babelOptions_plugins1;
862
- if (!/\.[cm]?[jt]sx?$/.test(id)) return;
863
- if (id.includes("\0") || id.includes("virtual:")) return;
864
- var needsRefresh = isRefreshCandidate(id);
865
- if (!compiler) compiler = await import("@vxrn/compiler");
866
- var props = {
867
- id,
868
- code,
869
- projectRoot,
870
- development: dev,
871
- environment: platform,
872
- reactForRNVersion: "19"
873
- };
874
- var babelOptions = compiler.getBabelOptions(props);
875
- var curCode = code;
876
- var intermediateMaps = [];
877
- var isWorkletPlugin = function (entry) {
878
- if (!entry) return false;
879
- var name = typeof entry === "string" ? entry : Array.isArray(entry) ? entry[0] : null;
880
- return typeof name === "string" && (name.includes("react-native-worklets") || name.includes("react-native-reanimated"));
881
- };
882
- var workletEntry = babelOptions === null || babelOptions === void 0 ? void 0 : (_babelOptions_plugins = babelOptions.plugins) === null || _babelOptions_plugins === void 0 ? void 0 : _babelOptions_plugins.find(isWorkletPlugin);
883
- var workletPluginOptions = Array.isArray(workletEntry) ? workletEntry[1] : void 0;
884
- var useWorklets = compiler.isNativeWorkletsEnabled() && (Boolean(workletEntry) || compiler.shouldTransformWorklets({
885
- id,
886
- code
887
- }));
888
- var compilerPluginIndex = (_ref = babelOptions === null || babelOptions === void 0 ? void 0 : (_babelOptions_plugins1 = babelOptions.plugins) === null || _babelOptions_plugins1 === void 0 ? void 0 : _babelOptions_plugins1.findIndex(function (x) {
889
- return Array.isArray(x) && x[0] === "babel-plugin-react-compiler";
890
- })) !== null && _ref !== void 0 ? _ref : -1;
891
- if (compilerPluginIndex !== -1) {
892
- if (useWorklets) {
893
- var prepared = compiler.prepareWorkletsForReactCompiler(id, curCode, sourceMaps);
894
- if (prepared) {
895
- curCode = prepared.code;
896
- if (prepared.map) intermediateMaps.push(prepared.map);
897
- }
898
- }
899
- var compilerPluginOptions = babelOptions.plugins[compilerPluginIndex][1] || {};
900
- if (!(compilerPluginOptions.compiler === "babel" || process.env.ONE_REACT_COMPILER === "babel" || process.env.VXRN_REACT_COMPILER === "babel")) {
901
- var compilerOut = await compiler.transformOxcReactCompiler(id, curCode, compilerPluginOptions, sourceMaps);
902
- if (compilerOut === null || compilerOut === void 0 ? void 0 : compilerOut.code) {
903
- curCode = compilerOut.code;
904
- if (sourceMaps && compilerOut.map) intermediateMaps.push(compilerOut.map);
905
- }
906
- babelOptions.plugins.splice(compilerPluginIndex, 1);
907
- if (babelOptions.plugins.length === 0 && !babelOptions.configFile && !babelOptions.babelrc) babelOptions = null;
908
- }
909
- }
910
- if (useWorklets) {
911
- var workletOut = await compiler.transformWorklets(id, curCode, sourceMaps, {
912
- projectRoot,
913
- ...workletPluginOptions
914
- });
915
- if (workletOut === null || workletOut === void 0 ? void 0 : workletOut.code) {
916
- curCode = workletOut.code;
917
- if (sourceMaps && workletOut.map) intermediateMaps.push(workletOut.map);
918
- }
919
- if (babelOptions === null || babelOptions === void 0 ? void 0 : babelOptions.plugins) {
920
- babelOptions.plugins = babelOptions.plugins.filter(function (entry) {
921
- return !isWorkletPlugin(entry);
922
- });
923
- if (babelOptions.plugins.length === 0 && !babelOptions.configFile && !babelOptions.babelrc) babelOptions = null;
924
- }
925
- }
926
- if (!babelOptions && !needsRefresh) {
927
- if (curCode !== code) {
928
- var finalMap = void 0;
929
- if (sourceMaps && intermediateMaps.length > 0) if (intermediateMaps.length === 1) finalMap = intermediateMaps[0];else {
930
- var remapping = (await import("@jridgewell/remapping")).default;
931
- finalMap = remapping(intermediateMaps.slice().reverse(), function () {
932
- return null;
933
- });
934
- }
935
- return {
936
- code: curCode,
937
- map: finalMap
938
- };
939
- }
940
- return;
941
- }
942
- if (sourceMaps && babelOptions) {
943
- babelOptions = {
944
- ...babelOptions,
945
- sourceMaps: true,
946
- sourceFileName: id
947
- };
948
- delete babelOptions.inputSourceMap;
949
- }
950
- if (babelOptions) {
951
- var result = await compiler.transformBabel(id, curCode, babelOptions);
952
- if (result === null || result === void 0 ? void 0 : result.code) {
953
- curCode = result.code;
954
- if (sourceMaps && result.map) intermediateMaps.push(result.map);
955
- if (!needsRefresh) {
956
- var finalMap1 = void 0;
957
- if (sourceMaps && intermediateMaps.length > 0) if (intermediateMaps.length === 1) finalMap1 = intermediateMaps[0];else {
958
- var remapping1 = (await import("@jridgewell/remapping")).default;
959
- finalMap1 = remapping1(intermediateMaps.slice().reverse(), function () {
960
- return null;
961
- });
962
- }
963
- return {
964
- code: curCode,
965
- map: finalMap1
966
- };
967
- }
968
- }
969
- }
970
- if (needsRefresh) {
971
- var _compiler_configuration;
972
- var {
973
- transformSync
974
- } = await import("oxc-transform-react");
975
- var jsxImportSource = ((_compiler_configuration = compiler.configuration) === null || _compiler_configuration === void 0 ? void 0 : _compiler_configuration.enableNativewind) && !id.includes("node_modules") ? "nativewind" : "react";
976
- var res = transformSync(id, curCode, {
977
- jsx: {
978
- development: dev,
979
- runtime: "automatic",
980
- importSource: jsxImportSource,
981
- refresh: {
982
- refreshReg: "__vxrnRefreshReg",
983
- refreshSig: "__vxrnRefreshSig"
984
- }
985
- },
986
- reactCompiler: false,
987
- sourcemap: sourceMaps
988
- });
989
- if (res.fatal) {
990
- var _res_errors;
991
- throw new Error(`[vxrn:compiler] oxc react transform failed on ${id}: ${((_res_errors = res.errors) !== null && _res_errors !== void 0 ? _res_errors : []).map(function (e) {
992
- var _e_message;
993
- return (_e_message = e.message) !== null && _e_message !== void 0 ? _e_message : String(e);
994
- }).join(", ")}`);
995
- }
996
- var header = `var __prevRefreshReg = globalThis.$RefreshReg$;
847
+ var projectRoot = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : process.cwd(), sourceMaps = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;
848
+ var compiler = null;
849
+ var isRefreshCandidate = function(id) {
850
+ return dev && !id.includes("node_modules") && !id.includes("__virtual-native-entry") && /\.[tj]sx?$/.test(id);
851
+ };
852
+ return {
853
+ name: "vxrn:compiler",
854
+ async transform(code, id) {
855
+ var _ref;
856
+ var _babelOptions_plugins, _babelOptions_plugins1;
857
+ if (!/\.[cm]?[jt]sx?$/.test(id)) return;
858
+ if (id.includes("\0") || id.includes("virtual:")) return;
859
+ var needsRefresh = isRefreshCandidate(id);
860
+ if (!compiler) compiler = await import("@vxrn/compiler");
861
+ var props = {
862
+ id,
863
+ code,
864
+ projectRoot,
865
+ development: dev,
866
+ environment: platform,
867
+ reactForRNVersion: "19"
868
+ };
869
+ var babelOptions = compiler.getBabelOptions(props);
870
+ var curCode = code;
871
+ var intermediateMaps = [];
872
+ var isWorkletPlugin = function(entry) {
873
+ if (!entry) return false;
874
+ var name = typeof entry === "string" ? entry : Array.isArray(entry) ? entry[0] : null;
875
+ return typeof name === "string" && (name.includes("react-native-worklets") || name.includes("react-native-reanimated"));
876
+ };
877
+ var workletEntry = babelOptions === null || babelOptions === void 0 ? void 0 : (_babelOptions_plugins = babelOptions.plugins) === null || _babelOptions_plugins === void 0 ? void 0 : _babelOptions_plugins.find(isWorkletPlugin);
878
+ var workletPluginOptions = Array.isArray(workletEntry) ? workletEntry[1] : void 0;
879
+ var useWorklets = compiler.isNativeWorkletsEnabled() && (Boolean(workletEntry) || compiler.shouldTransformWorklets({
880
+ id,
881
+ code
882
+ }));
883
+ var compilerPluginIndex = (_ref = babelOptions === null || babelOptions === void 0 ? void 0 : (_babelOptions_plugins1 = babelOptions.plugins) === null || _babelOptions_plugins1 === void 0 ? void 0 : _babelOptions_plugins1.findIndex(function(x) {
884
+ return Array.isArray(x) && x[0] === "babel-plugin-react-compiler";
885
+ })) !== null && _ref !== void 0 ? _ref : -1;
886
+ if (compilerPluginIndex !== -1) {
887
+ if (useWorklets) {
888
+ var prepared = compiler.prepareWorkletsForReactCompiler(id, curCode, sourceMaps);
889
+ if (prepared) {
890
+ curCode = prepared.code;
891
+ if (prepared.map) intermediateMaps.push(prepared.map);
892
+ }
893
+ }
894
+ var compilerPluginOptions = babelOptions.plugins[compilerPluginIndex][1] || {};
895
+ if (!(compilerPluginOptions.compiler === "babel" || process.env.ONE_REACT_COMPILER === "babel" || process.env.VXRN_REACT_COMPILER === "babel")) {
896
+ var compilerOut = await compiler.transformOxcReactCompiler(id, curCode, compilerPluginOptions, sourceMaps);
897
+ if (compilerOut === null || compilerOut === void 0 ? void 0 : compilerOut.code) {
898
+ curCode = compilerOut.code;
899
+ if (sourceMaps && compilerOut.map) intermediateMaps.push(compilerOut.map);
900
+ }
901
+ babelOptions.plugins.splice(compilerPluginIndex, 1);
902
+ if (babelOptions.plugins.length === 0 && !babelOptions.configFile && !babelOptions.babelrc) babelOptions = null;
903
+ }
904
+ }
905
+ if (useWorklets) {
906
+ var workletOut = await compiler.transformWorklets(id, curCode, sourceMaps, {
907
+ projectRoot,
908
+ ...workletPluginOptions
909
+ });
910
+ if (workletOut === null || workletOut === void 0 ? void 0 : workletOut.code) {
911
+ curCode = workletOut.code;
912
+ if (sourceMaps && workletOut.map) intermediateMaps.push(workletOut.map);
913
+ }
914
+ if (babelOptions === null || babelOptions === void 0 ? void 0 : babelOptions.plugins) {
915
+ babelOptions.plugins = babelOptions.plugins.filter(function(entry) {
916
+ return !isWorkletPlugin(entry);
917
+ });
918
+ if (babelOptions.plugins.length === 0 && !babelOptions.configFile && !babelOptions.babelrc) babelOptions = null;
919
+ }
920
+ }
921
+ if (!babelOptions && !needsRefresh) {
922
+ if (curCode !== code) {
923
+ var finalMap = void 0;
924
+ if (sourceMaps && intermediateMaps.length > 0) if (intermediateMaps.length === 1) finalMap = intermediateMaps[0];
925
+ else {
926
+ var remapping = (await import("@jridgewell/remapping")).default;
927
+ finalMap = remapping(intermediateMaps.slice().reverse(), function() {
928
+ return null;
929
+ });
930
+ }
931
+ return {
932
+ code: curCode,
933
+ map: finalMap
934
+ };
935
+ }
936
+ return;
937
+ }
938
+ if (sourceMaps && babelOptions) {
939
+ babelOptions = {
940
+ ...babelOptions,
941
+ sourceMaps: true,
942
+ sourceFileName: id
943
+ };
944
+ delete babelOptions.inputSourceMap;
945
+ }
946
+ if (babelOptions) {
947
+ var result = await compiler.transformBabel(id, curCode, babelOptions);
948
+ if (result === null || result === void 0 ? void 0 : result.code) {
949
+ curCode = result.code;
950
+ if (sourceMaps && result.map) intermediateMaps.push(result.map);
951
+ if (!needsRefresh) {
952
+ var finalMap1 = void 0;
953
+ if (sourceMaps && intermediateMaps.length > 0) if (intermediateMaps.length === 1) finalMap1 = intermediateMaps[0];
954
+ else {
955
+ var remapping1 = (await import("@jridgewell/remapping")).default;
956
+ finalMap1 = remapping1(intermediateMaps.slice().reverse(), function() {
957
+ return null;
958
+ });
959
+ }
960
+ return {
961
+ code: curCode,
962
+ map: finalMap1
963
+ };
964
+ }
965
+ }
966
+ }
967
+ if (needsRefresh) {
968
+ var _compiler_configuration;
969
+ var { transformSync } = await import("oxc-transform-react");
970
+ var jsxImportSource = ((_compiler_configuration = compiler.configuration) === null || _compiler_configuration === void 0 ? void 0 : _compiler_configuration.enableNativewind) && !id.includes("node_modules") ? "nativewind" : "react";
971
+ var res = transformSync(id, curCode, {
972
+ jsx: {
973
+ development: dev,
974
+ runtime: "automatic",
975
+ importSource: jsxImportSource,
976
+ refresh: {
977
+ refreshReg: "__vxrnRefreshReg",
978
+ refreshSig: "__vxrnRefreshSig"
979
+ }
980
+ },
981
+ reactCompiler: false,
982
+ sourcemap: sourceMaps
983
+ });
984
+ if (res.fatal) {
985
+ var _res_errors;
986
+ throw new Error(`[vxrn:compiler] oxc react transform failed on ${id}: ${((_res_errors = res.errors) !== null && _res_errors !== void 0 ? _res_errors : []).map(function(e) {
987
+ var _e_message;
988
+ return (_e_message = e.message) !== null && _e_message !== void 0 ? _e_message : String(e);
989
+ }).join(", ")}`);
990
+ }
991
+ var header = `var __prevRefreshReg = globalThis.$RefreshReg$;
997
992
  var __prevRefreshSig = globalThis.$RefreshSig$;
998
993
  if (globalThis.__ReactRefresh) {
999
994
  globalThis.$RefreshReg$ = function(type, id) {
@@ -1006,7 +1001,7 @@ var __vxrnRefreshReg = globalThis.$RefreshReg$;
1006
1001
  var __vxrnRefreshSig = globalThis.$RefreshSig$;
1007
1002
 
1008
1003
  `;
1009
- var footer = `
1004
+ var footer = `
1010
1005
 
1011
1006
  globalThis.$RefreshReg$ = __prevRefreshReg;
1012
1007
  globalThis.$RefreshSig$ = __prevRefreshSig;
@@ -1018,338 +1013,347 @@ if (import.meta.hot) {
1018
1013
  });
1019
1014
  }
1020
1015
  `;
1021
- var out;
1022
- var finalMap2 = void 0;
1023
- if (sourceMaps) {
1024
- var MagicString = (await import("magic-string")).default;
1025
- var ms = new MagicString(res.code);
1026
- ms.prepend(header);
1027
- ms.append(footer);
1028
- out = ms.toString();
1029
- var allMaps = [ms.generateMap({
1030
- source: id,
1031
- hires: true
1032
- }), res.map, ...intermediateMaps.slice().reverse()].filter(Boolean);
1033
- var remapping2 = (await import("@jridgewell/remapping")).default;
1034
- finalMap2 = remapping2(allMaps, function () {
1035
- return null;
1036
- });
1037
- } else out = header + res.code + footer;
1038
- return {
1039
- code: out,
1040
- map: finalMap2
1041
- };
1042
- }
1043
- }
1044
- };
1016
+ var out;
1017
+ var finalMap2 = void 0;
1018
+ if (sourceMaps) {
1019
+ var MagicString = (await import("magic-string")).default;
1020
+ var ms = new MagicString(res.code);
1021
+ ms.prepend(header);
1022
+ ms.append(footer);
1023
+ out = ms.toString();
1024
+ var allMaps = [
1025
+ ms.generateMap({
1026
+ source: id,
1027
+ hires: true
1028
+ }),
1029
+ res.map,
1030
+ ...intermediateMaps.slice().reverse()
1031
+ ].filter(Boolean);
1032
+ var remapping2 = (await import("@jridgewell/remapping")).default;
1033
+ finalMap2 = remapping2(allMaps, function() {
1034
+ return null;
1035
+ });
1036
+ } else out = header + res.code + footer;
1037
+ return {
1038
+ code: out,
1039
+ map: finalMap2
1040
+ };
1041
+ }
1042
+ }
1043
+ };
1045
1044
  }
1046
1045
  function flowStripPlugin() {
1047
- return {
1048
- name: "vxrn:flow-strip",
1049
- transform: {
1050
- async handler(code, id) {
1051
- if (!shouldStripFlow(id, code)) return;
1052
- var result = await (await import("fast-flow-transform")).default({
1053
- filename: id,
1054
- source: code,
1055
- sourcemap: true,
1056
- dialect: "flow",
1057
- format: "pretty"
1058
- });
1059
- return {
1060
- code: result.code,
1061
- map: result.map
1062
- };
1063
- }
1064
- }
1065
- };
1046
+ return {
1047
+ name: "vxrn:flow-strip",
1048
+ transform: { async handler(code, id) {
1049
+ if (!shouldStripFlow(id, code)) return;
1050
+ var { stripFlowTypes } = await import("@vxrn/compiler");
1051
+ var result = await stripFlowTypes(id, code);
1052
+ return {
1053
+ code: result.code,
1054
+ map: result.map
1055
+ };
1056
+ } }
1057
+ };
1066
1058
  }
1067
1059
  function assetPlugin(opts) {
1068
- var assetRegex = new RegExp(`\\.(?:${DEFAULT_ASSET_EXTS.join("|")})$`);
1069
- return {
1070
- name: "vxrn:asset",
1071
- load: {
1072
- async handler(id) {
1073
- var _opts_onAsset;
1074
- if (!assetRegex.test(id)) return;
1075
- var assetData = await getNativeAssetData(id, opts.root, opts.platform);
1076
- (_opts_onAsset = opts.onAsset) === null || _opts_onAsset === void 0 || _opts_onAsset.call(opts, assetData);
1077
- if (opts.assetsDest) copyNativeAssetFiles(assetData, opts.assetsDest, opts.platform);
1078
- return {
1079
- code: `module.exports = require('react-native/Libraries/Image/AssetRegistry').registerAsset(${JSON.stringify(assetData)});`,
1080
- moduleType: "js"
1081
- };
1082
- }
1083
- }
1084
- };
1060
+ var assetRegex = new RegExp(`\\.(?:${DEFAULT_ASSET_EXTS.join("|")})$`);
1061
+ return {
1062
+ name: "vxrn:asset",
1063
+ load: { async handler(id) {
1064
+ var _opts_onAsset;
1065
+ if (!assetRegex.test(id)) return;
1066
+ var assetData = await getNativeAssetData(id, opts.root, opts.platform);
1067
+ (_opts_onAsset = opts.onAsset) === null || _opts_onAsset === void 0 || _opts_onAsset.call(opts, assetData);
1068
+ if (opts.assetsDest) copyNativeAssetFiles(assetData, opts.assetsDest, opts.platform);
1069
+ return {
1070
+ code: `module.exports = require('react-native/asset-registry').registerAsset(${JSON.stringify(assetData)});`,
1071
+ moduleType: "js"
1072
+ };
1073
+ } }
1074
+ };
1085
1075
  }
1086
1076
  function createNativeDevAssetRegistry() {
1087
- var assets = /* @__PURE__ */new Map();
1088
- return {
1089
- register(asset) {
1090
- var _iteratorNormalCompletion = true,
1091
- _didIteratorError = false,
1092
- _iteratorError = void 0;
1093
- try {
1094
- for (var _iterator = asset.scales.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
1095
- var [index, scale] = _step.value;
1096
- var filePath = asset.files[index];
1097
- if (!filePath) continue;
1098
- var fileName = `${asset.name}${scale === 1 ? "" : `@${scale}x`}.${asset.type}`;
1099
- assets.set(`${asset.httpServerLocation}/${fileName}`, {
1100
- filePath,
1101
- hash: asset.hash,
1102
- type: asset.type
1103
- });
1104
- }
1105
- } catch (err) {
1106
- _didIteratorError = true;
1107
- _iteratorError = err;
1108
- } finally {
1109
- try {
1110
- if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
1111
- } finally {
1112
- if (_didIteratorError) throw _iteratorError;
1113
- }
1114
- }
1115
- },
1116
- resolve(pathname, hash) {
1117
- var asset = assets.get(pathname);
1118
- if (!asset || hash !== void 0 && hash !== asset.hash) return;
1119
- return asset;
1120
- }
1121
- };
1077
+ var assets = /* @__PURE__ */ new Map();
1078
+ return {
1079
+ register(asset) {
1080
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
1081
+ try {
1082
+ for (var _iterator = asset.scales.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
1083
+ var [index, scale] = _step.value;
1084
+ var filePath = asset.files[index];
1085
+ if (!filePath) continue;
1086
+ var fileName = `${asset.name}${scale === 1 ? "" : `@${scale}x`}.${asset.type}`;
1087
+ assets.set(`${asset.httpServerLocation}/${fileName}`, {
1088
+ filePath,
1089
+ hash: asset.hash,
1090
+ type: asset.type
1091
+ });
1092
+ }
1093
+ } catch (err) {
1094
+ _didIteratorError = true;
1095
+ _iteratorError = err;
1096
+ } finally {
1097
+ try {
1098
+ if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
1099
+ } finally {
1100
+ if (_didIteratorError) throw _iteratorError;
1101
+ }
1102
+ }
1103
+ },
1104
+ resolve(pathname, hash) {
1105
+ var asset = assets.get(pathname);
1106
+ if (!asset || hash !== void 0 && hash !== asset.hash) return;
1107
+ return asset;
1108
+ }
1109
+ };
1122
1110
  }
1123
- var NATIVE_IMAGE_EXTS = /* @__PURE__ */new Set(["png", "jpg", "jpeg", "gif", "webp", "bmp", "psd", "svg", "tiff", "ktx"]);
1111
+ var NATIVE_IMAGE_EXTS = /* @__PURE__ */ new Set([
1112
+ "png",
1113
+ "jpg",
1114
+ "jpeg",
1115
+ "gif",
1116
+ "webp",
1117
+ "bmp",
1118
+ "psd",
1119
+ "svg",
1120
+ "tiff",
1121
+ "ktx"
1122
+ ]);
1124
1123
  function parseNativeAssetName(filePath) {
1125
- var _ref;
1126
- var type = extname(filePath).slice(1);
1127
- if (!type) return;
1128
- var stem = basename(filePath, `.${type}`);
1129
- var platformMatch = stem.match(/^(.*)\.(ios|android)$/);
1130
- var platform = platformMatch === null || platformMatch === void 0 ? void 0 : platformMatch[2];
1131
- var scaleMatch = ((_ref = platformMatch === null || platformMatch === void 0 ? void 0 : platformMatch[1]) !== null && _ref !== void 0 ? _ref : stem).match(/^(.+?)(?:@([\d.]+)x)?$/);
1132
- if (!scaleMatch) return;
1133
- var scale = scaleMatch[2] === void 0 ? 1 : Number.parseFloat(scaleMatch[2]);
1134
- if (!Number.isFinite(scale) || scale <= 0) return;
1135
- return {
1136
- name: scaleMatch[1],
1137
- scale,
1138
- platform,
1139
- type
1140
- };
1124
+ var _ref;
1125
+ var type = extname(filePath).slice(1);
1126
+ if (!type) return;
1127
+ var stem = basename(filePath, `.${type}`);
1128
+ var platformMatch = stem.match(/^(.*)\.(ios|android)$/);
1129
+ var platform = platformMatch === null || platformMatch === void 0 ? void 0 : platformMatch[2];
1130
+ var scaleMatch = ((_ref = platformMatch === null || platformMatch === void 0 ? void 0 : platformMatch[1]) !== null && _ref !== void 0 ? _ref : stem).match(/^(.+?)(?:@([\d.]+)x)?$/);
1131
+ if (!scaleMatch) return;
1132
+ var scale = scaleMatch[2] === void 0 ? 1 : Number.parseFloat(scaleMatch[2]);
1133
+ if (!Number.isFinite(scale) || scale <= 0) return;
1134
+ return {
1135
+ name: scaleMatch[1],
1136
+ scale,
1137
+ platform,
1138
+ type
1139
+ };
1141
1140
  }
1142
1141
  function getNativeAssetUrlDirectory(root, assetDirectory) {
1143
- var safeDirectory = relative(realpathSync(root), realpathSync(assetDirectory)).replace(/\\/g, "/").split("/").filter(function (segment) {
1144
- return segment && segment !== ".";
1145
- }).map(function (segment) {
1146
- return segment === ".." ? "_" : segment;
1147
- }).join("/");
1148
- return safeDirectory ? `/assets/${safeDirectory}` : "/assets";
1142
+ var safeDirectory = relative(realpathSync(root), realpathSync(assetDirectory)).replace(/\\/g, "/").split("/").filter(function(segment) {
1143
+ return segment && segment !== ".";
1144
+ }).map(function(segment) {
1145
+ return segment === ".." ? "_" : segment;
1146
+ }).join("/");
1147
+ return safeDirectory ? `/assets/${safeDirectory}` : "/assets";
1149
1148
  }
1150
1149
  async function getNativeAssetData(id, root, platform) {
1151
- var requested = parseNativeAssetName(id);
1152
- if (!requested) throw new Error(`[vxrn] invalid native asset path: ${id}`);
1153
- var assetDirectory = dirname(id);
1154
- var filesByScale = /* @__PURE__ */new Map();
1155
- var _iteratorNormalCompletion = true,
1156
- _didIteratorError = false,
1157
- _iteratorError = void 0;
1158
- try {
1159
- for (var _iterator = readdirSync(assetDirectory)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
1160
- var fileName = _step.value;
1161
- var candidate = parseNativeAssetName(fileName);
1162
- if (!candidate || candidate.name !== requested.name || candidate.type !== requested.type || candidate.platform !== void 0 && candidate.platform !== platform) continue;
1163
- var platformSpecific = candidate.platform === platform;
1164
- var existing = filesByScale.get(candidate.scale);
1165
- if (!existing || platformSpecific && !existing.platformSpecific) filesByScale.set(candidate.scale, {
1166
- file: join(assetDirectory, fileName),
1167
- platformSpecific
1168
- });
1169
- }
1170
- } catch (err) {
1171
- _didIteratorError = true;
1172
- _iteratorError = err;
1173
- } finally {
1174
- try {
1175
- if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
1176
- } finally {
1177
- if (_didIteratorError) throw _iteratorError;
1178
- }
1179
- }
1180
- var scales = [...filesByScale.keys()].sort(function (a, b) {
1181
- return a - b;
1182
- });
1183
- var files = scales.map(function (scale) {
1184
- return filesByScale.get(scale).file;
1185
- });
1186
- if (files.length === 0) throw new Error(`[vxrn] native asset has no files for ${platform}: ${id}`);
1187
- var hash = createHash("md5");
1188
- var _iteratorNormalCompletion1 = true,
1189
- _didIteratorError1 = false,
1190
- _iteratorError1 = void 0;
1191
- try {
1192
- for (var _iterator1 = files[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
1193
- var file = _step1.value;
1194
- hash.update(readFileSync(file));
1195
- }
1196
- } catch (err) {
1197
- _didIteratorError1 = true;
1198
- _iteratorError1 = err;
1199
- } finally {
1200
- try {
1201
- if (!_iteratorNormalCompletion1 && _iterator1.return != null) _iterator1.return();
1202
- } finally {
1203
- if (_didIteratorError1) throw _iteratorError1;
1204
- }
1205
- }
1206
- var assetData = {
1207
- __packager_asset: true,
1208
- name: requested.name,
1209
- type: requested.type,
1210
- scales,
1211
- files,
1212
- httpServerLocation: getNativeAssetUrlDirectory(root, assetDirectory),
1213
- fileSystemLocation: assetDirectory,
1214
- hash: hash.digest("hex")
1215
- };
1216
- if (NATIVE_IMAGE_EXTS.has(requested.type)) try {
1217
- var {
1218
- imageSize
1219
- } = await import("image-size");
1220
- var dims = imageSize(files[0]);
1221
- assetData.width = dims.width === void 0 ? void 0 : dims.width / scales[0];
1222
- assetData.height = dims.height === void 0 ? void 0 : dims.height / scales[0];
1223
- } catch (unused) {}
1224
- return assetData;
1150
+ var requested = parseNativeAssetName(id);
1151
+ if (!requested) throw new Error(`[vxrn] invalid native asset path: ${id}`);
1152
+ var assetDirectory = dirname(id);
1153
+ var filesByScale = /* @__PURE__ */ new Map();
1154
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
1155
+ try {
1156
+ for (var _iterator = readdirSync(assetDirectory)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
1157
+ var fileName = _step.value;
1158
+ var candidate = parseNativeAssetName(fileName);
1159
+ if (!candidate || candidate.name !== requested.name || candidate.type !== requested.type || candidate.platform !== void 0 && candidate.platform !== platform) continue;
1160
+ var platformSpecific = candidate.platform === platform;
1161
+ var existing = filesByScale.get(candidate.scale);
1162
+ if (!existing || platformSpecific && !existing.platformSpecific) filesByScale.set(candidate.scale, {
1163
+ file: join(assetDirectory, fileName),
1164
+ platformSpecific
1165
+ });
1166
+ }
1167
+ } catch (err) {
1168
+ _didIteratorError = true;
1169
+ _iteratorError = err;
1170
+ } finally {
1171
+ try {
1172
+ if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
1173
+ } finally {
1174
+ if (_didIteratorError) throw _iteratorError;
1175
+ }
1176
+ }
1177
+ var scales = [...filesByScale.keys()].sort(function(a, b) {
1178
+ return a - b;
1179
+ });
1180
+ var files = scales.map(function(scale) {
1181
+ return filesByScale.get(scale).file;
1182
+ });
1183
+ if (files.length === 0) throw new Error(`[vxrn] native asset has no files for ${platform}: ${id}`);
1184
+ var hash = createHash("md5");
1185
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
1186
+ try {
1187
+ for (var _iterator1 = files[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
1188
+ var file = _step1.value;
1189
+ hash.update(readFileSync(file));
1190
+ }
1191
+ } catch (err) {
1192
+ _didIteratorError1 = true;
1193
+ _iteratorError1 = err;
1194
+ } finally {
1195
+ try {
1196
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) _iterator1.return();
1197
+ } finally {
1198
+ if (_didIteratorError1) throw _iteratorError1;
1199
+ }
1200
+ }
1201
+ var assetData = {
1202
+ __packager_asset: true,
1203
+ name: requested.name,
1204
+ type: requested.type,
1205
+ scales,
1206
+ files,
1207
+ httpServerLocation: getNativeAssetUrlDirectory(root, assetDirectory),
1208
+ fileSystemLocation: assetDirectory,
1209
+ hash: hash.digest("hex")
1210
+ };
1211
+ if (NATIVE_IMAGE_EXTS.has(requested.type)) try {
1212
+ var { imageSize } = await import("image-size");
1213
+ var dims = imageSize(files[0]);
1214
+ assetData.width = dims.width === void 0 ? void 0 : dims.width / scales[0];
1215
+ assetData.height = dims.height === void 0 ? void 0 : dims.height / scales[0];
1216
+ } catch (unused) {}
1217
+ return assetData;
1225
1218
  }
1226
1219
  function getIOSAssetScales(scales) {
1227
- var _scales_find;
1228
- var supported = scales.filter(function (scale) {
1229
- return scale === 1 || scale === 2 || scale === 3;
1230
- });
1231
- if (supported.length > 0 || scales.length === 0) return supported;
1232
- return [(_scales_find = scales.find(function (scale) {
1233
- return scale > 3;
1234
- })) !== null && _scales_find !== void 0 ? _scales_find : scales[scales.length - 1]];
1220
+ var _scales_find;
1221
+ var supported = scales.filter(function(scale) {
1222
+ return scale === 1 || scale === 2 || scale === 3;
1223
+ });
1224
+ if (supported.length > 0 || scales.length === 0) return supported;
1225
+ return [(_scales_find = scales.find(function(scale) {
1226
+ return scale > 3;
1227
+ })) !== null && _scales_find !== void 0 ? _scales_find : scales[scales.length - 1]];
1235
1228
  }
1236
1229
  function getAndroidAssetDirectory(type, scale) {
1237
- if (!(/* @__PURE__ */new Set(["gif", "heic", "heif", "jpeg", "jpg", "ktx", "png", "webp", "xml"])).has(type)) return "raw";
1238
- var density = (/* @__PURE__ */new Map([[.75, "ldpi"], [1, "mdpi"], [1.5, "hdpi"], [2, "xhdpi"], [3, "xxhdpi"], [4, "xxxhdpi"]])).get(scale);
1239
- if (density) return `drawable-${density}`;
1240
- return `drawable-${Math.round(scale * 160)}dpi`;
1230
+ if (!(/* @__PURE__ */ new Set([
1231
+ "gif",
1232
+ "heic",
1233
+ "heif",
1234
+ "jpeg",
1235
+ "jpg",
1236
+ "ktx",
1237
+ "png",
1238
+ "webp",
1239
+ "xml"
1240
+ ])).has(type)) return "raw";
1241
+ var density = (/* @__PURE__ */ new Map([
1242
+ [.75, "ldpi"],
1243
+ [1, "mdpi"],
1244
+ [1.5, "hdpi"],
1245
+ [2, "xhdpi"],
1246
+ [3, "xxhdpi"],
1247
+ [4, "xxxhdpi"]
1248
+ ])).get(scale);
1249
+ if (density) return `drawable-${density}`;
1250
+ return `drawable-${Math.round(scale * 160)}dpi`;
1241
1251
  }
1242
1252
  function getAndroidAssetName(asset) {
1243
- return `${asset.httpServerLocation}/${asset.name}`.toLowerCase().replace(/^\//, "").replace(/\//g, "_").replace(/([^a-z0-9_])/g, "").replace(/^assets_/, "");
1253
+ return `${asset.httpServerLocation}/${asset.name}`.toLowerCase().replace(/^\//, "").replace(/\//g, "_").replace(/([^a-z0-9_])/g, "").replace(/^assets_/, "");
1244
1254
  }
1245
1255
  function copyNativeAssetFiles(asset, assetsDest, platform) {
1246
- var validIOSScales = new Set(getIOSAssetScales(asset.scales));
1247
- var _iteratorNormalCompletion = true,
1248
- _didIteratorError = false,
1249
- _iteratorError = void 0;
1250
- try {
1251
- for (var _iterator = asset.scales.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
1252
- var [index, scale] = _step.value;
1253
- if (platform === "ios" && !validIOSScales.has(scale)) continue;
1254
- var destination = platform === "android" ? join(assetsDest, getAndroidAssetDirectory(asset.type, scale), `${getAndroidAssetName(asset)}.${asset.type}`) : join(assetsDest, asset.httpServerLocation.slice(1), `${asset.name}${scale === 1 ? "" : `@${scale}x`}.${asset.type}`);
1255
- mkdirSync(dirname(destination), {
1256
- recursive: true
1257
- });
1258
- copyFileSync(asset.files[index], destination);
1259
- }
1260
- } catch (err) {
1261
- _didIteratorError = true;
1262
- _iteratorError = err;
1263
- } finally {
1264
- try {
1265
- if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
1266
- } finally {
1267
- if (_didIteratorError) throw _iteratorError;
1268
- }
1269
- }
1256
+ var validIOSScales = new Set(getIOSAssetScales(asset.scales));
1257
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
1258
+ try {
1259
+ for (var _iterator = asset.scales.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
1260
+ var [index, scale] = _step.value;
1261
+ if (platform === "ios" && !validIOSScales.has(scale)) continue;
1262
+ var destination = platform === "android" ? join(assetsDest, getAndroidAssetDirectory(asset.type, scale), `${getAndroidAssetName(asset)}.${asset.type}`) : join(assetsDest, asset.httpServerLocation.slice(1), `${asset.name}${scale === 1 ? "" : `@${scale}x`}.${asset.type}`);
1263
+ mkdirSync(dirname(destination), { recursive: true });
1264
+ copyFileSync(asset.files[index], destination);
1265
+ }
1266
+ } catch (err) {
1267
+ _didIteratorError = true;
1268
+ _iteratorError = err;
1269
+ } finally {
1270
+ try {
1271
+ if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
1272
+ } finally {
1273
+ if (_didIteratorError) throw _iteratorError;
1274
+ }
1275
+ }
1270
1276
  }
1271
1277
  function hermesCompatSWCPlugin(dev) {
1272
- var sourceMaps = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
1273
- var oxc = null;
1274
- return {
1275
- name: "vxrn:hermes-compat",
1276
- async transform(code, id) {
1277
- var _ref;
1278
- if (!/\.[cm]?[jt]sx?$/.test(id)) return;
1279
- if (id.includes("\0") || id.includes("virtual:")) return;
1280
- var hasClass = code.includes("class ") || code.includes("class{");
1281
- var hasAsync = code.includes("async");
1282
- var hasBlockScopedLoop = /\bfor\s*\(\s*(?:const|let)\b/.test(code);
1283
- if (!hasClass && !hasAsync && !hasBlockScopedLoop) return;
1284
- var output;
1285
- if (code.length <= 5e5) {
1286
- var _result_errors;
1287
- if (!oxc) oxc = await import("oxc-transform");
1288
- var lang = /\.[cm]?ts$/.test(id) ? "ts" : id.endsWith(".tsx") ? "tsx" : "jsx";
1289
- var result = oxc.transformSync(id, code, {
1290
- lang,
1291
- target: "es2020",
1292
- assumptions: {
1293
- setPublicClassFields: true
1294
- },
1295
- jsx: "preserve",
1296
- sourcemap: sourceMaps,
1297
- sourceType: id.endsWith(".cjs") ? "script" : "module"
1298
- });
1299
- if ((_result_errors = result.errors) === null || _result_errors === void 0 ? void 0 : _result_errors.length) {
1300
- var err = result.errors[0];
1301
- throw new Error(err.message + (err.codeframe ? `
1278
+ var sourceMaps = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
1279
+ var oxc = null;
1280
+ return {
1281
+ name: "vxrn:hermes-compat",
1282
+ async transform(code, id) {
1283
+ var _ref;
1284
+ if (!/\.[cm]?[jt]sx?$/.test(id)) return;
1285
+ if (id.includes("\0") || id.includes("virtual:")) return;
1286
+ var hasClass = code.includes("class ") || code.includes("class{");
1287
+ var hasAsync = code.includes("async");
1288
+ var hasBlockScopedLoop = /\bfor\s*\(\s*(?:const|let)\b/.test(code);
1289
+ if (!hasClass && !hasAsync && !hasBlockScopedLoop) return;
1290
+ var output;
1291
+ if (code.length <= 5e5) {
1292
+ var _result_errors;
1293
+ if (!oxc) oxc = await import("oxc-transform");
1294
+ var lang = /\.[cm]?ts$/.test(id) ? "ts" : id.endsWith(".tsx") ? "tsx" : "jsx";
1295
+ var result = oxc.transformSync(id, code, {
1296
+ lang,
1297
+ target: "es2020",
1298
+ assumptions: { setPublicClassFields: true },
1299
+ jsx: "preserve",
1300
+ sourcemap: sourceMaps,
1301
+ sourceType: id.endsWith(".cjs") ? "script" : "module"
1302
+ });
1303
+ if ((_result_errors = result.errors) === null || _result_errors === void 0 ? void 0 : _result_errors.length) {
1304
+ var err = result.errors[0];
1305
+ throw new Error(err.message + (err.codeframe ? `
1302
1306
  ${err.codeframe}` : ""));
1303
- }
1304
- output = {
1305
- code: result.code,
1306
- map: sourceMaps ? result.map : void 0
1307
- };
1308
- }
1309
- var lowered = await transformHermesAsync((_ref = output === null || output === void 0 ? void 0 : output.code) !== null && _ref !== void 0 ? _ref : code, id, sourceMaps);
1310
- if (!lowered) return output;
1311
- if (lowered.map && (output === null || output === void 0 ? void 0 : output.map)) {
1312
- var remapping = (await import("@jridgewell/remapping")).default;
1313
- lowered.map = remapping([lowered.map, output.map], function () {
1314
- return null;
1315
- });
1316
- }
1317
- return lowered;
1318
- }
1319
- };
1307
+ }
1308
+ output = {
1309
+ code: result.code,
1310
+ map: sourceMaps ? result.map : void 0
1311
+ };
1312
+ }
1313
+ var lowered = await transformHermesAsync((_ref = output === null || output === void 0 ? void 0 : output.code) !== null && _ref !== void 0 ? _ref : code, id, sourceMaps);
1314
+ if (!lowered) return output;
1315
+ if (lowered.map && (output === null || output === void 0 ? void 0 : output.map)) {
1316
+ var remapping = (await import("@jridgewell/remapping")).default;
1317
+ lowered.map = remapping([lowered.map, output.map], function() {
1318
+ return null;
1319
+ });
1320
+ }
1321
+ return lowered;
1322
+ }
1323
+ };
1320
1324
  }
1321
1325
  var hermesCompatPlugin = hermesCompatSWCPlugin;
1322
1326
  function hermesLoopsPlugin() {
1323
- var sourceMaps = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
1324
- var compiler = null;
1325
- return {
1326
- name: "vxrn:hermes-loops",
1327
- async transform(code, id) {
1328
- if (!/\.[cm]?[jt]sx?$/.test(id)) return;
1329
- if (id.includes("\0") || id.includes("virtual:")) return;
1330
- if (!compiler) compiler = await import("@vxrn/compiler");
1331
- var result = compiler.transformHermesLoops(code, id);
1332
- if (!result) return;
1333
- if (!sourceMaps) return {
1334
- code: result.code,
1335
- map: null
1336
- };
1337
- if (result.maps.length === 1) return {
1338
- code: result.code,
1339
- map: result.maps[0]
1340
- };
1341
- var remapping = (await import("@jridgewell/remapping")).default;
1342
- return {
1343
- code: result.code,
1344
- map: remapping(result.maps.slice().reverse(), function () {
1345
- return null;
1346
- })
1347
- };
1348
- }
1349
- };
1327
+ var sourceMaps = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
1328
+ var compiler = null;
1329
+ return {
1330
+ name: "vxrn:hermes-loops",
1331
+ async transform(code, id) {
1332
+ if (!/\.[cm]?[jt]sx?$/.test(id)) return;
1333
+ if (id.includes("\0") || id.includes("virtual:")) return;
1334
+ if (!compiler) compiler = await import("@vxrn/compiler");
1335
+ var result = compiler.transformHermesLoops(code, id);
1336
+ if (!result) return;
1337
+ if (!sourceMaps) return {
1338
+ code: result.code,
1339
+ map: null
1340
+ };
1341
+ if (result.maps.length === 1) return {
1342
+ code: result.code,
1343
+ map: result.maps[0]
1344
+ };
1345
+ var remapping = (await import("@jridgewell/remapping")).default;
1346
+ return {
1347
+ code: result.code,
1348
+ map: remapping(result.maps.slice().reverse(), function() {
1349
+ return null;
1350
+ })
1351
+ };
1352
+ }
1353
+ };
1350
1354
  }
1351
1355
  function getHmrRuntimeSource() {
1352
- return `
1356
+ return `
1353
1357
  // vxrn HMR runtime for rolldown devMode
1354
1358
  var BaseDevRuntime = DevRuntime;
1355
1359
 
@@ -1586,5 +1590,6 @@ class ReactNativeDevRuntime extends BaseDevRuntime {
1586
1590
  globalThis.__rolldown_runtime__ = new ReactNativeDevRuntime();
1587
1591
  `;
1588
1592
  }
1593
+
1589
1594
  export { buildNativeBundle, createNativeDevAssetRegistry, createNativeDevEngine, getHermesSWCIncludes, getHmrRuntimeSource, getNativeAssetData, getNativeTransformConfig, hermesCompatPlugin, hermesCompatSWCPlugin, hermesLoopsPlugin, hmrClientNoopPlugin, nativeAnimatedGuardPlugin, normalizeNativeCommonJSInterop, postProcessNativeBundle, vxrnCompilerPlugin, wrapNativeBundleModuleScope };
1590
1595
  //# sourceMappingURL=createNativeDevEngine.native.js.map