rnxsim 0.1.393 → 0.1.395
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/README.md +12 -5
- package/cli/cloud-client.ts +74 -52
- package/cli/cloud-dispatch.ts +2 -1
- package/cli/commands/inspect/core.ts +33 -2
- package/cli/commands/platform.ts +34 -9
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/agent-identity.cjs +1 -1
- package/dist-lib/agent-sessions.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +12 -1
- package/dist-lib/bridge-contract-input.mjs +10 -1
- package/dist-lib/bridge-contract.cjs +7 -1
- package/dist-lib/bridge-contract.mjs +5 -1
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cli-constants.cjs +1 -1
- package/dist-lib/cloud-contract.cjs +29 -3
- package/dist-lib/cloud-contract.mjs +26 -2
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +1 -1
- package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +25 -55
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +132 -8
- package/dist-lib/metro-production-bundle.mjs +129 -6
- package/dist-lib/metro.cjs +3 -55
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/render-mode.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +24 -3
- package/dist-lib/sdk.mjs +24 -3
- package/dist-lib/skills.cjs +28 -25
- package/dist-lib/vite.cjs +1 -1
- package/package.json +1 -1
- package/src/bridge-contract-input.ts +12 -0
- package/src/bridge-contract.ts +7 -0
- package/src/cloud-contract.ts +29 -0
- package/src/metro-plugin.ts +17 -98
- package/src/metro-production-bundle.ts +204 -3
- package/dist-lib/metro-host-modules/react-dom.js +0 -6
- package/dist-lib/metro-host-modules/react-native-web.js +0 -6
- package/dist-lib/metro-host-modules/react-native.js +0 -6
- package/dist-lib/metro-host-modules/react.js +0 -6
- package/dist-lib/metro-host-modules/react__jsx-dev-runtime.js +0 -6
- package/dist-lib/metro-host-modules/react__jsx-runtime.js +0 -6
- package/src/metro-host-modules/react-dom.js +0 -6
- package/src/metro-host-modules/react-native-web.js +0 -6
- package/src/metro-host-modules/react-native.js +0 -6
- package/src/metro-host-modules/react.js +0 -6
- package/src/metro-host-modules/react__jsx-dev-runtime.js +0 -6
- package/src/metro-host-modules/react__jsx-runtime.js +0 -6
|
@@ -1,13 +1,37 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.395 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
|
|
3
3
|
// src/cloud-contract.ts
|
|
4
4
|
var RNX_CLOUD_MAX_ARTIFACT_BYTES = 20 * 1024 * 1024;
|
|
5
5
|
var RNX_CLOUD_DESIGN_PARALLEL_JOB_LIMIT = 16;
|
|
6
6
|
var RNX_CLOUD_DESIGN_MAX_STORAGE_ENTRIES = 256;
|
|
7
7
|
var RNX_CLOUD_DESIGN_MAX_STORAGE_BYTES = 1024 * 1024;
|
|
8
|
+
var RNX_CLOUD_COMMAND_TYPES = Object.freeze([
|
|
9
|
+
"state",
|
|
10
|
+
"query",
|
|
11
|
+
"resolve",
|
|
12
|
+
"perform",
|
|
13
|
+
"waitFor",
|
|
14
|
+
"reset",
|
|
15
|
+
"screenshot",
|
|
16
|
+
"capture",
|
|
17
|
+
"captureRegions",
|
|
18
|
+
"settle",
|
|
19
|
+
"setAppearance",
|
|
20
|
+
"openUrl",
|
|
21
|
+
"tree",
|
|
22
|
+
"tap",
|
|
23
|
+
"longPress",
|
|
24
|
+
"memory"
|
|
25
|
+
]);
|
|
26
|
+
var RNX_CLOUD_COMMAND_TYPE_SET = new Set(RNX_CLOUD_COMMAND_TYPES);
|
|
27
|
+
function isRnxCloudCommandType(value) {
|
|
28
|
+
return RNX_CLOUD_COMMAND_TYPE_SET.has(value);
|
|
29
|
+
}
|
|
8
30
|
export {
|
|
31
|
+
RNX_CLOUD_COMMAND_TYPES,
|
|
9
32
|
RNX_CLOUD_DESIGN_MAX_STORAGE_BYTES,
|
|
10
33
|
RNX_CLOUD_DESIGN_MAX_STORAGE_ENTRIES,
|
|
11
34
|
RNX_CLOUD_DESIGN_PARALLEL_JOB_LIMIT,
|
|
12
|
-
RNX_CLOUD_MAX_ARTIFACT_BYTES
|
|
35
|
+
RNX_CLOUD_MAX_ARTIFACT_BYTES,
|
|
36
|
+
isRnxCloudCommandType
|
|
13
37
|
};
|
package/dist-lib/config.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.395 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
package/dist-lib/detox/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.395 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.395 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
package/dist-lib/home-paths.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.395 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.395 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.395 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.395 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.395 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
|
|
3
3
|
// src/host/fetch-proxy-overrides.ts
|
|
4
4
|
var FETCH_PROXY_BROWSER_USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.395 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.395 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
package/dist-lib/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.395 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -506,6 +506,25 @@ function isDevBridgeLockfileFresh(lock, now = Date.now()) {
|
|
|
506
506
|
// src/cloud-contract.ts
|
|
507
507
|
var RNX_CLOUD_MAX_ARTIFACT_BYTES = 20 * 1024 * 1024;
|
|
508
508
|
var RNX_CLOUD_DESIGN_MAX_STORAGE_BYTES = 1024 * 1024;
|
|
509
|
+
var RNX_CLOUD_COMMAND_TYPES = Object.freeze([
|
|
510
|
+
"state",
|
|
511
|
+
"query",
|
|
512
|
+
"resolve",
|
|
513
|
+
"perform",
|
|
514
|
+
"waitFor",
|
|
515
|
+
"reset",
|
|
516
|
+
"screenshot",
|
|
517
|
+
"capture",
|
|
518
|
+
"captureRegions",
|
|
519
|
+
"settle",
|
|
520
|
+
"setAppearance",
|
|
521
|
+
"openUrl",
|
|
522
|
+
"tree",
|
|
523
|
+
"tap",
|
|
524
|
+
"longPress",
|
|
525
|
+
"memory"
|
|
526
|
+
]);
|
|
527
|
+
var RNX_CLOUD_COMMAND_TYPE_SET = new Set(RNX_CLOUD_COMMAND_TYPES);
|
|
509
528
|
|
|
510
529
|
// src/public-brand.ts
|
|
511
530
|
var name = "rnx";
|
|
@@ -1934,8 +1953,9 @@ async function inspectWaitReady(bridge, timeoutMs = 2e4, options = {}) {
|
|
|
1934
1953
|
};
|
|
1935
1954
|
}
|
|
1936
1955
|
const probe = result.probe;
|
|
1956
|
+
const externalError = probe?.externalError ?? "";
|
|
1937
1957
|
const status = {
|
|
1938
|
-
ready: result.matched,
|
|
1958
|
+
ready: result.matched && !externalError,
|
|
1939
1959
|
elapsedMs: result.elapsedMs,
|
|
1940
1960
|
nodes: probe?.nodes ?? 0,
|
|
1941
1961
|
targets: probe?.targets ?? 0,
|
|
@@ -1946,7 +1966,7 @@ async function inspectWaitReady(bridge, timeoutMs = 2e4, options = {}) {
|
|
|
1946
1966
|
loadingText: probe?.loadingText ?? "",
|
|
1947
1967
|
externalReady: probe?.externalReady ?? null,
|
|
1948
1968
|
externalStatus: probe?.externalStatus ?? "",
|
|
1949
|
-
externalError
|
|
1969
|
+
externalError,
|
|
1950
1970
|
suppressedEntryError: probe?.suppressedEntryError ?? "",
|
|
1951
1971
|
errors: probe?.errors ?? 0,
|
|
1952
1972
|
bridgeError: result.error ?? ""
|
|
@@ -3471,7 +3491,6 @@ var import_node_crypto4 = require("node:crypto");
|
|
|
3471
3491
|
var import_path4 = __toESM(require("path"), 1);
|
|
3472
3492
|
|
|
3473
3493
|
// src/metro-production-bundle.ts
|
|
3474
|
-
var RNXSIM_METRO_PRODUCTION_BUNDLE_OPTION = "rnxsim";
|
|
3475
3494
|
var RNXSIM_METRO_MODULE_PATHS_PREFIX = "globalThis.__sootsimModulePaths=";
|
|
3476
3495
|
function createRNXMetroModulePathsFooter(modulePaths) {
|
|
3477
3496
|
const payload = JSON.stringify(modulePaths).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029").replace(/<\//g, "<\\/");
|
|
@@ -3481,35 +3500,6 @@ ${RNXSIM_METRO_MODULE_PATHS_PREFIX}${payload};`;
|
|
|
3481
3500
|
|
|
3482
3501
|
// src/metro-plugin.ts
|
|
3483
3502
|
var prefix = "/__soot";
|
|
3484
|
-
var hostModuleSpecifiers = [
|
|
3485
|
-
"react",
|
|
3486
|
-
"react-dom",
|
|
3487
|
-
"react/jsx-runtime",
|
|
3488
|
-
"react/jsx-dev-runtime",
|
|
3489
|
-
"react-native",
|
|
3490
|
-
"react-native-web"
|
|
3491
|
-
];
|
|
3492
|
-
function isRNXProductionBundle(graph) {
|
|
3493
|
-
return graph.transformOptions?.dev === false && graph.transformOptions.customTransformOptions?.[RNXSIM_METRO_PRODUCTION_BUNDLE_OPTION] === "true";
|
|
3494
|
-
}
|
|
3495
|
-
function assertProductionEnvironment() {
|
|
3496
|
-
if (process.env.NODE_ENV === "production") return;
|
|
3497
|
-
throw new Error(
|
|
3498
|
-
"rnxsim: production bundle requests require NODE_ENV=production; restart Metro with NODE_ENV=production"
|
|
3499
|
-
);
|
|
3500
|
-
}
|
|
3501
|
-
function hostModuleFileName(specifier) {
|
|
3502
|
-
return `${specifier.replaceAll("/", "__")}.js`;
|
|
3503
|
-
}
|
|
3504
|
-
function resolveHostModules() {
|
|
3505
|
-
const root = import_path4.default.join(__dirname, "metro-host-modules");
|
|
3506
|
-
const files = /* @__PURE__ */ new Map();
|
|
3507
|
-
for (const specifier of hostModuleSpecifiers) {
|
|
3508
|
-
const filePath = import_path4.default.join(root, hostModuleFileName(specifier));
|
|
3509
|
-
files.set(specifier, filePath);
|
|
3510
|
-
}
|
|
3511
|
-
return { root, files };
|
|
3512
|
-
}
|
|
3513
3503
|
function readCallableMetroExport(moduleValue, label) {
|
|
3514
3504
|
const callable = typeof moduleValue === "function" ? moduleValue : typeof moduleValue === "object" && moduleValue !== null ? Reflect.get(moduleValue, "default") : void 0;
|
|
3515
3505
|
if (typeof callable !== "function") {
|
|
@@ -3539,7 +3529,7 @@ function createMetroDefaultSerializer(projectRoot) {
|
|
|
3539
3529
|
return code;
|
|
3540
3530
|
};
|
|
3541
3531
|
}
|
|
3542
|
-
function
|
|
3532
|
+
function appendRNXModulePaths(result, graph, options, projectRoot) {
|
|
3543
3533
|
const dependencies = graph.dependencies;
|
|
3544
3534
|
const createModuleId = options.createModuleId;
|
|
3545
3535
|
if (!dependencies || !createModuleId) {
|
|
@@ -3572,44 +3562,24 @@ function withRNX(config, options = {}) {
|
|
|
3572
3562
|
cfgProjectRoot,
|
|
3573
3563
|
appName
|
|
3574
3564
|
);
|
|
3575
|
-
const cfgResolver = config.resolver;
|
|
3576
3565
|
const cfgSerializer = config.serializer;
|
|
3577
3566
|
const existingEnhance = cfgServer?.enhanceMiddleware;
|
|
3578
|
-
const existingResolveRequest = cfgResolver?.resolveRequest;
|
|
3579
3567
|
const existingSerializer = cfgSerializer?.customSerializer;
|
|
3580
3568
|
let productionConfig = {};
|
|
3581
3569
|
if (options.productionBundles) {
|
|
3582
|
-
const hostModules = resolveHostModules();
|
|
3583
3570
|
let defaultSerializer;
|
|
3584
3571
|
productionConfig = {
|
|
3585
|
-
watchFolders: [
|
|
3586
|
-
...config.watchFolders || [],
|
|
3587
|
-
hostModules.root
|
|
3588
|
-
],
|
|
3589
|
-
resolver: {
|
|
3590
|
-
...cfgResolver,
|
|
3591
|
-
resolveRequest: (context, moduleName, platform) => {
|
|
3592
|
-
if (context.customResolverOptions?.[RNXSIM_METRO_PRODUCTION_BUNDLE_OPTION] === "true") {
|
|
3593
|
-
assertProductionEnvironment();
|
|
3594
|
-
const hostModule = hostModules.files.get(moduleName);
|
|
3595
|
-
if (hostModule) return { type: "sourceFile", filePath: hostModule };
|
|
3596
|
-
}
|
|
3597
|
-
return existingResolveRequest ? existingResolveRequest(context, moduleName, platform) : context.resolveRequest(context, moduleName, platform);
|
|
3598
|
-
}
|
|
3599
|
-
},
|
|
3600
3572
|
serializer: {
|
|
3601
3573
|
...cfgSerializer,
|
|
3602
3574
|
customSerializer: async (entryPoint, preModules, graph, serializerOptions) => {
|
|
3603
3575
|
const serializer = existingSerializer || (defaultSerializer ||= createMetroDefaultSerializer(cfgProjectRoot));
|
|
3604
|
-
const productionBundle = isRNXProductionBundle(graph);
|
|
3605
|
-
if (productionBundle) assertProductionEnvironment();
|
|
3606
3576
|
const result = await serializer(
|
|
3607
3577
|
entryPoint,
|
|
3608
3578
|
preModules,
|
|
3609
3579
|
graph,
|
|
3610
3580
|
serializerOptions
|
|
3611
3581
|
);
|
|
3612
|
-
return
|
|
3582
|
+
return graph.transformOptions?.dev === false ? appendRNXModulePaths(result, graph, serializerOptions, cfgProjectRoot) : result;
|
|
3613
3583
|
}
|
|
3614
3584
|
}
|
|
3615
3585
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.395 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
package/dist-lib/menu.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.395 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
package/dist-lib/menu.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.395 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -22,13 +22,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
22
22
|
// src/metro-production-bundle.ts
|
|
23
23
|
var metro_production_bundle_exports = {};
|
|
24
24
|
__export(metro_production_bundle_exports, {
|
|
25
|
-
RNXSIM_METRO_PRODUCTION_BUNDLE_OPTION: () => RNXSIM_METRO_PRODUCTION_BUNDLE_OPTION,
|
|
26
25
|
createRNXMetroModulePathsFooter: () => createRNXMetroModulePathsFooter,
|
|
26
|
+
readRNXMetroBundleLayout: () => readRNXMetroBundleLayout,
|
|
27
27
|
readRNXMetroModuleIdentity: () => readRNXMetroModuleIdentity,
|
|
28
|
-
toRNXProductionBundleUrl: () => toRNXProductionBundleUrl
|
|
28
|
+
toRNXProductionBundleUrl: () => toRNXProductionBundleUrl,
|
|
29
|
+
validateRNXMetroModulePaths: () => validateRNXMetroModulePaths
|
|
29
30
|
});
|
|
30
31
|
module.exports = __toCommonJS(metro_production_bundle_exports);
|
|
31
|
-
var RNXSIM_METRO_PRODUCTION_BUNDLE_OPTION = "rnxsim";
|
|
32
32
|
var RNXSIM_METRO_MODULE_PATHS_PREFIX = "globalThis.__sootsimModulePaths=";
|
|
33
33
|
function toRNXProductionBundleUrl(bundleUrl) {
|
|
34
34
|
const relative = bundleUrl.startsWith("/");
|
|
@@ -36,8 +36,6 @@ function toRNXProductionBundleUrl(bundleUrl) {
|
|
|
36
36
|
url.searchParams.set("dev", "false");
|
|
37
37
|
url.searchParams.set("hot", "false");
|
|
38
38
|
url.searchParams.set("minify", "true");
|
|
39
|
-
url.searchParams.set(`resolver.${RNXSIM_METRO_PRODUCTION_BUNDLE_OPTION}`, "true");
|
|
40
|
-
url.searchParams.set(`transform.${RNXSIM_METRO_PRODUCTION_BUNDLE_OPTION}`, "true");
|
|
41
39
|
return relative ? `${url.pathname}${url.search}${url.hash}` : url.toString();
|
|
42
40
|
}
|
|
43
41
|
function createRNXMetroModulePathsFooter(modulePaths) {
|
|
@@ -63,10 +61,136 @@ ${RNXSIM_METRO_MODULE_PATHS_PREFIX}`;
|
|
|
63
61
|
}
|
|
64
62
|
return { source: bundleText.slice(0, footerStart), modulePaths };
|
|
65
63
|
}
|
|
64
|
+
function readDefineTail(source, start, end) {
|
|
65
|
+
let cursor = end;
|
|
66
|
+
while (cursor > start && (source[cursor] === " " || source[cursor] === "\n" || source[cursor] === " " || source[cursor] === ";")) {
|
|
67
|
+
cursor--;
|
|
68
|
+
}
|
|
69
|
+
if (source[cursor] !== ")") return null;
|
|
70
|
+
cursor--;
|
|
71
|
+
while (cursor > start && /\s/.test(source[cursor])) cursor--;
|
|
72
|
+
if (source[cursor] !== "]") return null;
|
|
73
|
+
const dependenciesEnd = cursor + 1;
|
|
74
|
+
let depth = 1;
|
|
75
|
+
cursor--;
|
|
76
|
+
while (cursor > start && depth > 0) {
|
|
77
|
+
const character = source[cursor];
|
|
78
|
+
if (character === "]") depth++;
|
|
79
|
+
else if (character === "[") depth--;
|
|
80
|
+
if (depth === 0) break;
|
|
81
|
+
cursor--;
|
|
82
|
+
}
|
|
83
|
+
if (depth !== 0) return null;
|
|
84
|
+
const dependenciesStart = cursor;
|
|
85
|
+
let idEnd = cursor - 1;
|
|
86
|
+
while (idEnd > start && /\s/.test(source[idEnd])) idEnd--;
|
|
87
|
+
if (source[idEnd] !== ",") return null;
|
|
88
|
+
let idStart = idEnd;
|
|
89
|
+
while (idStart > start && /[0-9a-fA-FxX.+\-]/.test(source[idStart - 1])) idStart--;
|
|
90
|
+
const literal = source.slice(idStart, idEnd);
|
|
91
|
+
if (!/^-?(?:0[xXbBoO][0-9a-fA-F]+|\d+(?:\.\d*)?(?:[eE][+-]?\d+)?)$/.test(literal)) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
const moduleId = Number(literal);
|
|
95
|
+
if (!Number.isSafeInteger(moduleId)) return null;
|
|
96
|
+
let factoryEnd = idStart - 1;
|
|
97
|
+
while (factoryEnd > start && /\s/.test(source[factoryEnd])) factoryEnd--;
|
|
98
|
+
if (source[factoryEnd] !== ",") return null;
|
|
99
|
+
return {
|
|
100
|
+
moduleId,
|
|
101
|
+
factoryEnd,
|
|
102
|
+
dependenciesStart,
|
|
103
|
+
dependenciesEnd
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function readRNXMetroBundleLayout(source) {
|
|
107
|
+
const lineOffsets = [0];
|
|
108
|
+
for (let index = 0; index < source.length; index++) {
|
|
109
|
+
if (source.charCodeAt(index) === 10) lineOffsets.push(index + 1);
|
|
110
|
+
}
|
|
111
|
+
const boundaries = [];
|
|
112
|
+
for (let lineIndex = 0; lineIndex < lineOffsets.length; lineIndex++) {
|
|
113
|
+
const start = lineOffsets[lineIndex];
|
|
114
|
+
if (source.startsWith("__d(", start) || source.startsWith("__r(", start)) {
|
|
115
|
+
boundaries.push(lineIndex);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
const statements = [];
|
|
119
|
+
let moduleIdFailures = 0;
|
|
120
|
+
for (let index = 0; index < boundaries.length; index++) {
|
|
121
|
+
const lineIndex = boundaries[index];
|
|
122
|
+
const start = lineOffsets[lineIndex];
|
|
123
|
+
const nextLineIndex = boundaries[index + 1];
|
|
124
|
+
const endLineIndex = nextLineIndex !== void 0 ? nextLineIndex - 1 : lineOffsets.length - 1;
|
|
125
|
+
const end = nextLineIndex !== void 0 ? lineOffsets[nextLineIndex] : source.length;
|
|
126
|
+
if (!source.startsWith("__d(", start)) {
|
|
127
|
+
statements.push({ kind: "run", start, end, lineIndex, endLineIndex });
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
const tail = readDefineTail(source, start, end - 1);
|
|
131
|
+
if (!tail) {
|
|
132
|
+
moduleIdFailures++;
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
statements.push({
|
|
136
|
+
kind: "define",
|
|
137
|
+
moduleId: tail.moduleId,
|
|
138
|
+
start,
|
|
139
|
+
end,
|
|
140
|
+
lineIndex,
|
|
141
|
+
endLineIndex,
|
|
142
|
+
factory: { start: start + "__d(".length, end: tail.factoryEnd },
|
|
143
|
+
dependencies: { start: tail.dependenciesStart, end: tail.dependenciesEnd }
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
return {
|
|
147
|
+
prelude: source.slice(
|
|
148
|
+
0,
|
|
149
|
+
boundaries.length > 0 ? lineOffsets[boundaries[0]] : source.length
|
|
150
|
+
),
|
|
151
|
+
statements,
|
|
152
|
+
moduleIdFailures
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function validateRNXMetroModulePaths(source, modulePaths) {
|
|
156
|
+
const layout = readRNXMetroBundleLayout(source);
|
|
157
|
+
if (layout.moduleIdFailures > 0) {
|
|
158
|
+
throw new Error(
|
|
159
|
+
`Metro module identity could not read ${layout.moduleIdFailures} module IDs`
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
const definedIds = /* @__PURE__ */ new Set();
|
|
163
|
+
for (const statement of layout.statements) {
|
|
164
|
+
if (statement.kind !== "define") continue;
|
|
165
|
+
if (definedIds.has(statement.moduleId)) {
|
|
166
|
+
throw new Error(`Metro module identity has duplicate module ${statement.moduleId}`);
|
|
167
|
+
}
|
|
168
|
+
definedIds.add(statement.moduleId);
|
|
169
|
+
if (!Object.prototype.hasOwnProperty.call(modulePaths, String(statement.moduleId))) {
|
|
170
|
+
throw new Error(`Metro module identity is missing ${statement.moduleId}`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (definedIds.size === 0) {
|
|
174
|
+
throw new Error("Metro module identity found no canonical JavaScript modules");
|
|
175
|
+
}
|
|
176
|
+
for (const [key, modulePath] of Object.entries(modulePaths)) {
|
|
177
|
+
const moduleId = Number(key);
|
|
178
|
+
if (!Number.isSafeInteger(moduleId) || String(moduleId) !== key) {
|
|
179
|
+
throw new Error(`Metro module identity has invalid module ID ${key}`);
|
|
180
|
+
}
|
|
181
|
+
if (typeof modulePath !== "string" || modulePath.length === 0) {
|
|
182
|
+
throw new Error(`Metro module identity has no path for ${key}`);
|
|
183
|
+
}
|
|
184
|
+
if (!definedIds.has(moduleId)) {
|
|
185
|
+
throw new Error(`Metro module identity has no module ${key}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
66
189
|
// Annotate the CommonJS export names for ESM import in node:
|
|
67
190
|
0 && (module.exports = {
|
|
68
|
-
RNXSIM_METRO_PRODUCTION_BUNDLE_OPTION,
|
|
69
191
|
createRNXMetroModulePathsFooter,
|
|
192
|
+
readRNXMetroBundleLayout,
|
|
70
193
|
readRNXMetroModuleIdentity,
|
|
71
|
-
toRNXProductionBundleUrl
|
|
194
|
+
toRNXProductionBundleUrl,
|
|
195
|
+
validateRNXMetroModulePaths
|
|
72
196
|
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.395 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
|
|
3
3
|
// src/metro-production-bundle.ts
|
|
4
|
-
var RNXSIM_METRO_PRODUCTION_BUNDLE_OPTION = "rnxsim";
|
|
5
4
|
var RNXSIM_METRO_MODULE_PATHS_PREFIX = "globalThis.__sootsimModulePaths=";
|
|
6
5
|
function toRNXProductionBundleUrl(bundleUrl) {
|
|
7
6
|
const relative = bundleUrl.startsWith("/");
|
|
@@ -9,8 +8,6 @@ function toRNXProductionBundleUrl(bundleUrl) {
|
|
|
9
8
|
url.searchParams.set("dev", "false");
|
|
10
9
|
url.searchParams.set("hot", "false");
|
|
11
10
|
url.searchParams.set("minify", "true");
|
|
12
|
-
url.searchParams.set(`resolver.${RNXSIM_METRO_PRODUCTION_BUNDLE_OPTION}`, "true");
|
|
13
|
-
url.searchParams.set(`transform.${RNXSIM_METRO_PRODUCTION_BUNDLE_OPTION}`, "true");
|
|
14
11
|
return relative ? `${url.pathname}${url.search}${url.hash}` : url.toString();
|
|
15
12
|
}
|
|
16
13
|
function createRNXMetroModulePathsFooter(modulePaths) {
|
|
@@ -36,9 +33,135 @@ ${RNXSIM_METRO_MODULE_PATHS_PREFIX}`;
|
|
|
36
33
|
}
|
|
37
34
|
return { source: bundleText.slice(0, footerStart), modulePaths };
|
|
38
35
|
}
|
|
36
|
+
function readDefineTail(source, start, end) {
|
|
37
|
+
let cursor = end;
|
|
38
|
+
while (cursor > start && (source[cursor] === " " || source[cursor] === "\n" || source[cursor] === " " || source[cursor] === ";")) {
|
|
39
|
+
cursor--;
|
|
40
|
+
}
|
|
41
|
+
if (source[cursor] !== ")") return null;
|
|
42
|
+
cursor--;
|
|
43
|
+
while (cursor > start && /\s/.test(source[cursor])) cursor--;
|
|
44
|
+
if (source[cursor] !== "]") return null;
|
|
45
|
+
const dependenciesEnd = cursor + 1;
|
|
46
|
+
let depth = 1;
|
|
47
|
+
cursor--;
|
|
48
|
+
while (cursor > start && depth > 0) {
|
|
49
|
+
const character = source[cursor];
|
|
50
|
+
if (character === "]") depth++;
|
|
51
|
+
else if (character === "[") depth--;
|
|
52
|
+
if (depth === 0) break;
|
|
53
|
+
cursor--;
|
|
54
|
+
}
|
|
55
|
+
if (depth !== 0) return null;
|
|
56
|
+
const dependenciesStart = cursor;
|
|
57
|
+
let idEnd = cursor - 1;
|
|
58
|
+
while (idEnd > start && /\s/.test(source[idEnd])) idEnd--;
|
|
59
|
+
if (source[idEnd] !== ",") return null;
|
|
60
|
+
let idStart = idEnd;
|
|
61
|
+
while (idStart > start && /[0-9a-fA-FxX.+\-]/.test(source[idStart - 1])) idStart--;
|
|
62
|
+
const literal = source.slice(idStart, idEnd);
|
|
63
|
+
if (!/^-?(?:0[xXbBoO][0-9a-fA-F]+|\d+(?:\.\d*)?(?:[eE][+-]?\d+)?)$/.test(literal)) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
const moduleId = Number(literal);
|
|
67
|
+
if (!Number.isSafeInteger(moduleId)) return null;
|
|
68
|
+
let factoryEnd = idStart - 1;
|
|
69
|
+
while (factoryEnd > start && /\s/.test(source[factoryEnd])) factoryEnd--;
|
|
70
|
+
if (source[factoryEnd] !== ",") return null;
|
|
71
|
+
return {
|
|
72
|
+
moduleId,
|
|
73
|
+
factoryEnd,
|
|
74
|
+
dependenciesStart,
|
|
75
|
+
dependenciesEnd
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function readRNXMetroBundleLayout(source) {
|
|
79
|
+
const lineOffsets = [0];
|
|
80
|
+
for (let index = 0; index < source.length; index++) {
|
|
81
|
+
if (source.charCodeAt(index) === 10) lineOffsets.push(index + 1);
|
|
82
|
+
}
|
|
83
|
+
const boundaries = [];
|
|
84
|
+
for (let lineIndex = 0; lineIndex < lineOffsets.length; lineIndex++) {
|
|
85
|
+
const start = lineOffsets[lineIndex];
|
|
86
|
+
if (source.startsWith("__d(", start) || source.startsWith("__r(", start)) {
|
|
87
|
+
boundaries.push(lineIndex);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const statements = [];
|
|
91
|
+
let moduleIdFailures = 0;
|
|
92
|
+
for (let index = 0; index < boundaries.length; index++) {
|
|
93
|
+
const lineIndex = boundaries[index];
|
|
94
|
+
const start = lineOffsets[lineIndex];
|
|
95
|
+
const nextLineIndex = boundaries[index + 1];
|
|
96
|
+
const endLineIndex = nextLineIndex !== void 0 ? nextLineIndex - 1 : lineOffsets.length - 1;
|
|
97
|
+
const end = nextLineIndex !== void 0 ? lineOffsets[nextLineIndex] : source.length;
|
|
98
|
+
if (!source.startsWith("__d(", start)) {
|
|
99
|
+
statements.push({ kind: "run", start, end, lineIndex, endLineIndex });
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
const tail = readDefineTail(source, start, end - 1);
|
|
103
|
+
if (!tail) {
|
|
104
|
+
moduleIdFailures++;
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
statements.push({
|
|
108
|
+
kind: "define",
|
|
109
|
+
moduleId: tail.moduleId,
|
|
110
|
+
start,
|
|
111
|
+
end,
|
|
112
|
+
lineIndex,
|
|
113
|
+
endLineIndex,
|
|
114
|
+
factory: { start: start + "__d(".length, end: tail.factoryEnd },
|
|
115
|
+
dependencies: { start: tail.dependenciesStart, end: tail.dependenciesEnd }
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
prelude: source.slice(
|
|
120
|
+
0,
|
|
121
|
+
boundaries.length > 0 ? lineOffsets[boundaries[0]] : source.length
|
|
122
|
+
),
|
|
123
|
+
statements,
|
|
124
|
+
moduleIdFailures
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function validateRNXMetroModulePaths(source, modulePaths) {
|
|
128
|
+
const layout = readRNXMetroBundleLayout(source);
|
|
129
|
+
if (layout.moduleIdFailures > 0) {
|
|
130
|
+
throw new Error(
|
|
131
|
+
`Metro module identity could not read ${layout.moduleIdFailures} module IDs`
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
const definedIds = /* @__PURE__ */ new Set();
|
|
135
|
+
for (const statement of layout.statements) {
|
|
136
|
+
if (statement.kind !== "define") continue;
|
|
137
|
+
if (definedIds.has(statement.moduleId)) {
|
|
138
|
+
throw new Error(`Metro module identity has duplicate module ${statement.moduleId}`);
|
|
139
|
+
}
|
|
140
|
+
definedIds.add(statement.moduleId);
|
|
141
|
+
if (!Object.prototype.hasOwnProperty.call(modulePaths, String(statement.moduleId))) {
|
|
142
|
+
throw new Error(`Metro module identity is missing ${statement.moduleId}`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (definedIds.size === 0) {
|
|
146
|
+
throw new Error("Metro module identity found no canonical JavaScript modules");
|
|
147
|
+
}
|
|
148
|
+
for (const [key, modulePath] of Object.entries(modulePaths)) {
|
|
149
|
+
const moduleId = Number(key);
|
|
150
|
+
if (!Number.isSafeInteger(moduleId) || String(moduleId) !== key) {
|
|
151
|
+
throw new Error(`Metro module identity has invalid module ID ${key}`);
|
|
152
|
+
}
|
|
153
|
+
if (typeof modulePath !== "string" || modulePath.length === 0) {
|
|
154
|
+
throw new Error(`Metro module identity has no path for ${key}`);
|
|
155
|
+
}
|
|
156
|
+
if (!definedIds.has(moduleId)) {
|
|
157
|
+
throw new Error(`Metro module identity has no module ${key}`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
39
161
|
export {
|
|
40
|
-
RNXSIM_METRO_PRODUCTION_BUNDLE_OPTION,
|
|
41
162
|
createRNXMetroModulePathsFooter,
|
|
163
|
+
readRNXMetroBundleLayout,
|
|
42
164
|
readRNXMetroModuleIdentity,
|
|
43
|
-
toRNXProductionBundleUrl
|
|
165
|
+
toRNXProductionBundleUrl,
|
|
166
|
+
validateRNXMetroModulePaths
|
|
44
167
|
};
|