peachsim 0.1.752 → 0.1.754
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/bridge-flow-runner.ts +4 -8
- package/cli/commands/maestro.ts +1 -2
- 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 +1 -1
- 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 +24 -106
- package/dist-lib/swift-compile.cjs +1 -1
- package/dist-lib/swift-compile.mjs +1 -1
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +1 -1
- package/dist-lib/vite.cjs +1 -1
- package/package.json +1 -1
- package/skills/peach-test/SKILL.md +1 -4
- package/src/home-paths.ts +1 -0
- package/src/native-firebase-config.ts +17 -111
package/dist-lib/metro.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.754 | (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;
|
|
@@ -61,9 +61,9 @@ var require_parse = __commonJS({
|
|
|
61
61
|
doc.documentElement.nodeName === "plist",
|
|
62
62
|
"malformed document. First element should be <plist>"
|
|
63
63
|
);
|
|
64
|
-
var
|
|
65
|
-
if (
|
|
66
|
-
return
|
|
64
|
+
var plist3 = parsePlistXML(doc.documentElement);
|
|
65
|
+
if (plist3.length == 1) plist3 = plist3[0];
|
|
66
|
+
return plist3;
|
|
67
67
|
}
|
|
68
68
|
function parsePlistXML(node) {
|
|
69
69
|
var i, new_obj, key, val, new_arr, res, counter, type;
|
|
@@ -841,8 +841,8 @@ ${METRO_MODULE_PATHS_PREFIX}`);
|
|
|
841
841
|
if (moduleFooter < 0) return withoutExisting + footer;
|
|
842
842
|
return withoutExisting.slice(0, moduleFooter) + footer + withoutExisting.slice(moduleFooter);
|
|
843
843
|
}
|
|
844
|
-
function plistString(
|
|
845
|
-
const match =
|
|
844
|
+
function plistString(plist3, key) {
|
|
845
|
+
const match = plist3.match(new RegExp(`<key>${key}</key>\\s*<string>([^<]*)</string>`));
|
|
846
846
|
return match ? match[1].trim() : null;
|
|
847
847
|
}
|
|
848
848
|
function resolveBuildSetting(value, settings, depth = 0) {
|
|
@@ -912,9 +912,9 @@ function appTargetReleaseSettings(pbxproj, targetName, infoPlistRelativePath) {
|
|
|
912
912
|
candidates.push({ name: match[1], settings });
|
|
913
913
|
}
|
|
914
914
|
const plistMatch = (settings) => {
|
|
915
|
-
const
|
|
916
|
-
if (!
|
|
917
|
-
const normalized =
|
|
915
|
+
const plist3 = settings.INFOPLIST_FILE;
|
|
916
|
+
if (!plist3) return false;
|
|
917
|
+
const normalized = plist3.replace(/^"|"$/g, "");
|
|
918
918
|
return normalized === infoPlistRelativePath || infoPlistRelativePath.endsWith(`/${normalized}`) || normalized.endsWith(`/${infoPlistRelativePath}`);
|
|
919
919
|
};
|
|
920
920
|
const named = (settings) => resolveBuildSetting(settings.PRODUCT_NAME ?? "", settings) === targetName;
|
|
@@ -926,7 +926,7 @@ function appTargetReleaseSettings(pbxproj, targetName, infoPlistRelativePath) {
|
|
|
926
926
|
}
|
|
927
927
|
function nativeAppIdentityFromIos(files, parseInfoPlist) {
|
|
928
928
|
const pbxprojPath = Object.keys(files).find(
|
|
929
|
-
(
|
|
929
|
+
(path7) => /(?:^|\/)ios\/[^/]+\.xcodeproj\/project\.pbxproj$/.test(path7)
|
|
930
930
|
);
|
|
931
931
|
if (!pbxprojPath) return null;
|
|
932
932
|
const pbxproj = files[pbxprojPath];
|
|
@@ -938,10 +938,10 @@ function nativeAppIdentityFromIos(files, parseInfoPlist) {
|
|
|
938
938
|
].map((match) => match[1])
|
|
939
939
|
);
|
|
940
940
|
const appDelegatePattern = /(?:^|\/)ios\/([^/]+)\/AppDelegate\.(?:swift|mm|m)$/;
|
|
941
|
-
const targetName = Object.keys(files).filter((
|
|
941
|
+
const targetName = Object.keys(files).filter((path7) => !path7.includes("/Pods/")).map((path7) => path7.match(appDelegatePattern)?.[1]).find((name) => name !== void 0 && applicationTargets.has(name)) ?? null;
|
|
942
942
|
if (!targetName) return null;
|
|
943
|
-
const
|
|
944
|
-
if (!
|
|
943
|
+
const plist3 = files[`ios/${targetName}/Info.plist`];
|
|
944
|
+
if (!plist3) return null;
|
|
945
945
|
const settings = appTargetReleaseSettings(
|
|
946
946
|
pbxproj,
|
|
947
947
|
targetName,
|
|
@@ -950,29 +950,29 @@ function nativeAppIdentityFromIos(files, parseInfoPlist) {
|
|
|
950
950
|
if (!settings) return null;
|
|
951
951
|
const bundleIdentifier = identityFieldFrom(
|
|
952
952
|
settings,
|
|
953
|
-
plistString(
|
|
953
|
+
plistString(plist3, "CFBundleIdentifier"),
|
|
954
954
|
settings.PRODUCT_BUNDLE_IDENTIFIER
|
|
955
955
|
);
|
|
956
956
|
if (!bundleIdentifier) return null;
|
|
957
957
|
const appVersion = identityFieldFrom(
|
|
958
958
|
settings,
|
|
959
|
-
plistString(
|
|
959
|
+
plistString(plist3, "CFBundleShortVersionString"),
|
|
960
960
|
settings.MARKETING_VERSION
|
|
961
961
|
);
|
|
962
962
|
const buildVersion = identityFieldFrom(
|
|
963
963
|
settings,
|
|
964
|
-
plistString(
|
|
964
|
+
plistString(plist3, "CFBundleVersion"),
|
|
965
965
|
settings.CURRENT_PROJECT_VERSION
|
|
966
966
|
);
|
|
967
967
|
if (!appVersion || !buildVersion) return null;
|
|
968
968
|
const bundleName = identityFieldFrom(
|
|
969
969
|
settings,
|
|
970
|
-
plistString(
|
|
970
|
+
plistString(plist3, "CFBundleName"),
|
|
971
971
|
settings.PRODUCT_NAME
|
|
972
972
|
) ?? resolvedIdentityField(resolveBuildSetting(settings.PRODUCT_NAME ?? "", settings)) ?? resolvedIdentityField(targetName);
|
|
973
973
|
if (!bundleName) return null;
|
|
974
|
-
const applicationName = identityFieldFrom(settings, plistString(
|
|
975
|
-
const dictionary = parseInfoPlist(
|
|
974
|
+
const applicationName = identityFieldFrom(settings, plistString(plist3, "CFBundleDisplayName"), void 0) ?? bundleName;
|
|
975
|
+
const dictionary = parseInfoPlist(plist3);
|
|
976
976
|
if (!isRecord(dictionary)) throw new Error("native app Info.plist is not a dictionary");
|
|
977
977
|
const permissionUsageDescriptions = {};
|
|
978
978
|
for (const [key, value] of Object.entries(dictionary)) {
|
|
@@ -1013,9 +1013,9 @@ function extractNativeAppIdentityFromFiles(files, platform, parseInfoPlist) {
|
|
|
1013
1013
|
}
|
|
1014
1014
|
|
|
1015
1015
|
// src/native-firebase-config.ts
|
|
1016
|
-
var
|
|
1016
|
+
var import_node_fs4 = __toESM(require("node:fs"), 1);
|
|
1017
1017
|
var import_node_module = require("node:module");
|
|
1018
|
-
var
|
|
1018
|
+
var import_node_path3 = __toESM(require("node:path"), 1);
|
|
1019
1019
|
|
|
1020
1020
|
// src/is-record.ts
|
|
1021
1021
|
function isRecord2(value) {
|
|
@@ -1028,12 +1028,865 @@ function parsePlistSource(source) {
|
|
|
1028
1028
|
return import_plist.default.parse(source);
|
|
1029
1029
|
}
|
|
1030
1030
|
|
|
1031
|
+
// src/xcode-project.ts
|
|
1032
|
+
var import_node_fs3 = __toESM(require("node:fs"), 1);
|
|
1033
|
+
var import_node_path2 = __toESM(require("node:path"), 1);
|
|
1034
|
+
var import_plist2 = __toESM(require_plist(), 1);
|
|
1035
|
+
|
|
1036
|
+
// src/swift-package.ts
|
|
1037
|
+
var MANIFEST_DECLARATIONS = [
|
|
1038
|
+
"executableTarget",
|
|
1039
|
+
"testTarget",
|
|
1040
|
+
"binaryTarget",
|
|
1041
|
+
"systemLibrary",
|
|
1042
|
+
"macro",
|
|
1043
|
+
"plugin",
|
|
1044
|
+
"target",
|
|
1045
|
+
"library",
|
|
1046
|
+
"executable",
|
|
1047
|
+
"package"
|
|
1048
|
+
];
|
|
1049
|
+
function manifestCalls(manifest, kinds) {
|
|
1050
|
+
const code = manifest.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:"])\/\/[^\n]*/g, "$1");
|
|
1051
|
+
const calls = [];
|
|
1052
|
+
const pattern = new RegExp(`\\.(${MANIFEST_DECLARATIONS.join("|")})\\s*\\(`, "g");
|
|
1053
|
+
let match;
|
|
1054
|
+
while ((match = pattern.exec(code)) !== null) {
|
|
1055
|
+
let depth = 1;
|
|
1056
|
+
const start = pattern.lastIndex;
|
|
1057
|
+
let i = start;
|
|
1058
|
+
let inString = false;
|
|
1059
|
+
let escaped = false;
|
|
1060
|
+
let flat = "";
|
|
1061
|
+
while (i < code.length && depth > 0) {
|
|
1062
|
+
const ch = code[i];
|
|
1063
|
+
if (inString) {
|
|
1064
|
+
if (escaped) escaped = false;
|
|
1065
|
+
else if (ch === "\\") escaped = true;
|
|
1066
|
+
else if (ch === '"') inString = false;
|
|
1067
|
+
if (depth === 1) flat += ch;
|
|
1068
|
+
} else if (ch === '"') {
|
|
1069
|
+
inString = true;
|
|
1070
|
+
if (depth === 1) flat += ch;
|
|
1071
|
+
} else if (ch === "(") {
|
|
1072
|
+
depth++;
|
|
1073
|
+
if (depth === 1) flat += ch;
|
|
1074
|
+
} else if (ch === ")") {
|
|
1075
|
+
depth--;
|
|
1076
|
+
if (depth >= 1) flat += ch;
|
|
1077
|
+
} else if (depth === 1) {
|
|
1078
|
+
flat += ch;
|
|
1079
|
+
}
|
|
1080
|
+
i++;
|
|
1081
|
+
}
|
|
1082
|
+
if (kinds.includes(match[1]))
|
|
1083
|
+
calls.push({ kind: match[1], flat, call: code.slice(start, i) });
|
|
1084
|
+
pattern.lastIndex = i;
|
|
1085
|
+
}
|
|
1086
|
+
return calls;
|
|
1087
|
+
}
|
|
1088
|
+
var NAME = /\bname\s*:\s*"([^"]+)"/;
|
|
1089
|
+
function listArgument(call, label) {
|
|
1090
|
+
const start = new RegExp(`\\b${label}\\s*:\\s*\\[`).exec(call);
|
|
1091
|
+
if (!start) return [];
|
|
1092
|
+
const items = [];
|
|
1093
|
+
let depth = 0;
|
|
1094
|
+
let inString = false;
|
|
1095
|
+
let item = "";
|
|
1096
|
+
for (let i = start.index + start[0].length; i < call.length; i++) {
|
|
1097
|
+
const ch = call[i];
|
|
1098
|
+
if (inString) {
|
|
1099
|
+
item += ch;
|
|
1100
|
+
if (ch === '"' && call[i - 1] !== "\\") inString = false;
|
|
1101
|
+
continue;
|
|
1102
|
+
}
|
|
1103
|
+
if (ch === '"') inString = true;
|
|
1104
|
+
else if (ch === "(" || ch === "[") depth++;
|
|
1105
|
+
else if (ch === ")" || ch === "]") {
|
|
1106
|
+
if (depth === 0) break;
|
|
1107
|
+
depth--;
|
|
1108
|
+
} else if (ch === "," && depth === 0) {
|
|
1109
|
+
items.push(item.trim());
|
|
1110
|
+
item = "";
|
|
1111
|
+
continue;
|
|
1112
|
+
}
|
|
1113
|
+
item += ch;
|
|
1114
|
+
}
|
|
1115
|
+
if (item.trim()) items.push(item.trim());
|
|
1116
|
+
return items;
|
|
1117
|
+
}
|
|
1118
|
+
function swiftPackageIdentity(url) {
|
|
1119
|
+
return (url.split("/").pop() ?? url).replace(/\.git$/, "").toLowerCase();
|
|
1120
|
+
}
|
|
1121
|
+
function swiftManifestGraph(manifest) {
|
|
1122
|
+
const graph = {
|
|
1123
|
+
products: /* @__PURE__ */ new Map(),
|
|
1124
|
+
dependencies: /* @__PURE__ */ new Map(),
|
|
1125
|
+
binaryTargets: /* @__PURE__ */ new Set(),
|
|
1126
|
+
systemLibraries: /* @__PURE__ */ new Set(),
|
|
1127
|
+
packageURLs: /* @__PURE__ */ new Map(),
|
|
1128
|
+
packagePaths: []
|
|
1129
|
+
};
|
|
1130
|
+
for (const { kind, flat, call } of manifestCalls(manifest, [
|
|
1131
|
+
"library",
|
|
1132
|
+
"executableTarget",
|
|
1133
|
+
"target",
|
|
1134
|
+
"binaryTarget",
|
|
1135
|
+
"systemLibrary",
|
|
1136
|
+
"package"
|
|
1137
|
+
])) {
|
|
1138
|
+
if (kind === "package") {
|
|
1139
|
+
const local = /\bpath\s*:\s*"([^"]+)"/.exec(flat)?.[1];
|
|
1140
|
+
if (local) graph.packagePaths.push(local);
|
|
1141
|
+
const url = /\burl\s*:\s*"([^"]+)"/.exec(flat)?.[1];
|
|
1142
|
+
if (!url) continue;
|
|
1143
|
+
graph.packageURLs.set(swiftPackageIdentity(url), url);
|
|
1144
|
+
const name2 = NAME.exec(flat)?.[1];
|
|
1145
|
+
if (name2) graph.packageURLs.set(name2.toLowerCase(), url);
|
|
1146
|
+
continue;
|
|
1147
|
+
}
|
|
1148
|
+
const name = NAME.exec(flat)?.[1];
|
|
1149
|
+
if (!name) continue;
|
|
1150
|
+
if (kind === "library") {
|
|
1151
|
+
graph.products.set(
|
|
1152
|
+
name,
|
|
1153
|
+
listArgument(call, "targets").flatMap(
|
|
1154
|
+
(item) => /^"([^"]+)"$/.exec(item)?.[1] ?? []
|
|
1155
|
+
)
|
|
1156
|
+
);
|
|
1157
|
+
continue;
|
|
1158
|
+
}
|
|
1159
|
+
if (kind === "binaryTarget") graph.binaryTargets.add(name);
|
|
1160
|
+
if (kind === "systemLibrary") graph.systemLibraries.add(name);
|
|
1161
|
+
const dependencies = [];
|
|
1162
|
+
for (const item of listArgument(call, "dependencies")) {
|
|
1163
|
+
const platforms = /condition\s*:\s*\.when\(\s*platforms\s*:\s*\[([^\]]*)\]/.exec(
|
|
1164
|
+
item
|
|
1165
|
+
)?.[1];
|
|
1166
|
+
if (platforms !== void 0 && !/\.iOS\b/.test(platforms)) continue;
|
|
1167
|
+
if (/condition\s*:\s*\.when\([^)]*\btraits\s*:/.test(item)) continue;
|
|
1168
|
+
const plain = /^"([^"]+)"$/.exec(item)?.[1];
|
|
1169
|
+
const product = /^\.product(?:Item)?\(\s*name\s*:\s*"([^"]+)"\s*,\s*package\s*:\s*"([^"]+)"/.exec(
|
|
1170
|
+
item
|
|
1171
|
+
);
|
|
1172
|
+
const target = /^\.(?:target|byName)(?:Item)?\(\s*name\s*:\s*"([^"]+)"/.exec(
|
|
1173
|
+
item
|
|
1174
|
+
)?.[1];
|
|
1175
|
+
if (plain) dependencies.push({ kind: "target", name: plain });
|
|
1176
|
+
else if (product)
|
|
1177
|
+
dependencies.push({
|
|
1178
|
+
kind: "product",
|
|
1179
|
+
name: product[1],
|
|
1180
|
+
package: product[2].toLowerCase()
|
|
1181
|
+
});
|
|
1182
|
+
else if (target) dependencies.push({ kind: "target", name: target });
|
|
1183
|
+
}
|
|
1184
|
+
graph.dependencies.set(name, dependencies);
|
|
1185
|
+
}
|
|
1186
|
+
for (const dependencies of graph.dependencies.values()) {
|
|
1187
|
+
for (const [index, dependency] of dependencies.entries()) {
|
|
1188
|
+
if (dependency.kind === "target" && !graph.dependencies.has(dependency.name))
|
|
1189
|
+
dependencies[index] = {
|
|
1190
|
+
kind: "product",
|
|
1191
|
+
name: dependency.name,
|
|
1192
|
+
package: dependency.name.toLowerCase()
|
|
1193
|
+
};
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
return graph;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
// src/xcode-project.ts
|
|
1200
|
+
function parseOpenStepPlist(text) {
|
|
1201
|
+
let i = 0;
|
|
1202
|
+
const fail = (message) => {
|
|
1203
|
+
const line = text.slice(0, i).split("\n").length;
|
|
1204
|
+
throw new Error(`project.pbxproj line ${line}: ${message}`);
|
|
1205
|
+
};
|
|
1206
|
+
const skip = () => {
|
|
1207
|
+
for (; ; ) {
|
|
1208
|
+
const ch = text[i];
|
|
1209
|
+
if (ch === " " || ch === " " || ch === "\n" || ch === "\r") i++;
|
|
1210
|
+
else if (ch === "/" && text[i + 1] === "*") {
|
|
1211
|
+
const end = text.indexOf("*/", i + 2);
|
|
1212
|
+
if (end < 0) fail("unterminated comment");
|
|
1213
|
+
i = end + 2;
|
|
1214
|
+
} else if (ch === "/" && text[i + 1] === "/") {
|
|
1215
|
+
const end = text.indexOf("\n", i);
|
|
1216
|
+
i = end < 0 ? text.length : end + 1;
|
|
1217
|
+
} else return;
|
|
1218
|
+
}
|
|
1219
|
+
};
|
|
1220
|
+
const quoted = () => {
|
|
1221
|
+
i++;
|
|
1222
|
+
let out = "";
|
|
1223
|
+
for (; ; ) {
|
|
1224
|
+
const ch = text[i++];
|
|
1225
|
+
if (ch === void 0) fail("unterminated string");
|
|
1226
|
+
if (ch === '"') return out;
|
|
1227
|
+
if (ch !== "\\") {
|
|
1228
|
+
out += ch;
|
|
1229
|
+
continue;
|
|
1230
|
+
}
|
|
1231
|
+
const next = text[i++];
|
|
1232
|
+
if (next === "n") out += "\n";
|
|
1233
|
+
else if (next === "t") out += " ";
|
|
1234
|
+
else if (next === "r") out += "\r";
|
|
1235
|
+
else if (next === "U") {
|
|
1236
|
+
out += String.fromCharCode(parseInt(text.slice(i, i + 4), 16));
|
|
1237
|
+
i += 4;
|
|
1238
|
+
} else out += next;
|
|
1239
|
+
}
|
|
1240
|
+
};
|
|
1241
|
+
const value = () => {
|
|
1242
|
+
skip();
|
|
1243
|
+
const ch = text[i];
|
|
1244
|
+
if (ch === "{") {
|
|
1245
|
+
i++;
|
|
1246
|
+
const dict = {};
|
|
1247
|
+
for (; ; ) {
|
|
1248
|
+
skip();
|
|
1249
|
+
if (text[i] === "}") {
|
|
1250
|
+
i++;
|
|
1251
|
+
return dict;
|
|
1252
|
+
}
|
|
1253
|
+
const key = value();
|
|
1254
|
+
if (typeof key !== "string") fail("dictionary key is not a string");
|
|
1255
|
+
skip();
|
|
1256
|
+
if (text[i++] !== "=") fail("expected =");
|
|
1257
|
+
dict[key] = value();
|
|
1258
|
+
skip();
|
|
1259
|
+
if (text[i++] !== ";") fail("expected ;");
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
if (ch === "(") {
|
|
1263
|
+
i++;
|
|
1264
|
+
const list2 = [];
|
|
1265
|
+
for (; ; ) {
|
|
1266
|
+
skip();
|
|
1267
|
+
if (text[i] === ")") {
|
|
1268
|
+
i++;
|
|
1269
|
+
return list2;
|
|
1270
|
+
}
|
|
1271
|
+
list2.push(value());
|
|
1272
|
+
skip();
|
|
1273
|
+
if (text[i] === ",") i++;
|
|
1274
|
+
else if (text[i] !== ")") fail("expected , or )");
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
if (ch === '"') return quoted();
|
|
1278
|
+
const start = i;
|
|
1279
|
+
while (i < text.length && /[A-Za-z0-9_$+/:.\-<>]/.test(text[i])) i++;
|
|
1280
|
+
if (i === start) fail(`unexpected ${JSON.stringify(ch ?? "end of file")}`);
|
|
1281
|
+
return text.slice(start, i);
|
|
1282
|
+
};
|
|
1283
|
+
if (text.startsWith("// !$*UTF8*$!")) i = text.indexOf("\n") + 1;
|
|
1284
|
+
const root = value();
|
|
1285
|
+
skip();
|
|
1286
|
+
if (i !== text.length) fail("trailing content");
|
|
1287
|
+
return root;
|
|
1288
|
+
}
|
|
1289
|
+
var isDict = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1290
|
+
var str = (value) => typeof value === "string" ? value : void 0;
|
|
1291
|
+
var list = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
1292
|
+
var APPLICATION = "com.apple.product-type.application";
|
|
1293
|
+
var MODULE_PRODUCTS = /* @__PURE__ */ new Set([
|
|
1294
|
+
"com.apple.product-type.framework",
|
|
1295
|
+
"com.apple.product-type.framework.static",
|
|
1296
|
+
"com.apple.product-type.library.static",
|
|
1297
|
+
"com.apple.product-type.library.dynamic"
|
|
1298
|
+
]);
|
|
1299
|
+
var NEVER_MEMBER = /(?:^|\/)(?:Info\.plist|[^/]+\.entitlements|[^/]+\.xcconfig|\.DS_Store)$/;
|
|
1300
|
+
var BUNDLE_DIR = /\.(xcassets|bundle|lproj|xcdatamodeld|scnassets|spriteatlas|rcproject|storyboardc|icon)$/;
|
|
1301
|
+
var CONDITIONS = {
|
|
1302
|
+
sdk: "iphonesimulator",
|
|
1303
|
+
arch: "arm64",
|
|
1304
|
+
variant: "normal"
|
|
1305
|
+
};
|
|
1306
|
+
function walkFiles(dir) {
|
|
1307
|
+
if (!import_node_fs3.default.existsSync(dir)) return [];
|
|
1308
|
+
const out = [];
|
|
1309
|
+
for (const entry of import_node_fs3.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
|
|
1310
|
+
if (entry.name.startsWith(".")) continue;
|
|
1311
|
+
const full = import_node_path2.default.join(dir, entry.name);
|
|
1312
|
+
if (entry.isDirectory()) out.push(...walkFiles(full));
|
|
1313
|
+
else if (entry.isFile()) out.push(full);
|
|
1314
|
+
}
|
|
1315
|
+
return out;
|
|
1316
|
+
}
|
|
1317
|
+
var isDirectory = (dir) => import_node_fs3.default.existsSync(dir) && import_node_fs3.default.statSync(dir).isDirectory();
|
|
1318
|
+
function readXcconfig(file, seen = /* @__PURE__ */ new Set()) {
|
|
1319
|
+
if (seen.has(file) || !import_node_fs3.default.existsSync(file)) return {};
|
|
1320
|
+
seen.add(file);
|
|
1321
|
+
const settings = {};
|
|
1322
|
+
for (const raw of import_node_fs3.default.readFileSync(file, "utf8").split("\n")) {
|
|
1323
|
+
const line = raw.replace(/\/\/.*$/, "").trim();
|
|
1324
|
+
const include = /^#include\??\s+"([^"]+)"/.exec(line);
|
|
1325
|
+
if (include) {
|
|
1326
|
+
Object.assign(
|
|
1327
|
+
settings,
|
|
1328
|
+
readXcconfig(import_node_path2.default.resolve(import_node_path2.default.dirname(file), include[1]), seen)
|
|
1329
|
+
);
|
|
1330
|
+
continue;
|
|
1331
|
+
}
|
|
1332
|
+
const setting = /^([A-Za-z_][A-Za-z0-9_]*(?:\[[^\]]*\])*)\s*=\s*(.*)$/.exec(line);
|
|
1333
|
+
if (setting)
|
|
1334
|
+
settings[setting[1].replace(/\s+/g, "")] = setting[2].replace(/;$/, "").trim();
|
|
1335
|
+
}
|
|
1336
|
+
return settings;
|
|
1337
|
+
}
|
|
1338
|
+
function applyConditions(raw, configuration) {
|
|
1339
|
+
const plain = {};
|
|
1340
|
+
const conditional = {};
|
|
1341
|
+
for (const [key, value] of Object.entries(raw)) {
|
|
1342
|
+
const bracket = key.indexOf("[");
|
|
1343
|
+
if (bracket === -1) {
|
|
1344
|
+
plain[key] = value;
|
|
1345
|
+
continue;
|
|
1346
|
+
}
|
|
1347
|
+
const matches = [...key.slice(bracket).matchAll(/\[([^=\]]+)=([^\]]*)\]/g)].every(
|
|
1348
|
+
([, name, pattern]) => {
|
|
1349
|
+
const actual = name === "config" ? configuration : CONDITIONS[name];
|
|
1350
|
+
return actual !== void 0 && new RegExp(
|
|
1351
|
+
`^${pattern.replace(/[.+^${}()|\\]/g, "\\$&").replaceAll("*", ".*").replaceAll("?", ".")}$`
|
|
1352
|
+
).test(actual);
|
|
1353
|
+
}
|
|
1354
|
+
);
|
|
1355
|
+
if (matches) conditional[key.slice(0, bracket)] = value;
|
|
1356
|
+
}
|
|
1357
|
+
return { ...plain, ...conditional };
|
|
1358
|
+
}
|
|
1359
|
+
function applyOperator(value, operator) {
|
|
1360
|
+
if (operator.startsWith("default=")) return value === "" ? operator.slice(8) : value;
|
|
1361
|
+
switch (operator) {
|
|
1362
|
+
case "lower":
|
|
1363
|
+
return value.toLowerCase();
|
|
1364
|
+
case "upper":
|
|
1365
|
+
return value.toUpperCase();
|
|
1366
|
+
case "rfc1034identifier":
|
|
1367
|
+
return value.replace(/[^A-Za-z0-9-]/g, "-").replace(/^[0-9]/, "-");
|
|
1368
|
+
case "identifier":
|
|
1369
|
+
case "c99extidentifier":
|
|
1370
|
+
return value.replace(/[^A-Za-z0-9_]/g, "_").replace(/^[0-9]/, "_");
|
|
1371
|
+
}
|
|
1372
|
+
throw new Error(`unsupported build setting operator :${operator}`);
|
|
1373
|
+
}
|
|
1374
|
+
function decodeXml(text) {
|
|
1375
|
+
return text.replaceAll(""", '"').replaceAll("'", "'").replaceAll("<", "<").replaceAll(">", ">").replaceAll("&", "&");
|
|
1376
|
+
}
|
|
1377
|
+
function workspaceReferences(workspace) {
|
|
1378
|
+
const data = import_node_path2.default.join(workspace, "contents.xcworkspacedata");
|
|
1379
|
+
if (!import_node_fs3.default.existsSync(data))
|
|
1380
|
+
throw new Error(`${workspace} has no contents.xcworkspacedata`);
|
|
1381
|
+
const container = import_node_path2.default.dirname(workspace);
|
|
1382
|
+
const locate = (location, base) => {
|
|
1383
|
+
const colon = location.indexOf(":");
|
|
1384
|
+
const kind = location.slice(0, colon);
|
|
1385
|
+
const rest = location.slice(colon + 1);
|
|
1386
|
+
if (kind === "group") return import_node_path2.default.resolve(base, rest);
|
|
1387
|
+
if (kind === "container" || kind === "self") return import_node_path2.default.resolve(container, rest);
|
|
1388
|
+
if (kind === "absolute") return import_node_path2.default.resolve(rest);
|
|
1389
|
+
throw new Error(`${import_node_path2.default.basename(workspace)} has an unsupported location ${location}`);
|
|
1390
|
+
};
|
|
1391
|
+
const groups = [container];
|
|
1392
|
+
const references = [];
|
|
1393
|
+
for (const [, closing, tag, attributes, selfClosing] of import_node_fs3.default.readFileSync(data, "utf8").matchAll(/<(\/?)(Group|FileRef)\b([^>]*?)(\/?)>/g)) {
|
|
1394
|
+
if (closing) {
|
|
1395
|
+
if (tag === "Group") groups.pop();
|
|
1396
|
+
continue;
|
|
1397
|
+
}
|
|
1398
|
+
const base = groups.at(-1);
|
|
1399
|
+
const location = /\blocation\s*=\s*"([^"]*)"/.exec(attributes)?.[1];
|
|
1400
|
+
const resolved = location ? locate(decodeXml(location), base) : base;
|
|
1401
|
+
if (tag === "FileRef") references.push(resolved);
|
|
1402
|
+
else if (!selfClosing) groups.push(resolved);
|
|
1403
|
+
}
|
|
1404
|
+
return references;
|
|
1405
|
+
}
|
|
1406
|
+
var loaded = /* @__PURE__ */ new Map();
|
|
1407
|
+
function loadProject(xcodeproj) {
|
|
1408
|
+
const pbxproj = import_node_path2.default.join(xcodeproj, "project.pbxproj");
|
|
1409
|
+
if (!import_node_fs3.default.existsSync(pbxproj)) throw new Error(`${xcodeproj} has no project.pbxproj`);
|
|
1410
|
+
const mtimeMs = import_node_fs3.default.statSync(pbxproj).mtimeMs;
|
|
1411
|
+
const cached = loaded.get(pbxproj);
|
|
1412
|
+
if (cached?.mtimeMs === mtimeMs) return cached.project;
|
|
1413
|
+
const root = parseOpenStepPlist(import_node_fs3.default.readFileSync(pbxproj, "utf8"));
|
|
1414
|
+
if (!isDict(root) || !isDict(root.objects)) {
|
|
1415
|
+
throw new Error(`${pbxproj} has no objects table`);
|
|
1416
|
+
}
|
|
1417
|
+
const objects = root.objects;
|
|
1418
|
+
const object = (id) => {
|
|
1419
|
+
const found = id === void 0 ? void 0 : objects[id];
|
|
1420
|
+
return isDict(found) ? found : void 0;
|
|
1421
|
+
};
|
|
1422
|
+
const project = object(str(root.rootObject));
|
|
1423
|
+
if (!project || project.isa !== "PBXProject") {
|
|
1424
|
+
throw new Error(`${pbxproj} has no PBXProject root`);
|
|
1425
|
+
}
|
|
1426
|
+
const projectDir = import_node_fs3.default.realpathSync(
|
|
1427
|
+
import_node_path2.default.resolve(import_node_path2.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
|
|
1428
|
+
);
|
|
1429
|
+
const parent = /* @__PURE__ */ new Map();
|
|
1430
|
+
for (const [id, entry] of Object.entries(objects)) {
|
|
1431
|
+
if (!isDict(entry)) continue;
|
|
1432
|
+
if (entry.isa === "PBXGroup" || entry.isa === "PBXVariantGroup") {
|
|
1433
|
+
for (const child of list(entry.children)) parent.set(child, id);
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
const resolvedPaths = /* @__PURE__ */ new Map();
|
|
1437
|
+
const resolvePath = (id) => {
|
|
1438
|
+
if (resolvedPaths.has(id)) return resolvedPaths.get(id);
|
|
1439
|
+
const entry = object(id);
|
|
1440
|
+
let result2 = null;
|
|
1441
|
+
if (entry) {
|
|
1442
|
+
const own = str(entry.path) ?? "";
|
|
1443
|
+
const tree = str(entry.sourceTree) ?? "<group>";
|
|
1444
|
+
if (tree === "<absolute>") result2 = own;
|
|
1445
|
+
else if (tree === "SOURCE_ROOT") result2 = import_node_path2.default.join(projectDir, own);
|
|
1446
|
+
else if (tree === "<group>") {
|
|
1447
|
+
const up = parent.get(id);
|
|
1448
|
+
const base = up ? resolvePath(up) : projectDir;
|
|
1449
|
+
result2 = base === null ? null : import_node_path2.default.join(base, own);
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
resolvedPaths.set(id, result2);
|
|
1453
|
+
return result2;
|
|
1454
|
+
};
|
|
1455
|
+
const result = { xcodeproj, pbxproj, objects, project, projectDir, object, resolvePath };
|
|
1456
|
+
loaded.set(pbxproj, { mtimeMs, project: result });
|
|
1457
|
+
return result;
|
|
1458
|
+
}
|
|
1459
|
+
function targetSettings(ref, builtins) {
|
|
1460
|
+
const { project, target } = ref;
|
|
1461
|
+
const level = (listId) => {
|
|
1462
|
+
const configs = list(project.object(listId)?.buildConfigurations).map(project.object);
|
|
1463
|
+
const config = configs.find((entry) => entry?.name === "Debug") ?? configs.find(Boolean);
|
|
1464
|
+
if (!config) return [];
|
|
1465
|
+
const name = str(config.name) ?? "Debug";
|
|
1466
|
+
const base = str(config.baseConfigurationReference);
|
|
1467
|
+
const own = isDict(config.buildSettings) ? config.buildSettings : {};
|
|
1468
|
+
return [
|
|
1469
|
+
applyConditions(base ? readXcconfig(project.resolvePath(base) ?? "") : {}, name),
|
|
1470
|
+
applyConditions(
|
|
1471
|
+
Object.fromEntries(
|
|
1472
|
+
Object.entries(own).flatMap(
|
|
1473
|
+
([key, value]) => typeof value === "string" ? [[key, value]] : Array.isArray(value) ? [[key, list(value).join(" ")]] : []
|
|
1474
|
+
)
|
|
1475
|
+
),
|
|
1476
|
+
name
|
|
1477
|
+
)
|
|
1478
|
+
];
|
|
1479
|
+
};
|
|
1480
|
+
const levels = [
|
|
1481
|
+
builtins,
|
|
1482
|
+
...level(str(project.project.buildConfigurationList)),
|
|
1483
|
+
...level(str(target.buildConfigurationList))
|
|
1484
|
+
];
|
|
1485
|
+
const resolving = /* @__PURE__ */ new Set();
|
|
1486
|
+
const valueAt = (key, top) => {
|
|
1487
|
+
let at = top;
|
|
1488
|
+
while (at >= 0 && levels[at][key] === void 0) at--;
|
|
1489
|
+
if (at < 0) return derived(key);
|
|
1490
|
+
const marker = `${key}@${at}`;
|
|
1491
|
+
if (resolving.has(marker))
|
|
1492
|
+
throw new Error(`${str(target.name)} has a cyclic build setting ${key}`);
|
|
1493
|
+
resolving.add(marker);
|
|
1494
|
+
const value = expand(
|
|
1495
|
+
levels[at][key],
|
|
1496
|
+
(name) => name === "inherited" ? valueAt(key, at - 1) : valueAt(name, levels.length - 1)
|
|
1497
|
+
);
|
|
1498
|
+
resolving.delete(marker);
|
|
1499
|
+
return value;
|
|
1500
|
+
};
|
|
1501
|
+
const derived = (key) => {
|
|
1502
|
+
const get = (name) => valueAt(name, levels.length - 1);
|
|
1503
|
+
switch (key) {
|
|
1504
|
+
case "PRODUCT_NAME":
|
|
1505
|
+
return get("TARGET_NAME");
|
|
1506
|
+
case "PRODUCT_MODULE_NAME":
|
|
1507
|
+
return applyOperator(get("PRODUCT_NAME"), "c99extidentifier");
|
|
1508
|
+
case "EXECUTABLE_NAME":
|
|
1509
|
+
return get("PRODUCT_NAME");
|
|
1510
|
+
case "AppIdentifierPrefix":
|
|
1511
|
+
case "TeamIdentifierPrefix": {
|
|
1512
|
+
const team = get("DEVELOPMENT_TEAM");
|
|
1513
|
+
return get("CODE_SIGNING_ALLOWED") !== "NO" && team ? `${team}.` : "";
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
return "";
|
|
1517
|
+
};
|
|
1518
|
+
return {
|
|
1519
|
+
get: (key) => valueAt(key, levels.length - 1),
|
|
1520
|
+
keys: new Set(levels.flatMap((values) => Object.keys(values)))
|
|
1521
|
+
};
|
|
1522
|
+
}
|
|
1523
|
+
function expand(value, lookup) {
|
|
1524
|
+
return value.replace(
|
|
1525
|
+
/\$(?:\(([A-Za-z_][A-Za-z0-9_]*)((?::[^)]*)?)\)|\{([A-Za-z_][A-Za-z0-9_]*)((?::[^}]*)?)\}|([A-Za-z_][A-Za-z0-9_]*))/g,
|
|
1526
|
+
(_match, paren, parenOps, brace, braceOps, bare) => {
|
|
1527
|
+
const name = paren ?? brace ?? bare;
|
|
1528
|
+
const operators = parenOps ?? braceOps ?? "";
|
|
1529
|
+
return operators.split(":").slice(1).reduce((current, operator) => applyOperator(current, operator), lookup(name));
|
|
1530
|
+
}
|
|
1531
|
+
);
|
|
1532
|
+
}
|
|
1533
|
+
function targetMembers(ref) {
|
|
1534
|
+
const { project, target, id: targetId } = ref;
|
|
1535
|
+
const sources = /* @__PURE__ */ new Set();
|
|
1536
|
+
const allSources = /* @__PURE__ */ new Set();
|
|
1537
|
+
const resources = /* @__PURE__ */ new Set();
|
|
1538
|
+
const addResource = (file) => {
|
|
1539
|
+
if (isDirectory(file)) {
|
|
1540
|
+
for (const inner of walkFiles(file)) resources.add(inner);
|
|
1541
|
+
} else if (import_node_fs3.default.existsSync(file)) resources.add(file);
|
|
1542
|
+
};
|
|
1543
|
+
const fileRefPaths = (refId) => {
|
|
1544
|
+
const entry = project.object(refId);
|
|
1545
|
+
if (!entry) return [];
|
|
1546
|
+
if (entry.isa === "PBXVariantGroup") {
|
|
1547
|
+
return list(entry.children).flatMap((child) => {
|
|
1548
|
+
const resolved2 = project.resolvePath(child);
|
|
1549
|
+
return resolved2 ? [resolved2] : [];
|
|
1550
|
+
});
|
|
1551
|
+
}
|
|
1552
|
+
const resolved = project.resolvePath(refId);
|
|
1553
|
+
return resolved ? [resolved] : [];
|
|
1554
|
+
};
|
|
1555
|
+
for (const phaseId of list(target.buildPhases)) {
|
|
1556
|
+
const phase = project.object(phaseId);
|
|
1557
|
+
if (phase?.isa !== "PBXSourcesBuildPhase" && phase?.isa !== "PBXResourcesBuildPhase")
|
|
1558
|
+
continue;
|
|
1559
|
+
for (const buildFileId of list(phase.files)) {
|
|
1560
|
+
for (const file of fileRefPaths(str(project.object(buildFileId)?.fileRef) ?? "")) {
|
|
1561
|
+
if (phase.isa === "PBXSourcesBuildPhase") {
|
|
1562
|
+
if (!import_node_fs3.default.existsSync(file)) continue;
|
|
1563
|
+
allSources.add(file);
|
|
1564
|
+
if (file.endsWith(".swift")) sources.add(file);
|
|
1565
|
+
} else if (phase.isa === "PBXResourcesBuildPhase") addResource(file);
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
const addSynchronized = (folder, relative2) => {
|
|
1570
|
+
const file = import_node_path2.default.join(folder, relative2);
|
|
1571
|
+
if (NEVER_MEMBER.test(relative2)) return;
|
|
1572
|
+
if (file.endsWith(".swift")) {
|
|
1573
|
+
if (!relative2.split("/").some((segment) => BUNDLE_DIR.test(segment))) {
|
|
1574
|
+
sources.add(file);
|
|
1575
|
+
allSources.add(file);
|
|
1576
|
+
}
|
|
1577
|
+
} else if (/\.(h|m|mm|c|cpp|metal)$/.test(file)) {
|
|
1578
|
+
if (!file.endsWith(".h")) allSources.add(file);
|
|
1579
|
+
} else resources.add(file);
|
|
1580
|
+
};
|
|
1581
|
+
const owned = new Set(list(target.fileSystemSynchronizedGroups));
|
|
1582
|
+
for (const [groupId, group] of Object.entries(project.objects)) {
|
|
1583
|
+
if (!isDict(group) || group.isa !== "PBXFileSystemSynchronizedRootGroup") continue;
|
|
1584
|
+
const folder = project.resolvePath(groupId);
|
|
1585
|
+
if (!folder) continue;
|
|
1586
|
+
const exceptions = /* @__PURE__ */ new Set();
|
|
1587
|
+
for (const exceptionId of list(group.exceptions)) {
|
|
1588
|
+
const exception = project.object(exceptionId);
|
|
1589
|
+
if (exception?.target !== targetId) continue;
|
|
1590
|
+
for (const relative2 of list(exception.membershipExceptions))
|
|
1591
|
+
exceptions.add(relative2);
|
|
1592
|
+
}
|
|
1593
|
+
if (owned.has(groupId)) {
|
|
1594
|
+
for (const file of walkFiles(folder)) {
|
|
1595
|
+
const relative2 = import_node_path2.default.relative(folder, file).split(import_node_path2.default.sep).join("/");
|
|
1596
|
+
if ([...exceptions].some(
|
|
1597
|
+
(exception) => relative2 === exception || relative2.startsWith(`${exception}/`)
|
|
1598
|
+
))
|
|
1599
|
+
continue;
|
|
1600
|
+
addSynchronized(folder, relative2);
|
|
1601
|
+
}
|
|
1602
|
+
} else {
|
|
1603
|
+
for (const relative2 of exceptions) {
|
|
1604
|
+
const file = import_node_path2.default.join(folder, relative2);
|
|
1605
|
+
if (isDirectory(file)) {
|
|
1606
|
+
for (const inner of walkFiles(file))
|
|
1607
|
+
addSynchronized(
|
|
1608
|
+
folder,
|
|
1609
|
+
import_node_path2.default.relative(folder, inner).split(import_node_path2.default.sep).join("/")
|
|
1610
|
+
);
|
|
1611
|
+
} else if (import_node_fs3.default.existsSync(file)) addSynchronized(folder, relative2);
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
return {
|
|
1616
|
+
sources: [...sources].sort(),
|
|
1617
|
+
resources: [...resources].sort(),
|
|
1618
|
+
allSources: [...allSources].sort()
|
|
1619
|
+
};
|
|
1620
|
+
}
|
|
1621
|
+
function commonAncestor(dirs) {
|
|
1622
|
+
let common = dirs[0];
|
|
1623
|
+
for (const dir of dirs) {
|
|
1624
|
+
while (common !== import_node_path2.default.dirname(common) && import_node_path2.default.relative(common, dir).startsWith(".."))
|
|
1625
|
+
common = import_node_path2.default.dirname(common);
|
|
1626
|
+
}
|
|
1627
|
+
return common;
|
|
1628
|
+
}
|
|
1629
|
+
function workspaceProjects(xcodeprojOrWorkspace) {
|
|
1630
|
+
const listed = xcodeprojOrWorkspace.endsWith(".xcworkspace") ? workspaceReferences(xcodeprojOrWorkspace) : [xcodeprojOrWorkspace];
|
|
1631
|
+
const projects = [];
|
|
1632
|
+
const projectAt = /* @__PURE__ */ new Map();
|
|
1633
|
+
const addProject = (xcodeproj) => {
|
|
1634
|
+
const key = import_node_path2.default.resolve(xcodeproj);
|
|
1635
|
+
if (projectAt.has(key) || key.split(import_node_path2.default.sep).includes("Pods")) return;
|
|
1636
|
+
if (!import_node_fs3.default.existsSync(import_node_path2.default.join(key, "project.pbxproj"))) return;
|
|
1637
|
+
const project = loadProject(key);
|
|
1638
|
+
projectAt.set(key, project);
|
|
1639
|
+
projects.push(project);
|
|
1640
|
+
const nested = project.project.projectReferences;
|
|
1641
|
+
if (Array.isArray(nested)) {
|
|
1642
|
+
for (const entry of nested) {
|
|
1643
|
+
const ref = isDict(entry) ? str(entry.ProjectRef) : void 0;
|
|
1644
|
+
const resolved = ref ? project.resolvePath(ref) : null;
|
|
1645
|
+
if (resolved) addProject(resolved);
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
};
|
|
1649
|
+
for (const reference of listed)
|
|
1650
|
+
if (reference.endsWith(".xcodeproj")) addProject(reference);
|
|
1651
|
+
if (projects.length === 0) {
|
|
1652
|
+
throw new Error(`${import_node_path2.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
|
|
1653
|
+
}
|
|
1654
|
+
return { listed, projects, projectAt };
|
|
1655
|
+
}
|
|
1656
|
+
var nativeTargets = (project) => list(project.project.targets).flatMap((id) => {
|
|
1657
|
+
const target = project.object(id);
|
|
1658
|
+
return target?.isa === "PBXNativeTarget" ? [{ project, id, target }] : [];
|
|
1659
|
+
});
|
|
1660
|
+
function listXcodeAppTargets(xcodeprojOrWorkspace) {
|
|
1661
|
+
return workspaceProjects(xcodeprojOrWorkspace).projects.flatMap(nativeTargets).filter((ref) => ref.target.productType === APPLICATION).map((ref) => str(ref.target.name) ?? ref.id);
|
|
1662
|
+
}
|
|
1663
|
+
function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
1664
|
+
const workspace = xcodeprojOrWorkspace.endsWith(".xcworkspace") ? xcodeprojOrWorkspace : null;
|
|
1665
|
+
const { listed, projects, projectAt } = workspaceProjects(xcodeprojOrWorkspace);
|
|
1666
|
+
const allTargets = projects.flatMap(nativeTargets);
|
|
1667
|
+
const appTargets = allTargets.filter((ref) => ref.target.productType === APPLICATION);
|
|
1668
|
+
const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
|
|
1669
|
+
const container = import_node_path2.default.basename(xcodeprojOrWorkspace);
|
|
1670
|
+
const named = targetName ? appTargets.filter((ref) => ref.target.name === targetName) : appTargets;
|
|
1671
|
+
if (named.length !== 1) {
|
|
1672
|
+
throw new Error(
|
|
1673
|
+
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`
|
|
1674
|
+
);
|
|
1675
|
+
}
|
|
1676
|
+
const app = named[0];
|
|
1677
|
+
const byProduct = /* @__PURE__ */ new Map();
|
|
1678
|
+
for (const ref of allTargets) {
|
|
1679
|
+
const product = ref.project.object(str(ref.target.productReference));
|
|
1680
|
+
const file = str(product?.path);
|
|
1681
|
+
if (file && !byProduct.has(import_node_path2.default.basename(file)))
|
|
1682
|
+
byProduct.set(import_node_path2.default.basename(file), ref);
|
|
1683
|
+
}
|
|
1684
|
+
const proxied = (project, proxyId) => {
|
|
1685
|
+
const proxy = project.object(proxyId);
|
|
1686
|
+
if (proxy?.isa !== "PBXContainerItemProxy") return void 0;
|
|
1687
|
+
const portal = str(proxy.containerPortal);
|
|
1688
|
+
const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path2.default.resolve(project.resolvePath(portal ?? "") ?? ""));
|
|
1689
|
+
const remote = str(proxy.remoteGlobalIDString);
|
|
1690
|
+
if (!owner || !remote) return void 0;
|
|
1691
|
+
return nativeTargets(owner).find(
|
|
1692
|
+
(ref) => ref.id === remote || str(ref.target.productReference) === remote
|
|
1693
|
+
);
|
|
1694
|
+
};
|
|
1695
|
+
const dependenciesOf = (ref) => {
|
|
1696
|
+
const { project, target } = ref;
|
|
1697
|
+
const found = [];
|
|
1698
|
+
for (const dependencyId of list(target.dependencies)) {
|
|
1699
|
+
const dependency = project.object(dependencyId);
|
|
1700
|
+
const direct = str(dependency?.target);
|
|
1701
|
+
const resolved = direct ? nativeTargets(project).find((candidate) => candidate.id === direct) : proxied(project, str(dependency?.targetProxy));
|
|
1702
|
+
if (resolved) found.push(resolved);
|
|
1703
|
+
}
|
|
1704
|
+
for (const phaseId of list(target.buildPhases)) {
|
|
1705
|
+
const phase = project.object(phaseId);
|
|
1706
|
+
if (phase?.isa !== "PBXFrameworksBuildPhase") continue;
|
|
1707
|
+
for (const buildFileId of list(phase.files)) {
|
|
1708
|
+
const file = project.object(str(project.object(buildFileId)?.fileRef));
|
|
1709
|
+
const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path2.default.basename(str(file.path) ?? "")) : void 0;
|
|
1710
|
+
if (resolved) found.push(resolved);
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
return found.filter(
|
|
1714
|
+
(candidate) => MODULE_PRODUCTS.has(str(candidate.target.productType) ?? "")
|
|
1715
|
+
);
|
|
1716
|
+
};
|
|
1717
|
+
const order = [];
|
|
1718
|
+
const visited = /* @__PURE__ */ new Set();
|
|
1719
|
+
const visit = (ref) => {
|
|
1720
|
+
if (visited.has(ref)) return;
|
|
1721
|
+
visited.add(ref);
|
|
1722
|
+
for (const dependency of dependenciesOf(ref)) visit(dependency);
|
|
1723
|
+
order.push(ref);
|
|
1724
|
+
};
|
|
1725
|
+
visit(app);
|
|
1726
|
+
const moduleTarget = (ref) => {
|
|
1727
|
+
const name = str(ref.target.name) ?? ref.id;
|
|
1728
|
+
const { get: settings2, keys } = targetSettings(ref, {
|
|
1729
|
+
TARGET_NAME: name,
|
|
1730
|
+
PROJECT_NAME: import_node_path2.default.basename(ref.project.xcodeproj, ".xcodeproj"),
|
|
1731
|
+
SRCROOT: ref.project.projectDir,
|
|
1732
|
+
SOURCE_ROOT: ref.project.projectDir,
|
|
1733
|
+
PROJECT_DIR: ref.project.projectDir,
|
|
1734
|
+
DEVELOPMENT_LANGUAGE: str(ref.project.project.developmentRegion) ?? "en"
|
|
1735
|
+
});
|
|
1736
|
+
const swiftVersion = Number.parseFloat(settings2("SWIFT_VERSION") || "5");
|
|
1737
|
+
return {
|
|
1738
|
+
settings: settings2,
|
|
1739
|
+
keys,
|
|
1740
|
+
module: {
|
|
1741
|
+
name,
|
|
1742
|
+
moduleName: applyOperator(settings2("PRODUCT_MODULE_NAME"), "c99extidentifier"),
|
|
1743
|
+
...targetMembers(ref),
|
|
1744
|
+
languageMode: swiftVersion >= 6 ? 6 : 5,
|
|
1745
|
+
mainActorIsolation: settings2("SWIFT_DEFAULT_ACTOR_ISOLATION") === "MainActor"
|
|
1746
|
+
}
|
|
1747
|
+
};
|
|
1748
|
+
};
|
|
1749
|
+
const { settings, keys: settingKeys, module: module2 } = moduleTarget(app);
|
|
1750
|
+
const frameworks = order.slice(0, -1).map((ref) => moduleTarget(ref).module);
|
|
1751
|
+
const expandValue = (value) => {
|
|
1752
|
+
if (typeof value === "string") return expand(value, settings);
|
|
1753
|
+
if (Array.isArray(value)) return value.map(expandValue);
|
|
1754
|
+
if (typeof value === "object" && !(value instanceof Date) && !Buffer.isBuffer(value)) {
|
|
1755
|
+
return Object.fromEntries(
|
|
1756
|
+
Object.entries(value).map(([key, value2]) => [key, expandValue(value2)])
|
|
1757
|
+
);
|
|
1758
|
+
}
|
|
1759
|
+
return value;
|
|
1760
|
+
};
|
|
1761
|
+
const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path2.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
|
|
1762
|
+
const sourceInfo = infoPlistFile ? import_plist2.default.parse(import_node_fs3.default.readFileSync(infoPlistFile, "utf8")) : {};
|
|
1763
|
+
if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
|
|
1764
|
+
throw new Error(`${module2.name} Info.plist must contain a dictionary`);
|
|
1765
|
+
}
|
|
1766
|
+
const info = {};
|
|
1767
|
+
for (const [key, value] of Object.entries(sourceInfo)) info[key] = expandValue(value);
|
|
1768
|
+
for (const key of settingKeys) {
|
|
1769
|
+
if (!key.startsWith("INFOPLIST_KEY_") || key.endsWith("_Generation")) continue;
|
|
1770
|
+
const value = settings(key);
|
|
1771
|
+
info[key.slice("INFOPLIST_KEY_".length)] = value === "YES" ? true : value === "NO" ? false : value;
|
|
1772
|
+
}
|
|
1773
|
+
if (settings("INFOPLIST_KEY_UIApplicationSceneManifest_Generation") === "YES" && info.UIApplicationSceneManifest === void 0) {
|
|
1774
|
+
info.UIApplicationSceneManifest = {
|
|
1775
|
+
UIApplicationSupportsMultipleScenes: true,
|
|
1776
|
+
UISceneConfigurations: {}
|
|
1777
|
+
};
|
|
1778
|
+
}
|
|
1779
|
+
const localPackageDirs = [
|
|
1780
|
+
...listed.filter((reference) => import_node_fs3.default.existsSync(import_node_path2.default.join(reference, "Package.swift"))),
|
|
1781
|
+
...projects.flatMap(
|
|
1782
|
+
(project) => Object.entries(project.objects).flatMap(([id, entry]) => {
|
|
1783
|
+
if (!isDict(entry)) return [];
|
|
1784
|
+
const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path2.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
|
|
1785
|
+
return candidate && import_node_fs3.default.existsSync(import_node_path2.default.join(candidate, "Package.swift")) ? [candidate] : [];
|
|
1786
|
+
})
|
|
1787
|
+
)
|
|
1788
|
+
];
|
|
1789
|
+
const graphs = /* @__PURE__ */ new Map();
|
|
1790
|
+
const graphOf = (dir) => {
|
|
1791
|
+
const cached = graphs.get(dir);
|
|
1792
|
+
if (cached) return cached;
|
|
1793
|
+
const graph = swiftManifestGraph(
|
|
1794
|
+
import_node_fs3.default.readFileSync(import_node_path2.default.join(dir, "Package.swift"), "utf8")
|
|
1795
|
+
);
|
|
1796
|
+
graphs.set(dir, graph);
|
|
1797
|
+
return graph;
|
|
1798
|
+
};
|
|
1799
|
+
const localProducts = /* @__PURE__ */ new Map();
|
|
1800
|
+
for (const dir of localPackageDirs) {
|
|
1801
|
+
for (const product of graphOf(dir).products.keys()) {
|
|
1802
|
+
if (!localProducts.has(product)) localProducts.set(product, dir);
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
const localPackages = /* @__PURE__ */ new Set();
|
|
1806
|
+
const remoteProducts = [];
|
|
1807
|
+
const unresolvedProducts = [];
|
|
1808
|
+
for (const { project, target } of order) {
|
|
1809
|
+
const productDependencies = [
|
|
1810
|
+
...list(target.packageProductDependencies),
|
|
1811
|
+
...list(target.dependencies).flatMap((id) => {
|
|
1812
|
+
const productRef = str(project.object(id)?.productRef);
|
|
1813
|
+
return productRef ? [productRef] : [];
|
|
1814
|
+
})
|
|
1815
|
+
];
|
|
1816
|
+
for (const dependencyId of productDependencies) {
|
|
1817
|
+
const dependency = project.object(dependencyId);
|
|
1818
|
+
const product = str(dependency?.productName)?.replace(/^plugin:/, "");
|
|
1819
|
+
if (!dependency || !product) continue;
|
|
1820
|
+
const reference = project.object(str(dependency.package));
|
|
1821
|
+
if (reference?.isa === "XCRemoteSwiftPackageReference") {
|
|
1822
|
+
if (!remoteProducts.some((entry) => entry.product === product))
|
|
1823
|
+
remoteProducts.push({
|
|
1824
|
+
product,
|
|
1825
|
+
repositoryURL: str(reference.repositoryURL) ?? ""
|
|
1826
|
+
});
|
|
1827
|
+
} else if (reference?.isa === "XCLocalSwiftPackageReference") {
|
|
1828
|
+
localPackages.add(
|
|
1829
|
+
import_node_path2.default.resolve(project.projectDir, str(reference.relativePath) ?? "")
|
|
1830
|
+
);
|
|
1831
|
+
} else if (localProducts.has(product)) {
|
|
1832
|
+
localPackages.add(localProducts.get(product));
|
|
1833
|
+
} else if (!unresolvedProducts.includes(product)) unresolvedProducts.push(product);
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
const pending = [...localPackages];
|
|
1837
|
+
while (pending.length > 0) {
|
|
1838
|
+
const dir = pending.pop();
|
|
1839
|
+
const graph = graphOf(dir);
|
|
1840
|
+
for (const relative2 of graph.packagePaths) {
|
|
1841
|
+
const next = import_node_path2.default.resolve(dir, relative2);
|
|
1842
|
+
if (localPackages.has(next) || !import_node_fs3.default.existsSync(import_node_path2.default.join(next, "Package.swift")))
|
|
1843
|
+
continue;
|
|
1844
|
+
localPackages.add(next);
|
|
1845
|
+
pending.push(next);
|
|
1846
|
+
}
|
|
1847
|
+
for (const dependencies of graph.dependencies.values()) {
|
|
1848
|
+
for (const dependency of dependencies) {
|
|
1849
|
+
if (dependency.kind !== "product") continue;
|
|
1850
|
+
const url = graph.packageURLs.get(dependency.package);
|
|
1851
|
+
if (url && !remoteProducts.some((entry) => entry.product === dependency.name))
|
|
1852
|
+
remoteProducts.push({ product: dependency.name, repositoryURL: url });
|
|
1853
|
+
}
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1856
|
+
const resolvedFile = import_node_path2.default.join(
|
|
1857
|
+
workspace ?? import_node_path2.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
|
|
1858
|
+
"xcshareddata",
|
|
1859
|
+
"swiftpm",
|
|
1860
|
+
"Package.resolved"
|
|
1861
|
+
);
|
|
1862
|
+
const used = [app, ...order].map((ref) => ref.project);
|
|
1863
|
+
return {
|
|
1864
|
+
...module2,
|
|
1865
|
+
rootDir: commonAncestor(
|
|
1866
|
+
[
|
|
1867
|
+
workspace ? import_node_path2.default.dirname(workspace) : app.project.projectDir,
|
|
1868
|
+
...used.map((project) => project.projectDir),
|
|
1869
|
+
...localPackages
|
|
1870
|
+
].map((dir) => import_node_fs3.default.realpathSync(dir))
|
|
1871
|
+
),
|
|
1872
|
+
pbxprojs: [...new Set(used.map((project) => project.pbxproj))].sort(),
|
|
1873
|
+
infoPlist: import_plist2.default.build(info),
|
|
1874
|
+
infoPlistFile,
|
|
1875
|
+
frameworks,
|
|
1876
|
+
localPackages: [...localPackages].map((dir) => import_node_fs3.default.realpathSync(dir)).sort(),
|
|
1877
|
+
remoteProducts,
|
|
1878
|
+
packageResolved: import_node_fs3.default.existsSync(resolvedFile) ? resolvedFile : null,
|
|
1879
|
+
unresolvedProducts,
|
|
1880
|
+
appTargets: appTargetNames
|
|
1881
|
+
};
|
|
1882
|
+
}
|
|
1883
|
+
|
|
1031
1884
|
// src/native-firebase-config.ts
|
|
1032
1885
|
function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
1033
1886
|
const result = {};
|
|
1034
1887
|
let config = {};
|
|
1035
|
-
const appJsonPath =
|
|
1036
|
-
const appJson =
|
|
1888
|
+
const appJsonPath = import_node_path3.default.join(projectRoot, "app.json");
|
|
1889
|
+
const appJson = import_node_fs4.default.existsSync(appJsonPath) ? JSON.parse(import_node_fs4.default.readFileSync(appJsonPath, "utf8")) : null;
|
|
1037
1890
|
const staticExpo = isRecord2(appJson) && (isRecord2(appJson.expo) || [appJson.ios, appJson.android].some(
|
|
1038
1891
|
(value) => isRecord2(value) && typeof value.googleServicesFile === "string"
|
|
1039
1892
|
));
|
|
@@ -1042,9 +1895,9 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
1042
1895
|
"app.config.ts",
|
|
1043
1896
|
"app.config.cjs",
|
|
1044
1897
|
"app.config.mjs"
|
|
1045
|
-
].some((name) =>
|
|
1898
|
+
].some((name) => import_node_fs4.default.existsSync(import_node_path3.default.join(projectRoot, name)));
|
|
1046
1899
|
if (staticExpo || dynamicExpo) {
|
|
1047
|
-
const require2 = (0, import_node_module.createRequire)(
|
|
1900
|
+
const require2 = (0, import_node_module.createRequire)(import_node_path3.default.join(projectRoot, "package.json"));
|
|
1048
1901
|
const configModule = require2("@expo/config");
|
|
1049
1902
|
if (!isRecord2(configModule) || typeof configModule.getConfig !== "function")
|
|
1050
1903
|
throw new Error("Expo native configuration is unavailable.");
|
|
@@ -1056,109 +1909,23 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
1056
1909
|
}
|
|
1057
1910
|
const ios = config.ios;
|
|
1058
1911
|
if (platforms.includes("ios") && (!isRecord2(ios) || typeof ios.googleServicesFile !== "string")) {
|
|
1059
|
-
const iosRoot =
|
|
1060
|
-
if (
|
|
1061
|
-
const projects =
|
|
1912
|
+
const iosRoot = import_node_path3.default.join(projectRoot, "ios");
|
|
1913
|
+
if (import_node_fs4.default.existsSync(iosRoot)) {
|
|
1914
|
+
const projects = import_node_fs4.default.readdirSync(iosRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory() && entry.name.endsWith(".xcodeproj"));
|
|
1062
1915
|
if (projects.length > 1)
|
|
1063
1916
|
throw new Error("native Firebase configuration requires a selected Xcode project");
|
|
1064
1917
|
if (projects.length === 1) {
|
|
1065
|
-
const
|
|
1066
|
-
const
|
|
1067
|
-
if (
|
|
1068
|
-
throw new Error("native Xcode project parser is unavailable");
|
|
1069
|
-
const project = Reflect.apply(xcode.project, xcode, [
|
|
1070
|
-
import_node_path2.default.join(iosRoot, projects[0].name, "project.pbxproj")
|
|
1071
|
-
]);
|
|
1072
|
-
if (!isRecord2(project) || typeof project.parseSync !== "function")
|
|
1073
|
-
throw new Error("native Xcode project is malformed");
|
|
1074
|
-
Reflect.apply(project.parseSync, project, []);
|
|
1075
|
-
const hash = project.hash;
|
|
1076
|
-
const native = isRecord2(hash) ? hash.project : null;
|
|
1077
|
-
const objects = isRecord2(native) ? native.objects : null;
|
|
1078
|
-
if (!isRecord2(objects)) throw new Error("native Xcode objects are malformed");
|
|
1079
|
-
const unquote = (value) => typeof value === "string" ? value.replace(/^"|"$/g, "") : "";
|
|
1080
|
-
const targets = isRecord2(objects.PBXNativeTarget) ? Object.values(objects.PBXNativeTarget).filter(
|
|
1081
|
-
(target2) => isRecord2(target2) && unquote(target2.productType) === "com.apple.product-type.application"
|
|
1082
|
-
) : [];
|
|
1083
|
-
if (targets.length > 1)
|
|
1918
|
+
const xcodeproj = import_node_path3.default.join(iosRoot, projects[0].name);
|
|
1919
|
+
const appTargets = listXcodeAppTargets(xcodeproj);
|
|
1920
|
+
if (appTargets.length > 1)
|
|
1084
1921
|
throw new Error("native Firebase configuration requires a selected app target");
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
const
|
|
1088
|
-
|
|
1089
|
-
const groups = isRecord2(objects.PBXGroup) ? objects.PBXGroup : {};
|
|
1090
|
-
const references = isRecord2(objects.PBXFileReference) ? objects.PBXFileReference : {};
|
|
1091
|
-
const nativeProjects = isRecord2(objects.PBXProject) ? Object.values(objects.PBXProject) : [];
|
|
1092
|
-
const roots = nativeProjects.filter(isRecord2).map((value) => value.mainGroup);
|
|
1093
|
-
const pending = roots.filter((id) => typeof id === "string").map((id) => ({ id, base: iosRoot }));
|
|
1094
|
-
const visited = /* @__PURE__ */ new Map();
|
|
1095
|
-
while (pending.length) {
|
|
1096
|
-
const item = pending.pop();
|
|
1097
|
-
if (!item) break;
|
|
1098
|
-
const previous = visited.get(item.id);
|
|
1099
|
-
if (previous !== void 0) {
|
|
1100
|
-
if (previous !== item.base)
|
|
1101
|
-
throw new Error("native Xcode group has ambiguous parents");
|
|
1102
|
-
continue;
|
|
1103
|
-
}
|
|
1104
|
-
visited.set(item.id, item.base);
|
|
1105
|
-
const group = groups[item.id];
|
|
1106
|
-
if (!isRecord2(group) || !Array.isArray(group.children)) continue;
|
|
1107
|
-
const sourceTree = unquote(group.sourceTree);
|
|
1108
|
-
if (sourceTree && sourceTree !== "<group>" && sourceTree !== "SOURCE_ROOT")
|
|
1109
|
-
continue;
|
|
1110
|
-
const directory = import_node_path2.default.resolve(
|
|
1111
|
-
sourceTree === "SOURCE_ROOT" ? iosRoot : item.base,
|
|
1112
|
-
unquote(group.path)
|
|
1113
|
-
);
|
|
1114
|
-
for (const child of group.children) {
|
|
1115
|
-
if (!isRecord2(child) || typeof child.value !== "string") continue;
|
|
1116
|
-
if (isRecord2(groups[child.value])) {
|
|
1117
|
-
pending.push({ id: child.value, base: directory });
|
|
1118
|
-
continue;
|
|
1119
|
-
}
|
|
1120
|
-
const file = references[child.value];
|
|
1121
|
-
if (!isRecord2(file)) continue;
|
|
1122
|
-
const tree = unquote(file.sourceTree);
|
|
1123
|
-
if (tree !== "<group>" && tree !== "SOURCE_ROOT") continue;
|
|
1124
|
-
const filePath = import_node_path2.default.resolve(
|
|
1125
|
-
tree === "SOURCE_ROOT" ? iosRoot : directory,
|
|
1126
|
-
unquote(file.path)
|
|
1127
|
-
);
|
|
1128
|
-
const values = filePaths.get(child.value) ?? /* @__PURE__ */ new Set();
|
|
1129
|
-
values.add(filePath);
|
|
1130
|
-
filePaths.set(child.value, values);
|
|
1131
|
-
}
|
|
1132
|
-
}
|
|
1133
|
-
const buildFiles = isRecord2(objects.PBXBuildFile) ? objects.PBXBuildFile : {};
|
|
1134
|
-
const filesInPhase = (section, name) => {
|
|
1135
|
-
if (!isRecord2(section)) return [];
|
|
1136
|
-
const paths = [];
|
|
1137
|
-
for (const phase of buildPhases) {
|
|
1138
|
-
if (!isRecord2(phase) || typeof phase.value !== "string") continue;
|
|
1139
|
-
const value = section[phase.value];
|
|
1140
|
-
if (!isRecord2(value) || !Array.isArray(value.files)) continue;
|
|
1141
|
-
for (const entry of value.files) {
|
|
1142
|
-
if (!isRecord2(entry) || typeof entry.value !== "string") continue;
|
|
1143
|
-
const file = buildFiles[entry.value];
|
|
1144
|
-
if (!isRecord2(file) || typeof file.fileRef !== "string") continue;
|
|
1145
|
-
const reference = references[file.fileRef];
|
|
1146
|
-
if (!isRecord2(reference) || !name.test(import_node_path2.default.basename(unquote(reference.path))))
|
|
1147
|
-
continue;
|
|
1148
|
-
const candidates = filePaths.get(file.fileRef);
|
|
1149
|
-
if (!candidates || candidates.size !== 1)
|
|
1150
|
-
throw new Error("native Firebase build resource path is unresolved");
|
|
1151
|
-
paths.push(...candidates);
|
|
1152
|
-
}
|
|
1153
|
-
}
|
|
1154
|
-
return paths;
|
|
1155
|
-
};
|
|
1156
|
-
const delegates = filesInPhase(
|
|
1157
|
-
objects.PBXSourcesBuildPhase,
|
|
1158
|
-
/^AppDelegate\.(swift|mm|m)$/
|
|
1922
|
+
if (appTargets.length === 1) {
|
|
1923
|
+
const app = readXcodeAppTarget(xcodeproj, appTargets[0]);
|
|
1924
|
+
const delegates = app.allSources.filter(
|
|
1925
|
+
(file) => /^AppDelegate\.(swift|mm|m)$/.test(import_node_path3.default.basename(file))
|
|
1159
1926
|
);
|
|
1160
1927
|
const defaultConfigured = delegates.some((file) => {
|
|
1161
|
-
const source =
|
|
1928
|
+
const source = import_node_fs4.default.readFileSync(file, "utf8").replace(
|
|
1162
1929
|
/\/\*[\s\S]*?\*\/|\/\/[^\n]*|"(?:\\.|[^"\\])*"/g,
|
|
1163
1930
|
(token) => token.startsWith('"') ? '""' : token.replace(/[^\n]/g, " ")
|
|
1164
1931
|
);
|
|
@@ -1185,15 +1952,19 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
1185
1952
|
return true;
|
|
1186
1953
|
});
|
|
1187
1954
|
if (defaultConfigured) {
|
|
1188
|
-
const resources =
|
|
1189
|
-
|
|
1190
|
-
/^GoogleService-Info\.plist$/
|
|
1955
|
+
const resources = app.resources.filter(
|
|
1956
|
+
(file) => /^GoogleService-Info\.plist$/.test(import_node_path3.default.basename(file))
|
|
1191
1957
|
);
|
|
1192
1958
|
if (resources.length !== 1)
|
|
1193
1959
|
throw new Error(
|
|
1194
1960
|
"native Firebase default initialization requires one GoogleService-Info.plist build resource"
|
|
1195
1961
|
);
|
|
1196
|
-
config.ios = {
|
|
1962
|
+
config.ios = {
|
|
1963
|
+
googleServicesFile: import_node_path3.default.relative(
|
|
1964
|
+
import_node_fs4.default.realpathSync(projectRoot),
|
|
1965
|
+
resources[0]
|
|
1966
|
+
)
|
|
1967
|
+
};
|
|
1197
1968
|
}
|
|
1198
1969
|
}
|
|
1199
1970
|
}
|
|
@@ -1203,8 +1974,8 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
1203
1974
|
const native = config[platform];
|
|
1204
1975
|
if (!isRecord2(native) || typeof native.googleServicesFile !== "string") continue;
|
|
1205
1976
|
try {
|
|
1206
|
-
const source =
|
|
1207
|
-
|
|
1977
|
+
const source = import_node_fs4.default.readFileSync(
|
|
1978
|
+
import_node_path3.default.resolve(projectRoot, native.googleServicesFile),
|
|
1208
1979
|
"utf8"
|
|
1209
1980
|
);
|
|
1210
1981
|
const parsed = platform === "ios" ? parsePlistSource(source) : JSON.parse(source);
|
|
@@ -1346,28 +2117,28 @@ function isValidRuntimeVersion(value) {
|
|
|
1346
2117
|
}
|
|
1347
2118
|
|
|
1348
2119
|
// src/home-paths.ts
|
|
1349
|
-
var
|
|
2120
|
+
var import_node_fs5 = __toESM(require("node:fs"), 1);
|
|
1350
2121
|
var import_node_os = require("node:os");
|
|
1351
|
-
var
|
|
2122
|
+
var import_node_path4 = __toESM(require("node:path"), 1);
|
|
1352
2123
|
var PEACH_HOME_ENV = "PEACH_HOME";
|
|
1353
2124
|
var ACTIVE_RUNTIME_FILE = "active";
|
|
1354
2125
|
function rnxHomeDir() {
|
|
1355
2126
|
const override = process.env[PEACH_HOME_ENV];
|
|
1356
|
-
if (override && override.length > 0) return
|
|
1357
|
-
return
|
|
2127
|
+
if (override && override.length > 0) return import_node_path4.default.resolve(override);
|
|
2128
|
+
return import_node_path4.default.join((0, import_node_os.homedir)(), ".peach");
|
|
1358
2129
|
}
|
|
1359
2130
|
function runtimesDir() {
|
|
1360
|
-
return
|
|
2131
|
+
return import_node_path4.default.join(rnxHomeDir(), "runtimes");
|
|
1361
2132
|
}
|
|
1362
2133
|
function runtimeDir(version) {
|
|
1363
|
-
return
|
|
2134
|
+
return import_node_path4.default.join(runtimesDir(), version);
|
|
1364
2135
|
}
|
|
1365
2136
|
function activeRuntimeFile() {
|
|
1366
|
-
return
|
|
2137
|
+
return import_node_path4.default.join(runtimesDir(), ACTIVE_RUNTIME_FILE);
|
|
1367
2138
|
}
|
|
1368
2139
|
function readActiveRuntime() {
|
|
1369
2140
|
try {
|
|
1370
|
-
const value =
|
|
2141
|
+
const value = import_node_fs5.default.readFileSync(activeRuntimeFile(), "utf8").trim();
|
|
1371
2142
|
return value.length > 0 ? value : null;
|
|
1372
2143
|
} catch {
|
|
1373
2144
|
return null;
|