vxrn 0.1.50 → 0.1.52

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 (330) hide show
  1. package/dist/cjs/exports/bindKeypressInput.js +58 -0
  2. package/dist/cjs/exports/bindKeypressInput.js.map +6 -0
  3. package/dist/cjs/exports/bindKeypressInput.native.js +63 -0
  4. package/dist/cjs/exports/bindKeypressInput.native.js.map +6 -0
  5. package/dist/cjs/exports/build.js +26 -93
  6. package/dist/cjs/exports/build.js.map +2 -2
  7. package/dist/cjs/exports/build.native.js +70 -360
  8. package/dist/cjs/exports/build.native.js.map +2 -2
  9. package/dist/cjs/exports/coerceToArray.js +23 -0
  10. package/dist/cjs/exports/coerceToArray.js.map +6 -0
  11. package/dist/cjs/exports/connectedNativeClients.js +21 -0
  12. package/dist/cjs/exports/connectedNativeClients.js.map +6 -0
  13. package/dist/cjs/exports/dev.js +10 -416
  14. package/dist/cjs/exports/dev.js.map +2 -2
  15. package/dist/cjs/exports/dev.native.js +16 -732
  16. package/dist/cjs/exports/dev.native.js.map +2 -2
  17. package/dist/cjs/exports/entryRoot.js +69 -0
  18. package/dist/cjs/exports/entryRoot.js.map +6 -0
  19. package/dist/cjs/exports/getIndexJsonResponse.js +71 -0
  20. package/dist/cjs/exports/getIndexJsonResponse.js.map +6 -0
  21. package/dist/cjs/exports/getIndexJsonResponse.native.js +99 -0
  22. package/dist/cjs/exports/getIndexJsonResponse.native.js.map +6 -0
  23. package/dist/cjs/exports/getReactNativeBundle.js +160 -0
  24. package/dist/cjs/exports/getReactNativeBundle.js.map +6 -0
  25. package/dist/cjs/exports/getViteServerConfig.js +77 -0
  26. package/dist/cjs/exports/getViteServerConfig.js.map +6 -0
  27. package/dist/cjs/exports/getViteServerConfig.native.js +253 -0
  28. package/dist/cjs/exports/getViteServerConfig.native.js.map +6 -0
  29. package/dist/cjs/exports/hotUpdateCache.js +21 -0
  30. package/dist/cjs/exports/hotUpdateCache.js.map +6 -0
  31. package/dist/cjs/exports/isBuildingNativeBundle.js +21 -0
  32. package/dist/cjs/exports/isBuildingNativeBundle.js.map +6 -0
  33. package/dist/cjs/exports/isWithin.js +25 -0
  34. package/dist/cjs/exports/isWithin.js.map +6 -0
  35. package/dist/cjs/exports/reactNativeHMRPlugin.js +69 -0
  36. package/dist/cjs/exports/reactNativeHMRPlugin.js.map +6 -0
  37. package/dist/cjs/exports/resolveFile.js +28 -0
  38. package/dist/cjs/exports/resolveFile.js.map +6 -0
  39. package/dist/cjs/exports/resolveFile.native.js +34 -0
  40. package/dist/cjs/exports/resolveFile.native.js.map +6 -0
  41. package/dist/cjs/exports/serve.js +1 -1
  42. package/dist/cjs/exports/serve.js.map +1 -1
  43. package/dist/cjs/exports/serve.native.js +1 -1
  44. package/dist/cjs/exports/serve.native.js.map +1 -1
  45. package/dist/cjs/exports/swapPrebuiltReactModules.js +100 -0
  46. package/dist/cjs/exports/swapPrebuiltReactModules.js.map +6 -0
  47. package/dist/cjs/exports/uniq.js +23 -0
  48. package/dist/cjs/exports/uniq.js.map +6 -0
  49. package/dist/cjs/index.js +4 -0
  50. package/dist/cjs/index.js.map +1 -1
  51. package/dist/cjs/index.native.js +8 -0
  52. package/dist/cjs/index.native.js.map +1 -1
  53. package/dist/cjs/plugins/reactNativeCommonJsPlugin.js.map +1 -1
  54. package/dist/cjs/plugins/reactNativeCommonJsPlugin.native.js.map +1 -1
  55. package/dist/cjs/plugins/reactNativeHMRPlugin.js +67 -0
  56. package/dist/cjs/plugins/reactNativeHMRPlugin.js.map +6 -0
  57. package/dist/cjs/plugins/reactNativeHMRPlugin.native.js +307 -0
  58. package/dist/cjs/plugins/reactNativeHMRPlugin.native.js.map +6 -0
  59. package/dist/cjs/types.native.js.map +1 -1
  60. package/dist/cjs/utils/bindKeypressInput.js +58 -0
  61. package/dist/cjs/utils/bindKeypressInput.js.map +6 -0
  62. package/dist/cjs/utils/bindKeypressInput.native.js +63 -0
  63. package/dist/cjs/utils/bindKeypressInput.native.js.map +6 -0
  64. package/dist/cjs/utils/coerceToArray.js +23 -0
  65. package/dist/cjs/utils/coerceToArray.js.map +6 -0
  66. package/dist/cjs/utils/coerceToArray.native.js +30 -0
  67. package/dist/cjs/utils/coerceToArray.native.js.map +6 -0
  68. package/dist/cjs/utils/connectedNativeClients.js +29 -0
  69. package/dist/cjs/utils/connectedNativeClients.js.map +6 -0
  70. package/dist/cjs/utils/connectedNativeClients.native.js +36 -0
  71. package/dist/cjs/utils/connectedNativeClients.native.js.map +6 -0
  72. package/dist/cjs/utils/getIndexJsonResponse.js +71 -0
  73. package/dist/cjs/utils/getIndexJsonResponse.js.map +6 -0
  74. package/dist/cjs/utils/getIndexJsonResponse.native.js +99 -0
  75. package/dist/cjs/utils/getIndexJsonResponse.native.js.map +6 -0
  76. package/dist/cjs/utils/getOptimizeDeps.js +8 -7
  77. package/dist/cjs/utils/getOptimizeDeps.js.map +1 -1
  78. package/dist/cjs/utils/getOptimizeDeps.native.js +8 -7
  79. package/dist/cjs/utils/getOptimizeDeps.native.js.map +1 -1
  80. package/dist/cjs/utils/getOptionsFilled.js.map +1 -1
  81. package/dist/cjs/utils/getOptionsFilled.native.js.map +1 -1
  82. package/dist/cjs/utils/getReactNativeBundle.js +165 -0
  83. package/dist/cjs/utils/getReactNativeBundle.js.map +6 -0
  84. package/dist/cjs/utils/getReactNativeBundle.native.js +389 -0
  85. package/dist/cjs/utils/getReactNativeBundle.native.js.map +6 -0
  86. package/dist/cjs/utils/getVitePath.js +2 -2
  87. package/dist/cjs/utils/getVitePath.js.map +2 -2
  88. package/dist/cjs/utils/getVitePath.native.js +8 -8
  89. package/dist/cjs/utils/getVitePath.native.js.map +2 -2
  90. package/dist/cjs/utils/getViteServerConfig.js +80 -0
  91. package/dist/cjs/utils/getViteServerConfig.js.map +6 -0
  92. package/dist/cjs/utils/getViteServerConfig.native.js +256 -0
  93. package/dist/cjs/utils/getViteServerConfig.native.js.map +6 -0
  94. package/dist/cjs/utils/hotUpdateCache.js +21 -0
  95. package/dist/cjs/utils/hotUpdateCache.js.map +6 -0
  96. package/dist/cjs/utils/hotUpdateCache.native.js +26 -0
  97. package/dist/cjs/utils/hotUpdateCache.native.js.map +6 -0
  98. package/dist/cjs/utils/isBuildingNativeBundle.js +25 -0
  99. package/dist/cjs/utils/isBuildingNativeBundle.js.map +6 -0
  100. package/dist/cjs/utils/isBuildingNativeBundle.native.js +32 -0
  101. package/dist/cjs/utils/isBuildingNativeBundle.native.js.map +6 -0
  102. package/dist/cjs/utils/isWithin.js +25 -0
  103. package/dist/cjs/utils/isWithin.js.map +6 -0
  104. package/dist/cjs/utils/isWithin.native.js +30 -0
  105. package/dist/cjs/utils/isWithin.native.js.map +6 -0
  106. package/dist/cjs/utils/readVXRNConfig.js +15 -18
  107. package/dist/cjs/utils/readVXRNConfig.js.map +2 -2
  108. package/dist/cjs/utils/readVXRNConfig.native.js +104 -49
  109. package/dist/cjs/utils/readVXRNConfig.native.js.map +2 -2
  110. package/dist/cjs/utils/resolveFile.js +28 -0
  111. package/dist/cjs/utils/resolveFile.js.map +6 -0
  112. package/dist/cjs/utils/resolveFile.native.js +34 -0
  113. package/dist/cjs/utils/resolveFile.native.js.map +6 -0
  114. package/dist/cjs/utils/swapPrebuiltReactModules.js +108 -0
  115. package/dist/cjs/utils/swapPrebuiltReactModules.js.map +6 -0
  116. package/dist/cjs/utils/swapPrebuiltReactModules.native.js +272 -0
  117. package/dist/cjs/utils/swapPrebuiltReactModules.native.js.map +6 -0
  118. package/dist/cjs/utils/uniq.js +23 -0
  119. package/dist/cjs/utils/uniq.js.map +6 -0
  120. package/dist/cjs/utils/uniq.native.js +59 -0
  121. package/dist/cjs/utils/uniq.native.js.map +6 -0
  122. package/dist/esm/exports/bindKeypressInput.js +34 -0
  123. package/dist/esm/exports/bindKeypressInput.js.map +6 -0
  124. package/dist/esm/exports/bindKeypressInput.mjs +31 -0
  125. package/dist/esm/exports/bindKeypressInput.native.js +34 -0
  126. package/dist/esm/exports/bindKeypressInput.native.js.map +6 -0
  127. package/dist/esm/exports/build.js +27 -98
  128. package/dist/esm/exports/build.js.map +1 -1
  129. package/dist/esm/exports/build.mjs +38 -135
  130. package/dist/esm/exports/build.native.js +71 -366
  131. package/dist/esm/exports/build.native.js.map +2 -2
  132. package/dist/esm/exports/coerceToArray.js +7 -0
  133. package/dist/esm/exports/coerceToArray.js.map +6 -0
  134. package/dist/esm/exports/coerceToArray.mjs +4 -0
  135. package/dist/esm/exports/connectedNativeClients.js +5 -0
  136. package/dist/esm/exports/connectedNativeClients.js.map +6 -0
  137. package/dist/esm/exports/connectedNativeClients.mjs +2 -0
  138. package/dist/esm/exports/dev.js +17 -431
  139. package/dist/esm/exports/dev.js.map +2 -2
  140. package/dist/esm/exports/dev.mjs +15 -430
  141. package/dist/esm/exports/dev.native.js +19 -738
  142. package/dist/esm/exports/dev.native.js.map +2 -2
  143. package/dist/esm/exports/entryRoot.js +58 -0
  144. package/dist/esm/exports/entryRoot.js.map +6 -0
  145. package/dist/esm/exports/entryRoot.mjs +62 -0
  146. package/dist/esm/exports/getIndexJsonResponse.js +55 -0
  147. package/dist/esm/exports/getIndexJsonResponse.js.map +6 -0
  148. package/dist/esm/exports/getIndexJsonResponse.mjs +71 -0
  149. package/dist/esm/exports/getIndexJsonResponse.native.js +78 -0
  150. package/dist/esm/exports/getIndexJsonResponse.native.js.map +6 -0
  151. package/dist/esm/exports/getReactNativeBundle.js +146 -0
  152. package/dist/esm/exports/getReactNativeBundle.js.map +6 -0
  153. package/dist/esm/exports/getReactNativeBundle.mjs +136 -0
  154. package/dist/esm/exports/getViteServerConfig.js +64 -0
  155. package/dist/esm/exports/getViteServerConfig.js.map +6 -0
  156. package/dist/esm/exports/getViteServerConfig.mjs +44 -0
  157. package/dist/esm/exports/getViteServerConfig.native.js +235 -0
  158. package/dist/esm/exports/getViteServerConfig.native.js.map +6 -0
  159. package/dist/esm/exports/hotUpdateCache.js +5 -0
  160. package/dist/esm/exports/hotUpdateCache.js.map +6 -0
  161. package/dist/esm/exports/hotUpdateCache.mjs +2 -0
  162. package/dist/esm/exports/isBuildingNativeBundle.js +5 -0
  163. package/dist/esm/exports/isBuildingNativeBundle.js.map +6 -0
  164. package/dist/esm/exports/isBuildingNativeBundle.mjs +2 -0
  165. package/dist/esm/exports/isWithin.js +9 -0
  166. package/dist/esm/exports/isWithin.js.map +6 -0
  167. package/dist/esm/exports/isWithin.mjs +6 -0
  168. package/dist/esm/exports/reactNativeHMRPlugin.js +58 -0
  169. package/dist/esm/exports/reactNativeHMRPlugin.js.map +6 -0
  170. package/dist/esm/exports/reactNativeHMRPlugin.mjs +62 -0
  171. package/dist/esm/exports/resolveFile.js +12 -0
  172. package/dist/esm/exports/resolveFile.js.map +6 -0
  173. package/dist/esm/exports/resolveFile.mjs +9 -0
  174. package/dist/esm/exports/resolveFile.native.js +12 -0
  175. package/dist/esm/exports/resolveFile.native.js.map +6 -0
  176. package/dist/esm/exports/serve.js +1 -1
  177. package/dist/esm/exports/serve.js.map +1 -1
  178. package/dist/esm/exports/serve.mjs +1 -1
  179. package/dist/esm/exports/serve.native.js +1 -1
  180. package/dist/esm/exports/serve.native.js.map +1 -1
  181. package/dist/esm/exports/swapPrebuiltReactModules.js +87 -0
  182. package/dist/esm/exports/swapPrebuiltReactModules.js.map +6 -0
  183. package/dist/esm/exports/swapPrebuiltReactModules.mjs +73 -0
  184. package/dist/esm/exports/uniq.js +7 -0
  185. package/dist/esm/exports/uniq.js.map +6 -0
  186. package/dist/esm/exports/uniq.mjs +4 -0
  187. package/dist/esm/index.js +4 -0
  188. package/dist/esm/index.js.map +1 -1
  189. package/dist/esm/index.mjs +4 -0
  190. package/dist/esm/index.native.js +4 -0
  191. package/dist/esm/index.native.js.map +1 -1
  192. package/dist/esm/plugins/reactNativeCommonJsPlugin.js.map +1 -1
  193. package/dist/esm/plugins/reactNativeCommonJsPlugin.native.js.map +1 -1
  194. package/dist/esm/plugins/reactNativeHMRPlugin.js +57 -0
  195. package/dist/esm/plugins/reactNativeHMRPlugin.js.map +6 -0
  196. package/dist/esm/plugins/reactNativeHMRPlugin.mjs +62 -0
  197. package/dist/esm/plugins/reactNativeHMRPlugin.native.js +292 -0
  198. package/dist/esm/plugins/reactNativeHMRPlugin.native.js.map +6 -0
  199. package/dist/esm/utils/bindKeypressInput.js +34 -0
  200. package/dist/esm/utils/bindKeypressInput.js.map +6 -0
  201. package/dist/esm/utils/bindKeypressInput.mjs +31 -0
  202. package/dist/esm/utils/bindKeypressInput.native.js +34 -0
  203. package/dist/esm/utils/bindKeypressInput.native.js.map +6 -0
  204. package/dist/esm/utils/coerceToArray.js +7 -0
  205. package/dist/esm/utils/coerceToArray.js.map +6 -0
  206. package/dist/esm/utils/coerceToArray.mjs +4 -0
  207. package/dist/esm/utils/coerceToArray.native.js +9 -0
  208. package/dist/esm/utils/coerceToArray.native.js.map +6 -0
  209. package/dist/esm/utils/connectedNativeClients.js +13 -0
  210. package/dist/esm/utils/connectedNativeClients.js.map +6 -0
  211. package/dist/esm/utils/connectedNativeClients.mjs +8 -0
  212. package/dist/esm/utils/connectedNativeClients.native.js +13 -0
  213. package/dist/esm/utils/connectedNativeClients.native.js.map +6 -0
  214. package/dist/esm/utils/getIndexJsonResponse.js +55 -0
  215. package/dist/esm/utils/getIndexJsonResponse.js.map +6 -0
  216. package/dist/esm/utils/getIndexJsonResponse.mjs +71 -0
  217. package/dist/esm/utils/getIndexJsonResponse.native.js +78 -0
  218. package/dist/esm/utils/getIndexJsonResponse.native.js.map +6 -0
  219. package/dist/esm/utils/getOptimizeDeps.js +8 -7
  220. package/dist/esm/utils/getOptimizeDeps.js.map +1 -1
  221. package/dist/esm/utils/getOptimizeDeps.mjs +2 -2
  222. package/dist/esm/utils/getOptimizeDeps.native.js +8 -7
  223. package/dist/esm/utils/getOptimizeDeps.native.js.map +1 -1
  224. package/dist/esm/utils/getOptionsFilled.js.map +1 -1
  225. package/dist/esm/utils/getOptionsFilled.native.js.map +1 -1
  226. package/dist/esm/utils/getReactNativeBundle.js +153 -0
  227. package/dist/esm/utils/getReactNativeBundle.js.map +6 -0
  228. package/dist/esm/utils/getReactNativeBundle.mjs +142 -0
  229. package/dist/esm/utils/getReactNativeBundle.native.js +371 -0
  230. package/dist/esm/utils/getReactNativeBundle.native.js.map +6 -0
  231. package/dist/esm/utils/getVitePath.js +2 -2
  232. package/dist/esm/utils/getVitePath.js.map +1 -1
  233. package/dist/esm/utils/getVitePath.mjs +2 -2
  234. package/dist/esm/utils/getVitePath.native.js +8 -8
  235. package/dist/esm/utils/getVitePath.native.js.map +2 -2
  236. package/dist/esm/utils/getViteServerConfig.js +69 -0
  237. package/dist/esm/utils/getViteServerConfig.js.map +6 -0
  238. package/dist/esm/utils/getViteServerConfig.mjs +49 -0
  239. package/dist/esm/utils/getViteServerConfig.native.js +240 -0
  240. package/dist/esm/utils/getViteServerConfig.native.js.map +6 -0
  241. package/dist/esm/utils/hotUpdateCache.js +5 -0
  242. package/dist/esm/utils/hotUpdateCache.js.map +6 -0
  243. package/dist/esm/utils/hotUpdateCache.mjs +2 -0
  244. package/dist/esm/utils/hotUpdateCache.native.js +5 -0
  245. package/dist/esm/utils/hotUpdateCache.native.js.map +6 -0
  246. package/dist/esm/utils/isBuildingNativeBundle.js +9 -0
  247. package/dist/esm/utils/isBuildingNativeBundle.js.map +6 -0
  248. package/dist/esm/utils/isBuildingNativeBundle.mjs +5 -0
  249. package/dist/esm/utils/isBuildingNativeBundle.native.js +10 -0
  250. package/dist/esm/utils/isBuildingNativeBundle.native.js.map +6 -0
  251. package/dist/esm/utils/isWithin.js +9 -0
  252. package/dist/esm/utils/isWithin.js.map +6 -0
  253. package/dist/esm/utils/isWithin.mjs +6 -0
  254. package/dist/esm/utils/isWithin.native.js +9 -0
  255. package/dist/esm/utils/isWithin.native.js.map +6 -0
  256. package/dist/esm/utils/readVXRNConfig.js +16 -19
  257. package/dist/esm/utils/readVXRNConfig.js.map +1 -1
  258. package/dist/esm/utils/readVXRNConfig.mjs +17 -21
  259. package/dist/esm/utils/readVXRNConfig.native.js +105 -50
  260. package/dist/esm/utils/readVXRNConfig.native.js.map +2 -2
  261. package/dist/esm/utils/resolveFile.js +12 -0
  262. package/dist/esm/utils/resolveFile.js.map +6 -0
  263. package/dist/esm/utils/resolveFile.mjs +9 -0
  264. package/dist/esm/utils/resolveFile.native.js +12 -0
  265. package/dist/esm/utils/resolveFile.native.js.map +6 -0
  266. package/dist/esm/utils/swapPrebuiltReactModules.js +89 -0
  267. package/dist/esm/utils/swapPrebuiltReactModules.js.map +6 -0
  268. package/dist/esm/utils/swapPrebuiltReactModules.mjs +75 -0
  269. package/dist/esm/utils/swapPrebuiltReactModules.native.js +248 -0
  270. package/dist/esm/utils/swapPrebuiltReactModules.native.js.map +6 -0
  271. package/dist/esm/utils/uniq.js +7 -0
  272. package/dist/esm/utils/uniq.js.map +6 -0
  273. package/dist/esm/utils/uniq.mjs +4 -0
  274. package/dist/esm/utils/uniq.native.js +38 -0
  275. package/dist/esm/utils/uniq.native.js.map +6 -0
  276. package/package.json +8 -8
  277. package/src/exports/build.ts +46 -183
  278. package/src/exports/dev.ts +18 -646
  279. package/src/exports/serve.ts +4 -0
  280. package/src/index.ts +5 -0
  281. package/src/plugins/reactNativeCommonJsPlugin.ts +0 -2
  282. package/src/plugins/reactNativeHMRPlugin.ts +105 -0
  283. package/src/types.ts +9 -0
  284. package/src/utils/bindKeypressInput.ts +46 -0
  285. package/src/utils/coerceToArray.ts +3 -0
  286. package/src/utils/connectedNativeClients.ts +9 -0
  287. package/src/utils/getIndexJsonResponse.ts +52 -0
  288. package/src/utils/getOptimizeDeps.ts +9 -8
  289. package/src/utils/getOptionsFilled.ts +0 -1
  290. package/src/utils/getReactNativeBundle.ts +228 -0
  291. package/src/utils/getVitePath.ts +3 -3
  292. package/src/utils/getViteServerConfig.ts +104 -0
  293. package/src/utils/hotUpdateCache.ts +1 -0
  294. package/src/utils/isBuildingNativeBundle.ts +7 -0
  295. package/src/utils/isWithin.ts +6 -0
  296. package/src/utils/readVXRNConfig.ts +81 -25
  297. package/src/utils/resolveFile.ts +9 -0
  298. package/src/utils/swapPrebuiltReactModules.ts +126 -0
  299. package/src/utils/uniq.ts +3 -0
  300. package/types/exports/bindKeypressInput.d.ts +2 -0
  301. package/types/exports/coerceToArray.d.ts +2 -0
  302. package/types/exports/connectedNativeClients.d.ts +2 -0
  303. package/types/exports/dev.d.ts +0 -2
  304. package/types/exports/entryRoot.d.ts +11 -0
  305. package/types/exports/getIndexJsonResponse.d.ts +68 -0
  306. package/types/exports/getReactNativeBundle.d.ts +3 -0
  307. package/types/exports/getViteServerConfig.d.ts +4 -0
  308. package/types/exports/hotUpdateCache.d.ts +2 -0
  309. package/types/exports/isBuildingNativeBundle.d.ts +2 -0
  310. package/types/exports/isWithin.d.ts +2 -0
  311. package/types/exports/reactNativeHMRPlugin.d.ts +11 -0
  312. package/types/exports/resolveFile.d.ts +2 -0
  313. package/types/exports/swapPrebuiltReactModules.d.ts +7 -0
  314. package/types/exports/uniq.d.ts +2 -0
  315. package/types/index.d.ts +4 -0
  316. package/types/plugins/reactNativeHMRPlugin.d.ts +10 -0
  317. package/types/types.d.ts +4 -0
  318. package/types/utils/bindKeypressInput.d.ts +2 -0
  319. package/types/utils/coerceToArray.d.ts +2 -0
  320. package/types/utils/connectedNativeClients.d.ts +4 -0
  321. package/types/utils/getIndexJsonResponse.d.ts +68 -0
  322. package/types/utils/getOptionsFilled.d.ts +2 -0
  323. package/types/utils/getReactNativeBundle.d.ts +4 -0
  324. package/types/utils/getViteServerConfig.d.ts +4 -0
  325. package/types/utils/hotUpdateCache.d.ts +2 -0
  326. package/types/utils/isBuildingNativeBundle.d.ts +3 -0
  327. package/types/utils/isWithin.d.ts +2 -0
  328. package/types/utils/resolveFile.d.ts +2 -0
  329. package/types/utils/swapPrebuiltReactModules.d.ts +7 -0
  330. package/types/utils/uniq.d.ts +2 -0
