rnxsim 0.1.402 → 0.1.404

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 (59) hide show
  1. package/README.md +31 -9
  2. package/cli/commands/box.ts +10 -3
  3. package/cli/outbound-endpoints.ts +2 -2
  4. package/dist-lib/agent-daemon-client.cjs +1 -1
  5. package/dist-lib/agent-events.cjs +1 -1
  6. package/dist-lib/agent-identity.cjs +1 -1
  7. package/dist-lib/agent-sessions.cjs +1 -1
  8. package/dist-lib/attached-projects.cjs +1 -1
  9. package/dist-lib/auth/shared-session.cjs +1 -1
  10. package/dist-lib/backend-origin.cjs +1 -1
  11. package/dist-lib/beta.cjs +1 -1
  12. package/dist-lib/beta.mjs +1 -1
  13. package/dist-lib/bridge-constants.cjs +1 -1
  14. package/dist-lib/bridge-contract-input.cjs +1 -1
  15. package/dist-lib/bridge-contract-input.mjs +1 -1
  16. package/dist-lib/bridge-contract.cjs +1 -1
  17. package/dist-lib/bridge-contract.mjs +1 -1
  18. package/dist-lib/capture-contract.cjs +5 -2
  19. package/dist-lib/capture-contract.mjs +5 -2
  20. package/dist-lib/cli-constants.cjs +1 -1
  21. package/dist-lib/cloud-contract.cjs +3 -2
  22. package/dist-lib/cloud-contract.mjs +3 -2
  23. package/dist-lib/config.cjs +1 -1
  24. package/dist-lib/detox/index.cjs +1 -1
  25. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  26. package/dist-lib/home-paths.cjs +1 -1
  27. package/dist-lib/host/bridge-host.cjs +1 -1
  28. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  29. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  30. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  31. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  32. package/dist-lib/host/websocket-proxy.cjs +1 -1
  33. package/dist-lib/index.cjs +63 -14
  34. package/dist-lib/jump-to-source-babel.cjs +1 -1
  35. package/dist-lib/menu.cjs +1 -1
  36. package/dist-lib/menu.mjs +1 -1
  37. package/dist-lib/metro-fingerprint-registry.cjs +186 -0
  38. package/dist-lib/metro-fingerprint-registry.mjs +156 -0
  39. package/dist-lib/metro-production-bundle.cjs +131 -17
  40. package/dist-lib/metro-production-bundle.mjs +125 -16
  41. package/dist-lib/metro.cjs +67 -12
  42. package/dist-lib/profiles.cjs +1 -1
  43. package/dist-lib/public-brand.cjs +1 -1
  44. package/dist-lib/react-native-host-modules.cjs +1 -1
  45. package/dist-lib/react-native-host-modules.mjs +1 -1
  46. package/dist-lib/render-mode.cjs +1 -1
  47. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  48. package/dist-lib/sdk.cjs +1 -1
  49. package/dist-lib/sdk.mjs +1 -1
  50. package/dist-lib/skills.cjs +58 -25
  51. package/dist-lib/vite.cjs +6 -1
  52. package/package.json +8 -1
  53. package/src/bridge-contract.ts +20 -0
  54. package/src/capture-contract.ts +8 -0
  55. package/src/cloud-contract.ts +1 -0
  56. package/src/metro-fingerprint-registry.ts +302 -0
  57. package/src/metro-plugin.ts +73 -24
  58. package/src/metro-production-bundle.ts +213 -19
  59. package/src/runtime-assets.ts +5 -0
