vxrn 1.27.1 → 2.0.0-beta.45.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (456) hide show
  1. package/dist/cli.mjs +212 -261
  2. package/dist/cli.mjs.map +1 -1
  3. package/dist/cli.native.js +216 -265
  4. package/dist/cli.native.js.map +1 -1
  5. package/dist/config/getAdditionalViteConfig.mjs +33 -62
  6. package/dist/config/getAdditionalViteConfig.mjs.map +1 -1
  7. package/dist/config/getAdditionalViteConfig.native.js +33 -62
  8. package/dist/config/getAdditionalViteConfig.native.js.map +1 -1
  9. package/dist/config/getBaseViteConfigOnly.mjs +84 -77
  10. package/dist/config/getBaseViteConfigOnly.mjs.map +1 -1
  11. package/dist/config/getBaseViteConfigOnly.native.js +86 -79
  12. package/dist/config/getBaseViteConfigOnly.native.js.map +1 -1
  13. package/dist/config/getBaseViteConfigWithPlugins.mjs +6 -4
  14. package/dist/config/getBaseViteConfigWithPlugins.mjs.map +1 -1
  15. package/dist/config/getBaseViteConfigWithPlugins.native.js +6 -4
  16. package/dist/config/getBaseViteConfigWithPlugins.native.js.map +1 -1
  17. package/dist/config/getBaseVitePlugins.mjs +102 -130
  18. package/dist/config/getBaseVitePlugins.mjs.map +1 -1
  19. package/dist/config/getBaseVitePlugins.native.js +123 -152
  20. package/dist/config/getBaseVitePlugins.native.js.map +1 -1
  21. package/dist/config/getNonCliModeOnlyVitePlugins.mjs +3 -3
  22. package/dist/config/getNonCliModeOnlyVitePlugins.mjs.map +1 -1
  23. package/dist/config/getNonCliModeOnlyVitePlugins.native.js +3 -1
  24. package/dist/config/getNonCliModeOnlyVitePlugins.native.js.map +1 -1
  25. package/dist/config/getOptimizeDeps.mjs +138 -42
  26. package/dist/config/getOptimizeDeps.mjs.map +1 -1
  27. package/dist/config/getOptimizeDeps.native.js +138 -42
  28. package/dist/config/getOptimizeDeps.native.js.map +1 -1
  29. package/dist/config/getOptionsFilled.mjs +48 -52
  30. package/dist/config/getOptionsFilled.mjs.map +1 -1
  31. package/dist/config/getOptionsFilled.native.js +51 -55
  32. package/dist/config/getOptionsFilled.native.js.map +1 -1
  33. package/dist/config/getReactNativePlugins.mjs +23 -15
  34. package/dist/config/getReactNativePlugins.mjs.map +1 -1
  35. package/dist/config/getReactNativePlugins.native.js +25 -16
  36. package/dist/config/getReactNativePlugins.native.js.map +1 -1
  37. package/dist/config/getServerOptionsFilled.mjs +33 -35
  38. package/dist/config/getServerOptionsFilled.mjs.map +1 -1
  39. package/dist/config/getServerOptionsFilled.native.js +35 -38
  40. package/dist/config/getServerOptionsFilled.native.js.map +1 -1
  41. package/dist/config/getViteServerConfig.mjs +34 -45
  42. package/dist/config/getViteServerConfig.mjs.map +1 -1
  43. package/dist/config/getViteServerConfig.native.js +35 -46
  44. package/dist/config/getViteServerConfig.native.js.map +1 -1
  45. package/dist/config/mergeUserConfig.mjs +50 -28
  46. package/dist/config/mergeUserConfig.mjs.map +1 -1
  47. package/dist/config/mergeUserConfig.native.js +60 -38
  48. package/dist/config/mergeUserConfig.native.js.map +1 -1
  49. package/dist/constants/defaults.mjs +29 -12
  50. package/dist/constants/defaults.mjs.map +1 -1
  51. package/dist/constants/defaults.native.js +29 -12
  52. package/dist/constants/defaults.native.js.map +1 -1
  53. package/dist/constants.mjs +41 -6
  54. package/dist/constants.mjs.map +1 -1
  55. package/dist/constants.native.js +41 -6
  56. package/dist/constants.native.js.map +1 -1
  57. package/dist/exports/build.mjs +218 -270
  58. package/dist/exports/build.mjs.map +1 -1
  59. package/dist/exports/build.native.js +226 -283
  60. package/dist/exports/build.native.js.map +1 -1
  61. package/dist/exports/clean.mjs +71 -78
  62. package/dist/exports/clean.mjs.map +1 -1
  63. package/dist/exports/clean.native.js +76 -90
  64. package/dist/exports/clean.native.js.map +1 -1
  65. package/dist/exports/createServer.mjs +43 -46
  66. package/dist/exports/createServer.mjs.map +1 -1
  67. package/dist/exports/createServer.native.js +45 -48
  68. package/dist/exports/createServer.native.js.map +1 -1
  69. package/dist/exports/dev.mjs +177 -201
  70. package/dist/exports/dev.mjs.map +1 -1
  71. package/dist/exports/dev.native.js +191 -215
  72. package/dist/exports/dev.native.js.map +1 -1
  73. package/dist/exports/loadEnv.mjs +51 -48
  74. package/dist/exports/loadEnv.mjs.map +1 -1
  75. package/dist/exports/loadEnv.native.js +59 -57
  76. package/dist/exports/loadEnv.native.js.map +1 -1
  77. package/dist/exports/patch.mjs +9 -7
  78. package/dist/exports/patch.mjs.map +1 -1
  79. package/dist/exports/patch.native.js +9 -7
  80. package/dist/exports/patch.native.js.map +1 -1
  81. package/dist/exports/prebuild.mjs +177 -157
  82. package/dist/exports/prebuild.mjs.map +1 -1
  83. package/dist/exports/prebuild.native.js +197 -160
  84. package/dist/exports/prebuild.native.js.map +1 -1
  85. package/dist/exports/prebuildWithoutExpo.mjs +46 -44
  86. package/dist/exports/prebuildWithoutExpo.mjs.map +1 -1
  87. package/dist/exports/prebuildWithoutExpo.native.js +48 -46
  88. package/dist/exports/prebuildWithoutExpo.native.js.map +1 -1
  89. package/dist/exports/runAndroid.mjs +9 -10
  90. package/dist/exports/runAndroid.mjs.map +1 -1
  91. package/dist/exports/runAndroid.native.js +10 -11
  92. package/dist/exports/runAndroid.native.js.map +1 -1
  93. package/dist/exports/runIos.mjs +9 -10
  94. package/dist/exports/runIos.mjs.map +1 -1
  95. package/dist/exports/runIos.native.js +10 -11
  96. package/dist/exports/runIos.native.js.map +1 -1
  97. package/dist/exports/serve.mjs +23 -31
  98. package/dist/exports/serve.mjs.map +1 -1
  99. package/dist/exports/serve.native.js +26 -34
  100. package/dist/exports/serve.native.js.map +1 -1
  101. package/dist/exports/serveStaticAssets.mjs +109 -113
  102. package/dist/exports/serveStaticAssets.mjs.map +1 -1
  103. package/dist/exports/serveStaticAssets.native.js +180 -192
  104. package/dist/exports/serveStaticAssets.native.js.map +1 -1
  105. package/dist/index.js +25 -14
  106. package/dist/index.mjs +25 -14
  107. package/dist/index.native.js +25 -14
  108. package/dist/patches/builtInDepPatches.mjs +346 -435
  109. package/dist/patches/builtInDepPatches.mjs.map +1 -1
  110. package/dist/patches/builtInDepPatches.native.js +349 -438
  111. package/dist/patches/builtInDepPatches.native.js.map +1 -1
  112. package/dist/plugins/applyBuiltInPatchesPlugin.mjs +11 -11
  113. package/dist/plugins/applyBuiltInPatchesPlugin.mjs.map +1 -1
  114. package/dist/plugins/applyBuiltInPatchesPlugin.native.js +11 -11
  115. package/dist/plugins/applyBuiltInPatchesPlugin.native.js.map +1 -1
  116. package/dist/plugins/autoDepOptimizePlugin.mjs +87 -90
  117. package/dist/plugins/autoDepOptimizePlugin.mjs.map +1 -1
  118. package/dist/plugins/autoDepOptimizePlugin.native.js +99 -102
  119. package/dist/plugins/autoDepOptimizePlugin.native.js.map +1 -1
  120. package/dist/plugins/clientInjectPlugin.mjs +13 -11
  121. package/dist/plugins/clientInjectPlugin.mjs.map +1 -1
  122. package/dist/plugins/clientInjectPlugin.native.js +13 -11
  123. package/dist/plugins/clientInjectPlugin.native.js.map +1 -1
  124. package/dist/plugins/defaultDepOptimizePlugin.mjs +15 -23
  125. package/dist/plugins/defaultDepOptimizePlugin.mjs.map +1 -1
  126. package/dist/plugins/defaultDepOptimizePlugin.native.js +15 -23
  127. package/dist/plugins/defaultDepOptimizePlugin.native.js.map +1 -1
  128. package/dist/plugins/expoManifestRequestHandlerPlugin.mjs +163 -179
  129. package/dist/plugins/expoManifestRequestHandlerPlugin.mjs.map +1 -1
  130. package/dist/plugins/expoManifestRequestHandlerPlugin.native.js +169 -191
  131. package/dist/plugins/expoManifestRequestHandlerPlugin.native.js.map +1 -1
  132. package/dist/plugins/getResolvedConfigSubset.mjs +6 -5
  133. package/dist/plugins/getResolvedConfigSubset.mjs.map +1 -1
  134. package/dist/plugins/getResolvedConfigSubset.native.js +6 -5
  135. package/dist/plugins/getResolvedConfigSubset.native.js.map +1 -1
  136. package/dist/plugins/reactNativeCommonJsPlugin.mjs +210 -178
  137. package/dist/plugins/reactNativeCommonJsPlugin.mjs.map +1 -1
  138. package/dist/plugins/reactNativeCommonJsPlugin.native.js +283 -259
  139. package/dist/plugins/reactNativeCommonJsPlugin.native.js.map +1 -1
  140. package/dist/plugins/reactNativeDevAssetPlugin.mjs +72 -83
  141. package/dist/plugins/reactNativeDevAssetPlugin.mjs.map +1 -1
  142. package/dist/plugins/reactNativeDevAssetPlugin.native.js +75 -92
  143. package/dist/plugins/reactNativeDevAssetPlugin.native.js.map +1 -1
  144. package/dist/plugins/reactNativeDevServer.mjs +283 -328
  145. package/dist/plugins/reactNativeDevServer.mjs.map +1 -1
  146. package/dist/plugins/reactNativeDevServer.native.js +332 -391
  147. package/dist/plugins/reactNativeDevServer.native.js.map +1 -1
  148. package/dist/plugins/rnCodegenPlugin.mjs +13 -12
  149. package/dist/plugins/rnCodegenPlugin.mjs.map +1 -1
  150. package/dist/plugins/rnCodegenPlugin.native.js +13 -12
  151. package/dist/plugins/rnCodegenPlugin.native.js.map +1 -1
  152. package/dist/plugins/rollupRemoveUnusedImports.mjs +8 -7
  153. package/dist/plugins/rollupRemoveUnusedImports.mjs.map +1 -1
  154. package/dist/plugins/rollupRemoveUnusedImports.native.js +8 -7
  155. package/dist/plugins/rollupRemoveUnusedImports.native.js.map +1 -1
  156. package/dist/plugins/workletImportsPlugin.mjs +127 -132
  157. package/dist/plugins/workletImportsPlugin.mjs.map +1 -1
  158. package/dist/plugins/workletImportsPlugin.native.js +192 -203
  159. package/dist/plugins/workletImportsPlugin.native.js.map +1 -1
  160. package/dist/rn-commands/bundle/buildBundle.mjs +45 -79
  161. package/dist/rn-commands/bundle/buildBundle.mjs.map +1 -1
  162. package/dist/rn-commands/bundle/buildBundle.native.js +45 -85
  163. package/dist/rn-commands/bundle/buildBundle.native.js.map +1 -1
  164. package/dist/runtime/hmr-client.mjs +133 -140
  165. package/dist/runtime/hmr-client.mjs.map +1 -1
  166. package/dist/runtime/hmr-client.native.js +223 -222
  167. package/dist/runtime/hmr-client.native.js.map +1 -1
  168. package/dist/runtime/hmr-runtime.mjs +192 -194
  169. package/dist/runtime/hmr-runtime.mjs.map +1 -1
  170. package/dist/runtime/hmr-runtime.native.js +424 -411
  171. package/dist/runtime/hmr-runtime.native.js.map +1 -1
  172. package/dist/runtime/hmr-types.mjs +0 -2
  173. package/dist/runtime/hmr-types.native.js +0 -2
  174. package/dist/runtime/native-prelude.mjs +2 -1
  175. package/dist/runtime/native-prelude.mjs.map +1 -1
  176. package/dist/runtime/native-prelude.native.js +2 -1
  177. package/dist/runtime/native-prelude.native.js.map +1 -1
  178. package/dist/runtime/react-refresh-utils.mjs +23 -22
  179. package/dist/runtime/react-refresh-utils.mjs.map +1 -1
  180. package/dist/runtime/react-refresh-utils.native.js +23 -27
  181. package/dist/runtime/react-refresh-utils.native.js.map +1 -1
  182. package/dist/serve/node.mjs +49 -49
  183. package/dist/serve/node.mjs.map +1 -1
  184. package/dist/serve/node.native.js +92 -96
  185. package/dist/serve/node.native.js.map +1 -1
  186. package/dist/types.mjs +0 -2
  187. package/dist/types.native.js +0 -2
  188. package/dist/user-interface/index.mjs +245 -262
  189. package/dist/user-interface/index.mjs.map +1 -1
  190. package/dist/user-interface/index.native.js +274 -298
  191. package/dist/user-interface/index.native.js.map +1 -1
  192. package/dist/utils/assert.mjs +7 -6
  193. package/dist/utils/assert.mjs.map +1 -1
  194. package/dist/utils/assert.native.js +7 -18
  195. package/dist/utils/assert.native.js.map +1 -1
  196. package/dist/utils/bindKeypressInput.mjs +36 -38
  197. package/dist/utils/bindKeypressInput.mjs.map +1 -1
  198. package/dist/utils/bindKeypressInput.native.js +36 -38
  199. package/dist/utils/bindKeypressInput.native.js.map +1 -1
  200. package/dist/utils/coerceToArray.mjs +2 -1
  201. package/dist/utils/coerceToArray.mjs.map +1 -1
  202. package/dist/utils/coerceToArray.native.js +2 -1
  203. package/dist/utils/coerceToArray.native.js.map +1 -1
  204. package/dist/utils/connectedNativeClients.mjs +3 -2
  205. package/dist/utils/connectedNativeClients.mjs.map +1 -1
  206. package/dist/utils/connectedNativeClients.native.js +3 -2
  207. package/dist/utils/connectedNativeClients.native.js.map +1 -1
  208. package/dist/utils/createNativeDevEngine.mjs +992 -966
  209. package/dist/utils/createNativeDevEngine.mjs.map +1 -1
  210. package/dist/utils/createNativeDevEngine.native.js +1184 -1179
  211. package/dist/utils/createNativeDevEngine.native.js.map +1 -1
  212. package/dist/utils/dispose.mjs +4 -3
  213. package/dist/utils/dispose.mjs.map +1 -1
  214. package/dist/utils/dispose.native.js +6 -5
  215. package/dist/utils/dispose.native.js.map +1 -1
  216. package/dist/utils/environmentUtils.mjs +5 -4
  217. package/dist/utils/environmentUtils.mjs.map +1 -1
  218. package/dist/utils/environmentUtils.native.js +5 -4
  219. package/dist/utils/environmentUtils.native.js.map +1 -1
  220. package/dist/utils/execSync.mjs +7 -5
  221. package/dist/utils/execSync.mjs.map +1 -1
  222. package/dist/utils/execSync.native.js +8 -6
  223. package/dist/utils/execSync.native.js.map +1 -1
  224. package/dist/utils/expoRun.mjs +27 -35
  225. package/dist/utils/expoRun.mjs.map +1 -1
  226. package/dist/utils/expoRun.native.js +27 -35
  227. package/dist/utils/expoRun.native.js.map +1 -1
  228. package/dist/utils/filterViteServerResolvedUrls.mjs +24 -22
  229. package/dist/utils/filterViteServerResolvedUrls.mjs.map +1 -1
  230. package/dist/utils/filterViteServerResolvedUrls.native.js +61 -63
  231. package/dist/utils/filterViteServerResolvedUrls.native.js.map +1 -1
  232. package/dist/utils/getBoundPort.mjs +6 -5
  233. package/dist/utils/getBoundPort.mjs.map +1 -1
  234. package/dist/utils/getBoundPort.native.js +8 -12
  235. package/dist/utils/getBoundPort.native.js.map +1 -1
  236. package/dist/utils/getCacheDir.mjs +3 -1
  237. package/dist/utils/getCacheDir.mjs.map +1 -1
  238. package/dist/utils/getCacheDir.native.js +3 -1
  239. package/dist/utils/getCacheDir.native.js.map +1 -1
  240. package/dist/utils/getServerEntry.mjs +6 -4
  241. package/dist/utils/getServerEntry.mjs.map +1 -1
  242. package/dist/utils/getServerEntry.native.js +8 -11
  243. package/dist/utils/getServerEntry.native.js.map +1 -1
  244. package/dist/utils/getVitePath.mjs +42 -42
  245. package/dist/utils/getVitePath.mjs.map +1 -1
  246. package/dist/utils/getVitePath.native.js +43 -41
  247. package/dist/utils/getVitePath.native.js.map +1 -1
  248. package/dist/utils/globDir.mjs +7 -11
  249. package/dist/utils/globDir.mjs.map +1 -1
  250. package/dist/utils/globDir.native.js +10 -14
  251. package/dist/utils/globDir.native.js.map +1 -1
  252. package/dist/utils/isWithin.mjs +4 -2
  253. package/dist/utils/isWithin.mjs.map +1 -1
  254. package/dist/utils/isWithin.native.js +4 -2
  255. package/dist/utils/isWithin.native.js.map +1 -1
  256. package/dist/utils/patches.mjs +233 -255
  257. package/dist/utils/patches.mjs.map +1 -1
  258. package/dist/utils/patches.native.js +415 -460
  259. package/dist/utils/patches.native.js.map +1 -1
  260. package/dist/utils/printServerUrls.mjs +9 -7
  261. package/dist/utils/printServerUrls.mjs.map +1 -1
  262. package/dist/utils/printServerUrls.native.js +48 -51
  263. package/dist/utils/printServerUrls.native.js.map +1 -1
  264. package/dist/utils/removeUndefined.mjs +8 -7
  265. package/dist/utils/removeUndefined.mjs.map +1 -1
  266. package/dist/utils/removeUndefined.native.js +8 -7
  267. package/dist/utils/removeUndefined.native.js.map +1 -1
  268. package/dist/utils/scanDepsToOptimize.mjs +194 -161
  269. package/dist/utils/scanDepsToOptimize.mjs.map +1 -1
  270. package/dist/utils/scanDepsToOptimize.native.js +227 -197
  271. package/dist/utils/scanDepsToOptimize.native.js.map +1 -1
  272. package/dist/utils/state.mjs +18 -18
  273. package/dist/utils/state.mjs.map +1 -1
  274. package/dist/utils/state.native.js +18 -18
  275. package/dist/utils/state.native.js.map +1 -1
  276. package/dist/utils/symbolicateNativeStack.mjs +54 -54
  277. package/dist/utils/symbolicateNativeStack.mjs.map +1 -1
  278. package/dist/utils/symbolicateNativeStack.native.js +58 -58
  279. package/dist/utils/symbolicateNativeStack.native.js.map +1 -1
  280. package/dist/utils/uniq.mjs +2 -1
  281. package/dist/utils/uniq.mjs.map +1 -1
  282. package/dist/utils/uniq.native.js +2 -1
  283. package/dist/utils/uniq.native.js.map +1 -1
  284. package/dist/utils/utils.mjs +19 -19
  285. package/dist/utils/utils.mjs.map +1 -1
  286. package/dist/utils/utils.native.js +38 -40
  287. package/dist/utils/utils.native.js.map +1 -1
  288. package/dist/vendor/debugger-app/index.mjs +0 -2
  289. package/dist/vendor/debugger-app/index.native.js +0 -2
  290. package/dist/vendor/debugger-app/src/debuggerWorker.mjs +0 -2
  291. package/dist/vendor/debugger-app/src/debuggerWorker.native.js +0 -2
  292. package/dist/vendor/debugger-app/src/index.mjs +0 -2
  293. package/dist/vendor/debugger-app/src/index.native.js +0 -2
  294. package/dist/vxrn-vite-plugin.mjs +34 -33
  295. package/dist/vxrn-vite-plugin.mjs.map +1 -1
  296. package/dist/vxrn-vite-plugin.native.js +35 -34
  297. package/dist/vxrn-vite-plugin.native.js.map +1 -1
  298. package/expo-plugin.cjs +12 -6
  299. package/package.json +12 -13
  300. package/src/config/getBaseViteConfigOnly.ts +6 -0
  301. package/src/exports/prebuild.ts +40 -12
  302. package/src/patches/builtInDepPatches.ts +24 -48
  303. package/src/utils/createNativeDevEngine.test.ts +1 -1
  304. package/src/utils/createNativeDevEngine.ts +15 -9
  305. package/src/utils/scanDepsToOptimize.ts +0 -3
  306. package/types/config/getBaseViteConfigOnly.d.ts.map +1 -1
  307. package/types/config/getOptimizeDeps.d.ts.map +1 -1
  308. package/types/config/getOptionsFilled.d.ts +15 -15
  309. package/types/config/getOptionsFilled.d.ts.map +1 -1
  310. package/types/exports/build.d.ts +11 -11
  311. package/types/exports/build.d.ts.map +1 -1
  312. package/types/exports/clean.d.ts +1 -1
  313. package/types/exports/clean.d.ts.map +1 -1
  314. package/types/exports/createServer.d.ts.map +1 -1
  315. package/types/exports/dev.d.ts.map +1 -1
  316. package/types/exports/patch.d.ts.map +1 -1
  317. package/types/exports/prebuild.d.ts +3 -3
  318. package/types/exports/prebuild.d.ts.map +1 -1
  319. package/types/exports/prebuildWithoutExpo.d.ts +1 -1
  320. package/types/exports/prebuildWithoutExpo.d.ts.map +1 -1
  321. package/types/exports/runAndroid.d.ts.map +1 -1
  322. package/types/exports/runIos.d.ts.map +1 -1
  323. package/types/exports/serve.d.ts.map +1 -1
  324. package/types/patches/builtInDepPatches.d.ts.map +1 -1
  325. package/types/plugins/autoDepOptimizePlugin.d.ts.map +1 -1
  326. package/types/plugins/rollupRemoveUnusedImports.d.ts.map +1 -1
  327. package/types/runtime/hmr-client.d.ts.map +1 -1
  328. package/types/runtime/hmr-runtime.d.ts.map +1 -1
  329. package/types/runtime/hmr-types.d.ts.map +1 -1
  330. package/types/utils/createNativeDevEngine.d.ts +1 -1
  331. package/types/utils/createNativeDevEngine.d.ts.map +1 -1
  332. package/types/utils/execSync.d.ts.map +1 -1
  333. package/types/utils/getServerEntry.d.ts.map +1 -1
  334. package/types/utils/scanDepsToOptimize.d.ts.map +1 -1
  335. package/types/vxrn-vite-plugin.d.ts.map +1 -1
  336. package/dist/config/getOptimizeDeps.test.mjs +0 -20
  337. package/dist/config/getOptimizeDeps.test.mjs.map +0 -1
  338. package/dist/config/getOptimizeDeps.test.native.js +0 -39
  339. package/dist/config/getOptimizeDeps.test.native.js.map +0 -1
  340. package/dist/config/getServerOptionsFilled.test.mjs +0 -20
  341. package/dist/config/getServerOptionsFilled.test.mjs.map +0 -1
  342. package/dist/config/getServerOptionsFilled.test.native.js +0 -20
  343. package/dist/config/getServerOptionsFilled.test.native.js.map +0 -1
  344. package/dist/config/getViteServerConfig.test.mjs +0 -26
  345. package/dist/config/getViteServerConfig.test.mjs.map +0 -1
  346. package/dist/config/getViteServerConfig.test.native.js +0 -26
  347. package/dist/config/getViteServerConfig.test.native.js.map +0 -1
  348. package/dist/config/mergeUserConfig.test.mjs +0 -108
  349. package/dist/config/mergeUserConfig.test.mjs.map +0 -1
  350. package/dist/config/mergeUserConfig.test.native.js +0 -108
  351. package/dist/config/mergeUserConfig.test.native.js.map +0 -1
  352. package/dist/exports/clean.test.mjs +0 -81
  353. package/dist/exports/clean.test.mjs.map +0 -1
  354. package/dist/exports/clean.test.native.js +0 -88
  355. package/dist/exports/clean.test.native.js.map +0 -1
  356. package/dist/exports/loadEnv.test.mjs +0 -65
  357. package/dist/exports/loadEnv.test.mjs.map +0 -1
  358. package/dist/exports/loadEnv.test.native.js +0 -65
  359. package/dist/exports/loadEnv.test.native.js.map +0 -1
  360. package/dist/index.js.map +0 -1
  361. package/dist/index.mjs.map +0 -1
  362. package/dist/index.native.js.map +0 -1
  363. package/dist/plugins/autoDepOptimizePlugin.test.mjs +0 -31
  364. package/dist/plugins/autoDepOptimizePlugin.test.mjs.map +0 -1
  365. package/dist/plugins/autoDepOptimizePlugin.test.native.js +0 -39
  366. package/dist/plugins/autoDepOptimizePlugin.test.native.js.map +0 -1
  367. package/dist/plugins/resolveIdScan.test.mjs +0 -31
  368. package/dist/plugins/resolveIdScan.test.mjs.map +0 -1
  369. package/dist/plugins/resolveIdScan.test.native.js +0 -38
  370. package/dist/plugins/resolveIdScan.test.native.js.map +0 -1
  371. package/dist/plugins/rnCodegenPlugin.test.mjs +0 -239
  372. package/dist/plugins/rnCodegenPlugin.test.mjs.map +0 -1
  373. package/dist/plugins/rnCodegenPlugin.test.native.js +0 -242
  374. package/dist/plugins/rnCodegenPlugin.test.native.js.map +0 -1
  375. package/dist/plugins/serverExtensions.test.mjs +0 -106
  376. package/dist/plugins/serverExtensions.test.mjs.map +0 -1
  377. package/dist/plugins/serverExtensions.test.native.js +0 -117
  378. package/dist/plugins/serverExtensions.test.native.js.map +0 -1
  379. package/dist/runtime/hmr-types.mjs.map +0 -1
  380. package/dist/runtime/hmr-types.native.js.map +0 -1
  381. package/dist/serve/node.test.mjs +0 -60
  382. package/dist/serve/node.test.mjs.map +0 -1
  383. package/dist/serve/node.test.native.js +0 -72
  384. package/dist/serve/node.test.native.js.map +0 -1
  385. package/dist/types.mjs.map +0 -1
  386. package/dist/types.native.js.map +0 -1
  387. package/dist/utils/bindKeypressInput.test.mjs +0 -48
  388. package/dist/utils/bindKeypressInput.test.mjs.map +0 -1
  389. package/dist/utils/bindKeypressInput.test.native.js +0 -48
  390. package/dist/utils/bindKeypressInput.test.native.js.map +0 -1
  391. package/dist/utils/createNativeDevEngine.test.mjs +0 -1788
  392. package/dist/utils/createNativeDevEngine.test.mjs.map +0 -1
  393. package/dist/utils/createNativeDevEngine.test.native.js +0 -1942
  394. package/dist/utils/createNativeDevEngine.test.native.js.map +0 -1
  395. package/dist/utils/createNativeDevEngineFailure.test.mjs +0 -44
  396. package/dist/utils/createNativeDevEngineFailure.test.mjs.map +0 -1
  397. package/dist/utils/createNativeDevEngineFailure.test.native.js +0 -54
  398. package/dist/utils/createNativeDevEngineFailure.test.native.js.map +0 -1
  399. package/dist/utils/getBoundPort.test.mjs +0 -71
  400. package/dist/utils/getBoundPort.test.mjs.map +0 -1
  401. package/dist/utils/getBoundPort.test.native.js +0 -82
  402. package/dist/utils/getBoundPort.test.native.js.map +0 -1
  403. package/dist/utils/imageSizePatch.test.mjs +0 -29
  404. package/dist/utils/imageSizePatch.test.mjs.map +0 -1
  405. package/dist/utils/imageSizePatch.test.native.js +0 -30
  406. package/dist/utils/imageSizePatch.test.native.js.map +0 -1
  407. package/dist/utils/patches.test.mjs +0 -242
  408. package/dist/utils/patches.test.mjs.map +0 -1
  409. package/dist/utils/patches.test.native.js +0 -271
  410. package/dist/utils/patches.test.native.js.map +0 -1
  411. package/dist/utils/symbolicateNativeStack.test.mjs +0 -96
  412. package/dist/utils/symbolicateNativeStack.test.mjs.map +0 -1
  413. package/dist/utils/symbolicateNativeStack.test.native.js +0 -96
  414. package/dist/utils/symbolicateNativeStack.test.native.js.map +0 -1
  415. package/dist/vendor/debugger-app/index.mjs.map +0 -1
  416. package/dist/vendor/debugger-app/index.native.js.map +0 -1
  417. package/dist/vendor/debugger-app/src/debuggerWorker.mjs.map +0 -1
  418. package/dist/vendor/debugger-app/src/debuggerWorker.native.js.map +0 -1
  419. package/dist/vendor/debugger-app/src/index.mjs.map +0 -1
  420. package/dist/vendor/debugger-app/src/index.native.js.map +0 -1
  421. package/types/config/getOptimizeDeps.test.d.ts +0 -2
  422. package/types/config/getOptimizeDeps.test.d.ts.map +0 -1
  423. package/types/config/getServerOptionsFilled.test.d.ts +0 -2
  424. package/types/config/getServerOptionsFilled.test.d.ts.map +0 -1
  425. package/types/config/getViteServerConfig.test.d.ts +0 -2
  426. package/types/config/getViteServerConfig.test.d.ts.map +0 -1
  427. package/types/config/mergeUserConfig.test.d.ts +0 -2
  428. package/types/config/mergeUserConfig.test.d.ts.map +0 -1
  429. package/types/exports/clean.test.d.ts +0 -2
  430. package/types/exports/clean.test.d.ts.map +0 -1
  431. package/types/exports/loadEnv.test.d.ts +0 -2
  432. package/types/exports/loadEnv.test.d.ts.map +0 -1
  433. package/types/plugins/autoDepOptimizePlugin.test.d.ts +0 -2
  434. package/types/plugins/autoDepOptimizePlugin.test.d.ts.map +0 -1
  435. package/types/plugins/resolveIdScan.test.d.ts +0 -2
  436. package/types/plugins/resolveIdScan.test.d.ts.map +0 -1
  437. package/types/plugins/rnCodegenPlugin.test.d.ts +0 -2
  438. package/types/plugins/rnCodegenPlugin.test.d.ts.map +0 -1
  439. package/types/plugins/serverExtensions.test.d.ts +0 -2
  440. package/types/plugins/serverExtensions.test.d.ts.map +0 -1
  441. package/types/serve/node.test.d.ts +0 -2
  442. package/types/serve/node.test.d.ts.map +0 -1
  443. package/types/utils/bindKeypressInput.test.d.ts +0 -2
  444. package/types/utils/bindKeypressInput.test.d.ts.map +0 -1
  445. package/types/utils/createNativeDevEngine.test.d.ts +0 -2
  446. package/types/utils/createNativeDevEngine.test.d.ts.map +0 -1
  447. package/types/utils/createNativeDevEngineFailure.test.d.ts +0 -2
  448. package/types/utils/createNativeDevEngineFailure.test.d.ts.map +0 -1
  449. package/types/utils/getBoundPort.test.d.ts +0 -2
  450. package/types/utils/getBoundPort.test.d.ts.map +0 -1
  451. package/types/utils/imageSizePatch.test.d.ts +0 -2
  452. package/types/utils/imageSizePatch.test.d.ts.map +0 -1
  453. package/types/utils/patches.test.d.ts +0 -2
  454. package/types/utils/patches.test.d.ts.map +0 -1
  455. package/types/utils/symbolicateNativeStack.test.d.ts +0 -2
  456. package/types/utils/symbolicateNativeStack.test.d.ts.map +0 -1
