vxrn 0.1.20 → 0.1.21

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 (173) hide show
  1. package/dist/cjs/cli.js +77 -3
  2. package/dist/cjs/cli.js.map +2 -2
  3. package/dist/cjs/cli.native.js +268 -2
  4. package/dist/cjs/cli.native.js.map +2 -2
  5. package/dist/cjs/constants.js +21 -0
  6. package/dist/cjs/constants.js.map +6 -0
  7. package/dist/cjs/constants.native.js +26 -0
  8. package/dist/cjs/constants.native.js.map +6 -0
  9. package/dist/cjs/dispose.js +28 -0
  10. package/dist/cjs/dispose.js.map +6 -0
  11. package/dist/cjs/dispose.native.js +36 -0
  12. package/dist/cjs/dispose.native.js.map +6 -0
  13. package/dist/cjs/exports/build.js +145 -0
  14. package/dist/cjs/exports/build.js.map +6 -0
  15. package/dist/cjs/exports/build.native.js +409 -0
  16. package/dist/cjs/exports/build.native.js.map +6 -0
  17. package/dist/cjs/exports/checkPatches.js +62 -0
  18. package/dist/cjs/exports/checkPatches.js.map +6 -0
  19. package/dist/cjs/exports/checkPatches.native.js +289 -0
  20. package/dist/cjs/exports/checkPatches.native.js.map +6 -0
  21. package/dist/cjs/exports/dev.js +568 -0
  22. package/dist/cjs/exports/dev.js.map +6 -0
  23. package/dist/cjs/exports/dev.native.js +1111 -0
  24. package/dist/cjs/exports/dev.native.js.map +6 -0
  25. package/dist/cjs/exports/serve.js +55 -0
  26. package/dist/cjs/exports/serve.js.map +6 -0
  27. package/dist/cjs/exports/serve.native.js +236 -0
  28. package/dist/cjs/exports/serve.native.js.map +6 -0
  29. package/dist/cjs/index.js +2 -3
  30. package/dist/cjs/index.js.map +1 -1
  31. package/dist/cjs/index.native.js +3 -5
  32. package/dist/cjs/index.native.js.map +1 -1
  33. package/dist/cjs/plugins/clientInjectPlugin.js +66 -0
  34. package/dist/cjs/plugins/clientInjectPlugin.js.map +6 -0
  35. package/dist/cjs/plugins/clientInjectPlugin.native.js +190 -0
  36. package/dist/cjs/plugins/clientInjectPlugin.native.js.map +6 -0
  37. package/dist/cjs/plugins/reactNativeCommonJsPlugin.js +89 -0
  38. package/dist/cjs/plugins/reactNativeCommonJsPlugin.js.map +6 -0
  39. package/dist/cjs/plugins/reactNativeCommonJsPlugin.native.js +346 -0
  40. package/dist/cjs/plugins/reactNativeCommonJsPlugin.native.js.map +6 -0
  41. package/dist/cjs/utils/checkPatches.js +62 -0
  42. package/dist/cjs/utils/checkPatches.js.map +6 -0
  43. package/dist/cjs/utils/checkPatches.native.js +289 -0
  44. package/dist/cjs/utils/checkPatches.native.js.map +6 -0
  45. package/dist/cjs/utils/dispose.js +28 -0
  46. package/dist/cjs/utils/dispose.js.map +6 -0
  47. package/dist/cjs/utils/dispose.native.js +36 -0
  48. package/dist/cjs/utils/dispose.native.js.map +6 -0
  49. package/dist/cjs/utils/getBaseViteConfig.js +2 -2
  50. package/dist/cjs/utils/getBaseViteConfig.js.map +1 -1
  51. package/dist/cjs/utils/getBaseViteConfig.native.js +2 -2
  52. package/dist/cjs/utils/getBaseViteConfig.native.js.map +1 -1
  53. package/dist/cjs/utils/patches.js +62 -0
  54. package/dist/cjs/utils/patches.js.map +6 -0
  55. package/dist/cjs/utils/patches.native.js +289 -0
  56. package/dist/cjs/utils/patches.native.js.map +6 -0
  57. package/dist/cjs/utils/prerender.js +1 -0
  58. package/dist/cjs/utils/prerender.js.map +6 -0
  59. package/dist/cjs/utils/prerender.native.js +2 -0
  60. package/dist/cjs/utils/prerender.native.js.map +6 -0
  61. package/dist/cjs/vendor/createExpoServer.js +34 -0
  62. package/dist/cjs/vendor/createExpoServer.js.map +6 -0
  63. package/dist/cjs/vendor/createExpoServer.native.js +42 -0
  64. package/dist/cjs/vendor/createExpoServer.native.js.map +6 -0
  65. package/dist/esm/cli.js +58 -3
  66. package/dist/esm/cli.js.map +2 -2
  67. package/dist/esm/cli.mjs +81 -9
  68. package/dist/esm/cli.native.js +249 -3
  69. package/dist/esm/cli.native.js.map +2 -2
  70. package/dist/esm/constants.js +5 -0
  71. package/dist/esm/constants.js.map +6 -0
  72. package/dist/esm/constants.mjs +2 -0
  73. package/dist/esm/constants.native.js +5 -0
  74. package/dist/esm/constants.native.js.map +6 -0
  75. package/dist/esm/dispose.js +12 -0
  76. package/dist/esm/dispose.js.map +6 -0
  77. package/dist/esm/dispose.mjs +8 -0
  78. package/dist/esm/dispose.native.js +14 -0
  79. package/dist/esm/dispose.native.js.map +6 -0
  80. package/dist/esm/exports/build.js +128 -0
  81. package/dist/esm/exports/build.js.map +6 -0
  82. package/dist/esm/exports/build.mjs +119 -0
  83. package/dist/esm/exports/build.native.js +385 -0
  84. package/dist/esm/exports/build.native.js.map +6 -0
  85. package/dist/esm/exports/checkPatches.js +40 -0
  86. package/dist/esm/exports/checkPatches.js.map +6 -0
  87. package/dist/esm/exports/checkPatches.mjs +31 -0
  88. package/dist/esm/exports/checkPatches.native.js +262 -0
  89. package/dist/esm/exports/checkPatches.native.js.map +6 -0
  90. package/dist/esm/exports/dev.js +581 -0
  91. package/dist/esm/exports/dev.js.map +6 -0
  92. package/dist/esm/exports/dev.mjs +543 -0
  93. package/dist/esm/exports/dev.native.js +1102 -0
  94. package/dist/esm/exports/dev.native.js.map +6 -0
  95. package/dist/esm/exports/serve.js +33 -0
  96. package/dist/esm/exports/serve.js.map +6 -0
  97. package/dist/esm/exports/serve.mjs +38 -0
  98. package/dist/esm/exports/serve.native.js +209 -0
  99. package/dist/esm/exports/serve.native.js.map +6 -0
  100. package/dist/esm/index.js +3 -5
  101. package/dist/esm/index.js.map +1 -1
  102. package/dist/esm/index.mjs +3 -4
  103. package/dist/esm/index.native.js +3 -5
  104. package/dist/esm/index.native.js.map +2 -2
  105. package/dist/esm/plugins/clientInjectPlugin.js +42 -0
  106. package/dist/esm/plugins/clientInjectPlugin.js.map +6 -0
  107. package/dist/esm/plugins/clientInjectPlugin.mjs +56 -0
  108. package/dist/esm/plugins/clientInjectPlugin.native.js +161 -0
  109. package/dist/esm/plugins/clientInjectPlugin.native.js.map +6 -0
  110. package/dist/esm/plugins/reactNativeCommonJsPlugin.js +75 -0
  111. package/dist/esm/plugins/reactNativeCommonJsPlugin.js.map +6 -0
  112. package/dist/esm/plugins/reactNativeCommonJsPlugin.mjs +55 -0
  113. package/dist/esm/plugins/reactNativeCommonJsPlugin.native.js +327 -0
  114. package/dist/esm/plugins/reactNativeCommonJsPlugin.native.js.map +6 -0
  115. package/dist/esm/utils/checkPatches.js +40 -0
  116. package/dist/esm/utils/checkPatches.js.map +6 -0
  117. package/dist/esm/utils/checkPatches.mjs +31 -0
  118. package/dist/esm/utils/checkPatches.native.js +262 -0
  119. package/dist/esm/utils/checkPatches.native.js.map +6 -0
  120. package/dist/esm/utils/dispose.js +12 -0
  121. package/dist/esm/utils/dispose.js.map +6 -0
  122. package/dist/esm/utils/dispose.mjs +8 -0
  123. package/dist/esm/utils/dispose.native.js +14 -0
  124. package/dist/esm/utils/dispose.native.js.map +6 -0
  125. package/dist/esm/utils/getBaseViteConfig.js +1 -1
  126. package/dist/esm/utils/getBaseViteConfig.mjs +1 -1
  127. package/dist/esm/utils/getBaseViteConfig.native.js +1 -1
  128. package/dist/esm/utils/patches.js +40 -0
  129. package/dist/esm/utils/patches.js.map +6 -0
  130. package/dist/esm/utils/patches.mjs +31 -0
  131. package/dist/esm/utils/patches.native.js +262 -0
  132. package/dist/esm/utils/patches.native.js.map +6 -0
  133. package/dist/esm/utils/prerender.js +1 -0
  134. package/dist/esm/utils/prerender.js.map +6 -0
  135. package/dist/esm/utils/prerender.mjs +0 -0
  136. package/dist/esm/utils/prerender.native.js +1 -0
  137. package/dist/esm/utils/prerender.native.js.map +6 -0
  138. package/dist/esm/vendor/createExpoServer.js +20 -0
  139. package/dist/esm/vendor/createExpoServer.js.map +6 -0
  140. package/dist/esm/vendor/createExpoServer.mjs +17 -0
  141. package/dist/esm/vendor/createExpoServer.native.js +22 -0
  142. package/dist/esm/vendor/createExpoServer.native.js.map +6 -0
  143. package/package.json +8 -7
  144. package/src/cli.ts +78 -2
  145. package/src/{build.ts → exports/build.ts} +5 -4
  146. package/src/{createDevServer.ts → exports/dev.ts} +13 -63
  147. package/src/exports/serve.ts +51 -0
  148. package/src/index.ts +3 -3
  149. package/src/{dev → plugins}/clientInjectPlugin.ts +1 -12
  150. package/src/{nativePlugin.ts → plugins/reactNativeCommonJsPlugin.ts} +3 -26
  151. package/src/utils/getBaseViteConfig.ts +1 -1
  152. package/src/utils/patches.ts +54 -0
  153. package/types/build.d.ts +4 -4
  154. package/types/constants.d.ts +2 -0
  155. package/types/dispose.d.ts +3 -0
  156. package/types/exports/build.d.ts +4 -0
  157. package/types/exports/dev.d.ts +13 -0
  158. package/types/exports/serve.d.ts +3 -0
  159. package/types/index.d.ts +2 -3
  160. package/types/plugins/clientInjectPlugin.d.ts +7 -0
  161. package/types/plugins/reactNativeCommonJsPlugin.d.ts +7 -0
  162. package/types/utils/checkPatches.d.ts +3 -0
  163. package/types/utils/dispose.d.ts +3 -0
  164. package/types/utils/patches.d.ts +3 -0
  165. package/types/utils/prerender.d.ts +1 -0
  166. package/types/vendor/createExpoServer.d.ts +4 -0
  167. package/src/commands/cli-build.ts +0 -25
  168. package/src/commands/cli-dev.ts +0 -47
  169. package/src/commands/index.ts +0 -10
  170. package/src/dev/createDevServer.ts +0 -234
  171. /package/src/{utils/constants.ts → constants.ts} +0 -0
  172. /package/src/{utils.ts → utils/dispose.ts} +0 -0
  173. /package/src/{createExpoServer.ts → vendor/createExpoServer.ts} +0 -0
