peachsim 0.1.751 → 0.1.753
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-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-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/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +571 -300
- package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +906 -135
- 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 +907 -136
- 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 +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +767 -574
- 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 +465 -194
- package/dist-lib/vite.cjs +1 -1
- package/package.json +1 -1
- package/src/home-paths.ts +1 -0
- package/src/native-firebase-config.ts +17 -111
- package/src/swift-host.ts +51 -18
- package/src/xcode-project.ts +590 -245
package/dist-lib/skills.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.753 | (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;
|
|
@@ -18490,7 +18490,7 @@ function hasValues(bounds) {
|
|
|
18490
18490
|
}
|
|
18491
18491
|
function parseRange(input) {
|
|
18492
18492
|
const groups = input.split("||");
|
|
18493
|
-
const
|
|
18493
|
+
const parsed = [];
|
|
18494
18494
|
for (const group of groups) {
|
|
18495
18495
|
const tokens = group.trim().match(COMPARATOR) ?? [];
|
|
18496
18496
|
if (tokens.length === 0) return null;
|
|
@@ -18504,9 +18504,9 @@ function parseRange(input) {
|
|
|
18504
18504
|
};
|
|
18505
18505
|
}
|
|
18506
18506
|
if (!hasValues(bounds)) return null;
|
|
18507
|
-
|
|
18507
|
+
parsed.push(bounds);
|
|
18508
18508
|
}
|
|
18509
|
-
return
|
|
18509
|
+
return parsed;
|
|
18510
18510
|
}
|
|
18511
18511
|
function containsBounds(container, contained) {
|
|
18512
18512
|
if (container.lower) {
|
|
@@ -18999,12 +18999,12 @@ function parsePort(value) {
|
|
|
18999
18999
|
if (typeof value !== "string") return null;
|
|
19000
19000
|
const trimmed = value.trim();
|
|
19001
19001
|
if (!trimmed) return null;
|
|
19002
|
-
const
|
|
19003
|
-
return Number.isInteger(
|
|
19002
|
+
const parsed = Number(trimmed);
|
|
19003
|
+
return Number.isInteger(parsed) && parsed > 0 ? parsed : null;
|
|
19004
19004
|
}
|
|
19005
19005
|
function parsePortOffset(value) {
|
|
19006
|
-
const
|
|
19007
|
-
return
|
|
19006
|
+
const parsed = parsePort(value);
|
|
19007
|
+
return parsed === null ? 0 : parsed;
|
|
19008
19008
|
}
|
|
19009
19009
|
function resolveSootsimBridgePort(input = {}) {
|
|
19010
19010
|
const explicitPort = parsePort(input.explicitPort);
|
|
@@ -19309,9 +19309,9 @@ function resolveContrastBackendOrigin(currentOrigin) {
|
|
|
19309
19309
|
const origin = currentOrigin?.trim();
|
|
19310
19310
|
if (!origin) return DEFAULT_CONTRAST_BACKEND_ORIGIN;
|
|
19311
19311
|
try {
|
|
19312
|
-
const
|
|
19313
|
-
if (isLoopbackHost(
|
|
19314
|
-
return
|
|
19312
|
+
const parsed = new URL(origin);
|
|
19313
|
+
if (isLoopbackHost(parsed.hostname) || isContrastBackendHost(parsed.hostname)) {
|
|
19314
|
+
return parsed.origin;
|
|
19315
19315
|
}
|
|
19316
19316
|
} catch {
|
|
19317
19317
|
}
|
|
@@ -19359,13 +19359,13 @@ function mergePeachConfig(base, override) {
|
|
|
19359
19359
|
};
|
|
19360
19360
|
}
|
|
19361
19361
|
function applyPeachConfigToUrl(url, config) {
|
|
19362
|
-
const
|
|
19362
|
+
const parsed = new URL(url);
|
|
19363
19363
|
if (hasPeachConfig(config)) {
|
|
19364
|
-
|
|
19364
|
+
parsed.searchParams.set(PEACH_CONFIG_QUERY_PARAM, JSON.stringify(config));
|
|
19365
19365
|
} else {
|
|
19366
|
-
|
|
19366
|
+
parsed.searchParams.delete(PEACH_CONFIG_QUERY_PARAM);
|
|
19367
19367
|
}
|
|
19368
|
-
return
|
|
19368
|
+
return parsed.toString();
|
|
19369
19369
|
}
|
|
19370
19370
|
var PEACH_CONFIG_QUERY_PARAM;
|
|
19371
19371
|
var init_config = __esm({
|
|
@@ -19395,25 +19395,25 @@ function alignLoopbackBundleUrlWithProbe(bundleUrl, probeBaseUrl) {
|
|
|
19395
19395
|
return bundleUrl;
|
|
19396
19396
|
}
|
|
19397
19397
|
}
|
|
19398
|
-
function applyPreviewProdBundle(
|
|
19398
|
+
function applyPreviewProdBundle(parsed) {
|
|
19399
19399
|
if (!process.env.SOOTSIM_PREVIEW_PROD_BUNDLE) return;
|
|
19400
|
-
|
|
19401
|
-
|
|
19402
|
-
if (
|
|
19400
|
+
parsed.searchParams.set("dev", "false");
|
|
19401
|
+
parsed.searchParams.set("minify", "true");
|
|
19402
|
+
if (parsed.searchParams.has("hot")) parsed.searchParams.set("hot", "false");
|
|
19403
19403
|
}
|
|
19404
19404
|
function normalizeNativeDevBundleUrl(bundleUrl) {
|
|
19405
19405
|
try {
|
|
19406
19406
|
const isAbsolute3 = isAbsoluteHttpUrl(bundleUrl);
|
|
19407
|
-
const
|
|
19408
|
-
|
|
19409
|
-
if (!isNativeDevBundlePath(
|
|
19410
|
-
|
|
19411
|
-
if (
|
|
19412
|
-
|
|
19413
|
-
}
|
|
19414
|
-
applyPreviewProdBundle(
|
|
19415
|
-
if (isAbsolute3) return
|
|
19416
|
-
return `${
|
|
19407
|
+
const parsed = new URL(bundleUrl, "http://sootsim.local");
|
|
19408
|
+
parsed.pathname = parsed.pathname.replace(/\.\.bundle$/, ".bundle");
|
|
19409
|
+
if (!isNativeDevBundlePath(parsed.pathname)) return bundleUrl;
|
|
19410
|
+
parsed.searchParams.delete("transform.bytecode");
|
|
19411
|
+
if (parsed.searchParams.get("lazy") === "true") {
|
|
19412
|
+
parsed.searchParams.set("lazy", "false");
|
|
19413
|
+
}
|
|
19414
|
+
applyPreviewProdBundle(parsed);
|
|
19415
|
+
if (isAbsolute3) return parsed.toString();
|
|
19416
|
+
return `${parsed.pathname}${parsed.search}${parsed.hash}`;
|
|
19417
19417
|
} catch {
|
|
19418
19418
|
return bundleUrl;
|
|
19419
19419
|
}
|
|
@@ -19421,11 +19421,11 @@ function normalizeNativeDevBundleUrl(bundleUrl) {
|
|
|
19421
19421
|
function applyHotMode(bundleUrl, hot) {
|
|
19422
19422
|
try {
|
|
19423
19423
|
const isAbsolute3 = isAbsoluteHttpUrl(bundleUrl);
|
|
19424
|
-
const
|
|
19425
|
-
if (!isNativeDevBundlePath(
|
|
19426
|
-
|
|
19427
|
-
if (isAbsolute3) return
|
|
19428
|
-
return `${
|
|
19424
|
+
const parsed = new URL(bundleUrl, "http://sootsim.local");
|
|
19425
|
+
if (!isNativeDevBundlePath(parsed.pathname)) return bundleUrl;
|
|
19426
|
+
parsed.searchParams.set("hot", hot ? "true" : "false");
|
|
19427
|
+
if (isAbsolute3) return parsed.toString();
|
|
19428
|
+
return `${parsed.pathname}${parsed.search}${parsed.hash}`;
|
|
19429
19429
|
} catch {
|
|
19430
19430
|
return bundleUrl;
|
|
19431
19431
|
}
|
|
@@ -19819,8 +19819,8 @@ async function parsePlistRecord(path33) {
|
|
|
19819
19819
|
const metadata = await (0, import_promises.stat)(path33);
|
|
19820
19820
|
if (!metadata.isFile() || metadata.size > MAX_PLIST_BYTES) return null;
|
|
19821
19821
|
const source = await (0, import_promises.readFile)(path33, "utf8");
|
|
19822
|
-
const
|
|
19823
|
-
return isRecord(
|
|
19822
|
+
const parsed = parsePlistSource(source);
|
|
19823
|
+
return isRecord(parsed) ? parsed : null;
|
|
19824
19824
|
} catch {
|
|
19825
19825
|
return null;
|
|
19826
19826
|
}
|
|
@@ -20368,8 +20368,8 @@ function isDirectOneBundleUrl(bundleUrl) {
|
|
|
20368
20368
|
}
|
|
20369
20369
|
function safeParseManifest(body) {
|
|
20370
20370
|
try {
|
|
20371
|
-
const
|
|
20372
|
-
return
|
|
20371
|
+
const parsed = JSON.parse(body);
|
|
20372
|
+
return parsed && typeof parsed === "object" ? parsed : null;
|
|
20373
20373
|
} catch {
|
|
20374
20374
|
return null;
|
|
20375
20375
|
}
|
|
@@ -20417,8 +20417,8 @@ function applyManifest(result, manifestRes, buildIconProxyUrl) {
|
|
|
20417
20417
|
if (rawIcon.startsWith("http://") || rawIcon.startsWith("https://")) {
|
|
20418
20418
|
let isLoopback = false;
|
|
20419
20419
|
try {
|
|
20420
|
-
const
|
|
20421
|
-
isLoopback = isLoopbackHost(
|
|
20420
|
+
const parsed = new URL(rawIcon);
|
|
20421
|
+
isLoopback = isLoopbackHost(parsed.hostname);
|
|
20422
20422
|
} catch {
|
|
20423
20423
|
}
|
|
20424
20424
|
if (buildIconProxyUrl) {
|
|
@@ -20488,7 +20488,7 @@ async function fetchManifestEnrichment(result, buildIconProxyUrl) {
|
|
|
20488
20488
|
}
|
|
20489
20489
|
);
|
|
20490
20490
|
if (!manifestRes || manifestRes.statusCode !== 200) return;
|
|
20491
|
-
const
|
|
20491
|
+
const parsed = applyManifest(
|
|
20492
20492
|
{
|
|
20493
20493
|
port: result.port,
|
|
20494
20494
|
framework: "one",
|
|
@@ -20498,12 +20498,12 @@ async function fetchManifestEnrichment(result, buildIconProxyUrl) {
|
|
|
20498
20498
|
manifestRes,
|
|
20499
20499
|
buildIconProxyUrl
|
|
20500
20500
|
);
|
|
20501
|
-
if (!
|
|
20501
|
+
if (!parsed.projectName && !parsed.iconUrl) return;
|
|
20502
20502
|
enrichmentCache.set(result.port, {
|
|
20503
|
-
projectName:
|
|
20504
|
-
iconUrl:
|
|
20505
|
-
iconPath:
|
|
20506
|
-
bundleId:
|
|
20503
|
+
projectName: parsed.projectName,
|
|
20504
|
+
iconUrl: parsed.iconUrl,
|
|
20505
|
+
iconPath: parsed.iconPath,
|
|
20506
|
+
bundleId: parsed.bundleId
|
|
20507
20507
|
});
|
|
20508
20508
|
invalidatePortCache(result.port);
|
|
20509
20509
|
}
|
|
@@ -20973,8 +20973,8 @@ function cliUpdateFilePath() {
|
|
|
20973
20973
|
function readSharedConfig() {
|
|
20974
20974
|
try {
|
|
20975
20975
|
const raw2 = import_node_fs3.default.readFileSync(configFilePath(), "utf8");
|
|
20976
|
-
const
|
|
20977
|
-
return
|
|
20976
|
+
const parsed = JSON.parse(raw2);
|
|
20977
|
+
return parsed && typeof parsed === "object" ? parsed : {};
|
|
20978
20978
|
} catch {
|
|
20979
20979
|
return {};
|
|
20980
20980
|
}
|
|
@@ -21062,12 +21062,12 @@ function consumeRuntimeUpgradeNotice() {
|
|
|
21062
21062
|
try {
|
|
21063
21063
|
const raw2 = import_node_fs3.default.readFileSync(runtimeUpgradeNoticePath(), "utf8");
|
|
21064
21064
|
import_node_fs3.default.unlinkSync(runtimeUpgradeNoticePath());
|
|
21065
|
-
const
|
|
21066
|
-
if (typeof
|
|
21065
|
+
const parsed = JSON.parse(raw2);
|
|
21066
|
+
if (typeof parsed?.to !== "string" || !parsed.to) return null;
|
|
21067
21067
|
return {
|
|
21068
|
-
from: typeof
|
|
21069
|
-
to:
|
|
21070
|
-
at: typeof
|
|
21068
|
+
from: typeof parsed.from === "string" ? parsed.from : null,
|
|
21069
|
+
to: parsed.to,
|
|
21070
|
+
at: typeof parsed.at === "number" ? parsed.at : 0
|
|
21071
21071
|
};
|
|
21072
21072
|
} catch {
|
|
21073
21073
|
return null;
|
|
@@ -21110,9 +21110,9 @@ function readDaemonLockfile() {
|
|
|
21110
21110
|
const buf = Buffer.alloc(DAEMON_LOCKFILE_MAX_BYTES);
|
|
21111
21111
|
const bytesRead = import_node_fs3.default.readSync(fd, buf, 0, DAEMON_LOCKFILE_MAX_BYTES, 0);
|
|
21112
21112
|
const raw2 = buf.subarray(0, bytesRead).toString("utf8");
|
|
21113
|
-
const
|
|
21114
|
-
if (
|
|
21115
|
-
return
|
|
21113
|
+
const parsed = JSON.parse(raw2);
|
|
21114
|
+
if (parsed && parsed.schema === 1 && typeof parsed.pid === "number" && typeof parsed.bridgePort === "number" && typeof parsed.runtimePort === "number" && typeof parsed.startedAt === "number" && typeof parsed.heartbeatAt === "number" && (parsed.servedRuntimes === void 0 || Array.isArray(parsed.servedRuntimes) && parsed.servedRuntimes.every((version) => typeof version === "string"))) {
|
|
21115
|
+
return parsed;
|
|
21116
21116
|
}
|
|
21117
21117
|
return null;
|
|
21118
21118
|
} finally {
|
|
@@ -21124,9 +21124,9 @@ function readDaemonLockfile() {
|
|
|
21124
21124
|
}
|
|
21125
21125
|
function parseDevBridgeLockfile(raw2) {
|
|
21126
21126
|
try {
|
|
21127
|
-
const
|
|
21128
|
-
if (
|
|
21129
|
-
return
|
|
21127
|
+
const parsed = JSON.parse(raw2);
|
|
21128
|
+
if (parsed && parsed.schema === 1 && parsed.source === "vite-dev" && typeof parsed.pid === "number" && typeof parsed.bridgePort === "number" && typeof parsed.runtimePort === "number" && typeof parsed.cwd === "string" && typeof parsed.startedAt === "number" && typeof parsed.heartbeatAt === "number" && (parsed.shellPort === void 0 || typeof parsed.shellPort === "number") && (parsed.servedRuntimes === void 0 || Array.isArray(parsed.servedRuntimes) && parsed.servedRuntimes.every((version) => typeof version === "string"))) {
|
|
21129
|
+
return parsed;
|
|
21130
21130
|
}
|
|
21131
21131
|
return null;
|
|
21132
21132
|
} catch {
|
|
@@ -23230,10 +23230,10 @@ var init_product = __esm({
|
|
|
23230
23230
|
function createRuntimeDelivery(product) {
|
|
23231
23231
|
function readConfig() {
|
|
23232
23232
|
try {
|
|
23233
|
-
const
|
|
23233
|
+
const parsed = JSON.parse(
|
|
23234
23234
|
import_node_fs9.default.readFileSync(product.configFile(), "utf8")
|
|
23235
23235
|
);
|
|
23236
|
-
return
|
|
23236
|
+
return parsed && typeof parsed === "object" ? parsed : {};
|
|
23237
23237
|
} catch {
|
|
23238
23238
|
return {};
|
|
23239
23239
|
}
|
|
@@ -23859,8 +23859,8 @@ function flatScale(path33) {
|
|
|
23859
23859
|
function providesNamespace(text) {
|
|
23860
23860
|
if (text === null) return false;
|
|
23861
23861
|
try {
|
|
23862
|
-
const
|
|
23863
|
-
return
|
|
23862
|
+
const parsed = JSON.parse(text);
|
|
23863
|
+
return parsed?.properties?.["provides-namespace"] === true;
|
|
23864
23864
|
} catch {
|
|
23865
23865
|
return false;
|
|
23866
23866
|
}
|
|
@@ -23890,15 +23890,15 @@ function enumerateBundleImages(paths, readText2) {
|
|
|
23890
23890
|
for (const contentsPath of catalogs) {
|
|
23891
23891
|
const name2 = catalogEntryName(contentsPath, ".imageset", readText2);
|
|
23892
23892
|
if (name2 === null || seen.has(name2)) continue;
|
|
23893
|
-
let
|
|
23893
|
+
let parsed;
|
|
23894
23894
|
try {
|
|
23895
23895
|
const text = readText2(contentsPath);
|
|
23896
23896
|
if (text === null) continue;
|
|
23897
|
-
|
|
23897
|
+
parsed = JSON.parse(text);
|
|
23898
23898
|
} catch {
|
|
23899
23899
|
continue;
|
|
23900
23900
|
}
|
|
23901
|
-
const images =
|
|
23901
|
+
const images = parsed?.images;
|
|
23902
23902
|
if (!Array.isArray(images)) continue;
|
|
23903
23903
|
const dir = contentsPath.split("/").slice(0, -1).join("/");
|
|
23904
23904
|
const pick = pickImagesetFile(images);
|
|
@@ -23918,8 +23918,8 @@ function enumerateBundleImages(paths, readText2) {
|
|
|
23918
23918
|
}
|
|
23919
23919
|
function colorComponent(value) {
|
|
23920
23920
|
if (typeof value !== "string") return null;
|
|
23921
|
-
const
|
|
23922
|
-
return Number.isFinite(
|
|
23921
|
+
const parsed = value.startsWith("0x") ? Number.parseInt(value.slice(2), 16) / 255 : value.includes(".") ? Number.parseFloat(value) : Number.parseInt(value, 10) / 255;
|
|
23922
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
23923
23923
|
}
|
|
23924
23924
|
function colorsetValue(color) {
|
|
23925
23925
|
if (typeof color !== "object" || color === null) return null;
|
|
@@ -24179,8 +24179,8 @@ function readSharedDesktopAuthSession() {
|
|
|
24179
24179
|
const filepath = getSharedDesktopAuthFilePath();
|
|
24180
24180
|
if (!(0, import_node_fs12.existsSync)(filepath)) return null;
|
|
24181
24181
|
try {
|
|
24182
|
-
const
|
|
24183
|
-
const normalized = normalizeSession(
|
|
24182
|
+
const parsed = JSON.parse((0, import_node_fs12.readFileSync)(filepath, "utf8"));
|
|
24183
|
+
const normalized = normalizeSession(parsed);
|
|
24184
24184
|
if (!normalized) {
|
|
24185
24185
|
(0, import_node_fs12.rmSync)(filepath, { force: true });
|
|
24186
24186
|
return null;
|
|
@@ -24424,9 +24424,9 @@ function resolveRemotePackages(projectDir, resolved, products, provided) {
|
|
|
24424
24424
|
if (!pin) return null;
|
|
24425
24425
|
const dir = checkout(checkouts, identity, pin);
|
|
24426
24426
|
const manifest = import_node_fs13.default.readFileSync(import_node_path13.default.join(dir, "Package.swift"), "utf8");
|
|
24427
|
-
const
|
|
24428
|
-
packages.set(identity,
|
|
24429
|
-
return
|
|
24427
|
+
const loaded2 = { dir, manifest, graph: swiftManifestGraph(manifest) };
|
|
24428
|
+
packages.set(identity, loaded2);
|
|
24429
|
+
return loaded2;
|
|
24430
24430
|
};
|
|
24431
24431
|
const targets = /* @__PURE__ */ new Map();
|
|
24432
24432
|
const outcomes = /* @__PURE__ */ new Map();
|
|
@@ -24784,30 +24784,90 @@ function readXcconfig(file, seen = /* @__PURE__ */ new Set()) {
|
|
|
24784
24784
|
);
|
|
24785
24785
|
continue;
|
|
24786
24786
|
}
|
|
24787
|
-
const setting = /^([A-
|
|
24788
|
-
if (setting)
|
|
24787
|
+
const setting = /^([A-Za-z_][A-Za-z0-9_]*(?:\[[^\]]*\])*)\s*=\s*(.*)$/.exec(line);
|
|
24788
|
+
if (setting)
|
|
24789
|
+
settings[setting[1].replace(/\s+/g, "")] = setting[2].replace(/;$/, "").trim();
|
|
24789
24790
|
}
|
|
24790
24791
|
return settings;
|
|
24791
24792
|
}
|
|
24792
|
-
function
|
|
24793
|
-
const
|
|
24794
|
-
|
|
24793
|
+
function applyConditions(raw2, configuration) {
|
|
24794
|
+
const plain = {};
|
|
24795
|
+
const conditional = {};
|
|
24796
|
+
for (const [key, value] of Object.entries(raw2)) {
|
|
24797
|
+
const bracket = key.indexOf("[");
|
|
24798
|
+
if (bracket === -1) {
|
|
24799
|
+
plain[key] = value;
|
|
24800
|
+
continue;
|
|
24801
|
+
}
|
|
24802
|
+
const matches = [...key.slice(bracket).matchAll(/\[([^=\]]+)=([^\]]*)\]/g)].every(
|
|
24803
|
+
([, name2, pattern]) => {
|
|
24804
|
+
const actual = name2 === "config" ? configuration : CONDITIONS[name2];
|
|
24805
|
+
return actual !== void 0 && new RegExp(
|
|
24806
|
+
`^${pattern.replace(/[.+^${}()|\\]/g, "\\$&").replaceAll("*", ".*").replaceAll("?", ".")}$`
|
|
24807
|
+
).test(actual);
|
|
24808
|
+
}
|
|
24809
|
+
);
|
|
24810
|
+
if (matches) conditional[key.slice(0, bracket)] = value;
|
|
24811
|
+
}
|
|
24812
|
+
return { ...plain, ...conditional };
|
|
24813
|
+
}
|
|
24814
|
+
function applyOperator(value, operator) {
|
|
24815
|
+
if (operator.startsWith("default=")) return value === "" ? operator.slice(8) : value;
|
|
24816
|
+
switch (operator) {
|
|
24817
|
+
case "lower":
|
|
24818
|
+
return value.toLowerCase();
|
|
24819
|
+
case "upper":
|
|
24820
|
+
return value.toUpperCase();
|
|
24821
|
+
case "rfc1034identifier":
|
|
24822
|
+
return value.replace(/[^A-Za-z0-9-]/g, "-").replace(/^[0-9]/, "-");
|
|
24823
|
+
case "identifier":
|
|
24824
|
+
case "c99extidentifier":
|
|
24825
|
+
return value.replace(/[^A-Za-z0-9_]/g, "_").replace(/^[0-9]/, "_");
|
|
24826
|
+
}
|
|
24827
|
+
throw new Error(`unsupported build setting operator :${operator}`);
|
|
24828
|
+
}
|
|
24829
|
+
function decodeXml(text) {
|
|
24830
|
+
return text.replaceAll(""", '"').replaceAll("'", "'").replaceAll("<", "<").replaceAll(">", ">").replaceAll("&", "&");
|
|
24831
|
+
}
|
|
24832
|
+
function workspaceReferences(workspace) {
|
|
24833
|
+
const data = import_node_path14.default.join(workspace, "contents.xcworkspacedata");
|
|
24834
|
+
if (!import_node_fs14.default.existsSync(data))
|
|
24835
|
+
throw new Error(`${workspace} has no contents.xcworkspacedata`);
|
|
24836
|
+
const container = import_node_path14.default.dirname(workspace);
|
|
24837
|
+
const locate = (location2, base) => {
|
|
24838
|
+
const colon = location2.indexOf(":");
|
|
24839
|
+
const kind = location2.slice(0, colon);
|
|
24840
|
+
const rest = location2.slice(colon + 1);
|
|
24841
|
+
if (kind === "group") return import_node_path14.default.resolve(base, rest);
|
|
24842
|
+
if (kind === "container" || kind === "self") return import_node_path14.default.resolve(container, rest);
|
|
24843
|
+
if (kind === "absolute") return import_node_path14.default.resolve(rest);
|
|
24844
|
+
throw new Error(`${import_node_path14.default.basename(workspace)} has an unsupported location ${location2}`);
|
|
24845
|
+
};
|
|
24846
|
+
const groups = [container];
|
|
24847
|
+
const references = [];
|
|
24848
|
+
for (const [, closing, tag, attributes, selfClosing] of import_node_fs14.default.readFileSync(data, "utf8").matchAll(/<(\/?)(Group|FileRef)\b([^>]*?)(\/?)>/g)) {
|
|
24849
|
+
if (closing) {
|
|
24850
|
+
if (tag === "Group") groups.pop();
|
|
24851
|
+
continue;
|
|
24852
|
+
}
|
|
24853
|
+
const base = groups.at(-1);
|
|
24854
|
+
const location2 = /\blocation\s*=\s*"([^"]*)"/.exec(attributes)?.[1];
|
|
24855
|
+
const resolved = location2 ? locate(decodeXml(location2), base) : base;
|
|
24856
|
+
if (tag === "FileRef") references.push(resolved);
|
|
24857
|
+
else if (!selfClosing) groups.push(resolved);
|
|
24858
|
+
}
|
|
24859
|
+
return references;
|
|
24795
24860
|
}
|
|
24796
|
-
function
|
|
24861
|
+
function loadProject(xcodeproj) {
|
|
24862
|
+
const pbxproj = import_node_path14.default.join(xcodeproj, "project.pbxproj");
|
|
24863
|
+
if (!import_node_fs14.default.existsSync(pbxproj)) throw new Error(`${xcodeproj} has no project.pbxproj`);
|
|
24797
24864
|
const mtimeMs = import_node_fs14.default.statSync(pbxproj).mtimeMs;
|
|
24798
|
-
const cached4 =
|
|
24799
|
-
if (cached4?.mtimeMs === mtimeMs) return cached4.
|
|
24865
|
+
const cached4 = loaded.get(pbxproj);
|
|
24866
|
+
if (cached4?.mtimeMs === mtimeMs) return cached4.project;
|
|
24800
24867
|
const root = parseOpenStepPlist(import_node_fs14.default.readFileSync(pbxproj, "utf8"));
|
|
24801
24868
|
if (!isDict(root) || !isDict(root.objects)) {
|
|
24802
24869
|
throw new Error(`${pbxproj} has no objects table`);
|
|
24803
24870
|
}
|
|
24804
|
-
parsed.set(pbxproj, { mtimeMs, root });
|
|
24805
|
-
return root;
|
|
24806
|
-
}
|
|
24807
|
-
function readXcodeAppTarget(xcodeproj, targetName) {
|
|
24808
|
-
const pbxproj = import_node_path14.default.join(xcodeproj, "project.pbxproj");
|
|
24809
|
-
if (!import_node_fs14.default.existsSync(pbxproj)) throw new Error(`${xcodeproj} has no project.pbxproj`);
|
|
24810
|
-
const root = readProject(pbxproj);
|
|
24811
24871
|
const objects = root.objects;
|
|
24812
24872
|
const object = (id) => {
|
|
24813
24873
|
const found = id === void 0 ? void 0 : objects[id];
|
|
@@ -24831,141 +24891,131 @@ function readXcodeAppTarget(xcodeproj, targetName) {
|
|
|
24831
24891
|
const resolvePath = (id) => {
|
|
24832
24892
|
if (resolvedPaths.has(id)) return resolvedPaths.get(id);
|
|
24833
24893
|
const entry = object(id);
|
|
24834
|
-
let
|
|
24894
|
+
let result2 = null;
|
|
24835
24895
|
if (entry) {
|
|
24836
24896
|
const own = str(entry.path) ?? "";
|
|
24837
24897
|
const tree = str(entry.sourceTree) ?? "<group>";
|
|
24838
|
-
if (tree === "<absolute>")
|
|
24839
|
-
else if (tree === "SOURCE_ROOT")
|
|
24898
|
+
if (tree === "<absolute>") result2 = own;
|
|
24899
|
+
else if (tree === "SOURCE_ROOT") result2 = import_node_path14.default.join(projectDir, own);
|
|
24840
24900
|
else if (tree === "<group>") {
|
|
24841
24901
|
const up = parent.get(id);
|
|
24842
24902
|
const base = up ? resolvePath(up) : projectDir;
|
|
24843
|
-
|
|
24903
|
+
result2 = base === null ? null : import_node_path14.default.join(base, own);
|
|
24844
24904
|
}
|
|
24845
24905
|
}
|
|
24846
|
-
resolvedPaths.set(id,
|
|
24847
|
-
return
|
|
24906
|
+
resolvedPaths.set(id, result2);
|
|
24907
|
+
return result2;
|
|
24848
24908
|
};
|
|
24849
|
-
const
|
|
24850
|
-
|
|
24851
|
-
|
|
24852
|
-
|
|
24853
|
-
|
|
24854
|
-
const
|
|
24855
|
-
|
|
24856
|
-
|
|
24857
|
-
targetName ? `${import_node_path14.default.basename(xcodeproj)} has no application target ${targetName}; it has ${appTargetNames.join(", ") || "none"}` : `${import_node_path14.default.basename(xcodeproj)} has ${appTargetNames.length} application targets (${appTargetNames.join(", ") || "none"}); pass --target`
|
|
24858
|
-
);
|
|
24859
|
-
}
|
|
24860
|
-
const { id: targetId, target } = chosen;
|
|
24861
|
-
const configSettings = (listId) => {
|
|
24862
|
-
const configs = list(object(listId)?.buildConfigurations).map(object);
|
|
24909
|
+
const result = { xcodeproj, pbxproj, objects, project, projectDir, object, resolvePath };
|
|
24910
|
+
loaded.set(pbxproj, { mtimeMs, project: result });
|
|
24911
|
+
return result;
|
|
24912
|
+
}
|
|
24913
|
+
function targetSettings(ref, builtins) {
|
|
24914
|
+
const { project, target } = ref;
|
|
24915
|
+
const level = (listId) => {
|
|
24916
|
+
const configs = list(project.object(listId)?.buildConfigurations).map(project.object);
|
|
24863
24917
|
const config = configs.find((entry) => entry?.name === "Debug") ?? configs.find(Boolean);
|
|
24864
|
-
if (!config) return
|
|
24918
|
+
if (!config) return [];
|
|
24919
|
+
const name2 = str(config.name) ?? "Debug";
|
|
24865
24920
|
const base = str(config.baseConfigurationReference);
|
|
24866
|
-
const fromFile = base ? readXcconfig(resolvePath(base) ?? "") : {};
|
|
24867
24921
|
const own = isDict(config.buildSettings) ? config.buildSettings : {};
|
|
24868
|
-
return
|
|
24869
|
-
|
|
24870
|
-
|
|
24871
|
-
Object.
|
|
24872
|
-
(
|
|
24873
|
-
|
|
24922
|
+
return [
|
|
24923
|
+
applyConditions(base ? readXcconfig(project.resolvePath(base) ?? "") : {}, name2),
|
|
24924
|
+
applyConditions(
|
|
24925
|
+
Object.fromEntries(
|
|
24926
|
+
Object.entries(own).flatMap(
|
|
24927
|
+
([key, value]) => typeof value === "string" ? [[key, value]] : Array.isArray(value) ? [[key, list(value).join(" ")]] : []
|
|
24928
|
+
)
|
|
24929
|
+
),
|
|
24930
|
+
name2
|
|
24874
24931
|
)
|
|
24875
|
-
|
|
24932
|
+
];
|
|
24876
24933
|
};
|
|
24877
|
-
const
|
|
24878
|
-
|
|
24879
|
-
...
|
|
24934
|
+
const levels = [
|
|
24935
|
+
builtins,
|
|
24936
|
+
...level(str(project.project.buildConfigurationList)),
|
|
24937
|
+
...level(str(target.buildConfigurationList))
|
|
24938
|
+
];
|
|
24939
|
+
const resolving = /* @__PURE__ */ new Set();
|
|
24940
|
+
const valueAt = (key, top) => {
|
|
24941
|
+
let at = top;
|
|
24942
|
+
while (at >= 0 && levels[at][key] === void 0) at--;
|
|
24943
|
+
if (at < 0) return derived(key);
|
|
24944
|
+
const marker = `${key}@${at}`;
|
|
24945
|
+
if (resolving.has(marker))
|
|
24946
|
+
throw new Error(`${str(target.name)} has a cyclic build setting ${key}`);
|
|
24947
|
+
resolving.add(marker);
|
|
24948
|
+
const value = expand(
|
|
24949
|
+
levels[at][key],
|
|
24950
|
+
(name2) => name2 === "inherited" ? valueAt(key, at - 1) : valueAt(name2, levels.length - 1)
|
|
24951
|
+
);
|
|
24952
|
+
resolving.delete(marker);
|
|
24953
|
+
return value;
|
|
24880
24954
|
};
|
|
24881
|
-
const
|
|
24882
|
-
|
|
24883
|
-
|
|
24884
|
-
|
|
24885
|
-
|
|
24886
|
-
|
|
24887
|
-
|
|
24888
|
-
|
|
24889
|
-
|
|
24890
|
-
|
|
24891
|
-
|
|
24892
|
-
|
|
24893
|
-
|
|
24894
|
-
|
|
24955
|
+
const derived = (key) => {
|
|
24956
|
+
const get = (name2) => valueAt(name2, levels.length - 1);
|
|
24957
|
+
switch (key) {
|
|
24958
|
+
case "PRODUCT_NAME":
|
|
24959
|
+
return get("TARGET_NAME");
|
|
24960
|
+
case "PRODUCT_MODULE_NAME":
|
|
24961
|
+
return applyOperator(get("PRODUCT_NAME"), "c99extidentifier");
|
|
24962
|
+
case "EXECUTABLE_NAME":
|
|
24963
|
+
return get("PRODUCT_NAME");
|
|
24964
|
+
case "AppIdentifierPrefix":
|
|
24965
|
+
case "TeamIdentifierPrefix": {
|
|
24966
|
+
const team = get("DEVELOPMENT_TEAM");
|
|
24967
|
+
return get("CODE_SIGNING_ALLOWED") !== "NO" && team ? `${team}.` : "";
|
|
24968
|
+
}
|
|
24969
|
+
}
|
|
24970
|
+
return "";
|
|
24895
24971
|
};
|
|
24896
|
-
|
|
24897
|
-
|
|
24898
|
-
|
|
24899
|
-
if (seen.has(value)) throw new Error(`${name2} has cyclic Info.plist build settings`);
|
|
24900
|
-
seen.add(value);
|
|
24901
|
-
value = value.replace(
|
|
24902
|
-
/\$[({]([A-Za-z_][A-Za-z0-9_]*)[)}]/g,
|
|
24903
|
-
(match, key) => {
|
|
24904
|
-
const replacement = Object.entries(variables).find(
|
|
24905
|
-
([name3]) => name3 === key
|
|
24906
|
-
)?.[1];
|
|
24907
|
-
if (replacement === void 0)
|
|
24908
|
-
throw new Error(`${name2} Info.plist has unresolved setting ${match}`);
|
|
24909
|
-
return replacement;
|
|
24910
|
-
}
|
|
24911
|
-
);
|
|
24912
|
-
}
|
|
24913
|
-
return value;
|
|
24972
|
+
return {
|
|
24973
|
+
get: (key) => valueAt(key, levels.length - 1),
|
|
24974
|
+
keys: new Set(levels.flatMap((values) => Object.keys(values)))
|
|
24914
24975
|
};
|
|
24915
|
-
|
|
24916
|
-
|
|
24917
|
-
|
|
24918
|
-
|
|
24919
|
-
|
|
24920
|
-
|
|
24921
|
-
|
|
24976
|
+
}
|
|
24977
|
+
function expand(value, lookup) {
|
|
24978
|
+
return value.replace(
|
|
24979
|
+
/\$(?:\(([A-Za-z_][A-Za-z0-9_]*)((?::[^)]*)?)\)|\{([A-Za-z_][A-Za-z0-9_]*)((?::[^}]*)?)\}|([A-Za-z_][A-Za-z0-9_]*))/g,
|
|
24980
|
+
(_match, paren, parenOps, brace, braceOps, bare) => {
|
|
24981
|
+
const name2 = paren ?? brace ?? bare;
|
|
24982
|
+
const operators = parenOps ?? braceOps ?? "";
|
|
24983
|
+
return operators.split(":").slice(1).reduce((current, operator) => applyOperator(current, operator), lookup(name2));
|
|
24922
24984
|
}
|
|
24923
|
-
|
|
24924
|
-
|
|
24925
|
-
|
|
24926
|
-
const
|
|
24927
|
-
if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
|
|
24928
|
-
throw new Error(`${name2} Info.plist must contain a dictionary`);
|
|
24929
|
-
}
|
|
24930
|
-
const info = {};
|
|
24931
|
-
for (const [key, value] of Object.entries(sourceInfo)) info[key] = expandValue(value);
|
|
24932
|
-
for (const [key, value] of Object.entries(settings)) {
|
|
24933
|
-
if (!key.startsWith("INFOPLIST_KEY_") || key.endsWith("_Generation")) continue;
|
|
24934
|
-
info[key.slice("INFOPLIST_KEY_".length)] = value === "YES" ? true : value === "NO" ? false : expand(value);
|
|
24935
|
-
}
|
|
24936
|
-
if (settings.INFOPLIST_KEY_UIApplicationSceneManifest_Generation === "YES" && info.UIApplicationSceneManifest === void 0) {
|
|
24937
|
-
info.UIApplicationSceneManifest = {
|
|
24938
|
-
UIApplicationSupportsMultipleScenes: true,
|
|
24939
|
-
UISceneConfigurations: {}
|
|
24940
|
-
};
|
|
24941
|
-
}
|
|
24985
|
+
);
|
|
24986
|
+
}
|
|
24987
|
+
function targetMembers(ref) {
|
|
24988
|
+
const { project, target, id: targetId } = ref;
|
|
24942
24989
|
const sources = /* @__PURE__ */ new Set();
|
|
24990
|
+
const allSources = /* @__PURE__ */ new Set();
|
|
24943
24991
|
const resources = /* @__PURE__ */ new Set();
|
|
24944
24992
|
const addResource = (file) => {
|
|
24945
|
-
if (
|
|
24993
|
+
if (isDirectory(file)) {
|
|
24946
24994
|
for (const inner of walkFiles(file)) resources.add(inner);
|
|
24947
24995
|
} else if (import_node_fs14.default.existsSync(file)) resources.add(file);
|
|
24948
24996
|
};
|
|
24949
24997
|
const fileRefPaths = (refId) => {
|
|
24950
|
-
const
|
|
24951
|
-
if (!
|
|
24952
|
-
if (
|
|
24953
|
-
return list(
|
|
24954
|
-
const resolved2 = resolvePath(child);
|
|
24998
|
+
const entry = project.object(refId);
|
|
24999
|
+
if (!entry) return [];
|
|
25000
|
+
if (entry.isa === "PBXVariantGroup") {
|
|
25001
|
+
return list(entry.children).flatMap((child) => {
|
|
25002
|
+
const resolved2 = project.resolvePath(child);
|
|
24955
25003
|
return resolved2 ? [resolved2] : [];
|
|
24956
25004
|
});
|
|
24957
25005
|
}
|
|
24958
|
-
const resolved = resolvePath(refId);
|
|
25006
|
+
const resolved = project.resolvePath(refId);
|
|
24959
25007
|
return resolved ? [resolved] : [];
|
|
24960
25008
|
};
|
|
24961
25009
|
for (const phaseId of list(target.buildPhases)) {
|
|
24962
|
-
const phase = object(phaseId);
|
|
25010
|
+
const phase = project.object(phaseId);
|
|
24963
25011
|
if (phase?.isa !== "PBXSourcesBuildPhase" && phase?.isa !== "PBXResourcesBuildPhase")
|
|
24964
25012
|
continue;
|
|
24965
25013
|
for (const buildFileId of list(phase.files)) {
|
|
24966
|
-
for (const file of fileRefPaths(str(object(buildFileId)?.fileRef) ?? "")) {
|
|
24967
|
-
if (phase.isa === "PBXSourcesBuildPhase"
|
|
24968
|
-
if (import_node_fs14.default.existsSync(file))
|
|
25014
|
+
for (const file of fileRefPaths(str(project.object(buildFileId)?.fileRef) ?? "")) {
|
|
25015
|
+
if (phase.isa === "PBXSourcesBuildPhase") {
|
|
25016
|
+
if (!import_node_fs14.default.existsSync(file)) continue;
|
|
25017
|
+
allSources.add(file);
|
|
25018
|
+
if (file.endsWith(".swift")) sources.add(file);
|
|
24969
25019
|
} else if (phase.isa === "PBXResourcesBuildPhase") addResource(file);
|
|
24970
25020
|
}
|
|
24971
25021
|
}
|
|
@@ -24974,20 +25024,22 @@ function readXcodeAppTarget(xcodeproj, targetName) {
|
|
|
24974
25024
|
const file = import_node_path14.default.join(folder, relative3);
|
|
24975
25025
|
if (NEVER_MEMBER.test(relative3)) return;
|
|
24976
25026
|
if (file.endsWith(".swift")) {
|
|
24977
|
-
if (!relative3.split("/").some((segment) => BUNDLE_DIR.test(segment)))
|
|
25027
|
+
if (!relative3.split("/").some((segment) => BUNDLE_DIR.test(segment))) {
|
|
24978
25028
|
sources.add(file);
|
|
25029
|
+
allSources.add(file);
|
|
25030
|
+
}
|
|
24979
25031
|
} else if (/\.(h|m|mm|c|cpp|metal)$/.test(file)) {
|
|
24980
|
-
|
|
25032
|
+
if (!file.endsWith(".h")) allSources.add(file);
|
|
24981
25033
|
} else resources.add(file);
|
|
24982
25034
|
};
|
|
24983
25035
|
const owned = new Set(list(target.fileSystemSynchronizedGroups));
|
|
24984
|
-
for (const [groupId, group] of Object.entries(objects)) {
|
|
25036
|
+
for (const [groupId, group] of Object.entries(project.objects)) {
|
|
24985
25037
|
if (!isDict(group) || group.isa !== "PBXFileSystemSynchronizedRootGroup") continue;
|
|
24986
|
-
const folder = resolvePath(groupId);
|
|
25038
|
+
const folder = project.resolvePath(groupId);
|
|
24987
25039
|
if (!folder) continue;
|
|
24988
25040
|
const exceptions = /* @__PURE__ */ new Set();
|
|
24989
25041
|
for (const exceptionId of list(group.exceptions)) {
|
|
24990
|
-
const exception = object(exceptionId);
|
|
25042
|
+
const exception = project.object(exceptionId);
|
|
24991
25043
|
if (exception?.target !== targetId) continue;
|
|
24992
25044
|
for (const relative3 of list(exception.membershipExceptions))
|
|
24993
25045
|
exceptions.add(relative3);
|
|
@@ -25004,7 +25056,7 @@ function readXcodeAppTarget(xcodeproj, targetName) {
|
|
|
25004
25056
|
} else {
|
|
25005
25057
|
for (const relative3 of exceptions) {
|
|
25006
25058
|
const file = import_node_path14.default.join(folder, relative3);
|
|
25007
|
-
if (
|
|
25059
|
+
if (isDirectory(file)) {
|
|
25008
25060
|
for (const inner of walkFiles(file))
|
|
25009
25061
|
addSynchronized(
|
|
25010
25062
|
folder,
|
|
@@ -25014,11 +25066,176 @@ function readXcodeAppTarget(xcodeproj, targetName) {
|
|
|
25014
25066
|
}
|
|
25015
25067
|
}
|
|
25016
25068
|
}
|
|
25017
|
-
|
|
25018
|
-
|
|
25019
|
-
|
|
25020
|
-
|
|
25021
|
-
}
|
|
25069
|
+
return {
|
|
25070
|
+
sources: [...sources].sort(),
|
|
25071
|
+
resources: [...resources].sort(),
|
|
25072
|
+
allSources: [...allSources].sort()
|
|
25073
|
+
};
|
|
25074
|
+
}
|
|
25075
|
+
function commonAncestor(dirs) {
|
|
25076
|
+
let common = dirs[0];
|
|
25077
|
+
for (const dir of dirs) {
|
|
25078
|
+
while (common !== import_node_path14.default.dirname(common) && import_node_path14.default.relative(common, dir).startsWith(".."))
|
|
25079
|
+
common = import_node_path14.default.dirname(common);
|
|
25080
|
+
}
|
|
25081
|
+
return common;
|
|
25082
|
+
}
|
|
25083
|
+
function workspaceProjects(xcodeprojOrWorkspace) {
|
|
25084
|
+
const listed = xcodeprojOrWorkspace.endsWith(".xcworkspace") ? workspaceReferences(xcodeprojOrWorkspace) : [xcodeprojOrWorkspace];
|
|
25085
|
+
const projects2 = [];
|
|
25086
|
+
const projectAt = /* @__PURE__ */ new Map();
|
|
25087
|
+
const addProject = (xcodeproj) => {
|
|
25088
|
+
const key = import_node_path14.default.resolve(xcodeproj);
|
|
25089
|
+
if (projectAt.has(key) || key.split(import_node_path14.default.sep).includes("Pods")) return;
|
|
25090
|
+
if (!import_node_fs14.default.existsSync(import_node_path14.default.join(key, "project.pbxproj"))) return;
|
|
25091
|
+
const project = loadProject(key);
|
|
25092
|
+
projectAt.set(key, project);
|
|
25093
|
+
projects2.push(project);
|
|
25094
|
+
const nested = project.project.projectReferences;
|
|
25095
|
+
if (Array.isArray(nested)) {
|
|
25096
|
+
for (const entry of nested) {
|
|
25097
|
+
const ref = isDict(entry) ? str(entry.ProjectRef) : void 0;
|
|
25098
|
+
const resolved = ref ? project.resolvePath(ref) : null;
|
|
25099
|
+
if (resolved) addProject(resolved);
|
|
25100
|
+
}
|
|
25101
|
+
}
|
|
25102
|
+
};
|
|
25103
|
+
for (const reference of listed)
|
|
25104
|
+
if (reference.endsWith(".xcodeproj")) addProject(reference);
|
|
25105
|
+
if (projects2.length === 0) {
|
|
25106
|
+
throw new Error(`${import_node_path14.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
|
|
25107
|
+
}
|
|
25108
|
+
return { listed, projects: projects2, projectAt };
|
|
25109
|
+
}
|
|
25110
|
+
function listXcodeAppTargets(xcodeprojOrWorkspace) {
|
|
25111
|
+
return workspaceProjects(xcodeprojOrWorkspace).projects.flatMap(nativeTargets).filter((ref) => ref.target.productType === APPLICATION).map((ref) => str(ref.target.name) ?? ref.id);
|
|
25112
|
+
}
|
|
25113
|
+
function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
25114
|
+
const workspace = xcodeprojOrWorkspace.endsWith(".xcworkspace") ? xcodeprojOrWorkspace : null;
|
|
25115
|
+
const { listed, projects: projects2, projectAt } = workspaceProjects(xcodeprojOrWorkspace);
|
|
25116
|
+
const allTargets = projects2.flatMap(nativeTargets);
|
|
25117
|
+
const appTargets = allTargets.filter((ref) => ref.target.productType === APPLICATION);
|
|
25118
|
+
const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
|
|
25119
|
+
const container = import_node_path14.default.basename(xcodeprojOrWorkspace);
|
|
25120
|
+
const named = targetName ? appTargets.filter((ref) => ref.target.name === targetName) : appTargets;
|
|
25121
|
+
if (named.length !== 1) {
|
|
25122
|
+
throw new Error(
|
|
25123
|
+
targetName && named.length === 0 ? `${container} has no application target ${targetName}; it has ${appTargetNames.join(", ") || "none"}` : targetName ? `${container} has ${named.length} application targets named ${targetName}; open its .xcodeproj` : `${container} has ${appTargetNames.length} application targets (${appTargetNames.join(", ") || "none"}); pass --target`
|
|
25124
|
+
);
|
|
25125
|
+
}
|
|
25126
|
+
const app = named[0];
|
|
25127
|
+
const byProduct = /* @__PURE__ */ new Map();
|
|
25128
|
+
for (const ref of allTargets) {
|
|
25129
|
+
const product = ref.project.object(str(ref.target.productReference));
|
|
25130
|
+
const file = str(product?.path);
|
|
25131
|
+
if (file && !byProduct.has(import_node_path14.default.basename(file)))
|
|
25132
|
+
byProduct.set(import_node_path14.default.basename(file), ref);
|
|
25133
|
+
}
|
|
25134
|
+
const proxied = (project, proxyId) => {
|
|
25135
|
+
const proxy = project.object(proxyId);
|
|
25136
|
+
if (proxy?.isa !== "PBXContainerItemProxy") return void 0;
|
|
25137
|
+
const portal = str(proxy.containerPortal);
|
|
25138
|
+
const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path14.default.resolve(project.resolvePath(portal ?? "") ?? ""));
|
|
25139
|
+
const remote = str(proxy.remoteGlobalIDString);
|
|
25140
|
+
if (!owner || !remote) return void 0;
|
|
25141
|
+
return nativeTargets(owner).find(
|
|
25142
|
+
(ref) => ref.id === remote || str(ref.target.productReference) === remote
|
|
25143
|
+
);
|
|
25144
|
+
};
|
|
25145
|
+
const dependenciesOf = (ref) => {
|
|
25146
|
+
const { project, target } = ref;
|
|
25147
|
+
const found = [];
|
|
25148
|
+
for (const dependencyId of list(target.dependencies)) {
|
|
25149
|
+
const dependency = project.object(dependencyId);
|
|
25150
|
+
const direct = str(dependency?.target);
|
|
25151
|
+
const resolved = direct ? nativeTargets(project).find((candidate) => candidate.id === direct) : proxied(project, str(dependency?.targetProxy));
|
|
25152
|
+
if (resolved) found.push(resolved);
|
|
25153
|
+
}
|
|
25154
|
+
for (const phaseId of list(target.buildPhases)) {
|
|
25155
|
+
const phase = project.object(phaseId);
|
|
25156
|
+
if (phase?.isa !== "PBXFrameworksBuildPhase") continue;
|
|
25157
|
+
for (const buildFileId of list(phase.files)) {
|
|
25158
|
+
const file = project.object(str(project.object(buildFileId)?.fileRef));
|
|
25159
|
+
const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path14.default.basename(str(file.path) ?? "")) : void 0;
|
|
25160
|
+
if (resolved) found.push(resolved);
|
|
25161
|
+
}
|
|
25162
|
+
}
|
|
25163
|
+
return found.filter(
|
|
25164
|
+
(candidate) => MODULE_PRODUCTS.has(str(candidate.target.productType) ?? "")
|
|
25165
|
+
);
|
|
25166
|
+
};
|
|
25167
|
+
const order = [];
|
|
25168
|
+
const visited = /* @__PURE__ */ new Set();
|
|
25169
|
+
const visit = (ref) => {
|
|
25170
|
+
if (visited.has(ref)) return;
|
|
25171
|
+
visited.add(ref);
|
|
25172
|
+
for (const dependency of dependenciesOf(ref)) visit(dependency);
|
|
25173
|
+
order.push(ref);
|
|
25174
|
+
};
|
|
25175
|
+
visit(app);
|
|
25176
|
+
const moduleTarget = (ref) => {
|
|
25177
|
+
const name2 = str(ref.target.name) ?? ref.id;
|
|
25178
|
+
const { get: settings2, keys } = targetSettings(ref, {
|
|
25179
|
+
TARGET_NAME: name2,
|
|
25180
|
+
PROJECT_NAME: import_node_path14.default.basename(ref.project.xcodeproj, ".xcodeproj"),
|
|
25181
|
+
SRCROOT: ref.project.projectDir,
|
|
25182
|
+
SOURCE_ROOT: ref.project.projectDir,
|
|
25183
|
+
PROJECT_DIR: ref.project.projectDir,
|
|
25184
|
+
DEVELOPMENT_LANGUAGE: str(ref.project.project.developmentRegion) ?? "en"
|
|
25185
|
+
});
|
|
25186
|
+
const swiftVersion = Number.parseFloat(settings2("SWIFT_VERSION") || "5");
|
|
25187
|
+
return {
|
|
25188
|
+
settings: settings2,
|
|
25189
|
+
keys,
|
|
25190
|
+
module: {
|
|
25191
|
+
name: name2,
|
|
25192
|
+
moduleName: applyOperator(settings2("PRODUCT_MODULE_NAME"), "c99extidentifier"),
|
|
25193
|
+
...targetMembers(ref),
|
|
25194
|
+
languageMode: swiftVersion >= 6 ? 6 : 5,
|
|
25195
|
+
mainActorIsolation: settings2("SWIFT_DEFAULT_ACTOR_ISOLATION") === "MainActor"
|
|
25196
|
+
}
|
|
25197
|
+
};
|
|
25198
|
+
};
|
|
25199
|
+
const { settings, keys: settingKeys, module: module2 } = moduleTarget(app);
|
|
25200
|
+
const frameworks = order.slice(0, -1).map((ref) => moduleTarget(ref).module);
|
|
25201
|
+
const expandValue = (value) => {
|
|
25202
|
+
if (typeof value === "string") return expand(value, settings);
|
|
25203
|
+
if (Array.isArray(value)) return value.map(expandValue);
|
|
25204
|
+
if (typeof value === "object" && !(value instanceof Date) && !Buffer.isBuffer(value)) {
|
|
25205
|
+
return Object.fromEntries(
|
|
25206
|
+
Object.entries(value).map(([key, value2]) => [key, expandValue(value2)])
|
|
25207
|
+
);
|
|
25208
|
+
}
|
|
25209
|
+
return value;
|
|
25210
|
+
};
|
|
25211
|
+
const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path14.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
|
|
25212
|
+
const sourceInfo = infoPlistFile ? import_plist3.default.parse(import_node_fs14.default.readFileSync(infoPlistFile, "utf8")) : {};
|
|
25213
|
+
if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
|
|
25214
|
+
throw new Error(`${module2.name} Info.plist must contain a dictionary`);
|
|
25215
|
+
}
|
|
25216
|
+
const info = {};
|
|
25217
|
+
for (const [key, value] of Object.entries(sourceInfo)) info[key] = expandValue(value);
|
|
25218
|
+
for (const key of settingKeys) {
|
|
25219
|
+
if (!key.startsWith("INFOPLIST_KEY_") || key.endsWith("_Generation")) continue;
|
|
25220
|
+
const value = settings(key);
|
|
25221
|
+
info[key.slice("INFOPLIST_KEY_".length)] = value === "YES" ? true : value === "NO" ? false : value;
|
|
25222
|
+
}
|
|
25223
|
+
if (settings("INFOPLIST_KEY_UIApplicationSceneManifest_Generation") === "YES" && info.UIApplicationSceneManifest === void 0) {
|
|
25224
|
+
info.UIApplicationSceneManifest = {
|
|
25225
|
+
UIApplicationSupportsMultipleScenes: true,
|
|
25226
|
+
UISceneConfigurations: {}
|
|
25227
|
+
};
|
|
25228
|
+
}
|
|
25229
|
+
const localPackageDirs = [
|
|
25230
|
+
...listed.filter((reference) => import_node_fs14.default.existsSync(import_node_path14.default.join(reference, "Package.swift"))),
|
|
25231
|
+
...projects2.flatMap(
|
|
25232
|
+
(project) => Object.entries(project.objects).flatMap(([id, entry]) => {
|
|
25233
|
+
if (!isDict(entry)) return [];
|
|
25234
|
+
const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path14.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
|
|
25235
|
+
return candidate && import_node_fs14.default.existsSync(import_node_path14.default.join(candidate, "Package.swift")) ? [candidate] : [];
|
|
25236
|
+
})
|
|
25237
|
+
)
|
|
25238
|
+
];
|
|
25022
25239
|
const graphs = /* @__PURE__ */ new Map();
|
|
25023
25240
|
const graphOf = (dir) => {
|
|
25024
25241
|
const cached4 = graphs.get(dir);
|
|
@@ -25031,26 +25248,40 @@ function readXcodeAppTarget(xcodeproj, targetName) {
|
|
|
25031
25248
|
};
|
|
25032
25249
|
const localProducts = /* @__PURE__ */ new Map();
|
|
25033
25250
|
for (const dir of localPackageDirs) {
|
|
25034
|
-
for (const product of graphOf(dir).products.keys())
|
|
25251
|
+
for (const product of graphOf(dir).products.keys()) {
|
|
25252
|
+
if (!localProducts.has(product)) localProducts.set(product, dir);
|
|
25253
|
+
}
|
|
25035
25254
|
}
|
|
25036
25255
|
const localPackages = /* @__PURE__ */ new Set();
|
|
25037
25256
|
const remoteProducts = [];
|
|
25038
25257
|
const unresolvedProducts = [];
|
|
25039
|
-
for (const
|
|
25040
|
-
const
|
|
25041
|
-
|
|
25042
|
-
|
|
25043
|
-
|
|
25044
|
-
|
|
25045
|
-
|
|
25046
|
-
|
|
25047
|
-
|
|
25048
|
-
|
|
25049
|
-
|
|
25050
|
-
|
|
25051
|
-
|
|
25052
|
-
|
|
25053
|
-
|
|
25258
|
+
for (const { project, target } of order) {
|
|
25259
|
+
const productDependencies = [
|
|
25260
|
+
...list(target.packageProductDependencies),
|
|
25261
|
+
...list(target.dependencies).flatMap((id) => {
|
|
25262
|
+
const productRef = str(project.object(id)?.productRef);
|
|
25263
|
+
return productRef ? [productRef] : [];
|
|
25264
|
+
})
|
|
25265
|
+
];
|
|
25266
|
+
for (const dependencyId of productDependencies) {
|
|
25267
|
+
const dependency = project.object(dependencyId);
|
|
25268
|
+
const product = str(dependency?.productName)?.replace(/^plugin:/, "");
|
|
25269
|
+
if (!dependency || !product) continue;
|
|
25270
|
+
const reference = project.object(str(dependency.package));
|
|
25271
|
+
if (reference?.isa === "XCRemoteSwiftPackageReference") {
|
|
25272
|
+
if (!remoteProducts.some((entry) => entry.product === product))
|
|
25273
|
+
remoteProducts.push({
|
|
25274
|
+
product,
|
|
25275
|
+
repositoryURL: str(reference.repositoryURL) ?? ""
|
|
25276
|
+
});
|
|
25277
|
+
} else if (reference?.isa === "XCLocalSwiftPackageReference") {
|
|
25278
|
+
localPackages.add(
|
|
25279
|
+
import_node_path14.default.resolve(project.projectDir, str(reference.relativePath) ?? "")
|
|
25280
|
+
);
|
|
25281
|
+
} else if (localProducts.has(product)) {
|
|
25282
|
+
localPackages.add(localProducts.get(product));
|
|
25283
|
+
} else if (!unresolvedProducts.includes(product)) unresolvedProducts.push(product);
|
|
25284
|
+
}
|
|
25054
25285
|
}
|
|
25055
25286
|
const pending = [...localPackages];
|
|
25056
25287
|
while (pending.length > 0) {
|
|
@@ -25072,32 +25303,34 @@ function readXcodeAppTarget(xcodeproj, targetName) {
|
|
|
25072
25303
|
}
|
|
25073
25304
|
}
|
|
25074
25305
|
}
|
|
25075
|
-
const
|
|
25076
|
-
import_node_path14.default.join(
|
|
25077
|
-
|
|
25078
|
-
|
|
25079
|
-
|
|
25080
|
-
)
|
|
25081
|
-
const
|
|
25306
|
+
const resolvedFile = import_node_path14.default.join(
|
|
25307
|
+
workspace ?? import_node_path14.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
|
|
25308
|
+
"xcshareddata",
|
|
25309
|
+
"swiftpm",
|
|
25310
|
+
"Package.resolved"
|
|
25311
|
+
);
|
|
25312
|
+
const used = [app, ...order].map((ref) => ref.project);
|
|
25082
25313
|
return {
|
|
25083
|
-
|
|
25084
|
-
|
|
25085
|
-
|
|
25086
|
-
|
|
25087
|
-
|
|
25088
|
-
|
|
25314
|
+
...module2,
|
|
25315
|
+
rootDir: commonAncestor(
|
|
25316
|
+
[
|
|
25317
|
+
workspace ? import_node_path14.default.dirname(workspace) : app.project.projectDir,
|
|
25318
|
+
...used.map((project) => project.projectDir),
|
|
25319
|
+
...localPackages
|
|
25320
|
+
].map((dir) => import_node_fs14.default.realpathSync(dir))
|
|
25321
|
+
),
|
|
25322
|
+
pbxprojs: [...new Set(used.map((project) => project.pbxproj))].sort(),
|
|
25089
25323
|
infoPlist: import_plist3.default.build(info),
|
|
25090
25324
|
infoPlistFile,
|
|
25091
|
-
|
|
25092
|
-
|
|
25093
|
-
localPackages: [...localPackages].sort(),
|
|
25325
|
+
frameworks,
|
|
25326
|
+
localPackages: [...localPackages].map((dir) => import_node_fs14.default.realpathSync(dir)).sort(),
|
|
25094
25327
|
remoteProducts,
|
|
25095
|
-
packageResolved,
|
|
25328
|
+
packageResolved: import_node_fs14.default.existsSync(resolvedFile) ? resolvedFile : null,
|
|
25096
25329
|
unresolvedProducts,
|
|
25097
25330
|
appTargets: appTargetNames
|
|
25098
25331
|
};
|
|
25099
25332
|
}
|
|
25100
|
-
var import_node_fs14, import_node_path14, import_plist3, isDict, str, list, APPLICATION, NEVER_MEMBER, BUNDLE_DIR,
|
|
25333
|
+
var import_node_fs14, import_node_path14, import_plist3, isDict, str, list, APPLICATION, MODULE_PRODUCTS, NEVER_MEMBER, BUNDLE_DIR, CONDITIONS, isDirectory, loaded, nativeTargets;
|
|
25101
25334
|
var init_xcode_project = __esm({
|
|
25102
25335
|
"src/xcode-project.ts"() {
|
|
25103
25336
|
"use strict";
|
|
@@ -25109,9 +25342,25 @@ var init_xcode_project = __esm({
|
|
|
25109
25342
|
str = (value) => typeof value === "string" ? value : void 0;
|
|
25110
25343
|
list = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
25111
25344
|
APPLICATION = "com.apple.product-type.application";
|
|
25345
|
+
MODULE_PRODUCTS = /* @__PURE__ */ new Set([
|
|
25346
|
+
"com.apple.product-type.framework",
|
|
25347
|
+
"com.apple.product-type.framework.static",
|
|
25348
|
+
"com.apple.product-type.library.static",
|
|
25349
|
+
"com.apple.product-type.library.dynamic"
|
|
25350
|
+
]);
|
|
25112
25351
|
NEVER_MEMBER = /(?:^|\/)(?:Info\.plist|[^/]+\.entitlements|[^/]+\.xcconfig|\.DS_Store)$/;
|
|
25113
25352
|
BUNDLE_DIR = /\.(xcassets|bundle|lproj|xcdatamodeld|scnassets|spriteatlas|rcproject|storyboardc|icon)$/;
|
|
25114
|
-
|
|
25353
|
+
CONDITIONS = {
|
|
25354
|
+
sdk: "iphonesimulator",
|
|
25355
|
+
arch: "arm64",
|
|
25356
|
+
variant: "normal"
|
|
25357
|
+
};
|
|
25358
|
+
isDirectory = (dir) => import_node_fs14.default.existsSync(dir) && import_node_fs14.default.statSync(dir).isDirectory();
|
|
25359
|
+
loaded = /* @__PURE__ */ new Map();
|
|
25360
|
+
nativeTargets = (project) => list(project.project.targets).flatMap((id) => {
|
|
25361
|
+
const target = project.object(id);
|
|
25362
|
+
return target?.isa === "PBXNativeTarget" ? [{ project, id, target }] : [];
|
|
25363
|
+
});
|
|
25115
25364
|
}
|
|
25116
25365
|
});
|
|
25117
25366
|
|
|
@@ -25167,7 +25416,7 @@ function remotePackages(entry, app) {
|
|
|
25167
25416
|
entry.remote = {
|
|
25168
25417
|
key,
|
|
25169
25418
|
packages: resolveRemotePackages(
|
|
25170
|
-
|
|
25419
|
+
app.rootDir,
|
|
25171
25420
|
app.packageResolved,
|
|
25172
25421
|
app.remoteProducts,
|
|
25173
25422
|
entry.provided
|
|
@@ -25176,25 +25425,47 @@ function remotePackages(entry, app) {
|
|
|
25176
25425
|
}
|
|
25177
25426
|
return entry.remote.packages;
|
|
25178
25427
|
}
|
|
25179
|
-
function xcodeInputKey(
|
|
25180
|
-
|
|
25428
|
+
function xcodeInputKey(layout, file, relative3) {
|
|
25429
|
+
const owner = layout.targetDirs.get(file);
|
|
25430
|
+
if (owner) return import_node_path15.default.posix.join(owner, relative3);
|
|
25181
25431
|
return relative3.startsWith(CHECKOUTS_PREFIX) ? import_node_path15.default.posix.join(XCODE_PACKAGES_DIR, relative3.slice(CHECKOUTS_PREFIX.length)) : relative3;
|
|
25182
25432
|
}
|
|
25183
25433
|
function xcodeLayout(root) {
|
|
25184
25434
|
const registered = xcodeProjects.get(root);
|
|
25185
25435
|
if (!registered) return null;
|
|
25186
25436
|
const app = readXcodeAppTarget(registered.xcodeproj, registered.target);
|
|
25187
|
-
const files = /* @__PURE__ */ new Set([app.
|
|
25437
|
+
const files = /* @__PURE__ */ new Set([...app.pbxprojs, ...app.sources, ...app.resources]);
|
|
25188
25438
|
if (app.infoPlistFile) files.add(app.infoPlistFile);
|
|
25439
|
+
const targetDirs = new Map(app.sources.map((file) => [file, XCODE_APP_DIR]));
|
|
25189
25440
|
const targets = [];
|
|
25441
|
+
for (const framework of app.frameworks) {
|
|
25442
|
+
const dir = import_node_path15.default.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName);
|
|
25443
|
+
for (const file of framework.sources) {
|
|
25444
|
+
if (targetDirs.has(file)) continue;
|
|
25445
|
+
targetDirs.set(file, dir);
|
|
25446
|
+
files.add(file);
|
|
25447
|
+
}
|
|
25448
|
+
targets.push({
|
|
25449
|
+
name: framework.moduleName,
|
|
25450
|
+
path: dir,
|
|
25451
|
+
executable: false,
|
|
25452
|
+
resources: false,
|
|
25453
|
+
languageMode: framework.languageMode,
|
|
25454
|
+
mainActorIsolation: framework.mainActorIsolation
|
|
25455
|
+
});
|
|
25456
|
+
}
|
|
25190
25457
|
for (const dir of app.localPackages) {
|
|
25191
|
-
const
|
|
25192
|
-
files.add(
|
|
25458
|
+
const manifestFile = import_node_path15.default.join(dir, "Package.swift");
|
|
25459
|
+
files.add(manifestFile);
|
|
25460
|
+
const manifest = import_node_fs15.default.readFileSync(manifestFile, "utf8");
|
|
25193
25461
|
const prefix = import_node_path15.default.relative(root, dir).split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep);
|
|
25194
|
-
const
|
|
25195
|
-
|
|
25462
|
+
const declared = swiftManifestTargets(manifest).filter((target) => !target.executable);
|
|
25463
|
+
const all = declared.flatMap(
|
|
25464
|
+
(target) => sourceTreeFiles(import_node_path15.default.join(dir, target.path), root).map(
|
|
25465
|
+
(file) => import_node_path15.default.relative(dir, file).split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep)
|
|
25466
|
+
)
|
|
25196
25467
|
);
|
|
25197
|
-
for (const target of swiftManifestTargets(
|
|
25468
|
+
for (const target of swiftManifestTargets(manifest, all)) {
|
|
25198
25469
|
if (target.executable) continue;
|
|
25199
25470
|
targets.push({ ...target, path: import_node_path15.default.posix.join(prefix, target.path) });
|
|
25200
25471
|
for (const relative3 of all) {
|
|
@@ -25217,6 +25488,7 @@ function xcodeLayout(root) {
|
|
|
25217
25488
|
app,
|
|
25218
25489
|
targets,
|
|
25219
25490
|
unavailable: remote.unavailable,
|
|
25491
|
+
targetDirs,
|
|
25220
25492
|
files: [...files].sort()
|
|
25221
25493
|
};
|
|
25222
25494
|
}
|
|
@@ -25237,13 +25509,15 @@ function xcodeManifest(layout) {
|
|
|
25237
25509
|
function packageFiles(root) {
|
|
25238
25510
|
const canonicalRoot = import_node_fs15.default.realpathSync(root);
|
|
25239
25511
|
const xcode = xcodeLayout(canonicalRoot);
|
|
25240
|
-
|
|
25512
|
+
return xcode ? xcode.files : sourceTreeFiles(canonicalRoot, canonicalRoot);
|
|
25513
|
+
}
|
|
25514
|
+
function sourceTreeFiles(dir, canonicalRoot) {
|
|
25241
25515
|
const found = [];
|
|
25242
|
-
const walk2 = (
|
|
25243
|
-
for (const entry of import_node_fs15.default.readdirSync(
|
|
25516
|
+
const walk2 = (dir2) => {
|
|
25517
|
+
for (const entry of import_node_fs15.default.readdirSync(dir2, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
|
|
25244
25518
|
if (entry.name.startsWith(".") && entry.name !== NATIVE_DESCRIPTOR && entry.name !== NATIVE_GLUE || SKIP_SOURCE_DIRS.has(entry.name))
|
|
25245
25519
|
continue;
|
|
25246
|
-
const full = import_node_path15.default.join(
|
|
25520
|
+
const full = import_node_path15.default.join(dir2, entry.name);
|
|
25247
25521
|
if (entry.isSymbolicLink()) throw new Error(`swift input is a symlink: ${full}`);
|
|
25248
25522
|
const real = import_node_fs15.default.realpathSync(full);
|
|
25249
25523
|
const relative3 = import_node_path15.default.relative(canonicalRoot, real);
|
|
@@ -25259,7 +25533,7 @@ function packageFiles(root) {
|
|
|
25259
25533
|
}
|
|
25260
25534
|
}
|
|
25261
25535
|
};
|
|
25262
|
-
walk2(
|
|
25536
|
+
if (import_node_fs15.default.existsSync(dir)) walk2(import_node_fs15.default.realpathSync(dir));
|
|
25263
25537
|
return found;
|
|
25264
25538
|
}
|
|
25265
25539
|
function readPackageFile(root, file, maxBytes) {
|
|
@@ -25453,12 +25727,11 @@ function icuUrl(origin, artifact) {
|
|
|
25453
25727
|
}
|
|
25454
25728
|
function packageSources(packagePath) {
|
|
25455
25729
|
const xcode = xcodeLayout(packagePath);
|
|
25456
|
-
const appSources = new Set(xcode?.app.sources);
|
|
25457
25730
|
const files = {};
|
|
25458
25731
|
for (const file of sourceFiles(packagePath)) {
|
|
25459
25732
|
const relative3 = import_node_path15.default.relative(packagePath, file).split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep);
|
|
25460
25733
|
if (xcode && import_node_path15.default.basename(file) === "Package.swift") continue;
|
|
25461
|
-
files[xcode ? xcodeInputKey(
|
|
25734
|
+
files[xcode ? xcodeInputKey(xcode, file, relative3) : relative3] = readPackageFile(
|
|
25462
25735
|
packagePath,
|
|
25463
25736
|
file,
|
|
25464
25737
|
MAX_SWIFT_COMPILE_SOURCE_BYTES
|
|
@@ -25570,7 +25843,7 @@ function swiftApiGapReport(output) {
|
|
|
25570
25843
|
const diagnostic = /^(\S[^:]*\.swift):(\d+):(\d+): error: (.+)$/.exec(line);
|
|
25571
25844
|
if (!diagnostic || seen.has(line)) continue;
|
|
25572
25845
|
seen.add(line);
|
|
25573
|
-
const file = diagnostic[1].replace(new RegExp(
|
|
25846
|
+
const file = diagnostic[1].replace(new RegExp(`^(?:${XCODE_APP_DIR}|${XCODE_FRAMEWORKS_DIR}/[^/]+)/`), "").replace(new RegExp(`^${XCODE_PACKAGES_DIR}/`), "");
|
|
25574
25847
|
const message = diagnostic[4];
|
|
25575
25848
|
const rule = API_GAP_PATTERNS.find(([pattern]) => pattern.test(message));
|
|
25576
25849
|
const key = rule ? rule[1](rule[0].exec(message)) : message;
|
|
@@ -25774,7 +26047,7 @@ function serveSwiftPackageAsset(pathname, res) {
|
|
|
25774
26047
|
res.end("swift artifact is stale");
|
|
25775
26048
|
return true;
|
|
25776
26049
|
}
|
|
25777
|
-
var import_node_crypto5, import_node_fs15, import_node_os5, import_node_path15, ARTIFACT_PATH, RESOURCE_PATH, ICU_PATH, SKIP_SOURCE_DIRS, NATIVE_DESCRIPTOR, NATIVE_GLUE, projects, xcodeProjects, XCODE_APP_DIR, XCODE_PACKAGES_DIR, CHECKOUTS_PREFIX, HOSTED_LIMITS, LOCAL_LIMITS, inputLimits, RESOURCE_CONTENT_TYPES, API_GAP_PATTERNS;
|
|
26050
|
+
var import_node_crypto5, import_node_fs15, import_node_os5, import_node_path15, ARTIFACT_PATH, RESOURCE_PATH, ICU_PATH, SKIP_SOURCE_DIRS, NATIVE_DESCRIPTOR, NATIVE_GLUE, projects, xcodeProjects, XCODE_APP_DIR, XCODE_FRAMEWORKS_DIR, XCODE_PACKAGES_DIR, CHECKOUTS_PREFIX, HOSTED_LIMITS, LOCAL_LIMITS, inputLimits, RESOURCE_CONTENT_TYPES, API_GAP_PATTERNS;
|
|
25778
26051
|
var init_swift_host = __esm({
|
|
25779
26052
|
"src/swift-host.ts"() {
|
|
25780
26053
|
"use strict";
|
|
@@ -25807,6 +26080,7 @@ var init_swift_host = __esm({
|
|
|
25807
26080
|
projects = /* @__PURE__ */ new Map();
|
|
25808
26081
|
xcodeProjects = /* @__PURE__ */ new Map();
|
|
25809
26082
|
XCODE_APP_DIR = "__app__";
|
|
26083
|
+
XCODE_FRAMEWORKS_DIR = "__frameworks__";
|
|
25810
26084
|
XCODE_PACKAGES_DIR = "__packages__";
|
|
25811
26085
|
CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(import_node_path15.default.sep).join(import_node_path15.default.posix.sep)}/`;
|
|
25812
26086
|
HOSTED_LIMITS = {
|
|
@@ -26408,8 +26682,8 @@ function parseAgentEventLine(line) {
|
|
|
26408
26682
|
const trimmed = line.trim();
|
|
26409
26683
|
if (!trimmed) return null;
|
|
26410
26684
|
try {
|
|
26411
|
-
const
|
|
26412
|
-
return isAgentEvent(
|
|
26685
|
+
const parsed = JSON.parse(trimmed);
|
|
26686
|
+
return isAgentEvent(parsed) ? parsed : null;
|
|
26413
26687
|
} catch {
|
|
26414
26688
|
return null;
|
|
26415
26689
|
}
|
|
@@ -26479,13 +26753,13 @@ function loadStore() {
|
|
|
26479
26753
|
throw err;
|
|
26480
26754
|
}
|
|
26481
26755
|
try {
|
|
26482
|
-
const
|
|
26483
|
-
if (!
|
|
26756
|
+
const parsed = JSON.parse(raw2);
|
|
26757
|
+
if (!parsed || typeof parsed !== "object") throw new Error("not an object");
|
|
26484
26758
|
return {
|
|
26485
26759
|
version: 1,
|
|
26486
|
-
attachedProjects: Array.isArray(
|
|
26487
|
-
previewAttachments: Array.isArray(
|
|
26488
|
-
agentSessions: Array.isArray(
|
|
26760
|
+
attachedProjects: Array.isArray(parsed.attachedProjects) ? parsed.attachedProjects : [],
|
|
26761
|
+
previewAttachments: Array.isArray(parsed.previewAttachments) ? parsed.previewAttachments : [],
|
|
26762
|
+
agentSessions: Array.isArray(parsed.agentSessions) ? parsed.agentSessions : []
|
|
26489
26763
|
};
|
|
26490
26764
|
} catch (err) {
|
|
26491
26765
|
const quarantine = `${file}.corrupt-${Date.now()}`;
|
|
@@ -26825,8 +27099,8 @@ function resolveSootsimPackageDir() {
|
|
|
26825
27099
|
const pkg = import_node_path19.default.join(cur, "package.json");
|
|
26826
27100
|
try {
|
|
26827
27101
|
if (import_node_fs19.default.existsSync(pkg)) {
|
|
26828
|
-
const
|
|
26829
|
-
if (
|
|
27102
|
+
const parsed = JSON.parse(import_node_fs19.default.readFileSync(pkg, "utf8"));
|
|
27103
|
+
if (parsed.name === rnxPublicBrand.packageName) return cur;
|
|
26830
27104
|
}
|
|
26831
27105
|
} catch {
|
|
26832
27106
|
}
|
|
@@ -28074,9 +28348,9 @@ function handleAppApiRequest(req, res) {
|
|
|
28074
28348
|
let targetPath = "";
|
|
28075
28349
|
let targetOrigin = "";
|
|
28076
28350
|
if (reqUrl.startsWith("/__app-api?")) {
|
|
28077
|
-
const
|
|
28078
|
-
targetPath =
|
|
28079
|
-
targetOrigin =
|
|
28351
|
+
const parsed = new URL(reqUrl, "http://sootsim.local");
|
|
28352
|
+
targetPath = parsed.searchParams.get("path") || "";
|
|
28353
|
+
targetOrigin = parsed.searchParams.get("origin")?.trim() || "";
|
|
28080
28354
|
} else if (reqUrl.startsWith("/__app-api/")) {
|
|
28081
28355
|
targetPath = reqUrl.slice("/__app-api".length);
|
|
28082
28356
|
} else {
|
|
@@ -29300,10 +29574,10 @@ function decodeProxyHeaders(encoded) {
|
|
|
29300
29574
|
if (!encoded) return {};
|
|
29301
29575
|
const base64 = encoded.replace(/-/g, "+").replace(/_/g, "/");
|
|
29302
29576
|
const padded = base64 + "=".repeat((4 - base64.length % 4) % 4);
|
|
29303
|
-
const
|
|
29304
|
-
if (!
|
|
29577
|
+
const parsed = JSON.parse(Buffer.from(padded, "base64").toString("utf8"));
|
|
29578
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
|
|
29305
29579
|
const headers = {};
|
|
29306
|
-
for (const [key, value] of Object.entries(
|
|
29580
|
+
for (const [key, value] of Object.entries(parsed)) {
|
|
29307
29581
|
if (value == null) continue;
|
|
29308
29582
|
if (STRIP_UPSTREAM_HEADERS.has(key.toLowerCase())) continue;
|
|
29309
29583
|
headers[key] = Array.isArray(value) ? value.join(", ") : String(value);
|
|
@@ -30801,10 +31075,10 @@ function readStringArray(text, start, end) {
|
|
|
30801
31075
|
for (; ; ) {
|
|
30802
31076
|
cursor = skipTrivia(text, cursor, end);
|
|
30803
31077
|
if (text[cursor] === "]") return { values, end: cursor + 1 };
|
|
30804
|
-
const
|
|
30805
|
-
if (!
|
|
30806
|
-
values.push(
|
|
30807
|
-
cursor = skipTrivia(text,
|
|
31078
|
+
const parsed = readQuoted(text, cursor, end);
|
|
31079
|
+
if (!parsed) return null;
|
|
31080
|
+
values.push(parsed.value);
|
|
31081
|
+
cursor = skipTrivia(text, parsed.end, end);
|
|
30808
31082
|
if (text[cursor] === "]") return { values, end: cursor + 1 };
|
|
30809
31083
|
if (text[cursor] !== ",") return null;
|
|
30810
31084
|
cursor++;
|
|
@@ -30957,10 +31231,10 @@ function scanAssetDescriptorSites(bundle) {
|
|
|
30957
31231
|
continue;
|
|
30958
31232
|
}
|
|
30959
31233
|
if (character === '"' || character === "'") {
|
|
30960
|
-
const
|
|
30961
|
-
const after =
|
|
31234
|
+
const parsed = readQuoted(bundle, cursor, bundle.length);
|
|
31235
|
+
const after = parsed?.end ?? quotedEnd(bundle, cursor, bundle.length);
|
|
30962
31236
|
const colon = skipTrivia(bundle, after, bundle.length);
|
|
30963
|
-
if (
|
|
31237
|
+
if (parsed?.value === "__packager_asset" && bundle[colon] === ":" && objects.length > 0) {
|
|
30964
31238
|
objects[objects.length - 1].hasAssetKey = true;
|
|
30965
31239
|
}
|
|
30966
31240
|
cursor = after;
|
|
@@ -31263,18 +31537,18 @@ async function embedMetroAssetFiles(bundle, read) {
|
|
|
31263
31537
|
}
|
|
31264
31538
|
const fileUris = [];
|
|
31265
31539
|
const fileHashes = [];
|
|
31266
|
-
const
|
|
31540
|
+
const loaded2 = /* @__PURE__ */ new Map();
|
|
31267
31541
|
for (let index = 0; index < site.descriptor.scales.length; index++) {
|
|
31268
31542
|
const scale = site.descriptor.scales[index];
|
|
31269
31543
|
const file = await read({ descriptor: site.descriptor, index, scale });
|
|
31270
|
-
if (file)
|
|
31544
|
+
if (file) loaded2.set(scale, file);
|
|
31271
31545
|
}
|
|
31272
|
-
if (
|
|
31546
|
+
if (loaded2.size === 0) {
|
|
31273
31547
|
throw new Error(
|
|
31274
31548
|
`peach ios --remote found no scale of ${site.descriptor.name}.${site.descriptor.type} in the asset dest graph for ${site.descriptor.httpServerLocation}`
|
|
31275
31549
|
);
|
|
31276
31550
|
}
|
|
31277
|
-
const scales = [...
|
|
31551
|
+
const scales = [...loaded2.keys()].sort((left, right) => left - right);
|
|
31278
31552
|
if (scales.length !== site.descriptor.scales.length && !site.scalesSpan) {
|
|
31279
31553
|
throw new Error(
|
|
31280
31554
|
`peach ios --remote could not narrow the scales of ${site.descriptor.name}.${site.descriptor.type} because its descriptor declares none`
|
|
@@ -31282,7 +31556,7 @@ async function embedMetroAssetFiles(bundle, read) {
|
|
|
31282
31556
|
}
|
|
31283
31557
|
let descriptorBytes = 0;
|
|
31284
31558
|
for (const scale of scales) {
|
|
31285
|
-
const file =
|
|
31559
|
+
const file = loaded2.get(scale);
|
|
31286
31560
|
if (!file) continue;
|
|
31287
31561
|
fileUris.push(metroAssetDataUri(site.descriptor.type, file));
|
|
31288
31562
|
fileHashes.push(await sha256HexBytes(file));
|
|
@@ -31682,13 +31956,13 @@ async function parseRegistryBytes(args) {
|
|
|
31682
31956
|
if (integrity !== args.expectedIntegrity) {
|
|
31683
31957
|
throw new Error("RNX Metro fingerprint registry integrity mismatch");
|
|
31684
31958
|
}
|
|
31685
|
-
let
|
|
31959
|
+
let parsed;
|
|
31686
31960
|
try {
|
|
31687
|
-
|
|
31961
|
+
parsed = JSON.parse(new TextDecoder().decode(args.bytes));
|
|
31688
31962
|
} catch {
|
|
31689
31963
|
throw new Error("RNX Metro fingerprint registry is not valid JSON");
|
|
31690
31964
|
}
|
|
31691
|
-
const registry = (0, import_metro_fingerprint_registry.parseRNXMetroFingerprintRegistry)(
|
|
31965
|
+
const registry = (0, import_metro_fingerprint_registry.parseRNXMetroFingerprintRegistry)(parsed);
|
|
31692
31966
|
if (!registry) throw new Error("RNX Metro fingerprint registry is malformed");
|
|
31693
31967
|
if (args.expectedRevision && registry.revision !== args.expectedRevision) {
|
|
31694
31968
|
throw new Error("RNX Metro fingerprint registry revision does not match its pointer");
|
|
@@ -31743,13 +32017,13 @@ async function readPointer(response) {
|
|
|
31743
32017
|
`RNX Metro fingerprint pointer exceeds ${import_metro_fingerprint_registry.RNX_METRO_FINGERPRINT_MAX_POINTER_BYTES} bytes`
|
|
31744
32018
|
);
|
|
31745
32019
|
}
|
|
31746
|
-
let
|
|
32020
|
+
let parsed;
|
|
31747
32021
|
try {
|
|
31748
|
-
|
|
32022
|
+
parsed = JSON.parse(new TextDecoder().decode(bytes));
|
|
31749
32023
|
} catch {
|
|
31750
32024
|
throw new Error("RNX Metro fingerprint pointer is not valid JSON");
|
|
31751
32025
|
}
|
|
31752
|
-
const pointer = (0, import_metro_fingerprint_registry.parseRNXMetroFingerprintPointer)(
|
|
32026
|
+
const pointer = (0, import_metro_fingerprint_registry.parseRNXMetroFingerprintPointer)(parsed);
|
|
31753
32027
|
if (!pointer) throw new Error("RNX Metro fingerprint pointer is malformed");
|
|
31754
32028
|
return pointer;
|
|
31755
32029
|
}
|
|
@@ -32178,16 +32452,16 @@ function canonicalFactoryForDigest(factory, tokens) {
|
|
|
32178
32452
|
return cursor === 0 ? factory : canonical + factory.slice(cursor);
|
|
32179
32453
|
}
|
|
32180
32454
|
function readDependencyIds(source) {
|
|
32181
|
-
let
|
|
32455
|
+
let parsed;
|
|
32182
32456
|
try {
|
|
32183
|
-
|
|
32457
|
+
parsed = JSON.parse(source);
|
|
32184
32458
|
} catch {
|
|
32185
32459
|
throw new Error("Metro fingerprint analysis found a noncanonical dependency array");
|
|
32186
32460
|
}
|
|
32187
|
-
if (!Array.isArray(
|
|
32461
|
+
if (!Array.isArray(parsed) || !parsed.every((dependency) => dependency === null || Number.isSafeInteger(dependency))) {
|
|
32188
32462
|
throw new Error("Metro fingerprint analysis found a noncanonical dependency array");
|
|
32189
32463
|
}
|
|
32190
|
-
return
|
|
32464
|
+
return parsed;
|
|
32191
32465
|
}
|
|
32192
32466
|
function fnv1a64(value) {
|
|
32193
32467
|
let hash = 0xcbf29ce484222325n;
|
|
@@ -32709,19 +32983,19 @@ var init_cloud_contract = __esm({
|
|
|
32709
32983
|
|
|
32710
32984
|
// cli/cloud-session.ts
|
|
32711
32985
|
function normalizeCloudOrigin(source) {
|
|
32712
|
-
let
|
|
32986
|
+
let parsed;
|
|
32713
32987
|
try {
|
|
32714
|
-
|
|
32988
|
+
parsed = new URL(source);
|
|
32715
32989
|
} catch {
|
|
32716
32990
|
throw new Error(`invalid remote simulator origin: ${source}`);
|
|
32717
32991
|
}
|
|
32718
|
-
if (
|
|
32992
|
+
if (parsed.protocol !== "https:" && parsed.protocol !== "http:" || parsed.username || parsed.password || parsed.pathname !== "/" || parsed.search || parsed.hash) {
|
|
32719
32993
|
throw new Error(`remote simulator origin must be an HTTP(S) origin: ${source}`);
|
|
32720
32994
|
}
|
|
32721
|
-
if (
|
|
32995
|
+
if (parsed.protocol === "http:" && !isLoopbackHost(parsed.hostname)) {
|
|
32722
32996
|
throw new Error(`remote simulator origin requires HTTPS outside loopback: ${source}`);
|
|
32723
32997
|
}
|
|
32724
|
-
return
|
|
32998
|
+
return parsed.origin;
|
|
32725
32999
|
}
|
|
32726
33000
|
function createCloudSession(input) {
|
|
32727
33001
|
const boxId = input.boxId?.trim() ?? "";
|
|
@@ -32768,34 +33042,34 @@ function parseCloudSession(encoded) {
|
|
|
32768
33042
|
if (!value || value.length > MAX_ENCODED_SESSION_BYTES || !/^[A-Za-z0-9_-]+$/.test(value)) {
|
|
32769
33043
|
throw new Error(`${PEACH_CLOUD_SESSION_ENV} is invalid`);
|
|
32770
33044
|
}
|
|
32771
|
-
let
|
|
33045
|
+
let parsed;
|
|
32772
33046
|
try {
|
|
32773
33047
|
const bytes = Buffer.from(value, "base64url");
|
|
32774
33048
|
if (bytes.toString("base64url") !== value) {
|
|
32775
33049
|
throw new Error("non-canonical cloud session");
|
|
32776
33050
|
}
|
|
32777
|
-
|
|
33051
|
+
parsed = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
|
|
32778
33052
|
} catch {
|
|
32779
33053
|
throw new Error(`${PEACH_CLOUD_SESSION_ENV} is invalid`);
|
|
32780
33054
|
}
|
|
32781
|
-
if (!isRecord2(
|
|
33055
|
+
if (!isRecord2(parsed) || parsed.version !== CLOUD_SESSION_VERSION) {
|
|
32782
33056
|
throw new Error(`${PEACH_CLOUD_SESSION_ENV} is invalid`);
|
|
32783
33057
|
}
|
|
32784
|
-
const apiOrigin =
|
|
33058
|
+
const apiOrigin = parsed.apiOrigin;
|
|
32785
33059
|
if (typeof apiOrigin !== "string") {
|
|
32786
33060
|
throw new Error(`${PEACH_CLOUD_SESSION_ENV} is invalid`);
|
|
32787
33061
|
}
|
|
32788
|
-
const platform =
|
|
32789
|
-
const device = typeof
|
|
32790
|
-
const artifact = isRecord2(
|
|
32791
|
-
sha256:
|
|
32792
|
-
bytes: typeof
|
|
33062
|
+
const platform = parsed.platform === "ios" || parsed.platform === "android" ? parsed.platform : void 0;
|
|
33063
|
+
const device = typeof parsed.device === "string" ? parsed.device : void 0;
|
|
33064
|
+
const artifact = isRecord2(parsed.artifact) && typeof parsed.artifact.sha256 === "string" ? {
|
|
33065
|
+
sha256: parsed.artifact.sha256,
|
|
33066
|
+
bytes: typeof parsed.artifact.bytes === "number" ? parsed.artifact.bytes : void 0
|
|
32793
33067
|
} : void 0;
|
|
32794
|
-
const streamUrl = typeof
|
|
32795
|
-
const boxId = typeof
|
|
32796
|
-
const boxToken = typeof
|
|
33068
|
+
const streamUrl = typeof parsed.streamUrl === "string" ? parsed.streamUrl : void 0;
|
|
33069
|
+
const boxId = typeof parsed.boxId === "string" ? parsed.boxId : void 0;
|
|
33070
|
+
const boxToken = typeof parsed.boxToken === "string" ? parsed.boxToken : void 0;
|
|
32797
33071
|
try {
|
|
32798
|
-
if (
|
|
33072
|
+
if (parsed.service === "box") {
|
|
32799
33073
|
if (!boxId || !boxToken) throw new Error("unreadable cloud box session");
|
|
32800
33074
|
return createCloudBoxSession({
|
|
32801
33075
|
boxId,
|
|
@@ -32806,10 +33080,10 @@ function parseCloudSession(encoded) {
|
|
|
32806
33080
|
artifact
|
|
32807
33081
|
});
|
|
32808
33082
|
}
|
|
32809
|
-
const simId =
|
|
32810
|
-
const claimId =
|
|
32811
|
-
const token =
|
|
32812
|
-
if (
|
|
33083
|
+
const simId = parsed.simId;
|
|
33084
|
+
const claimId = parsed.claimId;
|
|
33085
|
+
const token = parsed.token;
|
|
33086
|
+
if (parsed.service !== "sim" || typeof simId !== "string" || typeof claimId !== "string" || typeof token !== "string") {
|
|
32813
33087
|
throw new Error("unreadable cloud session");
|
|
32814
33088
|
}
|
|
32815
33089
|
return createCloudSession({
|
|
@@ -32906,8 +33180,8 @@ function readProjectJson(path33) {
|
|
|
32906
33180
|
}
|
|
32907
33181
|
}
|
|
32908
33182
|
function readProjectManifest(dir) {
|
|
32909
|
-
const
|
|
32910
|
-
if (!
|
|
33183
|
+
const parsed = readProjectJson((0, import_node_path24.join)(dir, "package.json"));
|
|
33184
|
+
if (!parsed || typeof parsed !== "object") return null;
|
|
32911
33185
|
const record = (value) => {
|
|
32912
33186
|
if (!value || typeof value !== "object") return {};
|
|
32913
33187
|
return Object.fromEntries(
|
|
@@ -32916,11 +33190,11 @@ function readProjectManifest(dir) {
|
|
|
32916
33190
|
)
|
|
32917
33191
|
);
|
|
32918
33192
|
};
|
|
32919
|
-
const name2 = metadataValue(
|
|
33193
|
+
const name2 = metadataValue(parsed, "name");
|
|
32920
33194
|
return {
|
|
32921
33195
|
...typeof name2 === "string" ? { name: name2 } : {},
|
|
32922
|
-
dependencies: record(metadataValue(
|
|
32923
|
-
devDependencies: record(metadataValue(
|
|
33196
|
+
dependencies: record(metadataValue(parsed, "dependencies")),
|
|
33197
|
+
devDependencies: record(metadataValue(parsed, "devDependencies"))
|
|
32924
33198
|
};
|
|
32925
33199
|
}
|
|
32926
33200
|
var import_node_fs24, import_node_path24, import_json5, import_yaml, CONFIG_EXTENSIONS;
|
|
@@ -32937,24 +33211,24 @@ var init_detect = __esm({
|
|
|
32937
33211
|
|
|
32938
33212
|
// cli/cloud-client.ts
|
|
32939
33213
|
function failureSentence(text) {
|
|
32940
|
-
let
|
|
33214
|
+
let parsed;
|
|
32941
33215
|
try {
|
|
32942
|
-
|
|
33216
|
+
parsed = JSON.parse(text);
|
|
32943
33217
|
} catch {
|
|
32944
33218
|
return null;
|
|
32945
33219
|
}
|
|
32946
|
-
if (!isRecord2(
|
|
32947
|
-
if (isRecord2(
|
|
32948
|
-
const code = typeof
|
|
32949
|
-
return `${
|
|
33220
|
+
if (!isRecord2(parsed)) return null;
|
|
33221
|
+
if (isRecord2(parsed.error) && typeof parsed.error.message === "string") {
|
|
33222
|
+
const code = typeof parsed.error.code === "string" && parsed.error.code ? ` [${parsed.error.code}]` : "";
|
|
33223
|
+
return `${parsed.error.message}${code}`;
|
|
32950
33224
|
}
|
|
32951
|
-
if (typeof
|
|
32952
|
-
if (typeof
|
|
33225
|
+
if (typeof parsed.message === "string") return parsed.message;
|
|
33226
|
+
if (typeof parsed.error === "string") return parsed.error;
|
|
32953
33227
|
return null;
|
|
32954
33228
|
}
|
|
32955
33229
|
function responseError(status, text) {
|
|
32956
|
-
const
|
|
32957
|
-
const sentence =
|
|
33230
|
+
const parsed = text ? failureSentence(text) : null;
|
|
33231
|
+
const sentence = parsed && ACCOUNT_CHOICE_REFUSALS.has(parsed) ? CHOOSE_ACCOUNT_HINT : parsed;
|
|
32958
33232
|
return new Error(
|
|
32959
33233
|
`remote simulator request failed (${status})${sentence ? `: ${sentence}` : text.trim() ? `: ${text.trim()}` : ""}`
|
|
32960
33234
|
);
|
|
@@ -33458,13 +33732,13 @@ async function createCloudBox(options) {
|
|
|
33458
33732
|
}
|
|
33459
33733
|
const responseText = await response.text();
|
|
33460
33734
|
if (!response.ok) throw responseError(response.status, responseText);
|
|
33461
|
-
let
|
|
33735
|
+
let parsed;
|
|
33462
33736
|
try {
|
|
33463
|
-
|
|
33737
|
+
parsed = JSON.parse(responseText);
|
|
33464
33738
|
} catch {
|
|
33465
33739
|
throw new Error("remote simulator create returned unreadable JSON");
|
|
33466
33740
|
}
|
|
33467
|
-
const created = readCreateResponse(
|
|
33741
|
+
const created = readCreateResponse(parsed, artifact.bytes.length, artifact.sha256);
|
|
33468
33742
|
const session = createCloudSession({
|
|
33469
33743
|
boxId: created.receipt.boxId,
|
|
33470
33744
|
boxToken: created.boxToken,
|
|
@@ -33487,20 +33761,20 @@ async function createCloudBox(options) {
|
|
|
33487
33761
|
warnings: artifact.warnings
|
|
33488
33762
|
};
|
|
33489
33763
|
}
|
|
33490
|
-
function resolveCloudSessionForParsed(
|
|
33764
|
+
function resolveCloudSessionForParsed(parsed) {
|
|
33491
33765
|
const session = readCloudSession();
|
|
33492
33766
|
if (!session) return null;
|
|
33493
33767
|
if (session.service === "box") {
|
|
33494
|
-
if (
|
|
33768
|
+
if (parsed.simIdSource === "flag" && parsed.simId !== session.boxId) {
|
|
33495
33769
|
throw new Error(
|
|
33496
|
-
`this shell is connected to box ${session.boxId}; ${
|
|
33770
|
+
`this shell is connected to box ${session.boxId}; ${parsed.simId ? `--sim ${parsed.simId}` : "the requested simulator"} is not available in this shell`
|
|
33497
33771
|
);
|
|
33498
33772
|
}
|
|
33499
33773
|
return session;
|
|
33500
33774
|
}
|
|
33501
|
-
if (
|
|
33775
|
+
if (parsed.simIdSource === "flag" && parsed.simId !== session.simId) {
|
|
33502
33776
|
throw new Error(
|
|
33503
|
-
`this shell is connected to remote simulator ${session.simId}; ${
|
|
33777
|
+
`this shell is connected to remote simulator ${session.simId}; ${parsed.simId ? `--sim ${parsed.simId}` : "the requested simulator"} is not available in this shell`
|
|
33504
33778
|
);
|
|
33505
33779
|
}
|
|
33506
33780
|
return session;
|
|
@@ -33522,8 +33796,8 @@ function cloudCommand(command) {
|
|
|
33522
33796
|
}
|
|
33523
33797
|
return clean;
|
|
33524
33798
|
}
|
|
33525
|
-
function createCloudBridgeForParsed(
|
|
33526
|
-
const session = resolveCloudSessionForParsed(
|
|
33799
|
+
function createCloudBridgeForParsed(parsed) {
|
|
33800
|
+
const session = resolveCloudSessionForParsed(parsed);
|
|
33527
33801
|
if (!session) return null;
|
|
33528
33802
|
return session.service === "box" ? new CloudBoxBridge(session) : new CloudBridge(session);
|
|
33529
33803
|
}
|
|
@@ -33598,20 +33872,20 @@ var init_cloud_client = __esm({
|
|
|
33598
33872
|
}
|
|
33599
33873
|
const text = await response.text();
|
|
33600
33874
|
if (!response.ok) throw responseError(response.status, text);
|
|
33601
|
-
let
|
|
33875
|
+
let parsed;
|
|
33602
33876
|
try {
|
|
33603
|
-
|
|
33877
|
+
parsed = JSON.parse(text);
|
|
33604
33878
|
} catch {
|
|
33605
33879
|
throw new Error("remote simulator command returned unreadable JSON");
|
|
33606
33880
|
}
|
|
33607
|
-
if (!isRecord2(
|
|
33881
|
+
if (!isRecord2(parsed) || parsed.id !== body.id) {
|
|
33608
33882
|
throw new Error("remote simulator command returned an invalid command receipt");
|
|
33609
33883
|
}
|
|
33610
|
-
if (typeof
|
|
33611
|
-
if (!Object.hasOwn(
|
|
33884
|
+
if (typeof parsed.error === "string" && parsed.error) throw new Error(parsed.error);
|
|
33885
|
+
if (!Object.hasOwn(parsed, "result")) {
|
|
33612
33886
|
throw new Error("remote simulator command receipt has no result");
|
|
33613
33887
|
}
|
|
33614
|
-
return
|
|
33888
|
+
return parsed.result;
|
|
33615
33889
|
}
|
|
33616
33890
|
listSims() {
|
|
33617
33891
|
return Promise.reject(
|
|
@@ -33669,20 +33943,20 @@ var init_cloud_client = __esm({
|
|
|
33669
33943
|
}
|
|
33670
33944
|
const text = await response.text();
|
|
33671
33945
|
if (!response.ok) throw responseError(response.status, text);
|
|
33672
|
-
let
|
|
33946
|
+
let parsed;
|
|
33673
33947
|
try {
|
|
33674
|
-
|
|
33948
|
+
parsed = JSON.parse(text);
|
|
33675
33949
|
} catch {
|
|
33676
33950
|
throw new Error("box command returned unreadable JSON");
|
|
33677
33951
|
}
|
|
33678
|
-
if (!isRecord2(
|
|
33952
|
+
if (!isRecord2(parsed) || parsed.id !== id) {
|
|
33679
33953
|
throw new Error("box command returned an invalid command receipt");
|
|
33680
33954
|
}
|
|
33681
|
-
if (typeof
|
|
33682
|
-
if (!Object.hasOwn(
|
|
33955
|
+
if (typeof parsed.error === "string" && parsed.error) throw new Error(parsed.error);
|
|
33956
|
+
if (!Object.hasOwn(parsed, "result")) {
|
|
33683
33957
|
throw new Error("box command receipt has no result");
|
|
33684
33958
|
}
|
|
33685
|
-
return
|
|
33959
|
+
return parsed.result;
|
|
33686
33960
|
}
|
|
33687
33961
|
listSims() {
|
|
33688
33962
|
return Promise.reject(new Error("a box does not expose a local simulator list"));
|
|
@@ -34907,12 +35181,12 @@ var init_bridge_host = __esm({
|
|
|
34907
35181
|
}
|
|
34908
35182
|
chunks.push(buffer);
|
|
34909
35183
|
}
|
|
34910
|
-
const
|
|
34911
|
-
if (!
|
|
35184
|
+
const parsed = JSON.parse(Buffer.concat(chunks).toString("utf8"));
|
|
35185
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
34912
35186
|
throw new Error("shared config patch must be an object");
|
|
34913
35187
|
}
|
|
34914
35188
|
const patch = Object.fromEntries(
|
|
34915
|
-
Object.entries(
|
|
35189
|
+
Object.entries(parsed)
|
|
34916
35190
|
);
|
|
34917
35191
|
const next = this.writeAndBroadcastSharedConfig(patch);
|
|
34918
35192
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
@@ -34951,11 +35225,11 @@ var init_bridge_host = __esm({
|
|
|
34951
35225
|
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
34952
35226
|
}
|
|
34953
35227
|
const text = Buffer.concat(chunks).toString("utf8").trim();
|
|
34954
|
-
const
|
|
34955
|
-
if (!
|
|
35228
|
+
const parsed = text ? JSON.parse(text) : {};
|
|
35229
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
34956
35230
|
throw new Error("send to box needs a json object body");
|
|
34957
35231
|
}
|
|
34958
|
-
const body = { ...
|
|
35232
|
+
const body = { ...parsed };
|
|
34959
35233
|
const { CHOOSE_ACCOUNT_HINT: CHOOSE_ACCOUNT_HINT2, resolveCliAuth: resolveCliAuth2, authHeaderValue: authHeaderValue2 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
34960
35234
|
const auth = resolveCliAuth2();
|
|
34961
35235
|
if (!auth) {
|
|
@@ -35921,12 +36195,12 @@ function readProcessTable() {
|
|
|
35921
36195
|
stdio: ["ignore", "pipe", "ignore"]
|
|
35922
36196
|
});
|
|
35923
36197
|
for (const line of out.split("\n")) {
|
|
35924
|
-
const
|
|
35925
|
-
if (!
|
|
35926
|
-
rows.set(Number(
|
|
35927
|
-
ppid: Number(
|
|
35928
|
-
pgid: Number(
|
|
35929
|
-
comm: (
|
|
36198
|
+
const parsed = line.trim().match(/^(\d+)\s+(\d+)\s+(\d+)\s+(.*)$/);
|
|
36199
|
+
if (!parsed) continue;
|
|
36200
|
+
rows.set(Number(parsed[1]), {
|
|
36201
|
+
ppid: Number(parsed[2]),
|
|
36202
|
+
pgid: Number(parsed[3]),
|
|
36203
|
+
comm: (parsed[4].split("/").at(-1) ?? "").slice(0, PBI_COMM_LEN)
|
|
35930
36204
|
});
|
|
35931
36205
|
}
|
|
35932
36206
|
} catch {
|
|
@@ -36133,15 +36407,15 @@ function readCurrentTarget() {
|
|
|
36133
36407
|
(0, import_fs4.rmSync)(legacyCloudCredentialDirectory(filepath), { recursive: true, force: true });
|
|
36134
36408
|
if (!(0, import_fs4.existsSync)(filepath)) return null;
|
|
36135
36409
|
try {
|
|
36136
|
-
const
|
|
36137
|
-
if (
|
|
36410
|
+
const parsed = JSON.parse((0, import_fs4.readFileSync)(filepath, "utf8"));
|
|
36411
|
+
if (parsed === null || typeof parsed !== "object") {
|
|
36138
36412
|
(0, import_fs4.rmSync)(filepath, { force: true });
|
|
36139
36413
|
return null;
|
|
36140
36414
|
}
|
|
36141
|
-
const version = Reflect.get(
|
|
36142
|
-
const plane = Reflect.get(
|
|
36143
|
-
const simId = Reflect.get(
|
|
36144
|
-
const updatedAt = Reflect.get(
|
|
36415
|
+
const version = Reflect.get(parsed, "version");
|
|
36416
|
+
const plane = Reflect.get(parsed, "plane");
|
|
36417
|
+
const simId = Reflect.get(parsed, "simId");
|
|
36418
|
+
const updatedAt = Reflect.get(parsed, "updatedAt");
|
|
36145
36419
|
if (version !== 1 && version !== CURRENT_SIM_VERSION || version === CURRENT_SIM_VERSION && plane !== "local" || typeof simId !== "string" || !simId.trim() || typeof updatedAt !== "string") {
|
|
36146
36420
|
(0, import_fs4.rmSync)(filepath, { force: true });
|
|
36147
36421
|
return null;
|
|
@@ -36704,13 +36978,13 @@ function createBridge(wsPort, opts = {}) {
|
|
|
36704
36978
|
}
|
|
36705
36979
|
};
|
|
36706
36980
|
}
|
|
36707
|
-
function createBridgeFromParsed(
|
|
36708
|
-
const cloudBridge = createCloudBridgeForParsed(
|
|
36981
|
+
function createBridgeFromParsed(parsed) {
|
|
36982
|
+
const cloudBridge = createCloudBridgeForParsed(parsed);
|
|
36709
36983
|
if (cloudBridge) return cloudBridge;
|
|
36710
|
-
return createBridge(
|
|
36711
|
-
commandTimeoutMs:
|
|
36712
|
-
simId:
|
|
36713
|
-
simIdSource:
|
|
36984
|
+
return createBridge(parsed.wsPort, {
|
|
36985
|
+
commandTimeoutMs: parsed.commandTimeoutMs,
|
|
36986
|
+
simId: parsed.simId,
|
|
36987
|
+
simIdSource: parsed.simIdSource
|
|
36714
36988
|
});
|
|
36715
36989
|
}
|
|
36716
36990
|
function describeVisibleSimCandidate(sims, currentId) {
|
|
@@ -36883,8 +37157,8 @@ function buildBaseUrl(protocol, host2, port) {
|
|
|
36883
37157
|
function shouldProxyLoopbackProbe(targetUrl) {
|
|
36884
37158
|
if (typeof window === "undefined") return false;
|
|
36885
37159
|
try {
|
|
36886
|
-
const
|
|
36887
|
-
return isLoopbackHost(
|
|
37160
|
+
const parsed = new URL(targetUrl);
|
|
37161
|
+
return isLoopbackHost(parsed.hostname) && isLoopbackHost(window.location.hostname) && parsed.origin !== window.location.origin;
|
|
36888
37162
|
} catch {
|
|
36889
37163
|
return false;
|
|
36890
37164
|
}
|
|
@@ -37036,23 +37310,23 @@ async function resolveConnectionInput(input) {
|
|
|
37036
37310
|
throw buildUnresolvedTargetError(`localhost:${port2}`);
|
|
37037
37311
|
}
|
|
37038
37312
|
const bundleUrl = trimmed.startsWith("http") ? trimmed : `http://${trimmed}`;
|
|
37039
|
-
let
|
|
37313
|
+
let parsed;
|
|
37040
37314
|
try {
|
|
37041
|
-
|
|
37315
|
+
parsed = new URL(bundleUrl);
|
|
37042
37316
|
} catch {
|
|
37043
37317
|
throw new Error(
|
|
37044
37318
|
`could not parse "${input}". pass a dev-server port, a dev-server base URL, or a full bundle URL.`
|
|
37045
37319
|
);
|
|
37046
37320
|
}
|
|
37047
|
-
const protocol =
|
|
37048
|
-
const port =
|
|
37049
|
-
const baseUrl = buildBaseUrl(protocol,
|
|
37050
|
-
if (isBaseServerUrl(
|
|
37321
|
+
const protocol = parsed.protocol || "http:";
|
|
37322
|
+
const port = parsed.port ? parseInt(parsed.port, 10) : getDefaultPortForProtocol(protocol);
|
|
37323
|
+
const baseUrl = buildBaseUrl(protocol, parsed.hostname, port);
|
|
37324
|
+
if (isBaseServerUrl(parsed)) {
|
|
37051
37325
|
const resolved = await probeBaseUrlBundle(baseUrl, port);
|
|
37052
37326
|
if (resolved) return resolved;
|
|
37053
37327
|
throw buildUnresolvedTargetError(baseUrl);
|
|
37054
37328
|
}
|
|
37055
|
-
return { bundleUrl:
|
|
37329
|
+
return { bundleUrl: parsed.toString(), port, framework: "unknown" };
|
|
37056
37330
|
}
|
|
37057
37331
|
var MANIFEST_PROBE_TIMEOUT_MS, MANIFEST_BOOT_BUDGET_MS, MANIFEST_BOOT_RETRY_MS;
|
|
37058
37332
|
var init_dev_bundle_resolution = __esm({
|
|
@@ -37230,100 +37504,14 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
37230
37504
|
if (projects2.length > 1)
|
|
37231
37505
|
throw new Error("native Firebase configuration requires a selected Xcode project");
|
|
37232
37506
|
if (projects2.length === 1) {
|
|
37233
|
-
const
|
|
37234
|
-
const
|
|
37235
|
-
if (
|
|
37236
|
-
throw new Error("native Xcode project parser is unavailable");
|
|
37237
|
-
const project = Reflect.apply(xcode.project, xcode, [
|
|
37238
|
-
import_node_path29.default.join(iosRoot, projects2[0].name, "project.pbxproj")
|
|
37239
|
-
]);
|
|
37240
|
-
if (!isRecord2(project) || typeof project.parseSync !== "function")
|
|
37241
|
-
throw new Error("native Xcode project is malformed");
|
|
37242
|
-
Reflect.apply(project.parseSync, project, []);
|
|
37243
|
-
const hash = project.hash;
|
|
37244
|
-
const native = isRecord2(hash) ? hash.project : null;
|
|
37245
|
-
const objects = isRecord2(native) ? native.objects : null;
|
|
37246
|
-
if (!isRecord2(objects)) throw new Error("native Xcode objects are malformed");
|
|
37247
|
-
const unquote = (value) => typeof value === "string" ? value.replace(/^"|"$/g, "") : "";
|
|
37248
|
-
const targets = isRecord2(objects.PBXNativeTarget) ? Object.values(objects.PBXNativeTarget).filter(
|
|
37249
|
-
(target2) => isRecord2(target2) && unquote(target2.productType) === "com.apple.product-type.application"
|
|
37250
|
-
) : [];
|
|
37251
|
-
if (targets.length > 1)
|
|
37507
|
+
const xcodeproj = import_node_path29.default.join(iosRoot, projects2[0].name);
|
|
37508
|
+
const appTargets = listXcodeAppTargets(xcodeproj);
|
|
37509
|
+
if (appTargets.length > 1)
|
|
37252
37510
|
throw new Error("native Firebase configuration requires a selected app target");
|
|
37253
|
-
|
|
37254
|
-
|
|
37255
|
-
const
|
|
37256
|
-
|
|
37257
|
-
const groups = isRecord2(objects.PBXGroup) ? objects.PBXGroup : {};
|
|
37258
|
-
const references = isRecord2(objects.PBXFileReference) ? objects.PBXFileReference : {};
|
|
37259
|
-
const nativeProjects = isRecord2(objects.PBXProject) ? Object.values(objects.PBXProject) : [];
|
|
37260
|
-
const roots = nativeProjects.filter(isRecord2).map((value) => value.mainGroup);
|
|
37261
|
-
const pending = roots.filter((id) => typeof id === "string").map((id) => ({ id, base: iosRoot }));
|
|
37262
|
-
const visited = /* @__PURE__ */ new Map();
|
|
37263
|
-
while (pending.length) {
|
|
37264
|
-
const item = pending.pop();
|
|
37265
|
-
if (!item) break;
|
|
37266
|
-
const previous = visited.get(item.id);
|
|
37267
|
-
if (previous !== void 0) {
|
|
37268
|
-
if (previous !== item.base)
|
|
37269
|
-
throw new Error("native Xcode group has ambiguous parents");
|
|
37270
|
-
continue;
|
|
37271
|
-
}
|
|
37272
|
-
visited.set(item.id, item.base);
|
|
37273
|
-
const group = groups[item.id];
|
|
37274
|
-
if (!isRecord2(group) || !Array.isArray(group.children)) continue;
|
|
37275
|
-
const sourceTree = unquote(group.sourceTree);
|
|
37276
|
-
if (sourceTree && sourceTree !== "<group>" && sourceTree !== "SOURCE_ROOT")
|
|
37277
|
-
continue;
|
|
37278
|
-
const directory = import_node_path29.default.resolve(
|
|
37279
|
-
sourceTree === "SOURCE_ROOT" ? iosRoot : item.base,
|
|
37280
|
-
unquote(group.path)
|
|
37281
|
-
);
|
|
37282
|
-
for (const child of group.children) {
|
|
37283
|
-
if (!isRecord2(child) || typeof child.value !== "string") continue;
|
|
37284
|
-
if (isRecord2(groups[child.value])) {
|
|
37285
|
-
pending.push({ id: child.value, base: directory });
|
|
37286
|
-
continue;
|
|
37287
|
-
}
|
|
37288
|
-
const file = references[child.value];
|
|
37289
|
-
if (!isRecord2(file)) continue;
|
|
37290
|
-
const tree = unquote(file.sourceTree);
|
|
37291
|
-
if (tree !== "<group>" && tree !== "SOURCE_ROOT") continue;
|
|
37292
|
-
const filePath = import_node_path29.default.resolve(
|
|
37293
|
-
tree === "SOURCE_ROOT" ? iosRoot : directory,
|
|
37294
|
-
unquote(file.path)
|
|
37295
|
-
);
|
|
37296
|
-
const values = filePaths.get(child.value) ?? /* @__PURE__ */ new Set();
|
|
37297
|
-
values.add(filePath);
|
|
37298
|
-
filePaths.set(child.value, values);
|
|
37299
|
-
}
|
|
37300
|
-
}
|
|
37301
|
-
const buildFiles = isRecord2(objects.PBXBuildFile) ? objects.PBXBuildFile : {};
|
|
37302
|
-
const filesInPhase = (section, name2) => {
|
|
37303
|
-
if (!isRecord2(section)) return [];
|
|
37304
|
-
const paths = [];
|
|
37305
|
-
for (const phase of buildPhases) {
|
|
37306
|
-
if (!isRecord2(phase) || typeof phase.value !== "string") continue;
|
|
37307
|
-
const value = section[phase.value];
|
|
37308
|
-
if (!isRecord2(value) || !Array.isArray(value.files)) continue;
|
|
37309
|
-
for (const entry of value.files) {
|
|
37310
|
-
if (!isRecord2(entry) || typeof entry.value !== "string") continue;
|
|
37311
|
-
const file = buildFiles[entry.value];
|
|
37312
|
-
if (!isRecord2(file) || typeof file.fileRef !== "string") continue;
|
|
37313
|
-
const reference = references[file.fileRef];
|
|
37314
|
-
if (!isRecord2(reference) || !name2.test(import_node_path29.default.basename(unquote(reference.path))))
|
|
37315
|
-
continue;
|
|
37316
|
-
const candidates = filePaths.get(file.fileRef);
|
|
37317
|
-
if (!candidates || candidates.size !== 1)
|
|
37318
|
-
throw new Error("native Firebase build resource path is unresolved");
|
|
37319
|
-
paths.push(...candidates);
|
|
37320
|
-
}
|
|
37321
|
-
}
|
|
37322
|
-
return paths;
|
|
37323
|
-
};
|
|
37324
|
-
const delegates = filesInPhase(
|
|
37325
|
-
objects.PBXSourcesBuildPhase,
|
|
37326
|
-
/^AppDelegate\.(swift|mm|m)$/
|
|
37511
|
+
if (appTargets.length === 1) {
|
|
37512
|
+
const app = readXcodeAppTarget(xcodeproj, appTargets[0]);
|
|
37513
|
+
const delegates = app.allSources.filter(
|
|
37514
|
+
(file) => /^AppDelegate\.(swift|mm|m)$/.test(import_node_path29.default.basename(file))
|
|
37327
37515
|
);
|
|
37328
37516
|
const defaultConfigured = delegates.some((file) => {
|
|
37329
37517
|
const source = import_node_fs29.default.readFileSync(file, "utf8").replace(
|
|
@@ -37353,15 +37541,19 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
37353
37541
|
return true;
|
|
37354
37542
|
});
|
|
37355
37543
|
if (defaultConfigured) {
|
|
37356
|
-
const resources =
|
|
37357
|
-
|
|
37358
|
-
/^GoogleService-Info\.plist$/
|
|
37544
|
+
const resources = app.resources.filter(
|
|
37545
|
+
(file) => /^GoogleService-Info\.plist$/.test(import_node_path29.default.basename(file))
|
|
37359
37546
|
);
|
|
37360
37547
|
if (resources.length !== 1)
|
|
37361
37548
|
throw new Error(
|
|
37362
37549
|
"native Firebase default initialization requires one GoogleService-Info.plist build resource"
|
|
37363
37550
|
);
|
|
37364
|
-
config.ios = {
|
|
37551
|
+
config.ios = {
|
|
37552
|
+
googleServicesFile: import_node_path29.default.relative(
|
|
37553
|
+
import_node_fs29.default.realpathSync(projectRoot),
|
|
37554
|
+
resources[0]
|
|
37555
|
+
)
|
|
37556
|
+
};
|
|
37365
37557
|
}
|
|
37366
37558
|
}
|
|
37367
37559
|
}
|
|
@@ -37375,24 +37567,24 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
37375
37567
|
import_node_path29.default.resolve(projectRoot, native.googleServicesFile),
|
|
37376
37568
|
"utf8"
|
|
37377
37569
|
);
|
|
37378
|
-
const
|
|
37379
|
-
if (!isRecord2(
|
|
37570
|
+
const parsed = platform === "ios" ? parsePlistSource(source) : JSON.parse(source);
|
|
37571
|
+
if (!isRecord2(parsed)) throw new Error("Invalid Google services file.");
|
|
37380
37572
|
if (platform === "ios") {
|
|
37381
37573
|
result[platform] = {
|
|
37382
|
-
apiKey:
|
|
37383
|
-
appId:
|
|
37384
|
-
projectId:
|
|
37385
|
-
databaseURL:
|
|
37386
|
-
gaTrackingId:
|
|
37387
|
-
storageBucket:
|
|
37388
|
-
messagingSenderId:
|
|
37389
|
-
clientId:
|
|
37390
|
-
androidClientID:
|
|
37391
|
-
deepLinkUrlScheme:
|
|
37574
|
+
apiKey: parsed.API_KEY,
|
|
37575
|
+
appId: parsed.GOOGLE_APP_ID,
|
|
37576
|
+
projectId: parsed.PROJECT_ID,
|
|
37577
|
+
databaseURL: parsed.DATABASE_URL,
|
|
37578
|
+
gaTrackingId: parsed.TRACKING_ID,
|
|
37579
|
+
storageBucket: parsed.STORAGE_BUCKET,
|
|
37580
|
+
messagingSenderId: parsed.GCM_SENDER_ID,
|
|
37581
|
+
clientId: parsed.CLIENT_ID,
|
|
37582
|
+
androidClientID: parsed.ANDROID_CLIENT_ID,
|
|
37583
|
+
deepLinkUrlScheme: parsed.REVERSED_CLIENT_ID
|
|
37392
37584
|
};
|
|
37393
37585
|
} else {
|
|
37394
|
-
const project = isRecord2(
|
|
37395
|
-
const clients = Array.isArray(
|
|
37586
|
+
const project = isRecord2(parsed.project_info) ? parsed.project_info : {};
|
|
37587
|
+
const clients = Array.isArray(parsed.client) ? parsed.client : [];
|
|
37396
37588
|
const client = clients.find((value) => {
|
|
37397
37589
|
if (!isRecord2(value) || !isRecord2(value.client_info)) return false;
|
|
37398
37590
|
const android = value.client_info.android_client_info;
|
|
@@ -37433,6 +37625,7 @@ var init_native_firebase_config = __esm({
|
|
|
37433
37625
|
import_node_path29 = __toESM(require("node:path"), 1);
|
|
37434
37626
|
init_is_record();
|
|
37435
37627
|
init_plist();
|
|
37628
|
+
init_xcode_project();
|
|
37436
37629
|
}
|
|
37437
37630
|
});
|
|
37438
37631
|
|
|
@@ -37456,13 +37649,13 @@ function playwrightProfileUserDataDir(profileId) {
|
|
|
37456
37649
|
}
|
|
37457
37650
|
function readIndexRaw() {
|
|
37458
37651
|
try {
|
|
37459
|
-
const
|
|
37652
|
+
const parsed = JSON.parse(
|
|
37460
37653
|
import_fs5.default.readFileSync(profileIndexPath(), "utf8")
|
|
37461
37654
|
);
|
|
37462
|
-
if (!
|
|
37655
|
+
if (!parsed || parsed.version !== PROFILE_INDEX_VERSION) {
|
|
37463
37656
|
return { version: PROFILE_INDEX_VERSION, profiles: [] };
|
|
37464
37657
|
}
|
|
37465
|
-
const profiles = Array.isArray(
|
|
37658
|
+
const profiles = Array.isArray(parsed.profiles) ? parsed.profiles.filter(
|
|
37466
37659
|
(profile) => !!profile && typeof profile.id === "string" && typeof profile.createdAt === "string" && typeof profile.updatedAt === "string"
|
|
37467
37660
|
).map((profile) => ({
|
|
37468
37661
|
id: normalizeProfileId(profile.id),
|
|
@@ -37694,11 +37887,11 @@ async function loadRNXAppConfig(project) {
|
|
|
37694
37887
|
)
|
|
37695
37888
|
}
|
|
37696
37889
|
});
|
|
37697
|
-
const
|
|
37698
|
-
if (!isPeachConfig(
|
|
37890
|
+
const loaded2 = await jiti.import(project.configPath, { default: true });
|
|
37891
|
+
if (!isPeachConfig(loaded2)) {
|
|
37699
37892
|
throw new Error("the default export must be a peach config object");
|
|
37700
37893
|
}
|
|
37701
|
-
return resolveConfigReplacementFiles(
|
|
37894
|
+
return resolveConfigReplacementFiles(loaded2, project.configPath);
|
|
37702
37895
|
} catch (error) {
|
|
37703
37896
|
const message = error instanceof Error ? error.message : String(error);
|
|
37704
37897
|
throw new Error(`could not load ${project.configPath}: ${message}`);
|
|
@@ -37870,14 +38063,14 @@ function discoverNativeLinkedAppFonts(opts) {
|
|
|
37870
38063
|
plistPaths.push(import_node_path33.default.join(iosDir, entry.name, "Info.plist"));
|
|
37871
38064
|
}
|
|
37872
38065
|
for (const plistPath of plistPaths) {
|
|
37873
|
-
let
|
|
38066
|
+
let parsed;
|
|
37874
38067
|
try {
|
|
37875
|
-
|
|
38068
|
+
parsed = parsePlistSource(import_node_fs32.default.readFileSync(plistPath, "utf8"));
|
|
37876
38069
|
} catch {
|
|
37877
38070
|
continue;
|
|
37878
38071
|
}
|
|
37879
|
-
if (!
|
|
37880
|
-
const declaredFonts = Reflect.get(
|
|
38072
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) continue;
|
|
38073
|
+
const declaredFonts = Reflect.get(parsed, "UIAppFonts");
|
|
37881
38074
|
if (!Array.isArray(declaredFonts)) continue;
|
|
37882
38075
|
for (const declaredFont of declaredFonts) {
|
|
37883
38076
|
if (typeof declaredFont !== "string") continue;
|
|
@@ -40492,8 +40685,8 @@ function resolvePlaywright() {
|
|
|
40492
40685
|
try {
|
|
40493
40686
|
const modulePath = requireFromRoot.resolve(spec);
|
|
40494
40687
|
const packageJsonPath = requireFromRoot.resolve(`${spec}/package.json`);
|
|
40495
|
-
const
|
|
40496
|
-
if (!isRecord2(
|
|
40688
|
+
const parsed = JSON.parse((0, import_node_fs34.readFileSync)(packageJsonPath, "utf8"));
|
|
40689
|
+
if (!isRecord2(parsed) || typeof parsed.version !== "string") continue;
|
|
40497
40690
|
const corePackagePath = (0, import_node_module6.createRequire)(modulePath).resolve(
|
|
40498
40691
|
"playwright-core/package.json"
|
|
40499
40692
|
);
|
|
@@ -40503,7 +40696,7 @@ function resolvePlaywright() {
|
|
|
40503
40696
|
spec,
|
|
40504
40697
|
modulePath,
|
|
40505
40698
|
cliPath,
|
|
40506
|
-
version:
|
|
40699
|
+
version: parsed.version
|
|
40507
40700
|
};
|
|
40508
40701
|
} catch {
|
|
40509
40702
|
}
|
|
@@ -40562,14 +40755,14 @@ function probeBrowser(resolved, env) {
|
|
|
40562
40755
|
};
|
|
40563
40756
|
}
|
|
40564
40757
|
try {
|
|
40565
|
-
const
|
|
40566
|
-
if (!isRecord2(
|
|
40758
|
+
const parsed = JSON.parse(probe2.stdout);
|
|
40759
|
+
if (!isRecord2(parsed) || typeof parsed.executablePath !== "string" || typeof parsed.exists !== "boolean") {
|
|
40567
40760
|
throw new Error("probe returned an invalid result");
|
|
40568
40761
|
}
|
|
40569
40762
|
return {
|
|
40570
40763
|
ok: true,
|
|
40571
|
-
executablePath:
|
|
40572
|
-
exists:
|
|
40764
|
+
executablePath: parsed.executablePath,
|
|
40765
|
+
exists: parsed.exists && (0, import_node_fs34.existsSync)(parsed.executablePath)
|
|
40573
40766
|
};
|
|
40574
40767
|
} catch (error) {
|
|
40575
40768
|
return {
|
|
@@ -41611,8 +41804,8 @@ __export(control_exports, {
|
|
|
41611
41804
|
function parsePositiveIntegerEnv(name2) {
|
|
41612
41805
|
const value = process.env[name2]?.trim();
|
|
41613
41806
|
if (!value) return null;
|
|
41614
|
-
const
|
|
41615
|
-
return Number.isInteger(
|
|
41807
|
+
const parsed = Number(value);
|
|
41808
|
+
return Number.isInteger(parsed) && parsed > 0 ? parsed : null;
|
|
41616
41809
|
}
|
|
41617
41810
|
function resolveDriverConnectWaitOptions() {
|
|
41618
41811
|
const timeoutMs = parsePositiveIntegerEnv("SOOTSIM_DRIVER_CONNECT_TIMEOUT_MS") ?? parsePositiveIntegerEnv("SOOTSIM_PW_CONNECT_TIMEOUT_MS") ?? DEFAULT_DRIVER_CONNECT_TIMEOUT_MS;
|
|
@@ -42390,25 +42583,25 @@ function printOpenedSim(openUrl2, sim, mode, quiet = false) {
|
|
|
42390
42583
|
const [printableOpenUrl, printableSimUrl] = [openUrl2, sim.url].map((value) => {
|
|
42391
42584
|
if (!value) return value;
|
|
42392
42585
|
try {
|
|
42393
|
-
const
|
|
42586
|
+
const parsed = new URL(value);
|
|
42394
42587
|
let changed = false;
|
|
42395
|
-
if (
|
|
42396
|
-
|
|
42588
|
+
if (parsed.searchParams.has(PEACH_CONFIG_QUERY_PARAM)) {
|
|
42589
|
+
parsed.searchParams.set(PEACH_CONFIG_QUERY_PARAM, "[redacted]");
|
|
42397
42590
|
changed = true;
|
|
42398
42591
|
}
|
|
42399
|
-
const bundle =
|
|
42592
|
+
const bundle = parsed.searchParams.get("bundle");
|
|
42400
42593
|
if (bundle) {
|
|
42401
42594
|
try {
|
|
42402
42595
|
const parsedBundle = new URL(bundle);
|
|
42403
42596
|
if (parsedBundle.searchParams.has(PEACH_CONFIG_QUERY_PARAM)) {
|
|
42404
42597
|
parsedBundle.searchParams.set(PEACH_CONFIG_QUERY_PARAM, "[redacted]");
|
|
42405
|
-
|
|
42598
|
+
parsed.searchParams.set("bundle", parsedBundle.toString());
|
|
42406
42599
|
changed = true;
|
|
42407
42600
|
}
|
|
42408
42601
|
} catch {
|
|
42409
42602
|
}
|
|
42410
42603
|
}
|
|
42411
|
-
if (changed) return
|
|
42604
|
+
if (changed) return parsed.toString();
|
|
42412
42605
|
} catch {
|
|
42413
42606
|
}
|
|
42414
42607
|
return value;
|
|
@@ -42511,19 +42704,19 @@ async function waitForTreeStable(wsPort, simId, opts) {
|
|
|
42511
42704
|
}
|
|
42512
42705
|
}
|
|
42513
42706
|
async function runLinkCommand(args, opts = {}) {
|
|
42514
|
-
const
|
|
42707
|
+
const parsed = parseBridgeCliArgs(args, {
|
|
42515
42708
|
port: opts.port,
|
|
42516
42709
|
commandTimeoutMs: opts.timeoutMs
|
|
42517
42710
|
});
|
|
42518
|
-
if (
|
|
42711
|
+
if (parsed.positional.length !== 1) {
|
|
42519
42712
|
console.error(" peach open: expected exactly one <url-or-route>");
|
|
42520
42713
|
console.error(" examples: peach open /settings | peach open myapp://settings");
|
|
42521
42714
|
rnxExit(1);
|
|
42522
42715
|
}
|
|
42523
|
-
const bridge = createBridgeFromParsed(
|
|
42524
|
-
const simHint =
|
|
42716
|
+
const bridge = createBridgeFromParsed(parsed);
|
|
42717
|
+
const simHint = parsed.simId ? ` --sim ${parsed.simId}` : "";
|
|
42525
42718
|
try {
|
|
42526
|
-
const target = await openAppUrl(bridge,
|
|
42719
|
+
const target = await openAppUrl(bridge, parsed.positional[0] ?? "");
|
|
42527
42720
|
console.log(` opened deep link: ${target}`);
|
|
42528
42721
|
} catch (err) {
|
|
42529
42722
|
console.error(` link failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -42538,7 +42731,7 @@ async function runLinkCommand(args, opts = {}) {
|
|
|
42538
42731
|
}
|
|
42539
42732
|
}
|
|
42540
42733
|
async function runOpenCommand(args, opts = {}) {
|
|
42541
|
-
const
|
|
42734
|
+
const parsed = parseBridgeCliArgs(args, {
|
|
42542
42735
|
port: opts.port,
|
|
42543
42736
|
commandTimeoutMs: opts.timeoutMs,
|
|
42544
42737
|
stripBooleanFlags: [
|
|
@@ -42587,13 +42780,13 @@ async function runOpenCommand(args, opts = {}) {
|
|
|
42587
42780
|
const profileId = requestedProfileId ? ensureProfile(requestedProfileId).id : void 0;
|
|
42588
42781
|
const openInNewSim = args.includes("--new") || !!profileId || ephemeralProfile;
|
|
42589
42782
|
const commandConfig = parseOpenRuntimeConfig(args);
|
|
42590
|
-
if (openInNewSim &&
|
|
42783
|
+
if (openInNewSim && parsed.simIdSource === "flag") {
|
|
42591
42784
|
console.error(
|
|
42592
42785
|
" peach open: --new, --profile, and --ephemeral cannot be combined with --sim"
|
|
42593
42786
|
);
|
|
42594
42787
|
rnxExit(1);
|
|
42595
42788
|
}
|
|
42596
|
-
const target =
|
|
42789
|
+
const target = parsed.positional[0] || "";
|
|
42597
42790
|
if (!target && args.includes("--port")) {
|
|
42598
42791
|
const portValue = args[args.indexOf("--port") + 1] ?? "<number>";
|
|
42599
42792
|
console.error(
|
|
@@ -42665,23 +42858,23 @@ async function runOpenCommand(args, opts = {}) {
|
|
|
42665
42858
|
if (explicitBaseUrl) {
|
|
42666
42859
|
const pinned = resolveBridgePortForPin({
|
|
42667
42860
|
baseUrl: explicitBaseUrl,
|
|
42668
|
-
wsPort:
|
|
42669
|
-
explicitPort:
|
|
42861
|
+
wsPort: parsed.wsPort,
|
|
42862
|
+
explicitPort: parsed.explicitPort
|
|
42670
42863
|
});
|
|
42671
42864
|
if (pinned.error !== void 0) {
|
|
42672
42865
|
console.error(` error: ${pinned.error}`);
|
|
42673
42866
|
rnxExit(1);
|
|
42674
42867
|
} else {
|
|
42675
|
-
|
|
42868
|
+
parsed.wsPort = pinned.port;
|
|
42676
42869
|
}
|
|
42677
42870
|
}
|
|
42678
42871
|
opts.signal?.throwIfAborted();
|
|
42679
|
-
|
|
42680
|
-
|
|
42681
|
-
|
|
42872
|
+
parsed.wsPort = await ensureBridgeForOpen(
|
|
42873
|
+
parsed.wsPort,
|
|
42874
|
+
parsed.explicitPort,
|
|
42682
42875
|
opts.resources
|
|
42683
42876
|
);
|
|
42684
|
-
if (opts.resources) opts.resources.port =
|
|
42877
|
+
if (opts.resources) opts.resources.port = parsed.wsPort;
|
|
42685
42878
|
opts.signal?.throwIfAborted();
|
|
42686
42879
|
const requestedDriverId = args.find((_, i) => args[i - 1] === "--driver") || "";
|
|
42687
42880
|
if (requestedDriverId && !isDriverId(requestedDriverId)) {
|
|
@@ -42788,20 +42981,20 @@ async function runOpenCommand(args, opts = {}) {
|
|
|
42788
42981
|
env: envArgs.length ? envArgs : void 0,
|
|
42789
42982
|
dotEnv
|
|
42790
42983
|
};
|
|
42791
|
-
const selectedShellBaseUrl = configuredRuntimeVersion ? `http://localhost:${
|
|
42984
|
+
const selectedShellBaseUrl = configuredRuntimeVersion ? `http://localhost:${parsed.wsPort}/` : explicitBaseUrl || resolveShellBaseUrlForBridgePort(parsed.wsPort);
|
|
42792
42985
|
const baseUrl = applyRuntimeGenerationOrigin(
|
|
42793
42986
|
selectedShellBaseUrl,
|
|
42794
42987
|
configuredRuntimeVersion
|
|
42795
42988
|
);
|
|
42796
42989
|
const hasExplicitBaseUrl = args.includes("--base-url");
|
|
42797
|
-
printBridgeWorldNotice(
|
|
42990
|
+
printBridgeWorldNotice(parsed.wsPort, baseUrl);
|
|
42798
42991
|
const savedSimId = readCurrentSimId();
|
|
42799
42992
|
const shouldReuseCurrentSim = !openInNewSim;
|
|
42800
42993
|
const token = `cli-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
42801
42994
|
const simMatchesToken = (sim) => sim.url?.includes(`inspectOpen=${token}`) ?? false;
|
|
42802
42995
|
if (shouldReuseCurrentSim) {
|
|
42803
|
-
const bridge = createBridgeFromParsed(
|
|
42804
|
-
const simHint =
|
|
42996
|
+
const bridge = createBridgeFromParsed(parsed);
|
|
42997
|
+
const simHint = parsed.simId ? ` --sim ${parsed.simId}` : "";
|
|
42805
42998
|
let fallBackToNewSim = false;
|
|
42806
42999
|
let navigatedShellUrl = null;
|
|
42807
43000
|
try {
|
|
@@ -42809,22 +43002,22 @@ async function runOpenCommand(args, opts = {}) {
|
|
|
42809
43002
|
let targetShellUrl = null;
|
|
42810
43003
|
try {
|
|
42811
43004
|
const sims = await bridge.listSims();
|
|
42812
|
-
if (
|
|
43005
|
+
if (parsed.simIdSource === "saved") {
|
|
42813
43006
|
targetSim = sims.find(
|
|
42814
43007
|
(sim) => sim.id === savedSimId && sim.readyState === "open" && simUsesDriver(sim, driverId)
|
|
42815
43008
|
) ?? null;
|
|
42816
43009
|
if (!targetSim) {
|
|
42817
43010
|
clearCurrentSimId();
|
|
42818
43011
|
}
|
|
42819
|
-
} else if (
|
|
42820
|
-
targetSim = resolveTargetSim(sims,
|
|
43012
|
+
} else if (parsed.simIdSource === "flag") {
|
|
43013
|
+
targetSim = resolveTargetSim(sims, parsed.simId);
|
|
42821
43014
|
if (!simUsesDriver(targetSim, driverId)) {
|
|
42822
43015
|
throw new Error(
|
|
42823
43016
|
`sim ${targetSim.id} is not managed by the ${driverId} driver`
|
|
42824
43017
|
);
|
|
42825
43018
|
}
|
|
42826
43019
|
}
|
|
42827
|
-
if (!targetSim &&
|
|
43020
|
+
if (!targetSim && parsed.simIdSource !== "flag") {
|
|
42828
43021
|
targetShellUrl = await buildShellUrl(
|
|
42829
43022
|
target,
|
|
42830
43023
|
applyPeachConfigToUrl(baseUrl, runtimeConfig),
|
|
@@ -42846,7 +43039,7 @@ async function runOpenCommand(args, opts = {}) {
|
|
|
42846
43039
|
}) ?? null;
|
|
42847
43040
|
}
|
|
42848
43041
|
if (!targetSim) {
|
|
42849
|
-
if (
|
|
43042
|
+
if (parsed.simIdSource !== "flag") {
|
|
42850
43043
|
fallBackToNewSim = true;
|
|
42851
43044
|
} else {
|
|
42852
43045
|
throw new Error("no sim connected");
|
|
@@ -42881,8 +43074,8 @@ async function runOpenCommand(args, opts = {}) {
|
|
|
42881
43074
|
}
|
|
42882
43075
|
if (!fallBackToNewSim && targetSim && navigatedShellUrl) {
|
|
42883
43076
|
const navigatedSim = await waitForSimMatch(
|
|
42884
|
-
|
|
42885
|
-
|
|
43077
|
+
parsed.wsPort,
|
|
43078
|
+
parsed.commandTimeoutMs,
|
|
42886
43079
|
(sim) => sim.readyState === "open" && simUsesDriver(sim, driverId) && simMatchesToken(sim),
|
|
42887
43080
|
{ attempts: Math.round(30 * flowTimeoutScale()) }
|
|
42888
43081
|
);
|
|
@@ -42899,8 +43092,8 @@ async function runOpenCommand(args, opts = {}) {
|
|
|
42899
43092
|
}
|
|
42900
43093
|
targetSim = navigatedSim;
|
|
42901
43094
|
const ready = await waitForSimReady(
|
|
42902
|
-
|
|
42903
|
-
|
|
43095
|
+
parsed.wsPort,
|
|
43096
|
+
parsed.commandTimeoutMs,
|
|
42904
43097
|
targetSim.id
|
|
42905
43098
|
);
|
|
42906
43099
|
if (!ready.bridge) {
|
|
@@ -42923,7 +43116,7 @@ async function runOpenCommand(args, opts = {}) {
|
|
|
42923
43116
|
"current sim",
|
|
42924
43117
|
quiet
|
|
42925
43118
|
);
|
|
42926
|
-
await maybeDescribeAfterOpen(
|
|
43119
|
+
await maybeDescribeAfterOpen(parsed.wsPort, targetSim.id, args);
|
|
42927
43120
|
printAgentHints(quiet);
|
|
42928
43121
|
return { simId: targetSim.id, launched: false };
|
|
42929
43122
|
}
|
|
@@ -42955,7 +43148,7 @@ async function runOpenCommand(args, opts = {}) {
|
|
|
42955
43148
|
// the shell URL could name a third port, since a bridge with no lockfile
|
|
42956
43149
|
// resolves back to the default shell URL and that shell may belong to a
|
|
42957
43150
|
// live world of its own.
|
|
42958
|
-
bridgePort:
|
|
43151
|
+
bridgePort: parsed.wsPort,
|
|
42959
43152
|
headless: driverHeadless,
|
|
42960
43153
|
profileId,
|
|
42961
43154
|
ephemeralProfile,
|
|
@@ -42972,8 +43165,8 @@ async function runOpenCommand(args, opts = {}) {
|
|
|
42972
43165
|
rnxExit(1);
|
|
42973
43166
|
}
|
|
42974
43167
|
const outcome = await waitForSimMatchOrHostExit(
|
|
42975
|
-
|
|
42976
|
-
|
|
43168
|
+
parsed.wsPort,
|
|
43169
|
+
parsed.commandTimeoutMs,
|
|
42977
43170
|
simMatchesToken,
|
|
42978
43171
|
result.pid,
|
|
42979
43172
|
{
|
|
@@ -43013,23 +43206,23 @@ async function runOpenCommand(args, opts = {}) {
|
|
|
43013
43206
|
saveCurrentSimId(match.id);
|
|
43014
43207
|
signalDriverLaunchConnected(result);
|
|
43015
43208
|
printOpenedSim(openUrl2, match, `${driver.name} driver`, quiet);
|
|
43016
|
-
await maybeDescribeAfterOpen(
|
|
43209
|
+
await maybeDescribeAfterOpen(parsed.wsPort, match.id, args);
|
|
43017
43210
|
printAgentHints(quiet);
|
|
43018
43211
|
return { simId: match.id, launched: true };
|
|
43019
43212
|
}
|
|
43020
43213
|
async function runUseLikeCommand(args, opts = {}) {
|
|
43021
|
-
const
|
|
43214
|
+
const parsed = parseBridgeCliArgs(args, {
|
|
43022
43215
|
port: opts.port,
|
|
43023
43216
|
commandTimeoutMs: opts.timeoutMs,
|
|
43024
43217
|
stripBooleanFlags: ["--force"]
|
|
43025
43218
|
});
|
|
43026
43219
|
const force = args.includes("--force");
|
|
43027
|
-
const bridge = createBridgeFromParsed(
|
|
43028
|
-
const simHint =
|
|
43220
|
+
const bridge = createBridgeFromParsed(parsed);
|
|
43221
|
+
const simHint = parsed.simId ? ` --sim ${parsed.simId}` : "";
|
|
43029
43222
|
try {
|
|
43030
43223
|
try {
|
|
43031
43224
|
const sims = await bridge.listSims();
|
|
43032
|
-
const target = resolveTargetSim(sims,
|
|
43225
|
+
const target = resolveTargetSim(sims, parsed.positional[0] || parsed.simId);
|
|
43033
43226
|
if (target.lockedBy && !target.lockedByMe && target.lockExpiresAt && target.lockExpiresAt > Date.now()) {
|
|
43034
43227
|
const secs = Math.max(0, Math.round((target.lockExpiresAt - Date.now()) / 1e3));
|
|
43035
43228
|
if (target.lockedByKind === "user-active") {
|
|
@@ -43070,17 +43263,17 @@ async function runUseCommand(args, opts = {}) {
|
|
|
43070
43263
|
await runUseLikeCommand(args, opts);
|
|
43071
43264
|
}
|
|
43072
43265
|
async function runClaimCommand(args, opts = {}) {
|
|
43073
|
-
const
|
|
43266
|
+
const parsed = parseBridgeCliArgs(args, {
|
|
43074
43267
|
port: opts.port,
|
|
43075
43268
|
commandTimeoutMs: opts.timeoutMs,
|
|
43076
43269
|
stripBooleanFlags: ["--force"]
|
|
43077
43270
|
});
|
|
43078
43271
|
const force = args.includes("--force");
|
|
43079
|
-
const bridge = createBridgeFromParsed(
|
|
43272
|
+
const bridge = createBridgeFromParsed(parsed);
|
|
43080
43273
|
try {
|
|
43081
43274
|
try {
|
|
43082
43275
|
const sims = await bridge.listSims();
|
|
43083
|
-
const target = resolveTargetSim(sims,
|
|
43276
|
+
const target = resolveTargetSim(sims, parsed.positional[0] || parsed.simId);
|
|
43084
43277
|
const priorHolder = force && target.lockedBy && !target.lockedByMe && target.lockedByKind !== "user-active" ? target.lockedBy : null;
|
|
43085
43278
|
const result = await bridge.claim(target.id, { force });
|
|
43086
43279
|
saveCurrentSimId(target.id);
|
|
@@ -43191,13 +43384,13 @@ function planBulkCloseTargets(sims, opts) {
|
|
|
43191
43384
|
};
|
|
43192
43385
|
}
|
|
43193
43386
|
async function runCloseCommand(args, opts = {}) {
|
|
43194
|
-
const
|
|
43387
|
+
const parsed = parseBridgeCliArgs(args, {
|
|
43195
43388
|
port: opts.port,
|
|
43196
43389
|
commandTimeoutMs: opts.timeoutMs,
|
|
43197
43390
|
stripBooleanFlags: ["--all", "--others", "--force"]
|
|
43198
43391
|
});
|
|
43199
|
-
const bridge = createBridgeFromParsed(
|
|
43200
|
-
const simHint =
|
|
43392
|
+
const bridge = createBridgeFromParsed(parsed);
|
|
43393
|
+
const simHint = parsed.simId ? ` --sim ${parsed.simId}` : "";
|
|
43201
43394
|
const closeAll = args.includes("--all");
|
|
43202
43395
|
const closeOthers = args.includes("--others");
|
|
43203
43396
|
const force = args.includes("--force");
|
|
@@ -43205,7 +43398,7 @@ async function runCloseCommand(args, opts = {}) {
|
|
|
43205
43398
|
try {
|
|
43206
43399
|
const sims = await bridge.listSims();
|
|
43207
43400
|
const savedId = readCurrentSimId();
|
|
43208
|
-
const explicitKeepId =
|
|
43401
|
+
const explicitKeepId = parsed.positional[0] || (parsed.simIdSource === "flag" ? parsed.simId : void 0);
|
|
43209
43402
|
const plan = planBulkCloseTargets(sims, {
|
|
43210
43403
|
closeOthers,
|
|
43211
43404
|
explicitKeepId,
|
|
@@ -43244,8 +43437,8 @@ async function runCloseCommand(args, opts = {}) {
|
|
|
43244
43437
|
}
|
|
43245
43438
|
const result = await closeSimsBulk(
|
|
43246
43439
|
bridge,
|
|
43247
|
-
|
|
43248
|
-
|
|
43440
|
+
parsed.wsPort,
|
|
43441
|
+
parsed.commandTimeoutMs,
|
|
43249
43442
|
plan.targets
|
|
43250
43443
|
);
|
|
43251
43444
|
await terminatePlaywrightHostsForSims(sims, plan.targets);
|
|
@@ -43272,14 +43465,14 @@ async function runCloseCommand(args, opts = {}) {
|
|
|
43272
43465
|
try {
|
|
43273
43466
|
try {
|
|
43274
43467
|
const sims = await bridge.listSims();
|
|
43275
|
-
const target = resolveTargetSim(sims,
|
|
43468
|
+
const target = resolveTargetSim(sims, parsed.positional[0] || parsed.simId);
|
|
43276
43469
|
const fallbackTarget = sims.find(
|
|
43277
43470
|
(sim) => sim.id !== target.id && sim.readyState === "open"
|
|
43278
43471
|
);
|
|
43279
43472
|
await bridge.closeSim(target.id);
|
|
43280
43473
|
const closed = await waitForSimGone(
|
|
43281
|
-
|
|
43282
|
-
|
|
43474
|
+
parsed.wsPort,
|
|
43475
|
+
parsed.commandTimeoutMs,
|
|
43283
43476
|
target.id
|
|
43284
43477
|
);
|
|
43285
43478
|
if (!closed) {
|
|
@@ -44127,15 +44320,15 @@ function executeSyncHttp(url, method, params) {
|
|
|
44127
44320
|
if (child.error) {
|
|
44128
44321
|
throw new Error(`http ${method} ${url} failed: ${child.error.message}`);
|
|
44129
44322
|
}
|
|
44130
|
-
let
|
|
44323
|
+
let parsed;
|
|
44131
44324
|
try {
|
|
44132
|
-
|
|
44325
|
+
parsed = JSON.parse(child.stdout || "");
|
|
44133
44326
|
} catch {
|
|
44134
44327
|
throw new Error(
|
|
44135
44328
|
`http ${method} ${url} failed: no response (${(child.stderr || "").trim().slice(0, 200)})`
|
|
44136
44329
|
);
|
|
44137
44330
|
}
|
|
44138
|
-
const result =
|
|
44331
|
+
const result = parsed;
|
|
44139
44332
|
if (result.__error) {
|
|
44140
44333
|
throw new Error(`http ${method} ${url} failed: ${result.__error}`);
|
|
44141
44334
|
}
|
|
@@ -47134,16 +47327,16 @@ var skill2 = {
|
|
|
47134
47327
|
if (!fs30.existsSync(packagePath)) {
|
|
47135
47328
|
return { success: false, message: "No package.json found" };
|
|
47136
47329
|
}
|
|
47137
|
-
const
|
|
47138
|
-
if (!
|
|
47330
|
+
const parsed = JSON.parse(fs30.readFileSync(packagePath, "utf8"));
|
|
47331
|
+
if (!parsed || typeof parsed !== "object") {
|
|
47139
47332
|
return { success: false, message: "package.json is not an object" };
|
|
47140
47333
|
}
|
|
47141
|
-
const dependencies = readDependencies(
|
|
47334
|
+
const dependencies = readDependencies(parsed);
|
|
47142
47335
|
const scan = params.packageName ? scanDeps2({
|
|
47143
47336
|
dependencies: {
|
|
47144
47337
|
[params.packageName]: dependencies[params.packageName] ?? "*"
|
|
47145
47338
|
}
|
|
47146
|
-
}) : scanDeps2(
|
|
47339
|
+
}) : scanDeps2(parsed);
|
|
47147
47340
|
const packageResult = params.packageName ? scan.packages[0] : void 0;
|
|
47148
47341
|
const message = packageResult ? `${params.packageName}: ${formatPackageStatus2(packageResult)}. ${COMPAT_RESULT_CAVEAT2}` : `${formatScanCounts2(scan)}. ${COMPAT_RESULT_CAVEAT2}`;
|
|
47149
47342
|
const reportPath = path33.join(context.outputDir, "compat-report.json");
|