rnxsim 0.1.433 → 0.1.434
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/cli/cloud-client.ts +55 -13
- package/cli/commands/box.ts +89 -14
- package/cli/outbound-endpoints.ts +5 -0
- package/cli/send-to-box.ts +112 -0
- 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 +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -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 +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- 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 +5324 -1371
- 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 +298 -91
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +313 -104
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/menu.cjs +7 -1
- package/dist-lib/menu.mjs +7 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +302 -95
- 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 +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +5006 -1441
- package/dist-lib/vite.cjs +298 -91
- package/package.json +2 -2
- package/src/bridge-contract.ts +6 -0
- package/src/host/bridge-host.ts +79 -0
- package/src/host/replacement-module-handler.ts +20 -96
- package/src/menu.ts +8 -0
package/dist-lib/metro.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.434 | (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;
|
|
@@ -64,7 +64,287 @@ function tagRnxBundleForPlugin(bundleUrl, replacementOrigin, replacementToken, p
|
|
|
64
64
|
// src/host/replacement-module-handler.ts
|
|
65
65
|
var import_promises = __toESM(require("node:fs/promises"), 1);
|
|
66
66
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
67
|
-
|
|
67
|
+
|
|
68
|
+
// ../contrast-bundler/src/replacementModule.ts
|
|
69
|
+
var import_dist = require("sucrase/dist/index.js");
|
|
70
|
+
var import_parser = require("sucrase/dist/parser/index.js");
|
|
71
|
+
var import_types = require("sucrase/dist/parser/tokenizer/types.js");
|
|
72
|
+
|
|
73
|
+
// ../contrast-bundler/src/posixPath.ts
|
|
74
|
+
var sep = "/";
|
|
75
|
+
var delimiter = ":";
|
|
76
|
+
function isAbsolute(p) {
|
|
77
|
+
return p.charCodeAt(0) === 47;
|
|
78
|
+
}
|
|
79
|
+
function normalizeSegments(parts, allowAboveRoot) {
|
|
80
|
+
const out = [];
|
|
81
|
+
for (const part of parts) {
|
|
82
|
+
if (part === "" || part === ".") continue;
|
|
83
|
+
if (part === "..") {
|
|
84
|
+
if (out.length > 0 && out[out.length - 1] !== "..") out.pop();
|
|
85
|
+
else if (allowAboveRoot) out.push("..");
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
out.push(part);
|
|
89
|
+
}
|
|
90
|
+
return out;
|
|
91
|
+
}
|
|
92
|
+
function normalize(p) {
|
|
93
|
+
if (p.length === 0) return ".";
|
|
94
|
+
const absolute = isAbsolute(p);
|
|
95
|
+
const trailingSlash = p.charCodeAt(p.length - 1) === 47;
|
|
96
|
+
const segments = normalizeSegments(p.split("/"), !absolute);
|
|
97
|
+
let joined = segments.join("/");
|
|
98
|
+
if (joined.length === 0) {
|
|
99
|
+
if (absolute) return "/";
|
|
100
|
+
return trailingSlash ? "./" : ".";
|
|
101
|
+
}
|
|
102
|
+
if (trailingSlash) joined += "/";
|
|
103
|
+
return absolute ? "/" + joined : joined;
|
|
104
|
+
}
|
|
105
|
+
function join(...parts) {
|
|
106
|
+
const present = parts.filter((part) => part.length > 0);
|
|
107
|
+
if (present.length === 0) return ".";
|
|
108
|
+
return normalize(present.join("/"));
|
|
109
|
+
}
|
|
110
|
+
function resolve(...parts) {
|
|
111
|
+
let resolved = "";
|
|
112
|
+
let absolute = false;
|
|
113
|
+
for (let i = parts.length - 1; i >= 0 && !absolute; i--) {
|
|
114
|
+
const part = parts[i];
|
|
115
|
+
if (part.length === 0) continue;
|
|
116
|
+
resolved = resolved.length > 0 ? `${part}/${resolved}` : part;
|
|
117
|
+
absolute = isAbsolute(part);
|
|
118
|
+
}
|
|
119
|
+
if (!absolute)
|
|
120
|
+
throw new Error(
|
|
121
|
+
`posixPath.resolve needs an absolute segment, got: ${parts.join(", ")}`
|
|
122
|
+
);
|
|
123
|
+
const normalized = normalizeSegments(resolved.split("/"), false).join("/");
|
|
124
|
+
return normalized.length > 0 ? "/" + normalized : "/";
|
|
125
|
+
}
|
|
126
|
+
function dirname(p) {
|
|
127
|
+
const idx = p.lastIndexOf("/");
|
|
128
|
+
if (idx < 0) return ".";
|
|
129
|
+
if (idx === 0) return "/";
|
|
130
|
+
return p.slice(0, idx);
|
|
131
|
+
}
|
|
132
|
+
function basename(p, ext) {
|
|
133
|
+
const idx = p.lastIndexOf("/");
|
|
134
|
+
const base = idx < 0 ? p : p.slice(idx + 1);
|
|
135
|
+
if (ext != null && ext.length < base.length && base.endsWith(ext)) {
|
|
136
|
+
return base.slice(0, base.length - ext.length);
|
|
137
|
+
}
|
|
138
|
+
return base;
|
|
139
|
+
}
|
|
140
|
+
function extname(p) {
|
|
141
|
+
const base = basename(p);
|
|
142
|
+
const idx = base.lastIndexOf(".");
|
|
143
|
+
if (idx <= 0) return "";
|
|
144
|
+
return base.slice(idx);
|
|
145
|
+
}
|
|
146
|
+
function relative(from, to) {
|
|
147
|
+
if (from === to) return "";
|
|
148
|
+
const fromParts = normalizeSegments(from.split("/"), false);
|
|
149
|
+
const toParts = normalizeSegments(to.split("/"), false);
|
|
150
|
+
let shared = 0;
|
|
151
|
+
while (shared < fromParts.length && shared < toParts.length && fromParts[shared] === toParts[shared]) {
|
|
152
|
+
shared++;
|
|
153
|
+
}
|
|
154
|
+
const up = new Array(fromParts.length - shared).fill("..");
|
|
155
|
+
return [...up, ...toParts.slice(shared)].join("/");
|
|
156
|
+
}
|
|
157
|
+
var posix = {
|
|
158
|
+
sep,
|
|
159
|
+
delimiter,
|
|
160
|
+
isAbsolute,
|
|
161
|
+
normalize,
|
|
162
|
+
join,
|
|
163
|
+
resolve,
|
|
164
|
+
dirname,
|
|
165
|
+
basename,
|
|
166
|
+
extname,
|
|
167
|
+
relative
|
|
168
|
+
};
|
|
169
|
+
var posixPath_default = { ...posix, posix };
|
|
170
|
+
|
|
171
|
+
// ../contrast-bundler/src/replacementModule.ts
|
|
172
|
+
var REPLACEMENT_MODULE_EXTENSIONS = [".js", ".jsx", ".ts", ".tsx"];
|
|
173
|
+
var IMPORT_KEYWORD = import_types.TokenType["_import"];
|
|
174
|
+
var EXPORT_KEYWORD = import_types.TokenType["_export"];
|
|
175
|
+
var REACT_BRIDGE = "globalThis.__sootsim_react_bridge";
|
|
176
|
+
var REACT_NATIVE_BRIDGE = "globalThis.__sootsim_components__";
|
|
177
|
+
var PACKAGE_BRIDGES = "globalThis.__sootsim_config_package_modules";
|
|
178
|
+
var JSX_RUNTIME_SPECIFIERS = /* @__PURE__ */ new Set(["react/jsx-runtime", "react/jsx-dev-runtime"]);
|
|
179
|
+
function transformsFor(filePath) {
|
|
180
|
+
switch (extname(filePath).toLowerCase()) {
|
|
181
|
+
case ".ts":
|
|
182
|
+
return ["typescript"];
|
|
183
|
+
case ".tsx":
|
|
184
|
+
return ["typescript", "jsx"];
|
|
185
|
+
case ".js":
|
|
186
|
+
case ".jsx":
|
|
187
|
+
return ["jsx"];
|
|
188
|
+
default:
|
|
189
|
+
throw new Error(
|
|
190
|
+
`replacement files must be ${REPLACEMENT_MODULE_EXTENSIONS.join(", ")}`
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
function unsupportedSpecifier(specifier) {
|
|
195
|
+
return new Error(
|
|
196
|
+
`replacement modules may only import react, react-native, and the packages rnx stubs for this app; '${specifier}' is none of those. vendor the code into the replacement file, or add the package to rnx.config so the simulator bridges it.`
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
function bridgeDeclaration(name, specifier) {
|
|
200
|
+
const notReady = (what) => JSON.stringify(`[rnx] replacement ${what} bridge is not ready`);
|
|
201
|
+
if (specifier === "react") {
|
|
202
|
+
return `const ${name} = ${REACT_BRIDGE}; if (!${name}) throw new Error(${notReady("React")});`;
|
|
203
|
+
}
|
|
204
|
+
if (specifier === "react-native") {
|
|
205
|
+
return `const ${name} = ${REACT_NATIVE_BRIDGE}; if (!${name}) throw new Error(${notReady("React Native")});`;
|
|
206
|
+
}
|
|
207
|
+
if (JSX_RUNTIME_SPECIFIERS.has(specifier)) {
|
|
208
|
+
return `const ${name} = (() => { const react = ${REACT_BRIDGE}; if (!react) throw new Error(${notReady("React")}); const jsx = (type, props, key) => react.createElement(type, key === undefined ? props : { ...props, key }); return { Fragment: react.Fragment, jsx, jsxs: jsx, jsxDEV: jsx }; })();`;
|
|
209
|
+
}
|
|
210
|
+
return `const ${name} = (${PACKAGE_BRIDGES} || {})[${JSON.stringify(specifier)}]; if (!${name}) throw new Error(${JSON.stringify(`[rnx] replacement package bridge ${specifier} is not ready`)});`;
|
|
211
|
+
}
|
|
212
|
+
var DEFAULT_INTEROP = "__rnxReplacementDefault";
|
|
213
|
+
var DEFAULT_INTEROP_DECLARATION = `const ${DEFAULT_INTEROP} = (bridge) => (bridge && bridge.__esModule ? bridge.default : bridge);`;
|
|
214
|
+
function compileReplacementModule(input) {
|
|
215
|
+
const transformed = (0, import_dist.transform)(input.source, {
|
|
216
|
+
transforms: transformsFor(input.filePath),
|
|
217
|
+
filePath: input.filePath,
|
|
218
|
+
// classic runtime, matching what the app's own Metro build does for a file
|
|
219
|
+
// that has no automatic-runtime pragma: the file imports React itself.
|
|
220
|
+
jsxRuntime: "classic",
|
|
221
|
+
jsxPragma: "React.createElement",
|
|
222
|
+
jsxFragmentPragma: "React.Fragment",
|
|
223
|
+
production: true,
|
|
224
|
+
sourceMapOptions: { compiledFilename: input.filePath }
|
|
225
|
+
});
|
|
226
|
+
const code = transformed.code;
|
|
227
|
+
const sourceMap = transformed.sourceMap;
|
|
228
|
+
if (!sourceMap) throw new Error("sucrase compiled the replacement with no source map");
|
|
229
|
+
const { tokens } = (0, import_parser.parse)(code, false, false, false);
|
|
230
|
+
const read = (token) => code.slice(token.start, token.end);
|
|
231
|
+
const readSpecifier = (token) => {
|
|
232
|
+
if (token.type !== import_types.TokenType.string) {
|
|
233
|
+
throw new Error("replacement module import has no string specifier");
|
|
234
|
+
}
|
|
235
|
+
return code.slice(token.start + 1, token.end - 1);
|
|
236
|
+
};
|
|
237
|
+
const bridgeNames = /* @__PURE__ */ new Map();
|
|
238
|
+
const declarations = [];
|
|
239
|
+
let needsDefaultInterop = false;
|
|
240
|
+
const bridgeFor = (specifier) => {
|
|
241
|
+
const existing = bridgeNames.get(specifier);
|
|
242
|
+
if (existing) return existing;
|
|
243
|
+
const name = `__rnxReplacementBridge${bridgeNames.size}`;
|
|
244
|
+
bridgeNames.set(specifier, name);
|
|
245
|
+
declarations.push(bridgeDeclaration(name, specifier));
|
|
246
|
+
return name;
|
|
247
|
+
};
|
|
248
|
+
const edits = [];
|
|
249
|
+
for (let index = 0; index < tokens.length; index++) {
|
|
250
|
+
const token = tokens[index];
|
|
251
|
+
if (token.type === EXPORT_KEYWORD) {
|
|
252
|
+
const after2 = tokens[index + 1];
|
|
253
|
+
let fromAt = -1;
|
|
254
|
+
if (after2?.type === import_types.TokenType.star) {
|
|
255
|
+
fromAt = read(tokens[index + 2]) === "from" ? index + 2 : index + 4;
|
|
256
|
+
} else if (after2?.type === import_types.TokenType.braceL) {
|
|
257
|
+
let depth = 1;
|
|
258
|
+
let cursor2 = index + 2;
|
|
259
|
+
while (cursor2 < tokens.length && depth > 0) {
|
|
260
|
+
if (tokens[cursor2].type === import_types.TokenType.braceL) depth++;
|
|
261
|
+
else if (tokens[cursor2].type === import_types.TokenType.braceR) depth--;
|
|
262
|
+
cursor2++;
|
|
263
|
+
}
|
|
264
|
+
fromAt = cursor2;
|
|
265
|
+
}
|
|
266
|
+
if (fromAt > 0 && tokens[fromAt] && read(tokens[fromAt]) === "from" && tokens[fromAt + 1]?.type === import_types.TokenType.string) {
|
|
267
|
+
const specifier2 = readSpecifier(tokens[fromAt + 1]);
|
|
268
|
+
throw new Error(
|
|
269
|
+
`a replacement module cannot re-export from another module, and this one re-exports from '${specifier2}'. import what you need and export the binding.`
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
if (token.type !== IMPORT_KEYWORD) continue;
|
|
275
|
+
const after = tokens[index + 1];
|
|
276
|
+
if (!after || after.type === import_types.TokenType.parenL || after.type === import_types.TokenType.dot) continue;
|
|
277
|
+
const bindings = [];
|
|
278
|
+
let cursor = index + 1;
|
|
279
|
+
if (after.type !== import_types.TokenType.string) {
|
|
280
|
+
while (cursor < tokens.length) {
|
|
281
|
+
const clause = tokens[cursor];
|
|
282
|
+
if (clause.type === import_types.TokenType.name && read(clause) === "from") break;
|
|
283
|
+
if (clause.type === import_types.TokenType.comma) {
|
|
284
|
+
cursor++;
|
|
285
|
+
continue;
|
|
286
|
+
}
|
|
287
|
+
if (clause.type === import_types.TokenType.star) {
|
|
288
|
+
bindings.push({ local: read(tokens[cursor + 2]), imported: null });
|
|
289
|
+
cursor += 3;
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
if (clause.type === import_types.TokenType.braceL) {
|
|
293
|
+
cursor++;
|
|
294
|
+
while (cursor < tokens.length && tokens[cursor].type !== import_types.TokenType.braceR) {
|
|
295
|
+
if (tokens[cursor].type === import_types.TokenType.comma) {
|
|
296
|
+
cursor++;
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
const nameToken = tokens[cursor];
|
|
300
|
+
const imported = nameToken.type === import_types.TokenType.string ? readSpecifier(nameToken) : read(nameToken);
|
|
301
|
+
let local = imported;
|
|
302
|
+
if (tokens[cursor + 1] && read(tokens[cursor + 1]) === "as") {
|
|
303
|
+
local = read(tokens[cursor + 2]);
|
|
304
|
+
cursor += 2;
|
|
305
|
+
}
|
|
306
|
+
bindings.push({ local, imported });
|
|
307
|
+
cursor++;
|
|
308
|
+
}
|
|
309
|
+
cursor++;
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
bindings.push({ local: read(clause), imported: "default" });
|
|
313
|
+
cursor++;
|
|
314
|
+
}
|
|
315
|
+
cursor++;
|
|
316
|
+
}
|
|
317
|
+
const specifierToken = tokens[cursor];
|
|
318
|
+
if (!specifierToken) throw new Error("replacement module import is unterminated");
|
|
319
|
+
const specifier = readSpecifier(specifierToken);
|
|
320
|
+
if (specifier !== "react" && specifier !== "react-native" && !JSX_RUNTIME_SPECIFIERS.has(specifier) && !input.runtimePackages.has(specifier)) {
|
|
321
|
+
throw unsupportedSpecifier(specifier);
|
|
322
|
+
}
|
|
323
|
+
const bridge = bindings.length > 0 ? bridgeFor(specifier) : null;
|
|
324
|
+
const replacement = bindings.map((binding) => {
|
|
325
|
+
if (binding.imported === null) return `const ${binding.local} = ${bridge};`;
|
|
326
|
+
if (binding.imported === "default") {
|
|
327
|
+
needsDefaultInterop = true;
|
|
328
|
+
return `const ${binding.local} = ${DEFAULT_INTEROP}(${bridge});`;
|
|
329
|
+
}
|
|
330
|
+
return `const ${binding.local} = ${bridge}[${JSON.stringify(binding.imported)}];`;
|
|
331
|
+
}).join(" ");
|
|
332
|
+
const start = token.start;
|
|
333
|
+
const end = specifierToken.end;
|
|
334
|
+
const newlines = code.slice(start, end).split("\n").length - 1;
|
|
335
|
+
edits.push({ start, end, text: replacement + "\n".repeat(newlines) });
|
|
336
|
+
}
|
|
337
|
+
let out = code;
|
|
338
|
+
for (const edit of edits.reverse()) {
|
|
339
|
+
out = out.slice(0, edit.start) + edit.text + out.slice(edit.end);
|
|
340
|
+
}
|
|
341
|
+
if (needsDefaultInterop) declarations.unshift(DEFAULT_INTEROP_DECLARATION);
|
|
342
|
+
const preamble = declarations.join(" ");
|
|
343
|
+
return {
|
|
344
|
+
code: preamble ? `${preamble} ${out}` : out,
|
|
345
|
+
sourceMap: { ...sourceMap, sourcesContent: [input.source] }
|
|
346
|
+
};
|
|
347
|
+
}
|
|
68
348
|
|
|
69
349
|
// src/backend-origin.ts
|
|
70
350
|
function normalizeHostname(hostname) {
|
|
@@ -77,21 +357,6 @@ function isLoopbackHost(hostname) {
|
|
|
77
357
|
|
|
78
358
|
// src/host/replacement-module-handler.ts
|
|
79
359
|
var REPLACEMENT_MODULE_ROUTE = "/__sootsim-replacement-module";
|
|
80
|
-
function getReplacementLoader(filePath) {
|
|
81
|
-
const ext = import_node_path.default.extname(filePath).toLowerCase();
|
|
82
|
-
switch (ext) {
|
|
83
|
-
case ".js":
|
|
84
|
-
return "js";
|
|
85
|
-
case ".jsx":
|
|
86
|
-
return "jsx";
|
|
87
|
-
case ".ts":
|
|
88
|
-
return "ts";
|
|
89
|
-
case ".tsx":
|
|
90
|
-
return "tsx";
|
|
91
|
-
default:
|
|
92
|
-
return null;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
360
|
function sendJavaScript(req, res, source) {
|
|
96
361
|
const origin = req.headers.origin;
|
|
97
362
|
let allowedOrigin;
|
|
@@ -154,10 +419,10 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
154
419
|
res.end("missing path param");
|
|
155
420
|
return true;
|
|
156
421
|
}
|
|
157
|
-
const
|
|
158
|
-
if (!
|
|
422
|
+
const extension = import_node_path.default.extname(targetPath).toLowerCase();
|
|
423
|
+
if (!REPLACEMENT_MODULE_EXTENSIONS.some((allowed) => allowed === extension)) {
|
|
159
424
|
res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
|
|
160
|
-
res.end(
|
|
425
|
+
res.end(`replacement files must be ${REPLACEMENT_MODULE_EXTENSIONS.join(", ")}`);
|
|
161
426
|
return true;
|
|
162
427
|
}
|
|
163
428
|
if (!import_node_path.default.isAbsolute(targetPath)) {
|
|
@@ -195,81 +460,23 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
195
460
|
}
|
|
196
461
|
}
|
|
197
462
|
try {
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
format: "esm",
|
|
203
|
-
platform: "browser",
|
|
204
|
-
target: "es2022",
|
|
205
|
-
jsx: "transform",
|
|
206
|
-
jsxFactory: "React.createElement",
|
|
207
|
-
jsxFragment: "React.Fragment",
|
|
208
|
-
tsconfigRaw: { compilerOptions: { jsx: "react" } },
|
|
209
|
-
sourcemap: "inline",
|
|
210
|
-
logLevel: "silent",
|
|
211
|
-
plugins: [
|
|
212
|
-
{
|
|
213
|
-
name: "sootsim-replacement-runtime",
|
|
214
|
-
setup(runtimeBuild) {
|
|
215
|
-
runtimeBuild.onResolve(
|
|
216
|
-
{
|
|
217
|
-
filter: /^(react|react-native|react\/jsx-runtime|react\/jsx-dev-runtime)$/
|
|
218
|
-
},
|
|
219
|
-
(args) => ({ path: args.path, namespace: "sootsim-replacement-runtime" })
|
|
220
|
-
);
|
|
221
|
-
runtimeBuild.onResolve(
|
|
222
|
-
{ filter: /.*/ },
|
|
223
|
-
(args) => runtimePackages.has(args.path) ? { path: args.path, namespace: "sootsim-replacement-runtime" } : void 0
|
|
224
|
-
);
|
|
225
|
-
runtimeBuild.onLoad(
|
|
226
|
-
{ filter: /.*/, namespace: "sootsim-replacement-runtime" },
|
|
227
|
-
(args) => {
|
|
228
|
-
if (args.path === "react-native") {
|
|
229
|
-
return {
|
|
230
|
-
contents: `const bridge = globalThis.__sootsim_components__
|
|
231
|
-
if (!bridge) throw new Error('[rnx] replacement React Native bridge is not ready')
|
|
232
|
-
module.exports = bridge`,
|
|
233
|
-
loader: "js"
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
if (args.path === "react") {
|
|
237
|
-
return {
|
|
238
|
-
contents: `const bridge = globalThis.__sootsim_react_bridge
|
|
239
|
-
if (!bridge) throw new Error('[rnx] replacement React bridge is not ready')
|
|
240
|
-
module.exports = bridge`,
|
|
241
|
-
loader: "js"
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
if (args.path !== "react/jsx-runtime" && args.path !== "react/jsx-dev-runtime") {
|
|
245
|
-
return {
|
|
246
|
-
contents: `const packages = globalThis.__sootsim_config_package_modules
|
|
247
|
-
const bridge = packages?.[${JSON.stringify(args.path)}]
|
|
248
|
-
if (!bridge) throw new Error(${JSON.stringify(`[rnx] replacement package bridge ${args.path} is not ready`)})
|
|
249
|
-
module.exports = bridge`,
|
|
250
|
-
loader: "js"
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
return {
|
|
254
|
-
contents: `const React = globalThis.__sootsim_react_bridge
|
|
255
|
-
if (!React) throw new Error('[rnx] replacement React bridge is not ready')
|
|
256
|
-
exports.Fragment = React.Fragment
|
|
257
|
-
exports.jsx = (type, props, key) => React.createElement(type, key === undefined ? props : { ...props, key })
|
|
258
|
-
exports.jsxs = exports.jsx
|
|
259
|
-
exports.jsxDEV = exports.jsx`,
|
|
260
|
-
loader: "js"
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
]
|
|
463
|
+
const compiled = compileReplacementModule({
|
|
464
|
+
filePath: resolvedTargetPath,
|
|
465
|
+
source: await import_promises.default.readFile(resolvedTargetPath, "utf8"),
|
|
466
|
+
runtimePackages
|
|
267
467
|
});
|
|
268
|
-
|
|
468
|
+
const map = Buffer.from(JSON.stringify(compiled.sourceMap), "utf8").toString("base64");
|
|
469
|
+
sendJavaScript(
|
|
470
|
+
req,
|
|
471
|
+
res,
|
|
472
|
+
`${compiled.code}
|
|
473
|
+
//# sourceMappingURL=data:application/json;base64,${map}
|
|
474
|
+
`
|
|
475
|
+
);
|
|
269
476
|
} catch (error) {
|
|
270
477
|
const message = error instanceof Error ? error.message : String(error);
|
|
271
478
|
res.writeHead(500, { "Content-Type": "text/plain; charset=utf-8" });
|
|
272
|
-
res.end(`replacement
|
|
479
|
+
res.end(`replacement compile failed: ${message}`);
|
|
273
480
|
}
|
|
274
481
|
return true;
|
|
275
482
|
}
|
|
@@ -278,20 +485,20 @@ exports.jsxDEV = exports.jsx`,
|
|
|
278
485
|
var RNXSIM_METRO_MODULE_PATHS_PREFIX = "globalThis.__sootsimModulePaths=";
|
|
279
486
|
var RNX_METRO_MODULE_IDENTITY_VERSION = 2;
|
|
280
487
|
function toRNXProductionBundleUrl(bundleUrl) {
|
|
281
|
-
const
|
|
488
|
+
const relative2 = bundleUrl.startsWith("/");
|
|
282
489
|
const url = new URL(bundleUrl, "http://rnxsim.local");
|
|
283
490
|
url.searchParams.set("dev", "false");
|
|
284
491
|
url.searchParams.set("hot", "false");
|
|
285
492
|
url.searchParams.set("minify", "true");
|
|
286
|
-
return
|
|
493
|
+
return relative2 ? `${url.pathname}${url.search}${url.hash}` : url.toString();
|
|
287
494
|
}
|
|
288
495
|
function toRNXDevelopmentBundleUrl(bundleUrl) {
|
|
289
|
-
const
|
|
496
|
+
const relative2 = bundleUrl.startsWith("/");
|
|
290
497
|
const url = new URL(bundleUrl, "http://rnxsim.local");
|
|
291
498
|
url.searchParams.set("dev", "true");
|
|
292
499
|
url.searchParams.set("hot", "false");
|
|
293
500
|
url.searchParams.set("minify", "false");
|
|
294
|
-
return
|
|
501
|
+
return relative2 ? `${url.pathname}${url.search}${url.hash}` : url.toString();
|
|
295
502
|
}
|
|
296
503
|
var RNXSIM_METRO_SOURCE_MAP_COMMENT = "//# sourceMappingURL=";
|
|
297
504
|
function detachRNXMetroSourceMapUrl(bundleText) {
|
package/dist-lib/profiles.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.434 | (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.434 | (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.434 | (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/render-mode.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.434 | (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.434 | (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;
|
package/dist-lib/sdk.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.434 | (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/sdk.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.434 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|