@@ -9,508 +9,463 @@ import { rename } from "fs/promises";
9
9
  import semver from "semver";
10
10
  import { builtInDepPatches } from "../patches/builtInDepPatches.native.js";
11
11
  import { globDir } from "./globDir.native.js";
12
+
12
13
  function _assert_this_initialized(self) {
13
- if (self === void 0) {
14
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
15
- }
16
- return self;
14
+ if (self === void 0) {
15
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
16
+ }
17
+ return self;
17
18
  }
18
19
  function _call_super(_this, derived, args) {
19
- derived = _get_prototype_of(derived);
20
- return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
20
+ derived = _get_prototype_of(derived);
21
+ return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
21
22
  }
22
23
  function _class_call_check(instance, Constructor) {
23
- if (!(instance instanceof Constructor)) {
24
- throw new TypeError("Cannot call a class as a function");
25
- }
24
+ if (!(instance instanceof Constructor)) {
25
+ throw new TypeError("Cannot call a class as a function");
26
+ }
26
27
  }
27
28
  function _construct(Parent, args, Class) {
28
- if (_is_native_reflect_construct()) {
29
- _construct = Reflect.construct;
30
- } else {
31
- _construct = function construct(Parent2, args2, Class2) {
32
- var a = [null];
33
- a.push.apply(a, args2);
34
- var Constructor = Function.bind.apply(Parent2, a);
35
- var instance = new Constructor();
36
- if (Class2) _set_prototype_of(instance, Class2.prototype);
37
- return instance;
38
- };
39
- }
40
- return _construct.apply(null, arguments);
29
+ if (_is_native_reflect_construct()) {
30
+ _construct = Reflect.construct;
31
+ } else {
32
+ _construct = function construct(Parent2, args2, Class2) {
33
+ var a = [null];
34
+ a.push.apply(a, args2);
35
+ var Constructor = Function.bind.apply(Parent2, a);
36
+ var instance = new Constructor();
37
+ if (Class2) _set_prototype_of(instance, Class2.prototype);
38
+ return instance;
39
+ };
40
+ }
41
+ return _construct.apply(null, arguments);
41
42
  }