@@ -0,0 +1,186 @@
1
+ /*! rnx v0.1.404 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
+ "use strict";
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // src/metro-fingerprint-registry.ts
23
+ var metro_fingerprint_registry_exports = {};
24
+ __export(metro_fingerprint_registry_exports, {
25
+ RNX_METRO_FINGERPRINT_MAX_PAYLOAD_BYTES: () => RNX_METRO_FINGERPRINT_MAX_PAYLOAD_BYTES,
26
+ RNX_METRO_FINGERPRINT_MAX_POINTER_BYTES: () => RNX_METRO_FINGERPRINT_MAX_POINTER_BYTES,
27
+ RNX_METRO_FINGERPRINT_POINTER_PATH: () => RNX_METRO_FINGERPRINT_POINTER_PATH,
28
+ RNX_METRO_FINGERPRINT_SCHEMA_VERSION: () => RNX_METRO_FINGERPRINT_SCHEMA_VERSION,
29
+ parseRNXMetroFingerprintPointer: () => parseRNXMetroFingerprintPointer,
30
+ parseRNXMetroFingerprintRegistry: () => parseRNXMetroFingerprintRegistry
31
+ });
32
+ module.exports = __toCommonJS(metro_fingerprint_registry_exports);
33
+ var RNX_METRO_FINGERPRINT_SCHEMA_VERSION = 2;
34
+ var RNX_METRO_FINGERPRINT_POINTER_PATH = "/compile/metro-fingerprints.json";
35
+ var RNX_METRO_FINGERPRINT_MAX_POINTER_BYTES = 16 * 1024;
36
+ var RNX_METRO_FINGERPRINT_MAX_PAYLOAD_BYTES = 8 * 1024 * 1024;
37
+ function isRecord(value) {
38
+ return typeof value === "object" && value !== null && !Array.isArray(value);
39
+ }
40
+ function isSha256(value) {
41
+ return typeof value === "string" && /^[a-f0-9]{64}$/.test(value);
42
+ }
43
+ function readStringArray(value) {
44
+ if (!Array.isArray(value) || !value.every((entry) => typeof entry === "string")) {
45
+ return null;
46
+ }
47
+ const entries = [...value];
48
+ if (new Set(entries).size !== entries.length || entries.some((entry, index) => index > 0 && entries[index - 1] >= entry)) {
49
+ return null;
50
+ }
51
+ return entries;
52
+ }
53
+ function parseRNXMetroFingerprintPointer(value) {
54
+ if (!isRecord(value)) return null;
55
+ const { schemaVersion, revision, integrity, bytes, payloadUrl } = value;
56
+ if (schemaVersion !== RNX_METRO_FINGERPRINT_SCHEMA_VERSION || !isSha256(revision) || !isSha256(integrity) || typeof bytes !== "number" || !Number.isSafeInteger(bytes) || bytes < 1 || typeof payloadUrl !== "string" || payloadUrl.length === 0) {
57
+ return null;
58
+ }
59
+ return { schemaVersion, revision, integrity, bytes, payloadUrl };
60
+ }
61
+ function parseRNXMetroFingerprintRegistry(value) {
62
+ if (!isRecord(value)) return null;
63
+ const { schemaVersion, revision } = value;
64
+ if (schemaVersion !== RNX_METRO_FINGERPRINT_SCHEMA_VERSION || !isSha256(revision) || !Array.isArray(value.atoms) || !Array.isArray(value.templates) || !isRecord(value.candidatesByFactoryDigest) || !isRecord(value.candidatesByDiscriminator)) {
65
+ return null;
66
+ }
67
+ const atoms = [];
68
+ for (const atomValue of value.atoms) {
69
+ if (!isRecord(atomValue)) return null;
70
+ const exports2 = readStringArray(atomValue.exports);
71
+ const literals = readStringArray(atomValue.literals);
72
+ if (typeof atomValue.key !== "string" || atomValue.key.length === 0 || !exports2 || !literals || typeof atomValue.dependencyArity !== "number" || !Number.isSafeInteger(atomValue.dependencyArity) || atomValue.dependencyArity < 0 || !isSha256(atomValue.factoryDigest)) {
73
+ return null;
74
+ }
75
+ atoms.push({
76
+ key: atomValue.key,
77
+ exports: exports2,
78
+ literals,
79
+ dependencyArity: atomValue.dependencyArity,
80
+ factoryDigest: atomValue.factoryDigest
81
+ });
82
+ }
83
+ const templates = [];
84
+ for (const templateValue of value.templates) {
85
+ if (!isRecord(templateValue) || typeof templateValue.packageName !== "string" || templateValue.packageName.length === 0 || typeof templateValue.packageVersion !== "string" || templateValue.packageVersion.length === 0 || !isSha256(templateValue.sourceIntegrity) || typeof templateValue.profile !== "string" || templateValue.profile.length === 0 || templateValue.platform !== "ios" && templateValue.platform !== "android" || !Array.isArray(templateValue.nodes) || templateValue.nodes.length === 0 || !Array.isArray(templateValue.roots) || templateValue.roots.length === 0) {
86
+ return null;
87
+ }
88
+ const nodes = [];
89
+ for (const nodeValue of templateValue.nodes) {
90
+ if (!isRecord(nodeValue) || typeof nodeValue.atom !== "number" || !Number.isSafeInteger(nodeValue.atom) || nodeValue.atom < 0 || nodeValue.atom >= atoms.length || !Array.isArray(nodeValue.internalDependencies) || nodeValue.landmarkPath !== void 0 && (typeof nodeValue.landmarkPath !== "string" || nodeValue.landmarkPath.length === 0)) {
91
+ return null;
92
+ }
93
+ const internalDependencies = [];
94
+ const positions = /* @__PURE__ */ new Set();
95
+ for (const edgeValue of nodeValue.internalDependencies) {
96
+ if (!isRecord(edgeValue) || typeof edgeValue.position !== "number" || !Number.isSafeInteger(edgeValue.position) || edgeValue.position < 0 || positions.has(edgeValue.position) || typeof edgeValue.node !== "number" || !Number.isSafeInteger(edgeValue.node) || edgeValue.node < 0 || edgeValue.node >= templateValue.nodes.length) {
97
+ return null;
98
+ }
99
+ positions.add(edgeValue.position);
100
+ internalDependencies.push({
101
+ position: edgeValue.position,
102
+ node: edgeValue.node
103
+ });
104
+ }
105
+ internalDependencies.sort((left, right) => left.position - right.position);
106
+ nodes.push({
107
+ atom: nodeValue.atom,
108
+ internalDependencies,
109
+ ...typeof nodeValue.landmarkPath === "string" ? { landmarkPath: nodeValue.landmarkPath } : {}
110
+ });
111
+ }
112
+ const roots = [];
113
+ for (const rootValue of templateValue.roots) {
114
+ if (!isRecord(rootValue) || typeof rootValue.node !== "number" || !Number.isSafeInteger(rootValue.node) || rootValue.node < 0 || rootValue.node >= nodes.length || !nodes[rootValue.node].landmarkPath) {
115
+ return null;
116
+ }
117
+ roots.push({ node: rootValue.node });
118
+ }
119
+ templates.push({
120
+ packageName: templateValue.packageName,
121
+ packageVersion: templateValue.packageVersion,
122
+ sourceIntegrity: templateValue.sourceIntegrity,
123
+ profile: templateValue.profile,
124
+ platform: templateValue.platform,
125
+ nodes,
126
+ roots
127
+ });
128
+ }
129
+ const candidatesByFactoryDigest = {};
130
+ for (const [factoryDigest, candidateValues] of Object.entries(
131
+ value.candidatesByFactoryDigest
132
+ )) {
133
+ if (!isSha256(factoryDigest) || !Array.isArray(candidateValues)) return null;
134
+ const candidates = [];
135
+ for (const candidateValue of candidateValues) {
136
+ if (!isRecord(candidateValue) || typeof candidateValue.template !== "number" || !Number.isSafeInteger(candidateValue.template) || candidateValue.template < 0 || candidateValue.template >= templates.length || typeof candidateValue.root !== "number" || !Number.isSafeInteger(candidateValue.root) || candidateValue.root < 0 || candidateValue.root >= templates[candidateValue.template].roots.length) {
137
+ return null;
138
+ }
139
+ const template = templates[candidateValue.template];
140
+ const root = template.roots[candidateValue.root];
141
+ if (atoms[template.nodes[root.node].atom].factoryDigest !== factoryDigest) {
142
+ return null;
143
+ }
144
+ candidates.push({
145
+ template: candidateValue.template,
146
+ root: candidateValue.root
147
+ });
148
+ }
149
+ candidatesByFactoryDigest[factoryDigest] = candidates;
150
+ }
151
+ const candidatesByDiscriminator = {};
152
+ for (const [discriminator, candidateValues] of Object.entries(
153
+ value.candidatesByDiscriminator
154
+ )) {
155
+ if (!/^(?:e|l|ea|la|el|ela):[a-f0-9]{16}$/.test(discriminator)) return null;
156
+ if (!Array.isArray(candidateValues) || candidateValues.length === 0) return null;
157
+ const candidates = [];
158
+ for (const candidateValue of candidateValues) {
159
+ if (!isRecord(candidateValue) || typeof candidateValue.template !== "number" || !Number.isSafeInteger(candidateValue.template) || candidateValue.template < 0 || candidateValue.template >= templates.length || typeof candidateValue.root !== "number" || !Number.isSafeInteger(candidateValue.root) || candidateValue.root < 0 || candidateValue.root >= templates[candidateValue.template].roots.length) {
160
+ return null;
161
+ }
162
+ candidates.push({
163
+ template: candidateValue.template,
164
+ root: candidateValue.root
165
+ });
166
+ }
167
+ candidatesByDiscriminator[discriminator] = candidates;
168
+ }
169
+ return {
170
+ schemaVersion,
171
+ revision,
172
+ atoms,
173
+ templates,
174
+ candidatesByFactoryDigest,
175
+ candidatesByDiscriminator
176
+ };
177
+ }
178
+ // Annotate the CommonJS export names for ESM import in node:
179
+ 0 && (module.exports = {
180
+ RNX_METRO_FINGERPRINT_MAX_PAYLOAD_BYTES,
181
+ RNX_METRO_FINGERPRINT_MAX_POINTER_BYTES,
182
+ RNX_METRO_FINGERPRINT_POINTER_PATH,
183
+ RNX_METRO_FINGERPRINT_SCHEMA_VERSION,
184
+ parseRNXMetroFingerprintPointer,
185
+ parseRNXMetroFingerprintRegistry
186
+ });
@@ -0,0 +1,156 @@
1
+ /*! rnx v0.1.404 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+
3
+ // src/metro-fingerprint-registry.ts
4
+ var RNX_METRO_FINGERPRINT_SCHEMA_VERSION = 2;
5
+ var RNX_METRO_FINGERPRINT_POINTER_PATH = "/compile/metro-fingerprints.json";
6
+ var RNX_METRO_FINGERPRINT_MAX_POINTER_BYTES = 16 * 1024;
7
+ var RNX_METRO_FINGERPRINT_MAX_PAYLOAD_BYTES = 8 * 1024 * 1024;
8
+ function isRecord(value) {
9
+ return typeof value === "object" && value !== null && !Array.isArray(value);
10
+ }
11
+ function isSha256(value) {
12
+ return typeof value === "string" && /^[a-f0-9]{64}$/.test(value);
13
+ }
14
+ function readStringArray(value) {
15
+ if (!Array.isArray(value) || !value.every((entry) => typeof entry === "string")) {
16
+ return null;
17
+ }
18
+ const entries = [...value];
19
+ if (new Set(entries).size !== entries.length || entries.some((entry, index) => index > 0 && entries[index - 1] >= entry)) {
20
+ return null;
21
+ }
22
+ return entries;
23
+ }
24
+ function parseRNXMetroFingerprintPointer(value) {
25
+ if (!isRecord(value)) return null;
26
+ const { schemaVersion, revision, integrity, bytes, payloadUrl } = value;
27
+ if (schemaVersion !== RNX_METRO_FINGERPRINT_SCHEMA_VERSION || !isSha256(revision) || !isSha256(integrity) || typeof bytes !== "number" || !Number.isSafeInteger(bytes) || bytes < 1 || typeof payloadUrl !== "string" || payloadUrl.length === 0) {
28
+ return null;
29
+ }
30
+ return { schemaVersion, revision, integrity, bytes, payloadUrl };
31
+ }
32
+ function parseRNXMetroFingerprintRegistry(value) {
33
+ if (!isRecord(value)) return null;
34
+ const { schemaVersion, revision } = value;
35
+ if (schemaVersion !== RNX_METRO_FINGERPRINT_SCHEMA_VERSION || !isSha256(revision) || !Array.isArray(value.atoms) || !Array.isArray(value.templates) || !isRecord(value.candidatesByFactoryDigest) || !isRecord(value.candidatesByDiscriminator)) {
36
+ return null;
37
+ }
38
+ const atoms = [];
39
+ for (const atomValue of value.atoms) {
40
+ if (!isRecord(atomValue)) return null;
41
+ const exports = readStringArray(atomValue.exports);
42
+ const literals = readStringArray(atomValue.literals);
43
+ if (typeof atomValue.key !== "string" || atomValue.key.length === 0 || !exports || !literals || typeof atomValue.dependencyArity !== "number" || !Number.isSafeInteger(atomValue.dependencyArity) || atomValue.dependencyArity < 0 || !isSha256(atomValue.factoryDigest)) {
44
+ return null;
45
+ }
46
+ atoms.push({
47
+ key: atomValue.key,
48
+ exports,
49
+ literals,
50
+ dependencyArity: atomValue.dependencyArity,
51
+ factoryDigest: atomValue.factoryDigest
52
+ });
53
+ }
54
+ const templates = [];
55
+ for (const templateValue of value.templates) {
56
+ if (!isRecord(templateValue) || typeof templateValue.packageName !== "string" || templateValue.packageName.length === 0 || typeof templateValue.packageVersion !== "string" || templateValue.packageVersion.length === 0 || !isSha256(templateValue.sourceIntegrity) || typeof templateValue.profile !== "string" || templateValue.profile.length === 0 || templateValue.platform !== "ios" && templateValue.platform !== "android" || !Array.isArray(templateValue.nodes) || templateValue.nodes.length === 0 || !Array.isArray(templateValue.roots) || templateValue.roots.length === 0) {
57
+ return null;
58
+ }
59
+ const nodes = [];
60
+ for (const nodeValue of templateValue.nodes) {
61
+ if (!isRecord(nodeValue) || typeof nodeValue.atom !== "number" || !Number.isSafeInteger(nodeValue.atom) || nodeValue.atom < 0 || nodeValue.atom >= atoms.length || !Array.isArray(nodeValue.internalDependencies) || nodeValue.landmarkPath !== void 0 && (typeof nodeValue.landmarkPath !== "string" || nodeValue.landmarkPath.length === 0)) {
62
+ return null;
63
+ }
64
+ const internalDependencies = [];
65
+ const positions = /* @__PURE__ */ new Set();
66
+ for (const edgeValue of nodeValue.internalDependencies) {
67
+ if (!isRecord(edgeValue) || typeof edgeValue.position !== "number" || !Number.isSafeInteger(edgeValue.position) || edgeValue.position < 0 || positions.has(edgeValue.position) || typeof edgeValue.node !== "number" || !Number.isSafeInteger(edgeValue.node) || edgeValue.node < 0 || edgeValue.node >= templateValue.nodes.length) {
68
+ return null;
69
+ }
70
+ positions.add(edgeValue.position);
71
+ internalDependencies.push({
72
+ position: edgeValue.position,
73
+ node: edgeValue.node
74
+ });
75
+ }
76
+ internalDependencies.sort((left, right) => left.position - right.position);
77
+ nodes.push({
78
+ atom: nodeValue.atom,
79
+ internalDependencies,
80
+ ...typeof nodeValue.landmarkPath === "string" ? { landmarkPath: nodeValue.landmarkPath } : {}
81
+ });
82
+ }
83
+ const roots = [];
84
+ for (const rootValue of templateValue.roots) {
85
+ if (!isRecord(rootValue) || typeof rootValue.node !== "number" || !Number.isSafeInteger(rootValue.node) || rootValue.node < 0 || rootValue.node >= nodes.length || !nodes[rootValue.node].landmarkPath) {
86
+ return null;
87
+ }
88
+ roots.push({ node: rootValue.node });
89
+ }
90
+ templates.push({
91
+ packageName: templateValue.packageName,
92
+ packageVersion: templateValue.packageVersion,
93
+ sourceIntegrity: templateValue.sourceIntegrity,
94
+ profile: templateValue.profile,
95
+ platform: templateValue.platform,
96
+ nodes,
97
+ roots
98
+ });
99
+ }
100
+ const candidatesByFactoryDigest = {};
101
+ for (const [factoryDigest, candidateValues] of Object.entries(
102
+ value.candidatesByFactoryDigest
103
+ )) {
104
+ if (!isSha256(factoryDigest) || !Array.isArray(candidateValues)) return null;
105
+ const candidates = [];
106
+ for (const candidateValue of candidateValues) {
107
+ if (!isRecord(candidateValue) || typeof candidateValue.template !== "number" || !Number.isSafeInteger(candidateValue.template) || candidateValue.template < 0 || candidateValue.template >= templates.length || typeof candidateValue.root !== "number" || !Number.isSafeInteger(candidateValue.root) || candidateValue.root < 0 || candidateValue.root >= templates[candidateValue.template].roots.length) {
108
+ return null;
109
+ }
110
+ const template = templates[candidateValue.template];
111
+ const root = template.roots[candidateValue.root];
112
+ if (atoms[template.nodes[root.node].atom].factoryDigest !== factoryDigest) {
113
+ return null;
114
+ }
115
+ candidates.push({
116
+ template: candidateValue.template,
117
+ root: candidateValue.root
118
+ });
119
+ }
120
+ candidatesByFactoryDigest[factoryDigest] = candidates;
121
+ }
122
+ const candidatesByDiscriminator = {};
123
+ for (const [discriminator, candidateValues] of Object.entries(
124
+ value.candidatesByDiscriminator
125
+ )) {
126
+ if (!/^(?:e|l|ea|la|el|ela):[a-f0-9]{16}$/.test(discriminator)) return null;
127
+ if (!Array.isArray(candidateValues) || candidateValues.length === 0) return null;
128
+ const candidates = [];
129
+ for (const candidateValue of candidateValues) {
130
+ if (!isRecord(candidateValue) || typeof candidateValue.template !== "number" || !Number.isSafeInteger(candidateValue.template) || candidateValue.template < 0 || candidateValue.template >= templates.length || typeof candidateValue.root !== "number" || !Number.isSafeInteger(candidateValue.root) || candidateValue.root < 0 || candidateValue.root >= templates[candidateValue.template].roots.length) {
131
+ return null;
132
+ }
133
+ candidates.push({
134
+ template: candidateValue.template,
135
+ root: candidateValue.root
136
+ });
137
+ }
138
+ candidatesByDiscriminator[discriminator] = candidates;
139
+ }
140
+ return {
141
+ schemaVersion,
142
+ revision,
143
+ atoms,
144
+ templates,
145
+ candidatesByFactoryDigest,
146
+ candidatesByDiscriminator
147
+ };
148
+ }
149
+ export {
150
+ RNX_METRO_FINGERPRINT_MAX_PAYLOAD_BYTES,
151
+ RNX_METRO_FINGERPRINT_MAX_POINTER_BYTES,
152
+ RNX_METRO_FINGERPRINT_POINTER_PATH,
153
+ RNX_METRO_FINGERPRINT_SCHEMA_VERSION,
154
+ parseRNXMetroFingerprintPointer,
155
+ parseRNXMetroFingerprintRegistry
156
+ };
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.402 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.404 | (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,14 +22,20 @@ 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
- createRNXMetroModulePathsFooter: () => createRNXMetroModulePathsFooter,
25
+ RNX_METRO_MODULE_IDENTITY_VERSION: () => RNX_METRO_MODULE_IDENTITY_VERSION,
26
+ appendRNXMetroModuleIdentityFooter: () => appendRNXMetroModuleIdentityFooter,
27
+ createRNXMetroModuleIdentityFooter: () => createRNXMetroModuleIdentityFooter,
28
+ detachRNXMetroSourceMapUrl: () => detachRNXMetroSourceMapUrl,
26
29
  readRNXMetroBundleLayout: () => readRNXMetroBundleLayout,
27
30
  readRNXMetroModuleIdentity: () => readRNXMetroModuleIdentity,
31
+ toRNXDevelopmentBundleUrl: () => toRNXDevelopmentBundleUrl,
28
32
  toRNXProductionBundleUrl: () => toRNXProductionBundleUrl,
33
+ validateRNXMetroModuleIdentity: () => validateRNXMetroModuleIdentity,
29
34
  validateRNXMetroModulePaths: () => validateRNXMetroModulePaths
30
35
  });
