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