42
43
  function _get_prototype_of(o) {
43
- _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o2) {
44
- return o2.__proto__ || Object.getPrototypeOf(o2);
45
- };
46
- return _get_prototype_of(o);
44
+ _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o2) {
45
+ return o2.__proto__ || Object.getPrototypeOf(o2);
46
+ };
47
+ return _get_prototype_of(o);
47
48
  }
48
49
  function _inherits(subClass, superClass) {
49
- if (typeof superClass !== "function" && superClass !== null) {
50
- throw new TypeError("Super expression must either be null or a function");
51
- }
52
- subClass.prototype = Object.create(superClass && superClass.prototype, {
53
- constructor: {
54
- value: subClass,
55
- writable: true,
56
- configurable: true
57
- }
58
- });
59
- if (superClass) _set_prototype_of(subClass, superClass);
60
- }
61
- function _instanceof(left, right) {
62
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
63
- return !!right[Symbol.hasInstance](left);
64
- } else {
65
- return left instanceof right;
66
- }
50
+ if (typeof superClass !== "function" && superClass !== null) {
51
+ throw new TypeError("Super expression must either be null or a function");
52
+ }
53
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: {
54
+ value: subClass,
55
+ writable: true,
56
+ configurable: true
57
+ } });
58
+ if (superClass) _set_prototype_of(subClass, superClass);
67
59
  }
