vxrn 1.27.1 → 2.0.0-beta.45.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (456) hide show
  1. package/dist/cli.mjs +212 -261
  2. package/dist/cli.mjs.map +1 -1
  3. package/dist/cli.native.js +216 -265
  4. package/dist/cli.native.js.map +1 -1
  5. package/dist/config/getAdditionalViteConfig.mjs +33 -62
  6. package/dist/config/getAdditionalViteConfig.mjs.map +1 -1
  7. package/dist/config/getAdditionalViteConfig.native.js +33 -62
  8. package/dist/config/getAdditionalViteConfig.native.js.map +1 -1
  9. package/dist/config/getBaseViteConfigOnly.mjs +84 -77
  10. package/dist/config/getBaseViteConfigOnly.mjs.map +1 -1
  11. package/dist/config/getBaseViteConfigOnly.native.js +86 -79
  12. package/dist/config/getBaseViteConfigOnly.native.js.map +1 -1
  13. package/dist/config/getBaseViteConfigWithPlugins.mjs +6 -4
  14. package/dist/config/getBaseViteConfigWithPlugins.mjs.map +1 -1
  15. package/dist/config/getBaseViteConfigWithPlugins.native.js +6 -4
  16. package/dist/config/getBaseViteConfigWithPlugins.native.js.map +1 -1
  17. package/dist/config/getBaseVitePlugins.mjs +102 -130
  18. package/dist/config/getBaseVitePlugins.mjs.map +1 -1
  19. package/dist/config/getBaseVitePlugins.native.js +123 -152
  20. package/dist/config/getBaseVitePlugins.native.js.map +1 -1
  21. package/dist/config/getNonCliModeOnlyVitePlugins.mjs +3 -3
  22. package/dist/config/getNonCliModeOnlyVitePlugins.mjs.map +1 -1
  23. package/dist/config/getNonCliModeOnlyVitePlugins.native.js +3 -1
  24. package/dist/config/getNonCliModeOnlyVitePlugins.native.js.map +1 -1
  25. package/dist/config/getOptimizeDeps.mjs +138 -42
  26. package/dist/config/getOptimizeDeps.mjs.map +1 -1
  27. package/dist/config/getOptimizeDeps.native.js +138 -42
  28. package/dist/config/getOptimizeDeps.native.js.map +1 -1
  29. package/dist/config/getOptionsFilled.mjs +48 -52
  30. package/dist/config/getOptionsFilled.mjs.map +1 -1
  31. package/dist/config/getOptionsFilled.native.js +51 -55
  32. package/dist/config/getOptionsFilled.native.js.map +1 -1
  33. package/dist/config/getReactNativePlugins.mjs +23 -15
  34. package/dist/config/getReactNativePlugins.mjs.map +1 -1
  35. package/dist/config/getReactNativePlugins.native.js +25 -16
  36. package/dist/config/getReactNativePlugins.native.js.map +1 -1
  37. package/dist/config/getServerOptionsFilled.mjs +33 -35
  38. package/dist/config/getServerOptionsFilled.mjs.map +1 -1
  39. package/dist/config/getServerOptionsFilled.native.js +35 -38
  40. package/dist/config/getServerOptionsFilled.native.js.map +1 -1
  41. package/dist/config/getViteServerConfig.mjs +34 -45
  42. package/dist/config/getViteServerConfig.mjs.map +1 -1
  43. package/dist/config/getViteServerConfig.native.js +35 -46
  44. package/dist/config/getViteServerConfig.native.js.map +1 -1
  45. package/dist/config/mergeUserConfig.mjs +50 -28
  46. package/dist/config/mergeUserConfig.mjs.map +1 -1
  47. package/dist/config/mergeUserConfig.native.js +60 -38
  48. package/dist/config/mergeUserConfig.native.js.map +1 -1
  49. package/dist/constants/defaults.mjs +29 -12
  50. package/dist/constants/defaults.mjs.map +1 -1
  51. package/dist/constants/defaults.native.js +29 -12
  52. package/dist/constants/defaults.native.js.map +1 -1
  53. package/dist/constants.mjs +41 -6
  54. package/dist/constants.mjs.map +1 -1
  55. package/dist/constants.native.js +41 -6
  56. package/dist/constants.native.js.map +1 -1
  57. package/dist/exports/build.mjs +218 -270
  58. package/dist/exports/build.mjs.map +1 -1
  59. package/dist/exports/build.native.js +226 -283
  60. package/dist/exports/build.native.js.map +1 -1
  61. package/dist/exports/clean.mjs +71 -78
  62. package/dist/exports/clean.mjs.map +1 -1
  63. package/dist/exports/clean.native.js +76 -90
  64. package/dist/exports/clean.native.js.map +1 -1
  65. package/dist/exports/createServer.mjs +43 -46
  66. package/dist/exports/createServer.mjs.map +1 -1
  67. package/dist/exports/createServer.native.js +45 -48
  68. package/dist/exports/createServer.native.js.map +1 -1
  69. package/dist/exports/dev.mjs +177 -201
  70. package/dist/exports/dev.mjs.map +1 -1
  71. package/dist/exports/dev.native.js +191 -215
  72. package/dist/exports/dev.native.js.map +1 -1
  73. package/dist/exports/loadEnv.mjs +51 -48
  74. package/dist/exports/loadEnv.mjs.map +1 -1
  75. package/dist/exports/loadEnv.native.js +59 -57
  76. package/dist/exports/loadEnv.native.js.map +1 -1
  77. package/dist/exports/patch.mjs +9 -7
  78. package/dist/exports/patch.mjs.map +1 -1
  79. package/dist/exports/patch.native.js +9 -7
  80. package/dist/exports/patch.native.js.map +1 -1
  81. package/dist/exports/prebuild.mjs +177 -157
  82. package/dist/exports/prebuild.mjs.map +1 -1
  83. package/dist/exports/prebuild.native.js +197 -160
  84. package/dist/exports/prebuild.native.js.map +1 -1
  85. package/dist/exports/prebuildWithoutExpo.mjs +46 -44
  86. package/dist/exports/prebuildWithoutExpo.mjs.map +1 -1
  87. package/dist/exports/prebuildWithoutExpo.native.js +48 -46
  88. package/dist/exports/prebuildWithoutExpo.native.js.map +1 -1
  89. package/dist/exports/runAndroid.mjs +9 -10
  90. package/dist/exports/runAndroid.mjs.map +1 -1
  91. package/dist/exports/runAndroid.native.js +10 -11
  92. package/dist/exports/runAndroid.native.js.map +1 -1
  93. package/dist/exports/runIos.mjs +9 -10
  94. package/dist/exports/runIos.mjs.map +1 -1
  95. package/dist/exports/runIos.native.js +10 -11
  96. package/dist/exports/runIos.native.js.map +1 -1
  97. package/dist/exports/serve.mjs +23 -31
  98. package/dist/exports/serve.mjs.map +1 -1
  99. package/dist/exports/serve.native.js +26 -34
  100. package/dist/exports/serve.native.js.map +1 -1
  101. package/dist/exports/serveStaticAssets.mjs +109 -113
  102. package/dist/exports/serveStaticAssets.mjs.map +1 -1
  103. package/dist/exports/serveStaticAssets.native.js +180 -192
  104. package/dist/exports/serveStaticAssets.native.js.map +1 -1
  105. package/dist/index.js +25 -14
  106. package/dist/index.mjs +25 -14
  107. package/dist/index.native.js +25 -14
  108. package/dist/patches/builtInDepPatches.mjs +346 -435
  109. package/dist/patches/builtInDepPatches.mjs.map +1 -1
  110. package/dist/patches/builtInDepPatches.native.js +349 -438
  111. package/dist/patches/builtInDepPatches.native.js.map +1 -1
  112. package/dist/plugins/applyBuiltInPatchesPlugin.mjs +11 -11
  113. package/dist/plugins/applyBuiltInPatchesPlugin.mjs.map +1 -1
  114. package/dist/plugins/applyBuiltInPatchesPlugin.native.js +11 -11
  115. package/dist/plugins/applyBuiltInPatchesPlugin.native.js.map +1 -1
  116. package/dist/plugins/autoDepOptimizePlugin.mjs +87 -90
  117. package/dist/plugins/autoDepOptimizePlugin.mjs.map +1 -1
  118. package/dist/plugins/autoDepOptimizePlugin.native.js +99 -102
  119. package/dist/plugins/autoDepOptimizePlugin.native.js.map +1 -1
  120. package/dist/plugins/clientInjectPlugin.mjs +13 -11
  121. package/dist/plugins/clientInjectPlugin.mjs.map +1 -1
  122. package/dist/plugins/clientInjectPlugin.native.js +13 -11
  123. package/dist/plugins/clientInjectPlugin.native.js.map +1 -1
  124. package/dist/plugins/defaultDepOptimizePlugin.mjs +15 -23
  125. package/dist/plugins/defaultDepOptimizePlugin.mjs.map +1 -1
  126. package/dist/plugins/defaultDepOptimizePlugin.native.js +15 -23
  127. package/dist/plugins/defaultDepOptimizePlugin.native.js.map +1 -1
  128. package/dist/plugins/expoManifestRequestHandlerPlugin.mjs +163 -179
  129. package/dist/plugins/expoManifestRequestHandlerPlugin.mjs.map +1 -1
  130. package/dist/plugins/expoManifestRequestHandlerPlugin.native.js +169 -191
  131. package/dist/plugins/expoManifestRequestHandlerPlugin.native.js.map +1 -1
  132. package/dist/plugins/getResolvedConfigSubset.mjs +6 -5
  133. package/dist/plugins/getResolvedConfigSubset.mjs.map +1 -1
  134. package/dist/plugins/getResolvedConfigSubset.native.js +6 -5
  135. package/dist/plugins/getResolvedConfigSubset.native.js.map +1 -1
  136. package/dist/plugins/reactNativeCommonJsPlugin.mjs +210 -178
  137. package/dist/plugins/reactNativeCommonJsPlugin.mjs.map +1 -1
  138. package/dist/plugins/reactNativeCommonJsPlugin.native.js +283 -259
  139. package/dist/plugins/reactNativeCommonJsPlugin.native.js.map +1 -1
  140. package/dist/plugins/reactNativeDevAssetPlugin.mjs +72 -83
  141. package/dist/plugins/reactNativeDevAssetPlugin.mjs.map +1 -1
  142. package/dist/plugins/reactNativeDevAssetPlugin.native.js +75 -92
  143. package/dist/plugins/reactNativeDevAssetPlugin.native.js.map +1 -1
  144. package/dist/plugins/reactNativeDevServer.mjs +283 -328
  145. package/dist/plugins/reactNativeDevServer.mjs.map +1 -1
  146. package/dist/plugins/reactNativeDevServer.native.js +332 -391
  147. package/dist/plugins/reactNativeDevServer.native.js.map +1 -1
  148. package/dist/plugins/rnCodegenPlugin.mjs +13 -12
  149. package/dist/plugins/rnCodegenPlugin.mjs.map +1 -1
  150. package/dist/plugins/rnCodegenPlugin.native.js +13 -12
  151. package/dist/plugins/rnCodegenPlugin.native.js.map +1 -1
  152. package/dist/plugins/rollupRemoveUnusedImports.mjs +8 -7
  153. package/dist/plugins/rollupRemoveUnusedImports.mjs.map +1 -1
  154. package/dist/plugins/rollupRemoveUnusedImports.native.js +8 -7
  155. package/dist/plugins/rollupRemoveUnusedImports.native.js.map +1 -1
  156. package/dist/plugins/workletImportsPlugin.mjs +127 -132
  157. package/dist/plugins/workletImportsPlugin.mjs.map +1 -1
  158. package/dist/plugins/workletImportsPlugin.native.js +192 -203
  159. package/dist/plugins/workletImportsPlugin.native.js.map +1 -1
  160. package/dist/rn-commands/bundle/buildBundle.mjs +45 -79
  161. package/dist/rn-commands/bundle/buildBundle.mjs.map +1 -1
  162. package/dist/rn-commands/bundle/buildBundle.native.js +45 -85
  163. package/dist/rn-commands/bundle/buildBundle.native.js.map +1 -1
  164. package/dist/runtime/hmr-client.mjs +133 -140
  165. package/dist/runtime/hmr-client.mjs.map +1 -1
  166. package/dist/runtime/hmr-client.native.js +223 -222
  167. package/dist/runtime/hmr-client.native.js.map +1 -1
  168. package/dist/runtime/hmr-runtime.mjs +192 -194
  169. package/dist/runtime/hmr-runtime.mjs.map +1 -1
  170. package/dist/runtime/hmr-runtime.native.js +424 -411
  171. package/dist/runtime/hmr-runtime.native.js.map +1 -1
  172. package/dist/runtime/hmr-types.mjs +0 -2
  173. package/dist/runtime/hmr-types.native.js +0 -2
  174. package/dist/runtime/native-prelude.mjs +2 -1
  175. package/dist/runtime/native-prelude.mjs.map +1 -1
  176. package/dist/runtime/native-prelude.native.js +2 -1
  177. package/dist/runtime/native-prelude.native.js.map +1 -1
  178. package/dist/runtime/react-refresh-utils.mjs +23 -22
  179. package/dist/runtime/react-refresh-utils.mjs.map +1 -1
  180. package/dist/runtime/react-refresh-utils.native.js +23 -27
  181. package/dist/runtime/react-refresh-utils.native.js.map +1 -1
  182. package/dist/serve/node.mjs +49 -49
  183. package/dist/serve/node.mjs.map +1 -1
  184. package/dist/serve/node.native.js +92 -96
  185. package/dist/serve/node.native.js.map +1 -1
  186. package/dist/types.mjs +0 -2
  187. package/dist/types.native.js +0 -2
  188. package/dist/user-interface/index.mjs +245 -262
  189. package/dist/user-interface/index.mjs.map +1 -1
  190. package/dist/user-interface/index.native.js +274 -298
  191. package/dist/user-interface/index.native.js.map +1 -1
  192. package/dist/utils/assert.mjs +7 -6
  193. package/dist/utils/assert.mjs.map +1 -1
  194. package/dist/utils/assert.native.js +7 -18
  195. package/dist/utils/assert.native.js.map +1 -1
  196. package/dist/utils/bindKeypressInput.mjs +36 -38
  197. package/dist/utils/bindKeypressInput.mjs.map +1 -1
  198. package/dist/utils/bindKeypressInput.native.js +36 -38
  199. package/dist/utils/bindKeypressInput.native.js.map +1 -1
  200. package/dist/utils/coerceToArray.mjs +2 -1
  201. package/dist/utils/coerceToArray.mjs.map +1 -1
  202. package/dist/utils/coerceToArray.native.js +2 -1
  203. package/dist/utils/coerceToArray.native.js.map +1 -1
  204. package/dist/utils/connectedNativeClients.mjs +3 -2
  205. package/dist/utils/connectedNativeClients.mjs.map +1 -1
  206. package/dist/utils/connectedNativeClients.native.js +3 -2
  207. package/dist/utils/connectedNativeClients.native.js.map +1 -1
  208. package/dist/utils/createNativeDevEngine.mjs +992 -966
  209. package/dist/utils/createNativeDevEngine.mjs.map +1 -1
  210. package/dist/utils/createNativeDevEngine.native.js +1184 -1179
  211. package/dist/utils/createNativeDevEngine.native.js.map +1 -1
  212. package/dist/utils/dispose.mjs +4 -3
  213. package/dist/utils/dispose.mjs.map +1 -1
  214. package/dist/utils/dispose.native.js +6 -5
  215. package/dist/utils/dispose.native.js.map +1 -1
  216. package/dist/utils/environmentUtils.mjs +5 -4
  217. package/dist/utils/environmentUtils.mjs.map +1 -1
  218. package/dist/utils/environmentUtils.native.js +5 -4
  219. package/dist/utils/environmentUtils.native.js.map +1 -1
  220. package/dist/utils/execSync.mjs +7 -5
  221. package/dist/utils/execSync.mjs.map +1 -1
  222. package/dist/utils/execSync.native.js +8 -6
  223. package/dist/utils/execSync.native.js.map +1 -1
  224. package/dist/utils/expoRun.mjs +27 -35
  225. package/dist/utils/expoRun.mjs.map +1 -1
  226. package/dist/utils/expoRun.native.js +27 -35
  227. package/dist/utils/expoRun.native.js.map +1 -1
  228. package/dist/utils/filterViteServerResolvedUrls.mjs +24 -22
  229. package/dist/utils/filterViteServerResolvedUrls.mjs.map +1 -1
  230. package/dist/utils/filterViteServerResolvedUrls.native.js +61 -63
  231. package/dist/utils/filterViteServerResolvedUrls.native.js.map +1 -1
  232. package/dist/utils/getBoundPort.mjs +6 -5
  233. package/dist/utils/getBoundPort.mjs.map +1 -1
  234. package/dist/utils/getBoundPort.native.js +8 -12
  235. package/dist/utils/getBoundPort.native.js.map +1 -1
  236. package/dist/utils/getCacheDir.mjs +3 -1
  237. package/dist/utils/getCacheDir.mjs.map +1 -1
  238. package/dist/utils/getCacheDir.native.js +3 -1
  239. package/dist/utils/getCacheDir.native.js.map +1 -1
  240. package/dist/utils/getServerEntry.mjs +6 -4
  241. package/dist/utils/getServerEntry.mjs.map +1 -1
  242. package/dist/utils/getServerEntry.native.js +8 -11
  243. package/dist/utils/getServerEntry.native.js.map +1 -1
  244. package/dist/utils/getVitePath.mjs +42 -42
  245. package/dist/utils/getVitePath.mjs.map +1 -1
  246. package/dist/utils/getVitePath.native.js +43 -41
  247. package/dist/utils/getVitePath.native.js.map +1 -1
  248. package/dist/utils/globDir.mjs +7 -11
  249. package/dist/utils/globDir.mjs.map +1 -1
  250. package/dist/utils/globDir.native.js +10 -14
  251. package/dist/utils/globDir.native.js.map +1 -1
  252. package/dist/utils/isWithin.mjs +4 -2
  253. package/dist/utils/isWithin.mjs.map +1 -1
  254. package/dist/utils/isWithin.native.js +4 -2
  255. package/dist/utils/isWithin.native.js.map +1 -1
  256. package/dist/utils/patches.mjs +233 -255
  257. package/dist/utils/patches.mjs.map +1 -1
  258. package/dist/utils/patches.native.js +415 -460
  259. package/dist/utils/patches.native.js.map +1 -1
  260. package/dist/utils/printServerUrls.mjs +9 -7
  261. package/dist/utils/printServerUrls.mjs.map +1 -1
  262. package/dist/utils/printServerUrls.native.js +48 -51
  263. package/dist/utils/printServerUrls.native.js.map +1 -1
  264. package/dist/utils/removeUndefined.mjs +8 -7
  265. package/dist/utils/removeUndefined.mjs.map +1 -1
  266. package/dist/utils/removeUndefined.native.js +8 -7
  267. package/dist/utils/removeUndefined.native.js.map +1 -1
  268. package/dist/utils/scanDepsToOptimize.mjs +194 -161
  269. package/dist/utils/scanDepsToOptimize.mjs.map +1 -1
  270. package/dist/utils/scanDepsToOptimize.native.js +227 -197
  271. package/dist/utils/scanDepsToOptimize.native.js.map +1 -1
  272. package/dist/utils/state.mjs +18 -18
  273. package/dist/utils/state.mjs.map +1 -1
  274. package/dist/utils/state.native.js +18 -18
  275. package/dist/utils/state.native.js.map +1 -1
  276. package/dist/utils/symbolicateNativeStack.mjs +54 -54
  277. package/dist/utils/symbolicateNativeStack.mjs.map +1 -1
  278. package/dist/utils/symbolicateNativeStack.native.js +58 -58
  279. package/dist/utils/symbolicateNativeStack.native.js.map +1 -1
  280. package/dist/utils/uniq.mjs +2 -1
  281. package/dist/utils/uniq.mjs.map +1 -1
  282. package/dist/utils/uniq.native.js +2 -1
  283. package/dist/utils/uniq.native.js.map +1 -1
  284. package/dist/utils/utils.mjs +19 -19
  285. package/dist/utils/utils.mjs.map +1 -1
  286. package/dist/utils/utils.native.js +38 -40
  287. package/dist/utils/utils.native.js.map +1 -1
  288. package/dist/vendor/debugger-app/index.mjs +0 -2
  289. package/dist/vendor/debugger-app/index.native.js +0 -2
  290. package/dist/vendor/debugger-app/src/debuggerWorker.mjs +0 -2
  291. package/dist/vendor/debugger-app/src/debuggerWorker.native.js +0 -2
  292. package/dist/vendor/debugger-app/src/index.mjs +0 -2
  293. package/dist/vendor/debugger-app/src/index.native.js +0 -2
  294. package/dist/vxrn-vite-plugin.mjs +34 -33
  295. package/dist/vxrn-vite-plugin.mjs.map +1 -1
  296. package/dist/vxrn-vite-plugin.native.js +35 -34
  297. package/dist/vxrn-vite-plugin.native.js.map +1 -1
  298. package/expo-plugin.cjs +12 -6
  299. package/package.json +12 -13
  300. package/src/config/getBaseViteConfigOnly.ts +6 -0
  301. package/src/exports/prebuild.ts +40 -12
  302. package/src/patches/builtInDepPatches.ts +24 -48
  303. package/src/utils/createNativeDevEngine.test.ts +1 -1
  304. package/src/utils/createNativeDevEngine.ts +15 -9
  305. package/src/utils/scanDepsToOptimize.ts +0 -3
  306. package/types/config/getBaseViteConfigOnly.d.ts.map +1 -1
  307. package/types/config/getOptimizeDeps.d.ts.map +1 -1
  308. package/types/config/getOptionsFilled.d.ts +15 -15
  309. package/types/config/getOptionsFilled.d.ts.map +1 -1
  310. package/types/exports/build.d.ts +11 -11
  311. package/types/exports/build.d.ts.map +1 -1
  312. package/types/exports/clean.d.ts +1 -1
  313. package/types/exports/clean.d.ts.map +1 -1
  314. package/types/exports/createServer.d.ts.map +1 -1
  315. package/types/exports/dev.d.ts.map +1 -1
  316. package/types/exports/patch.d.ts.map +1 -1
  317. package/types/exports/prebuild.d.ts +3 -3
  318. package/types/exports/prebuild.d.ts.map +1 -1
  319. package/types/exports/prebuildWithoutExpo.d.ts +1 -1
  320. package/types/exports/prebuildWithoutExpo.d.ts.map +1 -1
  321. package/types/exports/runAndroid.d.ts.map +1 -1
  322. package/types/exports/runIos.d.ts.map +1 -1
  323. package/types/exports/serve.d.ts.map +1 -1
  324. package/types/patches/builtInDepPatches.d.ts.map +1 -1
  325. package/types/plugins/autoDepOptimizePlugin.d.ts.map +1 -1
  326. package/types/plugins/rollupRemoveUnusedImports.d.ts.map +1 -1
  327. package/types/runtime/hmr-client.d.ts.map +1 -1
  328. package/types/runtime/hmr-runtime.d.ts.map +1 -1
  329. package/types/runtime/hmr-types.d.ts.map +1 -1
  330. package/types/utils/createNativeDevEngine.d.ts +1 -1
  331. package/types/utils/createNativeDevEngine.d.ts.map +1 -1
  332. package/types/utils/execSync.d.ts.map +1 -1
  333. package/types/utils/getServerEntry.d.ts.map +1 -1
  334. package/types/utils/scanDepsToOptimize.d.ts.map +1 -1
  335. package/types/vxrn-vite-plugin.d.ts.map +1 -1
  336. package/dist/config/getOptimizeDeps.test.mjs +0 -20
  337. package/dist/config/getOptimizeDeps.test.mjs.map +0 -1
  338. package/dist/config/getOptimizeDeps.test.native.js +0 -39
  339. package/dist/config/getOptimizeDeps.test.native.js.map +0 -1
  340. package/dist/config/getServerOptionsFilled.test.mjs +0 -20
  341. package/dist/config/getServerOptionsFilled.test.mjs.map +0 -1
  342. package/dist/config/getServerOptionsFilled.test.native.js +0 -20
  343. package/dist/config/getServerOptionsFilled.test.native.js.map +0 -1
  344. package/dist/config/getViteServerConfig.test.mjs +0 -26
  345. package/dist/config/getViteServerConfig.test.mjs.map +0 -1
  346. package/dist/config/getViteServerConfig.test.native.js +0 -26
  347. package/dist/config/getViteServerConfig.test.native.js.map +0 -1
  348. package/dist/config/mergeUserConfig.test.mjs +0 -108
  349. package/dist/config/mergeUserConfig.test.mjs.map +0 -1
  350. package/dist/config/mergeUserConfig.test.native.js +0 -108
  351. package/dist/config/mergeUserConfig.test.native.js.map +0 -1
  352. package/dist/exports/clean.test.mjs +0 -81
  353. package/dist/exports/clean.test.mjs.map +0 -1
  354. package/dist/exports/clean.test.native.js +0 -88
  355. package/dist/exports/clean.test.native.js.map +0 -1
  356. package/dist/exports/loadEnv.test.mjs +0 -65
  357. package/dist/exports/loadEnv.test.mjs.map +0 -1
  358. package/dist/exports/loadEnv.test.native.js +0 -65
  359. package/dist/exports/loadEnv.test.native.js.map +0 -1
  360. package/dist/index.js.map +0 -1
  361. package/dist/index.mjs.map +0 -1
  362. package/dist/index.native.js.map +0 -1
  363. package/dist/plugins/autoDepOptimizePlugin.test.mjs +0 -31
  364. package/dist/plugins/autoDepOptimizePlugin.test.mjs.map +0 -1
  365. package/dist/plugins/autoDepOptimizePlugin.test.native.js +0 -39
  366. package/dist/plugins/autoDepOptimizePlugin.test.native.js.map +0 -1
  367. package/dist/plugins/resolveIdScan.test.mjs +0 -31
  368. package/dist/plugins/resolveIdScan.test.mjs.map +0 -1
  369. package/dist/plugins/resolveIdScan.test.native.js +0 -38
  370. package/dist/plugins/resolveIdScan.test.native.js.map +0 -1
  371. package/dist/plugins/rnCodegenPlugin.test.mjs +0 -239
  372. package/dist/plugins/rnCodegenPlugin.test.mjs.map +0 -1
  373. package/dist/plugins/rnCodegenPlugin.test.native.js +0 -242
  374. package/dist/plugins/rnCodegenPlugin.test.native.js.map +0 -1
  375. package/dist/plugins/serverExtensions.test.mjs +0 -106
  376. package/dist/plugins/serverExtensions.test.mjs.map +0 -1
  377. package/dist/plugins/serverExtensions.test.native.js +0 -117
  378. package/dist/plugins/serverExtensions.test.native.js.map +0 -1
  379. package/dist/runtime/hmr-types.mjs.map +0 -1
  380. package/dist/runtime/hmr-types.native.js.map +0 -1
  381. package/dist/serve/node.test.mjs +0 -60
  382. package/dist/serve/node.test.mjs.map +0 -1
  383. package/dist/serve/node.test.native.js +0 -72
  384. package/dist/serve/node.test.native.js.map +0 -1
  385. package/dist/types.mjs.map +0 -1
  386. package/dist/types.native.js.map +0 -1
  387. package/dist/utils/bindKeypressInput.test.mjs +0 -48
  388. package/dist/utils/bindKeypressInput.test.mjs.map +0 -1
  389. package/dist/utils/bindKeypressInput.test.native.js +0 -48
  390. package/dist/utils/bindKeypressInput.test.native.js.map +0 -1
  391. package/dist/utils/createNativeDevEngine.test.mjs +0 -1788
  392. package/dist/utils/createNativeDevEngine.test.mjs.map +0 -1
  393. package/dist/utils/createNativeDevEngine.test.native.js +0 -1942
  394. package/dist/utils/createNativeDevEngine.test.native.js.map +0 -1
  395. package/dist/utils/createNativeDevEngineFailure.test.mjs +0 -44
  396. package/dist/utils/createNativeDevEngineFailure.test.mjs.map +0 -1
  397. package/dist/utils/createNativeDevEngineFailure.test.native.js +0 -54
  398. package/dist/utils/createNativeDevEngineFailure.test.native.js.map +0 -1
  399. package/dist/utils/getBoundPort.test.mjs +0 -71
  400. package/dist/utils/getBoundPort.test.mjs.map +0 -1
  401. package/dist/utils/getBoundPort.test.native.js +0 -82
  402. package/dist/utils/getBoundPort.test.native.js.map +0 -1
  403. package/dist/utils/imageSizePatch.test.mjs +0 -29
  404. package/dist/utils/imageSizePatch.test.mjs.map +0 -1
  405. package/dist/utils/imageSizePatch.test.native.js +0 -30
  406. package/dist/utils/imageSizePatch.test.native.js.map +0 -1
  407. package/dist/utils/patches.test.mjs +0 -242
  408. package/dist/utils/patches.test.mjs.map +0 -1
  409. package/dist/utils/patches.test.native.js +0 -271
  410. package/dist/utils/patches.test.native.js.map +0 -1
  411. package/dist/utils/symbolicateNativeStack.test.mjs +0 -96
  412. package/dist/utils/symbolicateNativeStack.test.mjs.map +0 -1
  413. package/dist/utils/symbolicateNativeStack.test.native.js +0 -96
  414. package/dist/utils/symbolicateNativeStack.test.native.js.map +0 -1
  415. package/dist/vendor/debugger-app/index.mjs.map +0 -1
  416. package/dist/vendor/debugger-app/index.native.js.map +0 -1
  417. package/dist/vendor/debugger-app/src/debuggerWorker.mjs.map +0 -1
  418. package/dist/vendor/debugger-app/src/debuggerWorker.native.js.map +0 -1
  419. package/dist/vendor/debugger-app/src/index.mjs.map +0 -1
  420. package/dist/vendor/debugger-app/src/index.native.js.map +0 -1
  421. package/types/config/getOptimizeDeps.test.d.ts +0 -2
  422. package/types/config/getOptimizeDeps.test.d.ts.map +0 -1
  423. package/types/config/getServerOptionsFilled.test.d.ts +0 -2
  424. package/types/config/getServerOptionsFilled.test.d.ts.map +0 -1
  425. package/types/config/getViteServerConfig.test.d.ts +0 -2
  426. package/types/config/getViteServerConfig.test.d.ts.map +0 -1
  427. package/types/config/mergeUserConfig.test.d.ts +0 -2
  428. package/types/config/mergeUserConfig.test.d.ts.map +0 -1
  429. package/types/exports/clean.test.d.ts +0 -2
  430. package/types/exports/clean.test.d.ts.map +0 -1
  431. package/types/exports/loadEnv.test.d.ts +0 -2
  432. package/types/exports/loadEnv.test.d.ts.map +0 -1
  433. package/types/plugins/autoDepOptimizePlugin.test.d.ts +0 -2
  434. package/types/plugins/autoDepOptimizePlugin.test.d.ts.map +0 -1
  435. package/types/plugins/resolveIdScan.test.d.ts +0 -2
  436. package/types/plugins/resolveIdScan.test.d.ts.map +0 -1
  437. package/types/plugins/rnCodegenPlugin.test.d.ts +0 -2
  438. package/types/plugins/rnCodegenPlugin.test.d.ts.map +0 -1
  439. package/types/plugins/serverExtensions.test.d.ts +0 -2
  440. package/types/plugins/serverExtensions.test.d.ts.map +0 -1
  441. package/types/serve/node.test.d.ts +0 -2
  442. package/types/serve/node.test.d.ts.map +0 -1
  443. package/types/utils/bindKeypressInput.test.d.ts +0 -2
  444. package/types/utils/bindKeypressInput.test.d.ts.map +0 -1
  445. package/types/utils/createNativeDevEngine.test.d.ts +0 -2
  446. package/types/utils/createNativeDevEngine.test.d.ts.map +0 -1
  447. package/types/utils/createNativeDevEngineFailure.test.d.ts +0 -2
  448. package/types/utils/createNativeDevEngineFailure.test.d.ts.map +0 -1
  449. package/types/utils/getBoundPort.test.d.ts +0 -2
  450. package/types/utils/getBoundPort.test.d.ts.map +0 -1
  451. package/types/utils/imageSizePatch.test.d.ts +0 -2
  452. package/types/utils/imageSizePatch.test.d.ts.map +0 -1
  453. package/types/utils/patches.test.d.ts +0 -2
  454. package/types/utils/patches.test.d.ts.map +0 -1
  455. package/types/utils/symbolicateNativeStack.test.d.ts +0 -2
  456. package/types/utils/symbolicateNativeStack.test.d.ts.map +0 -1
