peachsim 0.1.758 → 0.1.759
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 +729 -371
- 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 +2 -4
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +495 -139
- 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 +466 -110
- 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 +920 -557
- 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 +539 -179
- package/dist-lib/vite.cjs +2 -4
- package/package.json +1 -1
- package/src/host/replacement-module-handler.ts +2 -1
- package/src/swift-host.ts +4 -2
- package/src/xcode-json-project.ts +450 -0
- package/src/xcode-project.ts +55 -22
package/dist-lib/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.759 | (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;
|
|
@@ -535,9 +535,7 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
535
535
|
sendJavaScript(
|
|
536
536
|
req,
|
|
537
537
|
res,
|
|
538
|
-
|
|
539
|
-
//# sourceMappingURL=data:application/json;base64,${map}
|
|
540
|
-
`
|
|
538
|
+
compiled.code + "\n//# sourceMappingURL=data:application/json;base64," + map + "\n"
|
|
541
539
|
);
|
|
542
540
|
} catch (error) {
|
|
543
541
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -913,12 +911,12 @@ function resolveFileEntries(entries, configDir) {
|
|
|
913
911
|
return Object.fromEntries(
|
|
914
912
|
Object.entries(entries).map(([name2, resolution]) => [
|
|
915
913
|
name2,
|
|
916
|
-
resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file:
|
|
914
|
+
resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file: import_node_path10.default.resolve(configDir, resolution.file) } : resolution
|
|
917
915
|
])
|
|
918
916
|
);
|
|
919
917
|
}
|
|
920
918
|
function resolveConfigReplacementFiles(config, configPath) {
|
|
921
|
-
const configDir =
|
|
919
|
+
const configDir = import_node_path10.default.dirname(configPath);
|
|
922
920
|
return {
|
|
923
921
|
...config,
|
|
924
922
|
modules: resolveFileEntries(config.modules, configDir),
|
|
@@ -955,12 +953,12 @@ async function resolveRNXAppConfig(startDir = process.cwd()) {
|
|
|
955
953
|
const project = resolveAppProject(startDir);
|
|
956
954
|
return { project, config: await loadRNXAppConfig(project) };
|
|
957
955
|
}
|
|
958
|
-
var import_node_module3,
|
|
956
|
+
var import_node_module3, import_node_path10, import_jiti, require2;
|
|
959
957
|
var init_app_config = __esm({
|
|
960
958
|
"cli/app-config.ts"() {
|
|
961
959
|
"use strict";
|
|
962
960
|
import_node_module3 = require("node:module");
|
|
963
|
-
|
|
961
|
+
import_node_path10 = __toESM(require("node:path"), 1);
|
|
964
962
|
import_jiti = require("jiti");
|
|
965
963
|
init_config();
|
|
966
964
|
init_public_brand();
|
|
@@ -1013,7 +1011,7 @@ async function produceConfiguredBundle(source, config, runtimePackages) {
|
|
|
1013
1011
|
if (!entries || typeof entries !== "object") continue;
|
|
1014
1012
|
for (const resolution of Object.values(entries)) {
|
|
1015
1013
|
if (resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string") {
|
|
1016
|
-
resolution.file = visit(
|
|
1014
|
+
resolution.file = visit(import_node_path11.default.resolve(resolution.file));
|
|
1017
1015
|
}
|
|
1018
1016
|
}
|
|
1019
1017
|
}
|
|
@@ -1037,12 +1035,12 @@ async function produceConfiguredBundle(source, config, runtimePackages) {
|
|
|
1037
1035
|
const identityStart = source.lastIndexOf("\nglobalThis.__sootsimModulePaths=");
|
|
1038
1036
|
return prefix2 + (identityStart < 0 ? source + footer : source.slice(0, identityStart) + footer + source.slice(identityStart));
|
|
1039
1037
|
}
|
|
1040
|
-
var import_node_fs9,
|
|
1038
|
+
var import_node_fs9, import_node_path11, import_sucrase, import_terser;
|
|
1041
1039
|
var init_configured_bundle_producer = __esm({
|
|
1042
1040
|
"src/configured-bundle-producer.ts"() {
|
|
1043
1041
|
"use strict";
|
|
1044
1042
|
import_node_fs9 = __toESM(require("node:fs"), 1);
|
|
1045
|
-
|
|
1043
|
+
import_node_path11 = __toESM(require("node:path"), 1);
|
|
1046
1044
|
import_sucrase = require("sucrase");
|
|
1047
1045
|
import_terser = require("terser");
|
|
1048
1046
|
init_replacementModule();
|
|
@@ -1454,10 +1452,10 @@ var import_yaml = require("yaml");
|
|
|
1454
1452
|
|
|
1455
1453
|
// cli/cloud-client.ts
|
|
1456
1454
|
var DEFAULT_RNX_CLOUD_ORIGIN = rnxPublicBrand.origin;
|
|
1457
|
-
function failureSentence(
|
|
1455
|
+
function failureSentence(text2) {
|
|
1458
1456
|
let parsed;
|
|
1459
1457
|
try {
|
|
1460
|
-
parsed = JSON.parse(
|
|
1458
|
+
parsed = JSON.parse(text2);
|
|
1461
1459
|
} catch {
|
|
1462
1460
|
return null;
|
|
1463
1461
|
}
|
|
@@ -1474,11 +1472,11 @@ var ACCOUNT_CHOICE_REFUSALS = /* @__PURE__ */ new Set([
|
|
|
1474
1472
|
"accountId is required",
|
|
1475
1473
|
"you do not have access to this account"
|
|
1476
1474
|
]);
|
|
1477
|
-
function responseError(status,
|
|
1478
|
-
const parsed =
|
|
1475
|
+
function responseError(status, text2) {
|
|
1476
|
+
const parsed = text2 ? failureSentence(text2) : null;
|
|
1479
1477
|
const sentence = parsed && ACCOUNT_CHOICE_REFUSALS.has(parsed) ? CHOOSE_ACCOUNT_HINT : parsed;
|
|
1480
1478
|
return new Error(
|
|
1481
|
-
`remote simulator request failed (${status})${sentence ? `: ${sentence}` :
|
|
1479
|
+
`remote simulator request failed (${status})${sentence ? `: ${sentence}` : text2.trim() ? `: ${text2.trim()}` : ""}`
|
|
1482
1480
|
);
|
|
1483
1481
|
}
|
|
1484
1482
|
function resolveCloudSessionForParsed(parsed) {
|
|
@@ -1546,11 +1544,11 @@ var CloudBridge = class {
|
|
|
1546
1544
|
`could not reach the remote simulator at ${this.session.apiOrigin}: ${error instanceof Error ? error.message : String(error)}`
|
|
1547
1545
|
);
|
|
1548
1546
|
}
|
|
1549
|
-
const
|
|
1550
|
-
if (!response.ok) throw responseError(response.status,
|
|
1547
|
+
const text2 = await response.text();
|
|
1548
|
+
if (!response.ok) throw responseError(response.status, text2);
|
|
1551
1549
|
let parsed;
|
|
1552
1550
|
try {
|
|
1553
|
-
parsed = JSON.parse(
|
|
1551
|
+
parsed = JSON.parse(text2);
|
|
1554
1552
|
} catch {
|
|
1555
1553
|
throw new Error("remote simulator command returned unreadable JSON");
|
|
1556
1554
|
}
|
|
@@ -1617,11 +1615,11 @@ var CloudBoxBridge = class {
|
|
|
1617
1615
|
`could not reach box ${this.session.boxId} at ${this.session.apiOrigin}: ${error instanceof Error ? error.message : String(error)}`
|
|
1618
1616
|
);
|
|
1619
1617
|
}
|
|
1620
|
-
const
|
|
1621
|
-
if (!response.ok) throw responseError(response.status,
|
|
1618
|
+
const text2 = await response.text();
|
|
1619
|
+
if (!response.ok) throw responseError(response.status, text2);
|
|
1622
1620
|
let parsed;
|
|
1623
1621
|
try {
|
|
1624
|
-
parsed = JSON.parse(
|
|
1622
|
+
parsed = JSON.parse(text2);
|
|
1625
1623
|
} catch {
|
|
1626
1624
|
throw new Error("box command returned unreadable JSON");
|
|
1627
1625
|
}
|
|
@@ -2499,8 +2497,8 @@ function formatSemanticTree(nodes, opts = {}) {
|
|
|
2499
2497
|
node.role ? `[${node.role}]` : node.pressable ? "[tap]" : `<${node.type}>`
|
|
2500
2498
|
];
|
|
2501
2499
|
if (node.text) {
|
|
2502
|
-
const
|
|
2503
|
-
parts.push(JSON.stringify(
|
|
2500
|
+
const text2 = opts.fullText || node.text.length <= 50 ? node.text : `${node.text.slice(0, 49).trimEnd()}\u2026`;
|
|
2501
|
+
parts.push(JSON.stringify(text2));
|
|
2504
2502
|
}
|
|
2505
2503
|
if (node.testID) parts.push(`#${node.testID}`);
|
|
2506
2504
|
if (node.label && node.label !== node.text) {
|
|
@@ -2913,8 +2911,8 @@ function isPeachAccessibilityTree(value) {
|
|
|
2913
2911
|
if (field !== void 0 && (typeof field !== "number" || !Number.isFinite(field)))
|
|
2914
2912
|
return false;
|
|
2915
2913
|
}
|
|
2916
|
-
const
|
|
2917
|
-
if (
|
|
2914
|
+
const text2 = Reflect.get(value2, "text");
|
|
2915
|
+
if (text2 !== void 0 && typeof text2 !== "string") return false;
|
|
2918
2916
|
}
|
|
2919
2917
|
if (!isSemanticGeometry(Reflect.get(node, "frame"))) return false;
|
|
2920
2918
|
return isPeachAccessibilityTree(Reflect.get(node, "children"));
|
|
@@ -3114,9 +3112,9 @@ async function inspectLogs(bridge) {
|
|
|
3114
3112
|
const recentLogs = state && typeof state === "object" && Array.isArray(Reflect.get(state, "recentLogs")) ? Reflect.get(state, "recentLogs") : [];
|
|
3115
3113
|
return recentLogs.flatMap((entry, index) => {
|
|
3116
3114
|
if (!entry || typeof entry !== "object") return [];
|
|
3117
|
-
const
|
|
3115
|
+
const text2 = Reflect.get(entry, "text");
|
|
3118
3116
|
const rawLevel = Reflect.get(entry, "level");
|
|
3119
|
-
if (typeof
|
|
3117
|
+
if (typeof text2 !== "string") return [];
|
|
3120
3118
|
const level = rawLevel === "log" || rawLevel === "info" || rawLevel === "warn" || rawLevel === "error" || rawLevel === "debug" ? rawLevel : "error";
|
|
3121
3119
|
const at = Reflect.get(entry, "at");
|
|
3122
3120
|
const ts = typeof at === "number" && Number.isFinite(at) ? at : 0;
|
|
@@ -3126,7 +3124,7 @@ async function inspectLogs(bridge) {
|
|
|
3126
3124
|
source: "peach-cloud",
|
|
3127
3125
|
level,
|
|
3128
3126
|
ts,
|
|
3129
|
-
args: [
|
|
3127
|
+
args: [text2],
|
|
3130
3128
|
stack: null
|
|
3131
3129
|
}
|
|
3132
3130
|
];
|
|
@@ -3632,14 +3630,14 @@ function payloadFromResolved(resolved, match, extra = {}) {
|
|
|
3632
3630
|
function collectTextCandidates(nodes, ancestors = [], pressableOwnerText = "", actionableAncestor = false, actionableRole) {
|
|
3633
3631
|
const out = [];
|
|
3634
3632
|
for (const node of nodes) {
|
|
3635
|
-
const
|
|
3636
|
-
const caption = !!
|
|
3633
|
+
const text2 = nodeText(node);
|
|
3634
|
+
const caption = !!text2 && text2 === pressableOwnerText && !node.pressable;
|
|
3637
3635
|
const actionable = !!node.pressable || actionableAncestor;
|
|
3638
3636
|
const role = node.role ?? actionableRole;
|
|
3639
3637
|
if (!caption) out.push({ node, ancestorTestIDs: ancestors, actionable, role });
|
|
3640
3638
|
if (node.children?.length) {
|
|
3641
3639
|
const next = node.testID ? [...ancestors, node.testID] : ancestors;
|
|
3642
|
-
const owner =
|
|
3640
|
+
const owner = text2 ? node.pressable ? text2 : "" : pressableOwnerText;
|
|
3643
3641
|
out.push(
|
|
3644
3642
|
...collectTextCandidates(
|
|
3645
3643
|
node.children,
|
|
@@ -3681,9 +3679,9 @@ async function resolveTextTapTarget(bridge, query, options = {}) {
|
|
|
3681
3679
|
const needle = options.exact ? query : query.toLowerCase();
|
|
3682
3680
|
let candidates = collectTextCandidates(tree).filter(
|
|
3683
3681
|
({ node: node2, ancestorTestIDs, role }) => {
|
|
3684
|
-
const
|
|
3685
|
-
if (!
|
|
3686
|
-
if (options.exact ?
|
|
3682
|
+
const text2 = nodeText(node2);
|
|
3683
|
+
if (!text2) return false;
|
|
3684
|
+
if (options.exact ? text2 !== needle : !text2.toLowerCase().includes(needle)) {
|
|
3687
3685
|
return false;
|
|
3688
3686
|
}
|
|
3689
3687
|
if (options.role && role !== options.role) return false;
|
|
@@ -4103,8 +4101,8 @@ var SimClient = class {
|
|
|
4103
4101
|
return this.throwUnlessTapped(await tapById(this, target.testId), target.testId);
|
|
4104
4102
|
}
|
|
4105
4103
|
if (isTextTapTarget(target)) {
|
|
4106
|
-
const { text, ...textOpts } = target;
|
|
4107
|
-
return this.throwUnlessTapped(await tapByText(this,
|
|
4104
|
+
const { text: text2, ...textOpts } = target;
|
|
4105
|
+
return this.throwUnlessTapped(await tapByText(this, text2, textOpts), text2);
|
|
4108
4106
|
}
|
|
4109
4107
|
if ("testID" in target && typeof target.testID === "string" && typeof target.nodeId !== "number") {
|
|
4110
4108
|
return this.throwUnlessTapped(await tapById(this, target.testID), target.testID);
|
|
@@ -4138,9 +4136,9 @@ var SimClient = class {
|
|
|
4138
4136
|
}
|
|
4139
4137
|
}
|
|
4140
4138
|
/** type through the visual iOS keyboard. requires a focused input. */
|
|
4141
|
-
async type(
|
|
4139
|
+
async type(text2) {
|
|
4142
4140
|
await this.requireVisibleKeyboard("type");
|
|
4143
|
-
await this.send({ type: "keyboard", action: "type", text });
|
|
4141
|
+
await this.send({ type: "keyboard", action: "type", text: text2 });
|
|
4144
4142
|
}
|
|
4145
4143
|
/** press a keyboard key ('return', 'delete', 'space', …). */
|
|
4146
4144
|
async press(key) {
|
|
@@ -5347,7 +5345,7 @@ function appTargetReleaseSettings(pbxproj, targetName, infoPlistRelativePath) {
|
|
|
5347
5345
|
}
|
|
5348
5346
|
function nativeAppIdentityFromIos(files, parseInfoPlist) {
|
|
5349
5347
|
const pbxprojPath = Object.keys(files).find(
|
|
5350
|
-
(
|
|
5348
|
+
(path14) => /(?:^|\/)ios\/[^/]+\.xcodeproj\/project\.pbxproj$/.test(path14)
|
|
5351
5349
|
);
|
|
5352
5350
|
if (!pbxprojPath) return null;
|
|
5353
5351
|
const pbxproj = files[pbxprojPath];
|
|
@@ -5359,7 +5357,7 @@ function nativeAppIdentityFromIos(files, parseInfoPlist) {
|
|
|
5359
5357
|
].map((match) => match[1])
|
|
5360
5358
|
);
|
|
5361
5359
|
const appDelegatePattern = /(?:^|\/)ios\/([^/]+)\/AppDelegate\.(?:swift|mm|m)$/;
|
|
5362
|
-
const targetName = Object.keys(files).filter((
|
|
5360
|
+
const targetName = Object.keys(files).filter((path14) => !path14.includes("/Pods/")).map((path14) => path14.match(appDelegatePattern)?.[1]).find((name2) => name2 !== void 0 && applicationTargets.has(name2)) ?? null;
|
|
5363
5361
|
if (!targetName) return null;
|
|
5364
5362
|
const plist3 = files[`ios/${targetName}/Info.plist`];
|
|
5365
5363
|
if (!plist3) return null;
|
|
@@ -5436,7 +5434,7 @@ function extractNativeAppIdentityFromFiles(files, platform, parseInfoPlist) {
|
|
|
5436
5434
|
// src/native-firebase-config.ts
|
|
5437
5435
|
var import_node_fs8 = __toESM(require("node:fs"), 1);
|
|
5438
5436
|
var import_node_module2 = require("node:module");
|
|
5439
|
-
var
|
|
5437
|
+
var import_node_path9 = __toESM(require("node:path"), 1);
|
|
5440
5438
|
init_is_record();
|
|
5441
5439
|
|
|
5442
5440
|
// src/plist.ts
|
|
@@ -5447,7 +5445,7 @@ function parsePlistSource(source) {
|
|
|
5447
5445
|
|
|
5448
5446
|
// src/xcode-project.ts
|
|
5449
5447
|
var import_node_fs7 = __toESM(require("node:fs"), 1);
|
|
5450
|
-
var
|
|
5448
|
+
var import_node_path8 = __toESM(require("node:path"), 1);
|
|
5451
5449
|
var import_plist2 = __toESM(require_plist(), 1);
|
|
5452
5450
|
|
|
5453
5451
|
// src/swift-package.ts
|
|
@@ -5506,7 +5504,7 @@ var NAME = /\bname\s*:\s*"([^"]+)"/;
|
|
|
5506
5504
|
function listArgument(call, label) {
|
|
5507
5505
|
const start = new RegExp(`\\b${label}\\s*:\\s*\\[`).exec(call);
|
|
5508
5506
|
if (!start) return [];
|
|
5509
|
-
const
|
|
5507
|
+
const items2 = [];
|
|
5510
5508
|
let depth = 0;
|
|
5511
5509
|
let inString = false;
|
|
5512
5510
|
let item = "";
|
|
@@ -5523,14 +5521,14 @@ function listArgument(call, label) {
|
|
|
5523
5521
|
if (depth === 0) break;
|
|
5524
5522
|
depth--;
|
|
5525
5523
|
} else if (ch === "," && depth === 0) {
|
|
5526
|
-
|
|
5524
|
+
items2.push(item.trim());
|
|
5527
5525
|
item = "";
|
|
5528
5526
|
continue;
|
|
5529
5527
|
}
|
|
5530
5528
|
item += ch;
|
|
5531
5529
|
}
|
|
5532
|
-
if (item.trim())
|
|
5533
|
-
return
|
|
5530
|
+
if (item.trim()) items2.push(item.trim());
|
|
5531
|
+
return items2;
|
|
5534
5532
|
}
|
|
5535
5533
|
function swiftPackageIdentity(url) {
|
|
5536
5534
|
return (url.split("/").pop() ?? url).replace(/\.git$/, "").toLowerCase();
|
|
@@ -5613,24 +5611,357 @@ function swiftManifestGraph(manifest) {
|
|
|
5613
5611
|
return graph;
|
|
5614
5612
|
}
|
|
5615
5613
|
|
|
5614
|
+
// src/xcode-json-project.ts
|
|
5615
|
+
var import_node_path7 = __toESM(require("node:path"), 1);
|
|
5616
|
+
var import_json52 = __toESM(require("json5"), 1);
|
|
5617
|
+
var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5618
|
+
var text = (value) => typeof value === "string" ? value : void 0;
|
|
5619
|
+
var items = (value) => Array.isArray(value) ? value : [];
|
|
5620
|
+
var PHASE_ISA = {
|
|
5621
|
+
"compile-sources": "PBXSourcesBuildPhase",
|
|
5622
|
+
resources: "PBXResourcesBuildPhase",
|
|
5623
|
+
frameworks: "PBXFrameworksBuildPhase",
|
|
5624
|
+
headers: "PBXHeadersBuildPhase",
|
|
5625
|
+
copy: "PBXCopyFilesBuildPhase",
|
|
5626
|
+
script: "PBXShellScriptBuildPhase"
|
|
5627
|
+
};
|
|
5628
|
+
function readXcodeJsonProject(xcodeproj, source) {
|
|
5629
|
+
const json = import_json52.default.parse(source);
|
|
5630
|
+
if (!isJsonObject(json)) throw new Error(`${xcodeproj}/project.xcproj is not an object`);
|
|
5631
|
+
const projectDir = import_node_path7.default.dirname(xcodeproj);
|
|
5632
|
+
const objects = {};
|
|
5633
|
+
let next = 0;
|
|
5634
|
+
const add = (entry, id) => {
|
|
5635
|
+
const key = id ?? `XCPROJ${(next++).toString(16).toUpperCase().padStart(18, "0")}`;
|
|
5636
|
+
objects[key] = entry;
|
|
5637
|
+
return key;
|
|
5638
|
+
};
|
|
5639
|
+
const locate = (raw, groupDir) => {
|
|
5640
|
+
if (raw.startsWith("<USER:")) return null;
|
|
5641
|
+
const base = /^<([A-Z]+)>\/(.*)$/.exec(raw);
|
|
5642
|
+
if (base) {
|
|
5643
|
+
if (base[1] === "PROJECT")
|
|
5644
|
+
return { sourceTree: "<absolute>", path: import_node_path7.default.join(projectDir, base[2]) };
|
|
5645
|
+
if (base[1] === "PRODUCTS")
|
|
5646
|
+
return { sourceTree: "BUILT_PRODUCTS_DIR", path: base[2] };
|
|
5647
|
+
return null;
|
|
5648
|
+
}
|
|
5649
|
+
const unescaped = raw.replaceAll("\\<", "<");
|
|
5650
|
+
if (unescaped.startsWith("/")) return { sourceTree: "<absolute>", path: unescaped };
|
|
5651
|
+
if (unescaped.startsWith("~")) return null;
|
|
5652
|
+
return groupDir === null ? null : { sourceTree: "<absolute>", path: import_node_path7.default.join(groupDir, unescaped) };
|
|
5653
|
+
};
|
|
5654
|
+
const memberships = [];
|
|
5655
|
+
const folders = [];
|
|
5656
|
+
const projectFiles = [];
|
|
5657
|
+
const root = { id: "", name: "", dir: projectDir, parent: null, children: [] };
|
|
5658
|
+
const walk = (entries, parent) => entries.flatMap((entry) => {
|
|
5659
|
+
if (!isObject(entry)) return [];
|
|
5660
|
+
const kind = text(entry.kind) ?? "file-reference";
|
|
5661
|
+
const raw = text(entry.path) ?? "";
|
|
5662
|
+
const located = raw === "" ? null : locate(raw, parent.dir);
|
|
5663
|
+
const name2 = text(entry.name) ?? import_node_path7.default.basename(raw);
|
|
5664
|
+
const node = { id: "", name: name2, dir: null, parent, children: [] };
|
|
5665
|
+
if (kind === "group" || kind === "variant-group" || kind === "version-group") {
|
|
5666
|
+
node.dir = raw === "" ? parent.dir : located?.sourceTree === "<absolute>" ? located.path : null;
|
|
5667
|
+
const childIds = walk(items(entry.children), node);
|
|
5668
|
+
node.id = add(
|
|
5669
|
+
kind === "version-group" && located ? {
|
|
5670
|
+
isa: "PBXFileReference",
|
|
5671
|
+
...located,
|
|
5672
|
+
lastKnownFileType: "wrapper.xcdatamodel"
|
|
5673
|
+
} : {
|
|
5674
|
+
isa: kind === "variant-group" ? "PBXVariantGroup" : "PBXGroup",
|
|
5675
|
+
children: childIds,
|
|
5676
|
+
...kind === "variant-group" ? {} : { sourceTree: "<absolute>", path: node.dir ?? "" },
|
|
5677
|
+
name: name2
|
|
5678
|
+
},
|
|
5679
|
+
text(entry.id)
|
|
5680
|
+
);
|
|
5681
|
+
} else if (kind === "folder") {
|
|
5682
|
+
node.id = add(
|
|
5683
|
+
{
|
|
5684
|
+
isa: "PBXFileSystemSynchronizedRootGroup",
|
|
5685
|
+
...located ?? { sourceTree: "SDKROOT", path: raw }
|
|
5686
|
+
},
|
|
5687
|
+
text(entry.id)
|
|
5688
|
+
);
|
|
5689
|
+
folders.push({ id: node.id, folder: entry });
|
|
5690
|
+
} else {
|
|
5691
|
+
node.id = add(
|
|
5692
|
+
{
|
|
5693
|
+
isa: "PBXFileReference",
|
|
5694
|
+
...located ?? { sourceTree: "SDKROOT", path: raw },
|
|
5695
|
+
name: name2
|
|
5696
|
+
},
|
|
5697
|
+
text(entry.id)
|
|
5698
|
+
);
|
|
5699
|
+
if (located?.sourceTree === "<absolute>" && located.path.endsWith(".xcodeproj"))
|
|
5700
|
+
projectFiles.push(node.id);
|
|
5701
|
+
}
|
|
5702
|
+
parent.children.push(node);
|
|
5703
|
+
for (const membership of items(entry["target-membership"])) {
|
|
5704
|
+
if (kind !== "folder") memberships.push({ refId: node.id, entry: membership });
|
|
5705
|
+
}
|
|
5706
|
+
return [node.id];
|
|
5707
|
+
});
|
|
5708
|
+
const mainGroupChildren = walk(items(json.files), root);
|
|
5709
|
+
const mainGroup = add({
|
|
5710
|
+
isa: "PBXGroup",
|
|
5711
|
+
children: mainGroupChildren,
|
|
5712
|
+
sourceTree: "<absolute>",
|
|
5713
|
+
path: projectDir
|
|
5714
|
+
});
|
|
5715
|
+
root.id = mainGroup;
|
|
5716
|
+
const lookup = (reference, from = root) => {
|
|
5717
|
+
if (isObject(reference)) {
|
|
5718
|
+
const anchor = lookupNode(reference.anchor, root);
|
|
5719
|
+
return anchor ? lookup(reference["relative-path"], anchor) : void 0;
|
|
5720
|
+
}
|
|
5721
|
+
if (Array.isArray(reference)) {
|
|
5722
|
+
return lookupNode(
|
|
5723
|
+
reference.map(
|
|
5724
|
+
(component) => isObject(component) ? text(component.name) ?? "" : text(component) ?? ""
|
|
5725
|
+
).join("/"),
|
|
5726
|
+
from
|
|
5727
|
+
)?.id;
|
|
5728
|
+
}
|
|
5729
|
+
return lookupNode(reference, from)?.id;
|
|
5730
|
+
};
|
|
5731
|
+
const lookupNode = (reference, from) => {
|
|
5732
|
+
const value = text(reference);
|
|
5733
|
+
if (value === void 0) return void 0;
|
|
5734
|
+
if (value.startsWith("id:")) {
|
|
5735
|
+
const id = value.slice(3);
|
|
5736
|
+
const find = (node2) => node2.id === id ? node2 : node2.children.map(find).find(Boolean);
|
|
5737
|
+
return find(root);
|
|
5738
|
+
}
|
|
5739
|
+
let node = from;
|
|
5740
|
+
for (const component of value.split("/")) {
|
|
5741
|
+
if (!node) return void 0;
|
|
5742
|
+
node = component === "." ? node : component === ".." ? node.parent ?? void 0 : node.children.find((child) => child.name === component);
|
|
5743
|
+
}
|
|
5744
|
+
return node;
|
|
5745
|
+
};
|
|
5746
|
+
const configurations = items(json.configurations).flatMap((entry) => {
|
|
5747
|
+
const name2 = isObject(entry) ? text(entry.name) : text(entry);
|
|
5748
|
+
return name2 ? [{ name: name2, file: isObject(entry) ? entry.file : void 0 }] : [];
|
|
5749
|
+
});
|
|
5750
|
+
const settingsOf = (value) => Object.fromEntries(
|
|
5751
|
+
Object.entries(isObject(value) ? value : {}).flatMap(
|
|
5752
|
+
([key, setting]) => typeof setting === "string" ? [[key, setting]] : Array.isArray(setting) ? [
|
|
5753
|
+
[
|
|
5754
|
+
key,
|
|
5755
|
+
setting.filter((item) => typeof item === "string")
|
|
5756
|
+
]
|
|
5757
|
+
] : []
|
|
5758
|
+
)
|
|
5759
|
+
);
|
|
5760
|
+
const configurationList = (settings, specialized) => add({
|
|
5761
|
+
isa: "XCConfigurationList",
|
|
5762
|
+
defaultConfigurationName: text(json["default-configuration"]) ?? "Debug",
|
|
5763
|
+
buildConfigurations: configurations.map(({ name: name2, file }) => {
|
|
5764
|
+
const base = lookup(specialized.has(name2) ? specialized.get(name2) : file);
|
|
5765
|
+
return add({
|
|
5766
|
+
isa: "XCBuildConfiguration",
|
|
5767
|
+
name: name2,
|
|
5768
|
+
buildSettings: settings,
|
|
5769
|
+
...base ? { baseConfigurationReference: base } : {}
|
|
5770
|
+
});
|
|
5771
|
+
})
|
|
5772
|
+
});
|
|
5773
|
+
const packageIds = /* @__PURE__ */ new Map();
|
|
5774
|
+
for (const entry of items(json.packages)) {
|
|
5775
|
+
if (!isObject(entry)) continue;
|
|
5776
|
+
const repository = text(entry.repository);
|
|
5777
|
+
const local = text(entry.path);
|
|
5778
|
+
const name2 = local !== void 0 ? import_node_path7.default.basename(import_node_path7.default.resolve(import_node_path7.default.dirname(xcodeproj), local)) : import_node_path7.default.basename(repository ?? "").replace(/\.git$/, "");
|
|
5779
|
+
const id = text(entry.kind) === "local" && local !== void 0 ? add({ isa: "XCLocalSwiftPackageReference", relativePath: local }) : add({ isa: "XCRemoteSwiftPackageReference", repositoryURL: repository ?? "" });
|
|
5780
|
+
packageIds.set(name2.toLowerCase(), id);
|
|
5781
|
+
}
|
|
5782
|
+
const productDependency = (entry) => add({
|
|
5783
|
+
isa: "XCSwiftPackageProductDependency",
|
|
5784
|
+
productName: text(entry["product-name"]) ?? "",
|
|
5785
|
+
// xcode finds a product by name across packages when none is named
|
|
5786
|
+
...packageIds.has(text(entry.package)?.toLowerCase() ?? "") ? { package: packageIds.get(text(entry.package).toLowerCase()) } : {}
|
|
5787
|
+
});
|
|
5788
|
+
const proxy = (entry, remote, proxyType) => add({
|
|
5789
|
+
isa: "PBXContainerItemProxy",
|
|
5790
|
+
containerPortal: lookup(entry.project) ?? "",
|
|
5791
|
+
proxyType,
|
|
5792
|
+
remoteGlobalIDString: remote ?? "",
|
|
5793
|
+
remoteInfo: text(entry.target) ?? ""
|
|
5794
|
+
});
|
|
5795
|
+
const phases = /* @__PURE__ */ new Map();
|
|
5796
|
+
const targetIds = /* @__PURE__ */ new Map();
|
|
5797
|
+
const targets = [];
|
|
5798
|
+
for (const entry of items(json.targets)) {
|
|
5799
|
+
if (!isObject(entry)) continue;
|
|
5800
|
+
const name2 = text(entry.name) ?? "";
|
|
5801
|
+
const productType = text(entry["product-type"]);
|
|
5802
|
+
const target = {
|
|
5803
|
+
isa: text(entry.kind) === "aggregate" ? "PBXAggregateTarget" : "PBXNativeTarget",
|
|
5804
|
+
name: name2,
|
|
5805
|
+
productName: name2,
|
|
5806
|
+
productType: productType ? `com.apple.product-type.${productType}` : text(entry["full-product-type"]) ?? "",
|
|
5807
|
+
buildPhases: [],
|
|
5808
|
+
dependencies: [],
|
|
5809
|
+
packageProductDependencies: [],
|
|
5810
|
+
fileSystemSynchronizedGroups: []
|
|
5811
|
+
};
|
|
5812
|
+
const product = lookup(entry.product);
|
|
5813
|
+
if (product) target.productReference = product;
|
|
5814
|
+
const id = add(target, text(entry.id));
|
|
5815
|
+
targetIds.set(name2, id);
|
|
5816
|
+
targets.push({ id, target, entry });
|
|
5817
|
+
for (const phase of items(entry["build-phases"])) {
|
|
5818
|
+
const kind = isObject(phase) ? text(phase.kind) : text(phase);
|
|
5819
|
+
const isa = kind ? PHASE_ISA[kind] : void 0;
|
|
5820
|
+
if (!kind || !isa) continue;
|
|
5821
|
+
const phaseName = isObject(phase) ? text(phase.name) : void 0;
|
|
5822
|
+
const phaseId = add(
|
|
5823
|
+
{ isa, files: [] },
|
|
5824
|
+
isObject(phase) ? text(phase.id) : void 0
|
|
5825
|
+
);
|
|
5826
|
+
target.buildPhases.push(phaseId);
|
|
5827
|
+
phases.set([name2, kind, phaseName].filter(Boolean).join("/"), phaseId);
|
|
5828
|
+
phases.set(`id:${phaseId}`, phaseId);
|
|
5829
|
+
}
|
|
5830
|
+
}
|
|
5831
|
+
const phaseFiles = (reference, targetName) => {
|
|
5832
|
+
const value = text(reference);
|
|
5833
|
+
if (value === void 0) return null;
|
|
5834
|
+
const key = value.startsWith("id:") || !targetName ? value : `${targetName}/${value}`;
|
|
5835
|
+
const phase = objects[phases.get(key) ?? ""];
|
|
5836
|
+
return phase && typeof phase === "object" && !Array.isArray(phase) && Array.isArray(phase.files) ? phase.files : null;
|
|
5837
|
+
};
|
|
5838
|
+
for (const { refId, entry } of memberships) {
|
|
5839
|
+
const files = phaseFiles(isObject(entry) ? entry["build-phase"] : entry);
|
|
5840
|
+
files?.push(add({ isa: "PBXBuildFile", fileRef: refId }));
|
|
5841
|
+
}
|
|
5842
|
+
for (const { target, entry } of targets) {
|
|
5843
|
+
const name2 = text(entry.name) ?? "";
|
|
5844
|
+
target.buildConfigurationList = configurationList(
|
|
5845
|
+
settingsOf(entry["build-settings"]),
|
|
5846
|
+
new Map(
|
|
5847
|
+
items(entry["specialized-configurations"]).flatMap(
|
|
5848
|
+
(configuration) => isObject(configuration) && text(configuration.name) ? [[text(configuration.name), configuration.file]] : []
|
|
5849
|
+
)
|
|
5850
|
+
)
|
|
5851
|
+
);
|
|
5852
|
+
for (const dependency of items(entry.dependencies)) {
|
|
5853
|
+
const kind = isObject(dependency) ? text(dependency.kind) ?? "localTarget" : "localTarget";
|
|
5854
|
+
if (kind === "package" && isObject(dependency)) {
|
|
5855
|
+
;
|
|
5856
|
+
target.dependencies.push(
|
|
5857
|
+
add({ isa: "PBXTargetDependency", productRef: productDependency(dependency) })
|
|
5858
|
+
);
|
|
5859
|
+
} else if (kind === "remoteTarget" && isObject(dependency)) {
|
|
5860
|
+
;
|
|
5861
|
+
target.dependencies.push(
|
|
5862
|
+
add({
|
|
5863
|
+
isa: "PBXTargetDependency",
|
|
5864
|
+
targetProxy: proxy(dependency, text(dependency["target-id"]), "1")
|
|
5865
|
+
})
|
|
5866
|
+
);
|
|
5867
|
+
} else {
|
|
5868
|
+
const local = isObject(dependency) ? text(dependency.target) : text(dependency);
|
|
5869
|
+
const id = local ? targetIds.get(local) : void 0;
|
|
5870
|
+
if (id)
|
|
5871
|
+
target.dependencies.push(
|
|
5872
|
+
add({ isa: "PBXTargetDependency", target: id })
|
|
5873
|
+
);
|
|
5874
|
+
}
|
|
5875
|
+
}
|
|
5876
|
+
for (const member of items(entry["package-product-members"])) {
|
|
5877
|
+
if (!isObject(member)) continue;
|
|
5878
|
+
const dependency = productDependency(member);
|
|
5879
|
+
target.packageProductDependencies.push(dependency);
|
|
5880
|
+
const buildFile = member["build-phase"];
|
|
5881
|
+
phaseFiles(isObject(buildFile) ? buildFile["build-phase"] : buildFile, name2)?.push(
|
|
5882
|
+
add({ isa: "PBXBuildFile", productRef: dependency })
|
|
5883
|
+
);
|
|
5884
|
+
}
|
|
5885
|
+
}
|
|
5886
|
+
for (const imported of items(json["imported-products"])) {
|
|
5887
|
+
if (!isObject(imported)) continue;
|
|
5888
|
+
const reference = add({
|
|
5889
|
+
isa: "PBXReferenceProxy",
|
|
5890
|
+
path: text(imported.name) ?? text(imported.path) ?? "",
|
|
5891
|
+
sourceTree: "BUILT_PRODUCTS_DIR",
|
|
5892
|
+
remoteRef: proxy(imported, text(imported["product-id"]), "2")
|
|
5893
|
+
});
|
|
5894
|
+
for (const membership of items(imported["target-membership"])) {
|
|
5895
|
+
phaseFiles(isObject(membership) ? membership["build-phase"] : membership)?.push(
|
|
5896
|
+
add({ isa: "PBXBuildFile", fileRef: reference })
|
|
5897
|
+
);
|
|
5898
|
+
}
|
|
5899
|
+
}
|
|
5900
|
+
for (const { id, folder } of folders) {
|
|
5901
|
+
const exceptions = [];
|
|
5902
|
+
for (const exception of items(folder["membership-exceptions"])) {
|
|
5903
|
+
if (!isObject(exception)) continue;
|
|
5904
|
+
const target = targetIds.get(text(exception.target) ?? "");
|
|
5905
|
+
if (!target) continue;
|
|
5906
|
+
exceptions.push(
|
|
5907
|
+
add({
|
|
5908
|
+
isa: "PBXFileSystemSynchronizedBuildFileExceptionSet",
|
|
5909
|
+
target,
|
|
5910
|
+
membershipExceptions: [
|
|
5911
|
+
...items(exception.exclusions),
|
|
5912
|
+
...items(exception.inclusions)
|
|
5913
|
+
].flatMap((member) => typeof member === "string" ? [member] : [])
|
|
5914
|
+
})
|
|
5915
|
+
);
|
|
5916
|
+
}
|
|
5917
|
+
const group = objects[id];
|
|
5918
|
+
if (group && typeof group === "object" && !Array.isArray(group))
|
|
5919
|
+
group.exceptions = exceptions;
|
|
5920
|
+
for (const owner of items(folder["target-membership"])) {
|
|
5921
|
+
const target = targets.find(
|
|
5922
|
+
(candidate) => candidate.id === targetIds.get(text(owner) ?? "")
|
|
5923
|
+
);
|
|
5924
|
+
target?.target.fileSystemSynchronizedGroups?.push(id);
|
|
5925
|
+
}
|
|
5926
|
+
}
|
|
5927
|
+
const localizations = isObject(json.localizations) ? json.localizations : {};
|
|
5928
|
+
const project = add({
|
|
5929
|
+
isa: "PBXProject",
|
|
5930
|
+
mainGroup,
|
|
5931
|
+
projectDirPath: "",
|
|
5932
|
+
developmentRegion: text(localizations.development) ?? "en",
|
|
5933
|
+
buildConfigurationList: configurationList(
|
|
5934
|
+
settingsOf(json["build-settings"]),
|
|
5935
|
+
/* @__PURE__ */ new Map()
|
|
5936
|
+
),
|
|
5937
|
+
targets: targets.map((entry) => entry.id),
|
|
5938
|
+
packageReferences: [...packageIds.values()],
|
|
5939
|
+
projectReferences: projectFiles.map((ProjectRef) => ({ ProjectRef }))
|
|
5940
|
+
});
|
|
5941
|
+
return { objects, rootObject: project };
|
|
5942
|
+
}
|
|
5943
|
+
function isJsonObject(value) {
|
|
5944
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5945
|
+
}
|
|
5946
|
+
|
|
5616
5947
|
// src/xcode-project.ts
|
|
5617
|
-
function parseOpenStepPlist(
|
|
5948
|
+
function parseOpenStepPlist(text2) {
|
|
5618
5949
|
let i = 0;
|
|
5619
5950
|
const fail = (message) => {
|
|
5620
|
-
const line =
|
|
5951
|
+
const line = text2.slice(0, i).split("\n").length;
|
|
5621
5952
|
throw new Error(`project.pbxproj line ${line}: ${message}`);
|
|
5622
5953
|
};
|
|
5623
5954
|
const skip = () => {
|
|
5624
5955
|
for (; ; ) {
|
|
5625
|
-
const ch =
|
|
5956
|
+
const ch = text2[i];
|
|
5626
5957
|
if (ch === " " || ch === " " || ch === "\n" || ch === "\r") i++;
|
|
5627
|
-
else if (ch === "/" &&
|
|
5628
|
-
const end =
|
|
5958
|
+
else if (ch === "/" && text2[i + 1] === "*") {
|
|
5959
|
+
const end = text2.indexOf("*/", i + 2);
|
|
5629
5960
|
if (end < 0) fail("unterminated comment");
|
|
5630
5961
|
i = end + 2;
|
|
5631
|
-
} else if (ch === "/" &&
|
|
5632
|
-
const end =
|
|
5633
|
-
i = end < 0 ?
|
|
5962
|
+
} else if (ch === "/" && text2[i + 1] === "/") {
|
|
5963
|
+
const end = text2.indexOf("\n", i);
|
|
5964
|
+
i = end < 0 ? text2.length : end + 1;
|
|
5634
5965
|
} else return;
|
|
5635
5966
|
}
|
|
5636
5967
|
};
|
|
@@ -5638,42 +5969,42 @@ function parseOpenStepPlist(text) {
|
|
|
5638
5969
|
i++;
|
|
5639
5970
|
let out = "";
|
|
5640
5971
|
for (; ; ) {
|
|
5641
|
-
const ch =
|
|
5972
|
+
const ch = text2[i++];
|
|
5642
5973
|
if (ch === void 0) fail("unterminated string");
|
|
5643
5974
|
if (ch === '"') return out;
|
|
5644
5975
|
if (ch !== "\\") {
|
|
5645
5976
|
out += ch;
|
|
5646
5977
|
continue;
|
|
5647
5978
|
}
|
|
5648
|
-
const next =
|
|
5979
|
+
const next = text2[i++];
|
|
5649
5980
|
if (next === "n") out += "\n";
|
|
5650
5981
|
else if (next === "t") out += " ";
|
|
5651
5982
|
else if (next === "r") out += "\r";
|
|
5652
5983
|
else if (next === "U") {
|
|
5653
|
-
out += String.fromCharCode(parseInt(
|
|
5984
|
+
out += String.fromCharCode(parseInt(text2.slice(i, i + 4), 16));
|
|
5654
5985
|
i += 4;
|
|
5655
5986
|
} else out += next;
|
|
5656
5987
|
}
|
|
5657
5988
|
};
|
|
5658
5989
|
const value = () => {
|
|
5659
5990
|
skip();
|
|
5660
|
-
const ch =
|
|
5991
|
+
const ch = text2[i];
|
|
5661
5992
|
if (ch === "{") {
|
|
5662
5993
|
i++;
|
|
5663
5994
|
const dict = {};
|
|
5664
5995
|
for (; ; ) {
|
|
5665
5996
|
skip();
|
|
5666
|
-
if (
|
|
5997
|
+
if (text2[i] === "}") {
|
|
5667
5998
|
i++;
|
|
5668
5999
|
return dict;
|
|
5669
6000
|
}
|
|
5670
6001
|
const key = value();
|
|
5671
6002
|
if (typeof key !== "string") fail("dictionary key is not a string");
|
|
5672
6003
|
skip();
|
|
5673
|
-
if (
|
|
6004
|
+
if (text2[i++] !== "=") fail("expected =");
|
|
5674
6005
|
dict[key] = value();
|
|
5675
6006
|
skip();
|
|
5676
|
-
if (
|
|
6007
|
+
if (text2[i++] !== ";") fail("expected ;");
|
|
5677
6008
|
}
|
|
5678
6009
|
}
|
|
5679
6010
|
if (ch === "(") {
|
|
@@ -5681,26 +6012,26 @@ function parseOpenStepPlist(text) {
|
|
|
5681
6012
|
const list2 = [];
|
|
5682
6013
|
for (; ; ) {
|
|
5683
6014
|
skip();
|
|
5684
|
-
if (
|
|
6015
|
+
if (text2[i] === ")") {
|
|
5685
6016
|
i++;
|
|
5686
6017
|
return list2;
|
|
5687
6018
|
}
|
|
5688
6019
|
list2.push(value());
|
|
5689
6020
|
skip();
|
|
5690
|
-
if (
|
|
5691
|
-
else if (
|
|
6021
|
+
if (text2[i] === ",") i++;
|
|
6022
|
+
else if (text2[i] !== ")") fail("expected , or )");
|
|
5692
6023
|
}
|
|
5693
6024
|
}
|
|
5694
6025
|
if (ch === '"') return quoted();
|
|
5695
6026
|
const start = i;
|
|
5696
|
-
while (i <
|
|
6027
|
+
while (i < text2.length && /[A-Za-z0-9_$+/:.\-<>]/.test(text2[i])) i++;
|
|
5697
6028
|
if (i === start) fail(`unexpected ${JSON.stringify(ch ?? "end of file")}`);
|
|
5698
|
-
return
|
|
6029
|
+
return text2.slice(start, i);
|
|
5699
6030
|
};
|
|
5700
|
-
if (
|
|
6031
|
+
if (text2.startsWith("// !$*UTF8*$!")) i = text2.indexOf("\n") + 1;
|
|
5701
6032
|
const root = value();
|
|
5702
6033
|
skip();
|
|
5703
|
-
if (i !==
|
|
6034
|
+
if (i !== text2.length) fail("trailing content");
|
|
5704
6035
|
return root;
|
|
5705
6036
|
}
|
|
5706
6037
|
var isDict = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -5725,7 +6056,7 @@ function walkFiles(dir) {
|
|
|
5725
6056
|
const out = [];
|
|
5726
6057
|
for (const entry of import_node_fs7.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
|
|
5727
6058
|
if (entry.name.startsWith(".")) continue;
|
|
5728
|
-
const full =
|
|
6059
|
+
const full = import_node_path8.default.join(dir, entry.name);
|
|
5729
6060
|
if (entry.isDirectory()) out.push(...walkFiles(full));
|
|
5730
6061
|
else if (entry.isFile()) out.push(full);
|
|
5731
6062
|
}
|
|
@@ -5742,7 +6073,7 @@ function readXcconfig(file, seen = /* @__PURE__ */ new Set()) {
|
|
|
5742
6073
|
if (include) {
|
|
5743
6074
|
Object.assign(
|
|
5744
6075
|
settings,
|
|
5745
|
-
readXcconfig(
|
|
6076
|
+
readXcconfig(import_node_path8.default.resolve(import_node_path8.default.dirname(file), include[1]), seen)
|
|
5746
6077
|
);
|
|
5747
6078
|
continue;
|
|
5748
6079
|
}
|
|
@@ -5788,22 +6119,22 @@ function applyOperator(value, operator) {
|
|
|
5788
6119
|
}
|
|
5789
6120
|
throw new Error(`unsupported build setting operator :${operator}`);
|
|
5790
6121
|
}
|
|
5791
|
-
function decodeXml(
|
|
5792
|
-
return
|
|
6122
|
+
function decodeXml(text2) {
|
|
6123
|
+
return text2.replaceAll(""", '"').replaceAll("'", "'").replaceAll("<", "<").replaceAll(">", ">").replaceAll("&", "&");
|
|
5793
6124
|
}
|
|
5794
6125
|
function workspaceReferences(workspace) {
|
|
5795
|
-
const data =
|
|
6126
|
+
const data = import_node_path8.default.join(workspace, "contents.xcworkspacedata");
|
|
5796
6127
|
if (!import_node_fs7.default.existsSync(data))
|
|
5797
6128
|
throw new Error(`${workspace} has no contents.xcworkspacedata`);
|
|
5798
|
-
const container =
|
|
6129
|
+
const container = import_node_path8.default.dirname(workspace);
|
|
5799
6130
|
const locate = (location, base) => {
|
|
5800
6131
|
const colon = location.indexOf(":");
|
|
5801
6132
|
const kind = location.slice(0, colon);
|
|
5802
6133
|
const rest = location.slice(colon + 1);
|
|
5803
|
-
if (kind === "group") return
|
|
5804
|
-
if (kind === "container" || kind === "self") return
|
|
5805
|
-
if (kind === "absolute") return
|
|
5806
|
-
throw new Error(`${
|
|
6134
|
+
if (kind === "group") return import_node_path8.default.resolve(base, rest);
|
|
6135
|
+
if (kind === "container" || kind === "self") return import_node_path8.default.resolve(container, rest);
|
|
6136
|
+
if (kind === "absolute") return import_node_path8.default.resolve(rest);
|
|
6137
|
+
throw new Error(`${import_node_path8.default.basename(workspace)} has an unsupported location ${location}`);
|
|
5807
6138
|
};
|
|
5808
6139
|
const groups = [container];
|
|
5809
6140
|
const references = [];
|
|
@@ -5821,15 +6152,24 @@ function workspaceReferences(workspace) {
|
|
|
5821
6152
|
return references;
|
|
5822
6153
|
}
|
|
5823
6154
|
var loaded = /* @__PURE__ */ new Map();
|
|
6155
|
+
function xcodeProjectFile(xcodeproj) {
|
|
6156
|
+
for (const name2 of ["project.pbxproj", "project.xcproj"]) {
|
|
6157
|
+
const file = import_node_path8.default.join(xcodeproj, name2);
|
|
6158
|
+
if (import_node_fs7.default.existsSync(file)) return file;
|
|
6159
|
+
}
|
|
6160
|
+
return null;
|
|
6161
|
+
}
|
|
5824
6162
|
function loadProject(xcodeproj) {
|
|
5825
|
-
const
|
|
5826
|
-
if (!
|
|
5827
|
-
|
|
5828
|
-
const
|
|
6163
|
+
const projectFile = xcodeProjectFile(xcodeproj);
|
|
6164
|
+
if (!projectFile)
|
|
6165
|
+
throw new Error(`${xcodeproj} has no project.pbxproj or project.xcproj`);
|
|
6166
|
+
const mtimeMs = import_node_fs7.default.statSync(projectFile).mtimeMs;
|
|
6167
|
+
const cached2 = loaded.get(projectFile);
|
|
5829
6168
|
if (cached2?.mtimeMs === mtimeMs) return cached2.project;
|
|
5830
|
-
const
|
|
6169
|
+
const source = import_node_fs7.default.readFileSync(projectFile, "utf8");
|
|
6170
|
+
const root = projectFile.endsWith(".xcproj") ? readXcodeJsonProject(xcodeproj, source) : parseOpenStepPlist(source);
|
|
5831
6171
|
if (!isDict(root) || !isDict(root.objects)) {
|
|
5832
|
-
throw new Error(`${
|
|
6172
|
+
throw new Error(`${projectFile} has no objects table`);
|
|
5833
6173
|
}
|
|
5834
6174
|
const objects = root.objects;
|
|
5835
6175
|
const object = (id) => {
|
|
@@ -5838,10 +6178,10 @@ function loadProject(xcodeproj) {
|
|
|
5838
6178
|
};
|
|
5839
6179
|
const project = object(str(root.rootObject));
|
|
5840
6180
|
if (!project || project.isa !== "PBXProject") {
|
|
5841
|
-
throw new Error(`${
|
|
6181
|
+
throw new Error(`${projectFile} has no PBXProject root`);
|
|
5842
6182
|
}
|
|
5843
6183
|
const projectDir = import_node_fs7.default.realpathSync(
|
|
5844
|
-
|
|
6184
|
+
import_node_path8.default.resolve(import_node_path8.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
|
|
5845
6185
|
);
|
|
5846
6186
|
const parent = /* @__PURE__ */ new Map();
|
|
5847
6187
|
for (const [id, entry] of Object.entries(objects)) {
|
|
@@ -5859,18 +6199,26 @@ function loadProject(xcodeproj) {
|
|
|
5859
6199
|
const own = str(entry.path) ?? "";
|
|
5860
6200
|
const tree = str(entry.sourceTree) ?? "<group>";
|
|
5861
6201
|
if (tree === "<absolute>") result2 = own;
|
|
5862
|
-
else if (tree === "SOURCE_ROOT") result2 =
|
|
6202
|
+
else if (tree === "SOURCE_ROOT") result2 = import_node_path8.default.join(projectDir, own);
|
|
5863
6203
|
else if (tree === "<group>") {
|
|
5864
6204
|
const up = parent.get(id);
|
|
5865
6205
|
const base = up ? resolvePath(up) : projectDir;
|
|
5866
|
-
result2 = base === null ? null :
|
|
6206
|
+
result2 = base === null ? null : import_node_path8.default.join(base, own);
|
|
5867
6207
|
}
|
|
5868
6208
|
}
|
|
5869
6209
|
resolvedPaths.set(id, result2);
|
|
5870
6210
|
return result2;
|
|
5871
6211
|
};
|
|
5872
|
-
const result = {
|
|
5873
|
-
|
|
6212
|
+
const result = {
|
|
6213
|
+
xcodeproj,
|
|
6214
|
+
projectFile,
|
|
6215
|
+
objects,
|
|
6216
|
+
project,
|
|
6217
|
+
projectDir,
|
|
6218
|
+
object,
|
|
6219
|
+
resolvePath
|
|
6220
|
+
};
|
|
6221
|
+
loaded.set(projectFile, { mtimeMs, project: result });
|
|
5874
6222
|
return result;
|
|
5875
6223
|
}
|
|
5876
6224
|
function targetSettings(ref, builtins) {
|
|
@@ -5984,7 +6332,7 @@ function targetMembers(ref) {
|
|
|
5984
6332
|
}
|
|
5985
6333
|
}
|
|
5986
6334
|
const addSynchronized = (folder, relative2) => {
|
|
5987
|
-
const file =
|
|
6335
|
+
const file = import_node_path8.default.join(folder, relative2);
|
|
5988
6336
|
if (NEVER_MEMBER.test(relative2)) return;
|
|
5989
6337
|
if (file.endsWith(".swift")) {
|
|
5990
6338
|
if (!relative2.split("/").some((segment) => BUNDLE_DIR.test(segment))) {
|
|
@@ -6009,7 +6357,7 @@ function targetMembers(ref) {
|
|
|
6009
6357
|
}
|
|
6010
6358
|
if (owned.has(groupId)) {
|
|
6011
6359
|
for (const file of walkFiles(folder)) {
|
|
6012
|
-
const relative2 =
|
|
6360
|
+
const relative2 = import_node_path8.default.relative(folder, file).split(import_node_path8.default.sep).join("/");
|
|
6013
6361
|
if ([...exceptions].some(
|
|
6014
6362
|
(exception) => relative2 === exception || relative2.startsWith(`${exception}/`)
|
|
6015
6363
|
))
|
|
@@ -6018,12 +6366,12 @@ function targetMembers(ref) {
|
|
|
6018
6366
|
}
|
|
6019
6367
|
} else {
|
|
6020
6368
|
for (const relative2 of exceptions) {
|
|
6021
|
-
const file =
|
|
6369
|
+
const file = import_node_path8.default.join(folder, relative2);
|
|
6022
6370
|
if (isDirectory(file)) {
|
|
6023
6371
|
for (const inner of walkFiles(file))
|
|
6024
6372
|
addSynchronized(
|
|
6025
6373
|
folder,
|
|
6026
|
-
|
|
6374
|
+
import_node_path8.default.relative(folder, inner).split(import_node_path8.default.sep).join("/")
|
|
6027
6375
|
);
|
|
6028
6376
|
} else if (import_node_fs7.default.existsSync(file)) addSynchronized(folder, relative2);
|
|
6029
6377
|
}
|
|
@@ -6038,8 +6386,8 @@ function targetMembers(ref) {
|
|
|
6038
6386
|
function commonAncestor(dirs) {
|
|
6039
6387
|
let common = dirs[0];
|
|
6040
6388
|
for (const dir of dirs) {
|
|
6041
|
-
while (common !==
|
|
6042
|
-
common =
|
|
6389
|
+
while (common !== import_node_path8.default.dirname(common) && import_node_path8.default.relative(common, dir).startsWith(".."))
|
|
6390
|
+
common = import_node_path8.default.dirname(common);
|
|
6043
6391
|
}
|
|
6044
6392
|
return common;
|
|
6045
6393
|
}
|
|
@@ -6048,9 +6396,9 @@ function workspaceProjects(xcodeprojOrWorkspace) {
|
|
|
6048
6396
|
const projects = [];
|
|
6049
6397
|
const projectAt = /* @__PURE__ */ new Map();
|
|
6050
6398
|
const addProject = (xcodeproj) => {
|
|
6051
|
-
const key =
|
|
6052
|
-
if (projectAt.has(key) || key.split(
|
|
6053
|
-
if (!
|
|
6399
|
+
const key = import_node_path8.default.resolve(xcodeproj);
|
|
6400
|
+
if (projectAt.has(key) || key.split(import_node_path8.default.sep).includes("Pods")) return;
|
|
6401
|
+
if (!xcodeProjectFile(key)) return;
|
|
6054
6402
|
const project = loadProject(key);
|
|
6055
6403
|
projectAt.set(key, project);
|
|
6056
6404
|
projects.push(project);
|
|
@@ -6066,14 +6414,22 @@ function workspaceProjects(xcodeprojOrWorkspace) {
|
|
|
6066
6414
|
for (const reference of listed)
|
|
6067
6415
|
if (reference.endsWith(".xcodeproj")) addProject(reference);
|
|
6068
6416
|
if (projects.length === 0) {
|
|
6069
|
-
throw new Error(`${
|
|
6417
|
+
throw new Error(`${import_node_path8.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
|
|
6070
6418
|
}
|
|
6071
6419
|
return { listed, projects, projectAt };
|
|
6072
6420
|
}
|
|
6073
|
-
var
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6421
|
+
var targetRefs = /* @__PURE__ */ new WeakMap();
|
|
6422
|
+
function nativeTargets(project) {
|
|
6423
|
+
let refs = targetRefs.get(project);
|
|
6424
|
+
if (!refs) {
|
|
6425
|
+
refs = list(project.project.targets).flatMap((id) => {
|
|
6426
|
+
const target = project.object(id);
|
|
6427
|
+
return target?.isa === "PBXNativeTarget" ? [{ project, id, target }] : [];
|
|
6428
|
+
});
|
|
6429
|
+
targetRefs.set(project, refs);
|
|
6430
|
+
}
|
|
6431
|
+
return refs;
|
|
6432
|
+
}
|
|
6077
6433
|
function listXcodeAppTargets(xcodeprojOrWorkspace) {
|
|
6078
6434
|
return workspaceProjects(xcodeprojOrWorkspace).projects.flatMap(nativeTargets).filter((ref) => ref.target.productType === APPLICATION).map((ref) => str(ref.target.name) ?? ref.id);
|
|
6079
6435
|
}
|
|
@@ -6083,7 +6439,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
6083
6439
|
const allTargets = projects.flatMap(nativeTargets);
|
|
6084
6440
|
const appTargets = allTargets.filter((ref) => ref.target.productType === APPLICATION);
|
|
6085
6441
|
const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
|
|
6086
|
-
const container =
|
|
6442
|
+
const container = import_node_path8.default.basename(xcodeprojOrWorkspace);
|
|
6087
6443
|
const named = targetName ? appTargets.filter((ref) => ref.target.name === targetName) : appTargets;
|
|
6088
6444
|
if (named.length !== 1) {
|
|
6089
6445
|
throw new Error(
|
|
@@ -6095,14 +6451,14 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
6095
6451
|
for (const ref of allTargets) {
|
|
6096
6452
|
const product = ref.project.object(str(ref.target.productReference));
|
|
6097
6453
|
const file = str(product?.path);
|
|
6098
|
-
if (file && !byProduct.has(
|
|
6099
|
-
byProduct.set(
|
|
6454
|
+
if (file && !byProduct.has(import_node_path8.default.basename(file)))
|
|
6455
|
+
byProduct.set(import_node_path8.default.basename(file), ref);
|
|
6100
6456
|
}
|
|
6101
6457
|
const proxied = (project, proxyId) => {
|
|
6102
6458
|
const proxy = project.object(proxyId);
|
|
6103
6459
|
if (proxy?.isa !== "PBXContainerItemProxy") return void 0;
|
|
6104
6460
|
const portal = str(proxy.containerPortal);
|
|
6105
|
-
const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(
|
|
6461
|
+
const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path8.default.resolve(project.resolvePath(portal ?? "") ?? ""));
|
|
6106
6462
|
const remote = str(proxy.remoteGlobalIDString);
|
|
6107
6463
|
if (!owner || !remote) return void 0;
|
|
6108
6464
|
return nativeTargets(owner).find(
|
|
@@ -6123,7 +6479,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
6123
6479
|
if (phase?.isa !== "PBXFrameworksBuildPhase") continue;
|
|
6124
6480
|
for (const buildFileId of list(phase.files)) {
|
|
6125
6481
|
const file = project.object(str(project.object(buildFileId)?.fileRef));
|
|
6126
|
-
const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(
|
|
6482
|
+
const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path8.default.basename(str(file.path) ?? "")) : void 0;
|
|
6127
6483
|
if (resolved) found.push(resolved);
|
|
6128
6484
|
}
|
|
6129
6485
|
}
|
|
@@ -6144,7 +6500,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
6144
6500
|
const name2 = str(ref.target.name) ?? ref.id;
|
|
6145
6501
|
const { get: settings2, keys } = targetSettings(ref, {
|
|
6146
6502
|
TARGET_NAME: name2,
|
|
6147
|
-
PROJECT_NAME:
|
|
6503
|
+
PROJECT_NAME: import_node_path8.default.basename(ref.project.xcodeproj, ".xcodeproj"),
|
|
6148
6504
|
SRCROOT: ref.project.projectDir,
|
|
6149
6505
|
SOURCE_ROOT: ref.project.projectDir,
|
|
6150
6506
|
PROJECT_DIR: ref.project.projectDir,
|
|
@@ -6175,7 +6531,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
6175
6531
|
}
|
|
6176
6532
|
return value;
|
|
6177
6533
|
};
|
|
6178
|
-
const infoPlistFile = settings("INFOPLIST_FILE") ?
|
|
6534
|
+
const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path8.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
|
|
6179
6535
|
const sourceInfo = infoPlistFile ? import_plist2.default.parse(import_node_fs7.default.readFileSync(infoPlistFile, "utf8")) : {};
|
|
6180
6536
|
if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
|
|
6181
6537
|
throw new Error(`${module2.name} Info.plist must contain a dictionary`);
|
|
@@ -6194,12 +6550,12 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
6194
6550
|
};
|
|
6195
6551
|
}
|
|
6196
6552
|
const localPackageDirs = [
|
|
6197
|
-
...listed.filter((reference) => import_node_fs7.default.existsSync(
|
|
6553
|
+
...listed.filter((reference) => import_node_fs7.default.existsSync(import_node_path8.default.join(reference, "Package.swift"))),
|
|
6198
6554
|
...projects.flatMap(
|
|
6199
6555
|
(project) => Object.entries(project.objects).flatMap(([id, entry]) => {
|
|
6200
6556
|
if (!isDict(entry)) return [];
|
|
6201
|
-
const candidate = entry.isa === "XCLocalSwiftPackageReference" ?
|
|
6202
|
-
return candidate && import_node_fs7.default.existsSync(
|
|
6557
|
+
const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path8.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
|
|
6558
|
+
return candidate && import_node_fs7.default.existsSync(import_node_path8.default.join(candidate, "Package.swift")) ? [candidate] : [];
|
|
6203
6559
|
})
|
|
6204
6560
|
)
|
|
6205
6561
|
];
|
|
@@ -6208,7 +6564,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
6208
6564
|
const cached2 = graphs.get(dir);
|
|
6209
6565
|
if (cached2) return cached2;
|
|
6210
6566
|
const graph = swiftManifestGraph(
|
|
6211
|
-
import_node_fs7.default.readFileSync(
|
|
6567
|
+
import_node_fs7.default.readFileSync(import_node_path8.default.join(dir, "Package.swift"), "utf8")
|
|
6212
6568
|
);
|
|
6213
6569
|
graphs.set(dir, graph);
|
|
6214
6570
|
return graph;
|
|
@@ -6243,7 +6599,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
6243
6599
|
});
|
|
6244
6600
|
} else if (reference?.isa === "XCLocalSwiftPackageReference") {
|
|
6245
6601
|
localPackages.add(
|
|
6246
|
-
|
|
6602
|
+
import_node_path8.default.resolve(project.projectDir, str(reference.relativePath) ?? "")
|
|
6247
6603
|
);
|
|
6248
6604
|
} else if (localProducts.has(product)) {
|
|
6249
6605
|
localPackages.add(localProducts.get(product));
|
|
@@ -6255,8 +6611,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
6255
6611
|
const dir = pending.pop();
|
|
6256
6612
|
const graph = graphOf(dir);
|
|
6257
6613
|
for (const relative2 of graph.packagePaths) {
|
|
6258
|
-
const next =
|
|
6259
|
-
if (localPackages.has(next) || !import_node_fs7.default.existsSync(
|
|
6614
|
+
const next = import_node_path8.default.resolve(dir, relative2);
|
|
6615
|
+
if (localPackages.has(next) || !import_node_fs7.default.existsSync(import_node_path8.default.join(next, "Package.swift")))
|
|
6260
6616
|
continue;
|
|
6261
6617
|
localPackages.add(next);
|
|
6262
6618
|
pending.push(next);
|
|
@@ -6270,8 +6626,8 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
6270
6626
|
}
|
|
6271
6627
|
}
|
|
6272
6628
|
}
|
|
6273
|
-
const resolvedFile =
|
|
6274
|
-
workspace ??
|
|
6629
|
+
const resolvedFile = import_node_path8.default.join(
|
|
6630
|
+
workspace ?? import_node_path8.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
|
|
6275
6631
|
"xcshareddata",
|
|
6276
6632
|
"swiftpm",
|
|
6277
6633
|
"Package.resolved"
|
|
@@ -6281,12 +6637,12 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
6281
6637
|
...module2,
|
|
6282
6638
|
rootDir: commonAncestor(
|
|
6283
6639
|
[
|
|
6284
|
-
workspace ?
|
|
6640
|
+
workspace ? import_node_path8.default.dirname(workspace) : app.project.projectDir,
|
|
6285
6641
|
...used.map((project) => project.projectDir),
|
|
6286
6642
|
...localPackages
|
|
6287
6643
|
].map((dir) => import_node_fs7.default.realpathSync(dir))
|
|
6288
6644
|
),
|
|
6289
|
-
|
|
6645
|
+
projectFiles: [...new Set(used.map((project) => project.projectFile))].sort(),
|
|
6290
6646
|
infoPlist: import_plist2.default.build(info),
|
|
6291
6647
|
infoPlistFile,
|
|
6292
6648
|
frameworks,
|
|
@@ -6302,7 +6658,7 @@ function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
|
6302
6658
|
function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
6303
6659
|
const result = {};
|
|
6304
6660
|
let config = {};
|
|
6305
|
-
const appJsonPath =
|
|
6661
|
+
const appJsonPath = import_node_path9.default.join(projectRoot, "app.json");
|
|
6306
6662
|
const appJson = import_node_fs8.default.existsSync(appJsonPath) ? JSON.parse(import_node_fs8.default.readFileSync(appJsonPath, "utf8")) : null;
|
|
6307
6663
|
const staticExpo = isRecord(appJson) && (isRecord(appJson.expo) || [appJson.ios, appJson.android].some(
|
|
6308
6664
|
(value) => isRecord(value) && typeof value.googleServicesFile === "string"
|
|
@@ -6312,9 +6668,9 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
6312
6668
|
"app.config.ts",
|
|
6313
6669
|
"app.config.cjs",
|
|
6314
6670
|
"app.config.mjs"
|
|
6315
|
-
].some((name2) => import_node_fs8.default.existsSync(
|
|
6671
|
+
].some((name2) => import_node_fs8.default.existsSync(import_node_path9.default.join(projectRoot, name2)));
|
|
6316
6672
|
if (staticExpo || dynamicExpo) {
|
|
6317
|
-
const require3 = (0, import_node_module2.createRequire)(
|
|
6673
|
+
const require3 = (0, import_node_module2.createRequire)(import_node_path9.default.join(projectRoot, "package.json"));
|
|
6318
6674
|
const configModule = require3("@expo/config");
|
|
6319
6675
|
if (!isRecord(configModule) || typeof configModule.getConfig !== "function")
|
|
6320
6676
|
throw new Error("Expo native configuration is unavailable.");
|
|
@@ -6326,20 +6682,20 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
6326
6682
|
}
|
|
6327
6683
|
const ios = config.ios;
|
|
6328
6684
|
if (platforms.includes("ios") && (!isRecord(ios) || typeof ios.googleServicesFile !== "string")) {
|
|
6329
|
-
const iosRoot =
|
|
6685
|
+
const iosRoot = import_node_path9.default.join(projectRoot, "ios");
|
|
6330
6686
|
if (import_node_fs8.default.existsSync(iosRoot)) {
|
|
6331
6687
|
const projects = import_node_fs8.default.readdirSync(iosRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory() && entry.name.endsWith(".xcodeproj"));
|
|
6332
6688
|
if (projects.length > 1)
|
|
6333
6689
|
throw new Error("native Firebase configuration requires a selected Xcode project");
|
|
6334
6690
|
if (projects.length === 1) {
|
|
6335
|
-
const xcodeproj =
|
|
6691
|
+
const xcodeproj = import_node_path9.default.join(iosRoot, projects[0].name);
|
|
6336
6692
|
const appTargets = listXcodeAppTargets(xcodeproj);
|
|
6337
6693
|
if (appTargets.length > 1)
|
|
6338
6694
|
throw new Error("native Firebase configuration requires a selected app target");
|
|
6339
6695
|
if (appTargets.length === 1) {
|
|
6340
6696
|
const app = readXcodeAppTarget(xcodeproj, appTargets[0]);
|
|
6341
6697
|
const delegates = app.allSources.filter(
|
|
6342
|
-
(file) => /^AppDelegate\.(swift|mm|m)$/.test(
|
|
6698
|
+
(file) => /^AppDelegate\.(swift|mm|m)$/.test(import_node_path9.default.basename(file))
|
|
6343
6699
|
);
|
|
6344
6700
|
const defaultConfigured = delegates.some((file) => {
|
|
6345
6701
|
const source = import_node_fs8.default.readFileSync(file, "utf8").replace(
|
|
@@ -6370,14 +6726,14 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
6370
6726
|
});
|
|
6371
6727
|
if (defaultConfigured) {
|
|
6372
6728
|
const resources = app.resources.filter(
|
|
6373
|
-
(file) => /^GoogleService-Info\.plist$/.test(
|
|
6729
|
+
(file) => /^GoogleService-Info\.plist$/.test(import_node_path9.default.basename(file))
|
|
6374
6730
|
);
|
|
6375
6731
|
if (resources.length !== 1)
|
|
6376
6732
|
throw new Error(
|
|
6377
6733
|
"native Firebase default initialization requires one GoogleService-Info.plist build resource"
|
|
6378
6734
|
);
|
|
6379
6735
|
config.ios = {
|
|
6380
|
-
googleServicesFile:
|
|
6736
|
+
googleServicesFile: import_node_path9.default.relative(
|
|
6381
6737
|
import_node_fs8.default.realpathSync(projectRoot),
|
|
6382
6738
|
resources[0]
|
|
6383
6739
|
)
|
|
@@ -6392,7 +6748,7 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
6392
6748
|
if (!isRecord(native) || typeof native.googleServicesFile !== "string") continue;
|
|
6393
6749
|
try {
|
|
6394
6750
|
const source = import_node_fs8.default.readFileSync(
|
|
6395
|
-
|
|
6751
|
+
import_node_path9.default.resolve(projectRoot, native.googleServicesFile),
|
|
6396
6752
|
"utf8"
|
|
6397
6753
|
);
|
|
6398
6754
|
const parsed = platform === "ios" ? parsePlistSource(source) : JSON.parse(source);
|
|
@@ -6795,13 +7151,13 @@ function resolveMetroPort(server) {
|
|
|
6795
7151
|
var metro_plugin_default = withRNX;
|
|
6796
7152
|
|
|
6797
7153
|
// src/jump-to-source-babel.ts
|
|
6798
|
-
function normalizeSourcePath(
|
|
6799
|
-
const queryStart =
|
|
6800
|
-
const clean = queryStart >= 0 ?
|
|
7154
|
+
function normalizeSourcePath(path14) {
|
|
7155
|
+
const queryStart = path14.indexOf("?");
|
|
7156
|
+
const clean = queryStart >= 0 ? path14.slice(0, queryStart) : path14;
|
|
6801
7157
|
return clean.replace(/\\/g, "/");
|
|
6802
7158
|
}
|
|
6803
|
-
function matchesPath(
|
|
6804
|
-
return typeof matcher === "string" ?
|
|
7159
|
+
function matchesPath(path14, matcher) {
|
|
7160
|
+
return typeof matcher === "string" ? path14.includes(matcher) : matcher.test(path14);
|
|
6805
7161
|
}
|
|
6806
7162
|
function shouldStampFile(filename, options) {
|
|
6807
7163
|
const normalized = normalizeSourcePath(filename);
|
|
@@ -6834,11 +7190,11 @@ function sootsimJumpToSourceBabelPlugin(api, options = {}) {
|
|
|
6834
7190
|
return {
|
|
6835
7191
|
name: "sootsim-jump-to-source",
|
|
6836
7192
|
visitor: {
|
|
6837
|
-
JSXOpeningElement(
|
|
7193
|
+
JSXOpeningElement(path14, state) {
|
|
6838
7194
|
if (options.enabled === false) return;
|
|
6839
7195
|
const filename = state.file?.opts?.filename;
|
|
6840
7196
|
if (!filename || !shouldStampFile(filename, options)) return;
|
|
6841
|
-
const node =
|
|
7197
|
+
const node = path14.node;
|
|
6842
7198
|
const tagName = getJSXName(node.name);
|
|
6843
7199
|
if (!tagName || tagName === "Fragment" || tagName.endsWith(".Fragment")) return;
|
|
6844
7200
|
if (hasAttribute(node, attrName)) return;
|