68
60
  function _is_native_function(fn) {
69
- return Function.toString.call(fn).indexOf("[native code]") !== -1;
61
+ return Function.toString.call(fn).indexOf("[native code]") !== -1;
70
62
  }
71
63
  function _possible_constructor_return(self, call) {
72
- if (call && (_type_of(call) === "object" || typeof call === "function")) {
73
- return call;
74
- }
75
- return _assert_this_initialized(self);
64
+ if (call && (_type_of(call) === "object" || typeof call === "function")) {
65
+ return call;
66
+ }
67
+ return _assert_this_initialized(self);
76
68
  }
77
69
  function _set_prototype_of(o, p) {
78
- _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o2, p2) {
79
- o2.__proto__ = p2;
80
- return o2;
81
- };
82
- return _set_prototype_of(o, p);
70
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o2, p2) {
71
+ o2.__proto__ = p2;
72
+ return o2;
73
+ };
74
+ return _set_prototype_of(o, p);
83
75
  }
84
76
  function _type_of(obj) {
85
- "@swc/helpers - typeof";
86
-
87
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
77
+ "@swc/helpers - typeof";
78
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
88
79
  }
89
80
  function _wrap_native_super(Class) {
90
- var _cache = typeof Map === "function" ? /* @__PURE__ */new Map() : void 0;
91
- _wrap_native_super = function wrapNativeSuper(Class2) {
92
- if (Class2 === null || !_is_native_function(Class2)) return Class2;
93
- if (typeof Class2 !== "function") {
94
- throw new TypeError("Super expression must either be null or a function");
95
- }
96
- if (typeof _cache !== "undefined") {
97
- if (_cache.has(Class2)) return _cache.get(Class2);
98
- _cache.set(Class2, Wrapper);
99
- }
100
- function Wrapper() {
101
- return _construct(Class2, arguments, _get_prototype_of(this).constructor);
102
- }
103
- Wrapper.prototype = Object.create(Class2.prototype, {
104
- constructor: {
105
- value: Wrapper,
106
- enumerable: false,
107
- writable: true,
108
- configurable: true
109
- }
110
- });
111
- return _set_prototype_of(Wrapper, Class2);
112
- };
113
- return _wrap_native_super(Class);
81
+ var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
82
+ _wrap_native_super = function wrapNativeSuper(Class2) {
83
+ if (Class2 === null || !_is_native_function(Class2)) return Class2;
84
+ if (typeof Class2 !== "function") {
85
+ throw new TypeError("Super expression must either be null or a function");
86
+ }
87
+ if (typeof _cache !== "undefined") {
88
+ if (_cache.has(Class2)) return _cache.get(Class2);
89
+ _cache.set(Class2, Wrapper);
90
+ }
91
+ function Wrapper() {
92
+ return _construct(Class2, arguments, _get_prototype_of(this).constructor);
93
+ }
94
+ Wrapper.prototype = Object.create(Class2.prototype, { constructor: {
95
+ value: Wrapper,
96
+ enumerable: false,
97
+ writable: true,
98
+ configurable: true
99
+ } });
100
+ return _set_prototype_of(Wrapper, Class2);
101
+ };
102
+ return _wrap_native_super(Class);
114
103
  }