@@ -4,191 +4,181 @@ import { dirname, isAbsolute, join } from "path";
4
4
  import { statSync } from "fs";
5
5
  import { rolldown } from "rolldown";
6
6
  import { parseSync } from "oxc-parser";
7
- import { getClosureVariables, JS_GLOBALS, transformHermesLoops } from "@vxrn/compiler";
7
+ import { JS_GLOBALS, getClosureVariables, transformHermesLoops } from "@vxrn/compiler";
8
8
  import { hermesCompatSWCPlugin, hermesLoopsPlugin } from "../utils/createNativeDevEngine.native.js";
9
+
9
10
  function workletImportsPlugin(imports) {
10
- var selections = new Map(Object.entries(imports).map(function (param) {
11
- var [source, names] = param;
12
- return [source, [...new Set(names)]];
13
- }));
14
- var rejectRuntimeDependency = function (source) {
15
- var normalized = source.replace(/\\/g, "/");
16
- if (isBuiltin(source) || /(?:^|\/node_modules\/)(?:react|react-native|react-native-worklets|react-native-reanimated|expo-modules-core)(?:\/|$)/.test(normalized) || /(?:^|\/node_modules\/)@react-native\//.test(normalized)) {
17
- throw new Error(`[worklet imports] runtime dependency ${source} is not pure JavaScript`);
18
- }
19
- };
20
- return {
21
- name: "vxrn:worklet-imports",
22
- options(nativeOptions) {
23
- var modules = /* @__PURE__ */new Map();
24
- var instance = {
25
- name: "vxrn:worklet-imports:bundle",
26
- async resolveId(source, importer, options) {
27
- var _statSync;
28
- var names = selections.get(source);
29
- if (!names) return;
30
- if (!names.length) throw new Error(`[worklet imports] no exports selected for ${source}`);
31
- if (options.kind !== "import-statement") {
32
- throw new Error(`[worklet imports] ${source} requires a static ESM import`);
33
- }
34
- rejectRuntimeDependency(source);
35
- var resolved = await this.resolve(source, importer, {
36
- skipSelf: true
37
- });
38
- if (!resolved || resolved.external || !isAbsolute(resolved.id) || !((_statSync = statSync(resolved.id, {
39
- throwIfNoEntry: false
40
- })) === null || _statSync === void 0 ? void 0 : _statSync.isFile())) {
41
- throw new Error(`[worklet imports] ${source} must resolve to a JavaScript file`);
42
- }
43
- rejectRuntimeDependency(resolved.id);
44
- var key = createHash("sha256").update(JSON.stringify([resolved.id, names])).digest("hex").slice(0, 16);
45
- var id = join(dirname(resolved.id), `__one_worklet_imports_${key}.js`);
46
- modules.set(id, {
47
- entry: resolved.id,
48
- names,
49
- key
50
- });
51
- return id;
52
- },
53
- moduleParsed(info) {
54
- if (!info.code || ![...selections.keys()].some(function (source2) {
55
- return info.code.includes(source2);
56
- })) return;
57
- var {
58
- program,
59
- errors
60
- } = parseSync(info.id, info.code, {
61
- lang: /\.[cm]?ts$/.test(info.id) ? "ts" : info.id.endsWith(".tsx") ? "tsx" : "jsx"
62
- });
63
- if (errors.length) throw new Error(errors[0].message);
64
- var _iteratorNormalCompletion = true,
65
- _didIteratorError = false,
66
- _iteratorError = void 0;
67
- try {
68
- for (var _iterator = program.body[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
69
- var node = _step.value;
70
- var _node_source;
71
- if (node.type !== "ImportDeclaration" && node.type !== "ExportNamedDeclaration") continue;
72
- var source = (_node_source = node.source) === null || _node_source === void 0 ? void 0 : _node_source.value;
73
- if (!source) continue;
74
- var names = selections.get(source);
75
- if (!names) continue;
76
- var _iteratorNormalCompletion1 = true,
77
- _didIteratorError1 = false,
78
- _iteratorError1 = void 0;
79
- try {
80
- for (var _iterator1 = node.specifiers[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
81
- var specifier = _step1.value;
82
- var imported = specifier.type === "ImportDefaultSpecifier" ? "default" : specifier.type === "ImportSpecifier" ? specifier.imported.type === "Identifier" ? specifier.imported.name : specifier.imported.value : specifier.type === "ExportSpecifier" ? specifier.local.type === "Identifier" ? specifier.local.name : specifier.local.value : void 0;
83
- if (imported !== void 0 && !names.includes(imported)) {
84
- throw new Error(`[worklet imports] ${info.id} imports unselected export ${imported} from ${source}`);
85
- }
86
- }
87
- } catch (err) {
88
- _didIteratorError1 = true;
89
- _iteratorError1 = err;
90
- } finally {
91
- try {
92
- if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
93
- _iterator1.return();
94
- }
95
- } finally {
96
- if (_didIteratorError1) {
97
- throw _iteratorError1;
98
- }
99
- }
100
- }
101
- }
102
- } catch (err) {
103
- _didIteratorError = true;
104
- _iteratorError = err;
105
- } finally {
106
- try {
107
- if (!_iteratorNormalCompletion && _iterator.return != null) {
108
- _iterator.return();
109
- }
110
- } finally {
111
- if (_didIteratorError) {
112
- throw _iteratorError;
113
- }
114
- }
115
- }
116
- },
117
- async load(id) {
118
- var selected = modules.get(id);
119
- if (!selected) return;
120
- var outerContext = this;
121
- var innerEntry = "\0one-worklet-import-entry";
122
- var bundle = await rolldown({
123
- cwd: nativeOptions.cwd,
124
- input: innerEntry,
125
- platform: "neutral",
126
- resolve: nativeOptions.resolve,
127
- transform: nativeOptions.transform,
128
- shimMissingExports: false,
129
- plugins: [{
130
- name: "vxrn:pure-worklet-module",
131
- resolveId(source, _importer, options) {
132
- if (source === innerEntry) return source;
133
- if (options.kind === "dynamic-import") {
134
- throw new Error(`[worklet imports] dynamic imports are unsupported in ${selected.entry}`);
135
- }
136
- rejectRuntimeDependency(source);
137
- },
138
- load(source) {
139
- if (source === innerEntry) {
140
- return `export { ${selected.names.map(function (name, index) {
141
- return `${JSON.stringify(name)} as __export${index}`;
142
- }).join(", ")} } from ${JSON.stringify(selected.entry)};`;
143
- }
144
- },
145
- moduleParsed(info) {
146
- rejectRuntimeDependency(info.id);
147
- if (isAbsolute(info.id)) outerContext.addWatchFile(info.id);
148
- if (info.packageJsonPath) outerContext.addWatchFile(info.packageJsonPath);
149
- }
150
- }, hermesCompatSWCPlugin(false), hermesLoopsPlugin()]
151
- });
152
- var code;
153
- try {
154
- var _ref;
155
- var _transformHermesLoops;
156
- var output = await bundle.generate({
157
- format: "iife",
158
- name: "__oneWorkletBundle"
159
- });
160
- var chunk = output.output[0];
161
- if (output.output.length !== 1 || chunk.type !== "chunk" || chunk.imports.length || chunk.dynamicImports.length) {
162
- throw new Error(`[worklet imports] ${selected.entry} must produce one self-contained JavaScript module`);
163
- }
164
- code = (_ref = (_transformHermesLoops = transformHermesLoops(chunk.code, id)) === null || _transformHermesLoops === void 0 ? void 0 : _transformHermesLoops.code) !== null && _ref !== void 0 ? _ref : chunk.code;
165
- var _iteratorNormalCompletion = true,
166
- _didIteratorError = false,
167
- _iteratorError = void 0;
168
- try {
169
- for (var _iterator = (await bundle.watchFiles)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
170
- var file = _step.value;
171
- if (isAbsolute(file)) outerContext.addWatchFile(file);
172
- }
173
- } catch (err) {
174
- _didIteratorError = true;
175
- _iteratorError = err;
176
- } finally {
177
- try {
178
- if (!_iteratorNormalCompletion && _iterator.return != null) {
179
- _iterator.return();
180
- }
181
- } finally {
182
- if (_didIteratorError) {
183
- throw _iteratorError;
184
- }
185
- }
186
- }
187
- } finally {
188
- await bundle.close();
189
- }
190
- var loader = `__oneLoadWorkletModule_${selected.key}`;
191
- var loaderCode = `function ${loader}() {
11
+ var selections = new Map(Object.entries(imports).map(function(param) {
12
+ var [source, names] = param;
13
+ return [source, [...new Set(names)]];
14
+ }));
15
+ var rejectRuntimeDependency = function(source) {
16
+ var normalized = source.replace(/\\/g, "/");
17
+ if (isBuiltin(source) || /(?:^|\/node_modules\/)(?:react|react-native|react-native-worklets|react-native-reanimated|expo-modules-core)(?:\/|$)/.test(normalized) || /(?:^|\/node_modules\/)@react-native\//.test(normalized)) {
18
+ throw new Error(`[worklet imports] runtime dependency ${source} is not pure JavaScript`);
19
+ }
20
+ };
21
+ return {
22
+ name: "vxrn:worklet-imports",
23
+ options(nativeOptions) {
24
+ var modules = /* @__PURE__ */ new Map();
25
+ var instance = {
26
+ name: "vxrn:worklet-imports:bundle",
27
+ async resolveId(source, importer, options) {
28
+ var _statSync;
29
+ var names = selections.get(source);
30
+ if (!names) return;
31
+ if (!names.length) throw new Error(`[worklet imports] no exports selected for ${source}`);
32
+ if (options.kind !== "import-statement") {
33
+ throw new Error(`[worklet imports] ${source} requires a static ESM import`);
34
+ }
35
+ rejectRuntimeDependency(source);
36
+ var resolved = await this.resolve(source, importer, { skipSelf: true });
37
+ if (!resolved || resolved.external || !isAbsolute(resolved.id) || !((_statSync = statSync(resolved.id, { throwIfNoEntry: false })) === null || _statSync === void 0 ? void 0 : _statSync.isFile())) {
38
+ throw new Error(`[worklet imports] ${source} must resolve to a JavaScript file`);
39
+ }
40
+ rejectRuntimeDependency(resolved.id);
41
+ var key = createHash("sha256").update(JSON.stringify([resolved.id, names])).digest("hex").slice(0, 16);
42
+ var id = join(dirname(resolved.id), `__one_worklet_imports_${key}.js`);
43
+ modules.set(id, {
44
+ entry: resolved.id,
45
+ names,
46
+ key
47
+ });
48
+ return id;
49
+ },
50
+ moduleParsed(info) {
51
+ if (!info.code || ![...selections.keys()].some(function(source2) {
52
+ return info.code.includes(source2);
53
+ })) return;
54
+ var { program, errors } = parseSync(info.id, info.code, { lang: /\.[cm]?ts$/.test(info.id) ? "ts" : info.id.endsWith(".tsx") ? "tsx" : "jsx" });
55
+ if (errors.length) throw new Error(errors[0].message);
56
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
57
+ try {
58
+ for (var _iterator = program.body[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
59
+ var node = _step.value;
60
+ var _node_source;
61
+ if (node.type !== "ImportDeclaration" && node.type !== "ExportNamedDeclaration") continue;
62
+ var source = (_node_source = node.source) === null || _node_source === void 0 ? void 0 : _node_source.value;
63
+ if (!source) continue;
64
+ var names = selections.get(source);
65
+ if (!names) continue;
66
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
67
+ try {
68
+ for (var _iterator1 = node.specifiers[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
69
+ var specifier = _step1.value;
70
+ var imported = specifier.type === "ImportDefaultSpecifier" ? "default" : specifier.type === "ImportSpecifier" ? specifier.imported.type === "Identifier" ? specifier.imported.name : specifier.imported.value : specifier.type === "ExportSpecifier" ? specifier.local.type === "Identifier" ? specifier.local.name : specifier.local.value : void 0;
71
+ if (imported !== void 0 && !names.includes(imported)) {
72
+ throw new Error(`[worklet imports] ${info.id} imports unselected export ${imported} from ${source}`);
73
+ }
74
+ }
75
+ } catch (err) {
76
+ _didIteratorError1 = true;
77
+ _iteratorError1 = err;
78
+ } finally {
79
+ try {
80
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
81
+ _iterator1.return();
82
+ }
83
+ } finally {
84
+ if (_didIteratorError1) {
85
+ throw _iteratorError1;
86
+ }
87
+ }
88
+ }
89
+ }
90
+ } catch (err) {
91
+ _didIteratorError = true;
92
+ _iteratorError = err;
93
+ } finally {
94
+ try {
95
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
96
+ _iterator.return();
97
+ }
98
+ } finally {
99
+ if (_didIteratorError) {
100
+ throw _iteratorError;
101
+ }
102
+ }
103
+ }
104
+ },
105
+ async load(id) {
106
+ var selected = modules.get(id);
107
+ if (!selected) return;
108
+ var outerContext = this;
109
+ var innerEntry = "\0one-worklet-import-entry";
110
+ var bundle = await rolldown({
111
+ cwd: nativeOptions.cwd,
112
+ input: innerEntry,
113
+ platform: "neutral",
114
+ resolve: nativeOptions.resolve,
115
+ transform: nativeOptions.transform,
116
+ shimMissingExports: false,
117
+ plugins: [
118
+ {
119
+ name: "vxrn:pure-worklet-module",
120
+ resolveId(source, _importer, options) {
121
+ if (source === innerEntry) return source;
122
+ if (options.kind === "dynamic-import") {
123
+ throw new Error(`[worklet imports] dynamic imports are unsupported in ${selected.entry}`);
124
+ }
125
+ rejectRuntimeDependency(source);
126
+ },
127
+ load(source) {
128
+ if (source === innerEntry) {
129
+ return `export { ${selected.names.map(function(name, index) {
130
+ return `${JSON.stringify(name)} as __export${index}`;
131
+ }).join(", ")} } from ${JSON.stringify(selected.entry)};`;
132
+ }
133
+ },
134
+ moduleParsed(info) {
135
+ rejectRuntimeDependency(info.id);
136
+ if (isAbsolute(info.id)) outerContext.addWatchFile(info.id);
137
+ if (info.packageJsonPath) outerContext.addWatchFile(info.packageJsonPath);
138
+ }
139
+ },
140
+ hermesCompatSWCPlugin(false),
141
+ hermesLoopsPlugin()
142
+ ]
143
+ });
144
+ var code;
145
+ try {
146
+ var _ref;
147
+ var _transformHermesLoops;
148
+ var output = await bundle.generate({
149
+ format: "iife",
150
+ name: "__oneWorkletBundle"
151
+ });
152
+ var chunk = output.output[0];
153
+ if (output.output.length !== 1 || chunk.type !== "chunk" || chunk.imports.length || chunk.dynamicImports.length) {
154
+ throw new Error(`[worklet imports] ${selected.entry} must produce one self-contained JavaScript module`);
155
+ }
156
+ code = (_ref = (_transformHermesLoops = transformHermesLoops(chunk.code, id)) === null || _transformHermesLoops === void 0 ? void 0 : _transformHermesLoops.code) !== null && _ref !== void 0 ? _ref : chunk.code;
157
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
158
+ try {
159
+ for (var _iterator = (await bundle.watchFiles)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
160
+ var file = _step.value;
161
+ if (isAbsolute(file)) outerContext.addWatchFile(file);
162
+ }
163
+ } catch (err) {
164
+ _didIteratorError = true;
165
+ _iteratorError = err;
166
+ } finally {
167
+ try {
168
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
169
+ _iterator.return();
170
+ }
171
+ } finally {
172
+ if (_didIteratorError) {
173
+ throw _iteratorError;
174
+ }
175
+ }
176
+ }
177
+ } finally {
178
+ await bundle.close();
179
+ }
180
+ var loader = `__oneLoadWorkletModule_${selected.key}`;
181
+ var loaderCode = `function ${loader}() {
192
182
  'worklet';
193
183
  const cache = globalThis.__oneWorkletImportCache || (globalThis.__oneWorkletImportCache = new WeakMap());
194
184
  let namespace = cache.get(${loader});
@@ -199,32 +189,31 @@ function workletImportsPlugin(imports) {
199
189
  }
200
190
  return namespace;
201
191
  }`;
202
- var parsed = parseSync(id, loaderCode, {
203
- lang: "js"
204
- });
205
- if (parsed.errors.length) throw new Error(parsed.errors[0].message);
206
- var captures = getClosureVariables(parsed.program.body[0], /* @__PURE__ */new Set([...JS_GLOBALS, "arguments"]));
207
- if (captures.length) {
208
- throw new Error(`[worklet imports] ${selected.entry} requires unsupported runtime globals: ${captures.join(", ")}`);
209
- }
210
- return `${loaderCode}
211
- ${selected.names.map(function (name, index) {
212
- return `
192
+ var parsed = parseSync(id, loaderCode, { lang: "js" });
193
+ if (parsed.errors.length) throw new Error(parsed.errors[0].message);
194
+ var captures = getClosureVariables(parsed.program.body[0], /* @__PURE__ */ new Set([...JS_GLOBALS, "arguments"]));
195
+ if (captures.length) {
196
+ throw new Error(`[worklet imports] ${selected.entry} requires unsupported runtime globals: ${captures.join(", ")}`);
197
+ }
198
+ return `${loaderCode}
199
+ ${selected.names.map(function(name, index) {
200
+ return `
213
201
  function __oneExport${index}(...args) {
214
202
  'worklet';
215
203
  return (0, ${loader}().__export${index})(...args);
216
204
  }
217
205
  export { __oneExport${index} as ${JSON.stringify(name)} };
218
206
  `;
219
- }).join("\n")}`;
220
- }
221
- };
222
- return {
223
- ...nativeOptions,
224
- plugins: [instance, nativeOptions.plugins]
225
- };
226
- }
227
- };
207
+ }).join("\n")}`;
208
+ }
209
+ };
210
+ return {
211
+ ...nativeOptions,
212
+ plugins: [instance, nativeOptions.plugins]
213
+ };
214
+ }
215
+ };
228
216
  }
217
+
229
218
  export { workletImportsPlugin };
230
219
  //# sourceMappingURL=workletImportsPlugin.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createHash","isBuiltin","dirname","isAbsolute","join","statSync","rolldown","parseSync","getClosureVariables","JS_GLOBALS","transformHermesLoops","hermesCompatSWCPlugin","hermesLoopsPlugin","workletImportsPlugin","imports","selections","Map","Object","entries","map","param","source","names","Set","rejectRuntimeDependency","normalized","replace","test","Error","name","options","nativeOptions","modules","instance","resolveId","importer","_statSync","get","length","kind","resolved","resolve","skipSelf","external","id","throwIfNoEntry","isFile","key","update","JSON","stringify","digest","slice","set","entry","moduleParsed","info","code","keys","some","source2","includes","program","errors","lang","endsWith","message","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","body","Symbol","iterator","_step","next","done","node","value","_node_source","type","_iteratorNormalCompletion1","_didIteratorError1","_iteratorError1","_iterator1","specifiers","_step1","specifier","imported","local","err","return","load","selected","outerContext","innerEntry","bundle","cwd","input","platform","transform","shimMissingExports","plugins","_importer","index","addWatchFile","packageJsonPath","_ref","_transformHermesLoops","output","generate","format","chunk","dynamicImports","watchFiles"],"sources":["../../src/plugins/workletImportsPlugin.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,UAAA,QAAkB;AAC3B,SAASC,SAAA,QAAiB;AAC1B,SAASC,OAAA,EAASC,UAAA,EAAYC,IAAA,QAAY;AAC1C,SAASC,QAAA,QAAgB;AACzB,SAASC,QAAA,QAA6B;AACtC,SAASC,SAAA,QAAiB;AAC1B,SAASC,mBAAA,EAAqBC,UAAA,EAAYC,oBAAA,QAA4B;AACtE,SAASC,qBAAA,EAAuBC,iBAAA,QAAyB;AAOlD,SAASC,qBAAqBC,OAAA,EAAoD;EACvF,IAAAC,UAAM,OAAaC,GAAI,CAAAC,MAAA,CAAAC,OAAA,CAAAJ,OAAA,EAAAK,GAAA,WAAAC,KAAA;IACrB,KAAAC,MAAO,EAAAC,KAAQ,IAAOF,K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AZ,EAAA;gBACI,IAAAzC,UAAiB,CAAAqD,IAAA,CAAAZ,EAAA,GAAAkD,YAAA,CAAAW,YAAA,CAAAjD,IAAA,CAAAZ,EAAA;gBACb,IAAIY,IAAA,CAAAkD,eAAA,EAAAZ,YAAA,CAAAW,YAAA,CAAAjD,IAAA,CAAAkD,eAAA;cACR;YACF,GACF/F,qBAAA,SACAC,iBAAoB;UACjB,EACC;UAAiB,IAAA6C,IAAA;UACJ;YAAA,IAEZkD,IAAA;YAAyB,IAAAC,qBAAA;YAAA,IAAAC,MAElB,SAAKb,MAAO,CAAAc,QAAK;cAAeC,MAAA;cAGzClF,IAAK;YACV;YACF,IAAAmF,KAAA,GAAAH,MAAA,CAAAA,MAAA;YACA,IAAOA,MAAA,CAAAA,MAAA,CAAAvE,MAAA,UAAA0E,KAAA,CAAAhC,IAAA,gBAAAgC,KAAA,CAAAlG,OAAA,CAAAwB,MAAA,IAAA0E,KAAA,CAAAC,cAAA,CAAA3E,MAAA;cACF,UAAAV,KAAA,sBAAAiE,QAAA,CAAAvC,KAAA;YACH;YACFG,IAAA,IAAAkD,IAAA,IAAAC,qBAAA,GAAAlG,oBAAA,CAAAsG,KAAA,CAAAvD,IAAA,EAAAb,EAAA,eAAAgE,qBAAA,uBAAAA,qBAAA,CAAAnD,IAAA,cAAAkD,IAAA,cAAAA,IAAA,GAAAK,KAAA,CAAAvD,IAAA;YACF,IAAAU,yBAAA;cAAAC,iBAAA;cAAAC,cAAA;YACF;cACF,SAAAC,SAAA,UAAA0B,MAAA,CAAAkB,UAAA,EAAA1C,MAAA,CAAAC,QAAA,KAAAC,KAAA,IAAAP,yBAAA,IAAAO,KAAA,GAAAJ,SAAA,CAAAK,IAAA,IAAAC,IAAA,GAAAT,yBAAA","ignoreList":[]}
1
+ {"version":3,"file":"workletImportsPlugin.native.js","names":[],"sources":["plugins/workletImportsPlugin.native.js"],"sourcesContent":["import { createHash } from \"crypto\";\nimport { isBuiltin } from \"module\";\nimport { dirname, isAbsolute, join } from \"path\";\nimport { statSync } from \"fs\";\nimport { rolldown } from \"rolldown\";\nimport { parseSync } from \"oxc-parser\";\nimport { getClosureVariables, JS_GLOBALS, transformHermesLoops } from \"@vxrn/compiler\";\nimport { hermesCompatSWCPlugin, hermesLoopsPlugin } from \"../utils/createNativeDevEngine\";\nfunction workletImportsPlugin(imports) {\n var selections = new Map(Object.entries(imports).map(function(param) {\n var [source, names] = param;\n return [\n source,\n [\n ...new Set(names)\n ]\n ];\n }));\n var rejectRuntimeDependency = function(source) {\n var normalized = source.replace(/\\\\/g, \"/\");\n if (isBuiltin(source) || /(?:^|\\/node_modules\\/)(?:react|react-native|react-native-worklets|react-native-reanimated|expo-modules-core)(?:\\/|$)/.test(normalized) || /(?:^|\\/node_modules\\/)@react-native\\//.test(normalized)) {\n throw new Error(`[worklet imports] runtime dependency ${source} is not pure JavaScript`);\n }\n };\n return {\n name: \"vxrn:worklet-imports\",\n options(nativeOptions) {\n var modules = /* @__PURE__ */ new Map();\n var instance = {\n name: \"vxrn:worklet-imports:bundle\",\n async resolveId(source, importer, options) {\n var _statSync;\n var names = selections.get(source);\n if (!names) return;\n if (!names.length) throw new Error(`[worklet imports] no exports selected for ${source}`);\n if (options.kind !== \"import-statement\") {\n throw new Error(`[worklet imports] ${source} requires a static ESM import`);\n }\n rejectRuntimeDependency(source);\n var resolved = await this.resolve(source, importer, {\n skipSelf: true\n });\n if (!resolved || resolved.external || !isAbsolute(resolved.id) || !((_statSync = statSync(resolved.id, {\n throwIfNoEntry: false\n })) === null || _statSync === void 0 ? void 0 : _statSync.isFile())) {\n throw new Error(`[worklet imports] ${source} must resolve to a JavaScript file`);\n }\n rejectRuntimeDependency(resolved.id);\n var key = createHash(\"sha256\").update(JSON.stringify([\n resolved.id,\n names\n ])).digest(\"hex\").slice(0, 16);\n var id = join(dirname(resolved.id), `__one_worklet_imports_${key}.js`);\n modules.set(id, {\n entry: resolved.id,\n names,\n key\n });\n return id;\n },\n moduleParsed(info) {\n if (!info.code || ![\n ...selections.keys()\n ].some(function(source2) {\n return info.code.includes(source2);\n })) return;\n var { program, errors } = parseSync(info.id, info.code, {\n lang: /\\.[cm]?ts$/.test(info.id) ? \"ts\" : info.id.endsWith(\".tsx\") ? \"tsx\" : \"jsx\"\n });\n if (errors.length) throw new Error(errors[0].message);\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = program.body[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var node = _step.value;\n var _node_source;\n if (node.type !== \"ImportDeclaration\" && node.type !== \"ExportNamedDeclaration\") continue;\n var source = (_node_source = node.source) === null || _node_source === void 0 ? void 0 : _node_source.value;\n if (!source) continue;\n var names = selections.get(source);\n if (!names) continue;\n var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;\n try {\n for (var _iterator1 = node.specifiers[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {\n var specifier = _step1.value;\n var imported = specifier.type === \"ImportDefaultSpecifier\" ? \"default\" : specifier.type === \"ImportSpecifier\" ? specifier.imported.type === \"Identifier\" ? specifier.imported.name : specifier.imported.value : specifier.type === \"ExportSpecifier\" ? specifier.local.type === \"Identifier\" ? specifier.local.name : specifier.local.value : void 0;\n if (imported !== void 0 && !names.includes(imported)) {\n throw new Error(`[worklet imports] ${info.id} imports unselected export ${imported} from ${source}`);\n }\n }\n } catch (err) {\n _didIteratorError1 = true;\n _iteratorError1 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion1 && _iterator1.return != null) {\n _iterator1.return();\n }\n } finally {\n if (_didIteratorError1) {\n throw _iteratorError1;\n }\n }\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n },\n async load(id) {\n var selected = modules.get(id);\n if (!selected) return;\n var outerContext = this;\n var innerEntry = \"\\0one-worklet-import-entry\";\n var bundle = await rolldown({\n cwd: nativeOptions.cwd,\n input: innerEntry,\n platform: \"neutral\",\n resolve: nativeOptions.resolve,\n transform: nativeOptions.transform,\n shimMissingExports: false,\n plugins: [\n {\n name: \"vxrn:pure-worklet-module\",\n resolveId(source, _importer, options) {\n if (source === innerEntry) return source;\n if (options.kind === \"dynamic-import\") {\n throw new Error(`[worklet imports] dynamic imports are unsupported in ${selected.entry}`);\n }\n rejectRuntimeDependency(source);\n },\n load(source) {\n if (source === innerEntry) {\n return `export { ${selected.names.map(function(name, index) {\n return `${JSON.stringify(name)} as __export${index}`;\n }).join(\", \")} } from ${JSON.stringify(selected.entry)};`;\n }\n },\n moduleParsed(info) {\n rejectRuntimeDependency(info.id);\n if (isAbsolute(info.id)) outerContext.addWatchFile(info.id);\n if (info.packageJsonPath) outerContext.addWatchFile(info.packageJsonPath);\n }\n },\n hermesCompatSWCPlugin(false),\n hermesLoopsPlugin()\n ]\n });\n var code;\n try {\n var _ref;\n var _transformHermesLoops;\n var output = await bundle.generate({\n format: \"iife\",\n name: \"__oneWorkletBundle\"\n });\n var chunk = output.output[0];\n if (output.output.length !== 1 || chunk.type !== \"chunk\" || chunk.imports.length || chunk.dynamicImports.length) {\n throw new Error(`[worklet imports] ${selected.entry} must produce one self-contained JavaScript module`);\n }\n code = (_ref = (_transformHermesLoops = transformHermesLoops(chunk.code, id)) === null || _transformHermesLoops === void 0 ? void 0 : _transformHermesLoops.code) !== null && _ref !== void 0 ? _ref : chunk.code;\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = (await bundle.watchFiles)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var file = _step.value;\n if (isAbsolute(file)) outerContext.addWatchFile(file);\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n } finally {\n await bundle.close();\n }\n var loader = `__oneLoadWorkletModule_${selected.key}`;\n var loaderCode = `function ${loader}() {\n 'worklet';\n const cache = globalThis.__oneWorkletImportCache || (globalThis.__oneWorkletImportCache = new WeakMap());\n let namespace = cache.get(${loader});\n if (namespace === undefined) {\n ${code}\n namespace = __oneWorkletBundle;\n cache.set(${loader}, namespace);\n }\n return namespace;\n}`;\n var parsed = parseSync(id, loaderCode, {\n lang: \"js\"\n });\n if (parsed.errors.length) throw new Error(parsed.errors[0].message);\n var captures = getClosureVariables(parsed.program.body[0], /* @__PURE__ */ new Set([\n ...JS_GLOBALS,\n \"arguments\"\n ]));\n if (captures.length) {\n throw new Error(`[worklet imports] ${selected.entry} requires unsupported runtime globals: ${captures.join(\", \")}`);\n }\n return `${loaderCode}\n${selected.names.map(function(name, index) {\n return `\nfunction __oneExport${index}(...args) {\n 'worklet';\n return (0, ${loader}().__export${index})(...args);\n}\nexport { __oneExport${index} as ${JSON.stringify(name)} };\n`;\n }).join(\"\\n\")}`;\n }\n };\n return {\n ...nativeOptions,\n plugins: [\n instance,\n nativeOptions.plugins\n ]\n };\n }\n };\n}\nexport {\n workletImportsPlugin\n};\n//# sourceMappingURL=workletImportsPlugin.js.map\n"],"mappings":";;;;;;;;;;AAQA,SAAS,qBAAqB,SAAS;CACrC,IAAI,aAAa,IAAI,IAAI,OAAO,QAAQ,OAAO,CAAC,CAAC,IAAI,SAAS,OAAO;EACnE,IAAI,CAAC,QAAQ,SAAS;EACtB,OAAO,CACL,QACA,CACE,GAAG,IAAI,IAAI,KAAK,CAClB,CACF;CACF,CAAC,CAAC;CACF,IAAI,0BAA0B,SAAS,QAAQ;EAC7C,IAAI,aAAa,OAAO,QAAQ,OAAO,GAAG;EAC1C,IAAI,UAAU,MAA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KAAK;;gBAEK,OAAO;;;;KAIb,IAAI,SAAS,UAAU,IAAI,YAAY,EACrC,MAAM,KACR,CAAC;KACD,IAAI,OAAO,OAAO,QAAQ,MAAM,IAAI,MAAM,OAAO,OAAO,EAAE,CAAC,OAAO;KAClE,IAAI,WAAW,oBAAoB,OAAO,QAAQ,KAAK,oBAAoB,IAAI,IAAI,CACjF,GAAG,YACH,WACF,CAAC,CAAC;KACF,IAAI,SAAS,QAAQ;MACnB,MAAM,IAAI,MAAM,qBAAqB,SAAS,MAAM,yCAAyC,SAAS,KAAK,IAAI,GAAG;KACpH;KACA,OAAO,GAAG,WAAW;EAC7B,SAAS,MAAM,IAAI,SAAS,MAAM,OAAO;MAC/B,OAAO;sBACG,MAAM;;eAEb,OAAO,aAAa,MAAM;;sBAEnB,MAAM,MAAM,KAAK,UAAU,IAAI,EAAE;;KAE7C,CAAC,CAAC,CAAC,KAAK,IAAI;IACd;GACF;GACA,OAAO;IACL,GAAG;IACH,SAAS,CACP,UACA,cAAc,OAChB;GACF;EACF;CACF;AACF"}
@@ -1,87 +1,53 @@
1
1
  import FSExtra from "fs-extra";
2
2
  import { clearTransformCache } from "@vxrn/compiler";
3
- import { bundle as metroBundle } from "@vxrn/vite-plugin-metro/rn-commands";
3
+ import { bundle } from "@vxrn/vite-plugin-metro/rn-commands";
4
4
  import { loadEnv } from "../../exports/loadEnv.mjs";
5
5
  import { buildNativeBundle } from "../../utils/createNativeDevEngine.mjs";
6
+
6
7
  async function buildBundle(_argv, ctx, args, bundleImpl = null) {
7
- const {
8
- platform,
9
- // Android is not supported yet.
10
- dev,
11
- bundleOutput,
12
- // React Native's `--bundle-encoding` names a Node Buffer encoding.
13
- bundleEncoding = "utf8",
14
- assetsDest,
15
- // `--minify` overrides React Native's default of "minify unless this is a
16
- // dev bundle". undefined means the flag was not passed.
17
- minify,
18
- // `--reset-cache` drops the compiler's transform cache, the only cache a
19
- // rolldown production build reads.
20
- resetCache
21
- // `--entry-file` names the React Native root module. One generates its own
22
- // native entry from the route tree instead, and __vxrnNativeEntryFile is
23
- // the supported way to point the build somewhere else.
24
- // `--read-global-cache` / `--max-workers` / `--config` / `--transformer` /
25
- // `--resolver-option` configure Metro's global cache, worker pool and
26
- // resolver. A rolldown production build has none of them: it transforms
27
- // from source in-process. React Native's own bundle command ignores
28
- // `--read-global-cache` too.
29
- // `--unstable-transform-profile` picks a JS engine to target. This pipeline
30
- // always downlevels for Hermes, which is what every profile it accepts
31
- // ('default', 'hermes', 'hermes-canary') can run.
32
- // `--sourcemap-use-absolute-path`, `--sourcemap-sources-root`,
33
- // `--asset-catalog-dest` and `--indexed-ram-bundle` are not implemented.
34
- } = args;
35
- const {
36
- root
37
- } = ctx;
38
- if (typeof root !== "string") {
39
- throw new Error(`Expected ctx.root to be a string, but got ${typeof root}`);
40
- }
41
- const metroBuildBundleFn = await metroBundle.getBuildBundleFn();
42
- if (metroBuildBundleFn) {
43
- console.info("Using @vxrn/vite-plugin-metro to build the bundle.");
44
- await metroBuildBundleFn(_argv, ctx, args, bundleImpl);
45
- return;
46
- }
47
- process.env.IS_VXRN_CLI = "true";
48
- loadEnv(dev ? "development" : "production", root);
49
- if (!dev) {
50
- process.env.NODE_ENV = "production";
51
- }
52
- if (resetCache) {
53
- clearTransformCache();
54
- }
55
- console.info(`[vxrn] building native bundle for ${platform}...`);
56
- const nativeEntryFile = globalThis.__vxrnNativeEntryFile;
57
- const result = await buildNativeBundle({
58
- root,
59
- platform,
60
- dev,
61
- entryFile: typeof nativeEntryFile === "string" ? nativeEntryFile : void 0,
62
- // pass through ONE_SERVER_URL so the native prelude can inject it into
63
- // process.env. without this, getURL.native falls back to the dummy
64
- // 'http://one-server.example.com' and runtime loader fetches fail in prod.
65
- serverUrl: process.env.ONE_SERVER_URL,
66
- assetsDest,
67
- sourcemap: !!args.sourcemapOutput,
68
- minify
69
- });
70
- const builtBundle = result.code;
71
- if (result.map && args.sourcemapOutput) {
72
- FSExtra.writeFileSync(args.sourcemapOutput, result.map, {
73
- encoding: "utf8"
74
- });
75
- }
76
- console.info(`Writing bundle to ${bundleOutput}...`);
77
- FSExtra.writeFileSync(bundleOutput, builtBundle, {
78
- encoding: bundleEncoding
79
- });
80
- console.info("Done.");
81
- setTimeout(() => {
82
- console.info("Exiting process to prevent hanging.");
83
- process.exit();
84
- }, 3e4);
8
+ const { platform, dev, bundleOutput, bundleEncoding = "utf8", assetsDest, minify, resetCache } = args;
9
+ const { root } = ctx;
10
+ if (typeof root !== "string") {
11
+ throw new Error(`Expected ctx.root to be a string, but got ${typeof root}`);
12
+ }
13
+ const metroBuildBundleFn = await bundle.getBuildBundleFn();
14
+ if (metroBuildBundleFn) {
15
+ console.info("Using @vxrn/vite-plugin-metro to build the bundle.");
16
+ await metroBuildBundleFn(_argv, ctx, args, bundleImpl);
17
+ return;
18
+ }
19
+ process.env.IS_VXRN_CLI = "true";
20
+ loadEnv(dev ? "development" : "production", root);
21
+ if (!dev) {
22
+ process.env.NODE_ENV = "production";
23
+ }
24
+ if (resetCache) {
25
+ clearTransformCache();
26
+ }
27
+ console.info(`[vxrn] building native bundle for ${platform}...`);
28
+ const nativeEntryFile = globalThis.__vxrnNativeEntryFile;
29
+ const result = await buildNativeBundle({
30
+ root,
31
+ platform,
32
+ dev,
33
+ entryFile: typeof nativeEntryFile === "string" ? nativeEntryFile : void 0,
34
+ serverUrl: process.env.ONE_SERVER_URL,
35
+ assetsDest,
36
+ sourcemap: !!args.sourcemapOutput,
37
+ minify
38
+ });
39
+ const builtBundle = result.code;
40
+ if (result.map && args.sourcemapOutput) {
41
+ FSExtra.writeFileSync(args.sourcemapOutput, result.map, { encoding: "utf8" });
42
+ }
43
+ console.info(`Writing bundle to ${bundleOutput}...`);
44
+ FSExtra.writeFileSync(bundleOutput, builtBundle, { encoding: bundleEncoding });
45
+ console.info("Done.");
46
+ setTimeout(() => {
47
+ console.info("Exiting process to prevent hanging.");
48
+ process.exit();
49
+ }, 3e4);
85
50
  }
51
+
86
52
  export { buildBundle };
87
53
  //# sourceMappingURL=buildBundle.mjs.map