vxrn 1.14.4 → 1.14.5

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