@@ -0,0 +1,262 @@
1
+ import findNodeModules from "find-node-modules";
2
+ import { join } from "node:path";
3
+ import FSExtra from "fs-extra";
4
+ function _array_like_to_array(arr, len) {
5
+ (len == null || len > arr.length) && (len = arr.length);
6
+ for (var i = 0, arr2 = new Array(len); i < len; i++)
7
+ arr2[i] = arr[i];
8
+ return arr2;
9
+ }
10
+ function _array_without_holes(arr) {
11
+ if (Array.isArray(arr))
12
+ return _array_like_to_array(arr);
13
+ }
14
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
15
+ try {
16
+ var info = gen[key](arg), value = info.value;
17
+ } catch (error) {
18
+ reject(error);
19
+ return;
20
+ }
21
+ info.done ? resolve(value) : Promise.resolve(value).then(_next, _throw);
22
+ }
23
+ function _async_to_generator(fn) {
24
+ return function() {
25
+ var self = this, args = arguments;
26
+ return new Promise(function(resolve, reject) {
27
+ var gen = fn.apply(self, args);
28
+ function _next(value) {
29
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
30
+ }
31
+ function _throw(err) {
32
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
33
+ }
34
+ _next(void 0);
35
+ });
36
+ };
37
+ }
38
+ function _iterable_to_array(iter) {
39
+ if (typeof Symbol < "u" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
40
+ return Array.from(iter);
41
+ }
42
+ function _non_iterable_spread() {
43
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
44
+ }
45
+ function _to_consumable_array(arr) {
46
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
47
+ }
48
+ function _unsupported_iterable_to_array(o, minLen) {
49
+ if (o) {
50
+ if (typeof o == "string")
51
+ return _array_like_to_array(o, minLen);
52
+ var n = Object.prototype.toString.call(o).slice(8, -1);
53
+ if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set")
54
+ return Array.from(n);
55
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
56
+ return _array_like_to_array(o, minLen);
57
+ }
58
+ }
59
+ function _ts_generator(thisArg, body) {
60
+ var f, y, t, g, _ = {
61
+ label: 0,
62
+ sent: function() {
63
+ if (t[0] & 1)
64
+ throw t[1];
65
+ return t[1];
66
+ },
67
+ trys: [],
68
+ ops: []
69
+ };
70
+ return g = {
71
+ next: verb(0),
72
+ throw: verb(1),
73
+ return: verb(2)
74
+ }, typeof Symbol == "function" && (g[Symbol.iterator] = function() {
75
+ return this;
76
+ }), g;
77
+ function verb(n) {
78
+ return function(v) {
79
+ return step([
80
+ n,
81
+ v
82
+ ]);
83
+ };
84
+ }
85
+ function step(op) {
86
+ if (f)
87
+ throw new TypeError("Generator is already executing.");
88
+ for (; _; )
89
+ try {
90
+ if (f = 1, y && (t = op[0] & 2 ? y.return : op[0] ? y.throw || ((t = y.return) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
91
+ return t;
92
+ switch (y = 0, t && (op = [
93
+ op[0] & 2,
94
+ t.value
95
+ ]), op[0]) {
96
+ case 0:
97
+ case 1:
98
+ t = op;
99
+ break;
100
+ case 4:
101
+ return _.label++, {
102
+ value: op[1],
103
+ done: !1
104
+ };
105
+ case 5:
106
+ _.label++, y = op[1], op = [
107
+ 0
108
+ ];
109
+ continue;
110
+ case 7:
111
+ op = _.ops.pop(), _.trys.pop();
112
+ continue;
113
+ default:
114
+ if (t = _.trys, !(t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
115
+ _ = 0;
116
+ continue;
117
+ }
118
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
119
+ _.label = op[1];
120
+ break;
121
+ }
122
+ if (op[0] === 6 && _.label < t[1]) {
123
+ _.label = t[1], t = op;
124
+ break;
125
+ }
126
+ if (t && _.label < t[2]) {
127
+ _.label = t[2], _.ops.push(op);
128
+ break;
129
+ }
130
+ t[2] && _.ops.pop(), _.trys.pop();
131
+ continue;
132
+ }
133
+ op = body.call(thisArg, _);
134
+ } catch (e) {
135
+ op = [
136
+ 6,
137
+ e
138
+ ], y = 0;
139
+ } finally {
140
+ f = t = 0;
141
+ }
142
+ if (op[0] & 5)
143
+ throw op[1];
144
+ return {
145
+ value: op[0] ? op[1] : void 0,
146
+ done: !0
147
+ };
148
+ }
149
+ }
150
+ var patches = [
151
+ {
152
+ module: "react-native-screens",
153
+ patchFile: "react-native-screens+3.22.1.patch"
154
+ }
155
+ ];
156
+ function checkPatches(options) {
157
+ return _checkPatches.apply(this, arguments);
158
+ }
159
+ function _checkPatches() {
160
+ return _checkPatches = _async_to_generator(function(options) {
161
+ var nodeModulesDirs, patchesToCopy, didCopy, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, patch, dest, src, err;
162
+ return _ts_generator(this, function(_state) {
163
+ switch (_state.label) {
164
+ case 0:
165
+ return options.state.applyPatches === !1 ? [
166
+ 2
167
+ ] : (nodeModulesDirs = findNodeModules({
168
+ cwd: options.root
169
+ }).map(function(relativePath) {
170
+ return join(options.root, relativePath);
171
+ }), patchesToCopy = /* @__PURE__ */ new Set(), [
172
+ 4,
173
+ Promise.all(patches.flatMap(function(patch2) {
174
+ return nodeModulesDirs.flatMap(function() {
175
+ var _ref = _async_to_generator(function(dir) {
176
+ return _ts_generator(this, function(_state2) {
177
+ switch (_state2.label) {
178
+ case 0:
179
+ return [
180
+ 4,
181
+ FSExtra.pathExists(join(dir, patch2.module))
182
+ ];
183
+ case 1:
184
+ return _state2.sent() && patchesToCopy.add(patch2), [
185
+ 2
186
+ ];
187
+ }
188
+ });
189
+ });
190
+ return function(dir) {
191
+ return _ref.apply(this, arguments);
192
+ };
193
+ }());
194
+ }))
195
+ ]);
196
+ case 1:
197
+ _state.sent(), didCopy = !1, _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0, _state.label = 2;
198
+ case 2:
199
+ _state.trys.push([
200
+ 2,
201
+ 8,
202
+ 9,
203
+ 10
204
+ ]), _iterator = _to_consumable_array(patchesToCopy)[Symbol.iterator](), _state.label = 3;
205
+ case 3:
206
+ return (_iteratorNormalCompletion = (_step = _iterator.next()).done) ? [
207
+ 3,
208
+ 7
209
+ ] : (patch = _step.value, dest = join(options.userPatchesDir, patch.patchFile), [
210
+ 4,
211
+ FSExtra.pathExists(dest)
212
+ ]);
213
+ case 4:
214
+ return _state.sent() ? [
215
+ 3,
216
+ 6
217
+ ] : (didCopy = !0, console.info("Copying patch ".concat(patch.module)), src = join(options.internalPatchesDir, patch.patchFile), [
218
+ 4,
219
+ FSExtra.copy(src, dest)
220
+ ]);
221
+ case 5:
222
+ _state.sent(), _state.label = 6;
223
+ case 6:
224
+ return _iteratorNormalCompletion = !0, [
225
+ 3,
226
+ 3
227
+ ];
228
+ case 7:
229
+ return [
230
+ 3,
231
+ 10
232
+ ];
233
+ case 8:
234
+ return err = _state.sent(), _didIteratorError = !0, _iteratorError = err, [
235
+ 3,
236
+ 10
237
+ ];
238
+ case 9:
239
+ try {
240
+ !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
241
+ } finally {
242
+ if (_didIteratorError)
243
+ throw _iteratorError;
244
+ }
245
+ return [
246
+ 7
247
+ ];
248
+ case 10:
249
+ return didCopy && (console.info(`
250
+ Please restart after applying the patch by running "npx patch-package".
251
+ Ideally add it to your devDependencies and as a postinstall script.
252
+ `), process.exit(0)), [
253
+ 2
254
+ ];
255
+ }
256
+ });
257
+ }), _checkPatches.apply(this, arguments);
258
+ }
259
+ export {
260
+ checkPatches
261
+ };
262
+ //# sourceMappingURL=patches.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/utils/Users/n8/vxrn/packages/vxrn/src/utils/patches.ts"],
4
+ "mappings": "AAAA,OAAOA,qBAAqB;AAC5B,SAASC,YAAY;AACrB,OAAOC,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGpB,IAAMC,UAAU;EACd;IACEC,QAAQ;IACRC,WAAW;EACb;;AAIF,SAAsBC,aAAaC,SAAyB;SAAtCD,cAAAA,MAAAA,MAAAA,SAAAA;;SAAAA,gBAAAA;AAAAA,yBAAf,oBAAA,SAA4BC,SAAyB;QAKpDC,iBAIAC,eAYFC,SAEC,2BAAA,mBAAA,gBAAA,WAAA,OAAMC,OACHC,MAIEC,KAAAA;;;;AA3BV,iBAAIN,QAAQO,MAAMC,iBAAiB,KACjC;;eAGIP,kBAAkBR,gBAAgB;YACtCgB,KAAKT,QAAQU;UACf,CAAA,EAAGC,IAAI,SAACC,cAAAA;mBAAiBlB,KAAKM,QAAQU,MAAME,YAAAA;cAEtCV,gBAAgB,oBAAIW,IAAAA,GAE1B;;YAAMC,QAAQC,IACZnB,QAAQoB,QAAQ,SAACZ,QAAAA;AACf,qBAAOH,gBAAgBe,QAAO,WAAA;2BAAC,oBAAA,SAAOC,KAAAA;;;;AAChC,+BAAA;;0BAAMtB,QAAQuB,WAAWxB,KAAKuB,KAAKb,OAAMP,MAAM,CAAA;;;AAAnD,+BAAIsB,QAAA,KAAA,KACFjB,cAAckB,IAAIhB,MAAAA;;;;;gBAEtB,CAAA;gCAJsCa,KAAAA;;;;YAKxC,CAAA,CAAA;;;AAPF,iBAAA,KAAA,GAUId,UAAU,IAET,4BAAA,IAAA,oBAAA,IAAA,iBAAA;;;;;;;cAAA,YAAgB,qBAAGD,aAAAA,EAAAA,OAAAA,QAAAA,EAAAA;;kBAAnB,6BAAA,QAAA,UAAA,KAAA,GAAA,QAAA;;;eAAME,QAAN,MAAA,OACGC,OAAOX,KAAKM,QAAQqB,gBAAgBjB,MAAMN,SAAS,GACnD;;YAAMH,QAAQuB,WAAWb,IAAAA;;;iBAAzB,OAAA,KAAA,IAAF;;;eACFF,UAAU,IACVmB,QAAQC,KAAM,iBAA6B,OAAbnB,MAAMP,MAAM,CAAA,GACpCS,MAAMZ,KAAKM,QAAQwB,oBAAoBpB,MAAMN,SAAS,GAC5D;;YAAMH,QAAQ8B,KAAKnB,KAAKD,IAAAA;;;AAAxB,iBAAA,KAAA;;AANC,6CAAA;;;;;;;;;;sCAAA,oBAAA,IAAA,iBAAA;;;;;;aAAA,6BAAA,UAAA,UAAA,QAAA,UAAA,OAAA;;gBAAA;oBAAA;;;;;;AAUL,iBAAIF,YACFmB,QAAQC,KACL;;;CAAA,GAGHG,QAAQC,KAAK,CAAA;;;;;EAEjB,CAAA,GAxCsB5B,cAAAA,MAAAA,MAAAA,SAAAA;;",
5
+ "names": ["findNodeModules", "join", "FSExtra", "patches", "module", "patchFile", "checkPatches", "options", "nodeModulesDirs", "patchesToCopy", "didCopy", "patch", "dest", "src", "state", "applyPatches", "cwd", "root", "map", "relativePath", "Set", "Promise", "all", "flatMap", "dir", "pathExists", "_state", "add", "userPatchesDir", "console", "info", "internalPatchesDir", "copy", "process", "exit"]
6
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=prerender.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "mappings": "",
5
+ "names": []
6
+ }
File without changes
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=prerender.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "mappings": "",
5
+ "names": []
6
+ }
@@ -0,0 +1,20 @@
1
+ import { sync as globSync } from "glob";
2
+ import { join } from "node:path";
3
+ import { createRoutesManifest } from "@vxrn/expo-router/routes-manifest";
4
+ function createExpoServer(root, app) {
5
+ const routePaths = getRoutePaths(join(root, "app")), manifest = createRoutesManifest(routePaths);
6
+ console.info("manifest", manifest);
7
+ }
8
+ function getRoutePaths(cwd) {
9
+ return globSync("**/*.@(ts|tsx|js|jsx)", {
10
+ cwd
11
+ }).map((p) => "./" + normalizePaths(p));
12
+ }
13
+ function normalizePaths(p) {
14
+ return p.replace(/\\/g, "/");
15
+ }
16
+ export {
17
+ createExpoServer,
18
+ getRoutePaths
19
+ };
20
+ //# sourceMappingURL=createExpoServer.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/vendor/createExpoServer.ts"],
4
+ "mappings": "AAAA,SAAS,QAAQ,gBAAgB;AAEjC,SAAS,YAAY;AAErB,SAAS,4BAA4B;AAI9B,SAAS,iBAAiB,MAAc,KAAU;AACvD,QAAM,aAAa,cAAc,KAAK,MAAM,KAAK,CAAC,GAC5C,WAAW,qBAAqB,UAAU;AAChD,UAAQ,KAAK,YAAY,QAAQ;AAInC;AAGO,SAAS,cAAc,KAAa;AACzC,SAAO,SAAS,yBAAyB;AAAA,IACvC;AAAA,EACF,CAAC,EAAE,IAAI,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AACxC;AAEA,SAAS,eAAe,GAAW;AACjC,SAAO,EAAE,QAAQ,OAAO,GAAG;AAC7B;",
5
+ "names": []
6
+ }
@@ -0,0 +1,17 @@
1
+ import { sync as globSync } from "glob";
2
+ import { join } from "node:path";
3
+ import { createRoutesManifest } from "@vxrn/expo-router/routes-manifest";
4
+ function createExpoServer(root, app) {
5
+ const routePaths = getRoutePaths(join(root, "app")),
6
+ manifest = createRoutesManifest(routePaths);
7
+ console.info("manifest", manifest);
8
+ }
9
+ function getRoutePaths(cwd) {
10
+ return globSync("**/*.@(ts|tsx|js|jsx)", {
11
+ cwd
12
+ }).map(p => "./" + normalizePaths(p));
13
+ }
14
+ function normalizePaths(p) {
15
+ return p.replace(/\\/g, "/");
16
+ }
17
+ export { createExpoServer, getRoutePaths };
@@ -0,0 +1,22 @@
1
+ import { sync as globSync } from "glob";
2
+ import { join } from "node:path";
3
+ import { createRoutesManifest } from "@vxrn/expo-router/routes-manifest";
4
+ function createExpoServer(root, app) {
5
+ var routePaths = getRoutePaths(join(root, "app")), manifest = createRoutesManifest(routePaths);
6
+ console.info("manifest", manifest);
7
+ }
8
+ function getRoutePaths(cwd) {
9
+ return globSync("**/*.@(ts|tsx|js|jsx)", {
10
+ cwd
11
+ }).map(function(p) {
12
+ return "./" + normalizePaths(p);
13
+ });
14
+ }
15
+ function normalizePaths(p) {
16
+ return p.replace(/\\/g, "/");
17
+ }
18
+ export {
19
+ createExpoServer,
20
+ getRoutePaths
21
+ };
22
+ //# sourceMappingURL=createExpoServer.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/vendor/Users/n8/vxrn/packages/vxrn/src/vendor/createExpoServer.ts"],
4
+ "mappings": "AAAA,SAASA,QAAQC,gBAAgB;AAEjC,SAASC,YAAY;AAErB,SAASC,4BAA4B;AAI9B,SAASC,iBAAiBC,MAAcC,KAAQ;AACrD,MAAMC,aAAaC,cAAcN,KAAKG,MAAM,KAAA,CAAA,GACtCI,WAAWN,qBAAqBI,UAAAA;AACtCG,UAAQC,KAAK,YAAYF,QAAAA;AAI3B;AAGO,SAASD,cAAcI,KAAW;AACvC,SAAOX,SAAS,yBAAyB;IACvCW;EACF,CAAA,EAAGC,IAAI,SAACC,GAAAA;WAAM,OAAOC,eAAeD,CAAAA;;AACtC;AAEA,SAASC,eAAeD,GAAS;AAC/B,SAAOA,EAAEE,QAAQ,OAAO,GAAA;AAC1B;",
5
+ "names": ["sync", "globSync", "join", "createRoutesManifest", "createExpoServer", "root", "app", "routePaths", "getRoutePaths", "manifest", "console", "info", "cwd", "map", "p", "normalizePaths", "replace"]
6
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vxrn",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "source": "src/index.ts",
5
5
  "types": "./types/index.d.ts",
6
6
  "type": "module",
@@ -29,12 +29,12 @@
29
29
  "@babel/code-frame": "^7.21.4",
30
30
  "@vitejs/plugin-react": "^4.2.1",
31
31
  "@vitejs/plugin-react-swc": "^3.6.0",
32
- "@vxrn/expo-router": "0.1.20",
33
- "@vxrn/react-native-prebuilt": "0.1.20",
34
- "@vxrn/vite-flow": "0.1.20",
35
- "@vxrn/vite-native-client": "0.1.20",
36
- "@vxrn/vite-native-hmr": "0.1.20",
37
- "@vxrn/vite-native-swc": "0.1.20",
32
+ "@vxrn/expo-router": "0.1.21",
33
+ "@vxrn/react-native-prebuilt": "0.1.21",
34
+ "@vxrn/vite-flow": "0.1.21",
35
+ "@vxrn/vite-native-client": "0.1.21",
36
+ "@vxrn/vite-native-hmr": "0.1.21",
37
+ "@vxrn/vite-native-swc": "0.1.21",
38
38
  "chalk": "^5.3.0",
39
39
  "citty": "^0.1.6",
40
40
  "crossws": "^0.2.4",
@@ -59,6 +59,7 @@
59
59
  "prompts": "^2.4.2",
60
60
  "radix3": "^1.1.2",
61
61
  "readline": "^1.3.0",
62
+ "sirv": "^2.0.4",
62
63
  "source-map": "^0.7.3",
63
64
  "url": "^0.11.0",
64
65
  "vite": "^5.2.8",
package/src/cli.ts CHANGED
@@ -1,5 +1,78 @@
1
+ import { readVXRNConfig } from './utils/readVXRNConfig'
1
2
  import { defineCommand, runMain } from 'citty'
2
- import { commands } from './commands'
3
+
4
+ const dev = defineCommand({
5
+ meta: {
6
+ name: 'dev',
7
+ version: '0.0.0',
8
+ description: 'Start the dev server',
9
+ },
10
+ args: {},
11
+ async run({ args }) {
12
+ const userConfig = await readVXRNConfig()
13
+ const { dev } = await import(
14
+ // @ts-expect-error
15
+ './exports/dev.mjs'
16
+ )
17
+ const { start, stop } = await dev({
18
+ root: process.cwd(),
19
+ host: '127.0.0.1',
20
+ webConfig: {
21
+ plugins: [],
22
+ },
23
+ buildConfig: {
24
+ plugins: [],
25
+ },
26
+ flow: {
27
+ include: [],
28
+ exclude: [],
29
+ },
30
+ ...userConfig,
31
+ })
32
+
33
+ const { closePromise } = await start()
34
+
35
+ process.on('beforeExit', () => {
36
+ stop()
37
+ })
38
+
39
+ process.on('SIGINT', () => {
40
+ stop()
41
+ })
42
+
43
+ process.on('uncaughtException', (err) => {
44
+ console.error(err?.message || err)
45
+ })
46
+
47
+ await closePromise
48
+ },
49
+ })
50
+
51
+ const build = defineCommand({
52
+ meta: {
53
+ name: 'build',
54
+ version: '0.0.0',
55
+ description: 'Build your app',
56
+ },
57
+ args: {},
58
+ async run({ args }) {
59
+ const userConfig = await readVXRNConfig()
60
+ const { build } = await import(
61
+ // @ts-expect-error
62
+ './exports/build.mjs'
63
+ )
64
+
65
+ process.on('uncaughtException', (err) => {
66
+ console.error(err?.message || err)
67
+ })
68
+
69
+ const results = await build(userConfig)
70
+
71
+ if (process.env.DEBUG) {
72
+ console.info('results', results)
73
+ }
74
+ },
75
+ })
3
76
 
4
77
  const main = defineCommand({
5
78
  meta: {
@@ -7,7 +80,10 @@ const main = defineCommand({
7
80
  version: '0.0.0',
8
81
  description: 'Welcome to vxrn',
9
82
  },
10
- subCommands: commands,
83
+ subCommands: {
84
+ dev,
85
+ build,
86
+ },
11
87
  })
12
88
 
13
89
  runMain(main)
@@ -5,10 +5,10 @@ import { mergeConfig, build as viteBuild, type UserConfig } from 'vite'
5
5
 
6
6
  import FSExtra from 'fs-extra'
7
7
  import type { OutputAsset, OutputChunk, RollupOutput } from 'rollup'
8
- import { clientBundleTreeShakePlugin } from './plugins/clientBundleTreeShakePlugin'
9
- import type { VXRNConfig } from './types'
10
- import { getBaseViteConfig } from './utils/getBaseViteConfig'
11
- import { getOptionsFilled, type VXRNConfigFilled } from './utils/getOptionsFilled'
8
+ import { clientBundleTreeShakePlugin } from '../plugins/clientBundleTreeShakePlugin'
9
+ import type { VXRNConfig } from '../types'
10
+ import { getBaseViteConfig } from '../utils/getBaseViteConfig'
11
+ import { getOptionsFilled, type VXRNConfigFilled } from '../utils/getOptionsFilled'
12
12
 
13
13
  export const resolveFile = (path: string) => {
14
14
  try {
@@ -117,6 +117,7 @@ async function generateStaticPages(
117
117
  const staticDir = toAbsolute(`dist/static`)
118
118
  await ensureDir(staticDir)
119
119
  const template = fs.readFileSync(toAbsolute('index.html'), 'utf-8')
120
+
120
121
  const render = (await import(`${options.root}/dist/server/entry-server.js`)).render
121
122
 
122
123
  // load routes
@@ -1,5 +1,4 @@
1
1
  import wsAdapter from 'crossws/adapters/node'
2
- import findNodeModules from 'find-node-modules'
3
2
  import {
4
3
  createApp,
5
4
  createRouter,
@@ -35,14 +34,15 @@ import {
35
34
  import createViteFlow from '@vxrn/vite-flow'
36
35
  import type { Peer } from 'crossws'
37
36
  import { resolve as importMetaResolve } from 'import-meta-resolve'
38
- import { clientInjectionsPlugin } from './dev/clientInjectPlugin'
39
- import { nativePlugin } from './nativePlugin'
40
- import type { VXRNConfig } from './types'
41
- import { getBaseViteConfig } from './utils/getBaseViteConfig'
42
- import { getOptionsFilled, type VXRNConfigFilled } from './utils/getOptionsFilled'
43
- import { getVitePath } from './utils/getVitePath'
44
- import { clientBundleTreeShakePlugin } from './plugins/clientBundleTreeShakePlugin'
45
- import { createExpoServer } from './createExpoServer'
37
+ import { clientBundleTreeShakePlugin } from '../plugins/clientBundleTreeShakePlugin'
38
+ import { clientInjectionsPlugin } from '../plugins/clientInjectPlugin'
39
+ import { reactNativeCommonJsPlugin } from '../plugins/reactNativeCommonJsPlugin'
40
+ import type { VXRNConfig } from '../types'
41
+ import { getBaseViteConfig } from '../utils/getBaseViteConfig'
42
+ import { getOptionsFilled } from '../utils/getOptionsFilled'
43
+ import { getVitePath } from '../utils/getVitePath'
44
+ import { checkPatches } from '../utils/patches'
45
+ import { createExpoServer } from '../vendor/createExpoServer'
46
46
 
47
47
  export const resolveFile = (path: string) => {
48
48
  try {
@@ -78,58 +78,7 @@ const extensions = [
78
78
 
79
79
  const { ensureDir, pathExists, pathExistsSync } = FSExtra
80
80
 
81
- const patches = [
82
- {
83
- module: 'react-native-screens',
84
- patchFile: 'react-native-screens+3.22.1.patch',
85
- },
86
- ]
87
-
88
- type Patch = (typeof patches)[0]
89
-
90
- async function checkPatches(options: VXRNConfigFilled) {
91
- if (options.state.applyPatches === false) {
92
- return
93
- }
94
-
95
- const nodeModulesDirs = findNodeModules({
96
- cwd: options.root,
97
- }).map((relativePath) => join(options.root, relativePath))
98
-
99
- const patchesToCopy = new Set<Patch>()
100
-
101
- await Promise.all(
102
- patches.flatMap((patch) => {
103
- return nodeModulesDirs.flatMap(async (dir) => {
104
- if (await FSExtra.pathExists(join(dir, patch.module))) {
105
- patchesToCopy.add(patch)
106
- }
107
- })
108
- })
109
- )
110
-
111
- let didCopy = false
112
-
113
- for (const patch of [...patchesToCopy]) {
114
- const dest = join(options.userPatchesDir, patch.patchFile)
115
- if (!(await pathExists(dest))) {
116
- didCopy = true
117
- console.info(`Copying patch ${patch.module}`)
118
- const src = join(options.internalPatchesDir, patch.patchFile)
119
- await FSExtra.copy(src, dest)
120
- }
121
- }
122
-
123
- if (didCopy) {
124
- console.info(
125
- `\nPlease restart after applying the patch by running "npx patch-package".
126
- Ideally add it to your devDependencies and as a postinstall script.\n`
127
- )
128
- process.exit(0)
129
- }
130
- }
131
-
132
- export const createDevServer = async (optionsIn: VXRNConfig) => {
81
+ export const dev = async (optionsIn: VXRNConfig) => {
133
82
  const options = await getOptionsFilled(optionsIn)
134
83
  const { host, port, root, cacheDir } = options
135
84
 
@@ -564,6 +513,7 @@ export const createDevServer = async (optionsIn: VXRNConfig) => {
564
513
  data: string[]
565
514
  }
566
515
 
516
+ // react native log bridge
567
517
  app.use(
568
518
  '/__client',
569
519
  defineWebSocketHandler({
@@ -608,7 +558,7 @@ export const createDevServer = async (optionsIn: VXRNConfig) => {
608
558
  server.on('upgrade', handleUpgrade)
609
559
 
610
560
  return {
611
- nativeServer: server,
561
+ server,
612
562
  viteServer,
613
563
 
614
564
  async start() {
@@ -682,7 +632,7 @@ export const createDevServer = async (optionsIn: VXRNConfig) => {
682
632
  clientBundleTreeShakePlugin({}),
683
633
  viteRNClientPlugin,
684
634
 
685
- nativePlugin({
635
+ reactNativeCommonJsPlugin({
686
636
  root,
687
637
  port,
688
638
  mode: 'build',