31
36
  module.exports = __toCommonJS(metro_production_bundle_exports);
32
37
  var RNXSIM_METRO_MODULE_PATHS_PREFIX = "globalThis.__sootsimModulePaths=";
38
+ var RNX_METRO_MODULE_IDENTITY_VERSION = 2;
33
39
  function toRNXProductionBundleUrl(bundleUrl) {
34
40
  const relative = bundleUrl.startsWith("/");
35
41
  const url = new URL(bundleUrl, "http://rnxsim.local");
@@ -38,28 +44,105 @@ function toRNXProductionBundleUrl(bundleUrl) {
38
44
  url.searchParams.set("minify", "true");
39
45
  return relative ? `${url.pathname}${url.search}${url.hash}` : url.toString();
40
46
  }
41
- function createRNXMetroModulePathsFooter(modulePaths) {
42
- const payload = JSON.stringify(modulePaths).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029").replace(/<\//g, "<\\/");
47
+ function toRNXDevelopmentBundleUrl(bundleUrl) {
48
+ const relative = bundleUrl.startsWith("/");
49
+ const url = new URL(bundleUrl, "http://rnxsim.local");
50
+ url.searchParams.set("dev", "true");
51
+ url.searchParams.set("hot", "false");
52
+ url.searchParams.set("minify", "false");
53
+ return relative ? `${url.pathname}${url.search}${url.hash}` : url.toString();
54
+ }
55
+ var RNXSIM_METRO_SOURCE_MAP_COMMENT = "//# sourceMappingURL=";
56
+ function detachRNXMetroSourceMapUrl(bundleText) {
57
+ const trimmedEnd = bundleText.replace(/\s+$/, "");
58
+ const commentStart = trimmedEnd.lastIndexOf(`
59
+ ${RNXSIM_METRO_SOURCE_MAP_COMMENT}`);
60
+ if (commentStart < 0) return { source: bundleText, sourceMappingUrl: null };
61
+ const url = trimmedEnd.slice(commentStart + 1 + RNXSIM_METRO_SOURCE_MAP_COMMENT.length);
62
+ if (url.includes("\n")) return { source: bundleText, sourceMappingUrl: null };
63
+ return { source: trimmedEnd.slice(0, commentStart), sourceMappingUrl: url };
64
+ }
65
+ function createRNXMetroModuleIdentityFooter(identity) {
66
+ const payload = JSON.stringify(identity).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029").replace(/<\//g, "<\\/");
43
67
  return `
44
68
  ${RNXSIM_METRO_MODULE_PATHS_PREFIX}${payload};`;
45
69
  }
70
+ function appendRNXMetroModuleIdentityFooter(bundleText, identity) {
71
+ const footer = createRNXMetroModuleIdentityFooter(identity);
72
+ const detached = detachRNXMetroSourceMapUrl(bundleText);
73
+ return detached.sourceMappingUrl === null ? bundleText + footer : `${detached.source}${footer}
74
+ ${RNXSIM_METRO_SOURCE_MAP_COMMENT}${detached.sourceMappingUrl}`;
75
+ }
46
76
  function readRNXMetroModuleIdentity(bundleText) {
77
+ const detached = detachRNXMetroSourceMapUrl(bundleText);
78
+ const withoutMap = detached.source;
47
79
  const footerPrefix = `
48
80
  ${RNXSIM_METRO_MODULE_PATHS_PREFIX}`;
49
- const footerStart = bundleText.lastIndexOf(footerPrefix);
50
- if (footerStart < 0 || !bundleText.endsWith(";")) return null;
51
- const parsed = JSON.parse(
52
- bundleText.slice(footerStart + footerPrefix.length, -1)
53
- );
81
+ const footerStart = withoutMap.lastIndexOf(footerPrefix);
82
+ if (footerStart < 0) return null;
83
+ if (!withoutMap.endsWith(";")) {
84
+ throw new Error("Metro module identity footer is truncated");
85
+ }
86
+ let parsed;
87
+ try {
88
+ parsed = JSON.parse(withoutMap.slice(footerStart + footerPrefix.length, -1));
89
+ } catch {
90
+ throw new Error("Metro module identity footer is not valid JSON");
91
+ }
54
92
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
55
- return null;
93
+ throw new Error("Metro module identity footer is malformed");
94
+ }
95
+ const version = Reflect.get(parsed, "version");
96
+ if (version === void 0) return null;
97
+ const identitySource = Reflect.get(parsed, "identitySource");
98
+ const parsedModulePaths = Reflect.get(parsed, "modulePaths");
99
+ const parsedLogicalSpecifiers = Reflect.get(parsed, "logicalSpecifiers");
100
+ if (version !== RNX_METRO_MODULE_IDENTITY_VERSION || identitySource !== "rnx-plugin" && identitySource !== "contrast-bundler" && identitySource !== "metro-source-map" || typeof parsedModulePaths !== "object" || parsedModulePaths === null || Array.isArray(parsedModulePaths) || typeof parsedLogicalSpecifiers !== "object" || parsedLogicalSpecifiers === null || Array.isArray(parsedLogicalSpecifiers)) {
101
+ throw new Error("Metro module identity footer is malformed");
56
102
  }
57
103
  const modulePaths = {};
58
- for (const [moduleId, modulePath] of Object.entries(parsed)) {
59
- if (typeof modulePath !== "string") return null;
104
+ for (const [moduleId, modulePath] of Object.entries(parsedModulePaths)) {
105
+ if (typeof modulePath !== "string") {
106
+ throw new Error(`Metro module identity has an invalid path for ${moduleId}`);
107
+ }
60
108
  modulePaths[moduleId] = modulePath;
61
109
  }
62
- return { source: bundleText.slice(0, footerStart), modulePaths };
110
+ const logicalSpecifiers = {};
111
+ for (const [moduleId, specifiers] of Object.entries(parsedLogicalSpecifiers)) {
112
+ if (!Array.isArray(specifiers) || specifiers.length === 0 || !specifiers.every(
113
+ (specifier) => typeof specifier === "string" && specifier.length > 0
114
+ )) {
115
+ throw new Error(`Metro module identity has invalid specifiers for ${moduleId}`);
116
+ }
117
+ const unique = [...new Set(specifiers)].sort(
118
+ (left, right) => left.localeCompare(right)
119
+ );
120
+ if (unique.length !== specifiers.length) {
121
+ throw new Error(`Metro module identity repeats a specifier for ${moduleId}`);
122
+ }
123
+ logicalSpecifiers[moduleId] = unique;
124
+ }
125
+ return {
126
+ source: withoutMap.slice(0, footerStart),
127
+ version,
128
+ identitySource,
129
+ modulePaths,
130
+ logicalSpecifiers,
131
+ sourceMappingUrl: detached.sourceMappingUrl
132
+ };
133
+ }
134
+ function readStringLiteralStart(source, start, end) {
135
+ const quote = source[end];
136
+ if (quote !== '"' && quote !== "'") return -1;
137
+ for (let index = end - 1; index > start; index--) {
138
+ if (source[index] !== quote) continue;
139
+ let backslashes = 0;
140
+ while (index - 1 - backslashes > start && source[index - 1 - backslashes] === "\\") {
141
+ backslashes++;
142
+ }
143
+ if (backslashes % 2 === 0) return index;
144
+ }
145
+ return -1;
63
146
  }
64
147
  function readDefineTail(source, start, end) {
65
148
  let cursor = end;
@@ -69,6 +152,19 @@ function readDefineTail(source, start, end) {
69
152
  if (source[cursor] !== ")") return null;
70
153
  cursor--;
71
154
  while (cursor > start && /\s/.test(source[cursor])) cursor--;
155
+ let verboseNameStart;
156
+ let verboseNameEnd;
157
+ if (source[cursor] === '"' || source[cursor] === "'") {
158
+ const literalStart = readStringLiteralStart(source, start, cursor);
159
+ if (literalStart < 0) return null;
160
+ verboseNameStart = literalStart;
161
+ verboseNameEnd = cursor + 1;
162
+ cursor = literalStart - 1;
163
+ while (cursor > start && /\s/.test(source[cursor])) cursor--;
164
+ if (source[cursor] !== ",") return null;
165
+ cursor--;
166
+ while (cursor > start && /\s/.test(source[cursor])) cursor--;
167
+ }
72
168
  if (source[cursor] !== "]") return null;
73
169
  const dependenciesEnd = cursor + 1;
74
170
  let depth = 1;
@@ -86,7 +182,7 @@ function readDefineTail(source, start, end) {
86
182
  while (idEnd > start && /\s/.test(source[idEnd])) idEnd--;
87
183
  if (source[idEnd] !== ",") return null;
88
184
  let idStart = idEnd;
89
- while (idStart > start && /[0-9a-fA-FxX.+\-]/.test(source[idStart - 1])) idStart--;
185
+ while (idStart > start && /[0-9a-fA-FxX.+-]/.test(source[idStart - 1])) idStart--;
90
186
  const literal = source.slice(idStart, idEnd);
91
187
  if (!/^-?(?:0[xXbBoO][0-9a-fA-F]+|\d+(?:\.\d*)?(?:[eE][+-]?\d+)?)$/.test(literal)) {
92
188
  return null;
@@ -100,7 +196,9 @@ function readDefineTail(source, start, end) {
100
196
  moduleId,
101
197
  factoryEnd,
102
198
  dependenciesStart,
103
- dependenciesEnd
199
+ dependenciesEnd,
200
+ verboseNameStart,
201
+ verboseNameEnd
104
202
  };
105
203
  }
106
204
  function readRNXMetroBundleLayout(source) {
@@ -140,7 +238,8 @@ function readRNXMetroBundleLayout(source) {
140
238
  lineIndex,
141
239
  endLineIndex,
142
240
  factory: { start: start + "__d(".length, end: tail.factoryEnd },
143
- dependencies: { start: tail.dependenciesStart, end: tail.dependenciesEnd }
241
+ dependencies: { start: tail.dependenciesStart, end: tail.dependenciesEnd },
242
+ ...tail.verboseNameStart !== void 0 && tail.verboseNameEnd !== void 0 ? { verboseName: { start: tail.verboseNameStart, end: tail.verboseNameEnd } } : {}
144
243
  });
145
244
  }
146
245
  return {
@@ -186,11 +285,26 @@ function validateRNXMetroModulePaths(source, modulePaths) {
186
285
  }
187
286
  }
188
287
  }
288
+ function validateRNXMetroModuleIdentity(identity) {
289
+ validateRNXMetroModulePaths(identity.source, identity.modulePaths);
290
+ for (const moduleId of Object.keys(identity.logicalSpecifiers)) {
291
+ if (!Object.prototype.hasOwnProperty.call(identity.modulePaths, moduleId)) {
292
+ throw new Error(
293
+ `Metro module identity has logical specifiers for unknown module ${moduleId}`
294
+ );
295
+ }
296
+ }
297
+ }
189
298
  // Annotate the CommonJS export names for ESM import in node:
190
299
  0 && (module.exports = {
191
- createRNXMetroModulePathsFooter,
300
+ RNX_METRO_MODULE_IDENTITY_VERSION,
301
+ appendRNXMetroModuleIdentityFooter,
302
+ createRNXMetroModuleIdentityFooter,
303
+ detachRNXMetroSourceMapUrl,
192
304
  readRNXMetroBundleLayout,
193
305
  readRNXMetroModuleIdentity,
306
+ toRNXDevelopmentBundleUrl,
194
307
  toRNXProductionBundleUrl,
308
+ validateRNXMetroModuleIdentity,
195
309
  validateRNXMetroModulePaths
196
310
  });