vxrn 1.25.3 → 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 +157 -80
  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 -875
  253. package/dist/utils/createNativeDevEngine.mjs.map +0 -1
  254. package/dist/utils/createNativeDevEngine.native.js +0 -932
  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,875 +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
- if (currentBundle) return currentBundle;
350
- if (!bundlePromise) {
351
- let timeoutId;
352
- bundlePromise = new Promise((resolve2, reject) => {
353
- bundleResolve = value => {
354
- clearTimeout(timeoutId);
355
- resolve2(value);
356
- };
357
- timeoutId = setTimeout(() => reject(/* @__PURE__ */new Error("[vxrn] bundle build timed out after 120s")), 12e4);
358
- });
359
- }
360
- await engine.ensureLatestBuildOutput();
361
- if (currentBundle) return currentBundle;
362
- return bundlePromise;
363
- },
364
- async close() {
365
- await engine.close();
366
- }
367
- };
368
- }
369
- async function buildNativeBundle(options) {
370
- const {
371
- root,
372
- platform,
373
- dev = false,
374
- serverUrl,
375
- entryFile,
376
- assetsDest,
377
- plugins: userPlugins = [],
378
- sourcemap = false
379
- } = options;
380
- const {
381
- build
382
- } = await import("rolldown");
383
- const {
384
- viteImportGlobPlugin
385
- } = await import("rolldown/experimental");
386
- const prelude = getNativePrelude({
387
- dev,
388
- platform,
389
- serverUrl
390
- });
391
- const chunk = (await build({
392
- input: entryFile ? normalizePath(resolve(root, entryFile)) : VIRTUAL_NATIVE_ENTRY,
393
- cwd: root,
394
- platform: "neutral",
395
- resolve: getNativeResolveConfig(platform),
396
- transform: getNativeTransformConfig(platform, dev, root),
397
- treeshake: !dev,
398
- experimental: {
399
- lazyBarrel: false
400
- },
401
- shimMissingExports: true,
402
- moduleTypes: {
403
- ".js": "jsx"
404
- },
405
- plugins: [...(entryFile ? [] : [nativeVirtualEntryPlugin(root, {
406
- dev
407
- })]), ...getNativePlugins(root, platform, viteImportGlobPlugin, dev, assetsDest), ...userPlugins],
408
- output: getNativeOutputOptions(prelude, sourcemap)
409
- })).output.find(o => o.type === "chunk" && o.isEntry);
410
- if (!chunk || !("code" in chunk)) throw new Error("[vxrn] production build produced no output");
411
- let code = postProcessNativeBundle(chunk.code);
412
- code = await downlevelClassFieldsInBundle(code);
413
- return {
414
- code,
415
- map: sourcemap ? chunk.map?.toString() : void 0
416
- };
417
- }
418
- const VIRTUAL_NATIVE_ENTRY = "virtual:native-entry";
419
- function nativeVirtualEntryPlugin(root, opts) {
420
- const isDev = opts?.dev !== false;
421
- const resolvedId = normalizePath(resolve(root, "__virtual-native-entry.tsx"));
422
- const entryConfig = globalThis.__vxrnNativeEntryConfig || {};
423
- const routerRoot = entryConfig.routerRoot || "app";
424
- const flags = entryConfig.flags || {};
425
- const linking = entryConfig.linking;
426
- const setupFileImport = (() => {
427
- const sf = entryConfig.setupFile;
428
- if (!sf) return "";
429
- const file = typeof sf === "string" ? sf : "native" in sf ? sf.native : sf.ios;
430
- if (!file) return "";
431
- const resolved = pathToFileURL(resolve(root, file)).href;
432
- return `import ${JSON.stringify(resolved)};`;
433
- })();
434
- 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}`)];
435
- const entryCode = `
436
- ${isDev ? `
437
- // react-refresh/runtime MUST initialize before React loads
438
- import RefreshRuntime from 'react-refresh/runtime';
439
- RefreshRuntime.injectIntoGlobalHook(globalThis);
440
- globalThis.__ReactRefresh = RefreshRuntime;
441
- globalThis.$RefreshReg$ = function(type, id) {
442
- RefreshRuntime.register(type, id);
443
- };
444
- globalThis.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;
445
- ` : ""}
446
- import * as ReactNativeInitializeCore from 'react-native/Libraries/Core/InitializeCore';
447
- import NativeWebSocket from 'react-native/Libraries/WebSocket/WebSocket';
448
- ${setupFileImport}
449
- import { createApp } from 'one';
450
-
451
- void ReactNativeInitializeCore;
452
- globalThis.WebSocket = NativeWebSocket;
453
-
454
- var _routes = import.meta.glob(${JSON.stringify(routeGlobs)}, { exhaustive: true });
455
- // fix route keys: One expects '/${routerRoot}/...' prefix but import.meta.glob returns './${routerRoot}/...'
456
- var routes = {};
457
- Object.keys(_routes).forEach(function(key) {
458
- var normalizedKey = key.replace(/^\\.\\//, '');
459
- routes['/' + normalizedKey] = _routes[key];
460
- });
461
-
462
- createApp({
463
- routes: routes,
464
- routerRoot: ${JSON.stringify(routerRoot)},
465
- flags: ${JSON.stringify(flags)},
466
- linking: ${JSON.stringify(linking)},
467
- });
468
- `;
469
- return {
470
- name: "vxrn:native-virtual-entry",
471
- resolveId(id) {
472
- if (id === VIRTUAL_NATIVE_ENTRY) return resolvedId;
473
- },
474
- load(id) {
475
- if (id === resolvedId) return entryCode;
476
- }
477
- };
478
- }
479
- function nativeAnimatedGuardPlugin() {
480
- return {
481
- name: "vxrn:native-animated-guard",
482
- transform(code, id) {
483
- if (!id.includes("animated/NativeAnimatedHelper")) return;
484
- const target = "const method = nullthrows(NativeAnimatedModule)[methodName];";
485
- if (!code.includes(target)) return;
486
- return {
487
- code: code.replace(target, `const method = nullthrows(NativeAnimatedModule)[methodName];
488
- if (typeof method !== 'function') return;`)
489
- };
490
- }
491
- };
492
- }
493
- function serverFileExclusionPlugin() {
494
- return {
495
- name: "vxrn:server-file-exclusion",
496
- load(id) {
497
- if (/\.server\.\w+$/.test(id)) return {
498
- code: "export default undefined;",
499
- moduleType: "js"
500
- };
501
- if (/[\\/]_middleware\.\w+$/.test(id)) return {
502
- code: "export default undefined;",
503
- moduleType: "js"
504
- };
505
- }
506
- };
507
- }
508
- function environmentGuardPlugin() {
509
- const THROWING = ["server-only", "client-only", "web-only"];
510
- const NOOP = ["native-only"];
511
- return {
512
- name: "vxrn:environment-guard",
513
- resolveId(source) {
514
- if (THROWING.includes(source)) return {
515
- id: `\0env-guard-throw:${source}`,
516
- external: false
517
- };
518
- if (NOOP.includes(source)) return {
519
- id: `\0env-guard-noop:${source}`,
520
- external: false
521
- };
522
- },
523
- load(id) {
524
- if (id.startsWith("\0env-guard-throw:")) return {
525
- code: `throw new Error("Cannot import '${id.slice(17)}' in a native bundle.");`,
526
- moduleType: "js"
527
- };
528
- if (id.startsWith("\0env-guard-noop:")) return {
529
- code: "",
530
- moduleType: "js"
531
- };
532
- }
533
- };
534
- }
535
- function hmrClientNoopPlugin() {
536
- const RN_HMR_CLIENT_RE = /(^|[\\/])Utilities[\\/]HMRClient(\.[cm]?[jt]sx?)?$/;
537
- return {
538
- name: "vxrn:hmr-client-noop",
539
- resolveId(source, importer) {
540
- if ((source.startsWith("react-native/") || importer != null && /(^|[\\/])react-native[\\/]/.test(importer)) && RN_HMR_CLIENT_RE.test(source)) return {
541
- id: "\0vxrn-hmr-client-noop",
542
- external: false
543
- };
544
- },
545
- load(id) {
546
- if (id === "\0vxrn-hmr-client-noop") return {
547
- code: `const HMRClient = { setup() {}, enable() {}, disable() {}, registerBundle() {}, log() {}, isEnabled() { return false } }
548
- export default HMRClient`,
549
- moduleType: "js"
550
- };
551
- }
552
- };
553
- }
554
- function cssStubPlugin() {
555
- return {
556
- name: "vxrn:css-stub",
557
- load: {
558
- handler(id) {
559
- if (id.endsWith(".css")) return {
560
- code: "",
561
- moduleType: "js"
562
- };
563
- }
564
- }
565
- };
566
- }
567
- function vxrnCompilerPlugin(platform, dev) {
568
- let compiler = null;
569
- const isRefreshCandidate = id => dev && !id.includes("node_modules") && !id.includes("__virtual-native-entry") && /\.[tj]sx?$/.test(id);
570
- return {
571
- name: "vxrn:compiler",
572
- async transform(code, id) {
573
- if (!/\.[cm]?[jt]sx?$/.test(id)) return;
574
- if (id.includes("\0") || id.includes("virtual:")) return;
575
- const needsRefresh = isRefreshCandidate(id);
576
- try {
577
- if (!compiler) compiler = await import("@vxrn/compiler");
578
- const props = {
579
- id,
580
- code,
581
- development: dev,
582
- environment: platform,
583
- reactForRNVersion: "19"
584
- };
585
- let babelOptions = compiler.getBabelOptions(props);
586
- if (needsRefresh) {
587
- const existingPlugins = babelOptions?.plugins || [];
588
- babelOptions = {
589
- ...babelOptions,
590
- plugins: [...existingPlugins, ["react-refresh/babel", {
591
- skipEnvCheck: true,
592
- refreshReg: "__vxrnRefreshReg",
593
- refreshSig: "__vxrnRefreshSig"
594
- }]]
595
- };
596
- }
597
- if (!babelOptions) return;
598
- const result = await compiler.transformBabel(id, code, babelOptions);
599
- if (result?.code) {
600
- let out = result.code;
601
- if (needsRefresh) out = `
602
- var __prevRefreshReg = globalThis.$RefreshReg$;
603
- var __prevRefreshSig = globalThis.$RefreshSig$;
604
- if (globalThis.__ReactRefresh) {
605
- globalThis.$RefreshReg$ = function(type, id) {
606
- globalThis.__ReactRefresh.register(type, "${id.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}" + " " + id);
607
- };
608
- globalThis.$RefreshSig$ = globalThis.__ReactRefresh.createSignatureFunctionForTransform;
609
- }
610
- // keep registration calls local so rolldown retains them in the initial bundle.
611
- var __vxrnRefreshReg = globalThis.$RefreshReg$;
612
- var __vxrnRefreshSig = globalThis.$RefreshSig$;
613
-
614
- ${out}
615
-
616
- globalThis.$RefreshReg$ = __prevRefreshReg;
617
- globalThis.$RefreshSig$ = __prevRefreshSig;
618
- if (import.meta.hot) {
619
- import.meta.hot.accept(function() {
620
- if (globalThis.__ReactRefresh) {
621
- setTimeout(function() { globalThis.__ReactRefresh.performReactRefresh(); }, 30);
622
- }
623
- });
624
- }
625
- `;
626
- return {
627
- code: out
628
- };
629
- }
630
- } catch (err) {
631
- if (dev) console.warn(`[vxrn:compiler] ${id}: ${err.message || err}`);
632
- if (needsRefresh) return {
633
- code: code + `
634
- if (import.meta.hot) { import.meta.hot.accept(); }
635
- `
636
- };
637
- }
638
- }
639
- };
640
- }
641
- function flowStripPlugin() {
642
- return {
643
- name: "vxrn:flow-strip",
644
- transform: {
645
- async handler(code, id) {
646
- if (!FLOW_FILE_PATTERN.test(id)) return;
647
- try {
648
- const result = await (await import("fast-flow-transform")).default({
649
- filename: id,
650
- source: code,
651
- sourcemap: true,
652
- dialect: "flow",
653
- format: "pretty"
654
- });
655
- return {
656
- code: result.code,
657
- map: result.map
658
- };
659
- } catch (err) {
660
- console.warn(`[vxrn:flow-strip] ${id}: ${err.message}`);
661
- }
662
- }
663
- }
664
- };
665
- }
666
- function assetPlugin(opts) {
667
- const assetRegex = new RegExp(`\\.(?:${DEFAULT_ASSET_EXTS.join("|")})$`);
668
- return {
669
- name: "vxrn:asset",
670
- load: {
671
- async handler(id) {
672
- if (!assetRegex.test(id)) return;
673
- const ext = extname(id).slice(1);
674
- const name = basename(id, `.${ext}`);
675
- const dir = dirname(id);
676
- const relativePath = relative(opts.root, id);
677
- const assetData = {
678
- __packager_asset: true,
679
- name,
680
- type: ext,
681
- scales: [1],
682
- httpServerLocation: "/assets/" + dirname(relativePath).replace(/\\/g, "/"),
683
- fileSystemLocation: dir,
684
- hash: "",
685
- width: void 0,
686
- height: void 0
687
- };
688
- if (["png", "jpg", "jpeg", "gif", "webp", "bmp"].includes(ext)) try {
689
- const {
690
- imageSize
691
- } = await import("image-size");
692
- const dims = imageSize(id);
693
- assetData.width = dims.width;
694
- assetData.height = dims.height;
695
- } catch {}
696
- if (opts.assetsDest) {
697
- const relativeAssetDir = dirname(relativePath).replace(/\\/g, "/");
698
- const assetDestDir = join(opts.assetsDest, "assets", relativeAssetDir);
699
- mkdirSync(assetDestDir, {
700
- recursive: true
701
- });
702
- copyFileSync(id, join(assetDestDir, `${name}.${ext}`));
703
- }
704
- return {
705
- code: `module.exports = require('react-native/Libraries/Image/AssetRegistry').registerAsset(${JSON.stringify(assetData)});`,
706
- moduleType: "js"
707
- };
708
- }
709
- }
710
- };
711
- }
712
- function hermesCompatSWCPlugin(dev) {
713
- let swc = null;
714
- return {
715
- name: "vxrn:hermes-compat",
716
- async transform(code, id) {
717
- if (!/\.[cm]?[jt]sx?$/.test(id)) return;
718
- if (id.includes("\0") || id.includes("virtual:")) return;
719
- const hasClass = code.includes("class ") || code.includes("class{");
720
- const hasAsync = !dev && code.includes("async ");
721
- if (!hasClass && !hasAsync) return;
722
- if (code.length > 5e5) return;
723
- try {
724
- if (!swc) swc = await import("@swc/core");
725
- const envIncludes = getHermesSWCIncludes(dev);
726
- return {
727
- code: (await swc.transform(code, {
728
- filename: id,
729
- configFile: false,
730
- swcrc: false,
731
- sourceMaps: false,
732
- inputSourceMap: false,
733
- env: {
734
- targets: {
735
- node: 9999
736
- },
737
- include: envIncludes
738
- },
739
- jsc: {
740
- parser: {
741
- syntax: "typescript",
742
- tsx: true
743
- },
744
- transform: {
745
- react: {
746
- runtime: "preserve"
747
- }
748
- },
749
- externalHelpers: false,
750
- assumptions: {
751
- setPublicClassFields: true,
752
- privateFieldsAsProperties: true
753
- }
754
- },
755
- isModule: !id.endsWith(".cjs")
756
- })).code
757
- };
758
- } catch (err) {}
759
- }
760
- };
761
- }
762
- function getHmrRuntimeSource() {
763
- return `
764
- // vxrn HMR runtime for rolldown devMode
765
- var BaseDevRuntime = DevRuntime;
766
-
767
- class ReactNativeDevRuntime extends BaseDevRuntime {
768
- constructor() {
769
- var _shared = { _socket: null, _queue: [] };
770
- var clientId = 'rn-' + Date.now() + '-' + Math.random().toString(36).slice(2);
771
- super({ send: function(msg) {
772
- var s = JSON.stringify(msg);
773
- if (_shared._socket && _shared._socket.readyState === 1) { _shared._socket.send(s); }
774
- else { _shared._queue.push(s); }
775
- }}, clientId);
776
- this._shared = _shared;
777
- this._socket = null;
778
- this._queue = [];
779
- this.moduleHotContexts = {};
780
- }
781
-
782
- createModuleHotContext(moduleId) {
783
- var ctx = {
784
- acceptCallbacks: [],
785
- accept: function(cb) {
786
- if (cb) ctx.acceptCallbacks.push({ deps: [moduleId], fn: cb });
787
- },
788
- invalidate: function() {},
789
- on: function() {},
790
- off: function() {},
791
- send: function() {},
792
- get refresh() { return globalThis.__ReactRefresh; },
793
- get refreshUtils() {
794
- return {
795
- isReactRefreshBoundary: function(exports) {
796
- if (!globalThis.__ReactRefresh) return false;
797
- if (globalThis.__ReactRefresh.isLikelyComponentType(exports)) return true;
798
- if (!exports || typeof exports !== 'object') return false;
799
- var hasExports = false, allComponents = true;
800
- for (var key in exports) {
801
- hasExports = true;
802
- if (key === '__esModule') continue;
803
- if (!globalThis.__ReactRefresh.isLikelyComponentType(exports[key])) allComponents = false;
804
- }
805
- return hasExports && allComponents;
806
- },
807
- enqueueUpdate: function() {
808
- if (globalThis.__ReactRefresh) {
809
- setTimeout(function() { globalThis.__ReactRefresh.performReactRefresh(); }, 50);
810
- }
811
- }
812
- };
813
- }
814
- };
815
- this.moduleHotContexts[moduleId] = ctx;
816
- return ctx;
817
- }
818
-
819
- applyUpdates(boundaries) {
820
- for (var i = 0; i < boundaries.length; i++) {
821
- var moduleId = boundaries[i][0];
822
- var ctx = this.moduleHotContexts[moduleId];
823
- if (ctx && ctx.acceptCallbacks) {
824
- for (var j = 0; j < ctx.acceptCallbacks.length; j++) {
825
- ctx.acceptCallbacks[j].fn(this.modules[moduleId].exports);
826
- }
827
- }
828
- // surface each committed module id to the framework hot-update hook (if one
829
- // is registered). RN's React Refresh can't repaint frameworks that re-wrap
830
- // route components away from the edited module's Refresh family (e.g. One),
831
- // and the web route-update event has no equivalent on the native /hot
832
- // socket, so this generic vxrn global is the bridge.
833
- try {
834
- if (globalThis.__VXRN_ON_MODULE_UPDATED__ && moduleId) globalThis.__VXRN_ON_MODULE_UPDATED__(moduleId);
835
- } catch (error) {
836
- console.error('[vxrn HMR]: module update hook failed', error);
837
- }
838
- }
839
- }
840
-
841
- setup(socket, origin) {
842
- if (this._socket) return;
843
- this._socket = socket;
844
- // also set the shared messenger socket so queued messages can flush
845
- if (this._shared) this._shared._socket = socket;
846
-
847
- var flushQueues = function() {
848
- // flush messenger queue
849
- if (this._shared && this._shared._queue.length) {
850
- for (var i = 0; i < this._shared._queue.length; i++) socket.send(this._shared._queue[i]);
851
- this._shared._queue = [];
852
- }
853
- // flush instance queue
854
- for (var i = 0; i < this._queue.length; i++) socket.send(this._queue[i]);
855
- this._queue = [];
856
- }.bind(this);
857
-
858
- if (socket.readyState === 1) {
859
- flushQueues();
860
- } else {
861
- socket.addEventListener('open', function() {
862
- flushQueues();
863
- }, { once: true });
864
- }
865
-
866
- // HMR message handling is done by the outro WebSocket handler
867
- // the runtime's setup() only needs to flush queued messages
868
- }
869
- }
870
-
871
- globalThis.__rolldown_runtime__ = new ReactNativeDevRuntime();
872
- `;
873
- }
874
- export { buildNativeBundle, createNativeDevEngine, getHermesSWCIncludes, getNativeTransformConfig, hmrClientNoopPlugin, vxrnCompilerPlugin, wrapNativeBundleModuleScope };
875
- //# sourceMappingURL=createNativeDevEngine.mjs.map