115
104
  function _is_native_reflect_construct() {
116
- try {
117
- var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
118
- } catch (_) {}
119
- return (_is_native_reflect_construct = function () {
120
- return !!result;
121
- })();
105
+ try {
106
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
107
+ } catch (_) {}
108
+ return (_is_native_reflect_construct = function() {
109
+ return !!result;
110
+ })();
122
111
  }
123
- var Bail = /* @__PURE__ */function (Error1) {
124
- "use strict";
125
-
126
- _inherits(Bail2, Error1);
127
- function Bail2() {
128
- _class_call_check(this, Bail2);
129
- return _call_super(this, Bail2, arguments);
130
- }
131
- return Bail2;
132
- }(_wrap_native_super(Error));
112
+ var Bail = /* @__PURE__ */ (function(Error1) {
113
+ "use strict";
114
+ _inherits(Bail2, Error1);
115
+ function Bail2() {
116
+ _class_call_check(this, Bail2);
117
+ return _call_super(this, Bail2, arguments);
118
+ }
119
+ return Bail2;
120
+ })(_wrap_native_super(Error));
133
121
  function bailIfUnchanged(obj1, obj2) {
134
- if (JSON.stringify(obj1) === JSON.stringify(obj2)) {
135
- throw new Bail();
136
- }
122
+ if (JSON.stringify(obj1) === JSON.stringify(obj2)) {
123
+ throw new Bail();
124
+ }
137
125
  }
138
126
  function bailIfExists(haystack, needle) {
139
- if (haystack.includes(needle)) {
140
- throw new Bail();
141
- }
127
+ if (haystack.includes(needle)) {
128
+ throw new Bail();
129
+ }
142
130
  }
143
131
  async function applyBuiltInPatches(options, extraPatches) {
144
- var all = [...builtInDepPatches];
145
- if (extraPatches) {
146
- var _loop = function (key2) {
147
- var extraPatchFiles = extraPatches[key2];
148
- var existing = all.find(function (x) {
149
- return x.module === key2;
150
- });
151
- if (existing) {
152
- for (var patchKey in extraPatchFiles) {
153
- if (existing.patchFiles[patchKey]) {
154
- console.warn(`Warning: Overwriting One built-in patch with user patch`, key2, patchKey);
155
- }
156
- existing.patchFiles[patchKey] = extraPatchFiles[patchKey];
157
- }
158
- } else {
159
- all.push({
160
- module: key2,
161
- patchFiles: extraPatchFiles
162
- });
163
- }
164
- };
165
- for (var key in extraPatches) _loop(key);
166
- }
167
- await applyDependencyPatches(all, {
168
- root: options.root
169
- });
132
+ var all = [...builtInDepPatches];
133
+ if (extraPatches) {
134
+ var _loop = function(key2) {
135
+ var extraPatchFiles = extraPatches[key2];
136
+ var existing = all.find(function(x) {
137
+ return x.module === key2;
138
+ });
139
+ if (existing) {
140
+ for (var patchKey in extraPatchFiles) {
141
+ if (existing.patchFiles[patchKey]) {
142
+ console.warn(`Warning: Overwriting One built-in patch with user patch`, key2, patchKey);
143
+ }
144
+ existing.patchFiles[patchKey] = extraPatchFiles[patchKey];
145
+ }
146
+ } else {
147
+ all.push({
148
+ module: key2,
149
+ patchFiles: extraPatchFiles
150
+ });
151
+ }
152
+ };
153
+ for (var key in extraPatches) _loop(key);
154
+ }
155
+ await applyDependencyPatches(all, { root: options.root });
170
156
  }
