vxrn 2.9.2 → 2.11.0
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.
- package/dist/config/getBaseVitePlugins.mjs +3 -1
- package/dist/config/getBaseVitePlugins.mjs.map +1 -1
- package/dist/config/getBaseVitePlugins.native.js +3 -1
- package/dist/config/getBaseVitePlugins.native.js.map +1 -1
- package/dist/constants.mjs +23 -1
- package/dist/constants.mjs.map +1 -1
- package/dist/constants.native.js +23 -1
- package/dist/constants.native.js.map +1 -1
- package/dist/exports/build.mjs +11 -12
- package/dist/exports/build.mjs.map +1 -1
- package/dist/exports/build.native.js +11 -12
- package/dist/exports/build.native.js.map +1 -1
- package/dist/exports/prebuildWithoutExpo.mjs +16 -1
- package/dist/exports/prebuildWithoutExpo.mjs.map +1 -1
- package/dist/exports/prebuildWithoutExpo.native.js +16 -1
- package/dist/exports/prebuildWithoutExpo.native.js.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.mjs +2 -1
- package/dist/index.native.js +2 -1
- package/dist/plugins/reactNativeDevServer.mjs +7 -5
- package/dist/plugins/reactNativeDevServer.mjs.map +1 -1
- package/dist/plugins/reactNativeDevServer.native.js +8 -5
- package/dist/plugins/reactNativeDevServer.native.js.map +1 -1
- package/dist/rn-commands/bundle/buildBundle.mjs +9 -0
- package/dist/rn-commands/bundle/buildBundle.mjs.map +1 -1
- package/dist/rn-commands/bundle/buildBundle.native.js +9 -0
- package/dist/rn-commands/bundle/buildBundle.native.js.map +1 -1
- package/dist/runtime/native-prelude.mjs +7 -1
- package/dist/runtime/native-prelude.mjs.map +1 -1
- package/dist/runtime/native-prelude.native.js +7 -1
- package/dist/runtime/native-prelude.native.js.map +1 -1
- package/dist/utils/compileNativeDevBytecode.mjs +13 -3
- package/dist/utils/compileNativeDevBytecode.mjs.map +1 -1
- package/dist/utils/compileNativeDevBytecode.native.js +13 -3
- package/dist/utils/compileNativeDevBytecode.native.js.map +1 -1
- package/dist/utils/createNativeDevEngine.mjs +375 -173
- package/dist/utils/createNativeDevEngine.mjs.map +1 -1
- package/dist/utils/createNativeDevEngine.native.js +429 -193
- package/dist/utils/createNativeDevEngine.native.js.map +1 -1
- package/dist/utils/environmentUtils.mjs +1 -1
- package/dist/utils/environmentUtils.mjs.map +1 -1
- package/dist/utils/environmentUtils.native.js +1 -1
- package/dist/utils/environmentUtils.native.js.map +1 -1
- package/dist/utils/scanDepsToOptimize.mjs +37 -15
- package/dist/utils/scanDepsToOptimize.mjs.map +1 -1
- package/dist/utils/scanDepsToOptimize.native.js +45 -15
- package/dist/utils/scanDepsToOptimize.native.js.map +1 -1
- package/package.json +13 -13
- package/src/config/getBaseVitePlugins.ts +2 -0
- package/src/constants.ts +24 -0
- package/src/exports/build.lifecycle.test.ts +152 -0
- package/src/exports/build.ts +16 -14
- package/src/exports/prebuildWithoutExpo.ts +16 -1
- package/src/index.ts +1 -0
- package/src/plugins/reactNativeCommonJsPlugin.ts +1 -1
- package/src/plugins/reactNativeDevServer.ts +19 -8
- package/src/rn-commands/bundle/buildBundle.ts +13 -1
- package/src/runtime/native-prelude.ts +7 -1
- package/src/types.ts +1 -1
- package/src/utils/compileNativeDevBytecode.test.ts +8 -8
- package/src/utils/compileNativeDevBytecode.ts +22 -2
- package/src/utils/createNativeDevEngine.test.ts +52 -25
- package/src/utils/createNativeDevEngine.ts +567 -254
- package/src/utils/environmentUtils.ts +6 -1
- package/src/utils/scanDepsToOptimize.test.ts +46 -2
- package/src/utils/scanDepsToOptimize.ts +78 -18
- package/types/config/getBaseVitePlugins.d.ts.map +1 -1
- package/types/constants.d.ts +2 -0
- package/types/constants.d.ts.map +1 -1
- package/types/exports/build.d.ts.map +1 -1
- package/types/exports/prebuildWithoutExpo.d.ts.map +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/plugins/reactNativeDevServer.d.ts.map +1 -1
- package/types/rn-commands/bundle/buildBundle.d.ts.map +1 -1
- package/types/runtime/native-prelude.d.ts.map +1 -1
- package/types/types.d.ts +1 -1
- package/types/types.d.ts.map +1 -1
- package/types/utils/compileNativeDevBytecode.d.ts +2 -1
- package/types/utils/compileNativeDevBytecode.d.ts.map +1 -1
- package/types/utils/createNativeDevEngine.d.ts +11 -5
- package/types/utils/createNativeDevEngine.d.ts.map +1 -1
- package/types/utils/environmentUtils.d.ts.map +1 -1
- package/types/utils/scanDepsToOptimize.d.ts.map +1 -1
|
@@ -7,6 +7,7 @@ import { parseSync } from "oxc-parser";
|
|
|
7
7
|
import { loadEnv, normalizePath } from "vite";
|
|
8
8
|
import { shouldStripFlow, transformHermesAsync } from "@vxrn/compiler";
|
|
9
9
|
import { resolvePath } from "@vxrn/resolve";
|
|
10
|
+
import { desktopReactNativeFile, requireOnePackageRoot } from "@vxrn/utils/desktopReactNativeResolve";
|
|
10
11
|
import { nativeAppDefines } from "@vxrn/utils/nativeAppManifest";
|
|
11
12
|
import { withExpoPublicEnvAliases } from "@vxrn/utils/publicEnv";
|
|
12
13
|
import { DEFAULT_ASSET_EXTS } from "../constants/defaults.native.js";
|
|
@@ -27,37 +28,52 @@ var HERMES_ASYNC_TRANSFORMS = ["transform-async-to-generator"];
|
|
|
27
28
|
function getHermesSWCIncludes(dev) {
|
|
28
29
|
return [...HERMES_CLASS_TRANSFORMS, ...HERMES_ASYNC_TRANSFORMS];
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
var NATIVE_PLATFORM_EXTENSIONS = {
|
|
32
|
+
ios: [
|
|
32
33
|
".ios.tsx",
|
|
33
34
|
".ios.ts",
|
|
34
35
|
".ios.jsx",
|
|
35
36
|
".ios.js"
|
|
36
|
-
]
|
|
37
|
+
],
|
|
38
|
+
android: [
|
|
37
39
|
".android.tsx",
|
|
38
40
|
".android.ts",
|
|
39
41
|
".android.jsx",
|
|
40
42
|
".android.js"
|
|
41
|
-
]
|
|
42
|
-
|
|
43
|
-
".
|
|
44
|
-
".
|
|
45
|
-
".
|
|
46
|
-
".
|
|
47
|
-
]
|
|
48
|
-
|
|
49
|
-
".tsx",
|
|
50
|
-
".ts",
|
|
51
|
-
".jsx",
|
|
52
|
-
".js"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
43
|
+
],
|
|
44
|
+
macos: [
|
|
45
|
+
".macos.tsx",
|
|
46
|
+
".macos.ts",
|
|
47
|
+
".macos.jsx",
|
|
48
|
+
".macos.js"
|
|
49
|
+
],
|
|
50
|
+
linux: [
|
|
51
|
+
".linux.tsx",
|
|
52
|
+
".linux.ts",
|
|
53
|
+
".linux.jsx",
|
|
54
|
+
".linux.js"
|
|
55
|
+
]
|
|
56
|
+
};
|
|
57
|
+
var NATIVE_SHARED_EXTENSIONS = [
|
|
58
|
+
".native.tsx",
|
|
59
|
+
".native.ts",
|
|
60
|
+
".native.jsx",
|
|
61
|
+
".native.js"
|
|
62
|
+
];
|
|
63
|
+
var PLAIN_EXTENSIONS = [
|
|
64
|
+
".tsx",
|
|
65
|
+
".ts",
|
|
66
|
+
".jsx",
|
|
67
|
+
".js",
|
|
68
|
+
".mjs",
|
|
69
|
+
".cjs",
|
|
70
|
+
".json"
|
|
71
|
+
];
|
|
72
|
+
function getResolveExtensions(platform) {
|
|
57
73
|
return [
|
|
58
|
-
...
|
|
59
|
-
...
|
|
60
|
-
...
|
|
74
|
+
...NATIVE_PLATFORM_EXTENSIONS[platform],
|
|
75
|
+
...NATIVE_SHARED_EXTENSIONS,
|
|
76
|
+
...PLAIN_EXTENSIONS
|
|
61
77
|
];
|
|
62
78
|
}
|
|
63
79
|
function getNativeResolveConfig(platform) {
|
|
@@ -181,16 +197,142 @@ function getNativeTransformConfig(platform, dev, root) {
|
|
|
181
197
|
inject: { React: "react" }
|
|
182
198
|
};
|
|
183
199
|
}
|
|
200
|
+
function desktopReactNativeResolvePlugin(root, platform) {
|
|
201
|
+
var oneRoot = requireOnePackageRoot(root, platform);
|
|
202
|
+
return {
|
|
203
|
+
name: `vxrn:${platform}-react-native-resolve`,
|
|
204
|
+
resolveId(source, importer) {
|
|
205
|
+
if (!importer) return;
|
|
206
|
+
var file = desktopReactNativeFile(importer, source, oneRoot, platform);
|
|
207
|
+
if (file) return file;
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
var PLATFORM_VARIANT_EXTS = [
|
|
212
|
+
".ios.tsx",
|
|
213
|
+
".ios.ts",
|
|
214
|
+
".ios.jsx",
|
|
215
|
+
".ios.js",
|
|
216
|
+
".android.tsx",
|
|
217
|
+
".android.ts",
|
|
218
|
+
".android.jsx",
|
|
219
|
+
".android.js",
|
|
220
|
+
".web.tsx",
|
|
221
|
+
".web.ts",
|
|
222
|
+
".web.jsx",
|
|
223
|
+
".web.js"
|
|
224
|
+
];
|
|
225
|
+
function desktopNormalFile(target, source, platform) {
|
|
226
|
+
if (/\.(?:tsx|ts|jsx|js|mjs|cjs|json)$/.test(source)) return existsSync(target);
|
|
227
|
+
var extensions = getResolveExtensions(platform);
|
|
228
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
229
|
+
try {
|
|
230
|
+
for (var _iterator = extensions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
231
|
+
var ext = _step.value;
|
|
232
|
+
if (existsSync(target + ext)) return true;
|
|
233
|
+
if (existsSync(join(target, "index" + ext))) return true;
|
|
234
|
+
}
|
|
235
|
+
} catch (err) {
|
|
236
|
+
_didIteratorError = true;
|
|
237
|
+
_iteratorError = err;
|
|
238
|
+
} finally {
|
|
239
|
+
try {
|
|
240
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
|
|
241
|
+
} finally {
|
|
242
|
+
if (_didIteratorError) throw _iteratorError;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
function desktopVariantSource(target) {
|
|
248
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
249
|
+
try {
|
|
250
|
+
for (var _iterator = PLATFORM_VARIANT_EXTS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
251
|
+
var file = target + _step.value;
|
|
252
|
+
if (existsSync(file)) return file;
|
|
253
|
+
}
|
|
254
|
+
} catch (err) {
|
|
255
|
+
_didIteratorError = true;
|
|
256
|
+
_iteratorError = err;
|
|
257
|
+
} finally {
|
|
258
|
+
try {
|
|
259
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
|
|
260
|
+
} finally {
|
|
261
|
+
if (_didIteratorError) throw _iteratorError;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return null;
|
|
265
|
+
}
|
|
266
|
+
function desktopPackageImportLabel(variantFile) {
|
|
267
|
+
var dir = dirname(variantFile);
|
|
268
|
+
for (var i = 0; i < 8; i++) {
|
|
269
|
+
var manifest = join(dir, "package.json");
|
|
270
|
+
if (existsSync(manifest)) try {
|
|
271
|
+
var name = JSON.parse(readFileSync(manifest, "utf8")).name;
|
|
272
|
+
if (typeof name === "string" && name.length > 0) return `${name}/${relative(dir, variantFile).split("\\").join("/").replace(/\.(?:ios|android|web)\.(?:tsx|ts|jsx|js)$/, "")}`;
|
|
273
|
+
} catch (unused) {}
|
|
274
|
+
var parent = dirname(dir);
|
|
275
|
+
if (parent === dir) break;
|
|
276
|
+
dir = parent;
|
|
277
|
+
}
|
|
278
|
+
return variantFile;
|
|
279
|
+
}
|
|
280
|
+
function desktopUnsupportedImportPlugin(platform) {
|
|
281
|
+
var label = platform === "macos" ? "macOS" : "Linux";
|
|
282
|
+
return {
|
|
283
|
+
name: `vxrn:${platform}-unsupported-import`,
|
|
284
|
+
onLog(_level, log) {
|
|
285
|
+
if (log.code === "UNRESOLVED_IMPORT") this.error({
|
|
286
|
+
...log,
|
|
287
|
+
message: `[vxrn] ${label} bundle cannot resolve an import: ${log.message}`
|
|
288
|
+
});
|
|
289
|
+
},
|
|
290
|
+
resolveId(source, importer) {
|
|
291
|
+
if (!importer || !source.startsWith(".") || source.includes("\0")) return;
|
|
292
|
+
if (source.includes("?") || source.includes("#")) return;
|
|
293
|
+
var target = resolve(dirname(importer), source);
|
|
294
|
+
if (desktopNormalFile(target, source, platform)) return;
|
|
295
|
+
var variant = desktopVariantSource(target);
|
|
296
|
+
if (!variant) return;
|
|
297
|
+
this.error(`[vxrn] ${desktopPackageImportLabel(variant)} has no ${label} implementation: cannot resolve import "${source}" from "${importer}". Add a .${platform}, .native or plain file.`);
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
function desktopDistVariantPlugin(platform) {
|
|
302
|
+
return {
|
|
303
|
+
name: `vxrn:${platform}-dist-variant`,
|
|
304
|
+
resolveId(source, importer) {
|
|
305
|
+
if (!importer || !source.startsWith(".") || !source.endsWith(".native.js")) return;
|
|
306
|
+
if (source.endsWith(`.${platform}.native.js`)) return;
|
|
307
|
+
var variant = resolve(dirname(importer), source).replace(/\.native\.js$/, `.${platform}.native.js`);
|
|
308
|
+
if (variant === importer || !existsSync(variant)) return;
|
|
309
|
+
return variant;
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
}
|
|
184
313
|
function getNativePlugins(root, platform, viteImportGlobPlugin, dev, assetsDest, onAsset) {
|
|
185
|
-
var sourceMaps = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : false, userPlugins = arguments.length > 7 && arguments[7] !== void 0 ? arguments[7] : [], minify = arguments.length > 8 && arguments[8] !== void 0 ? arguments[8] : false;
|
|
186
|
-
var _globalThis___vxrnAddNativePlugins, _globalThis;
|
|
314
|
+
var sourceMaps = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : false, userPlugins = arguments.length > 7 && arguments[7] !== void 0 ? arguments[7] : [], minify = arguments.length > 8 && arguments[8] !== void 0 ? arguments[8] : false, command = arguments.length > 9 && arguments[9] !== void 0 ? arguments[9] : "serve";
|
|
315
|
+
var _globalThis___vxrnAddNativePlugins, _globalThis, _find;
|
|
187
316
|
var context = {
|
|
188
317
|
root,
|
|
189
318
|
platform,
|
|
190
|
-
dev
|
|
319
|
+
dev,
|
|
320
|
+
command,
|
|
321
|
+
assetsDest
|
|
191
322
|
};
|
|
192
|
-
|
|
193
|
-
|
|
323
|
+
var desktopPlugins = platform === "macos" || platform === "linux" ? [
|
|
324
|
+
desktopReactNativeResolvePlugin(root, platform),
|
|
325
|
+
desktopDistVariantPlugin(platform),
|
|
326
|
+
desktopUnsupportedImportPlugin(platform)
|
|
327
|
+
] : [];
|
|
328
|
+
var globalPlugins = ((_globalThis___vxrnAddNativePlugins = (_globalThis = globalThis).__vxrnAddNativePlugins) === null || _globalThis___vxrnAddNativePlugins === void 0 ? void 0 : _globalThis___vxrnAddNativePlugins.call(_globalThis, platform)) || [];
|
|
329
|
+
var trace = dev && command === "serve" ? (_find = [...globalPlugins, ...userPlugins].find(function(plugin) {
|
|
330
|
+
var _plugin_api;
|
|
331
|
+
return (_plugin_api = plugin.api) === null || _plugin_api === void 0 ? void 0 : _plugin_api.vxrnNativeCompilerTrace;
|
|
332
|
+
})) === null || _find === void 0 ? void 0 : _find.api.vxrnNativeCompilerTrace : void 0;
|
|
333
|
+
var plugins = [
|
|
334
|
+
...desktopPlugins,
|
|
335
|
+
...globalPlugins,
|
|
194
336
|
serverFileExclusionPlugin(),
|
|
195
337
|
environmentGuardPlugin(),
|
|
196
338
|
missingDynamicImportPlugin(),
|
|
@@ -203,7 +345,7 @@ function getNativePlugins(root, platform, viteImportGlobPlugin, dev, assetsDest,
|
|
|
203
345
|
viteImportGlobPlugin({ root }),
|
|
204
346
|
rnCodegenPlugin({ projectRoot: root }),
|
|
205
347
|
flowStripPlugin(),
|
|
206
|
-
vxrnCompilerPlugin(platform, dev, root, sourceMaps),
|
|
348
|
+
vxrnCompilerPlugin(platform, dev, root, sourceMaps, trace),
|
|
207
349
|
mixedNativeModulePlugin(sourceMaps),
|
|
208
350
|
nativeAnimatedGuardPlugin(),
|
|
209
351
|
assetPlugin({
|
|
@@ -221,6 +363,61 @@ function getNativePlugins(root, platform, viteImportGlobPlugin, dev, assetsDest,
|
|
|
221
363
|
var _plugin_api;
|
|
222
364
|
return ((_plugin_api = plugin.api) === null || _plugin_api === void 0 ? void 0 : _plugin_api.vxrnNative) ? plugin.api.vxrnNative(context) : plugin;
|
|
223
365
|
});
|
|
366
|
+
if (!trace) return plugins;
|
|
367
|
+
var start = function start2(id, stage) {
|
|
368
|
+
try {
|
|
369
|
+
var record = trace(id);
|
|
370
|
+
if (!record) return;
|
|
371
|
+
var mark = function mark2(status) {
|
|
372
|
+
try {
|
|
373
|
+
record(stage, status);
|
|
374
|
+
} catch (unused) {}
|
|
375
|
+
};
|
|
376
|
+
mark("start");
|
|
377
|
+
return mark;
|
|
378
|
+
} catch (unused) {}
|
|
379
|
+
};
|
|
380
|
+
return [{
|
|
381
|
+
name: "test-native-hmr-trace-first-pre",
|
|
382
|
+
transform: {
|
|
383
|
+
order: "pre",
|
|
384
|
+
handler(_code, id) {
|
|
385
|
+
var _start;
|
|
386
|
+
(_start = start(id, "pre:first")) === null || _start === void 0 || _start("end");
|
|
387
|
+
return null;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}, ...plugins.map(function(plugin, index) {
|
|
391
|
+
if (plugin.name !== "one:use-dom-native" && plugin.name !== "vxrn:rn-codegen" && plugin.name !== "one:background-computation:native" && plugin.name !== "one-client-tree-shake") return plugin;
|
|
392
|
+
var hook = plugin.transform;
|
|
393
|
+
if (!hook || typeof hook === "function" || hook.order !== "pre") return plugin;
|
|
394
|
+
return {
|
|
395
|
+
...plugin,
|
|
396
|
+
transform: {
|
|
397
|
+
...hook,
|
|
398
|
+
handler() {
|
|
399
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
|
|
400
|
+
var mark = start(args[1], `pre:${index}:${plugin.name}`);
|
|
401
|
+
if (!mark) return hook.handler.apply(this, args);
|
|
402
|
+
try {
|
|
403
|
+
var result = hook.handler.apply(this, args);
|
|
404
|
+
if (result instanceof Promise) try {
|
|
405
|
+
Promise.prototype.then.call(result, function() {
|
|
406
|
+
return mark("end");
|
|
407
|
+
}, function() {
|
|
408
|
+
return mark("error");
|
|
409
|
+
});
|
|
410
|
+
} catch (unused) {}
|
|
411
|
+
else mark("end");
|
|
412
|
+
return result;
|
|
413
|
+
} catch (error) {
|
|
414
|
+
mark("error");
|
|
415
|
+
throw error;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
})];
|
|
224
421
|
}
|
|
225
422
|
function getNativeOutputOptions(prelude, sourcemap, minify) {
|
|
226
423
|
return {
|
|
@@ -379,21 +576,21 @@ function postProcessNativeBundle(code) {
|
|
|
379
576
|
}
|
|
380
577
|
return code;
|
|
381
578
|
}
|
|
579
|
+
var NATIVE_MODULE_SCOPE_MARKER = "// vxrn: native module scope";
|
|
580
|
+
var NATIVE_DEV_RUNTIME_END = "globalThis.__rolldown_runtime__ = new ReactNativeDevRuntime();";
|
|
382
581
|
function wrapNativeBundleModuleScope(code) {
|
|
383
|
-
var idx = code.indexOf(
|
|
384
|
-
if (idx === -1)
|
|
582
|
+
var idx = code.indexOf(NATIVE_MODULE_SCOPE_MARKER);
|
|
583
|
+
if (idx === -1) throw new Error("[vxrn] the dev bundle lost the end of its prelude, so its modules would run at script scope");
|
|
385
584
|
return code.slice(0, idx) + ";(function() {" + code.slice(idx) + "\n})();\n";
|
|
386
585
|
}
|
|
387
586
|
async function downlevelClassFieldsInBundle(code) {
|
|
388
587
|
var _ref, _ref1;
|
|
389
588
|
var _runtimeSection_match, _result_errors, _transformed_match;
|
|
390
|
-
var
|
|
391
|
-
var
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
var
|
|
395
|
-
if (endIdx === -1) return code;
|
|
396
|
-
var runtimeEnd = endIdx + endMarker.length;
|
|
589
|
+
var markerIdx = code.indexOf(NATIVE_MODULE_SCOPE_MARKER);
|
|
590
|
+
var endIdx = markerIdx === -1 ? -1 : code.indexOf(NATIVE_DEV_RUNTIME_END, markerIdx);
|
|
591
|
+
if (endIdx === -1) throw new Error("[vxrn] could not locate the rolldown runtime in the dev bundle");
|
|
592
|
+
var startIdx = code.indexOf("\n", markerIdx) + 1;
|
|
593
|
+
var runtimeEnd = endIdx + NATIVE_DEV_RUNTIME_END.length;
|
|
397
594
|
var runtimeSection = code.slice(startIdx, runtimeEnd);
|
|
398
595
|
var originalNewlines = (_ref = (_runtimeSection_match = runtimeSection.match(/\n/g)) === null || _runtimeSection_match === void 0 ? void 0 : _runtimeSection_match.length) !== null && _ref !== void 0 ? _ref : 0;
|
|
399
596
|
var { transformSync } = await import("oxc-transform");
|
|
@@ -404,19 +601,17 @@ async function downlevelClassFieldsInBundle(code) {
|
|
|
404
601
|
if ((_result_errors = result.errors) === null || _result_errors === void 0 ? void 0 : _result_errors.length) throw new Error(result.errors.map(function(e) {
|
|
405
602
|
return e.message;
|
|
406
603
|
}).join("\n"));
|
|
407
|
-
var
|
|
408
|
-
var transformed = transformedCode.includes(startMarker) ? transformedCode : `${startMarker}
|
|
409
|
-
${transformedCode}`;
|
|
604
|
+
var transformed = result.code.trimEnd();
|
|
410
605
|
var transformedNewlines = (_ref1 = (_transformed_match = transformed.match(/\n/g)) === null || _transformed_match === void 0 ? void 0 : _transformed_match.length) !== null && _ref1 !== void 0 ? _ref1 : 0;
|
|
411
|
-
if (transformedNewlines > originalNewlines) throw new Error("[vxrn] Hermes runtime transform added lines and would invalidate the
|
|
606
|
+
if (transformedNewlines > originalNewlines) throw new Error("[vxrn] Hermes runtime transform added lines and would invalidate the dev source map");
|
|
412
607
|
var linePreservingRuntime = transformed + "\n".repeat(originalNewlines - transformedNewlines);
|
|
413
608
|
return code.slice(0, startIdx) + linePreservingRuntime + code.slice(runtimeEnd);
|
|
414
609
|
}
|
|
415
610
|
function nativeBundlePostProcessPlugin() {
|
|
416
611
|
return {
|
|
417
612
|
name: "vxrn:native-post-process",
|
|
418
|
-
|
|
419
|
-
var processed =
|
|
613
|
+
renderChunk(code) {
|
|
614
|
+
var processed = postProcessNativeBundle(code);
|
|
420
615
|
assertBundleLinesPreserved(code, processed, "production");
|
|
421
616
|
return {
|
|
422
617
|
code: processed,
|
|
@@ -473,7 +668,8 @@ async function createNativeDevEngine(options) {
|
|
|
473
668
|
plugins: [virtualEntry.plugin, ...getNativePlugins(root, platform, viteImportGlobPlugin, true, void 0, assetRegistry.register, true, userPlugins)]
|
|
474
669
|
};
|
|
475
670
|
var outputOptions = {
|
|
476
|
-
...getNativeOutputOptions(prelude
|
|
671
|
+
...getNativeOutputOptions(`${prelude}
|
|
672
|
+
${NATIVE_MODULE_SCOPE_MARKER}`, true, false),
|
|
477
673
|
outro: `
|
|
478
674
|
try {
|
|
479
675
|
var __WS = (init_WebSocket(), __toCommonJS(WebSocket_exports)).default;
|
|
@@ -587,6 +783,7 @@ try {
|
|
|
587
783
|
code = postProcessNativeBundle(chunk.code);
|
|
588
784
|
code = await downlevelClassFieldsInBundle(code);
|
|
589
785
|
assertBundleLinesPreserved(chunk.code, code, "dev");
|
|
786
|
+
code = wrapNativeBundleModuleScope(code);
|
|
590
787
|
} catch (error) {
|
|
591
788
|
var failure = error instanceof Error ? error : new Error(String(error));
|
|
592
789
|
console.error("[vxrn] native bundle post-processing failed:", failure.message);
|
|
@@ -602,7 +799,6 @@ try {
|
|
|
602
799
|
}
|
|
603
800
|
return;
|
|
604
801
|
}
|
|
605
|
-
code = wrapNativeBundleModuleScope(code);
|
|
606
802
|
if (!chunk.map) throw new Error("[vxrn] rolldown produced no source map for the dev bundle, so /symbolicate cannot resolve a frame");
|
|
607
803
|
currentBundle = {
|
|
608
804
|
code,
|
|
@@ -707,7 +903,7 @@ async function buildNativeBundle(options) {
|
|
|
707
903
|
dev,
|
|
708
904
|
platform
|
|
709
905
|
}).plugin],
|
|
710
|
-
...getNativePlugins(root, platform, viteImportGlobPlugin, dev, assetsDest, void 0, sourcemap, userPlugins, minify),
|
|
906
|
+
...getNativePlugins(root, platform, viteImportGlobPlugin, dev, assetsDest, void 0, sourcemap, userPlugins, minify, "build"),
|
|
711
907
|
nativeBundlePostProcessPlugin()
|
|
712
908
|
],
|
|
713
909
|
output: {
|
|
@@ -736,7 +932,8 @@ function nativeVirtualEntryPlugin(root, opts) {
|
|
|
736
932
|
var setupFileImport = (function() {
|
|
737
933
|
var sf = entryConfig.setupFile;
|
|
738
934
|
if (!sf) return "";
|
|
739
|
-
var
|
|
935
|
+
var perPlatform = sf;
|
|
936
|
+
var file = typeof sf === "string" ? sf : "native" in sf ? sf.native : opts.platform === "macos" || opts.platform === "linux" ? perPlatform[opts.platform] : sf.ios;
|
|
740
937
|
if (!file) return "";
|
|
741
938
|
var resolved = pathToFileURL(resolve(root, file)).href;
|
|
742
939
|
return `import ${JSON.stringify(resolved)};`;
|
|
@@ -1242,7 +1439,7 @@ function cssStubPlugin() {
|
|
|
1242
1439
|
};
|
|
1243
1440
|
}
|
|
1244
1441
|
function vxrnCompilerPlugin(platform, dev) {
|
|
1245
|
-
var projectRoot = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : process.cwd(), sourceMaps = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;
|
|
1442
|
+
var projectRoot = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : process.cwd(), sourceMaps = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false, trace = arguments.length > 4 ? arguments[4] : void 0;
|
|
1246
1443
|
var compiler = null;
|
|
1247
1444
|
var isRefreshCandidate = function isRefreshCandidate2(id) {
|
|
1248
1445
|
return dev && !id.includes("node_modules") && !id.includes("__virtual-native-entry") && /\.[tj]sx?$/.test(id);
|
|
@@ -1250,143 +1447,175 @@ function vxrnCompilerPlugin(platform, dev) {
|
|
|
1250
1447
|
return {
|
|
1251
1448
|
name: "vxrn:compiler",
|
|
1252
1449
|
async transform(code, id) {
|
|
1253
|
-
var _ref;
|
|
1254
|
-
var _babelOptions_plugins, _babelOptions_plugins1;
|
|
1255
1450
|
if (!/\.[cm]?[jt]sx?$/.test(id)) return;
|
|
1256
1451
|
if (id.includes("\0") || id.includes("virtual:")) return;
|
|
1257
|
-
var
|
|
1258
|
-
|
|
1259
|
-
var
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
var
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
id,
|
|
1279
|
-
code
|
|
1280
|
-
}));
|
|
1281
|
-
var compilerPluginIndex = (_ref = babelOptions === null || babelOptions === void 0 ? void 0 : (_babelOptions_plugins1 = babelOptions.plugins) === null || _babelOptions_plugins1 === void 0 ? void 0 : _babelOptions_plugins1.findIndex(function(x) {
|
|
1282
|
-
return Array.isArray(x) && x[0] === "babel-plugin-react-compiler";
|
|
1283
|
-
})) !== null && _ref !== void 0 ? _ref : -1;
|
|
1284
|
-
if (compilerPluginIndex !== -1) {
|
|
1285
|
-
if (useWorklets) {
|
|
1286
|
-
var prepared = compiler.prepareWorkletsForReactCompiler(id, curCode, sourceMaps);
|
|
1287
|
-
if (prepared) {
|
|
1288
|
-
curCode = prepared.code;
|
|
1289
|
-
if (prepared.map) intermediateMaps.push(prepared.map);
|
|
1290
|
-
}
|
|
1291
|
-
}
|
|
1292
|
-
var compilerPluginOptions = babelOptions.plugins[compilerPluginIndex][1] || {};
|
|
1293
|
-
if (!(compilerPluginOptions.compiler === "babel" || process.env.ONE_REACT_COMPILER === "babel" || process.env.VXRN_REACT_COMPILER === "babel")) {
|
|
1294
|
-
var compilerOut = await compiler.transformOxcReactCompiler(id, curCode, compilerPluginOptions, sourceMaps);
|
|
1295
|
-
if (compilerOut === null || compilerOut === void 0 ? void 0 : compilerOut.code) {
|
|
1296
|
-
curCode = compilerOut.code;
|
|
1297
|
-
if (sourceMaps && compilerOut.map) intermediateMaps.push(compilerOut.map);
|
|
1298
|
-
}
|
|
1299
|
-
babelOptions.plugins.splice(compilerPluginIndex, 1);
|
|
1300
|
-
if (babelOptions.plugins.length === 0 && !babelOptions.configFile && !babelOptions.babelrc) babelOptions = null;
|
|
1452
|
+
var active = "transform";
|
|
1453
|
+
var failed = false;
|
|
1454
|
+
var mark;
|
|
1455
|
+
if (trace) try {
|
|
1456
|
+
var record = trace(id);
|
|
1457
|
+
if (record) mark = function mark2(stage, status) {
|
|
1458
|
+
active = status === "start" ? stage : "transform";
|
|
1459
|
+
try {
|
|
1460
|
+
record(stage, status);
|
|
1461
|
+
} catch (unused) {}
|
|
1462
|
+
};
|
|
1463
|
+
} catch (unused) {}
|
|
1464
|
+
mark === null || mark === void 0 || mark("transform", "start");
|
|
1465
|
+
try {
|
|
1466
|
+
var _ref;
|
|
1467
|
+
var _babelOptions_plugins, _babelOptions_plugins1;
|
|
1468
|
+
var needsRefresh = isRefreshCandidate(id);
|
|
1469
|
+
if (!compiler) {
|
|
1470
|
+
mark === null || mark === void 0 || mark("compiler-import", "start");
|
|
1471
|
+
compiler = await import("@vxrn/compiler");
|
|
1472
|
+
mark === null || mark === void 0 || mark("compiler-import", "end");
|
|
1301
1473
|
}
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1474
|
+
var props = {
|
|
1475
|
+
id,
|
|
1476
|
+
code,
|
|
1305
1477
|
projectRoot,
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1478
|
+
development: dev,
|
|
1479
|
+
environment: platform === "android" ? "android" : "ios",
|
|
1480
|
+
reactForRNVersion: "19"
|
|
1481
|
+
};
|
|
1482
|
+
mark === null || mark === void 0 || mark("options", "start");
|
|
1483
|
+
var babelOptions = compiler.getBabelOptions(props);
|
|
1484
|
+
mark === null || mark === void 0 || mark("options", "end");
|
|
1485
|
+
var curCode = code;
|
|
1486
|
+
var intermediateMaps = [];
|
|
1487
|
+
var isWorkletPlugin = function isWorkletPlugin2(entry) {
|
|
1488
|
+
if (!entry) return false;
|
|
1489
|
+
var name = typeof entry === "string" ? entry : Array.isArray(entry) ? entry[0] : null;
|
|
1490
|
+
return typeof name === "string" && (name.includes("react-native-worklets") || name.includes("react-native-reanimated"));
|
|
1491
|
+
};
|
|
1492
|
+
var workletEntry = babelOptions === null || babelOptions === void 0 ? void 0 : (_babelOptions_plugins = babelOptions.plugins) === null || _babelOptions_plugins === void 0 ? void 0 : _babelOptions_plugins.find(isWorkletPlugin);
|
|
1493
|
+
var workletPluginOptions = Array.isArray(workletEntry) ? workletEntry[1] : void 0;
|
|
1494
|
+
var useWorklets = compiler.isNativeWorkletsEnabled() && (Boolean(workletEntry) || compiler.shouldTransformWorklets({
|
|
1495
|
+
id,
|
|
1496
|
+
code
|
|
1497
|
+
}));
|
|
1498
|
+
var compilerPluginIndex = (_ref = babelOptions === null || babelOptions === void 0 ? void 0 : (_babelOptions_plugins1 = babelOptions.plugins) === null || _babelOptions_plugins1 === void 0 ? void 0 : _babelOptions_plugins1.findIndex(function(x) {
|
|
1499
|
+
return Array.isArray(x) && x[0] === "babel-plugin-react-compiler";
|
|
1500
|
+
})) !== null && _ref !== void 0 ? _ref : -1;
|
|
1501
|
+
if (compilerPluginIndex !== -1) {
|
|
1502
|
+
if (useWorklets) {
|
|
1503
|
+
mark === null || mark === void 0 || mark("worklets-prepare", "start");
|
|
1504
|
+
var prepared = compiler.prepareWorkletsForReactCompiler(id, curCode, sourceMaps);
|
|
1505
|
+
mark === null || mark === void 0 || mark("worklets-prepare", "end");
|
|
1506
|
+
if (prepared) {
|
|
1507
|
+
curCode = prepared.code;
|
|
1508
|
+
if (prepared.map) intermediateMaps.push(prepared.map);
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
var compilerPluginOptions = babelOptions.plugins[compilerPluginIndex][1] || {};
|
|
1512
|
+
if (!(compilerPluginOptions.compiler === "babel" || process.env.ONE_REACT_COMPILER === "babel" || process.env.VXRN_REACT_COMPILER === "babel")) {
|
|
1513
|
+
mark === null || mark === void 0 || mark("oxc-react-compiler", "start");
|
|
1514
|
+
var compilerOut = await compiler.transformOxcReactCompiler(id, curCode, compilerPluginOptions, sourceMaps);
|
|
1515
|
+
mark === null || mark === void 0 || mark("oxc-react-compiler", "end");
|
|
1516
|
+
if (compilerOut === null || compilerOut === void 0 ? void 0 : compilerOut.code) {
|
|
1517
|
+
curCode = compilerOut.code;
|
|
1518
|
+
if (sourceMaps && compilerOut.map) intermediateMaps.push(compilerOut.map);
|
|
1519
|
+
}
|
|
1520
|
+
babelOptions.plugins.splice(compilerPluginIndex, 1);
|
|
1521
|
+
if (babelOptions.plugins.length === 0 && !babelOptions.configFile && !babelOptions.babelrc) babelOptions = null;
|
|
1522
|
+
}
|
|
1311
1523
|
}
|
|
1312
|
-
if (
|
|
1313
|
-
|
|
1314
|
-
|
|
1524
|
+
if (useWorklets) {
|
|
1525
|
+
mark === null || mark === void 0 || mark("worklets", "start");
|
|
1526
|
+
var workletOut = await compiler.transformWorklets(id, curCode, sourceMaps, {
|
|
1527
|
+
projectRoot,
|
|
1528
|
+
...workletPluginOptions
|
|
1315
1529
|
});
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
var remapping = (await import("@jridgewell/remapping")).default;
|
|
1325
|
-
finalMap = remapping(intermediateMaps.slice().reverse(), function() {
|
|
1326
|
-
return null;
|
|
1530
|
+
mark === null || mark === void 0 || mark("worklets", "end");
|
|
1531
|
+
if (workletOut === null || workletOut === void 0 ? void 0 : workletOut.code) {
|
|
1532
|
+
curCode = workletOut.code;
|
|
1533
|
+
if (sourceMaps && workletOut.map) intermediateMaps.push(workletOut.map);
|
|
1534
|
+
}
|
|
1535
|
+
if (babelOptions === null || babelOptions === void 0 ? void 0 : babelOptions.plugins) {
|
|
1536
|
+
babelOptions.plugins = babelOptions.plugins.filter(function(entry) {
|
|
1537
|
+
return !isWorkletPlugin(entry);
|
|
1327
1538
|
});
|
|
1539
|
+
if (babelOptions.plugins.length === 0 && !babelOptions.configFile && !babelOptions.babelrc) babelOptions = null;
|
|
1328
1540
|
}
|
|
1329
|
-
return {
|
|
1330
|
-
code: curCode,
|
|
1331
|
-
map: finalMap
|
|
1332
|
-
};
|
|
1333
1541
|
}
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
...babelOptions,
|
|
1339
|
-
sourceMaps: true,
|
|
1340
|
-
sourceFileName: id
|
|
1341
|
-
};
|
|
1342
|
-
delete babelOptions.inputSourceMap;
|
|
1343
|
-
}
|
|
1344
|
-
if (babelOptions) {
|
|
1345
|
-
var result = await compiler.transformBabel(id, curCode, babelOptions);
|
|
1346
|
-
if (result === null || result === void 0 ? void 0 : result.code) {
|
|
1347
|
-
curCode = result.code;
|
|
1348
|
-
if (sourceMaps && result.map) intermediateMaps.push(result.map);
|
|
1349
|
-
if (!needsRefresh) {
|
|
1350
|
-
var finalMap1 = void 0;
|
|
1351
|
-
if (sourceMaps && intermediateMaps.length > 0) if (intermediateMaps.length === 1) finalMap1 = intermediateMaps[0];
|
|
1542
|
+
if (!babelOptions && !needsRefresh) {
|
|
1543
|
+
if (curCode !== code) {
|
|
1544
|
+
var finalMap = void 0;
|
|
1545
|
+
if (sourceMaps && intermediateMaps.length > 0) if (intermediateMaps.length === 1) finalMap = intermediateMaps[0];
|
|
1352
1546
|
else {
|
|
1353
|
-
var
|
|
1354
|
-
|
|
1547
|
+
var remapping = (await import("@jridgewell/remapping")).default;
|
|
1548
|
+
finalMap = remapping(intermediateMaps.slice().reverse(), function() {
|
|
1355
1549
|
return null;
|
|
1356
1550
|
});
|
|
1357
1551
|
}
|
|
1358
1552
|
return {
|
|
1359
1553
|
code: curCode,
|
|
1360
|
-
map:
|
|
1554
|
+
map: finalMap
|
|
1361
1555
|
};
|
|
1362
1556
|
}
|
|
1557
|
+
return;
|
|
1363
1558
|
}
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1559
|
+
if (sourceMaps && babelOptions) {
|
|
1560
|
+
babelOptions = {
|
|
1561
|
+
...babelOptions,
|
|
1562
|
+
sourceMaps: true,
|
|
1563
|
+
sourceFileName: id
|
|
1564
|
+
};
|
|
1565
|
+
delete babelOptions.inputSourceMap;
|
|
1566
|
+
}
|
|
1567
|
+
if (babelOptions) {
|
|
1568
|
+
mark === null || mark === void 0 || mark("babel", "start");
|
|
1569
|
+
var result = await compiler.transformBabel(id, curCode, babelOptions);
|
|
1570
|
+
mark === null || mark === void 0 || mark("babel", "end");
|
|
1571
|
+
if (result === null || result === void 0 ? void 0 : result.code) {
|
|
1572
|
+
curCode = result.code;
|
|
1573
|
+
if (sourceMaps && result.map) intermediateMaps.push(result.map);
|
|
1574
|
+
if (!needsRefresh) {
|
|
1575
|
+
var finalMap1 = void 0;
|
|
1576
|
+
if (sourceMaps && intermediateMaps.length > 0) if (intermediateMaps.length === 1) finalMap1 = intermediateMaps[0];
|
|
1577
|
+
else {
|
|
1578
|
+
var remapping1 = (await import("@jridgewell/remapping")).default;
|
|
1579
|
+
finalMap1 = remapping1(intermediateMaps.slice().reverse(), function() {
|
|
1580
|
+
return null;
|
|
1581
|
+
});
|
|
1582
|
+
}
|
|
1583
|
+
return {
|
|
1584
|
+
code: curCode,
|
|
1585
|
+
map: finalMap1
|
|
1586
|
+
};
|
|
1377
1587
|
}
|
|
1378
|
-
}
|
|
1379
|
-
reactCompiler: false,
|
|
1380
|
-
sourcemap: sourceMaps
|
|
1381
|
-
});
|
|
1382
|
-
if (res.fatal) {
|
|
1383
|
-
var _res_errors;
|
|
1384
|
-
throw new Error(`[vxrn:compiler] oxc react transform failed on ${id}: ${((_res_errors = res.errors) !== null && _res_errors !== void 0 ? _res_errors : []).map(function(e) {
|
|
1385
|
-
var _e_message;
|
|
1386
|
-
return (_e_message = e.message) !== null && _e_message !== void 0 ? _e_message : String(e);
|
|
1387
|
-
}).join(", ")}`);
|
|
1588
|
+
}
|
|
1388
1589
|
}
|
|
1389
|
-
|
|
1590
|
+
if (needsRefresh) {
|
|
1591
|
+
var _compiler_configuration;
|
|
1592
|
+
mark === null || mark === void 0 || mark("refresh-import", "start");
|
|
1593
|
+
var { transformSync } = await import("oxc-transform-react");
|
|
1594
|
+
mark === null || mark === void 0 || mark("refresh-import", "end");
|
|
1595
|
+
var jsxImportSource = ((_compiler_configuration = compiler.configuration) === null || _compiler_configuration === void 0 ? void 0 : _compiler_configuration.enableNativewind) && !id.includes("node_modules") ? "nativewind" : "react";
|
|
1596
|
+
mark === null || mark === void 0 || mark("refresh", "start");
|
|
1597
|
+
var res = transformSync(id, curCode, {
|
|
1598
|
+
jsx: {
|
|
1599
|
+
development: dev,
|
|
1600
|
+
runtime: "automatic",
|
|
1601
|
+
importSource: jsxImportSource,
|
|
1602
|
+
refresh: {
|
|
1603
|
+
refreshReg: "__vxrnRefreshReg",
|
|
1604
|
+
refreshSig: "__vxrnRefreshSig"
|
|
1605
|
+
}
|
|
1606
|
+
},
|
|
1607
|
+
reactCompiler: false,
|
|
1608
|
+
sourcemap: sourceMaps
|
|
1609
|
+
});
|
|
1610
|
+
if (res.fatal) {
|
|
1611
|
+
var _res_errors;
|
|
1612
|
+
throw new Error(`[vxrn:compiler] oxc react transform failed on ${id}: ${((_res_errors = res.errors) !== null && _res_errors !== void 0 ? _res_errors : []).map(function(e) {
|
|
1613
|
+
var _e_message;
|
|
1614
|
+
return (_e_message = e.message) !== null && _e_message !== void 0 ? _e_message : String(e);
|
|
1615
|
+
}).join(", ")}`);
|
|
1616
|
+
}
|
|
1617
|
+
mark === null || mark === void 0 || mark("refresh", "end");
|
|
1618
|
+
var header = `var __prevRefreshReg = globalThis.$RefreshReg$;
|
|
1390
1619
|
var __prevRefreshSig = globalThis.$RefreshSig$;
|
|
1391
1620
|
if (globalThis.__ReactRefresh) {
|
|
1392
1621
|
globalThis.$RefreshReg$ = function(type, id) {
|
|
@@ -1399,7 +1628,7 @@ var __vxrnRefreshReg = globalThis.$RefreshReg$;
|
|
|
1399
1628
|
var __vxrnRefreshSig = globalThis.$RefreshSig$;
|
|
1400
1629
|
|
|
1401
1630
|
`;
|
|
1402
|
-
|
|
1631
|
+
var footer = `
|
|
1403
1632
|
|
|
1404
1633
|
globalThis.$RefreshReg$ = __prevRefreshReg;
|
|
1405
1634
|
globalThis.$RefreshSig$ = __prevRefreshSig;
|
|
@@ -1411,31 +1640,38 @@ if (import.meta.hot) {
|
|
|
1411
1640
|
});
|
|
1412
1641
|
}
|
|
1413
1642
|
`;
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1643
|
+
var out;
|
|
1644
|
+
var finalMap2 = void 0;
|
|
1645
|
+
if (sourceMaps) {
|
|
1646
|
+
var MagicString = (await import("magic-string")).default;
|
|
1647
|
+
var ms = new MagicString(res.code);
|
|
1648
|
+
ms.prepend(header);
|
|
1649
|
+
ms.append(footer);
|
|
1650
|
+
out = ms.toString();
|
|
1651
|
+
var allMaps = [
|
|
1652
|
+
ms.generateMap({
|
|
1653
|
+
source: id,
|
|
1654
|
+
hires: true
|
|
1655
|
+
}),
|
|
1656
|
+
res.map,
|
|
1657
|
+
...intermediateMaps.slice().reverse()
|
|
1658
|
+
].filter(Boolean);
|
|
1659
|
+
var remapping2 = (await import("@jridgewell/remapping")).default;
|
|
1660
|
+
finalMap2 = remapping2(allMaps, function() {
|
|
1661
|
+
return null;
|
|
1662
|
+
});
|
|
1663
|
+
} else out = header + res.code + footer;
|
|
1664
|
+
return {
|
|
1665
|
+
code: out,
|
|
1666
|
+
map: finalMap2
|
|
1667
|
+
};
|
|
1668
|
+
}
|
|
1669
|
+
} catch (error) {
|
|
1670
|
+
failed = true;
|
|
1671
|
+
if (active !== "transform") mark === null || mark === void 0 || mark(active, "error");
|
|
1672
|
+
throw error;
|
|
1673
|
+
} finally {
|
|
1674
|
+
mark === null || mark === void 0 || mark("transform", failed ? "error" : "end");
|
|
1439
1675
|
}
|
|
1440
1676
|
}
|
|
1441
1677
|
};
|
|
@@ -2010,9 +2246,9 @@ class ReactNativeDevRuntime extends BaseDevRuntime {
|
|
|
2010
2246
|
}
|
|
2011
2247
|
}
|
|
2012
2248
|
|
|
2013
|
-
|
|
2249
|
+
${NATIVE_DEV_RUNTIME_END}
|
|
2014
2250
|
`;
|
|
2015
2251
|
}
|
|
2016
2252
|
|
|
2017
|
-
export { buildNativeBundle, createNativeDevAssetRegistry, createNativeDevEngine, getHermesSWCIncludes, getHmrRuntimeSource, getNativeAssetData, getNativeTransformConfig, hermesCompatPlugin, hermesCompatSWCPlugin, hermesLoopsPlugin, hmrClientNoopPlugin, nativeAnimatedGuardPlugin, normalizeNativeCommonJSInterop, postProcessNativeBundle, vxrnCompilerPlugin, wrapNativeBundleModuleScope };
|
|
2253
|
+
export { NATIVE_DEV_RUNTIME_END, NATIVE_MODULE_SCOPE_MARKER, buildNativeBundle, createNativeDevAssetRegistry, createNativeDevEngine, getHermesSWCIncludes, getHmrRuntimeSource, getNativeAssetData, getNativeTransformConfig, hermesCompatPlugin, hermesCompatSWCPlugin, hermesLoopsPlugin, hmrClientNoopPlugin, nativeAnimatedGuardPlugin, normalizeNativeCommonJSInterop, postProcessNativeBundle, vxrnCompilerPlugin, wrapNativeBundleModuleScope };
|
|
2018
2254
|
//# sourceMappingURL=createNativeDevEngine.native.js.map
|