vxrn 1.25.4 → 1.25.5

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