peachsim 0.1.751 → 0.1.753
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/agent-identity.cjs +1 -1
- package/dist-lib/agent-sessions.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cli-constants.cjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +571 -300
- package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +906 -135
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +907 -136
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/render-mode.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +767 -574
- package/dist-lib/swift-compile.cjs +1 -1
- package/dist-lib/swift-compile.mjs +1 -1
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +465 -194
- package/dist-lib/vite.cjs +1 -1
- package/package.json +1 -1
- package/src/home-paths.ts +1 -0
- package/src/native-firebase-config.ts +17 -111
- package/src/swift-host.ts +51 -18
- package/src/xcode-project.ts +590 -245
package/dist-lib/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.753 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -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;
|
|
@@ -4953,8 +4953,8 @@ ${METRO_MODULE_PATHS_PREFIX}`);
|
|
|
4953
4953
|
if (moduleFooter < 0) return withoutExisting + footer;
|
|
4954
4954
|
return withoutExisting.slice(0, moduleFooter) + footer + withoutExisting.slice(moduleFooter);
|
|
4955
4955
|
}
|
|
4956
|
-
function plistString(
|
|
4957
|
-
const match =
|
|
4956
|
+
function plistString(plist3, key) {
|
|
4957
|
+
const match = plist3.match(new RegExp(`<key>${key}</key>\\s*<string>([^<]*)</string>`));
|
|
4958
4958
|
return match ? match[1].trim() : null;
|
|
4959
4959
|
}
|
|
4960
4960
|
function resolveBuildSetting(value, settings, depth = 0) {
|
|
@@ -5024,9 +5024,9 @@ function appTargetReleaseSettings(pbxproj, targetName, infoPlistRelativePath) {
|
|
|
5024
5024
|
candidates.push({ name: match[1], settings });
|
|
5025
5025
|
}
|
|
5026
5026
|
const plistMatch = (settings) => {
|
|
5027
|
-
const
|
|
5028
|
-
if (!
|
|
5029
|
-
const normalized =
|
|
5027
|
+
const plist3 = settings.INFOPLIST_FILE;
|
|
5028
|
+
if (!plist3) return false;
|
|
5029
|
+
const normalized = plist3.replace(/^"|"$/g, "");
|
|
5030
5030
|
return normalized === infoPlistRelativePath || infoPlistRelativePath.endsWith(`/${normalized}`) || normalized.endsWith(`/${infoPlistRelativePath}`);
|
|
5031
5031
|
};
|
|
5032
5032
|
const named = (settings) => resolveBuildSetting(settings.PRODUCT_NAME ?? "", settings) === targetName;
|
|
@@ -5038,7 +5038,7 @@ function appTargetReleaseSettings(pbxproj, targetName, infoPlistRelativePath) {
|
|
|
5038
5038
|
}
|
|
5039
5039
|
function nativeAppIdentityFromIos(files, parseInfoPlist) {
|
|
5040
5040
|
const pbxprojPath = Object.keys(files).find(
|
|
5041
|
-
(
|
|
5041
|
+
(path10) => /(?:^|\/)ios\/[^/]+\.xcodeproj\/project\.pbxproj$/.test(path10)
|
|
5042
5042
|
);
|
|
5043
5043
|
if (!pbxprojPath) return null;
|
|
5044
5044
|
const pbxproj = files[pbxprojPath];
|
|
@@ -5050,10 +5050,10 @@ function nativeAppIdentityFromIos(files, parseInfoPlist) {
|
|
|
5050
5050
|
].map((match) => match[1])
|
|
5051
5051
|
);
|
|
5052
5052
|
const appDelegatePattern = /(?:^|\/)ios\/([^/]+)\/AppDelegate\.(?:swift|mm|m)$/;
|
|
5053
|
-
const targetName = Object.keys(files).filter((
|
|
5053
|
+
const targetName = Object.keys(files).filter((path10) => !path10.includes("/Pods/")).map((path10) => path10.match(appDelegatePattern)?.[1]).find((name2) => name2 !== void 0 && applicationTargets.has(name2)) ?? null;
|
|
5054
5054
|
if (!targetName) return null;
|
|
5055
|
-
const
|
|
5056
|
-
if (!
|
|
5055
|
+
const plist3 = files[`ios/${targetName}/Info.plist`];
|
|
5056
|
+
if (!plist3) return null;
|
|
5057
5057
|
const settings = appTargetReleaseSettings(
|
|
5058
5058
|
pbxproj,
|
|
5059
5059
|
targetName,
|
|
@@ -5062,29 +5062,29 @@ function nativeAppIdentityFromIos(files, parseInfoPlist) {
|
|
|
5062
5062
|
if (!settings) return null;
|
|
5063
5063
|
const bundleIdentifier = identityFieldFrom(
|
|
5064
5064
|
settings,
|
|
5065
|
-
plistString(
|
|
5065
|
+
plistString(plist3, "CFBundleIdentifier"),
|
|
5066
5066
|
settings.PRODUCT_BUNDLE_IDENTIFIER
|
|
5067
5067
|
);
|
|
5068
5068
|
if (!bundleIdentifier) return null;
|
|
5069
5069
|
const appVersion = identityFieldFrom(
|
|
5070
5070
|
settings,
|
|
5071
|
-
plistString(
|
|
5071
|
+
plistString(plist3, "CFBundleShortVersionString"),
|
|
5072
5072
|
settings.MARKETING_VERSION
|
|
5073
5073
|
);
|
|
5074
5074
|
const buildVersion = identityFieldFrom(
|
|
5075
5075
|
settings,
|
|
5076
|
-
plistString(
|
|
5076
|
+
plistString(plist3, "CFBundleVersion"),
|
|
5077
5077
|
settings.CURRENT_PROJECT_VERSION
|
|
5078
5078
|
);
|
|
5079
5079
|
if (!appVersion || !buildVersion) return null;
|
|
5080
5080
|
const bundleName = identityFieldFrom(
|
|
5081
5081
|
settings,
|
|
5082
|
-
plistString(
|
|
5082
|
+
plistString(plist3, "CFBundleName"),
|
|
5083
5083
|
settings.PRODUCT_NAME
|
|
5084
5084
|
) ?? resolvedIdentityField(resolveBuildSetting(settings.PRODUCT_NAME ?? "", settings)) ?? resolvedIdentityField(targetName);
|
|
5085
5085
|
if (!bundleName) return null;
|
|
5086
|
-
const applicationName = identityFieldFrom(settings, plistString(
|
|
5087
|
-
const dictionary = parseInfoPlist(
|
|
5086
|
+
const applicationName = identityFieldFrom(settings, plistString(plist3, "CFBundleDisplayName"), void 0) ?? bundleName;
|
|
5087
|
+
const dictionary = parseInfoPlist(plist3);
|
|
5088
5088
|
if (!isRecord2(dictionary)) throw new Error("native app Info.plist is not a dictionary");
|
|
5089
5089
|
const permissionUsageDescriptions = {};
|
|
5090
5090
|
for (const [key, value] of Object.entries(dictionary)) {
|
|
@@ -5125,9 +5125,9 @@ function extractNativeAppIdentityFromFiles(files, platform, parseInfoPlist) {
|
|
|
5125
5125
|
}
|
|
5126
5126
|
|
|
5127
5127
|
// src/native-firebase-config.ts
|
|
5128
|
-
var
|
|
5128
|
+
var import_node_fs7 = __toESM(require("node:fs"), 1);
|
|
5129
5129
|
var import_node_module2 = require("node:module");
|
|
5130
|
-
var
|
|
5130
|
+
var import_node_path7 = __toESM(require("node:path"), 1);
|
|
5131
5131
|
|
|
5132
5132
|
// src/plist.ts
|
|
5133
5133
|
var import_plist = __toESM(require_plist(), 1);
|
|
@@ -5135,12 +5135,865 @@ function parsePlistSource(source) {
|
|
|
5135
5135
|
return import_plist.default.parse(source);
|
|
5136
5136
|
}
|
|
5137
5137
|
|
|
5138
|
+
// src/xcode-project.ts
|
|
5139
|
+
var import_node_fs6 = __toESM(require("node:fs"), 1);
|
|
5140
|
+
var import_node_path6 = __toESM(require("node:path"), 1);
|
|
5141
|
+
var import_plist2 = __toESM(require_plist(), 1);
|
|
5142
|
+
|
|
5143
|
+
// src/swift-package.ts
|
|
5144
|
+
var MANIFEST_DECLARATIONS = [
|
|
5145
|
+
"executableTarget",
|
|
5146
|
+
"testTarget",
|
|
5147
|
+
"binaryTarget",
|
|
5148
|
+
"systemLibrary",
|
|
5149
|
+
"macro",
|
|
5150
|
+
"plugin",
|
|
5151
|
+
"target",
|
|
5152
|
+
"library",
|
|
5153
|
+
"executable",
|
|
5154
|
+
"package"
|
|
5155
|
+
];
|
|
5156
|
+
function manifestCalls(manifest, kinds) {
|
|
5157
|
+
const code = manifest.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:"])\/\/[^\n]*/g, "$1");
|
|
5158
|
+
const calls = [];
|
|
5159
|
+
const pattern = new RegExp(`\\.(${MANIFEST_DECLARATIONS.join("|")})\\s*\\(`, "g");
|
|
5160
|
+
let match;
|
|
5161
|
+
while ((match = pattern.exec(code)) !== null) {
|
|
5162
|
+
let depth = 1;
|
|
5163
|
+
const start = pattern.lastIndex;
|
|
5164
|
+
let i = start;
|
|
5165
|
+
let inString = false;
|
|
5166
|
+
let escaped = false;
|
|
5167
|
+
let flat = "";
|
|
5168
|
+
while (i < code.length && depth > 0) {
|
|
5169
|
+
const ch = code[i];
|
|
5170
|
+
if (inString) {
|
|
5171
|
+
if (escaped) escaped = false;
|
|
5172
|
+
else if (ch === "\\") escaped = true;
|
|
5173
|
+
else if (ch === '"') inString = false;
|
|
5174
|
+
if (depth === 1) flat += ch;
|
|
5175
|
+
} else if (ch === '"') {
|
|
5176
|
+
inString = true;
|
|
5177
|
+
if (depth === 1) flat += ch;
|
|
5178
|
+
} else if (ch === "(") {
|
|
5179
|
+
depth++;
|
|
5180
|
+
if (depth === 1) flat += ch;
|
|
5181
|
+
} else if (ch === ")") {
|
|
5182
|
+
depth--;
|
|
5183
|
+
if (depth >= 1) flat += ch;
|
|
5184
|
+
} else if (depth === 1) {
|
|
5185
|
+
flat += ch;
|
|
5186
|
+
}
|
|
5187
|
+
i++;
|
|
5188
|
+
}
|
|
5189
|
+
if (kinds.includes(match[1]))
|
|
5190
|
+
calls.push({ kind: match[1], flat, call: code.slice(start, i) });
|
|
5191
|
+
pattern.lastIndex = i;
|
|
5192
|
+
}
|
|
5193
|
+
return calls;
|
|
5194
|
+
}
|
|
5195
|
+
var NAME = /\bname\s*:\s*"([^"]+)"/;
|
|
5196
|
+
function listArgument(call, label) {
|
|
5197
|
+
const start = new RegExp(`\\b${label}\\s*:\\s*\\[`).exec(call);
|
|
5198
|
+
if (!start) return [];
|
|
5199
|
+
const items = [];
|
|
5200
|
+
let depth = 0;
|
|
5201
|
+
let inString = false;
|
|
5202
|
+
let item = "";
|
|
5203
|
+
for (let i = start.index + start[0].length; i < call.length; i++) {
|
|
5204
|
+
const ch = call[i];
|
|
5205
|
+
if (inString) {
|
|
5206
|
+
item += ch;
|
|
5207
|
+
if (ch === '"' && call[i - 1] !== "\\") inString = false;
|
|
5208
|
+
continue;
|
|
5209
|
+
}
|
|
5210
|
+
if (ch === '"') inString = true;
|
|
5211
|
+
else if (ch === "(" || ch === "[") depth++;
|
|
5212
|
+
else if (ch === ")" || ch === "]") {
|
|
5213
|
+
if (depth === 0) break;
|
|
5214
|
+
depth--;
|
|
5215
|
+
} else if (ch === "," && depth === 0) {
|
|
5216
|
+
items.push(item.trim());
|
|
5217
|
+
item = "";
|
|
5218
|
+
continue;
|
|
5219
|
+
}
|
|
5220
|
+
item += ch;
|
|
5221
|
+
}
|
|
5222
|
+
if (item.trim()) items.push(item.trim());
|
|
5223
|
+
return items;
|
|
5224
|
+
}
|
|
5225
|
+
function swiftPackageIdentity(url) {
|
|
5226
|
+
return (url.split("/").pop() ?? url).replace(/\.git$/, "").toLowerCase();
|
|
5227
|
+
}
|
|
5228
|
+
function swiftManifestGraph(manifest) {
|
|
5229
|
+
const graph = {
|
|
5230
|
+
products: /* @__PURE__ */ new Map(),
|
|
5231
|
+
dependencies: /* @__PURE__ */ new Map(),
|
|
5232
|
+
binaryTargets: /* @__PURE__ */ new Set(),
|
|
5233
|
+
systemLibraries: /* @__PURE__ */ new Set(),
|
|
5234
|
+
packageURLs: /* @__PURE__ */ new Map(),
|
|
5235
|
+
packagePaths: []
|
|
5236
|
+
};
|
|
5237
|
+
for (const { kind, flat, call } of manifestCalls(manifest, [
|
|
5238
|
+
"library",
|
|
5239
|
+
"executableTarget",
|
|
5240
|
+
"target",
|
|
5241
|
+
"binaryTarget",
|
|
5242
|
+
"systemLibrary",
|
|
5243
|
+
"package"
|
|
5244
|
+
])) {
|
|
5245
|
+
if (kind === "package") {
|
|
5246
|
+
const local = /\bpath\s*:\s*"([^"]+)"/.exec(flat)?.[1];
|
|
5247
|
+
if (local) graph.packagePaths.push(local);
|
|
5248
|
+
const url = /\burl\s*:\s*"([^"]+)"/.exec(flat)?.[1];
|
|
5249
|
+
if (!url) continue;
|
|
5250
|
+
graph.packageURLs.set(swiftPackageIdentity(url), url);
|
|
5251
|
+
const name3 = NAME.exec(flat)?.[1];
|
|
5252
|
+
if (name3) graph.packageURLs.set(name3.toLowerCase(), url);
|
|
5253
|
+
continue;
|
|
5254
|
+
}
|
|
5255
|
+
const name2 = NAME.exec(flat)?.[1];
|
|
5256
|
+
if (!name2) continue;
|
|
5257
|
+
if (kind === "library") {
|
|
5258
|
+
graph.products.set(
|
|
5259
|
+
name2,
|
|
5260
|
+
listArgument(call, "targets").flatMap(
|
|
5261
|
+
(item) => /^"([^"]+)"$/.exec(item)?.[1] ?? []
|
|
5262
|
+
)
|
|
5263
|
+
);
|
|
5264
|
+
continue;
|
|
5265
|
+
}
|
|
5266
|
+
if (kind === "binaryTarget") graph.binaryTargets.add(name2);
|
|
5267
|
+
if (kind === "systemLibrary") graph.systemLibraries.add(name2);
|
|
5268
|
+
const dependencies = [];
|
|
5269
|
+
for (const item of listArgument(call, "dependencies")) {
|
|
5270
|
+
const platforms = /condition\s*:\s*\.when\(\s*platforms\s*:\s*\[([^\]]*)\]/.exec(
|
|
5271
|
+
item
|
|
5272
|
+
)?.[1];
|
|
5273
|
+
if (platforms !== void 0 && !/\.iOS\b/.test(platforms)) continue;
|
|
5274
|
+
if (/condition\s*:\s*\.when\([^)]*\btraits\s*:/.test(item)) continue;
|
|
5275
|
+
const plain = /^"([^"]+)"$/.exec(item)?.[1];
|
|
5276
|
+
const product = /^\.product(?:Item)?\(\s*name\s*:\s*"([^"]+)"\s*,\s*package\s*:\s*"([^"]+)"/.exec(
|
|
5277
|
+
item
|
|
5278
|
+
);
|
|
5279
|
+
const target = /^\.(?:target|byName)(?:Item)?\(\s*name\s*:\s*"([^"]+)"/.exec(
|
|
5280
|
+
item
|
|
5281
|
+
)?.[1];
|
|
5282
|
+
if (plain) dependencies.push({ kind: "target", name: plain });
|
|
5283
|
+
else if (product)
|
|
5284
|
+
dependencies.push({
|
|
5285
|
+
kind: "product",
|
|
5286
|
+
name: product[1],
|
|
5287
|
+
package: product[2].toLowerCase()
|
|
5288
|
+
});
|
|
5289
|
+
else if (target) dependencies.push({ kind: "target", name: target });
|
|
5290
|
+
}
|
|
5291
|
+
graph.dependencies.set(name2, dependencies);
|
|
5292
|
+
}
|
|
5293
|
+
for (const dependencies of graph.dependencies.values()) {
|
|
5294
|
+
for (const [index, dependency] of dependencies.entries()) {
|
|
5295
|
+
if (dependency.kind === "target" && !graph.dependencies.has(dependency.name))
|
|
5296
|
+
dependencies[index] = {
|
|
5297
|
+
kind: "product",
|
|
5298
|
+
name: dependency.name,
|
|
5299
|
+
package: dependency.name.toLowerCase()
|
|
5300
|
+
};
|
|
5301
|
+
}
|
|
5302
|
+
}
|
|
5303
|
+
return graph;
|
|
5304
|
+
}
|
|
5305
|
+
|
|
5306
|
+
// src/xcode-project.ts
|
|
5307
|
+
function parseOpenStepPlist(text) {
|
|
5308
|
+
let i = 0;
|
|
5309
|
+
const fail = (message) => {
|
|
5310
|
+
const line = text.slice(0, i).split("\n").length;
|
|
5311
|
+
throw new Error(`project.pbxproj line ${line}: ${message}`);
|
|
5312
|
+
};
|
|
5313
|
+
const skip = () => {
|
|
5314
|
+
for (; ; ) {
|
|
5315
|
+
const ch = text[i];
|
|
5316
|
+
if (ch === " " || ch === " " || ch === "\n" || ch === "\r") i++;
|
|
5317
|
+
else if (ch === "/" && text[i + 1] === "*") {
|
|
5318
|
+
const end = text.indexOf("*/", i + 2);
|
|
5319
|
+
if (end < 0) fail("unterminated comment");
|
|
5320
|
+
i = end + 2;
|
|
5321
|
+
} else if (ch === "/" && text[i + 1] === "/") {
|
|
5322
|
+
const end = text.indexOf("\n", i);
|
|
5323
|
+
i = end < 0 ? text.length : end + 1;
|
|
5324
|
+
} else return;
|
|
5325
|
+
}
|
|
5326
|
+
};
|
|
5327
|
+
const quoted = () => {
|
|
5328
|
+
i++;
|
|
5329
|
+
let out = "";
|
|
5330
|
+
for (; ; ) {
|
|
5331
|
+
const ch = text[i++];
|
|
5332
|
+
if (ch === void 0) fail("unterminated string");
|
|
5333
|
+
if (ch === '"') return out;
|
|
5334
|
+
if (ch !== "\\") {
|
|
5335
|
+
out += ch;
|
|
5336
|
+
continue;
|
|
5337
|
+
}
|
|
5338
|
+
const next = text[i++];
|
|
5339
|
+
if (next === "n") out += "\n";
|
|
5340
|
+
else if (next === "t") out += " ";
|
|
5341
|
+
else if (next === "r") out += "\r";
|
|
5342
|
+
else if (next === "U") {
|
|
5343
|
+
out += String.fromCharCode(parseInt(text.slice(i, i + 4), 16));
|
|
5344
|
+
i += 4;
|
|
5345
|
+
} else out += next;
|
|
5346
|
+
}
|
|
5347
|
+
};
|
|
5348
|
+
const value = () => {
|
|
5349
|
+
skip();
|
|
5350
|
+
const ch = text[i];
|
|
5351
|
+
if (ch === "{") {
|
|
5352
|
+
i++;
|
|
5353
|
+
const dict = {};
|
|
5354
|
+
for (; ; ) {
|
|
5355
|
+
skip();
|
|
5356
|
+
if (text[i] === "}") {
|
|
5357
|
+
i++;
|
|
5358
|
+
return dict;
|
|
5359
|
+
}
|
|
5360
|
+
const key = value();
|
|
5361
|
+
if (typeof key !== "string") fail("dictionary key is not a string");
|
|
5362
|
+
skip();
|
|
5363
|
+
if (text[i++] !== "=") fail("expected =");
|
|
5364
|
+
dict[key] = value();
|
|
5365
|
+
skip();
|
|
5366
|
+
if (text[i++] !== ";") fail("expected ;");
|
|
5367
|
+
}
|
|
5368
|
+
}
|
|
5369
|
+
if (ch === "(") {
|
|
5370
|
+
i++;
|
|
5371
|
+
const list2 = [];
|
|
5372
|
+
for (; ; ) {
|
|
5373
|
+
skip();
|
|
5374
|
+
if (text[i] === ")") {
|
|
5375
|
+
i++;
|
|
5376
|
+
return list2;
|
|
5377
|
+
}
|
|
5378
|
+
list2.push(value());
|
|
5379
|
+
skip();
|
|
5380
|
+
if (text[i] === ",") i++;
|
|
5381
|
+
else if (text[i] !== ")") fail("expected , or )");
|
|
5382
|
+
}
|
|
5383
|
+
}
|
|
5384
|
+
if (ch === '"') return quoted();
|
|
5385
|
+
const start = i;
|
|
5386
|
+
while (i < text.length && /[A-Za-z0-9_$+/:.\-<>]/.test(text[i])) i++;
|
|
5387
|
+
if (i === start) fail(`unexpected ${JSON.stringify(ch ?? "end of file")}`);
|
|
5388
|
+
return text.slice(start, i);
|
|
5389
|
+
};
|
|
5390
|
+
if (text.startsWith("// !$*UTF8*$!")) i = text.indexOf("\n") + 1;
|
|
5391
|
+
const root = value();
|
|
5392
|
+
skip();
|
|
5393
|
+
if (i !== text.length) fail("trailing content");
|
|
5394
|
+
return root;
|
|
5395
|
+
}
|
|
5396
|
+
var isDict = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5397
|
+
var str = (value) => typeof value === "string" ? value : void 0;
|
|
5398
|
+
var list = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
5399
|
+
var APPLICATION = "com.apple.product-type.application";
|
|
5400
|
+
var MODULE_PRODUCTS = /* @__PURE__ */ new Set([
|
|
5401
|
+
"com.apple.product-type.framework",
|
|
5402
|
+
"com.apple.product-type.framework.static",
|
|
5403
|
+
"com.apple.product-type.library.static",
|
|
5404
|
+
"com.apple.product-type.library.dynamic"
|
|
5405
|
+
]);
|
|
5406
|
+
var NEVER_MEMBER = /(?:^|\/)(?:Info\.plist|[^/]+\.entitlements|[^/]+\.xcconfig|\.DS_Store)$/;
|
|
5407
|
+
var BUNDLE_DIR = /\.(xcassets|bundle|lproj|xcdatamodeld|scnassets|spriteatlas|rcproject|storyboardc|icon)$/;
|
|
5408
|
+
var CONDITIONS = {
|
|
5409
|
+
sdk: "iphonesimulator",
|
|
5410
|
+
arch: "arm64",
|
|
5411
|
+
variant: "normal"
|
|
5412
|
+
};
|
|
5413
|
+
function walkFiles(dir) {
|
|
5414
|
+
if (!import_node_fs6.default.existsSync(dir)) return [];
|
|
5415
|
+
const out = [];
|
|
5416
|
+
for (const entry of import_node_fs6.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
|
|
5417
|
+
if (entry.name.startsWith(".")) continue;
|
|
5418
|
+
const full = import_node_path6.default.join(dir, entry.name);
|
|
5419
|
+
if (entry.isDirectory()) out.push(...walkFiles(full));
|
|
5420
|
+
else if (entry.isFile()) out.push(full);
|
|
5421
|
+
}
|
|
5422
|
+
return out;
|
|
5423
|
+
}
|
|
5424
|
+
var isDirectory = (dir) => import_node_fs6.default.existsSync(dir) && import_node_fs6.default.statSync(dir).isDirectory();
|
|
5425
|
+
function readXcconfig(file, seen = /* @__PURE__ */ new Set()) {
|
|
5426
|
+
if (seen.has(file) || !import_node_fs6.default.existsSync(file)) return {};
|
|
5427
|
+
seen.add(file);
|
|
5428
|
+
const settings = {};
|
|
5429
|
+
for (const raw of import_node_fs6.default.readFileSync(file, "utf8").split("\n")) {
|
|
5430
|
+
const line = raw.replace(/\/\/.*$/, "").trim();
|
|
5431
|
+
const include = /^#include\??\s+"([^"]+)"/.exec(line);
|
|
5432
|
+
if (include) {
|
|
5433
|
+
Object.assign(
|
|
5434
|
+
settings,
|
|
5435
|
+
readXcconfig(import_node_path6.default.resolve(import_node_path6.default.dirname(file), include[1]), seen)
|
|
5436
|
+
);
|
|
5437
|
+
continue;
|
|
5438
|
+
}
|
|
5439
|
+
const setting = /^([A-Za-z_][A-Za-z0-9_]*(?:\[[^\]]*\])*)\s*=\s*(.*)$/.exec(line);
|
|
5440
|
+
if (setting)
|
|
5441
|
+
settings[setting[1].replace(/\s+/g, "")] = setting[2].replace(/;$/, "").trim();
|
|
5442
|
+
}
|
|
5443
|
+
return settings;
|
|
5444
|
+
}
|
|
5445
|
+
function applyConditions(raw, configuration) {
|
|
5446
|
+
const plain = {};
|
|
5447
|
+
const conditional = {};
|
|
5448
|
+
for (const [key, value] of Object.entries(raw)) {
|
|
5449
|
+
const bracket = key.indexOf("[");
|
|
5450
|
+
if (bracket === -1) {
|
|
5451
|
+
plain[key] = value;
|
|
5452
|
+
continue;
|
|
5453
|
+
}
|
|
5454
|
+
const matches = [...key.slice(bracket).matchAll(/\[([^=\]]+)=([^\]]*)\]/g)].every(
|
|
5455
|
+
([, name2, pattern]) => {
|
|
5456
|
+
const actual = name2 === "config" ? configuration : CONDITIONS[name2];
|
|
5457
|
+
return actual !== void 0 && new RegExp(
|
|
5458
|
+
`^${pattern.replace(/[.+^${}()|\\]/g, "\\$&").replaceAll("*", ".*").replaceAll("?", ".")}$`
|
|
5459
|
+
).test(actual);
|
|
5460
|
+
}
|
|
5461
|
+
);
|
|
5462
|
+
if (matches) conditional[key.slice(0, bracket)] = value;
|
|
5463
|
+
}
|
|
5464
|
+
return { ...plain, ...conditional };
|
|
5465
|
+
}
|
|
5466
|
+
function applyOperator(value, operator) {
|
|
5467
|
+
if (operator.startsWith("default=")) return value === "" ? operator.slice(8) : value;
|
|
5468
|
+
switch (operator) {
|
|
5469
|
+
case "lower":
|
|
5470
|
+
return value.toLowerCase();
|
|
5471
|
+
case "upper":
|
|
5472
|
+
return value.toUpperCase();
|
|
5473
|
+
case "rfc1034identifier":
|
|
5474
|
+
return value.replace(/[^A-Za-z0-9-]/g, "-").replace(/^[0-9]/, "-");
|
|
5475
|
+
case "identifier":
|
|
5476
|
+
case "c99extidentifier":
|
|
5477
|
+
return value.replace(/[^A-Za-z0-9_]/g, "_").replace(/^[0-9]/, "_");
|
|
5478
|
+
}
|
|
5479
|
+
throw new Error(`unsupported build setting operator :${operator}`);
|
|
5480
|
+
}
|
|
5481
|
+
function decodeXml(text) {
|
|
5482
|
+
return text.replaceAll(""", '"').replaceAll("'", "'").replaceAll("<", "<").replaceAll(">", ">").replaceAll("&", "&");
|
|
5483
|
+
}
|
|
5484
|
+
function workspaceReferences(workspace) {
|
|
5485
|
+
const data = import_node_path6.default.join(workspace, "contents.xcworkspacedata");
|
|
5486
|
+
if (!import_node_fs6.default.existsSync(data))
|
|
5487
|
+
throw new Error(`${workspace} has no contents.xcworkspacedata`);
|
|
5488
|
+
const container = import_node_path6.default.dirname(workspace);
|
|
5489
|
+
const locate = (location, base) => {
|
|
5490
|
+
const colon = location.indexOf(":");
|
|
5491
|
+
const kind = location.slice(0, colon);
|
|
5492
|
+
const rest = location.slice(colon + 1);
|
|
5493
|
+
if (kind === "group") return import_node_path6.default.resolve(base, rest);
|
|
5494
|
+
if (kind === "container" || kind === "self") return import_node_path6.default.resolve(container, rest);
|
|
5495
|
+
if (kind === "absolute") return import_node_path6.default.resolve(rest);
|
|
5496
|
+
throw new Error(`${import_node_path6.default.basename(workspace)} has an unsupported location ${location}`);
|
|
5497
|
+
};
|
|
5498
|
+
const groups = [container];
|
|
5499
|
+
const references = [];
|
|
5500
|
+
for (const [, closing, tag, attributes, selfClosing] of import_node_fs6.default.readFileSync(data, "utf8").matchAll(/<(\/?)(Group|FileRef)\b([^>]*?)(\/?)>/g)) {
|
|
5501
|
+
if (closing) {
|
|
5502
|
+
if (tag === "Group") groups.pop();
|
|
5503
|
+
continue;
|
|
5504
|
+
}
|
|
5505
|
+
const base = groups.at(-1);
|
|
5506
|
+
const location = /\blocation\s*=\s*"([^"]*)"/.exec(attributes)?.[1];
|
|
5507
|
+
const resolved = location ? locate(decodeXml(location), base) : base;
|
|
5508
|
+
if (tag === "FileRef") references.push(resolved);
|
|
5509
|
+
else if (!selfClosing) groups.push(resolved);
|
|
5510
|
+
}
|
|
5511
|
+
return references;
|
|
5512
|
+
}
|
|
5513
|
+
var loaded = /* @__PURE__ */ new Map();
|
|
5514
|
+
function loadProject(xcodeproj) {
|
|
5515
|
+
const pbxproj = import_node_path6.default.join(xcodeproj, "project.pbxproj");
|
|
5516
|
+
if (!import_node_fs6.default.existsSync(pbxproj)) throw new Error(`${xcodeproj} has no project.pbxproj`);
|
|
5517
|
+
const mtimeMs = import_node_fs6.default.statSync(pbxproj).mtimeMs;
|
|
5518
|
+
const cached2 = loaded.get(pbxproj);
|
|
5519
|
+
if (cached2?.mtimeMs === mtimeMs) return cached2.project;
|
|
5520
|
+
const root = parseOpenStepPlist(import_node_fs6.default.readFileSync(pbxproj, "utf8"));
|
|
5521
|
+
if (!isDict(root) || !isDict(root.objects)) {
|
|
5522
|
+
throw new Error(`${pbxproj} has no objects table`);
|
|
5523
|
+
}
|
|
5524
|
+
const objects = root.objects;
|
|
5525
|
+
const object = (id) => {
|
|
5526
|
+
const found = id === void 0 ? void 0 : objects[id];
|
|
5527
|
+
return isDict(found) ? found : void 0;
|
|
5528
|
+
};
|
|
5529
|
+
const project = object(str(root.rootObject));
|
|
5530
|
+
if (!project || project.isa !== "PBXProject") {
|
|
5531
|
+
throw new Error(`${pbxproj} has no PBXProject root`);
|
|
5532
|
+
}
|
|
5533
|
+
const projectDir = import_node_fs6.default.realpathSync(
|
|
5534
|
+
import_node_path6.default.resolve(import_node_path6.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
|
|
5535
|
+
);
|
|
5536
|
+
const parent = /* @__PURE__ */ new Map();
|
|
5537
|
+
for (const [id, entry] of Object.entries(objects)) {
|
|
5538
|
+
if (!isDict(entry)) continue;
|
|
5539
|
+
if (entry.isa === "PBXGroup" || entry.isa === "PBXVariantGroup") {
|
|
5540
|
+
for (const child of list(entry.children)) parent.set(child, id);
|
|
5541
|
+
}
|
|
5542
|
+
}
|
|
5543
|
+
const resolvedPaths = /* @__PURE__ */ new Map();
|
|
5544
|
+
const resolvePath = (id) => {
|
|
5545
|
+
if (resolvedPaths.has(id)) return resolvedPaths.get(id);
|
|
5546
|
+
const entry = object(id);
|
|
5547
|
+
let result2 = null;
|
|
5548
|
+
if (entry) {
|
|
5549
|
+
const own = str(entry.path) ?? "";
|
|
5550
|
+
const tree = str(entry.sourceTree) ?? "<group>";
|
|
5551
|
+
if (tree === "<absolute>") result2 = own;
|
|
5552
|
+
else if (tree === "SOURCE_ROOT") result2 = import_node_path6.default.join(projectDir, own);
|
|
5553
|
+
else if (tree === "<group>") {
|
|
5554
|
+
const up = parent.get(id);
|
|
5555
|
+
const base = up ? resolvePath(up) : projectDir;
|
|
5556
|
+
result2 = base === null ? null : import_node_path6.default.join(base, own);
|
|
5557
|
+
}
|
|
5558
|
+
}
|
|
5559
|
+
resolvedPaths.set(id, result2);
|
|
5560
|
+
return result2;
|
|
5561
|
+
};
|
|
5562
|
+
const result = { xcodeproj, pbxproj, objects, project, projectDir, object, resolvePath };
|
|
5563
|
+
loaded.set(pbxproj, { mtimeMs, project: result });
|
|
5564
|
+
return result;
|
|
5565
|
+
}
|
|
5566
|
+
function targetSettings(ref, builtins) {
|
|
5567
|
+
const { project, target } = ref;
|
|
5568
|
+
const level = (listId) => {
|
|
5569
|
+
const configs = list(project.object(listId)?.buildConfigurations).map(project.object);
|
|
5570
|
+
const config = configs.find((entry) => entry?.name === "Debug") ?? configs.find(Boolean);
|
|
5571
|
+
if (!config) return [];
|
|
5572
|
+
const name2 = str(config.name) ?? "Debug";
|
|
5573
|
+
const base = str(config.baseConfigurationReference);
|
|
5574
|
+
const own = isDict(config.buildSettings) ? config.buildSettings : {};
|
|
5575
|
+
return [
|
|
5576
|
+
applyConditions(base ? readXcconfig(project.resolvePath(base) ?? "") : {}, name2),
|
|
5577
|
+
applyConditions(
|
|
5578
|
+
Object.fromEntries(
|
|
5579
|
+
Object.entries(own).flatMap(
|
|
5580
|
+
([key, value]) => typeof value === "string" ? [[key, value]] : Array.isArray(value) ? [[key, list(value).join(" ")]] : []
|
|
5581
|
+
)
|
|
5582
|
+
),
|
|
5583
|
+
name2
|
|
5584
|
+
)
|
|
5585
|
+
];
|
|
5586
|
+
};
|
|
5587
|
+
const levels = [
|
|
5588
|
+
builtins,
|
|
5589
|
+
...level(str(project.project.buildConfigurationList)),
|
|
5590
|
+
...level(str(target.buildConfigurationList))
|
|
5591
|
+
];
|
|
5592
|
+
const resolving = /* @__PURE__ */ new Set();
|
|
5593
|
+
const valueAt = (key, top) => {
|
|
5594
|
+
let at = top;
|
|
5595
|
+
while (at >= 0 && levels[at][key] === void 0) at--;
|
|
5596
|
+
if (at < 0) return derived(key);
|
|
5597
|
+
const marker = `${key}@${at}`;
|
|
5598
|
+
if (resolving.has(marker))
|
|
5599
|
+
throw new Error(`${str(target.name)} has a cyclic build setting ${key}`);
|
|
5600
|
+
resolving.add(marker);
|
|
5601
|
+
const value = expand(
|
|
5602
|
+
levels[at][key],
|
|
5603
|
+
(name2) => name2 === "inherited" ? valueAt(key, at - 1) : valueAt(name2, levels.length - 1)
|
|
5604
|
+
);
|
|
5605
|
+
resolving.delete(marker);
|
|
5606
|
+
return value;
|
|
5607
|
+
};
|
|
5608
|
+
const derived = (key) => {
|
|
5609
|
+
const get = (name2) => valueAt(name2, levels.length - 1);
|
|
5610
|
+
switch (key) {
|
|
5611
|
+
case "PRODUCT_NAME":
|
|
5612
|
+
return get("TARGET_NAME");
|
|
5613
|
+
case "PRODUCT_MODULE_NAME":
|
|
5614
|
+
return applyOperator(get("PRODUCT_NAME"), "c99extidentifier");
|
|
5615
|
+
case "EXECUTABLE_NAME":
|
|
5616
|
+
return get("PRODUCT_NAME");
|
|
5617
|
+
case "AppIdentifierPrefix":
|
|
5618
|
+
case "TeamIdentifierPrefix": {
|
|
5619
|
+
const team = get("DEVELOPMENT_TEAM");
|
|
5620
|
+
return get("CODE_SIGNING_ALLOWED") !== "NO" && team ? `${team}.` : "";
|
|
5621
|
+
}
|
|
5622
|
+
}
|
|
5623
|
+
return "";
|
|
5624
|
+
};
|
|
5625
|
+
return {
|
|
5626
|
+
get: (key) => valueAt(key, levels.length - 1),
|
|
5627
|
+
keys: new Set(levels.flatMap((values) => Object.keys(values)))
|
|
5628
|
+
};
|
|
5629
|
+
}
|
|
5630
|
+
function expand(value, lookup) {
|
|
5631
|
+
return value.replace(
|
|
5632
|
+
/\$(?:\(([A-Za-z_][A-Za-z0-9_]*)((?::[^)]*)?)\)|\{([A-Za-z_][A-Za-z0-9_]*)((?::[^}]*)?)\}|([A-Za-z_][A-Za-z0-9_]*))/g,
|
|
5633
|
+
(_match, paren, parenOps, brace, braceOps, bare) => {
|
|
5634
|
+
const name2 = paren ?? brace ?? bare;
|
|
5635
|
+
const operators = parenOps ?? braceOps ?? "";
|
|
5636
|
+
return operators.split(":").slice(1).reduce((current, operator) => applyOperator(current, operator), lookup(name2));
|
|
5637
|
+
}
|
|
5638
|
+
);
|
|
5639
|
+
}
|
|
5640
|
+
function targetMembers(ref) {
|
|
5641
|
+
const { project, target, id: targetId } = ref;
|
|
5642
|
+
const sources = /* @__PURE__ */ new Set();
|
|
5643
|
+
const allSources = /* @__PURE__ */ new Set();
|
|
5644
|
+
const resources = /* @__PURE__ */ new Set();
|
|
5645
|
+
const addResource = (file) => {
|
|
5646
|
+
if (isDirectory(file)) {
|
|
5647
|
+
for (const inner of walkFiles(file)) resources.add(inner);
|
|
5648
|
+
} else if (import_node_fs6.default.existsSync(file)) resources.add(file);
|
|
5649
|
+
};
|
|
5650
|
+
const fileRefPaths = (refId) => {
|
|
5651
|
+
const entry = project.object(refId);
|
|
5652
|
+
if (!entry) return [];
|
|
5653
|
+
if (entry.isa === "PBXVariantGroup") {
|
|
5654
|
+
return list(entry.children).flatMap((child) => {
|
|
5655
|
+
const resolved2 = project.resolvePath(child);
|
|
5656
|
+
return resolved2 ? [resolved2] : [];
|
|
5657
|
+
});
|
|
5658
|
+
}
|
|
5659
|
+
const resolved = project.resolvePath(refId);
|
|
5660
|
+
return resolved ? [resolved] : [];
|
|
5661
|
+
};
|
|
5662
|
+
for (const phaseId of list(target.buildPhases)) {
|
|
5663
|
+
const phase = project.object(phaseId);
|
|
5664
|
+
if (phase?.isa !== "PBXSourcesBuildPhase" && phase?.isa !== "PBXResourcesBuildPhase")
|
|
5665
|
+
continue;
|
|
5666
|
+
for (const buildFileId of list(phase.files)) {
|
|
5667
|
+
for (const file of fileRefPaths(str(project.object(buildFileId)?.fileRef) ?? "")) {
|
|
5668
|
+
if (phase.isa === "PBXSourcesBuildPhase") {
|
|
5669
|
+
if (!import_node_fs6.default.existsSync(file)) continue;
|
|
5670
|
+
allSources.add(file);
|
|
5671
|
+
if (file.endsWith(".swift")) sources.add(file);
|
|
5672
|
+
} else if (phase.isa === "PBXResourcesBuildPhase") addResource(file);
|
|
5673
|
+
}
|
|
5674
|
+
}
|
|
5675
|
+
}
|
|
5676
|
+
const addSynchronized = (folder, relative2) => {
|
|
5677
|
+
const file = import_node_path6.default.join(folder, relative2);
|
|
5678
|
+
if (NEVER_MEMBER.test(relative2)) return;
|
|
5679
|
+
if (file.endsWith(".swift")) {
|
|
5680
|
+
if (!relative2.split("/").some((segment) => BUNDLE_DIR.test(segment))) {
|
|
5681
|
+
sources.add(file);
|
|
5682
|
+
allSources.add(file);
|
|
5683
|
+
}
|
|
5684
|
+
} else if (/\.(h|m|mm|c|cpp|metal)$/.test(file)) {
|
|
5685
|
+
if (!file.endsWith(".h")) allSources.add(file);
|
|
5686
|
+
} else resources.add(file);
|
|
5687
|
+
};
|
|
5688
|
+
const owned = new Set(list(target.fileSystemSynchronizedGroups));
|
|
5689
|
+
for (const [groupId, group] of Object.entries(project.objects)) {
|
|
5690
|
+
if (!isDict(group) || group.isa !== "PBXFileSystemSynchronizedRootGroup") continue;
|
|
5691
|
+
const folder = project.resolvePath(groupId);
|
|
5692
|
+
if (!folder) continue;
|
|
5693
|
+
const exceptions = /* @__PURE__ */ new Set();
|
|
5694
|
+
for (const exceptionId of list(group.exceptions)) {
|
|
5695
|
+
const exception = project.object(exceptionId);
|
|
5696
|
+
if (exception?.target !== targetId) continue;
|
|
5697
|
+
for (const relative2 of list(exception.membershipExceptions))
|
|
5698
|
+
exceptions.add(relative2);
|
|
5699
|
+
}
|
|
5700
|
+
if (owned.has(groupId)) {
|
|
5701
|
+
for (const file of walkFiles(folder)) {
|
|
5702
|
+
const relative2 = import_node_path6.default.relative(folder, file).split(import_node_path6.default.sep).join("/");
|
|
5703
|
+
if ([...exceptions].some(
|
|
5704
|
+
(exception) => relative2 === exception || relative2.startsWith(`${exception}/`)
|
|
5705
|
+
))
|
|
5706
|
+
continue;
|
|
5707
|
+
addSynchronized(folder, relative2);
|
|
5708
|
+
}
|
|
5709
|
+
} else {
|
|
5710
|
+
for (const relative2 of exceptions) {
|
|
5711
|
+
const file = import_node_path6.default.join(folder, relative2);
|
|
5712
|
+
if (isDirectory(file)) {
|
|
5713
|
+
for (const inner of walkFiles(file))
|
|
5714
|
+
addSynchronized(
|
|
5715
|
+
folder,
|
|
5716
|
+
import_node_path6.default.relative(folder, inner).split(import_node_path6.default.sep).join("/")
|
|
5717
|
+
);
|
|
5718
|
+
} else if (import_node_fs6.default.existsSync(file)) addSynchronized(folder, relative2);
|
|
5719
|
+
}
|
|
5720
|
+
}
|
|
5721
|
+
}
|
|
5722
|
+
return {
|
|
5723
|
+
sources: [...sources].sort(),
|
|
5724
|
+
resources: [...resources].sort(),
|
|
5725
|
+
allSources: [...allSources].sort()
|
|
5726
|
+
};
|
|
5727
|
+
}
|
|
5728
|
+
function commonAncestor(dirs) {
|
|
5729
|
+
let common = dirs[0];
|
|
5730
|
+
for (const dir of dirs) {
|
|
5731
|
+
while (common !== import_node_path6.default.dirname(common) && import_node_path6.default.relative(common, dir).startsWith(".."))
|
|
5732
|
+
common = import_node_path6.default.dirname(common);
|
|
5733
|
+
}
|
|
5734
|
+
return common;
|
|
5735
|
+
}
|
|
5736
|
+
function workspaceProjects(xcodeprojOrWorkspace) {
|
|
5737
|
+
const listed = xcodeprojOrWorkspace.endsWith(".xcworkspace") ? workspaceReferences(xcodeprojOrWorkspace) : [xcodeprojOrWorkspace];
|
|
5738
|
+
const projects = [];
|
|
5739
|
+
const projectAt = /* @__PURE__ */ new Map();
|
|
5740
|
+
const addProject = (xcodeproj) => {
|
|
5741
|
+
const key = import_node_path6.default.resolve(xcodeproj);
|
|
5742
|
+
if (projectAt.has(key) || key.split(import_node_path6.default.sep).includes("Pods")) return;
|
|
5743
|
+
if (!import_node_fs6.default.existsSync(import_node_path6.default.join(key, "project.pbxproj"))) return;
|
|
5744
|
+
const project = loadProject(key);
|
|
5745
|
+
projectAt.set(key, project);
|
|
5746
|
+
projects.push(project);
|
|
5747
|
+
const nested = project.project.projectReferences;
|
|
5748
|
+
if (Array.isArray(nested)) {
|
|
5749
|
+
for (const entry of nested) {
|
|
5750
|
+
const ref = isDict(entry) ? str(entry.ProjectRef) : void 0;
|
|
5751
|
+
const resolved = ref ? project.resolvePath(ref) : null;
|
|
5752
|
+
if (resolved) addProject(resolved);
|
|
5753
|
+
}
|
|
5754
|
+
}
|
|
5755
|
+
};
|
|
5756
|
+
for (const reference of listed)
|
|
5757
|
+
if (reference.endsWith(".xcodeproj")) addProject(reference);
|
|
5758
|
+
if (projects.length === 0) {
|
|
5759
|
+
throw new Error(`${import_node_path6.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
|
|
5760
|
+
}
|
|
5761
|
+
return { listed, projects, projectAt };
|
|
5762
|
+
}
|
|
5763
|
+
var nativeTargets = (project) => list(project.project.targets).flatMap((id) => {
|
|
5764
|
+
const target = project.object(id);
|
|
5765
|
+
return target?.isa === "PBXNativeTarget" ? [{ project, id, target }] : [];
|
|
5766
|
+
});
|
|
5767
|
+
function listXcodeAppTargets(xcodeprojOrWorkspace) {
|
|
5768
|
+
return workspaceProjects(xcodeprojOrWorkspace).projects.flatMap(nativeTargets).filter((ref) => ref.target.productType === APPLICATION).map((ref) => str(ref.target.name) ?? ref.id);
|
|
5769
|
+
}
|
|
5770
|
+
function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
5771
|
+
const workspace = xcodeprojOrWorkspace.endsWith(".xcworkspace") ? xcodeprojOrWorkspace : null;
|
|
5772
|
+
const { listed, projects, projectAt } = workspaceProjects(xcodeprojOrWorkspace);
|
|
5773
|
+
const allTargets = projects.flatMap(nativeTargets);
|
|
5774
|
+
const appTargets = allTargets.filter((ref) => ref.target.productType === APPLICATION);
|
|
5775
|
+
const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
|
|
5776
|
+
const container = import_node_path6.default.basename(xcodeprojOrWorkspace);
|
|
5777
|
+
const named = targetName ? appTargets.filter((ref) => ref.target.name === targetName) : appTargets;
|
|
5778
|
+
if (named.length !== 1) {
|
|
5779
|
+
throw new Error(
|
|
5780
|
+
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`
|
|
5781
|
+
);
|
|
5782
|
+
}
|
|
5783
|
+
const app = named[0];
|
|
5784
|
+
const byProduct = /* @__PURE__ */ new Map();
|
|
5785
|
+
for (const ref of allTargets) {
|
|
5786
|
+
const product = ref.project.object(str(ref.target.productReference));
|
|
5787
|
+
const file = str(product?.path);
|
|
5788
|
+
if (file && !byProduct.has(import_node_path6.default.basename(file)))
|
|
5789
|
+
byProduct.set(import_node_path6.default.basename(file), ref);
|
|
5790
|
+
}
|
|
5791
|
+
const proxied = (project, proxyId) => {
|
|
5792
|
+
const proxy = project.object(proxyId);
|
|
5793
|
+
if (proxy?.isa !== "PBXContainerItemProxy") return void 0;
|
|
5794
|
+
const portal = str(proxy.containerPortal);
|
|
5795
|
+
const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path6.default.resolve(project.resolvePath(portal ?? "") ?? ""));
|
|
5796
|
+
const remote = str(proxy.remoteGlobalIDString);
|
|
5797
|
+
if (!owner || !remote) return void 0;
|
|
5798
|
+
return nativeTargets(owner).find(
|
|
5799
|
+
(ref) => ref.id === remote || str(ref.target.productReference) === remote
|
|
5800
|
+
);
|
|
5801
|
+
};
|
|
5802
|
+
const dependenciesOf = (ref) => {
|
|
5803
|
+
const { project, target } = ref;
|
|
5804
|
+
const found = [];
|
|
5805
|
+
for (const dependencyId of list(target.dependencies)) {
|
|
5806
|
+
const dependency = project.object(dependencyId);
|
|
5807
|
+
const direct = str(dependency?.target);
|
|
5808
|
+
const resolved = direct ? nativeTargets(project).find((candidate) => candidate.id === direct) : proxied(project, str(dependency?.targetProxy));
|
|
5809
|
+
if (resolved) found.push(resolved);
|
|
5810
|
+
}
|
|
5811
|
+
for (const phaseId of list(target.buildPhases)) {
|
|
5812
|
+
const phase = project.object(phaseId);
|
|
5813
|
+
if (phase?.isa !== "PBXFrameworksBuildPhase") continue;
|
|
5814
|
+
for (const buildFileId of list(phase.files)) {
|
|
5815
|
+
const file = project.object(str(project.object(buildFileId)?.fileRef));
|
|
5816
|
+
const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path6.default.basename(str(file.path) ?? "")) : void 0;
|
|
5817
|
+
if (resolved) found.push(resolved);
|
|
5818
|
+
}
|
|
5819
|
+
}
|
|
5820
|
+
return found.filter(
|
|
5821
|
+
(candidate) => MODULE_PRODUCTS.has(str(candidate.target.productType) ?? "")
|
|
5822
|
+
);
|
|
5823
|
+
};
|
|
5824
|
+
const order = [];
|
|
5825
|
+
const visited = /* @__PURE__ */ new Set();
|
|
5826
|
+
const visit = (ref) => {
|
|
5827
|
+
if (visited.has(ref)) return;
|
|
5828
|
+
visited.add(ref);
|
|
5829
|
+
for (const dependency of dependenciesOf(ref)) visit(dependency);
|
|
5830
|
+
order.push(ref);
|
|
5831
|
+
};
|
|
5832
|
+
visit(app);
|
|
5833
|
+
const moduleTarget = (ref) => {
|
|
5834
|
+
const name2 = str(ref.target.name) ?? ref.id;
|
|
5835
|
+
const { get: settings2, keys } = targetSettings(ref, {
|
|
5836
|
+
TARGET_NAME: name2,
|
|
5837
|
+
PROJECT_NAME: import_node_path6.default.basename(ref.project.xcodeproj, ".xcodeproj"),
|
|
5838
|
+
SRCROOT: ref.project.projectDir,
|
|
5839
|
+
SOURCE_ROOT: ref.project.projectDir,
|
|
5840
|
+
PROJECT_DIR: ref.project.projectDir,
|
|
5841
|
+
DEVELOPMENT_LANGUAGE: str(ref.project.project.developmentRegion) ?? "en"
|
|
5842
|
+
});
|
|
5843
|
+
const swiftVersion = Number.parseFloat(settings2("SWIFT_VERSION") || "5");
|
|
5844
|
+
return {
|
|
5845
|
+
settings: settings2,
|
|
5846
|
+
keys,
|
|
5847
|
+
module: {
|
|
5848
|
+
name: name2,
|
|
5849
|
+
moduleName: applyOperator(settings2("PRODUCT_MODULE_NAME"), "c99extidentifier"),
|
|
5850
|
+
...targetMembers(ref),
|
|
5851
|
+
languageMode: swiftVersion >= 6 ? 6 : 5,
|
|
5852
|
+
mainActorIsolation: settings2("SWIFT_DEFAULT_ACTOR_ISOLATION") === "MainActor"
|
|
5853
|
+
}
|
|
5854
|
+
};
|
|
5855
|
+
};
|
|
5856
|
+
const { settings, keys: settingKeys, module: module2 } = moduleTarget(app);
|
|
5857
|
+
const frameworks = order.slice(0, -1).map((ref) => moduleTarget(ref).module);
|
|
5858
|
+
const expandValue = (value) => {
|
|
5859
|
+
if (typeof value === "string") return expand(value, settings);
|
|
5860
|
+
if (Array.isArray(value)) return value.map(expandValue);
|
|
5861
|
+
if (typeof value === "object" && !(value instanceof Date) && !Buffer.isBuffer(value)) {
|
|
5862
|
+
return Object.fromEntries(
|
|
5863
|
+
Object.entries(value).map(([key, value2]) => [key, expandValue(value2)])
|
|
5864
|
+
);
|
|
5865
|
+
}
|
|
5866
|
+
return value;
|
|
5867
|
+
};
|
|
5868
|
+
const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path6.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
|
|
5869
|
+
const sourceInfo = infoPlistFile ? import_plist2.default.parse(import_node_fs6.default.readFileSync(infoPlistFile, "utf8")) : {};
|
|
5870
|
+
if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
|
|
5871
|
+
throw new Error(`${module2.name} Info.plist must contain a dictionary`);
|
|
5872
|
+
}
|
|
5873
|
+
const info = {};
|
|
5874
|
+
for (const [key, value] of Object.entries(sourceInfo)) info[key] = expandValue(value);
|
|
5875
|
+
for (const key of settingKeys) {
|
|
5876
|
+
if (!key.startsWith("INFOPLIST_KEY_") || key.endsWith("_Generation")) continue;
|
|
5877
|
+
const value = settings(key);
|
|
5878
|
+
info[key.slice("INFOPLIST_KEY_".length)] = value === "YES" ? true : value === "NO" ? false : value;
|
|
5879
|
+
}
|
|
5880
|
+
if (settings("INFOPLIST_KEY_UIApplicationSceneManifest_Generation") === "YES" && info.UIApplicationSceneManifest === void 0) {
|
|
5881
|
+
info.UIApplicationSceneManifest = {
|
|
5882
|
+
UIApplicationSupportsMultipleScenes: true,
|
|
5883
|
+
UISceneConfigurations: {}
|
|
5884
|
+
};
|
|
5885
|
+
}
|
|
5886
|
+
const localPackageDirs = [
|
|
5887
|
+
...listed.filter((reference) => import_node_fs6.default.existsSync(import_node_path6.default.join(reference, "Package.swift"))),
|
|
5888
|
+
...projects.flatMap(
|
|
5889
|
+
(project) => Object.entries(project.objects).flatMap(([id, entry]) => {
|
|
5890
|
+
if (!isDict(entry)) return [];
|
|
5891
|
+
const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path6.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
|
|
5892
|
+
return candidate && import_node_fs6.default.existsSync(import_node_path6.default.join(candidate, "Package.swift")) ? [candidate] : [];
|
|
5893
|
+
})
|
|
5894
|
+
)
|
|
5895
|
+
];
|
|
5896
|
+
const graphs = /* @__PURE__ */ new Map();
|
|
5897
|
+
const graphOf = (dir) => {
|
|
5898
|
+
const cached2 = graphs.get(dir);
|
|
5899
|
+
if (cached2) return cached2;
|
|
5900
|
+
const graph = swiftManifestGraph(
|
|
5901
|
+
import_node_fs6.default.readFileSync(import_node_path6.default.join(dir, "Package.swift"), "utf8")
|
|
5902
|
+
);
|
|
5903
|
+
graphs.set(dir, graph);
|
|
5904
|
+
return graph;
|
|
5905
|
+
};
|
|
5906
|
+
const localProducts = /* @__PURE__ */ new Map();
|
|
5907
|
+
for (const dir of localPackageDirs) {
|
|
5908
|
+
for (const product of graphOf(dir).products.keys()) {
|
|
5909
|
+
if (!localProducts.has(product)) localProducts.set(product, dir);
|
|
5910
|
+
}
|
|
5911
|
+
}
|
|
5912
|
+
const localPackages = /* @__PURE__ */ new Set();
|
|
5913
|
+
const remoteProducts = [];
|
|
5914
|
+
const unresolvedProducts = [];
|
|
5915
|
+
for (const { project, target } of order) {
|
|
5916
|
+
const productDependencies = [
|
|
5917
|
+
...list(target.packageProductDependencies),
|
|
5918
|
+
...list(target.dependencies).flatMap((id) => {
|
|
5919
|
+
const productRef = str(project.object(id)?.productRef);
|
|
5920
|
+
return productRef ? [productRef] : [];
|
|
5921
|
+
})
|
|
5922
|
+
];
|
|
5923
|
+
for (const dependencyId of productDependencies) {
|
|
5924
|
+
const dependency = project.object(dependencyId);
|
|
5925
|
+
const product = str(dependency?.productName)?.replace(/^plugin:/, "");
|
|
5926
|
+
if (!dependency || !product) continue;
|
|
5927
|
+
const reference = project.object(str(dependency.package));
|
|
5928
|
+
if (reference?.isa === "XCRemoteSwiftPackageReference") {
|
|
5929
|
+
if (!remoteProducts.some((entry) => entry.product === product))
|
|
5930
|
+
remoteProducts.push({
|
|
5931
|
+
product,
|
|
5932
|
+
repositoryURL: str(reference.repositoryURL) ?? ""
|
|
5933
|
+
});
|
|
5934
|
+
} else if (reference?.isa === "XCLocalSwiftPackageReference") {
|
|
5935
|
+
localPackages.add(
|
|
5936
|
+
import_node_path6.default.resolve(project.projectDir, str(reference.relativePath) ?? "")
|
|
5937
|
+
);
|
|
5938
|
+
} else if (localProducts.has(product)) {
|
|
5939
|
+
localPackages.add(localProducts.get(product));
|
|
5940
|
+
} else if (!unresolvedProducts.includes(product)) unresolvedProducts.push(product);
|
|
5941
|
+
}
|
|
5942
|
+
}
|
|
5943
|
+
const pending = [...localPackages];
|
|
5944
|
+
while (pending.length > 0) {
|
|
5945
|
+
const dir = pending.pop();
|
|
5946
|
+
const graph = graphOf(dir);
|
|
5947
|
+
for (const relative2 of graph.packagePaths) {
|
|
5948
|
+
const next = import_node_path6.default.resolve(dir, relative2);
|
|
5949
|
+
if (localPackages.has(next) || !import_node_fs6.default.existsSync(import_node_path6.default.join(next, "Package.swift")))
|
|
5950
|
+
continue;
|
|
5951
|
+
localPackages.add(next);
|
|
5952
|
+
pending.push(next);
|
|
5953
|
+
}
|
|
5954
|
+
for (const dependencies of graph.dependencies.values()) {
|
|
5955
|
+
for (const dependency of dependencies) {
|
|
5956
|
+
if (dependency.kind !== "product") continue;
|
|
5957
|
+
const url = graph.packageURLs.get(dependency.package);
|
|
5958
|
+
if (url && !remoteProducts.some((entry) => entry.product === dependency.name))
|
|
5959
|
+
remoteProducts.push({ product: dependency.name, repositoryURL: url });
|
|
5960
|
+
}
|
|
5961
|
+
}
|
|
5962
|
+
}
|
|
5963
|
+
const resolvedFile = import_node_path6.default.join(
|
|
5964
|
+
workspace ?? import_node_path6.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
|
|
5965
|
+
"xcshareddata",
|
|
5966
|
+
"swiftpm",
|
|
5967
|
+
"Package.resolved"
|
|
5968
|
+
);
|
|
5969
|
+
const used = [app, ...order].map((ref) => ref.project);
|
|
5970
|
+
return {
|
|
5971
|
+
...module2,
|
|
5972
|
+
rootDir: commonAncestor(
|
|
5973
|
+
[
|
|
5974
|
+
workspace ? import_node_path6.default.dirname(workspace) : app.project.projectDir,
|
|
5975
|
+
...used.map((project) => project.projectDir),
|
|
5976
|
+
...localPackages
|
|
5977
|
+
].map((dir) => import_node_fs6.default.realpathSync(dir))
|
|
5978
|
+
),
|
|
5979
|
+
pbxprojs: [...new Set(used.map((project) => project.pbxproj))].sort(),
|
|
5980
|
+
infoPlist: import_plist2.default.build(info),
|
|
5981
|
+
infoPlistFile,
|
|
5982
|
+
frameworks,
|
|
5983
|
+
localPackages: [...localPackages].map((dir) => import_node_fs6.default.realpathSync(dir)).sort(),
|
|
5984
|
+
remoteProducts,
|
|
5985
|
+
packageResolved: import_node_fs6.default.existsSync(resolvedFile) ? resolvedFile : null,
|
|
5986
|
+
unresolvedProducts,
|
|
5987
|
+
appTargets: appTargetNames
|
|
5988
|
+
};
|
|
5989
|
+
}
|
|
5990
|
+
|
|
5138
5991
|
// src/native-firebase-config.ts
|
|
5139
5992
|
function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
5140
5993
|
const result = {};
|
|
5141
5994
|
let config = {};
|
|
5142
|
-
const appJsonPath =
|
|
5143
|
-
const appJson =
|
|
5995
|
+
const appJsonPath = import_node_path7.default.join(projectRoot, "app.json");
|
|
5996
|
+
const appJson = import_node_fs7.default.existsSync(appJsonPath) ? JSON.parse(import_node_fs7.default.readFileSync(appJsonPath, "utf8")) : null;
|
|
5144
5997
|
const staticExpo = isRecord(appJson) && (isRecord(appJson.expo) || [appJson.ios, appJson.android].some(
|
|
5145
5998
|
(value) => isRecord(value) && typeof value.googleServicesFile === "string"
|
|
5146
5999
|
));
|
|
@@ -5149,9 +6002,9 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
5149
6002
|
"app.config.ts",
|
|
5150
6003
|
"app.config.cjs",
|
|
5151
6004
|
"app.config.mjs"
|
|
5152
|
-
].some((name2) =>
|
|
6005
|
+
].some((name2) => import_node_fs7.default.existsSync(import_node_path7.default.join(projectRoot, name2)));
|
|
5153
6006
|
if (staticExpo || dynamicExpo) {
|
|
5154
|
-
const require2 = (0, import_node_module2.createRequire)(
|
|
6007
|
+
const require2 = (0, import_node_module2.createRequire)(import_node_path7.default.join(projectRoot, "package.json"));
|
|
5155
6008
|
const configModule = require2("@expo/config");
|
|
5156
6009
|
if (!isRecord(configModule) || typeof configModule.getConfig !== "function")
|
|
5157
6010
|
throw new Error("Expo native configuration is unavailable.");
|
|
@@ -5163,109 +6016,23 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
5163
6016
|
}
|
|
5164
6017
|
const ios = config.ios;
|
|
5165
6018
|
if (platforms.includes("ios") && (!isRecord(ios) || typeof ios.googleServicesFile !== "string")) {
|
|
5166
|
-
const iosRoot =
|
|
5167
|
-
if (
|
|
5168
|
-
const projects =
|
|
6019
|
+
const iosRoot = import_node_path7.default.join(projectRoot, "ios");
|
|
6020
|
+
if (import_node_fs7.default.existsSync(iosRoot)) {
|
|
6021
|
+
const projects = import_node_fs7.default.readdirSync(iosRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory() && entry.name.endsWith(".xcodeproj"));
|
|
5169
6022
|
if (projects.length > 1)
|
|
5170
6023
|
throw new Error("native Firebase configuration requires a selected Xcode project");
|
|
5171
6024
|
if (projects.length === 1) {
|
|
5172
|
-
const
|
|
5173
|
-
const
|
|
5174
|
-
if (
|
|
5175
|
-
throw new Error("native Xcode project parser is unavailable");
|
|
5176
|
-
const project = Reflect.apply(xcode.project, xcode, [
|
|
5177
|
-
import_node_path6.default.join(iosRoot, projects[0].name, "project.pbxproj")
|
|
5178
|
-
]);
|
|
5179
|
-
if (!isRecord(project) || typeof project.parseSync !== "function")
|
|
5180
|
-
throw new Error("native Xcode project is malformed");
|
|
5181
|
-
Reflect.apply(project.parseSync, project, []);
|
|
5182
|
-
const hash = project.hash;
|
|
5183
|
-
const native = isRecord(hash) ? hash.project : null;
|
|
5184
|
-
const objects = isRecord(native) ? native.objects : null;
|
|
5185
|
-
if (!isRecord(objects)) throw new Error("native Xcode objects are malformed");
|
|
5186
|
-
const unquote = (value) => typeof value === "string" ? value.replace(/^"|"$/g, "") : "";
|
|
5187
|
-
const targets = isRecord(objects.PBXNativeTarget) ? Object.values(objects.PBXNativeTarget).filter(
|
|
5188
|
-
(target2) => isRecord(target2) && unquote(target2.productType) === "com.apple.product-type.application"
|
|
5189
|
-
) : [];
|
|
5190
|
-
if (targets.length > 1)
|
|
6025
|
+
const xcodeproj = import_node_path7.default.join(iosRoot, projects[0].name);
|
|
6026
|
+
const appTargets = listXcodeAppTargets(xcodeproj);
|
|
6027
|
+
if (appTargets.length > 1)
|
|
5191
6028
|
throw new Error("native Firebase configuration requires a selected app target");
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
const
|
|
5195
|
-
|
|
5196
|
-
const groups = isRecord(objects.PBXGroup) ? objects.PBXGroup : {};
|
|
5197
|
-
const references = isRecord(objects.PBXFileReference) ? objects.PBXFileReference : {};
|
|
5198
|
-
const nativeProjects = isRecord(objects.PBXProject) ? Object.values(objects.PBXProject) : [];
|
|
5199
|
-
const roots = nativeProjects.filter(isRecord).map((value) => value.mainGroup);
|
|
5200
|
-
const pending = roots.filter((id) => typeof id === "string").map((id) => ({ id, base: iosRoot }));
|
|
5201
|
-
const visited = /* @__PURE__ */ new Map();
|
|
5202
|
-
while (pending.length) {
|
|
5203
|
-
const item = pending.pop();
|
|
5204
|
-
if (!item) break;
|
|
5205
|
-
const previous = visited.get(item.id);
|
|
5206
|
-
if (previous !== void 0) {
|
|
5207
|
-
if (previous !== item.base)
|
|
5208
|
-
throw new Error("native Xcode group has ambiguous parents");
|
|
5209
|
-
continue;
|
|
5210
|
-
}
|
|
5211
|
-
visited.set(item.id, item.base);
|
|
5212
|
-
const group = groups[item.id];
|
|
5213
|
-
if (!isRecord(group) || !Array.isArray(group.children)) continue;
|
|
5214
|
-
const sourceTree = unquote(group.sourceTree);
|
|
5215
|
-
if (sourceTree && sourceTree !== "<group>" && sourceTree !== "SOURCE_ROOT")
|
|
5216
|
-
continue;
|
|
5217
|
-
const directory = import_node_path6.default.resolve(
|
|
5218
|
-
sourceTree === "SOURCE_ROOT" ? iosRoot : item.base,
|
|
5219
|
-
unquote(group.path)
|
|
5220
|
-
);
|
|
5221
|
-
for (const child of group.children) {
|
|
5222
|
-
if (!isRecord(child) || typeof child.value !== "string") continue;
|
|
5223
|
-
if (isRecord(groups[child.value])) {
|
|
5224
|
-
pending.push({ id: child.value, base: directory });
|
|
5225
|
-
continue;
|
|
5226
|
-
}
|
|
5227
|
-
const file = references[child.value];
|
|
5228
|
-
if (!isRecord(file)) continue;
|
|
5229
|
-
const tree = unquote(file.sourceTree);
|
|
5230
|
-
if (tree !== "<group>" && tree !== "SOURCE_ROOT") continue;
|
|
5231
|
-
const filePath = import_node_path6.default.resolve(
|
|
5232
|
-
tree === "SOURCE_ROOT" ? iosRoot : directory,
|
|
5233
|
-
unquote(file.path)
|
|
5234
|
-
);
|
|
5235
|
-
const values = filePaths.get(child.value) ?? /* @__PURE__ */ new Set();
|
|
5236
|
-
values.add(filePath);
|
|
5237
|
-
filePaths.set(child.value, values);
|
|
5238
|
-
}
|
|
5239
|
-
}
|
|
5240
|
-
const buildFiles = isRecord(objects.PBXBuildFile) ? objects.PBXBuildFile : {};
|
|
5241
|
-
const filesInPhase = (section, name2) => {
|
|
5242
|
-
if (!isRecord(section)) return [];
|
|
5243
|
-
const paths = [];
|
|
5244
|
-
for (const phase of buildPhases) {
|
|
5245
|
-
if (!isRecord(phase) || typeof phase.value !== "string") continue;
|
|
5246
|
-
const value = section[phase.value];
|
|
5247
|
-
if (!isRecord(value) || !Array.isArray(value.files)) continue;
|
|
5248
|
-
for (const entry of value.files) {
|
|
5249
|
-
if (!isRecord(entry) || typeof entry.value !== "string") continue;
|
|
5250
|
-
const file = buildFiles[entry.value];
|
|
5251
|
-
if (!isRecord(file) || typeof file.fileRef !== "string") continue;
|
|
5252
|
-
const reference = references[file.fileRef];
|
|
5253
|
-
if (!isRecord(reference) || !name2.test(import_node_path6.default.basename(unquote(reference.path))))
|
|
5254
|
-
continue;
|
|
5255
|
-
const candidates = filePaths.get(file.fileRef);
|
|
5256
|
-
if (!candidates || candidates.size !== 1)
|
|
5257
|
-
throw new Error("native Firebase build resource path is unresolved");
|
|
5258
|
-
paths.push(...candidates);
|
|
5259
|
-
}
|
|
5260
|
-
}
|
|
5261
|
-
return paths;
|
|
5262
|
-
};
|
|
5263
|
-
const delegates = filesInPhase(
|
|
5264
|
-
objects.PBXSourcesBuildPhase,
|
|
5265
|
-
/^AppDelegate\.(swift|mm|m)$/
|
|
6029
|
+
if (appTargets.length === 1) {
|
|
6030
|
+
const app = readXcodeAppTarget(xcodeproj, appTargets[0]);
|
|
6031
|
+
const delegates = app.allSources.filter(
|
|
6032
|
+
(file) => /^AppDelegate\.(swift|mm|m)$/.test(import_node_path7.default.basename(file))
|
|
5266
6033
|
);
|
|
5267
6034
|
const defaultConfigured = delegates.some((file) => {
|
|
5268
|
-
const source =
|
|
6035
|
+
const source = import_node_fs7.default.readFileSync(file, "utf8").replace(
|
|
5269
6036
|
/\/\*[\s\S]*?\*\/|\/\/[^\n]*|"(?:\\.|[^"\\])*"/g,
|
|
5270
6037
|
(token) => token.startsWith('"') ? '""' : token.replace(/[^\n]/g, " ")
|
|
5271
6038
|
);
|
|
@@ -5292,15 +6059,19 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
5292
6059
|
return true;
|
|
5293
6060
|
});
|
|
5294
6061
|
if (defaultConfigured) {
|
|
5295
|
-
const resources =
|
|
5296
|
-
|
|
5297
|
-
/^GoogleService-Info\.plist$/
|
|
6062
|
+
const resources = app.resources.filter(
|
|
6063
|
+
(file) => /^GoogleService-Info\.plist$/.test(import_node_path7.default.basename(file))
|
|
5298
6064
|
);
|
|
5299
6065
|
if (resources.length !== 1)
|
|
5300
6066
|
throw new Error(
|
|
5301
6067
|
"native Firebase default initialization requires one GoogleService-Info.plist build resource"
|
|
5302
6068
|
);
|
|
5303
|
-
config.ios = {
|
|
6069
|
+
config.ios = {
|
|
6070
|
+
googleServicesFile: import_node_path7.default.relative(
|
|
6071
|
+
import_node_fs7.default.realpathSync(projectRoot),
|
|
6072
|
+
resources[0]
|
|
6073
|
+
)
|
|
6074
|
+
};
|
|
5304
6075
|
}
|
|
5305
6076
|
}
|
|
5306
6077
|
}
|
|
@@ -5310,8 +6081,8 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"]) {
|
|
|
5310
6081
|
const native = config[platform];
|
|
5311
6082
|
if (!isRecord(native) || typeof native.googleServicesFile !== "string") continue;
|
|
5312
6083
|
try {
|
|
5313
|
-
const source =
|
|
5314
|
-
|
|
6084
|
+
const source = import_node_fs7.default.readFileSync(
|
|
6085
|
+
import_node_path7.default.resolve(projectRoot, native.googleServicesFile),
|
|
5315
6086
|
"utf8"
|
|
5316
6087
|
);
|
|
5317
6088
|
const parsed = platform === "ios" ? parsePlistSource(source) : JSON.parse(source);
|
|
@@ -5693,13 +6464,13 @@ function resolveMetroPort(server) {
|
|
|
5693
6464
|
var metro_plugin_default = withRNX;
|
|
5694
6465
|
|
|
5695
6466
|
// src/jump-to-source-babel.ts
|
|
5696
|
-
function normalizeSourcePath(
|
|
5697
|
-
const queryStart =
|
|
5698
|
-
const clean = queryStart >= 0 ?
|
|
6467
|
+
function normalizeSourcePath(path10) {
|
|
6468
|
+
const queryStart = path10.indexOf("?");
|
|
6469
|
+
const clean = queryStart >= 0 ? path10.slice(0, queryStart) : path10;
|
|
5699
6470
|
return clean.replace(/\\/g, "/");
|
|
5700
6471
|
}
|
|
5701
|
-
function matchesPath(
|
|
5702
|
-
return typeof matcher === "string" ?
|
|
6472
|
+
function matchesPath(path10, matcher) {
|
|
6473
|
+
return typeof matcher === "string" ? path10.includes(matcher) : matcher.test(path10);
|
|
5703
6474
|
}
|
|
5704
6475
|
function shouldStampFile(filename, options) {
|
|
5705
6476
|
const normalized = normalizeSourcePath(filename);
|
|
@@ -5732,11 +6503,11 @@ function sootsimJumpToSourceBabelPlugin(api, options = {}) {
|
|
|
5732
6503
|
return {
|
|
5733
6504
|
name: "sootsim-jump-to-source",
|
|
5734
6505
|
visitor: {
|
|
5735
|
-
JSXOpeningElement(
|
|
6506
|
+
JSXOpeningElement(path10, state) {
|
|
5736
6507
|
if (options.enabled === false) return;
|
|
5737
6508
|
const filename = state.file?.opts?.filename;
|
|
5738
6509
|
if (!filename || !shouldStampFile(filename, options)) return;
|
|
5739
|
-
const node =
|
|
6510
|
+
const node = path10.node;
|
|
5740
6511
|
const tagName = getJSXName(node.name);
|
|
5741
6512
|
if (!tagName || tagName === "Fragment" || tagName.endsWith(".Fragment")) return;
|
|
5742
6513
|
if (hasAttribute(node, attrName)) return;
|