@@ -1,42 +1,35 @@
1
1
  import FSExtra from 'fs-extra'
2
2
  import type { VXRNConfig } from '../types'
3
- import { createServer } from 'vite'
4
- import jiti from 'jiti'
3
+ import { join } from 'node:path'
4
+ import { build } from 'esbuild'
5
5
 
6
6
  export async function readVXRNConfig(): Promise<VXRNConfig> {
7
7
  if (!(await FSExtra.pathExists('vxrn.config.ts'))) {
8
8
  return {}
9
9
  }
10
10
 
11
- if (process.env.VXRN_CJS) {
12
- const requireFile = jiti(process.cwd(), {
13
- esmResolve: true,
14
- })
15
- const userConfig = requireFile('./vxrn.config.ts')
16
- return resolveOptionalAsyncFunction(userConfig?.default ?? {})
17
- }
11
+ const outfile = join(process.cwd(), 'vxrn.config.js')
18
12
 
19
- // try esm load
20
13
  try {
21
- // somewhat hacky creating a server just to read config?
22
- const vite = await createServer({
23
- logLevel: 'silent',
24
- appType: 'custom',
25
- })
26
-
27
- const userConfig = await vite.ssrLoadModule('./vxrn.config.ts', {
28
- fixStacktrace: true,
14
+ // output to same place so paths and relative things work
15
+ await build({
16
+ entryPoints: ['vxrn.config.ts'],
17
+ bundle: false,
18
+ outfile,
19
+ platform: 'node',
20
+ format: 'esm',
21
+ sourcemap: false,
22
+ minify: false,
29
23
  })
30
24
 
31
- await vite.close()
32
- return resolveOptionalAsyncFunction(userConfig?.default ?? {})
33
- } catch (err: any) {
34
- console.info(` [vxrn] Error loading config via ESM:
25
+ const exportedConfig = (await import(outfile)).default
35
26
 
36
- ${err.stack}
37
-
38
- To load as CommonJS, set VXRN_CJS=1`)
27
+ return await resolveOptionalAsyncFunction(exportedConfig)
28
+ } catch (err) {
29
+ console.error(` [vxrn] Error building vxrn.config.ts`)
39
30
  throw err
31
+ } finally {
32
+ FSExtra.removeSync(outfile)
40
33
  }
41
34
  }
42
35
 
@@ -49,3 +42,66 @@ async function resolveOptionalAsyncFunction(value: any) {
49
42
  }
50
43
  return value
51
44
  }
45
+
46
+ // // vite version:
47
+
48
+ // import FSExtra from 'fs-extra'
49
+ // import type { VXRNConfig } from '../types'
50
+ // import { join } from 'node:path'
51
+ // import { build } from 'vite'
52
+
53
+ // export async function readVXRNConfig(): Promise<VXRNConfig> {
54
+ // if (!(await FSExtra.pathExists('vxrn.config.ts'))) {
55
+ // return {}
56
+ // }
57
+
58
+ // const outfile = join(process.cwd(), 'vxrn.config.js')
59
+
60
+ // try {
61
+ // // output to same place so paths and relative things work
62
+ // // build using vite:
63
+ // await build({
64
+ // logLevel: 'silent',
65
+ // build: {
66
+ // lib: {
67
+ // entry: 'vxrn.config.ts',
68
+ // formats: ['es'],
69
+ // fileName: () => 'vxrn.config.js',
70
+ // },
71
+ // rollupOptions: {
72
+ // external: (id) => {
73
+ // if (id.includes('vxrn')) {
74
+ // return false
75
+ // }
76
+ // // exclude node_modules:
77
+ // return !id.startsWith('.') && !id.startsWith('/')
78
+ // },
79
+ // },
80
+ // outDir: process.cwd(),
81
+ // copyPublicDir: false,
82
+ // assetsDir: '',
83
+ // minify: false,
84
+ // emptyOutDir: false,
85
+ // },
86
+ // })
87
+
88
+ // const exportedConfig = (await import(outfile)).default
89
+
90
+ // return await resolveOptionalAsyncFunction(exportedConfig)
91
+ // } catch (err) {
92
+ // console.error(` [vxrn] Error building vxrn.config.ts`)
93
+ // throw err
94
+ // } finally {
95
+ // // FSExtra.removeSync(outfile)
96
+ // }
97
+ // }
98
+
99
+ // async function resolveOptionalAsyncFunction(value: any) {
100
+ // if (typeof value === 'function') {
101
+ // value = value()
102
+ // }
103
+ // if (value instanceof Promise) {
104
+ // value = await value
105
+ // }
106
+ // return value
107
+ // }
@@ -0,0 +1,9 @@
1
+ import { resolve as importMetaResolve } from 'import-meta-resolve'
2
+
3
+ export const resolveFile = (path: string) => {
4
+ try {
5
+ return importMetaResolve(path, import.meta.url).replace('file://', '')
6
+ } catch {
7
+ return require.resolve(path)
8
+ }
9
+ }
@@ -0,0 +1,126 @@
1
+ import { readFile } from 'node:fs/promises'
2
+ import { dirname, join, resolve } from 'node:path'
3
+ import { buildReact, buildReactJSX, buildReactNative } from '@vxrn/react-native-prebuilt'
4
+ import type { PluginOption } from 'vite'
5
+ import { resolveFile } from './resolveFile'
6
+ import FSExtra from 'fs-extra'
7
+ import { isBuildingNativeBundle } from './isBuildingNativeBundle'
8
+
9
+ // we should just detect or whitelist and use flow to convert instead of this but i did a
10
+ // few things to the prebuilts to make them work, we may need to account for
11
+
12
+ export async function swapPrebuiltReactModules(cacheDir: string) {
13
+ const prebuilds = {
14
+ reactJSX: join(cacheDir, 'react-jsx-runtime.js'),
15
+ react: join(cacheDir, 'react.js'),
16
+ reactNative: join(cacheDir, 'react-native.js'),
17
+ }
18
+
19
+ if (!(await FSExtra.pathExists(prebuilds.reactNative))) {
20
+ console.info('Pre-building react, react-native react/jsx-runtime (one time cost)...')
21
+ await Promise.all([
22
+ buildReactNative({
23
+ entryPoints: [resolveFile('react-native')],
24
+ outfile: prebuilds.reactNative,
25
+ }),
26
+ buildReact({
27
+ entryPoints: [resolveFile('react')],
28
+ outfile: prebuilds.react,
29
+ }),
30
+ buildReactJSX({
31
+ entryPoints: [resolveFile('react/jsx-dev-runtime')],
32
+ outfile: prebuilds.reactJSX,
33
+ }),
34
+ ])
35
+ }
36
+
37
+ // react native port (it scans 19000 +5)
38
+ const jsxRuntime = {
39
+ // alias: 'virtual:react-jsx',
40
+ alias: prebuilds.reactJSX,
41
+ contents: await readFile(prebuilds.reactJSX, 'utf-8'),
42
+ } as const
43
+
44
+ const virtualModules = {
45
+ 'react-native': {
46
+ // alias: 'virtual:react-native',
47
+ alias: prebuilds.reactNative,
48
+ contents: await readFile(prebuilds.reactNative, 'utf-8'),
49
+ },
50
+ react: {
51
+ // alias: 'virtual:react',
52
+ alias: prebuilds.react,
53
+ contents: await readFile(prebuilds.react, 'utf-8'),
54
+ },
55
+ 'react/jsx-runtime': jsxRuntime,
56
+ 'react/jsx-dev-runtime': jsxRuntime,
57
+ } as const
58
+
59
+ return {
60
+ name: `swap-react-native`,
61
+ enforce: 'pre',
62
+
63
+ resolveId(id, importer = '') {
64
+ if (id.startsWith('react-native/Libraries')) {
65
+ return `virtual:rn-internals:${id}`
66
+ }
67
+
68
+ // this will break web support, we need a way to somehow switch between?
69
+ if (id === 'react-native-web') {
70
+ return prebuilds.reactNative
71
+ }
72
+
73
+ for (const targetId in virtualModules) {
74
+ if (id === targetId || id.includes(`node_modules/${targetId}/`)) {
75
+ const info = virtualModules[targetId]
76
+
77
+ return info.alias
78
+ }
79
+ }
80
+
81
+ // TODO this is terrible and slow, we should be able to get extensions working:
82
+ // having trouble getting .native.js to be picked up via vite
83
+ // tried adding packages to optimizeDeps, tried resolveExtensions + extensions...
84
+ // tried this but seems to not be called for node_modules
85
+ if (isBuildingNativeBundle) {
86
+ if (id[0] === '.') {
87
+ const absolutePath = resolve(dirname(importer), id)
88
+ const nativePath = absolutePath.replace(/(.m?js)/, '.native.js')
89
+ if (nativePath === id) return
90
+ try {
91
+ const directoryPath = absolutePath + '/index.native.js'
92
+ const directoryNonNativePath = absolutePath + '/index.js'
93
+ if (FSExtra.pathExistsSync(directoryPath)) {
94
+ return directoryPath
95
+ }
96
+ if (FSExtra.pathExistsSync(directoryNonNativePath)) {
97
+ return directoryNonNativePath
98
+ }
99
+ if (FSExtra.pathExistsSync(nativePath)) {
100
+ return nativePath
101
+ }
102
+ } catch (err) {
103
+ console.warn(`error probably fine`, err)
104
+ }
105
+ }
106
+ }
107
+ },
108
+
109
+ load(id) {
110
+ if (id.startsWith('virtual:rn-internals')) {
111
+ const idOut = id.replace('virtual:rn-internals:', '')
112
+ let out = `const ___val = __cachedModules["${idOut}"]
113
+ const ___defaultVal = ___val ? ___val.default || ___val : ___val
114
+ export default ___defaultVal`
115
+ return out
116
+ }
117
+
118
+ for (const targetId in virtualModules) {
119
+ const info = virtualModules[targetId as keyof typeof virtualModules]
120
+ if (id === info.alias) {
121
+ return info.contents
122
+ }
123
+ }
124
+ },
125
+ } satisfies PluginOption
126
+ }
@@ -0,0 +1,3 @@
1
+ export function uniq(a: any[]) {
2
+ return [...new Set(a)]
3
+ }
@@ -0,0 +1,2 @@
1
+ export declare function bindKeypressInput(): void;
2
+ //# sourceMappingURL=bindKeypressInput.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare function coerceToArray<A>(thing: A | A[]): A[];
2
+ //# sourceMappingURL=coerceToArray.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare let connectedNativeClients: number;
2
+ //# sourceMappingURL=connectedNativeClients.d.ts.map
@@ -1,6 +1,5 @@
1
1
  /// <reference types="node" />
2
2
  import type { VXRNConfig } from '../types';
3
- export declare const resolveFile: (path: string) => string;
4
3
  export declare const dev: ({ clean, ...rest }: VXRNConfig & {
5
4
  clean?: boolean;
6
5
  }) => Promise<{
@@ -11,5 +10,4 @@ export declare const dev: ({ clean, ...rest }: VXRNConfig & {
11
10
  }>;
12
11
  stop: () => Promise<void>;
13
12
  }>;
14
- export declare function bindKeypressInput(): void;
15
13
  //# sourceMappingURL=dev.d.ts.map
@@ -0,0 +1,11 @@
1
+ import type { VXRNConfigFilled } from '../utils/getOptionsFilled';
2
+ export declare let entryRoot: string;
3
+ export declare function reactNativeHMRPlugin({ root }: VXRNConfigFilled): {
4
+ name: string;
5
+ handleHotUpdate({ read, modules, file }: {
6
+ read: any;
7
+ modules: any;
8
+ file: any;
9
+ }): Promise<void>;
10
+ };
11
+ //# sourceMappingURL=entryRoot.d.ts.map
@@ -0,0 +1,68 @@
1
+ export declare function getIndexJsonResponse({ port, root }: {
2
+ port: number | string;
3
+ root: any;
4
+ }): {
5
+ name: string;
6
+ slug: string;
7
+ scheme: string;
8
+ version: string;
9
+ jsEngine: string;
10
+ orientation: string;
11
+ icon: string;
12
+ userInterfaceStyle: string;
13
+ splash: {
14
+ image: string;
15
+ resizeMode: string;
16
+ backgroundColor: string;
17
+ imageUrl: string;
18
+ };
19
+ updates: {
20
+ fallbackToCacheTimeout: number;
21
+ };
22
+ assetBundlePatterns: string[];
23
+ ios: {
24
+ supportsTablet: boolean;
25
+ bundleIdentifier: string;
26
+ };
27
+ android: {
28
+ package: string;
29
+ adaptiveIcon: {
30
+ foregroundImage: string;
31
+ backgroundColor: string;
32
+ foregroundImageUrl: string;
33
+ };
34
+ };
35
+ web: {
36
+ favicon: string;
37
+ };
38
+ extra: {
39
+ eas: {
40
+ projectId: string;
41
+ };
42
+ };
43
+ _internal: {
44
+ isDebug: boolean;
45
+ projectRoot: any;
46
+ dynamicConfigPath: null;
47
+ staticConfigPath: string;
48
+ packageJsonPath: string;
49
+ };
50
+ sdkVersion: string;
51
+ platforms: string[];
52
+ iconUrl: string;
53
+ debuggerHost: string;
54
+ logUrl: string;
55
+ developer: {
56
+ tool: string;
57
+ projectRoot: any;
58
+ };
59
+ packagerOpts: {
60
+ dev: boolean;
61
+ };
62
+ mainModuleName: string;
63
+ __flipperHack: string;
64
+ hostUri: string;
65
+ bundleUrl: string;
66
+ id: string;
67
+ };
68
+ //# sourceMappingURL=getIndexJsonResponse.d.ts.map
@@ -0,0 +1,3 @@
1
+ import { type VXRNConfigFilled } from '../utils/getOptionsFilled';
2
+ export declare function getReactNativeBundle(options: VXRNConfigFilled, viteRNClientPlugin: any): Promise<string>;
3
+ //# sourceMappingURL=getReactNativeBundle.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { type UserConfig } from 'vite';
2
+ import { type VXRNConfigFilled } from '../utils/getOptionsFilled';
3
+ export declare function getViteServerConfig(config: VXRNConfigFilled): Promise<UserConfig>;
4
+ //# sourceMappingURL=getViteServerConfig.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare const hotUpdateCache: Map<string, string>;
2
+ //# sourceMappingURL=hotUpdateCache.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare let isBuildingNativeBundle: Promise<string> | null;
2
+ //# sourceMappingURL=isBuildingNativeBundle.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare function isWithin(outer: string, inner: string): boolean;
2
+ //# sourceMappingURL=isWithin.d.ts.map
@@ -0,0 +1,11 @@
1
+ import type { VXRNConfigFilled } from '../utils/getOptionsFilled';
2
+ export declare let entryRoot: string;
3
+ export declare function reactNativeHMRPlugin({ root }: VXRNConfigFilled): {
4
+ name: string;
5
+ handleHotUpdate({ read, modules, file }: {
6
+ read: any;
7
+ modules: any;
8
+ file: any;
9
+ }): Promise<void>;
10
+ };
11
+ //# sourceMappingURL=reactNativeHMRPlugin.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare const resolveFile: (path: string) => string;
2
+ //# sourceMappingURL=resolveFile.d.ts.map
@@ -0,0 +1,7 @@
1
+ export declare function swapPrebuiltReactModules(cacheDir: string): Promise<{
2
+ name: string;
3
+ enforce: "pre";
4
+ resolveId(this: import("rollup").PluginContext, id: string, importer?: string | undefined): any;
5
+ load(this: import("rollup").PluginContext, id: string): string | undefined;
6
+ }>;
7
+ //# sourceMappingURL=swapPrebuiltReactModules.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare function uniq(a: any[]): any[];
2
+ //# sourceMappingURL=uniq.d.ts.map
package/types/index.d.ts CHANGED
@@ -1,4 +1,8 @@
1
1
  export { build } from './exports/build';
2
2
  export { dev } from './exports/dev';
3
+ export * from './utils/getHtml';
4
+ export * from './utils/getOptionsFilled';
5
+ export * from './utils/getOptimizeDeps';
6
+ export * from './utils/getBaseViteConfig';
3
7
  export * from './types';
4
8
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,10 @@
1
+ import type { VXRNConfigFilled } from '../utils/getOptionsFilled';
2
+ export declare function reactNativeHMRPlugin({ root }: VXRNConfigFilled): {
3
+ name: string;
4
+ handleHotUpdate({ read, modules, file }: {
5
+ read: any;
6
+ modules: any;
7
+ file: any;
8
+ }): Promise<void>;
9
+ };
10
+ //# sourceMappingURL=reactNativeHMRPlugin.d.ts.map
package/types/types.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import type { Options as FlowOptions } from '@vxrn/vite-flow';
2
+ import type { App } from 'h3';
3
+ import type { OutputAsset, OutputChunk } from 'rollup';
2
4
  import type { InlineConfig } from 'vite';
3
5
  export type VXRNConfig = {
4
6
  /**
@@ -18,6 +20,8 @@ export type VXRNConfig = {
18
20
  webConfig?: InlineConfig;
19
21
  nativeConfig?: InlineConfig;
20
22
  flow?: FlowOptions;
23
+ afterBuild?: (options: VXRNConfig, output: [OutputChunk, ...(OutputChunk | OutputAsset)[]]) => void | Promise<void>;
24
+ serve?: (options: VXRNConfig, app: App) => void;
21
25
  };
22
26
  export type HMRListener = (update: {
23
27
  file: string;
@@ -0,0 +1,2 @@
1
+ export declare function bindKeypressInput(): void;
2
+ //# sourceMappingURL=bindKeypressInput.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare function coerceToArray<A>(thing: A | A[]): A[];
2
+ //# sourceMappingURL=coerceToArray.d.ts.map
@@ -0,0 +1,4 @@
1
+ export declare let connectedNativeClients: number;
2
+ export declare function addConnectedNativeClient(): void;
3
+ export declare function removeConnectedNativeClient(): void;
4
+ //# sourceMappingURL=connectedNativeClients.d.ts.map
@@ -0,0 +1,68 @@
1
+ export declare function getIndexJsonResponse({ port, root }: {
2
+ port: number | string;
3
+ root: any;
4
+ }): {
5
+ name: string;
6
+ slug: string;
7
+ scheme: string;
8
+ version: string;
9
+ jsEngine: string;
10
+ orientation: string;
11
+ icon: string;
12
+ userInterfaceStyle: string;
13
+ splash: {
14
+ image: string;
15
+ resizeMode: string;
16
+ backgroundColor: string;
17
+ imageUrl: string;
18
+ };
19
+ updates: {
20
+ fallbackToCacheTimeout: number;
21
+ };
22
+ assetBundlePatterns: string[];
23
+ ios: {
24
+ supportsTablet: boolean;
25
+ bundleIdentifier: string;
26
+ };
27
+ android: {
28
+ package: string;
29
+ adaptiveIcon: {
30
+ foregroundImage: string;
31
+ backgroundColor: string;
32
+ foregroundImageUrl: string;
33
+ };
34
+ };
35
+ web: {
36
+ favicon: string;
37
+ };
38
+ extra: {
39
+ eas: {
40
+ projectId: string;
41
+ };
42
+ };
43
+ _internal: {
44
+ isDebug: boolean;
45
+ projectRoot: any;
46
+ dynamicConfigPath: null;
47
+ staticConfigPath: string;
48
+ packageJsonPath: string;
49
+ };
50
+ sdkVersion: string;
51
+ platforms: string[];
52
+ iconUrl: string;
53
+ debuggerHost: string;
54
+ logUrl: string;
55
+ developer: {
56
+ tool: string;
57
+ projectRoot: any;
58
+ };
59
+ packagerOpts: {
60
+ dev: boolean;
61
+ };
62
+ mainModuleName: string;
63
+ __flipperHack: string;
64
+ hostUri: string;
65
+ bundleUrl: string;
66
+ id: string;
67
+ };
68
+ //# sourceMappingURL=getIndexJsonResponse.d.ts.map
@@ -17,6 +17,8 @@ export declare function getOptionsFilled(options: VXRNConfig): Promise<{
17
17
  webConfig?: import("vite").InlineConfig | undefined;
18
18
  nativeConfig?: import("vite").InlineConfig | undefined;
19
19
  flow?: import("@vxrn/vite-flow").Options | undefined;
20
+ afterBuild?: ((options: VXRNConfig, output: [import("rollup").OutputChunk, ...(import("rollup").OutputChunk | import("rollup").OutputAsset)[]]) => void | Promise<void>) | undefined;
21
+ serve?: ((options: VXRNConfig, app: import("h3").App) => void) | undefined;
20
22
  }>;
21
23
  type State = {
22
24
  applyPatches?: boolean;
@@ -0,0 +1,4 @@
1
+ import type { VXRNConfigFilled } from './getOptionsFilled';
2
+ export declare let entryRoot: string;
3
+ export declare function getReactNativeBundle(options: VXRNConfigFilled, viteRNClientPlugin: any): Promise<string>;
4
+ //# sourceMappingURL=getReactNativeBundle.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { type UserConfig } from 'vite';
2
+ import type { VXRNConfigFilled } from './getOptionsFilled';
3
+ export declare function getViteServerConfig(config: VXRNConfigFilled): Promise<UserConfig>;
4
+ //# sourceMappingURL=getViteServerConfig.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare const hotUpdateCache: Map<string, string>;
2
+ //# sourceMappingURL=hotUpdateCache.d.ts.map
@@ -0,0 +1,3 @@
1
+ export declare let isBuildingNativeBundle: Promise<string> | null;
2
+ export declare function setIsBuildingNativeBundle(val?: Promise<string> | null): void;
3
+ //# sourceMappingURL=isBuildingNativeBundle.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare function isWithin(outer: string, inner: string): boolean;
2
+ //# sourceMappingURL=isWithin.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare const resolveFile: (path: string) => string;
2
+ //# sourceMappingURL=resolveFile.d.ts.map
@@ -0,0 +1,7 @@
1
+ export declare function swapPrebuiltReactModules(cacheDir: string): Promise<{
2
+ name: string;
3
+ enforce: "pre";
4
+ resolveId(this: import("rollup").PluginContext, id: string, importer?: string | undefined): any;
5
+ load(this: import("rollup").PluginContext, id: string): string | undefined;
6
+ }>;
7
+ //# sourceMappingURL=swapPrebuiltReactModules.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare function uniq(a: any[]): any[];
2
+ //# sourceMappingURL=uniq.d.ts.map