peachsim 0.1.824 → 0.1.826
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/commands/record.ts +33 -14
- package/cli/drivers/playwright-sim-host.ts +5 -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/bundle-channel.cjs +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-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.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/expo-swift-bundle.cjs +1 -1
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +9 -1
- package/dist-lib/host/bridge-host.cjs +265 -219
- package/dist-lib/host/fetch-proxy-handler.cjs +2 -2
- 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 +2 -2
- package/dist-lib/index.cjs +1 -1
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -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 +1 -1
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- 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 +2 -2
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +504 -456
- package/dist-lib/swift-compile.cjs +1 -1
- package/dist-lib/swift-compile.mjs +1 -1
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +1 -1
- package/dist-lib/vite.cjs +1 -1
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/package.json +1 -1
- package/scripts/dev-server-scanner.ts +4 -1
- package/src/home-paths.ts +8 -0
- package/src/host/bridge-host.ts +4 -1
- package/src/host/fetch-proxy-handler.ts +5 -1
- package/src/host/fetch-proxy-transport.ts +76 -18
- package/src/host/websocket-proxy.ts +3 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.826 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -441,6 +441,9 @@ function daemonLockfilePath() {
|
|
|
441
441
|
function devBridgesDir() {
|
|
442
442
|
return import_node_path4.default.join(rnxHomeDir(), DEV_BRIDGES_DIR);
|
|
443
443
|
}
|
|
444
|
+
function fetchTransportIdentityPath(bridgePort) {
|
|
445
|
+
return import_node_path4.default.join(rnxHomeDir(), FETCH_TRANSPORT_DIR, `${bridgePort}.json`);
|
|
446
|
+
}
|
|
444
447
|
function devBridgeLockfilePath(bridgePort) {
|
|
445
448
|
if (!Number.isInteger(bridgePort) || bridgePort <= 0) {
|
|
446
449
|
throw new Error(`invalid development bridge port: ${bridgePort}`);
|
|
@@ -727,7 +730,7 @@ function removeDevBridgeLockfile(owner) {
|
|
|
727
730
|
} catch {
|
|
728
731
|
}
|
|
729
732
|
}
|
|
730
|
-
var import_node_crypto, import_node_fs3, import_node_os, import_node_path4, PEACH_HOME_ENV, ACTIVE_RUNTIME_FILE, DAEMON_LOCKFILE, DEV_BRIDGES_DIR, CONFIG_FILE, DAEMON_HEARTBEAT_STALE_MS, DAEMON_LOCKFILE_MAX_BYTES, DAEMON_CLAIM_STALE_MS;
|
|
733
|
+
var import_node_crypto, import_node_fs3, import_node_os, import_node_path4, PEACH_HOME_ENV, ACTIVE_RUNTIME_FILE, DAEMON_LOCKFILE, DEV_BRIDGES_DIR, FETCH_TRANSPORT_DIR, CONFIG_FILE, DAEMON_HEARTBEAT_STALE_MS, DAEMON_LOCKFILE_MAX_BYTES, DAEMON_CLAIM_STALE_MS;
|
|
731
734
|
var init_home_paths = __esm({
|
|
732
735
|
"src/home-paths.ts"() {
|
|
733
736
|
"use strict";
|
|
@@ -739,6 +742,7 @@ var init_home_paths = __esm({
|
|
|
739
742
|
ACTIVE_RUNTIME_FILE = "active";
|
|
740
743
|
DAEMON_LOCKFILE = "daemon.json";
|
|
741
744
|
DEV_BRIDGES_DIR = "dev-bridges";
|
|
745
|
+
FETCH_TRANSPORT_DIR = "fetch-transport";
|
|
742
746
|
CONFIG_FILE = "config.json";
|
|
743
747
|
DAEMON_HEARTBEAT_STALE_MS = 3e4;
|
|
744
748
|
DAEMON_LOCKFILE_MAX_BYTES = 16 * 1024;
|
|
@@ -3840,8 +3844,8 @@ function metroIosAssetDestRelatives(httpServerLocation, filename) {
|
|
|
3840
3844
|
}
|
|
3841
3845
|
const out = [];
|
|
3842
3846
|
for (const dir of dirs) {
|
|
3843
|
-
const
|
|
3844
|
-
if (!out.includes(
|
|
3847
|
+
const path26 = `${dir}/${filename}`;
|
|
3848
|
+
if (!out.includes(path26)) out.push(path26);
|
|
3845
3849
|
}
|
|
3846
3850
|
if (!out.includes(filename)) out.push(filename);
|
|
3847
3851
|
return out;
|
|
@@ -4805,13 +4809,13 @@ function readFactoryStringLiterals(factory) {
|
|
|
4805
4809
|
return literals;
|
|
4806
4810
|
}
|
|
4807
4811
|
function normalizeFingerprintLiteral(literal) {
|
|
4808
|
-
const
|
|
4812
|
+
const path26 = literal.replaceAll("\\\\", "/").replaceAll("\\/", "/");
|
|
4809
4813
|
const nodeModulesMarker = "/node_modules/";
|
|
4810
|
-
const nodeModulesIndex =
|
|
4814
|
+
const nodeModulesIndex = path26.lastIndexOf(nodeModulesMarker);
|
|
4811
4815
|
if (nodeModulesIndex >= 0) {
|
|
4812
|
-
return `node_modules/${
|
|
4816
|
+
return `node_modules/${path26.slice(nodeModulesIndex + nodeModulesMarker.length)}`;
|
|
4813
4817
|
}
|
|
4814
|
-
if ((
|
|
4818
|
+
if ((path26.startsWith("/") || /^[A-Za-z]:\//.test(path26) || path26.startsWith("file:/")) && /\.[cm]?[jt]sx?(?::\d+(?::\d+)?)?$/.test(path26)) {
|
|
4815
4819
|
return null;
|
|
4816
4820
|
}
|
|
4817
4821
|
return literal;
|
|
@@ -5049,10 +5053,10 @@ function templateAssignment(template, embeddings) {
|
|
|
5049
5053
|
if (existingNode !== void 0 && existingNode !== nodeIndex) return null;
|
|
5050
5054
|
nodesByModuleId.set(moduleId, nodeIndex);
|
|
5051
5055
|
const node = template.nodes[nodeIndex];
|
|
5052
|
-
const
|
|
5056
|
+
const path26 = node.landmarkPath ?? `node_modules/${template.packageName}/__rnx_inferred__/${moduleId}.js`;
|
|
5053
5057
|
const existingPath = pathsByModuleId.get(moduleId);
|
|
5054
|
-
if (existingPath !== void 0 && existingPath !==
|
|
5055
|
-
pathsByModuleId.set(moduleId,
|
|
5058
|
+
if (existingPath !== void 0 && existingPath !== path26) return null;
|
|
5059
|
+
pathsByModuleId.set(moduleId, path26);
|
|
5056
5060
|
}
|
|
5057
5061
|
}
|
|
5058
5062
|
return {
|
|
@@ -5214,14 +5218,14 @@ async function inferMetroModuleIdentity(args) {
|
|
|
5214
5218
|
const packageClaims = claimsByPackage.values().next().value;
|
|
5215
5219
|
if (!packageClaims) continue;
|
|
5216
5220
|
const exactClaims = packageClaims.filter((assignment2) => {
|
|
5217
|
-
const
|
|
5218
|
-
return
|
|
5221
|
+
const path26 = assignment2.pathsByModuleId.get(moduleId);
|
|
5222
|
+
return path26 !== void 0 && !path26.includes("/__rnx_inferred__/");
|
|
5219
5223
|
});
|
|
5220
5224
|
const preferredClaims = exactClaims.length > 0 ? exactClaims : packageClaims;
|
|
5221
5225
|
const routes = new Set(
|
|
5222
5226
|
preferredClaims.flatMap((assignment2) => {
|
|
5223
|
-
const
|
|
5224
|
-
return
|
|
5227
|
+
const path26 = assignment2.pathsByModuleId.get(moduleId);
|
|
5228
|
+
return path26 ? [metroFingerprintModuleClaimRoute(assignment2.packageName, path26)] : [];
|
|
5225
5229
|
})
|
|
5226
5230
|
);
|
|
5227
5231
|
if (routes.size !== 1) continue;
|
|
@@ -5464,17 +5468,17 @@ function visit(node, visitor) {
|
|
|
5464
5468
|
} else
|
|
5465
5469
|
visit_(null, node, visitor_, Object.freeze([]));
|
|
5466
5470
|
}
|
|
5467
|
-
function visit_(key2, node, visitor,
|
|
5468
|
-
const ctrl = callVisitor(key2, node, visitor,
|
|
5471
|
+
function visit_(key2, node, visitor, path26) {
|
|
5472
|
+
const ctrl = callVisitor(key2, node, visitor, path26);
|
|
5469
5473
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
5470
|
-
replaceNode(key2,
|
|
5471
|
-
return visit_(key2, ctrl, visitor,
|
|
5474
|
+
replaceNode(key2, path26, ctrl);
|
|
5475
|
+
return visit_(key2, ctrl, visitor, path26);
|
|
5472
5476
|
}
|
|
5473
5477
|
if (typeof ctrl !== "symbol") {
|
|
5474
5478
|
if (isCollection(node)) {
|
|
5475
|
-
|
|
5479
|
+
path26 = Object.freeze(path26.concat(node));
|
|
5476
5480
|
for (let i = 0; i < node.items.length; ++i) {
|
|
5477
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
5481
|
+
const ci = visit_(i, node.items[i], visitor, path26);
|
|
5478
5482
|
if (typeof ci === "number")
|
|
5479
5483
|
i = ci - 1;
|
|
5480
5484
|
else if (ci === BREAK)
|
|
@@ -5485,13 +5489,13 @@ function visit_(key2, node, visitor, path25) {
|
|
|
5485
5489
|
}
|
|
5486
5490
|
}
|
|
5487
5491
|
} else if (isPair(node)) {
|
|
5488
|
-
|
|
5489
|
-
const ck = visit_("key", node.key, visitor,
|
|
5492
|
+
path26 = Object.freeze(path26.concat(node));
|
|
5493
|
+
const ck = visit_("key", node.key, visitor, path26);
|
|
5490
5494
|
if (ck === BREAK)
|
|
5491
5495
|
return BREAK;
|
|
5492
5496
|
else if (ck === REMOVE)
|
|
5493
5497
|
node.key = null;
|
|
5494
|
-
const cv = visit_("value", node.value, visitor,
|
|
5498
|
+
const cv = visit_("value", node.value, visitor, path26);
|
|
5495
5499
|
if (cv === BREAK)
|
|
5496
5500
|
return BREAK;
|
|
5497
5501
|
else if (cv === REMOVE)
|
|
@@ -5509,17 +5513,17 @@ async function visitAsync(node, visitor) {
|
|
|
5509
5513
|
} else
|
|
5510
5514
|
await visitAsync_(null, node, visitor_, Object.freeze([]));
|
|
5511
5515
|
}
|
|
5512
|
-
async function visitAsync_(key2, node, visitor,
|
|
5513
|
-
const ctrl = await callVisitor(key2, node, visitor,
|
|
5516
|
+
async function visitAsync_(key2, node, visitor, path26) {
|
|
5517
|
+
const ctrl = await callVisitor(key2, node, visitor, path26);
|
|
5514
5518
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
5515
|
-
replaceNode(key2,
|
|
5516
|
-
return visitAsync_(key2, ctrl, visitor,
|
|
5519
|
+
replaceNode(key2, path26, ctrl);
|
|
5520
|
+
return visitAsync_(key2, ctrl, visitor, path26);
|
|
5517
5521
|
}
|
|
5518
5522
|
if (typeof ctrl !== "symbol") {
|
|
5519
5523
|
if (isCollection(node)) {
|
|
5520
|
-
|
|
5524
|
+
path26 = Object.freeze(path26.concat(node));
|
|
5521
5525
|
for (let i = 0; i < node.items.length; ++i) {
|
|
5522
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
5526
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path26);
|
|
5523
5527
|
if (typeof ci === "number")
|
|
5524
5528
|
i = ci - 1;
|
|
5525
5529
|
else if (ci === BREAK)
|
|
@@ -5530,13 +5534,13 @@ async function visitAsync_(key2, node, visitor, path25) {
|
|
|
5530
5534
|
}
|
|
5531
5535
|
}
|
|
5532
5536
|
} else if (isPair(node)) {
|
|
5533
|
-
|
|
5534
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
5537
|
+
path26 = Object.freeze(path26.concat(node));
|
|
5538
|
+
const ck = await visitAsync_("key", node.key, visitor, path26);
|
|
5535
5539
|
if (ck === BREAK)
|
|
5536
5540
|
return BREAK;
|
|
5537
5541
|
else if (ck === REMOVE)
|
|
5538
5542
|
node.key = null;
|
|
5539
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
5543
|
+
const cv = await visitAsync_("value", node.value, visitor, path26);
|
|
5540
5544
|
if (cv === BREAK)
|
|
5541
5545
|
return BREAK;
|
|
5542
5546
|
else if (cv === REMOVE)
|
|
@@ -5563,23 +5567,23 @@ function initVisitor(visitor) {
|
|
|
5563
5567
|
}
|
|
5564
5568
|
return visitor;
|
|
5565
5569
|
}
|
|
5566
|
-
function callVisitor(key2, node, visitor,
|
|
5570
|
+
function callVisitor(key2, node, visitor, path26) {
|
|
5567
5571
|
if (typeof visitor === "function")
|
|
5568
|
-
return visitor(key2, node,
|
|
5572
|
+
return visitor(key2, node, path26);
|
|
5569
5573
|
if (isMap(node))
|
|
5570
|
-
return visitor.Map?.(key2, node,
|
|
5574
|
+
return visitor.Map?.(key2, node, path26);
|
|
5571
5575
|
if (isSeq(node))
|
|
5572
|
-
return visitor.Seq?.(key2, node,
|
|
5576
|
+
return visitor.Seq?.(key2, node, path26);
|
|
5573
5577
|
if (isPair(node))
|
|
5574
|
-
return visitor.Pair?.(key2, node,
|
|
5578
|
+
return visitor.Pair?.(key2, node, path26);
|
|
5575
5579
|
if (isScalar(node))
|
|
5576
|
-
return visitor.Scalar?.(key2, node,
|
|
5580
|
+
return visitor.Scalar?.(key2, node, path26);
|
|
5577
5581
|
if (isAlias(node))
|
|
5578
|
-
return visitor.Alias?.(key2, node,
|
|
5582
|
+
return visitor.Alias?.(key2, node, path26);
|
|
5579
5583
|
return void 0;
|
|
5580
5584
|
}
|
|
5581
|
-
function replaceNode(key2,
|
|
5582
|
-
const parent =
|
|
5585
|
+
function replaceNode(key2, path26, node) {
|
|
5586
|
+
const parent = path26[path26.length - 1];
|
|
5583
5587
|
if (isCollection(parent)) {
|
|
5584
5588
|
parent.items[key2] = node;
|
|
5585
5589
|
} else if (isPair(parent)) {
|
|
@@ -6130,10 +6134,10 @@ var init_createNode = __esm({
|
|
|
6130
6134
|
});
|
|
6131
6135
|
|
|
6132
6136
|
// ../../node_modules/yaml/browser/dist/nodes/Collection.js
|
|
6133
|
-
function collectionFromPath(schema4,
|
|
6137
|
+
function collectionFromPath(schema4, path26, value) {
|
|
6134
6138
|
let v = value;
|
|
6135
|
-
for (let i =
|
|
6136
|
-
const k =
|
|
6139
|
+
for (let i = path26.length - 1; i >= 0; --i) {
|
|
6140
|
+
const k = path26[i];
|
|
6137
6141
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
6138
6142
|
const a = [];
|
|
6139
6143
|
a[k] = v;
|
|
@@ -6158,7 +6162,7 @@ var init_Collection = __esm({
|
|
|
6158
6162
|
init_createNode();
|
|
6159
6163
|
init_identity();
|
|
6160
6164
|
init_Node();
|
|
6161
|
-
isEmptyPath = (
|
|
6165
|
+
isEmptyPath = (path26) => path26 == null || typeof path26 === "object" && !!path26[Symbol.iterator]().next().done;
|
|
6162
6166
|
Collection = class extends NodeBase {
|
|
6163
6167
|
constructor(type, schema4) {
|
|
6164
6168
|
super(type);
|
|
@@ -6188,11 +6192,11 @@ var init_Collection = __esm({
|
|
|
6188
6192
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
6189
6193
|
* that already exists in the map.
|
|
6190
6194
|
*/
|
|
6191
|
-
addIn(
|
|
6192
|
-
if (isEmptyPath(
|
|
6195
|
+
addIn(path26, value) {
|
|
6196
|
+
if (isEmptyPath(path26))
|
|
6193
6197
|
this.add(value);
|
|
6194
6198
|
else {
|
|
6195
|
-
const [key2, ...rest] =
|
|
6199
|
+
const [key2, ...rest] = path26;
|
|
6196
6200
|
const node = this.get(key2, true);
|
|
6197
6201
|
if (isCollection(node))
|
|
6198
6202
|
node.addIn(rest, value);
|
|
@@ -6206,8 +6210,8 @@ var init_Collection = __esm({
|
|
|
6206
6210
|
* Removes a value from the collection.
|
|
6207
6211
|
* @returns `true` if the item was found and removed.
|
|
6208
6212
|
*/
|
|
6209
|
-
deleteIn(
|
|
6210
|
-
const [key2, ...rest] =
|
|
6213
|
+
deleteIn(path26) {
|
|
6214
|
+
const [key2, ...rest] = path26;
|
|
6211
6215
|
if (rest.length === 0)
|
|
6212
6216
|
return this.delete(key2);
|
|
6213
6217
|
const node = this.get(key2, true);
|
|
@@ -6221,8 +6225,8 @@ var init_Collection = __esm({
|
|
|
6221
6225
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
6222
6226
|
* `true` (collections are always returned intact).
|
|
6223
6227
|
*/
|
|
6224
|
-
getIn(
|
|
6225
|
-
const [key2, ...rest] =
|
|
6228
|
+
getIn(path26, keepScalar) {
|
|
6229
|
+
const [key2, ...rest] = path26;
|
|
6226
6230
|
const node = this.get(key2, true);
|
|
6227
6231
|
if (rest.length === 0)
|
|
6228
6232
|
return !keepScalar && isScalar(node) ? node.value : node;
|
|
@@ -6240,8 +6244,8 @@ var init_Collection = __esm({
|
|
|
6240
6244
|
/**
|
|
6241
6245
|
* Checks if the collection includes a value with the key `key`.
|
|
6242
6246
|
*/
|
|
6243
|
-
hasIn(
|
|
6244
|
-
const [key2, ...rest] =
|
|
6247
|
+
hasIn(path26) {
|
|
6248
|
+
const [key2, ...rest] = path26;
|
|
6245
6249
|
if (rest.length === 0)
|
|
6246
6250
|
return this.has(key2);
|
|
6247
6251
|
const node = this.get(key2, true);
|
|
@@ -6251,8 +6255,8 @@ var init_Collection = __esm({
|
|
|
6251
6255
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
6252
6256
|
* boolean to add/remove the item from the set.
|
|
6253
6257
|
*/
|
|
6254
|
-
setIn(
|
|
6255
|
-
const [key2, ...rest] =
|
|
6258
|
+
setIn(path26, value) {
|
|
6259
|
+
const [key2, ...rest] = path26;
|
|
6256
6260
|
if (rest.length === 0) {
|
|
6257
6261
|
this.set(key2, value);
|
|
6258
6262
|
} else {
|
|
@@ -8171,15 +8175,15 @@ function visit2(cst, visitor) {
|
|
|
8171
8175
|
cst = { start: cst.start, value: cst.value };
|
|
8172
8176
|
_visit(Object.freeze([]), cst, visitor);
|
|
8173
8177
|
}
|
|
8174
|
-
function _visit(
|
|
8175
|
-
let ctrl = visitor(item,
|
|
8178
|
+
function _visit(path26, item, visitor) {
|
|
8179
|
+
let ctrl = visitor(item, path26);
|
|
8176
8180
|
if (typeof ctrl === "symbol")
|
|
8177
8181
|
return ctrl;
|
|
8178
8182
|
for (const field of ["key", "value"]) {
|
|
8179
8183
|
const token = item[field];
|
|
8180
8184
|
if (token && "items" in token) {
|
|
8181
8185
|
for (let i = 0; i < token.items.length; ++i) {
|
|
8182
|
-
const ci = _visit(Object.freeze(
|
|
8186
|
+
const ci = _visit(Object.freeze(path26.concat([[field, i]])), token.items[i], visitor);
|
|
8183
8187
|
if (typeof ci === "number")
|
|
8184
8188
|
i = ci - 1;
|
|
8185
8189
|
else if (ci === BREAK2)
|
|
@@ -8190,10 +8194,10 @@ function _visit(path25, item, visitor) {
|
|
|
8190
8194
|
}
|
|
8191
8195
|
}
|
|
8192
8196
|
if (typeof ctrl === "function" && field === "key")
|
|
8193
|
-
ctrl = ctrl(item,
|
|
8197
|
+
ctrl = ctrl(item, path26);
|
|
8194
8198
|
}
|
|
8195
8199
|
}
|
|
8196
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
8200
|
+
return typeof ctrl === "function" ? ctrl(item, path26) : ctrl;
|
|
8197
8201
|
}
|
|
8198
8202
|
var BREAK2, SKIP2, REMOVE2;
|
|
8199
8203
|
var init_cst_visit = __esm({
|
|
@@ -8204,9 +8208,9 @@ var init_cst_visit = __esm({
|
|
|
8204
8208
|
visit2.BREAK = BREAK2;
|
|
8205
8209
|
visit2.SKIP = SKIP2;
|
|
8206
8210
|
visit2.REMOVE = REMOVE2;
|
|
8207
|
-
visit2.itemAtPath = (cst,
|
|
8211
|
+
visit2.itemAtPath = (cst, path26) => {
|
|
8208
8212
|
let item = cst;
|
|
8209
|
-
for (const [field, index] of
|
|
8213
|
+
for (const [field, index] of path26) {
|
|
8210
8214
|
const tok = item?.[field];
|
|
8211
8215
|
if (tok && "items" in tok) {
|
|
8212
8216
|
item = tok.items[index];
|
|
@@ -8215,9 +8219,9 @@ var init_cst_visit = __esm({
|
|
|
8215
8219
|
}
|
|
8216
8220
|
return item;
|
|
8217
8221
|
};
|
|
8218
|
-
visit2.parentCollection = (cst,
|
|
8219
|
-
const parent = visit2.itemAtPath(cst,
|
|
8220
|
-
const field =
|
|
8222
|
+
visit2.parentCollection = (cst, path26) => {
|
|
8223
|
+
const parent = visit2.itemAtPath(cst, path26.slice(0, -1));
|
|
8224
|
+
const field = path26[path26.length - 1][0];
|
|
8221
8225
|
const coll = parent?.[field];
|
|
8222
8226
|
if (coll && "items" in coll)
|
|
8223
8227
|
return coll;
|
|
@@ -8312,8 +8316,8 @@ function detectFramework(deps) {
|
|
|
8312
8316
|
return "unknown";
|
|
8313
8317
|
}
|
|
8314
8318
|
function detectProject(dir) {
|
|
8315
|
-
const pkgPath = (0,
|
|
8316
|
-
if (!(0,
|
|
8319
|
+
const pkgPath = (0, import_node_path30.join)(dir, "package.json");
|
|
8320
|
+
if (!(0, import_node_fs29.existsSync)(pkgPath)) return null;
|
|
8317
8321
|
const pkg = readProjectManifest(dir);
|
|
8318
8322
|
if (!pkg) return null;
|
|
8319
8323
|
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
@@ -8325,25 +8329,25 @@ function detectProject(dir) {
|
|
|
8325
8329
|
if (framework === "unknown") return null;
|
|
8326
8330
|
return {
|
|
8327
8331
|
dir,
|
|
8328
|
-
name: pkg.name || (0,
|
|
8332
|
+
name: pkg.name || (0, import_node_path30.basename)(dir),
|
|
8329
8333
|
framework,
|
|
8330
8334
|
// a config file is a config file whatever module system it declares. real
|
|
8331
8335
|
// apps write .cjs as often as .js, and missing one reads as "this project
|
|
8332
8336
|
// has no bundler config" and sends the user to create a second one.
|
|
8333
8337
|
hasViteConfig: CONFIG_EXTENSIONS.some(
|
|
8334
|
-
(ext) => (0,
|
|
8338
|
+
(ext) => (0, import_node_fs29.existsSync)((0, import_node_path30.join)(dir, `vite.config.${ext}`))
|
|
8335
8339
|
),
|
|
8336
8340
|
hasMetroConfig: CONFIG_EXTENSIONS.some(
|
|
8337
|
-
(ext) => (0,
|
|
8341
|
+
(ext) => (0, import_node_fs29.existsSync)((0, import_node_path30.join)(dir, `metro.config.${ext}`))
|
|
8338
8342
|
),
|
|
8339
8343
|
devCommand: typeof devCommand === "string" ? devCommand : null
|
|
8340
8344
|
};
|
|
8341
8345
|
}
|
|
8342
|
-
function readProjectMetadata(
|
|
8346
|
+
function readProjectMetadata(path26) {
|
|
8343
8347
|
try {
|
|
8344
|
-
const info = (0,
|
|
8348
|
+
const info = (0, import_node_fs29.lstatSync)(path26);
|
|
8345
8349
|
if (!info.isFile() || info.size > 4 * 1024 * 1024) return null;
|
|
8346
|
-
return (0,
|
|
8350
|
+
return (0, import_node_fs29.readFileSync)(path26, "utf8");
|
|
8347
8351
|
} catch {
|
|
8348
8352
|
return null;
|
|
8349
8353
|
}
|
|
@@ -8352,8 +8356,8 @@ function metadataValue(value, key2) {
|
|
|
8352
8356
|
if (!value || typeof value !== "object") return void 0;
|
|
8353
8357
|
return Object.getOwnPropertyDescriptor(value, key2)?.value;
|
|
8354
8358
|
}
|
|
8355
|
-
function readProjectJson(
|
|
8356
|
-
const text3 = readProjectMetadata(
|
|
8359
|
+
function readProjectJson(path26) {
|
|
8360
|
+
const text3 = readProjectMetadata(path26);
|
|
8357
8361
|
if (text3 === null) return null;
|
|
8358
8362
|
try {
|
|
8359
8363
|
const value = JSON.parse(text3);
|
|
@@ -8363,7 +8367,7 @@ function readProjectJson(path25) {
|
|
|
8363
8367
|
}
|
|
8364
8368
|
}
|
|
8365
8369
|
function readProjectManifest(dir) {
|
|
8366
|
-
const parsed = readProjectJson((0,
|
|
8370
|
+
const parsed = readProjectJson((0, import_node_path30.join)(dir, "package.json"));
|
|
8367
8371
|
if (!parsed || typeof parsed !== "object") return null;
|
|
8368
8372
|
const record2 = (value) => {
|
|
8369
8373
|
if (!value || typeof value !== "object") return {};
|
|
@@ -8380,12 +8384,12 @@ function readProjectManifest(dir) {
|
|
|
8380
8384
|
devDependencies: record2(metadataValue(parsed, "devDependencies"))
|
|
8381
8385
|
};
|
|
8382
8386
|
}
|
|
8383
|
-
var
|
|
8387
|
+
var import_node_fs29, import_node_path30, import_json52, CONFIG_EXTENSIONS;
|
|
8384
8388
|
var init_detect = __esm({
|
|
8385
8389
|
"cli/commands/detect.ts"() {
|
|
8386
8390
|
"use strict";
|
|
8387
|
-
|
|
8388
|
-
|
|
8391
|
+
import_node_fs29 = require("node:fs");
|
|
8392
|
+
import_node_path30 = require("node:path");
|
|
8389
8393
|
import_json52 = __toESM(require_lib(), 1);
|
|
8390
8394
|
init_browser();
|
|
8391
8395
|
CONFIG_EXTENSIONS = ["ts", "js", "cjs", "mjs", "mts", "cts"];
|
|
@@ -8422,21 +8426,21 @@ function resolveCloudOrigin(value) {
|
|
|
8422
8426
|
return normalizeCloudOrigin(source);
|
|
8423
8427
|
}
|
|
8424
8428
|
function readImmutableBundleSource(bundlePath) {
|
|
8425
|
-
const filepath = (0,
|
|
8426
|
-
if ((0,
|
|
8429
|
+
const filepath = (0, import_node_path31.resolve)(bundlePath);
|
|
8430
|
+
if ((0, import_node_path31.extname)(filepath) !== ".js") {
|
|
8427
8431
|
throw new Error(`${REMOTE_COMMAND} requires one local Metro .js bundle`);
|
|
8428
8432
|
}
|
|
8429
|
-
const descriptor = (0,
|
|
8433
|
+
const descriptor = (0, import_node_fs30.openSync)(filepath, "r");
|
|
8430
8434
|
try {
|
|
8431
|
-
const before = (0,
|
|
8435
|
+
const before = (0, import_node_fs30.fstatSync)(descriptor, { bigint: true });
|
|
8432
8436
|
if (!before.isFile()) {
|
|
8433
8437
|
throw new Error(`${REMOTE_COMMAND} bundle must be a regular local file`);
|
|
8434
8438
|
}
|
|
8435
8439
|
if (before.size <= 0n) {
|
|
8436
8440
|
throw new Error(`${REMOTE_COMMAND} bundle is empty`);
|
|
8437
8441
|
}
|
|
8438
|
-
const bytes = (0,
|
|
8439
|
-
const after = (0,
|
|
8442
|
+
const bytes = (0, import_node_fs30.readFileSync)(descriptor);
|
|
8443
|
+
const after = (0, import_node_fs30.fstatSync)(descriptor, { bigint: true });
|
|
8440
8444
|
if (before.dev !== after.dev || before.ino !== after.ino || before.size !== after.size || before.mtimeNs !== after.mtimeNs || bytes.length !== Number(before.size)) {
|
|
8441
8445
|
throw new Error(`${REMOTE_COMMAND} bundle changed while it was being read`);
|
|
8442
8446
|
}
|
|
@@ -8451,7 +8455,7 @@ function readImmutableBundleSource(bundlePath) {
|
|
|
8451
8455
|
}
|
|
8452
8456
|
return source;
|
|
8453
8457
|
} finally {
|
|
8454
|
-
(0,
|
|
8458
|
+
(0, import_node_fs30.closeSync)(descriptor);
|
|
8455
8459
|
}
|
|
8456
8460
|
}
|
|
8457
8461
|
async function fetchBundleSource(bundleUrl) {
|
|
@@ -8498,15 +8502,15 @@ async function loadBundleSource(bundleInput) {
|
|
|
8498
8502
|
return readImmutableBundleSource(bundleInput);
|
|
8499
8503
|
}
|
|
8500
8504
|
function listMetroAssetDest(assetsPath) {
|
|
8501
|
-
const directory = (0,
|
|
8502
|
-
if (!(0,
|
|
8503
|
-
const skipNested = (0,
|
|
8505
|
+
const directory = (0, import_node_path31.resolve)(assetsPath);
|
|
8506
|
+
if (!(0, import_node_fs30.existsSync)(directory)) return { directory, files: [], truncated: false };
|
|
8507
|
+
const skipNested = (0, import_node_fs30.existsSync)((0, import_node_path31.join)(directory, "package.json"));
|
|
8504
8508
|
const files2 = [];
|
|
8505
8509
|
let truncated = false;
|
|
8506
8510
|
const walk2 = (dir, prefix) => {
|
|
8507
8511
|
let entries;
|
|
8508
8512
|
try {
|
|
8509
|
-
entries = (0,
|
|
8513
|
+
entries = (0, import_node_fs30.readdirSync)(dir, { withFileTypes: true });
|
|
8510
8514
|
} catch {
|
|
8511
8515
|
return;
|
|
8512
8516
|
}
|
|
@@ -8518,7 +8522,7 @@ function listMetroAssetDest(assetsPath) {
|
|
|
8518
8522
|
if (entry.isDirectory()) {
|
|
8519
8523
|
if (entry.name === ".git") continue;
|
|
8520
8524
|
if (skipNested && PROJECT_ONLY_DIRECTORIES.has(entry.name)) continue;
|
|
8521
|
-
walk2((0,
|
|
8525
|
+
walk2((0, import_node_path31.join)(dir, entry.name), prefix ? `${prefix}/${entry.name}` : entry.name);
|
|
8522
8526
|
} else if (entry.isFile()) {
|
|
8523
8527
|
files2.push(prefix ? `${prefix}/${entry.name}` : entry.name);
|
|
8524
8528
|
}
|
|
@@ -8553,7 +8557,7 @@ function distinctByContent(directory, options) {
|
|
|
8553
8557
|
for (const relative2 of options) {
|
|
8554
8558
|
let bytes;
|
|
8555
8559
|
try {
|
|
8556
|
-
bytes = (0,
|
|
8560
|
+
bytes = (0, import_node_fs30.readFileSync)((0, import_node_path31.join)(directory, relative2));
|
|
8557
8561
|
} catch {
|
|
8558
8562
|
continue;
|
|
8559
8563
|
}
|
|
@@ -8585,7 +8589,7 @@ function placeMetroDescriptor(listing, descriptor) {
|
|
|
8585
8589
|
let bytes;
|
|
8586
8590
|
try {
|
|
8587
8591
|
bytes = combination.map(
|
|
8588
|
-
(relative2) => (0,
|
|
8592
|
+
(relative2) => (0, import_node_fs30.readFileSync)((0, import_node_path31.join)(listing.directory, relative2))
|
|
8589
8593
|
);
|
|
8590
8594
|
} catch {
|
|
8591
8595
|
continue;
|
|
@@ -8613,10 +8617,10 @@ function unverifiedContentKey(dest, fileDigests) {
|
|
|
8613
8617
|
return JSON.stringify(
|
|
8614
8618
|
dest.placements.map(
|
|
8615
8619
|
(placement) => placement.verified ? null : [...placement.files].map(([scale, relative2]) => {
|
|
8616
|
-
const file = (0,
|
|
8620
|
+
const file = (0, import_node_path31.join)(dest.directory, relative2);
|
|
8617
8621
|
let digest = fileDigests.get(file);
|
|
8618
8622
|
if (digest === void 0) {
|
|
8619
|
-
digest = (0, import_node_crypto14.createHash)("sha256").update((0,
|
|
8623
|
+
digest = (0, import_node_crypto14.createHash)("sha256").update((0, import_node_fs30.readFileSync)(file)).digest("hex");
|
|
8620
8624
|
fileDigests.set(file, digest);
|
|
8621
8625
|
}
|
|
8622
8626
|
return [scale, digest];
|
|
@@ -8625,22 +8629,22 @@ function unverifiedContentKey(dest, fileDigests) {
|
|
|
8625
8629
|
);
|
|
8626
8630
|
}
|
|
8627
8631
|
function searchMetroAssetDest(bundlePath, descriptors) {
|
|
8628
|
-
const bundleDirectory = (0,
|
|
8632
|
+
const bundleDirectory = (0, import_node_path31.dirname)((0, import_node_path31.resolve)(bundlePath));
|
|
8629
8633
|
const candidates = [
|
|
8630
|
-
(0,
|
|
8634
|
+
(0, import_node_path31.join)(bundleDirectory, "assets"),
|
|
8631
8635
|
bundleDirectory,
|
|
8632
|
-
(0,
|
|
8636
|
+
(0, import_node_path31.resolve)(bundleDirectory, "..", "assets")
|
|
8633
8637
|
];
|
|
8634
8638
|
const cwd = process.cwd();
|
|
8635
8639
|
let projectDirectory = null;
|
|
8636
8640
|
for (const start of [bundleDirectory, cwd]) {
|
|
8637
|
-
let directory = (0,
|
|
8641
|
+
let directory = (0, import_node_path31.resolve)(start);
|
|
8638
8642
|
while (true) {
|
|
8639
8643
|
if (detectProject(directory)?.hasMetroConfig) {
|
|
8640
8644
|
projectDirectory = directory;
|
|
8641
8645
|
break;
|
|
8642
8646
|
}
|
|
8643
|
-
const parent = (0,
|
|
8647
|
+
const parent = (0, import_node_path31.dirname)(directory);
|
|
8644
8648
|
if (parent === directory) break;
|
|
8645
8649
|
directory = parent;
|
|
8646
8650
|
}
|
|
@@ -8648,11 +8652,11 @@ function searchMetroAssetDest(bundlePath, descriptors) {
|
|
|
8648
8652
|
}
|
|
8649
8653
|
if (projectDirectory) {
|
|
8650
8654
|
candidates.push(
|
|
8651
|
-
(0,
|
|
8652
|
-
(0,
|
|
8653
|
-
(0,
|
|
8654
|
-
(0,
|
|
8655
|
-
(0,
|
|
8655
|
+
(0, import_node_path31.join)(projectDirectory, "assets"),
|
|
8656
|
+
(0, import_node_path31.join)(projectDirectory, "dist"),
|
|
8657
|
+
(0, import_node_path31.join)(projectDirectory, "dist", "assets"),
|
|
8658
|
+
(0, import_node_path31.join)(projectDirectory, "build"),
|
|
8659
|
+
(0, import_node_path31.join)(projectDirectory, "build", "assets")
|
|
8656
8660
|
);
|
|
8657
8661
|
}
|
|
8658
8662
|
const searched = [];
|
|
@@ -8660,7 +8664,7 @@ function searchMetroAssetDest(bundlePath, descriptors) {
|
|
|
8660
8664
|
const stale = [];
|
|
8661
8665
|
let truncated = false;
|
|
8662
8666
|
for (const candidate of candidates) {
|
|
8663
|
-
const directory = (0,
|
|
8667
|
+
const directory = (0, import_node_path31.resolve)(candidate);
|
|
8664
8668
|
if (searched.includes(directory)) continue;
|
|
8665
8669
|
searched.push(directory);
|
|
8666
8670
|
const listing = listMetroAssetDest(directory);
|
|
@@ -8769,7 +8773,7 @@ async function embedBundleAssets(bundlePath, command, assetPolicy) {
|
|
|
8769
8773
|
);
|
|
8770
8774
|
}
|
|
8771
8775
|
const relative2 = placement?.files.get(variant.scale);
|
|
8772
|
-
if (relative2 && dest) return (0,
|
|
8776
|
+
if (relative2 && dest) return (0, import_node_fs30.readFileSync)((0, import_node_path31.join)(dest.directory, relative2));
|
|
8773
8777
|
if (placement && placement.files.size > 0) return null;
|
|
8774
8778
|
if (placement && placement.ambiguous.length > 0 && dest) {
|
|
8775
8779
|
throw new Error(
|
|
@@ -8798,7 +8802,7 @@ async function embedBundleAssets(bundlePath, command, assetPolicy) {
|
|
|
8798
8802
|
);
|
|
8799
8803
|
const classic = metroIosAssetDestRelatives(variant.descriptor.httpServerLocation, filename)[0] ?? filename;
|
|
8800
8804
|
throw new Error(
|
|
8801
|
-
`${command} could not read ${(0,
|
|
8805
|
+
`${command} could not read ${(0, import_node_path31.join)(dest?.directory ?? ".", classic)} for ${variant.descriptor.name}.${variant.descriptor.type} at scale ${variant.scale}, and has no stand-in for a .${variant.descriptor.type} asset. Rebuild with \`react-native bundle --assets-dest\`.`
|
|
8802
8806
|
);
|
|
8803
8807
|
});
|
|
8804
8808
|
return {
|
|
@@ -8944,13 +8948,13 @@ async function createCloudBox(options) {
|
|
|
8944
8948
|
warnings: artifact.warnings
|
|
8945
8949
|
};
|
|
8946
8950
|
}
|
|
8947
|
-
var import_node_crypto14,
|
|
8951
|
+
var import_node_crypto14, import_node_fs30, import_node_path31, DEFAULT_RNX_CLOUD_ORIGIN, MAX_RNX_CLOUD_BUNDLE_BYTES, REMOTE_COMMAND, MAX_ASSET_DEST_FILES, ACCOUNT_CHOICE_REFUSALS, PROJECT_ONLY_DIRECTORIES, MAX_PLACEMENT_COMBINATIONS;
|
|
8948
8952
|
var init_cloud_client = __esm({
|
|
8949
8953
|
"cli/cloud-client.ts"() {
|
|
8950
8954
|
"use strict";
|
|
8951
8955
|
import_node_crypto14 = require("node:crypto");
|
|
8952
|
-
|
|
8953
|
-
|
|
8956
|
+
import_node_fs30 = require("node:fs");
|
|
8957
|
+
import_node_path31 = require("node:path");
|
|
8954
8958
|
init_metroAssetArtifact();
|
|
8955
8959
|
init_metroCloudArtifact();
|
|
8956
8960
|
init_metro_fingerprint_registry_client();
|
|
@@ -9465,9 +9469,9 @@ function safeChildPlistName(value) {
|
|
|
9465
9469
|
name: file.toLowerCase().endsWith(".plist") ? file : `${file}.plist`
|
|
9466
9470
|
};
|
|
9467
9471
|
}
|
|
9468
|
-
async function readableSettingsBundle(
|
|
9472
|
+
async function readableSettingsBundle(path26) {
|
|
9469
9473
|
try {
|
|
9470
|
-
const root = await (0, import_promises.stat)((0, import_node_path.join)(
|
|
9474
|
+
const root = await (0, import_promises.stat)((0, import_node_path.join)(path26, "Root.plist"));
|
|
9471
9475
|
return root.isFile() && root.size <= MAX_PLIST_BYTES;
|
|
9472
9476
|
} catch {
|
|
9473
9477
|
return false;
|
|
@@ -9512,11 +9516,11 @@ async function settingsBundleFingerprint(bundlePath) {
|
|
|
9512
9516
|
return null;
|
|
9513
9517
|
}
|
|
9514
9518
|
}
|
|
9515
|
-
async function parsePlistRecord(
|
|
9519
|
+
async function parsePlistRecord(path26) {
|
|
9516
9520
|
try {
|
|
9517
|
-
const metadata = await (0, import_promises.stat)(
|
|
9521
|
+
const metadata = await (0, import_promises.stat)(path26);
|
|
9518
9522
|
if (!metadata.isFile() || metadata.size > MAX_PLIST_BYTES) return null;
|
|
9519
|
-
const source = await (0, import_promises.readFile)(
|
|
9523
|
+
const source = await (0, import_promises.readFile)(path26, "utf8");
|
|
9520
9524
|
const parsed = parsePlistSource(source);
|
|
9521
9525
|
return isRecord2(parsed) ? parsed : null;
|
|
9522
9526
|
} catch {
|
|
@@ -9778,7 +9782,7 @@ async function tcpPing(port, timeout = TCP_GATE_MS) {
|
|
|
9778
9782
|
return null;
|
|
9779
9783
|
}
|
|
9780
9784
|
}
|
|
9781
|
-
function httpGet(hostname, port,
|
|
9785
|
+
function httpGet(hostname, port, path26, method = "GET", timeout = TIMEOUT_MS, headers = {}) {
|
|
9782
9786
|
return new Promise((resolve5) => {
|
|
9783
9787
|
let settled = false;
|
|
9784
9788
|
let killing = false;
|
|
@@ -9787,7 +9791,7 @@ function httpGet(hostname, port, path25, method = "GET", timeout = TIMEOUT_MS, h
|
|
|
9787
9791
|
settled = true;
|
|
9788
9792
|
resolve5(value);
|
|
9789
9793
|
};
|
|
9790
|
-
const req = import_http.default.request({ hostname, port, path:
|
|
9794
|
+
const req = import_http.default.request({ hostname, port, path: path26, method, headers }, (res) => {
|
|
9791
9795
|
let body = "";
|
|
9792
9796
|
res.on("data", (c) => body += c.toString());
|
|
9793
9797
|
const contentType = (() => {
|
|
@@ -9874,7 +9878,7 @@ async function listListeners() {
|
|
|
9874
9878
|
let timedOut = false;
|
|
9875
9879
|
try {
|
|
9876
9880
|
const { stdout } = await execGuarded(
|
|
9877
|
-
`lsof -iTCP -sTCP:LISTEN -P -n 2>/dev/null | grep -E '^(node|bun)'`,
|
|
9881
|
+
`lsof -a -c node -c bun -iTCP -sTCP:LISTEN -P -n 2>/dev/null | grep -E '^(node|bun)'`,
|
|
9878
9882
|
LISTING_TIMEOUT_MS
|
|
9879
9883
|
);
|
|
9880
9884
|
const seen = /* @__PURE__ */ new Map();
|
|
@@ -13238,8 +13242,8 @@ function pickImagesetFile(images) {
|
|
|
13238
13242
|
scale: pick.scale === "2x" ? 2 : pick.scale === "3x" ? 3 : 1
|
|
13239
13243
|
};
|
|
13240
13244
|
}
|
|
13241
|
-
function flatScale(
|
|
13242
|
-
const match = /@([23])x\.[^./]+$/.exec(
|
|
13245
|
+
function flatScale(path26) {
|
|
13246
|
+
const match = /@([23])x\.[^./]+$/.exec(path26);
|
|
13243
13247
|
return match ? Number(match[1]) : 1;
|
|
13244
13248
|
}
|
|
13245
13249
|
function providesNamespace(text3) {
|
|
@@ -13266,13 +13270,13 @@ function catalogEntryName(contentsPath, kind, readText) {
|
|
|
13266
13270
|
}
|
|
13267
13271
|
return segments.join("/");
|
|
13268
13272
|
}
|
|
13269
|
-
function isFlatResourceImage(
|
|
13270
|
-
return
|
|
13273
|
+
function isFlatResourceImage(path26) {
|
|
13274
|
+
return path26.split("/").includes("Resources") && RASTER_EXTENSIONS.has(extOf(path26));
|
|
13271
13275
|
}
|
|
13272
13276
|
function enumerateBundleImages(paths, readText) {
|
|
13273
13277
|
const table = [];
|
|
13274
13278
|
const seen = /* @__PURE__ */ new Set();
|
|
13275
|
-
const catalogs = paths.filter((
|
|
13279
|
+
const catalogs = paths.filter((path26) => baseOf(path26) === "Contents.json");
|
|
13276
13280
|
for (const contentsPath of catalogs) {
|
|
13277
13281
|
const name2 = catalogEntryName(contentsPath, ".imageset", readText);
|
|
13278
13282
|
if (name2 === null || seen.has(name2)) continue;
|
|
@@ -13293,12 +13297,12 @@ function enumerateBundleImages(paths, readText) {
|
|
|
13293
13297
|
seen.add(name2);
|
|
13294
13298
|
table.push({ name: name2, file: `${dir}/${pick.filename}`, scale: pick.scale });
|
|
13295
13299
|
}
|
|
13296
|
-
for (const
|
|
13297
|
-
if (!isFlatResourceImage(
|
|
13298
|
-
const name2 = baseOf(
|
|
13300
|
+
for (const path26 of paths) {
|
|
13301
|
+
if (!isFlatResourceImage(path26)) continue;
|
|
13302
|
+
const name2 = baseOf(path26).slice(0, -extOf(path26).length);
|
|
13299
13303
|
if (name2 === "" || seen.has(name2)) continue;
|
|
13300
13304
|
seen.add(name2);
|
|
13301
|
-
table.push({ name: name2, file:
|
|
13305
|
+
table.push({ name: name2, file: path26, scale: flatScale(path26) });
|
|
13302
13306
|
}
|
|
13303
13307
|
return table;
|
|
13304
13308
|
}
|
|
@@ -13327,7 +13331,7 @@ function colorsetValue(color) {
|
|
|
13327
13331
|
}
|
|
13328
13332
|
function enumerateBundleColors(paths, readText) {
|
|
13329
13333
|
const table = {};
|
|
13330
|
-
for (const contentsPath of paths.filter((
|
|
13334
|
+
for (const contentsPath of paths.filter((path26) => baseOf(path26) === "Contents.json")) {
|
|
13331
13335
|
const name2 = catalogEntryName(contentsPath, ".colorset", readText);
|
|
13332
13336
|
if (name2 === null || name2 in table) continue;
|
|
13333
13337
|
let colors;
|
|
@@ -13392,8 +13396,8 @@ function axisExtremes(points) {
|
|
|
13392
13396
|
function pathBounds(d) {
|
|
13393
13397
|
const xs = [];
|
|
13394
13398
|
const ys = [];
|
|
13395
|
-
for (const
|
|
13396
|
-
(0, import_svgpath.default)(
|
|
13399
|
+
for (const path26 of d)
|
|
13400
|
+
(0, import_svgpath.default)(path26).abs().unshort().unarc().iterate((segment, _index, x, y) => {
|
|
13397
13401
|
const [command, ...args] = segment;
|
|
13398
13402
|
if (command === "M" || command === "L") {
|
|
13399
13403
|
xs.push(Number(args[0]));
|
|
@@ -13420,7 +13424,7 @@ function guide(svg, id, axis) {
|
|
|
13420
13424
|
}
|
|
13421
13425
|
function enumerateBundleSymbols(paths, readText) {
|
|
13422
13426
|
const table = {};
|
|
13423
|
-
for (const contentsPath of paths.filter((
|
|
13427
|
+
for (const contentsPath of paths.filter((path26) => baseOf(path26) === "Contents.json")) {
|
|
13424
13428
|
const name2 = catalogEntryName(contentsPath, ".symbolset", readText);
|
|
13425
13429
|
if (name2 === null || name2 in table) continue;
|
|
13426
13430
|
let symbols;
|
|
@@ -13453,8 +13457,8 @@ function enumerateBundleSymbols(paths, readText) {
|
|
|
13453
13457
|
viewBox: "0 0 24 24",
|
|
13454
13458
|
advance,
|
|
13455
13459
|
box: [12 - advance / 2, 12 - tall / 2, advance, tall],
|
|
13456
|
-
layers: d.map((
|
|
13457
|
-
d: (0, import_svgpath.default)(
|
|
13460
|
+
layers: d.map((path26) => ({
|
|
13461
|
+
d: (0, import_svgpath.default)(path26).abs().scale(scale).translate(translateX, translateY).round(3).toString()
|
|
13458
13462
|
}))
|
|
13459
13463
|
};
|
|
13460
13464
|
}
|
|
@@ -13464,7 +13468,7 @@ function enumerateBundleJson(paths) {
|
|
|
13464
13468
|
const found = [];
|
|
13465
13469
|
const seen = /* @__PURE__ */ new Set();
|
|
13466
13470
|
const ordered = [...paths].filter(
|
|
13467
|
-
(
|
|
13471
|
+
(path26) => path26.split("/").includes("Resources") && path26.split("/").every((segment) => segment !== "" && segment !== "..") && (extOf(path26) === ".json" || extOf(path26) === ".xcstrings")
|
|
13468
13472
|
).sort((a, b) => {
|
|
13469
13473
|
const aDepth = a.split("/").length;
|
|
13470
13474
|
const bDepth = b.split("/").length;
|
|
@@ -14399,7 +14403,7 @@ var witnessKey = (symbol) => `${symbol.kind.identifier.startsWith("swift.type.")
|
|
|
14399
14403
|
var sideLeaf = (symbol) => `${symbol.kind.identifier.startsWith("swift.type.") ? "type" : "instance"}|leaf|${leaf(symbol)}`;
|
|
14400
14404
|
var isObjC = (symbol) => symbol.identifier.precise.startsWith("c:");
|
|
14401
14405
|
var synthesizedEquality = (symbol, conforms) => conforms.includes("Hashable") ? ["==(_:_:)", "hash(into:)", "hashValue"].includes(leaf(symbol)) : conforms.includes("Equatable") && leaf(symbol) === "==(_:_:)";
|
|
14402
|
-
var trap = (
|
|
14406
|
+
var trap = (path26) => `fatalError("${path26} is a binary framework peach cannot run")`;
|
|
14403
14407
|
function emitSwiftStandin(graphs, options) {
|
|
14404
14408
|
const skipped = [];
|
|
14405
14409
|
const behavior = options.behavior ?? /* @__PURE__ */ new Map();
|
|
@@ -14536,10 +14540,10 @@ function emitSwiftStandin(graphs, options) {
|
|
|
14536
14540
|
owners.push(...physical.map(() => current));
|
|
14537
14541
|
};
|
|
14538
14542
|
const scoped = (body) => (symbol, ...rest) => {
|
|
14539
|
-
const
|
|
14540
|
-
if (omit.has(
|
|
14543
|
+
const path26 = pathOf(symbol);
|
|
14544
|
+
if (omit.has(path26)) return void skipped.push({ path: path26, reason: omit.get(path26) });
|
|
14541
14545
|
const previous = current;
|
|
14542
|
-
current =
|
|
14546
|
+
current = path26;
|
|
14543
14547
|
try {
|
|
14544
14548
|
body(symbol, ...rest);
|
|
14545
14549
|
} finally {
|
|
@@ -14559,14 +14563,14 @@ function emitSwiftStandin(graphs, options) {
|
|
|
14559
14563
|
const access = (symbol, openOwner) => symbol.accessLevel === "open" && openOwner ? "open" : "public";
|
|
14560
14564
|
const emitMember = scoped(
|
|
14561
14565
|
(member, indent, context) => {
|
|
14562
|
-
const
|
|
14566
|
+
const path26 = pathOf(member);
|
|
14563
14567
|
if (TYPE_KINDS.has(member.kind.identifier)) {
|
|
14564
14568
|
emitType(member, indent);
|
|
14565
14569
|
return;
|
|
14566
14570
|
}
|
|
14567
14571
|
if (member.kind.identifier === "swift.enum.case") return;
|
|
14568
14572
|
if (!MEMBER_KINDS.has(member.kind.identifier)) {
|
|
14569
|
-
skipped.push({ path:
|
|
14573
|
+
skipped.push({ path: path26, reason: `unhandled ${member.kind.identifier}` });
|
|
14570
14574
|
return;
|
|
14571
14575
|
}
|
|
14572
14576
|
const { 1: attrs, 2: rest } = LEADING_ATTRS.exec(text(member));
|
|
@@ -14580,12 +14584,12 @@ function emitSwiftStandin(graphs, options) {
|
|
|
14580
14584
|
const final = context.inClass && flags.has("final") ? "final " : "";
|
|
14581
14585
|
const mutating = flags.has("mutating") ? "mutating " : flags.has("nonmutating") ? "nonmutating " : "";
|
|
14582
14586
|
let core = `${flags.has("convenience") ? "convenience " : ""}${modifiers[2]}`;
|
|
14583
|
-
const override = context.inClass && !options.plain?.has(
|
|
14587
|
+
const override = context.inClass && !options.plain?.has(path26) && (flags.has("override") || overrides.has(member.identifier.precise) || options.forcedOverride?.has(path26) || isObjC(member) && path26.endsWith(".init()")) ? "override " : "";
|
|
14584
14588
|
const head = `${indent}${attrs}${access(member, context.openOwner)} ${required ? "required " : ""}${final}${override}${mutating}`;
|
|
14585
|
-
const measured = behavior.get(
|
|
14586
|
-
if (measured) used.add(
|
|
14589
|
+
const measured = behavior.get(path26);
|
|
14590
|
+
if (measured) used.add(path26);
|
|
14587
14591
|
const overloadBody = /\basync\b/.test(core) ? measured?.asyncBody : /\bResult</.test(core) ? measured?.resultBody : void 0;
|
|
14588
|
-
const body = overloadBody ?? measured?.body ?? trap(
|
|
14592
|
+
const body = overloadBody ?? measured?.body ?? trap(path26);
|
|
14589
14593
|
switch (member.kind.identifier) {
|
|
14590
14594
|
case "swift.property":
|
|
14591
14595
|
case "swift.type.property":
|
|
@@ -14606,7 +14610,7 @@ function emitSwiftStandin(graphs, options) {
|
|
|
14606
14610
|
return;
|
|
14607
14611
|
}
|
|
14608
14612
|
emit(
|
|
14609
|
-
`${head}${computed} { get${effects} { ${body} }${settable && !effects ? ` ${parsed.nonmutating ? "nonmutating " : ""}set { ${measured?.set ?? trap(
|
|
14613
|
+
`${head}${computed} { get${effects} { ${body} }${settable && !effects ? ` ${parsed.nonmutating ? "nonmutating " : ""}set { ${measured?.set ?? trap(path26)} }` : ""} }`
|
|
14610
14614
|
);
|
|
14611
14615
|
return;
|
|
14612
14616
|
}
|
|
@@ -14659,7 +14663,7 @@ function emitSwiftStandin(graphs, options) {
|
|
|
14659
14663
|
};
|
|
14660
14664
|
const emitType = scoped(
|
|
14661
14665
|
(symbol, indent) => {
|
|
14662
|
-
const
|
|
14666
|
+
const path26 = pathOf(symbol);
|
|
14663
14667
|
const id = symbol.identifier.precise;
|
|
14664
14668
|
const inner = `${indent} `;
|
|
14665
14669
|
switch (symbol.kind.identifier) {
|
|
@@ -14671,10 +14675,10 @@ function emitSwiftStandin(graphs, options) {
|
|
|
14671
14675
|
case "swift.class": {
|
|
14672
14676
|
const shape = header(symbol, "class", indent);
|
|
14673
14677
|
if (!shape)
|
|
14674
|
-
return void skipped.push({ path:
|
|
14675
|
-
const parent = options.superclasses?.get(
|
|
14678
|
+
return void skipped.push({ path: path26, reason: `unparsed class ${text(symbol)}` });
|
|
14679
|
+
const parent = options.superclasses?.get(path26) ?? superclass.get(id);
|
|
14676
14680
|
const blocked = classBlocked(id);
|
|
14677
|
-
if (blocked) return void skipped.push({ path:
|
|
14681
|
+
if (blocked) return void skipped.push({ path: path26, reason: blocked });
|
|
14678
14682
|
const ancestors = /* @__PURE__ */ new Set();
|
|
14679
14683
|
for (let at = superId.get(id); at; at = superId.get(at))
|
|
14680
14684
|
for (const name2 of conforms.get(at) ?? []) ancestors.add(name2);
|
|
@@ -14690,9 +14694,9 @@ function emitSwiftStandin(graphs, options) {
|
|
|
14690
14694
|
`${indent}${shape.attrs}${open ? "open" : "public"} class ${shape.name}${shape.generics}${list2.length ? `: ${list2.join(", ")}` : ""}${selfConforming(shape.where)} {`
|
|
14691
14695
|
);
|
|
14692
14696
|
const members = membersOf(id);
|
|
14693
|
-
const extra = options.behavior?.get(
|
|
14697
|
+
const extra = options.behavior?.get(path26)?.members;
|
|
14694
14698
|
if (extra) {
|
|
14695
|
-
used.add(
|
|
14699
|
+
used.add(path26);
|
|
14696
14700
|
emit(`${inner}${extra}`);
|
|
14697
14701
|
}
|
|
14698
14702
|
for (const member of members)
|
|
@@ -14744,13 +14748,13 @@ function emitSwiftStandin(graphs, options) {
|
|
|
14744
14748
|
continue;
|
|
14745
14749
|
have.add(witnessKey(member));
|
|
14746
14750
|
have.add(sideLeaf(member));
|
|
14747
|
-
emitWitness(member, inner,
|
|
14751
|
+
emitWitness(member, inner, path26);
|
|
14748
14752
|
}
|
|
14749
14753
|
}
|
|
14750
14754
|
const coder = members.some((member) => leaf(member) === "init(coder:)");
|
|
14751
14755
|
if (designated && !coder && externalRoot(id) !== "NSObject" && externalRoot(id) !== null)
|
|
14752
14756
|
emit(
|
|
14753
|
-
`${inner}public required init?(coder: NSCoder) { ${trap(`${
|
|
14757
|
+
`${inner}public required init?(coder: NSCoder) { ${trap(`${path26}.init(coder:)`)} }`
|
|
14754
14758
|
);
|
|
14755
14759
|
emit(`${indent}}`);
|
|
14756
14760
|
return;
|
|
@@ -14758,7 +14762,7 @@ function emitSwiftStandin(graphs, options) {
|
|
|
14758
14762
|
case "swift.struct": {
|
|
14759
14763
|
const shape = header(symbol, "struct", indent);
|
|
14760
14764
|
if (!shape)
|
|
14761
|
-
return void skipped.push({ path:
|
|
14765
|
+
return void skipped.push({ path: path26, reason: `unparsed struct ${text(symbol)}` });
|
|
14762
14766
|
const members = membersOf(id);
|
|
14763
14767
|
const raw2 = rawType(members);
|
|
14764
14768
|
const list2 = inheritance(id);
|
|
@@ -14790,7 +14794,7 @@ function emitSwiftStandin(graphs, options) {
|
|
|
14790
14794
|
case "swift.enum": {
|
|
14791
14795
|
const shape = header(symbol, "enum", indent);
|
|
14792
14796
|
if (!shape)
|
|
14793
|
-
return void skipped.push({ path:
|
|
14797
|
+
return void skipped.push({ path: path26, reason: `unparsed enum ${text(symbol)}` });
|
|
14794
14798
|
const members = membersOf(id);
|
|
14795
14799
|
const raw2 = rawType(members);
|
|
14796
14800
|
const cases = members.filter(
|
|
@@ -14799,7 +14803,7 @@ function emitSwiftStandin(graphs, options) {
|
|
|
14799
14803
|
const missing = raw2 ? cases.filter((member) => !values.has(member.identifier.precise)) : [];
|
|
14800
14804
|
if (raw2 && isObjC(symbol) && missing.length > 0)
|
|
14801
14805
|
return void skipped.push({
|
|
14802
|
-
path:
|
|
14806
|
+
path: path26,
|
|
14803
14807
|
reason: `no header value for ${missing.map(leaf).join(", ")}`
|
|
14804
14808
|
});
|
|
14805
14809
|
const list2 = inheritance(id, raw2 ?? void 0).filter(
|
|
@@ -14839,7 +14843,7 @@ function emitSwiftStandin(graphs, options) {
|
|
|
14839
14843
|
const shape = header(symbol, "protocol", indent);
|
|
14840
14844
|
if (!shape)
|
|
14841
14845
|
return void skipped.push({
|
|
14842
|
-
path:
|
|
14846
|
+
path: path26,
|
|
14843
14847
|
reason: `unparsed protocol ${text(symbol)}`
|
|
14844
14848
|
});
|
|
14845
14849
|
const list2 = [...isObjC(symbol) ? ["AnyObject"] : [], ...inheritance(id)];
|
|
@@ -14864,7 +14868,7 @@ function emitSwiftStandin(graphs, options) {
|
|
|
14864
14868
|
}
|
|
14865
14869
|
emit(`${indent}}`);
|
|
14866
14870
|
if (defaults.length > 0) {
|
|
14867
|
-
emit(`${indent}extension ${
|
|
14871
|
+
emit(`${indent}extension ${path26} {`);
|
|
14868
14872
|
for (const member of defaults) {
|
|
14869
14873
|
const decl = text(member);
|
|
14870
14874
|
if (optional.has(member.identifier.precise) && member.kind.identifier === "swift.method" && !decl.replace(/\([^)]*\)/g, "").includes("->") && !/ async\b/.test(decl))
|
|
@@ -14910,7 +14914,7 @@ function emitSwiftStandin(graphs, options) {
|
|
|
14910
14914
|
return init ? /rawValue:\s*([^)]+)\)/.exec(text(init))?.[1]?.trim() ?? null : null;
|
|
14911
14915
|
};
|
|
14912
14916
|
const emitGlobal = scoped((symbol) => {
|
|
14913
|
-
const
|
|
14917
|
+
const path26 = pathOf(symbol);
|
|
14914
14918
|
const kind = symbol.kind.identifier;
|
|
14915
14919
|
if (kind === "swift.func" || kind === "swift.func.op" || kind === "swift.method" || kind === "swift.type.method") {
|
|
14916
14920
|
const { 1: attrs, 2: rest } = LEADING_ATTRS.exec(text(symbol));
|
|
@@ -14921,17 +14925,17 @@ function emitSwiftStandin(graphs, options) {
|
|
|
14921
14925
|
if (fix && !/^(?:prefix|infix|postfix)\b/.test(spelled))
|
|
14922
14926
|
spelled = `${fix} ${spelled}`;
|
|
14923
14927
|
}
|
|
14924
|
-
emit(`${attrs}public ${spelled} { ${trap(
|
|
14928
|
+
emit(`${attrs}public ${spelled} { ${trap(path26)} }`);
|
|
14925
14929
|
} else if (kind === "swift.var") {
|
|
14926
14930
|
const parsed = splitAccessors(text(symbol).replace(/^let /, "var "));
|
|
14927
|
-
const measured = behavior.get(
|
|
14928
|
-
if (measured) used.add(
|
|
14929
|
-
emit(`public ${parsed.decl} { ${measured?.body ?? trap(
|
|
14930
|
-
} else skipped.push({ path:
|
|
14931
|
+
const measured = behavior.get(path26);
|
|
14932
|
+
if (measured) used.add(path26);
|
|
14933
|
+
emit(`public ${parsed.decl} { ${measured?.body ?? trap(path26)} }`);
|
|
14934
|
+
} else skipped.push({ path: path26, reason: `unhandled top-level ${kind}` });
|
|
14931
14935
|
});
|
|
14932
14936
|
const roots = [...byId.values()].filter((symbol) => !owner.has(symbol.identifier.precise) && !unavailable(symbol)).sort((a, b) => pathOf(a).localeCompare(pathOf(b)));
|
|
14933
14937
|
for (const symbol of roots) {
|
|
14934
|
-
const
|
|
14938
|
+
const path26 = pathOf(symbol);
|
|
14935
14939
|
if (TYPE_KINDS.has(symbol.kind.identifier)) emitType(symbol, "");
|
|
14936
14940
|
else emitGlobal(symbol);
|
|
14937
14941
|
}
|
|
@@ -14972,9 +14976,9 @@ function emitSwiftStandin(graphs, options) {
|
|
|
14972
14976
|
...imports.map((name2) => `import ${name2}`),
|
|
14973
14977
|
""
|
|
14974
14978
|
];
|
|
14975
|
-
for (const
|
|
14976
|
-
if (!used.has(
|
|
14977
|
-
skipped.push({ path:
|
|
14979
|
+
for (const path26 of behavior.keys())
|
|
14980
|
+
if (!used.has(path26))
|
|
14981
|
+
skipped.push({ path: path26, reason: "behavior names no emitted declaration" });
|
|
14978
14982
|
return {
|
|
14979
14983
|
source: `${[...banner, ...lines].join("\n")}
|
|
14980
14984
|
`,
|
|
@@ -18105,8 +18109,8 @@ function sourceEntryPath() {
|
|
|
18105
18109
|
return null;
|
|
18106
18110
|
}
|
|
18107
18111
|
}
|
|
18108
|
-
function isCliEntry(
|
|
18109
|
-
const name2 = (0, import_node_path22.basename)(
|
|
18112
|
+
function isCliEntry(path26) {
|
|
18113
|
+
const name2 = (0, import_node_path22.basename)(path26);
|
|
18110
18114
|
return name2 === "bin.ts" || name2 === "bin.js";
|
|
18111
18115
|
}
|
|
18112
18116
|
function rnxSelfInvocation() {
|
|
@@ -19674,7 +19678,7 @@ async function handleFetchProxyRequest(req, res) {
|
|
|
19674
19678
|
const abort = () => proxyReq.destroy(new Error("fetch proxy client disconnected"));
|
|
19675
19679
|
req.once("aborted", abort);
|
|
19676
19680
|
proxyReq.once("close", () => req.off("aborted", abort));
|
|
19677
|
-
proxyReq.
|
|
19681
|
+
proxyReq.on("error", reject);
|
|
19678
19682
|
if (nextBody === void 0) proxyReq.end();
|
|
19679
19683
|
else proxyReq.end(nextBody);
|
|
19680
19684
|
});
|
|
@@ -19815,9 +19819,32 @@ function handleAppApiRequest(req, res) {
|
|
|
19815
19819
|
|
|
19816
19820
|
// src/host/fetch-proxy-transport.ts
|
|
19817
19821
|
var import_node_crypto13 = require("node:crypto");
|
|
19822
|
+
var import_node_fs25 = require("node:fs");
|
|
19818
19823
|
var import_node_http22 = require("node:http2");
|
|
19824
|
+
var import_node_path26 = __toESM(require("node:path"), 1);
|
|
19819
19825
|
var import_x509 = require("@peculiar/x509");
|
|
19820
|
-
|
|
19826
|
+
function readIdentity(identityPath) {
|
|
19827
|
+
let parsed;
|
|
19828
|
+
try {
|
|
19829
|
+
parsed = JSON.parse((0, import_node_fs25.readFileSync)(identityPath, "utf8"));
|
|
19830
|
+
} catch {
|
|
19831
|
+
return null;
|
|
19832
|
+
}
|
|
19833
|
+
if (!parsed || typeof parsed !== "object") return null;
|
|
19834
|
+
const key2 = Reflect.get(parsed, "key");
|
|
19835
|
+
const cert = Reflect.get(parsed, "cert");
|
|
19836
|
+
const spki = Reflect.get(parsed, "spki");
|
|
19837
|
+
const port = Reflect.get(parsed, "port");
|
|
19838
|
+
if (typeof key2 !== "string" || typeof cert !== "string" || typeof spki !== "string" || typeof port !== "number") {
|
|
19839
|
+
return null;
|
|
19840
|
+
}
|
|
19841
|
+
return { key: key2, cert, spki, port };
|
|
19842
|
+
}
|
|
19843
|
+
function writeIdentity(identityPath, identity) {
|
|
19844
|
+
(0, import_node_fs25.mkdirSync)(import_node_path26.default.dirname(identityPath), { recursive: true });
|
|
19845
|
+
(0, import_node_fs25.writeFileSync)(identityPath, JSON.stringify(identity), { mode: 384 });
|
|
19846
|
+
}
|
|
19847
|
+
async function createIdentity() {
|
|
19821
19848
|
const algorithm = { name: "ECDSA", namedCurve: "P-256", hash: "SHA-256" };
|
|
19822
19849
|
const keys = await crypto.subtle.generateKey(algorithm, true, ["sign", "verify"]);
|
|
19823
19850
|
const certificate = await import_x509.X509CertificateGenerator.createSelfSigned(
|
|
@@ -19835,15 +19862,22 @@ async function startFetchProxyTransport() {
|
|
|
19835
19862
|
crypto
|
|
19836
19863
|
);
|
|
19837
19864
|
const privateKey = Buffer.from(await crypto.subtle.exportKey("pkcs8", keys.privateKey));
|
|
19838
|
-
|
|
19839
|
-
|
|
19840
|
-
|
|
19841
|
-
{
|
|
19842
|
-
cert: certificate.toString("pem"),
|
|
19843
|
-
key: `-----BEGIN PRIVATE KEY-----
|
|
19865
|
+
return {
|
|
19866
|
+
cert: certificate.toString("pem"),
|
|
19867
|
+
key: `-----BEGIN PRIVATE KEY-----
|
|
19844
19868
|
${privateKey.toString("base64").match(/.{1,64}/g)?.join("\n")}
|
|
19845
19869
|
-----END PRIVATE KEY-----
|
|
19846
19870
|
`,
|
|
19871
|
+
spki: (0, import_node_crypto13.createHash)("sha256").update(Buffer.from(await crypto.subtle.exportKey("spki", keys.publicKey))).digest("base64")
|
|
19872
|
+
};
|
|
19873
|
+
}
|
|
19874
|
+
async function startFetchProxyTransport(identityPath) {
|
|
19875
|
+
const identity = readIdentity(identityPath) ?? { ...await createIdentity(), port: 0 };
|
|
19876
|
+
const sessions = /* @__PURE__ */ new Set();
|
|
19877
|
+
const server = (0, import_node_http22.createSecureServer)(
|
|
19878
|
+
{
|
|
19879
|
+
cert: identity.cert,
|
|
19880
|
+
key: identity.key,
|
|
19847
19881
|
settings: { maxConcurrentStreams: 256 }
|
|
19848
19882
|
},
|
|
19849
19883
|
(req, res) => {
|
|
@@ -19863,18 +19897,28 @@ ${privateKey.toString("base64").match(/.{1,64}/g)?.join("\n")}
|
|
|
19863
19897
|
session.once("close", () => sessions.delete(session));
|
|
19864
19898
|
session.on("error", () => session.destroy());
|
|
19865
19899
|
});
|
|
19866
|
-
|
|
19900
|
+
const listen = (port) => new Promise((resolve5, reject) => {
|
|
19867
19901
|
server.once("error", reject);
|
|
19868
|
-
server.listen(
|
|
19902
|
+
server.listen(port, "127.0.0.1", () => {
|
|
19869
19903
|
server.off("error", reject);
|
|
19870
19904
|
resolve5();
|
|
19871
19905
|
});
|
|
19872
19906
|
});
|
|
19907
|
+
try {
|
|
19908
|
+
await listen(identity.port);
|
|
19909
|
+
} catch (error) {
|
|
19910
|
+
const taken = error instanceof Error && Reflect.get(error, "code") === "EADDRINUSE";
|
|
19911
|
+
if (identity.port === 0 || !taken) throw error;
|
|
19912
|
+
await listen(0);
|
|
19913
|
+
}
|
|
19873
19914
|
const address = server.address();
|
|
19874
19915
|
if (!address || typeof address === "string")
|
|
19875
19916
|
throw new Error("fetch proxy has no address");
|
|
19917
|
+
if (address.port !== identity.port) {
|
|
19918
|
+
writeIdentity(identityPath, { ...identity, port: address.port });
|
|
19919
|
+
}
|
|
19876
19920
|
return {
|
|
19877
|
-
descriptor: { origin: `https://127.0.0.1:${address.port}`, spki },
|
|
19921
|
+
descriptor: { origin: `https://127.0.0.1:${address.port}`, spki: identity.spki },
|
|
19878
19922
|
async close() {
|
|
19879
19923
|
for (const session of sessions) session.destroy();
|
|
19880
19924
|
await new Promise((resolve5) => server.close(() => resolve5()));
|
|
@@ -19985,8 +20029,8 @@ async function openUrl(url, options = {}) {
|
|
|
19985
20029
|
}
|
|
19986
20030
|
|
|
19987
20031
|
// src/host/plane-host.ts
|
|
19988
|
-
var
|
|
19989
|
-
var
|
|
20032
|
+
var import_node_fs27 = __toESM(require("node:fs"), 1);
|
|
20033
|
+
var import_node_path28 = __toESM(require("node:path"), 1);
|
|
19990
20034
|
|
|
19991
20035
|
// ../peach-box/src/planeProtocol.ts
|
|
19992
20036
|
var PLANE_FLAG_READ_ONLY = 1;
|
|
@@ -20066,8 +20110,8 @@ async function dispatchPlaneCommand(plane, type, msg, mutationOptions) {
|
|
|
20066
20110
|
|
|
20067
20111
|
// cli/commands/box/checkout-plane.ts
|
|
20068
20112
|
var import_node_child_process11 = require("node:child_process");
|
|
20069
|
-
var
|
|
20070
|
-
var
|
|
20113
|
+
var import_node_fs26 = __toESM(require("node:fs"), 1);
|
|
20114
|
+
var import_node_path27 = __toESM(require("node:path"), 1);
|
|
20071
20115
|
var CheckoutRequiresGitError = class extends Error {
|
|
20072
20116
|
};
|
|
20073
20117
|
var BINARY_SNIFF_BYTES = 8192;
|
|
@@ -20078,14 +20122,14 @@ function looksBinary(filePath, size) {
|
|
|
20078
20122
|
if (size === 0) return false;
|
|
20079
20123
|
let fd;
|
|
20080
20124
|
try {
|
|
20081
|
-
fd =
|
|
20125
|
+
fd = import_node_fs26.default.openSync(filePath, "r");
|
|
20082
20126
|
const buffer = Buffer.alloc(Math.min(BINARY_SNIFF_BYTES, size));
|
|
20083
|
-
const read =
|
|
20127
|
+
const read = import_node_fs26.default.readSync(fd, buffer, 0, buffer.length, 0);
|
|
20084
20128
|
return buffer.subarray(0, read).includes(0);
|
|
20085
20129
|
} catch {
|
|
20086
20130
|
return false;
|
|
20087
20131
|
} finally {
|
|
20088
|
-
if (fd !== void 0)
|
|
20132
|
+
if (fd !== void 0) import_node_fs26.default.closeSync(fd);
|
|
20089
20133
|
}
|
|
20090
20134
|
}
|
|
20091
20135
|
var CheckoutFilePlane = class {
|
|
@@ -20098,7 +20142,7 @@ var CheckoutFilePlane = class {
|
|
|
20098
20142
|
listTimeoutMs;
|
|
20099
20143
|
trackedOnly;
|
|
20100
20144
|
constructor(root, options = {}) {
|
|
20101
|
-
this.root =
|
|
20145
|
+
this.root = import_node_path27.default.resolve(root);
|
|
20102
20146
|
this.listTimeoutMs = options.listTimeoutMs ?? LIST_FILES_TIMEOUT_MS;
|
|
20103
20147
|
this.trackedOnly = options.trackedOnly ?? false;
|
|
20104
20148
|
}
|
|
@@ -20160,13 +20204,13 @@ var CheckoutFilePlane = class {
|
|
|
20160
20204
|
if (!relative2) continue;
|
|
20161
20205
|
let stat2;
|
|
20162
20206
|
try {
|
|
20163
|
-
stat2 =
|
|
20207
|
+
stat2 = import_node_fs26.default.statSync(import_node_path27.default.join(this.root, relative2));
|
|
20164
20208
|
} catch {
|
|
20165
20209
|
continue;
|
|
20166
20210
|
}
|
|
20167
20211
|
if (!stat2.isFile()) continue;
|
|
20168
20212
|
const seen = this.sniffed.get(relative2);
|
|
20169
|
-
const binary2 = seen && seen.size === stat2.size && seen.mtimeMs === stat2.mtimeMs ? seen.binary : looksBinary(
|
|
20213
|
+
const binary2 = seen && seen.size === stat2.size && seen.mtimeMs === stat2.mtimeMs ? seen.binary : looksBinary(import_node_path27.default.join(this.root, relative2), stat2.size);
|
|
20170
20214
|
nextSniffed.set(relative2, { size: stat2.size, mtimeMs: stat2.mtimeMs, binary: binary2 });
|
|
20171
20215
|
next.set(relative2, {
|
|
20172
20216
|
size: stat2.size,
|
|
@@ -20180,22 +20224,22 @@ var CheckoutFilePlane = class {
|
|
|
20180
20224
|
this.sniffed = nextSniffed;
|
|
20181
20225
|
}
|
|
20182
20226
|
absolute(planePath) {
|
|
20183
|
-
const resolved =
|
|
20184
|
-
if (resolved !== this.root && !resolved.startsWith(`${this.root}${
|
|
20227
|
+
const resolved = import_node_path27.default.resolve(this.root, planePath);
|
|
20228
|
+
if (resolved !== this.root && !resolved.startsWith(`${this.root}${import_node_path27.default.sep}`)) {
|
|
20185
20229
|
throw new Error(`path escapes the project: ${planePath}`);
|
|
20186
20230
|
}
|
|
20187
20231
|
return resolved;
|
|
20188
20232
|
}
|
|
20189
20233
|
async read(planePath) {
|
|
20190
|
-
return
|
|
20234
|
+
return import_node_fs26.default.promises.readFile(this.absolute(planePath), "utf8");
|
|
20191
20235
|
}
|
|
20192
20236
|
async readBytes(planePath) {
|
|
20193
|
-
return
|
|
20237
|
+
return import_node_fs26.default.promises.readFile(this.absolute(planePath));
|
|
20194
20238
|
}
|
|
20195
20239
|
async write(planePath, content) {
|
|
20196
20240
|
const absolute = this.absolute(planePath);
|
|
20197
|
-
await
|
|
20198
|
-
await
|
|
20241
|
+
await import_node_fs26.default.promises.mkdir(import_node_path27.default.dirname(absolute), { recursive: true });
|
|
20242
|
+
await import_node_fs26.default.promises.writeFile(absolute, content);
|
|
20199
20243
|
this.entries.set(planePath, {
|
|
20200
20244
|
size: content.byteLength,
|
|
20201
20245
|
readOnly: false,
|
|
@@ -20204,7 +20248,7 @@ var CheckoutFilePlane = class {
|
|
|
20204
20248
|
});
|
|
20205
20249
|
}
|
|
20206
20250
|
async delete(planePath) {
|
|
20207
|
-
await
|
|
20251
|
+
await import_node_fs26.default.promises.rm(this.absolute(planePath), { force: true });
|
|
20208
20252
|
this.entries.delete(planePath);
|
|
20209
20253
|
}
|
|
20210
20254
|
};
|
|
@@ -20330,14 +20374,14 @@ var PlaneHost = class {
|
|
|
20330
20374
|
// root and an opened one cannot disagree about the same directory.
|
|
20331
20375
|
realRoot(root) {
|
|
20332
20376
|
if (!root) throw new Error("root is required");
|
|
20333
|
-
const resolved =
|
|
20377
|
+
const resolved = import_node_path28.default.resolve(root);
|
|
20334
20378
|
let real;
|
|
20335
20379
|
try {
|
|
20336
|
-
real =
|
|
20380
|
+
real = import_node_fs27.default.realpathSync(resolved);
|
|
20337
20381
|
} catch {
|
|
20338
20382
|
throw new Error(`no such directory: ${resolved}`);
|
|
20339
20383
|
}
|
|
20340
|
-
if (!
|
|
20384
|
+
if (!import_node_fs27.default.statSync(real).isDirectory()) throw new Error(`not a directory: ${real}`);
|
|
20341
20385
|
return real;
|
|
20342
20386
|
}
|
|
20343
20387
|
respond(ws, id, result) {
|
|
@@ -20357,9 +20401,9 @@ var PlaneHost = class {
|
|
|
20357
20401
|
};
|
|
20358
20402
|
|
|
20359
20403
|
// src/host/replacement-module-handler.ts
|
|
20360
|
-
var
|
|
20404
|
+
var import_node_fs28 = require("node:fs");
|
|
20361
20405
|
var import_promises5 = __toESM(require("node:fs/promises"), 1);
|
|
20362
|
-
var
|
|
20406
|
+
var import_node_path29 = __toESM(require("node:path"), 1);
|
|
20363
20407
|
|
|
20364
20408
|
// ../contrast-bundler/src/replacementModule.ts
|
|
20365
20409
|
var import_dist = require("sucrase/dist/index.js");
|
|
@@ -20687,16 +20731,16 @@ function sendJavaScript(req, res, source) {
|
|
|
20687
20731
|
res.end(req.method === "HEAD" ? void 0 : source);
|
|
20688
20732
|
}
|
|
20689
20733
|
function resolveReplacementModuleFile(fromFile, specifier) {
|
|
20690
|
-
const base =
|
|
20734
|
+
const base = import_node_path29.default.resolve(import_node_path29.default.dirname(fromFile), specifier);
|
|
20691
20735
|
const candidates = [
|
|
20692
20736
|
...REPLACEMENT_MODULE_EXTENSIONS.some(
|
|
20693
|
-
(ext) => ext ===
|
|
20737
|
+
(ext) => ext === import_node_path29.default.extname(base).toLowerCase()
|
|
20694
20738
|
) ? [base] : [],
|
|
20695
20739
|
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => base + ext),
|
|
20696
|
-
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) =>
|
|
20740
|
+
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => import_node_path29.default.join(base, `index${ext}`))
|
|
20697
20741
|
];
|
|
20698
20742
|
const found = candidates.find(
|
|
20699
|
-
(candidate) => (0,
|
|
20743
|
+
(candidate) => (0, import_node_fs28.statSync)(candidate, { throwIfNoEntry: false })?.isFile()
|
|
20700
20744
|
);
|
|
20701
20745
|
if (!found) {
|
|
20702
20746
|
throw new Error(
|
|
@@ -20751,13 +20795,13 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
20751
20795
|
res.end("missing path param");
|
|
20752
20796
|
return true;
|
|
20753
20797
|
}
|
|
20754
|
-
const extension =
|
|
20798
|
+
const extension = import_node_path29.default.extname(targetPath).toLowerCase();
|
|
20755
20799
|
if (!REPLACEMENT_MODULE_EXTENSIONS.some((allowed) => allowed === extension)) {
|
|
20756
20800
|
res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
|
|
20757
20801
|
res.end(`replacement files must be ${REPLACEMENT_MODULE_EXTENSIONS.join(", ")}`);
|
|
20758
20802
|
return true;
|
|
20759
20803
|
}
|
|
20760
|
-
if (!
|
|
20804
|
+
if (!import_node_path29.default.isAbsolute(targetPath)) {
|
|
20761
20805
|
res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
|
|
20762
20806
|
res.end("replacement file path must be absolute");
|
|
20763
20807
|
return true;
|
|
@@ -20765,10 +20809,10 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
20765
20809
|
const runtimePackages = new Set(url.searchParams.getAll("runtimePackage"));
|
|
20766
20810
|
let resolvedProjectRoot;
|
|
20767
20811
|
if (options.projectRoot) {
|
|
20768
|
-
const lexicalProjectRoot =
|
|
20812
|
+
const lexicalProjectRoot = import_node_path29.default.resolve(options.projectRoot);
|
|
20769
20813
|
resolvedProjectRoot = await import_promises5.default.realpath(options.projectRoot);
|
|
20770
|
-
const lexicalTarget =
|
|
20771
|
-
if (lexicalTarget.startsWith("..") ||
|
|
20814
|
+
const lexicalTarget = import_node_path29.default.relative(lexicalProjectRoot, targetPath);
|
|
20815
|
+
if (lexicalTarget.startsWith("..") || import_node_path29.default.isAbsolute(lexicalTarget)) {
|
|
20772
20816
|
res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
|
|
20773
20817
|
res.end("replacement file must be inside the project root");
|
|
20774
20818
|
return true;
|
|
@@ -20784,8 +20828,8 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
20784
20828
|
return true;
|
|
20785
20829
|
}
|
|
20786
20830
|
if (resolvedProjectRoot) {
|
|
20787
|
-
const relativeTarget =
|
|
20788
|
-
if (relativeTarget.startsWith("..") ||
|
|
20831
|
+
const relativeTarget = import_node_path29.default.relative(resolvedProjectRoot, resolvedTargetPath);
|
|
20832
|
+
if (relativeTarget.startsWith("..") || import_node_path29.default.isAbsolute(relativeTarget)) {
|
|
20789
20833
|
res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
|
|
20790
20834
|
res.end("replacement file must be inside the project root");
|
|
20791
20835
|
return true;
|
|
@@ -21036,7 +21080,7 @@ function handleWebSocketProxyUpgrade(req, socket, head, forwardOrigin = true) {
|
|
|
21036
21080
|
response.resume();
|
|
21037
21081
|
fail(502, "upstream websocket rejected upgrade");
|
|
21038
21082
|
});
|
|
21039
|
-
upstreamRequest.
|
|
21083
|
+
upstreamRequest.on("error", () => {
|
|
21040
21084
|
fail(502, "upstream websocket error");
|
|
21041
21085
|
});
|
|
21042
21086
|
upstreamRequest.once("upgrade", (response, upstreamSocket, upstreamHead) => {
|
|
@@ -21280,7 +21324,9 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
|
|
|
21280
21324
|
);
|
|
21281
21325
|
}
|
|
21282
21326
|
try {
|
|
21283
|
-
this.fetchProxyTransport = await startFetchProxyTransport(
|
|
21327
|
+
this.fetchProxyTransport = await startFetchProxyTransport(
|
|
21328
|
+
fetchTransportIdentityPath(boundPort)
|
|
21329
|
+
);
|
|
21284
21330
|
} catch (error) {
|
|
21285
21331
|
await this.close();
|
|
21286
21332
|
throw error;
|