171
157
  var STATS_FILE = ".vxrn.patch-stats.json";
172
158
  function getOriginalPath(fullPath) {
173
- return fullPath + ".vxrn.original";
159
+ return fullPath + ".vxrn.original";
174
160
  }
175
161
  async function readPatchStats(nodeModulesDir) {
176
- try {
177
- return await FSExtra.readJSON(join(nodeModulesDir, STATS_FILE));
178
- } catch (unused) {
179
- return {};
180
- }
162
+ try {
163
+ return await FSExtra.readJSON(join(nodeModulesDir, STATS_FILE));
164
+ } catch (unused) {
165
+ return {};
166
+ }
181
167
  }
182
168
  async function writePatchStats(nodeModulesDir, stats) {
183
- await FSExtra.writeJSON(join(nodeModulesDir, STATS_FILE), stats);
169
+ await FSExtra.writeJSON(join(nodeModulesDir, STATS_FILE), stats);
184
170
  }
185
171
  function moduleToPnpmStorePattern(moduleName) {
186
- return moduleName.replace("/", "+");
172
+ return moduleName.replace("/", "+");
187
173
  }
188
174
  async function applyDependencyPatches(patches) {
189
- var {
190
- root = process.cwd()
191
- } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
192
- var patchModuleNames = [...new Set(patches.map(function (p) {
193
- return p.module;
194
- }))];
195
- var nodeModulesDirs = findNodeModules({
196
- cwd: root
197
- }).flatMap(function (relativePath) {
198
- var dir = join(root, relativePath);
199
- var dirs = [dir];
200
- var pnpmBase = join(dir, ".pnpm");
201
- if (!FSExtra.existsSync(pnpmBase)) return dirs;
202
- var pnpmHoistedDir = join(pnpmBase, "node_modules");
203
- if (FSExtra.existsSync(pnpmHoistedDir)) {
204
- dirs.push(pnpmHoistedDir);
205
- }
206
- var _iteratorNormalCompletion2 = true,
207
- _didIteratorError2 = false,
208
- _iteratorError2 = void 0;
209
- try {
210
- for (var _iterator2 = patchModuleNames[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
211
- var moduleName = _step2.value;
212
- var storePattern = moduleToPnpmStorePattern(moduleName);
213
- var storeMatches = Glob.sync(`${storePattern}@*/node_modules`, {
214
- cwd: pnpmBase,
215
- onlyDirectories: true
216
- });
217
- var _iteratorNormalCompletion1 = true,
218
- _didIteratorError1 = false,
219
- _iteratorError1 = void 0;
220
- try {
221
- for (var _iterator1 = storeMatches[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
222
- var match = _step1.value;
223
- dirs.push(join(pnpmBase, match));
224
- }
225
- } catch (err) {
226
- _didIteratorError1 = true;
227
- _iteratorError1 = err;
228
- } finally {
229
- try {
230
- if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
231
- _iterator1.return();
232
- }
233
- } finally {
234
- if (_didIteratorError1) {
235
- throw _iteratorError1;
236
- }
237
- }
238
- }
239
- }
240
- } catch (err) {
241
- _didIteratorError2 = true;
242
- _iteratorError2 = err;
243
- } finally {
244
- try {
245
- if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
246
- _iterator2.return();
247
- }
248
- } finally {
249
- if (_didIteratorError2) {
250
- throw _iteratorError2;
251
- }
252
- }
253
- }
254
- return dirs;
255
- });
256
- var results = /* @__PURE__ */new Map();
257
- var transformWarnedModules = /* @__PURE__ */new Set();
258
- var patchedRealPaths = /* @__PURE__ */new Set();
259
- await Promise.all(nodeModulesDirs.map(async function (nodeModulesDir) {
260
- var patchStats = await readPatchStats(nodeModulesDir);
261
- var statsChanged = false;
262
- await Promise.all(patches.map(async function (patch) {
263
- try {
264
- var nodeModuleDir = join(nodeModulesDir, patch.module);
265
- if (!FSExtra.existsSync(nodeModuleDir)) return;
266
- var realModuleDir;
267
- try {
268
- realModuleDir = realpathSync(nodeModuleDir);
269
- } catch (unused) {
270
- return;
271
- }
272
- var patchIdx = patches.indexOf(patch);
273
- var dedupKey = `${patchIdx}\0${realModuleDir}`;
274
- if (patchedRealPaths.has(dedupKey)) return;
275
- patchedRealPaths.add(dedupKey);
276
- var version = patch.patchFiles.version;
277
- if (typeof version === "string") {
278
- var pkgJSON = await FSExtra.readJSON(join(nodeModuleDir, "package.json"));
279
- if (!semver.satisfies(pkgJSON.version, version)) return;
280
- }
281
- var filePatches = [];
282
- for (var file in patch.patchFiles) {
283
- if (file === "version") continue;
284
- var filesToApply = file.includes("*") ? globDir(nodeModuleDir, file) : [file];
285
- var _iteratorNormalCompletion2 = true,
286
- _didIteratorError2 = false,
287
- _iteratorError2 = void 0;
288
- try {
289
- for (var _iterator2 = filesToApply[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
290
- var relativePath = _step2.value;
291
- filePatches.push({
292
- relativePath,
293
- patchDefinition: patch.patchFiles[file]
294
- });
295
- }
296
- } catch (err) {
297
- _didIteratorError2 = true;
298
- _iteratorError2 = err;
299
- } finally {
300
- try {
301
- if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
302
- _iterator2.return();
303
- }
304
- } finally {
305
- if (_didIteratorError2) {
306
- throw _iteratorError2;
307
- }
308
- }
309
- }
310
- }
311
- var fileStatsResults = await Promise.all(filePatches.map(async function (param) {
312
- var {
313
- relativePath: relativePath2
314
- } = param;
315
- var fullPath = join(nodeModuleDir, relativePath2);
316
- try {
317
- var stat = await FSExtra.stat(fullPath);
318
- return {
319
- relativePath: relativePath2,
320
- fullPath,
321
- stat,
322
- exists: true
323
- };
324
- } catch (unused) {
325
- return {
326
- relativePath: relativePath2,
327
- fullPath,
328
- stat: null,
329
- exists: false
330
- };
331
- }
332
- }));
333
- var filesToProcess = fileStatsResults.filter(function (param) {
334
- var {
335
- fullPath,
336
- stat,
337
- exists
338
- } = param;
339
- if (!exists || !stat) return false;
340
- if (process.env.VXRN_FORCE_PATCH) return true;
341
- var cached = patchStats[fullPath];
342
- if (!cached) return true;
343
- return stat.size !== cached.size || stat.mtimeMs !== cached.mtimeMs;
344
- });
345
- if (filesToProcess.length === 0) {
346
- if (!results.has(patch.module)) {
347
- results.set(patch.module, "ok");
348
- }
349
- return;
350
- }
351
- var didApplyPatch = false;
352
- await Promise.all(filesToProcess.map(async function (param) {
353
- var {
354
- relativePath: relativePath2,
355
- fullPath
356
- } = param;
357
- try {
358
- var patchDef = filePatches.find(function (p) {
359
- return p.relativePath === relativePath2;
360
- }).patchDefinition;
361
- var originalPath = getOriginalPath(fullPath);
362
- var [targetContent, originalContent] = await Promise.all([FSExtra.readFile(fullPath, "utf-8"), FSExtra.readFile(originalPath, "utf-8").catch(function () {
363
- return null;
364
- })]);
365
- var sourceContent = originalContent !== null && originalContent !== void 0 ? originalContent : targetContent;
366
- var patchedContent = null;
367
- if (typeof patchDef === "string") {
368
- patchedContent = patchDef;
369
- } else if (Array.isArray(patchDef)) {
370
- try {
371
- var contents = sourceContent;
372
- var _iteratorNormalCompletion3 = true,
373
- _didIteratorError3 = false,
374
- _iteratorError3 = void 0;
375
- try {
376
- for (var _iterator3 = patchDef[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
377
- var strategy = _step3.value;
378
- if (strategy === "flow") {
379
- contents = await transformFlowBabel(contents);
380
- }
381
- if (strategy === "swc" || strategy === "jsx") {
382
- var _this;
383
- contents = ((_this = await transformSWC(fullPath, contents, {
384
- mode: "build",
385
- environment: "ios",
386
- forceJSX: strategy === "jsx",
387
- noHMR: true,
388
- fixNonTypeSpecificImports: true,
389
- // a patch is written to node_modules ONCE and then read by
390
- // every later build, dev and production alike, so its output
391
- // has to be valid in both. the automatic JSX runtime is not:
392
- // its dev form emits `jsxDEV` from react/jsx-dev-runtime, and
393
- // React's production build exports `jsxDEV = void 0`, so a
394
- // patched dependency that renders JSX throws "undefined is not
395
- // a function" from render in any production bundle. `jsx`/`jsxs`
396
- // work in both builds, and refresh is already off for
397
- // node_modules, so the stable runtime is the only correct output.
398
- production: true
399
- })) === null || _this === void 0 ? void 0 : _this.code) || contents;
400
- }
401
- }
402
- } catch (err) {
403
- _didIteratorError3 = true;
404
- _iteratorError3 = err;
405
- } finally {
406
- try {
407
- if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
408
- _iterator3.return();
409
- }
410
- } finally {
411
- if (_didIteratorError3) {
412
- throw _iteratorError3;
413
- }
414
- }
415
- }
416
- if (contents !== sourceContent) {
417
- patchedContent = contents;
418
- }
419
- } catch (transformErr) {
420
- if (!transformWarnedModules.has(patch.module)) {
421
- var _ref;
422
- transformWarnedModules.add(patch.module);
423
- console.warn(` \u26A0 Patch transform failed for ${patch.module} in ${relativePath2}, skipping non-critical patch: ${(_ref = transformErr === null || transformErr === void 0 ? void 0 : transformErr.stack) !== null && _ref !== void 0 ? _ref : transformErr}`);
424
- }
425
- return;
426
- }
427
- } else {
428
- var out = await patchDef(sourceContent);
429
- if (typeof out === "string" && out !== sourceContent) {
430
- patchedContent = out;
431
- } else if (typeof out === "string") {
432
- console.warn(`[vxrn] patch for ${patch.module} matched nothing in ${relativePath2} \u2014 it is stale and is no longer protecting anything`);
433
- }
434
- }
435
- if (patchedContent !== null) {
436
- if (targetContent === patchedContent) {
437
- var stat = await FSExtra.stat(fullPath);
438
- patchStats[fullPath] = {
439
- size: stat.size,
440
- mtimeMs: stat.mtimeMs
441
- };
442
- statsChanged = true;
443
- return;
444
- }
445
- await Promise.all([originalContent === null && atomicWriteFile(originalPath, sourceContent), atomicWriteFile(fullPath, patchedContent)]);
446
- var stat1 = await FSExtra.stat(fullPath);
447
- patchStats[fullPath] = {
448
- size: stat1.size,
449
- mtimeMs: stat1.mtimeMs
450
- };
451
- statsChanged = true;
452
- didApplyPatch = true;
453
- if (process.env.DEBUG) {
454
- console.info(` - Applied patch to ${patch.module}: ${relativePath2}`);
455
- }
456
- } else {
457
- var stat2 = await FSExtra.stat(fullPath);
458
- patchStats[fullPath] = {
459
- size: stat2.size,
460
- mtimeMs: stat2.mtimeMs
461
- };
462
- statsChanged = true;
463
- }
464
- } catch (err) {
465
- if (_instanceof(err, Bail)) return;
466
- throw err;
467
- }
468
- }));
469
- if (didApplyPatch) {
470
- results.set(patch.module, "applied");
471
- } else if (!results.has(patch.module)) {
472
- results.set(patch.module, "ok");
473
- }
474
- } catch (err) {
475
- console.error(`\u{1F6A8} Error applying patch to`, patch.module);
476
- console.error(err);
477
- }
478
- }));
479
- if (statsChanged) {
480
- await writePatchStats(nodeModulesDir, patchStats);
481
- }
482
- }));
483
- var _iteratorNormalCompletion = true,
484
- _didIteratorError = false,
485
- _iteratorError = void 0;
486
- try {
487
- for (var _iterator = results[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
488
- var [module, result] = _step.value;
489
- if (result === "applied") {
490
- console.info(` \u{1FA79} ${module}`);
491
- } else if (result === "ok" && process.env.VXRN_FORCE_PATCH) {
492
- console.info(` \u2713 ${module}`);
493
- }
494
- }
495
- } catch (err) {
496
- _didIteratorError = true;
497
- _iteratorError = err;
498
- } finally {
499
- try {
500
- if (!_iteratorNormalCompletion && _iterator.return != null) {
501
- _iterator.return();
502
- }
503
- } finally {
504
- if (_didIteratorError) {
505
- throw _iteratorError;
506
- }
507
- }
508
- }
175
+ var { root = process.cwd() } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
176
+ var patchModuleNames = [...new Set(patches.map(function(p) {
177
+ return p.module;
178
+ }))];
179
+ var nodeModulesDirs = findNodeModules({ cwd: root }).flatMap(function(relativePath) {
180
+ var dir = join(root, relativePath);
181
+ var dirs = [dir];
182
+ var pnpmBase = join(dir, ".pnpm");
183
+ if (!FSExtra.existsSync(pnpmBase)) return dirs;
184
+ var pnpmHoistedDir = join(pnpmBase, "node_modules");
185
+ if (FSExtra.existsSync(pnpmHoistedDir)) {
186
+ dirs.push(pnpmHoistedDir);
187
+ }
188
+ var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = void 0;
189
+ try {
190
+ for (var _iterator2 = patchModuleNames[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
191
+ var moduleName = _step2.value;
192
+ var storePattern = moduleToPnpmStorePattern(moduleName);
193
+ var storeMatches = Glob.sync(`${storePattern}@*/node_modules`, {
194
+ cwd: pnpmBase,
195
+ onlyDirectories: true
196
+ });
197
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
198
+ try {
199
+ for (var _iterator1 = storeMatches[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
200
+ var match = _step1.value;
201
+ dirs.push(join(pnpmBase, match));
202
+ }
203
+ } catch (err) {
204
+ _didIteratorError1 = true;
205
+ _iteratorError1 = err;
206
+ } finally {
207
+ try {
208
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
209
+ _iterator1.return();
210
+ }
211
+ } finally {
212
+ if (_didIteratorError1) {
213
+ throw _iteratorError1;
214
+ }
215
+ }
216
+ }
217
+ }
218
+ } catch (err) {
219
+ _didIteratorError2 = true;
220
+ _iteratorError2 = err;
221
+ } finally {
222
+ try {
223
+ if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
224
+ _iterator2.return();
225
+ }
226
+ } finally {
227
+ if (_didIteratorError2) {
228
+ throw _iteratorError2;
229
+ }
230
+ }
231
+ }
232
+ return dirs;
233
+ });
234
+ var results = /* @__PURE__ */ new Map();
235
+ var transformWarnedModules = /* @__PURE__ */ new Set();
236
+ var patchedRealPaths = /* @__PURE__ */ new Set();
237
+ await Promise.all(nodeModulesDirs.map(async function(nodeModulesDir) {
238
+ var patchStats = await readPatchStats(nodeModulesDir);
239
+ var statsChanged = false;
240
+ await Promise.all(patches.map(async function(patch) {
241
+ try {
242
+ var nodeModuleDir = join(nodeModulesDir, patch.module);
243
+ if (!FSExtra.existsSync(nodeModuleDir)) return;
244
+ var realModuleDir;
245
+ try {
246
+ realModuleDir = realpathSync(nodeModuleDir);
247
+ } catch (unused) {
248
+ return;
249
+ }
250
+ var patchIdx = patches.indexOf(patch);
251
+ var dedupKey = `${patchIdx}\0${realModuleDir}`;
252
+ if (patchedRealPaths.has(dedupKey)) return;
253
+ patchedRealPaths.add(dedupKey);
254
+ var version = patch.patchFiles.version;
255
+ if (typeof version === "string") {
256
+ var pkgJSON = await FSExtra.readJSON(join(nodeModuleDir, "package.json"));
257
+ if (!semver.satisfies(pkgJSON.version, version)) return;
258
+ }
259
+ var filePatches = [];
260
+ for (var file in patch.patchFiles) {
261
+ if (file === "version") continue;
262
+ var filesToApply = file.includes("*") ? globDir(nodeModuleDir, file) : [file];
263
+ var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = void 0;
264
+ try {
265
+ for (var _iterator2 = filesToApply[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
266
+ var relativePath = _step2.value;
267
+ filePatches.push({
268
+ relativePath,
269
+ patchDefinition: patch.patchFiles[file]
270
+ });
271
+ }
272
+ } catch (err) {
273
+ _didIteratorError2 = true;
274
+ _iteratorError2 = err;
275
+ } finally {
276
+ try {
277
+ if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
278
+ _iterator2.return();
279
+ }
280
+ } finally {
281
+ if (_didIteratorError2) {
282
+ throw _iteratorError2;
283
+ }
284
+ }
285
+ }
286
+ }
287
+ var fileStatsResults = await Promise.all(filePatches.map(async function(param) {
288
+ var { relativePath: relativePath2 } = param;
289
+ var fullPath = join(nodeModuleDir, relativePath2);
290
+ try {
291
+ var stat = await FSExtra.stat(fullPath);
292
+ return {
293
+ relativePath: relativePath2,
294
+ fullPath,
295
+ stat,
296
+ exists: true
297
+ };
298
+ } catch (unused) {
299
+ return {
300
+ relativePath: relativePath2,
301
+ fullPath,
302
+ stat: null,
303
+ exists: false
304
+ };
305
+ }
306
+ }));
307
+ var filesToProcess = fileStatsResults.filter(function(param) {
308
+ var { fullPath, stat, exists } = param;
309
+ if (!exists || !stat) return false;
310
+ if (process.env.VXRN_FORCE_PATCH) return true;
311
+ var cached = patchStats[fullPath];
312
+ if (!cached) return true;
313
+ return stat.size !== cached.size || stat.mtimeMs !== cached.mtimeMs;
314
+ });
315
+ if (filesToProcess.length === 0) {
316
+ if (!results.has(patch.module)) {
317
+ results.set(patch.module, "ok");
318
+ }
319
+ return;
320
+ }
321
+ var didApplyPatch = false;
322
+ await Promise.all(filesToProcess.map(async function(param) {
323
+ var { relativePath: relativePath2, fullPath } = param;
324
+ try {
325
+ var patchDef = filePatches.find(function(p) {
326
+ return p.relativePath === relativePath2;
327
+ }).patchDefinition;
328
+ var originalPath = getOriginalPath(fullPath);
329
+ var [targetContent, originalContent] = await Promise.all([FSExtra.readFile(fullPath, "utf-8"), FSExtra.readFile(originalPath, "utf-8").catch(function() {
330
+ return null;
331
+ })]);
332
+ var sourceContent = originalContent !== null && originalContent !== void 0 ? originalContent : targetContent;
333
+ var patchedContent = null;
334
+ if (typeof patchDef === "string") {
335
+ patchedContent = patchDef;
336
+ } else if (Array.isArray(patchDef)) {
337
+ try {
338
+ var contents = sourceContent;
339
+ var _iteratorNormalCompletion3 = true, _didIteratorError3 = false, _iteratorError3 = void 0;
340
+ try {
341
+ for (var _iterator3 = patchDef[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
342
+ var strategy = _step3.value;
343
+ if (strategy === "flow") {
344
+ contents = await transformFlowBabel(contents);
345
+ }
346
+ if (strategy === "swc" || strategy === "jsx") {
347
+ var _this;
348
+ contents = ((_this = await transformSWC(fullPath, contents, {
349
+ mode: "build",
350
+ environment: "ios",
351
+ forceJSX: strategy === "jsx",
352
+ noHMR: true,
353
+ fixNonTypeSpecificImports: true,
354
+ production: true
355
+ })) === null || _this === void 0 ? void 0 : _this.code) || contents;
356
+ }
357
+ }
358
+ } catch (err) {
359
+ _didIteratorError3 = true;
360
+ _iteratorError3 = err;
361
+ } finally {
362
+ try {
363
+ if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
364
+ _iterator3.return();
365
+ }
366
+ } finally {
367
+ if (_didIteratorError3) {
368
+ throw _iteratorError3;
369
+ }
370
+ }
371
+ }
372
+ if (contents !== sourceContent) {
373
+ patchedContent = contents;
374
+ }
375
+ } catch (transformErr) {
376
+ if (!transformWarnedModules.has(patch.module)) {
377
+ var _ref;
378
+ transformWarnedModules.add(patch.module);
379
+ console.warn(` \u26A0 Patch transform failed for ${patch.module} in ${relativePath2}, skipping non-critical patch: ${(_ref = transformErr === null || transformErr === void 0 ? void 0 : transformErr.stack) !== null && _ref !== void 0 ? _ref : transformErr}`);
380
+ }
381
+ return;
382
+ }
383
+ } else {
384
+ var out = await patchDef(sourceContent);
385
+ if (typeof out === "string" && out !== sourceContent) {
386
+ patchedContent = out;
387
+ } else if (typeof out === "string") {
388
+ console.warn(`[vxrn] patch for ${patch.module} matched nothing in ${relativePath2} \u2014 it is stale and is no longer protecting anything`);
389
+ }
390
+ }
391
+ if (patchedContent !== null) {
392
+ if (targetContent === patchedContent) {
393
+ var stat = await FSExtra.stat(fullPath);
394
+ patchStats[fullPath] = {
395
+ size: stat.size,
396
+ mtimeMs: stat.mtimeMs
397
+ };
398
+ statsChanged = true;
399
+ return;
400
+ }
401
+ await Promise.all([originalContent === null && atomicWriteFile(originalPath, sourceContent), atomicWriteFile(fullPath, patchedContent)]);
402
+ var stat1 = await FSExtra.stat(fullPath);
403
+ patchStats[fullPath] = {
404
+ size: stat1.size,
405
+ mtimeMs: stat1.mtimeMs
406
+ };
407
+ statsChanged = true;
408
+ didApplyPatch = true;
409
+ if (process.env.DEBUG) {
410
+ console.info(` - Applied patch to ${patch.module}: ${relativePath2}`);
411
+ }
412
+ } else {
413
+ var stat2 = await FSExtra.stat(fullPath);
414
+ patchStats[fullPath] = {
415
+ size: stat2.size,
416
+ mtimeMs: stat2.mtimeMs
417
+ };
418
+ statsChanged = true;
419
+ }
420
+ } catch (err) {
421
+ if (err instanceof Bail) return;
422
+ throw err;
423
+ }
424
+ }));
425
+ if (didApplyPatch) {
426
+ results.set(patch.module, "applied");
427
+ } else if (!results.has(patch.module)) {
428
+ results.set(patch.module, "ok");
429
+ }
430
+ } catch (err) {
431
+ console.error(`\u{1F6A8} Error applying patch to`, patch.module);
432
+ console.error(err);
433
+ }
434
+ }));
435
+ if (statsChanged) {
436
+ await writePatchStats(nodeModulesDir, patchStats);
437
+ }
438
+ }));
439
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
440
+ try {
441
+ for (var _iterator = results[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
442
+ var [module, result] = _step.value;
443
+ if (result === "applied") {
444
+ console.info(` \u{1FA79} ${module}`);
445
+ } else if (result === "ok" && process.env.VXRN_FORCE_PATCH) {
446
+ console.info(` \u2713 ${module}`);
447
+ }
448
+ }
449
+ } catch (err) {
450
+ _didIteratorError = true;
451
+ _iteratorError = err;
452
+ } finally {
453
+ try {
454
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
455
+ _iterator.return();
456
+ }
457
+ } finally {
458
+ if (_didIteratorError) {
459
+ throw _iteratorError;
460
+ }
461
+ }
462
+ }
509
463
  }
510
464
  async function atomicWriteFile(filePath, contents) {
511
- var tempPath = filePath + ".vxrn.tmp." + process.pid + "." + Date.now();
512
- await FSExtra.writeFile(tempPath, contents);
513
- await rename(tempPath, filePath);
465
+ var tempPath = filePath + ".vxrn.tmp." + process.pid + "." + Date.now();
466
+ await FSExtra.writeFile(tempPath, contents);
467
+ await rename(tempPath, filePath);
514
468
  }
469
+
515
470
  export { applyBuiltInPatches, applyDependencyPatches, bailIfExists, bailIfUnchanged, moduleToPnpmStorePattern };
516
471
  //# sourceMappingURL=patches.native.js.map