peachsim 0.1.750 → 0.1.752
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/commands/inspect/settling.ts +7 -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 +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 +5 -3
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +1 -1
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/render-mode.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +5 -3
- package/dist-lib/sdk.mjs +5 -3
- package/dist-lib/skills.cjs +752 -479
- 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/swift-host.ts +51 -18
- package/src/vite-plugin.ts +3 -1
- package/src/xcode-project.ts +590 -245
package/dist-lib/vite-swift.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.752 | (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;
|
|
@@ -2047,8 +2047,8 @@ function flatScale(path11) {
|
|
|
2047
2047
|
function providesNamespace(text) {
|
|
2048
2048
|
if (text === null) return false;
|
|
2049
2049
|
try {
|
|
2050
|
-
const
|
|
2051
|
-
return
|
|
2050
|
+
const parsed = JSON.parse(text);
|
|
2051
|
+
return parsed?.properties?.["provides-namespace"] === true;
|
|
2052
2052
|
} catch {
|
|
2053
2053
|
return false;
|
|
2054
2054
|
}
|
|
@@ -2078,15 +2078,15 @@ function enumerateBundleImages(paths, readText) {
|
|
|
2078
2078
|
for (const contentsPath of catalogs) {
|
|
2079
2079
|
const name = catalogEntryName(contentsPath, ".imageset", readText);
|
|
2080
2080
|
if (name === null || seen.has(name)) continue;
|
|
2081
|
-
let
|
|
2081
|
+
let parsed;
|
|
2082
2082
|
try {
|
|
2083
2083
|
const text = readText(contentsPath);
|
|
2084
2084
|
if (text === null) continue;
|
|
2085
|
-
|
|
2085
|
+
parsed = JSON.parse(text);
|
|
2086
2086
|
} catch {
|
|
2087
2087
|
continue;
|
|
2088
2088
|
}
|
|
2089
|
-
const images =
|
|
2089
|
+
const images = parsed?.images;
|
|
2090
2090
|
if (!Array.isArray(images)) continue;
|
|
2091
2091
|
const dir = contentsPath.split("/").slice(0, -1).join("/");
|
|
2092
2092
|
const pick = pickImagesetFile(images);
|
|
@@ -2106,8 +2106,8 @@ function enumerateBundleImages(paths, readText) {
|
|
|
2106
2106
|
}
|
|
2107
2107
|
function colorComponent(value) {
|
|
2108
2108
|
if (typeof value !== "string") return null;
|
|
2109
|
-
const
|
|
2110
|
-
return Number.isFinite(
|
|
2109
|
+
const parsed = value.startsWith("0x") ? Number.parseInt(value.slice(2), 16) / 255 : value.includes(".") ? Number.parseFloat(value) : Number.parseInt(value, 10) / 255;
|
|
2110
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
2111
2111
|
}
|
|
2112
2112
|
function colorsetValue(color) {
|
|
2113
2113
|
if (typeof color !== "object" || color === null) return null;
|
|
@@ -2374,8 +2374,8 @@ function readSharedDesktopAuthSession() {
|
|
|
2374
2374
|
const filepath = getSharedDesktopAuthFilePath();
|
|
2375
2375
|
if (!(0, import_node_fs3.existsSync)(filepath)) return null;
|
|
2376
2376
|
try {
|
|
2377
|
-
const
|
|
2378
|
-
const normalized = normalizeSession(
|
|
2377
|
+
const parsed = JSON.parse((0, import_node_fs3.readFileSync)(filepath, "utf8"));
|
|
2378
|
+
const normalized = normalizeSession(parsed);
|
|
2379
2379
|
if (!normalized) {
|
|
2380
2380
|
(0, import_node_fs3.rmSync)(filepath, { force: true });
|
|
2381
2381
|
return null;
|
|
@@ -2472,9 +2472,9 @@ function resolveContrastBackendOrigin(currentOrigin) {
|
|
|
2472
2472
|
const origin = currentOrigin?.trim();
|
|
2473
2473
|
if (!origin) return DEFAULT_CONTRAST_BACKEND_ORIGIN;
|
|
2474
2474
|
try {
|
|
2475
|
-
const
|
|
2476
|
-
if (isLoopbackHost(
|
|
2477
|
-
return
|
|
2475
|
+
const parsed = new URL(origin);
|
|
2476
|
+
if (isLoopbackHost(parsed.hostname) || isContrastBackendHost(parsed.hostname)) {
|
|
2477
|
+
return parsed.origin;
|
|
2478
2478
|
}
|
|
2479
2479
|
} catch {
|
|
2480
2480
|
}
|
|
@@ -2828,9 +2828,9 @@ function resolveRemotePackages(projectDir, resolved, products, provided) {
|
|
|
2828
2828
|
if (!pin) return null;
|
|
2829
2829
|
const dir = checkout(checkouts, identity, pin);
|
|
2830
2830
|
const manifest = import_node_fs7.default.readFileSync(import_node_path8.default.join(dir, "Package.swift"), "utf8");
|
|
2831
|
-
const
|
|
2832
|
-
packages.set(identity,
|
|
2833
|
-
return
|
|
2831
|
+
const loaded2 = { dir, manifest, graph: swiftManifestGraph(manifest) };
|
|
2832
|
+
packages.set(identity, loaded2);
|
|
2833
|
+
return loaded2;
|
|
2834
2834
|
};
|
|
2835
2835
|
const targets = /* @__PURE__ */ new Map();
|
|
2836
2836
|
const outcomes = /* @__PURE__ */ new Map();
|
|
@@ -3161,8 +3161,19 @@ var isDict = (value) => typeof value === "object" && value !== null && !Array.is
|
|
|
3161
3161
|
var str = (value) => typeof value === "string" ? value : void 0;
|
|
3162
3162
|
var list = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
3163
3163
|
var APPLICATION = "com.apple.product-type.application";
|
|
3164
|
+
var MODULE_PRODUCTS = /* @__PURE__ */ new Set([
|
|
3165
|
+
"com.apple.product-type.framework",
|
|
3166
|
+
"com.apple.product-type.framework.static",
|
|
3167
|
+
"com.apple.product-type.library.static",
|
|
3168
|
+
"com.apple.product-type.library.dynamic"
|
|
3169
|
+
]);
|
|
3164
3170
|
var NEVER_MEMBER = /(?:^|\/)(?:Info\.plist|[^/]+\.entitlements|[^/]+\.xcconfig|\.DS_Store)$/;
|
|
3165
3171
|
var BUNDLE_DIR = /\.(xcassets|bundle|lproj|xcdatamodeld|scnassets|spriteatlas|rcproject|storyboardc|icon)$/;
|
|
3172
|
+
var CONDITIONS = {
|
|
3173
|
+
sdk: "iphonesimulator",
|
|
3174
|
+
arch: "arm64",
|
|
3175
|
+
variant: "normal"
|
|
3176
|
+
};
|
|
3166
3177
|
function walkFiles(dir) {
|
|
3167
3178
|
if (!import_node_fs8.default.existsSync(dir)) return [];
|
|
3168
3179
|
const out = [];
|
|
@@ -3174,6 +3185,7 @@ function walkFiles(dir) {
|
|
|
3174
3185
|
}
|
|
3175
3186
|
return out;
|
|
3176
3187
|
}
|
|
3188
|
+
var isDirectory = (dir) => import_node_fs8.default.existsSync(dir) && import_node_fs8.default.statSync(dir).isDirectory();
|
|
3177
3189
|
function readXcconfig(file, seen = /* @__PURE__ */ new Set()) {
|
|
3178
3190
|
if (seen.has(file) || !import_node_fs8.default.existsSync(file)) return {};
|
|
3179
3191
|
seen.add(file);
|
|
@@ -3188,31 +3200,91 @@ function readXcconfig(file, seen = /* @__PURE__ */ new Set()) {
|
|
|
3188
3200
|
);
|
|
3189
3201
|
continue;
|
|
3190
3202
|
}
|
|
3191
|
-
const setting = /^([A-
|
|
3192
|
-
if (setting)
|
|
3203
|
+
const setting = /^([A-Za-z_][A-Za-z0-9_]*(?:\[[^\]]*\])*)\s*=\s*(.*)$/.exec(line);
|
|
3204
|
+
if (setting)
|
|
3205
|
+
settings[setting[1].replace(/\s+/g, "")] = setting[2].replace(/;$/, "").trim();
|
|
3193
3206
|
}
|
|
3194
3207
|
return settings;
|
|
3195
3208
|
}
|
|
3196
|
-
function
|
|
3197
|
-
const
|
|
3198
|
-
|
|
3209
|
+
function applyConditions(raw2, configuration) {
|
|
3210
|
+
const plain = {};
|
|
3211
|
+
const conditional = {};
|
|
3212
|
+
for (const [key, value] of Object.entries(raw2)) {
|
|
3213
|
+
const bracket = key.indexOf("[");
|
|
3214
|
+
if (bracket === -1) {
|
|
3215
|
+
plain[key] = value;
|
|
3216
|
+
continue;
|
|
3217
|
+
}
|
|
3218
|
+
const matches = [...key.slice(bracket).matchAll(/\[([^=\]]+)=([^\]]*)\]/g)].every(
|
|
3219
|
+
([, name, pattern]) => {
|
|
3220
|
+
const actual = name === "config" ? configuration : CONDITIONS[name];
|
|
3221
|
+
return actual !== void 0 && new RegExp(
|
|
3222
|
+
`^${pattern.replace(/[.+^${}()|\\]/g, "\\$&").replaceAll("*", ".*").replaceAll("?", ".")}$`
|
|
3223
|
+
).test(actual);
|
|
3224
|
+
}
|
|
3225
|
+
);
|
|
3226
|
+
if (matches) conditional[key.slice(0, bracket)] = value;
|
|
3227
|
+
}
|
|
3228
|
+
return { ...plain, ...conditional };
|
|
3229
|
+
}
|
|
3230
|
+
function applyOperator(value, operator) {
|
|
3231
|
+
if (operator.startsWith("default=")) return value === "" ? operator.slice(8) : value;
|
|
3232
|
+
switch (operator) {
|
|
3233
|
+
case "lower":
|
|
3234
|
+
return value.toLowerCase();
|
|
3235
|
+
case "upper":
|
|
3236
|
+
return value.toUpperCase();
|
|
3237
|
+
case "rfc1034identifier":
|
|
3238
|
+
return value.replace(/[^A-Za-z0-9-]/g, "-").replace(/^[0-9]/, "-");
|
|
3239
|
+
case "identifier":
|
|
3240
|
+
case "c99extidentifier":
|
|
3241
|
+
return value.replace(/[^A-Za-z0-9_]/g, "_").replace(/^[0-9]/, "_");
|
|
3242
|
+
}
|
|
3243
|
+
throw new Error(`unsupported build setting operator :${operator}`);
|
|
3244
|
+
}
|
|
3245
|
+
function decodeXml(text) {
|
|
3246
|
+
return text.replaceAll(""", '"').replaceAll("'", "'").replaceAll("<", "<").replaceAll(">", ">").replaceAll("&", "&");
|
|
3247
|
+
}
|
|
3248
|
+
function workspaceReferences(workspace) {
|
|
3249
|
+
const data = import_node_path9.default.join(workspace, "contents.xcworkspacedata");
|
|
3250
|
+
if (!import_node_fs8.default.existsSync(data))
|
|
3251
|
+
throw new Error(`${workspace} has no contents.xcworkspacedata`);
|
|
3252
|
+
const container = import_node_path9.default.dirname(workspace);
|
|
3253
|
+
const locate = (location, base) => {
|
|
3254
|
+
const colon = location.indexOf(":");
|
|
3255
|
+
const kind = location.slice(0, colon);
|
|
3256
|
+
const rest = location.slice(colon + 1);
|
|
3257
|
+
if (kind === "group") return import_node_path9.default.resolve(base, rest);
|
|
3258
|
+
if (kind === "container" || kind === "self") return import_node_path9.default.resolve(container, rest);
|
|
3259
|
+
if (kind === "absolute") return import_node_path9.default.resolve(rest);
|
|
3260
|
+
throw new Error(`${import_node_path9.default.basename(workspace)} has an unsupported location ${location}`);
|
|
3261
|
+
};
|
|
3262
|
+
const groups = [container];
|
|
3263
|
+
const references = [];
|
|
3264
|
+
for (const [, closing, tag, attributes, selfClosing] of import_node_fs8.default.readFileSync(data, "utf8").matchAll(/<(\/?)(Group|FileRef)\b([^>]*?)(\/?)>/g)) {
|
|
3265
|
+
if (closing) {
|
|
3266
|
+
if (tag === "Group") groups.pop();
|
|
3267
|
+
continue;
|
|
3268
|
+
}
|
|
3269
|
+
const base = groups.at(-1);
|
|
3270
|
+
const location = /\blocation\s*=\s*"([^"]*)"/.exec(attributes)?.[1];
|
|
3271
|
+
const resolved = location ? locate(decodeXml(location), base) : base;
|
|
3272
|
+
if (tag === "FileRef") references.push(resolved);
|
|
3273
|
+
else if (!selfClosing) groups.push(resolved);
|
|
3274
|
+
}
|
|
3275
|
+
return references;
|
|
3199
3276
|
}
|
|
3200
|
-
var
|
|
3201
|
-
function
|
|
3277
|
+
var loaded = /* @__PURE__ */ new Map();
|
|
3278
|
+
function loadProject(xcodeproj) {
|
|
3279
|
+
const pbxproj = import_node_path9.default.join(xcodeproj, "project.pbxproj");
|
|
3280
|
+
if (!import_node_fs8.default.existsSync(pbxproj)) throw new Error(`${xcodeproj} has no project.pbxproj`);
|
|
3202
3281
|
const mtimeMs = import_node_fs8.default.statSync(pbxproj).mtimeMs;
|
|
3203
|
-
const cached =
|
|
3204
|
-
if (cached?.mtimeMs === mtimeMs) return cached.
|
|
3282
|
+
const cached = loaded.get(pbxproj);
|
|
3283
|
+
if (cached?.mtimeMs === mtimeMs) return cached.project;
|
|
3205
3284
|
const root = parseOpenStepPlist(import_node_fs8.default.readFileSync(pbxproj, "utf8"));
|
|
3206
3285
|
if (!isDict(root) || !isDict(root.objects)) {
|
|
3207
3286
|
throw new Error(`${pbxproj} has no objects table`);
|
|
3208
3287
|
}
|
|
3209
|
-
parsed.set(pbxproj, { mtimeMs, root });
|
|
3210
|
-
return root;
|
|
3211
|
-
}
|
|
3212
|
-
function readXcodeAppTarget(xcodeproj, targetName) {
|
|
3213
|
-
const pbxproj = import_node_path9.default.join(xcodeproj, "project.pbxproj");
|
|
3214
|
-
if (!import_node_fs8.default.existsSync(pbxproj)) throw new Error(`${xcodeproj} has no project.pbxproj`);
|
|
3215
|
-
const root = readProject(pbxproj);
|
|
3216
3288
|
const objects = root.objects;
|
|
3217
3289
|
const object = (id) => {
|
|
3218
3290
|
const found = id === void 0 ? void 0 : objects[id];
|
|
@@ -3236,141 +3308,131 @@ function readXcodeAppTarget(xcodeproj, targetName) {
|
|
|
3236
3308
|
const resolvePath = (id) => {
|
|
3237
3309
|
if (resolvedPaths.has(id)) return resolvedPaths.get(id);
|
|
3238
3310
|
const entry = object(id);
|
|
3239
|
-
let
|
|
3311
|
+
let result2 = null;
|
|
3240
3312
|
if (entry) {
|
|
3241
3313
|
const own = str(entry.path) ?? "";
|
|
3242
3314
|
const tree = str(entry.sourceTree) ?? "<group>";
|
|
3243
|
-
if (tree === "<absolute>")
|
|
3244
|
-
else if (tree === "SOURCE_ROOT")
|
|
3315
|
+
if (tree === "<absolute>") result2 = own;
|
|
3316
|
+
else if (tree === "SOURCE_ROOT") result2 = import_node_path9.default.join(projectDir, own);
|
|
3245
3317
|
else if (tree === "<group>") {
|
|
3246
3318
|
const up = parent.get(id);
|
|
3247
3319
|
const base = up ? resolvePath(up) : projectDir;
|
|
3248
|
-
|
|
3320
|
+
result2 = base === null ? null : import_node_path9.default.join(base, own);
|
|
3249
3321
|
}
|
|
3250
3322
|
}
|
|
3251
|
-
resolvedPaths.set(id,
|
|
3252
|
-
return
|
|
3323
|
+
resolvedPaths.set(id, result2);
|
|
3324
|
+
return result2;
|
|
3253
3325
|
};
|
|
3254
|
-
const
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
const
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
targetName ? `${import_node_path9.default.basename(xcodeproj)} has no application target ${targetName}; it has ${appTargetNames.join(", ") || "none"}` : `${import_node_path9.default.basename(xcodeproj)} has ${appTargetNames.length} application targets (${appTargetNames.join(", ") || "none"}); pass --target`
|
|
3263
|
-
);
|
|
3264
|
-
}
|
|
3265
|
-
const { id: targetId, target } = chosen;
|
|
3266
|
-
const configSettings = (listId) => {
|
|
3267
|
-
const configs = list(object(listId)?.buildConfigurations).map(object);
|
|
3326
|
+
const result = { xcodeproj, pbxproj, objects, project, projectDir, object, resolvePath };
|
|
3327
|
+
loaded.set(pbxproj, { mtimeMs, project: result });
|
|
3328
|
+
return result;
|
|
3329
|
+
}
|
|
3330
|
+
function targetSettings(ref, builtins) {
|
|
3331
|
+
const { project, target } = ref;
|
|
3332
|
+
const level = (listId) => {
|
|
3333
|
+
const configs = list(project.object(listId)?.buildConfigurations).map(project.object);
|
|
3268
3334
|
const config = configs.find((entry) => entry?.name === "Debug") ?? configs.find(Boolean);
|
|
3269
|
-
if (!config) return
|
|
3335
|
+
if (!config) return [];
|
|
3336
|
+
const name = str(config.name) ?? "Debug";
|
|
3270
3337
|
const base = str(config.baseConfigurationReference);
|
|
3271
|
-
const fromFile = base ? readXcconfig(resolvePath(base) ?? "") : {};
|
|
3272
3338
|
const own = isDict(config.buildSettings) ? config.buildSettings : {};
|
|
3273
|
-
return
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
Object.
|
|
3277
|
-
(
|
|
3278
|
-
|
|
3339
|
+
return [
|
|
3340
|
+
applyConditions(base ? readXcconfig(project.resolvePath(base) ?? "") : {}, name),
|
|
3341
|
+
applyConditions(
|
|
3342
|
+
Object.fromEntries(
|
|
3343
|
+
Object.entries(own).flatMap(
|
|
3344
|
+
([key, value]) => typeof value === "string" ? [[key, value]] : Array.isArray(value) ? [[key, list(value).join(" ")]] : []
|
|
3345
|
+
)
|
|
3346
|
+
),
|
|
3347
|
+
name
|
|
3279
3348
|
)
|
|
3280
|
-
|
|
3281
|
-
};
|
|
3282
|
-
const settings = {
|
|
3283
|
-
...configSettings(str(project.buildConfigurationList)),
|
|
3284
|
-
...configSettings(str(target.buildConfigurationList))
|
|
3349
|
+
];
|
|
3285
3350
|
};
|
|
3286
|
-
const
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
const
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
seen.add(value);
|
|
3306
|
-
value = value.replace(
|
|
3307
|
-
/\$[({]([A-Za-z_][A-Za-z0-9_]*)[)}]/g,
|
|
3308
|
-
(match, key) => {
|
|
3309
|
-
const replacement = Object.entries(variables).find(
|
|
3310
|
-
([name2]) => name2 === key
|
|
3311
|
-
)?.[1];
|
|
3312
|
-
if (replacement === void 0)
|
|
3313
|
-
throw new Error(`${name} Info.plist has unresolved setting ${match}`);
|
|
3314
|
-
return replacement;
|
|
3315
|
-
}
|
|
3316
|
-
);
|
|
3317
|
-
}
|
|
3351
|
+
const levels = [
|
|
3352
|
+
builtins,
|
|
3353
|
+
...level(str(project.project.buildConfigurationList)),
|
|
3354
|
+
...level(str(target.buildConfigurationList))
|
|
3355
|
+
];
|
|
3356
|
+
const resolving = /* @__PURE__ */ new Set();
|
|
3357
|
+
const valueAt = (key, top) => {
|
|
3358
|
+
let at = top;
|
|
3359
|
+
while (at >= 0 && levels[at][key] === void 0) at--;
|
|
3360
|
+
if (at < 0) return derived(key);
|
|
3361
|
+
const marker = `${key}@${at}`;
|
|
3362
|
+
if (resolving.has(marker))
|
|
3363
|
+
throw new Error(`${str(target.name)} has a cyclic build setting ${key}`);
|
|
3364
|
+
resolving.add(marker);
|
|
3365
|
+
const value = expand(
|
|
3366
|
+
levels[at][key],
|
|
3367
|
+
(name) => name === "inherited" ? valueAt(key, at - 1) : valueAt(name, levels.length - 1)
|
|
3368
|
+
);
|
|
3369
|
+
resolving.delete(marker);
|
|
3318
3370
|
return value;
|
|
3319
3371
|
};
|
|
3320
|
-
const
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3372
|
+
const derived = (key) => {
|
|
3373
|
+
const get = (name) => valueAt(name, levels.length - 1);
|
|
3374
|
+
switch (key) {
|
|
3375
|
+
case "PRODUCT_NAME":
|
|
3376
|
+
return get("TARGET_NAME");
|
|
3377
|
+
case "PRODUCT_MODULE_NAME":
|
|
3378
|
+
return applyOperator(get("PRODUCT_NAME"), "c99extidentifier");
|
|
3379
|
+
case "EXECUTABLE_NAME":
|
|
3380
|
+
return get("PRODUCT_NAME");
|
|
3381
|
+
case "AppIdentifierPrefix":
|
|
3382
|
+
case "TeamIdentifierPrefix": {
|
|
3383
|
+
const team = get("DEVELOPMENT_TEAM");
|
|
3384
|
+
return get("CODE_SIGNING_ALLOWED") !== "NO" && team ? `${team}.` : "";
|
|
3385
|
+
}
|
|
3327
3386
|
}
|
|
3328
|
-
return
|
|
3387
|
+
return "";
|
|
3329
3388
|
};
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
}
|
|
3389
|
+
return {
|
|
3390
|
+
get: (key) => valueAt(key, levels.length - 1),
|
|
3391
|
+
keys: new Set(levels.flatMap((values) => Object.keys(values)))
|
|
3392
|
+
};
|
|
3393
|
+
}
|
|
3394
|
+
function expand(value, lookup) {
|
|
3395
|
+
return value.replace(
|
|
3396
|
+
/\$(?:\(([A-Za-z_][A-Za-z0-9_]*)((?::[^)]*)?)\)|\{([A-Za-z_][A-Za-z0-9_]*)((?::[^}]*)?)\}|([A-Za-z_][A-Za-z0-9_]*))/g,
|
|
3397
|
+
(_match, paren, parenOps, brace, braceOps, bare) => {
|
|
3398
|
+
const name = paren ?? brace ?? bare;
|
|
3399
|
+
const operators = parenOps ?? braceOps ?? "";
|
|
3400
|
+
return operators.split(":").slice(1).reduce((current, operator) => applyOperator(current, operator), lookup(name));
|
|
3401
|
+
}
|
|
3402
|
+
);
|
|
3403
|
+
}
|
|
3404
|
+
function targetMembers(ref) {
|
|
3405
|
+
const { project, target, id: targetId } = ref;
|
|
3347
3406
|
const sources = /* @__PURE__ */ new Set();
|
|
3407
|
+
const allSources = /* @__PURE__ */ new Set();
|
|
3348
3408
|
const resources = /* @__PURE__ */ new Set();
|
|
3349
3409
|
const addResource = (file) => {
|
|
3350
|
-
if (
|
|
3410
|
+
if (isDirectory(file)) {
|
|
3351
3411
|
for (const inner of walkFiles(file)) resources.add(inner);
|
|
3352
3412
|
} else if (import_node_fs8.default.existsSync(file)) resources.add(file);
|
|
3353
3413
|
};
|
|
3354
3414
|
const fileRefPaths = (refId) => {
|
|
3355
|
-
const
|
|
3356
|
-
if (!
|
|
3357
|
-
if (
|
|
3358
|
-
return list(
|
|
3359
|
-
const resolved2 = resolvePath(child);
|
|
3415
|
+
const entry = project.object(refId);
|
|
3416
|
+
if (!entry) return [];
|
|
3417
|
+
if (entry.isa === "PBXVariantGroup") {
|
|
3418
|
+
return list(entry.children).flatMap((child) => {
|
|
3419
|
+
const resolved2 = project.resolvePath(child);
|
|
3360
3420
|
return resolved2 ? [resolved2] : [];
|
|
3361
3421
|
});
|
|
3362
3422
|
}
|
|
3363
|
-
const resolved = resolvePath(refId);
|
|
3423
|
+
const resolved = project.resolvePath(refId);
|
|
3364
3424
|
return resolved ? [resolved] : [];
|
|
3365
3425
|
};
|
|
3366
3426
|
for (const phaseId of list(target.buildPhases)) {
|
|
3367
|
-
const phase = object(phaseId);
|
|
3427
|
+
const phase = project.object(phaseId);
|
|
3368
3428
|
if (phase?.isa !== "PBXSourcesBuildPhase" && phase?.isa !== "PBXResourcesBuildPhase")
|
|
3369
3429
|
continue;
|
|
3370
3430
|
for (const buildFileId of list(phase.files)) {
|
|
3371
|
-
for (const file of fileRefPaths(str(object(buildFileId)?.fileRef) ?? "")) {
|
|
3372
|
-
if (phase.isa === "PBXSourcesBuildPhase"
|
|
3373
|
-
if (import_node_fs8.default.existsSync(file))
|
|
3431
|
+
for (const file of fileRefPaths(str(project.object(buildFileId)?.fileRef) ?? "")) {
|
|
3432
|
+
if (phase.isa === "PBXSourcesBuildPhase") {
|
|
3433
|
+
if (!import_node_fs8.default.existsSync(file)) continue;
|
|
3434
|
+
allSources.add(file);
|
|
3435
|
+
if (file.endsWith(".swift")) sources.add(file);
|
|
3374
3436
|
} else if (phase.isa === "PBXResourcesBuildPhase") addResource(file);
|
|
3375
3437
|
}
|
|
3376
3438
|
}
|
|
@@ -3379,20 +3441,22 @@ function readXcodeAppTarget(xcodeproj, targetName) {
|
|
|
3379
3441
|
const file = import_node_path9.default.join(folder, relative);
|
|
3380
3442
|
if (NEVER_MEMBER.test(relative)) return;
|
|
3381
3443
|
if (file.endsWith(".swift")) {
|
|
3382
|
-
if (!relative.split("/").some((segment) => BUNDLE_DIR.test(segment)))
|
|
3444
|
+
if (!relative.split("/").some((segment) => BUNDLE_DIR.test(segment))) {
|
|
3383
3445
|
sources.add(file);
|
|
3446
|
+
allSources.add(file);
|
|
3447
|
+
}
|
|
3384
3448
|
} else if (/\.(h|m|mm|c|cpp|metal)$/.test(file)) {
|
|
3385
|
-
|
|
3449
|
+
if (!file.endsWith(".h")) allSources.add(file);
|
|
3386
3450
|
} else resources.add(file);
|
|
3387
3451
|
};
|
|
3388
3452
|
const owned = new Set(list(target.fileSystemSynchronizedGroups));
|
|
3389
|
-
for (const [groupId, group] of Object.entries(objects)) {
|
|
3453
|
+
for (const [groupId, group] of Object.entries(project.objects)) {
|
|
3390
3454
|
if (!isDict(group) || group.isa !== "PBXFileSystemSynchronizedRootGroup") continue;
|
|
3391
|
-
const folder = resolvePath(groupId);
|
|
3455
|
+
const folder = project.resolvePath(groupId);
|
|
3392
3456
|
if (!folder) continue;
|
|
3393
3457
|
const exceptions = /* @__PURE__ */ new Set();
|
|
3394
3458
|
for (const exceptionId of list(group.exceptions)) {
|
|
3395
|
-
const exception = object(exceptionId);
|
|
3459
|
+
const exception = project.object(exceptionId);
|
|
3396
3460
|
if (exception?.target !== targetId) continue;
|
|
3397
3461
|
for (const relative of list(exception.membershipExceptions))
|
|
3398
3462
|
exceptions.add(relative);
|
|
@@ -3409,7 +3473,7 @@ function readXcodeAppTarget(xcodeproj, targetName) {
|
|
|
3409
3473
|
} else {
|
|
3410
3474
|
for (const relative of exceptions) {
|
|
3411
3475
|
const file = import_node_path9.default.join(folder, relative);
|
|
3412
|
-
if (
|
|
3476
|
+
if (isDirectory(file)) {
|
|
3413
3477
|
for (const inner of walkFiles(file))
|
|
3414
3478
|
addSynchronized(
|
|
3415
3479
|
folder,
|
|
@@ -3419,11 +3483,177 @@ function readXcodeAppTarget(xcodeproj, targetName) {
|
|
|
3419
3483
|
}
|
|
3420
3484
|
}
|
|
3421
3485
|
}
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
}
|
|
3486
|
+
return {
|
|
3487
|
+
sources: [...sources].sort(),
|
|
3488
|
+
resources: [...resources].sort(),
|
|
3489
|
+
allSources: [...allSources].sort()
|
|
3490
|
+
};
|
|
3491
|
+
}
|
|
3492
|
+
function commonAncestor(dirs) {
|
|
3493
|
+
let common = dirs[0];
|
|
3494
|
+
for (const dir of dirs) {
|
|
3495
|
+
while (common !== import_node_path9.default.dirname(common) && import_node_path9.default.relative(common, dir).startsWith(".."))
|
|
3496
|
+
common = import_node_path9.default.dirname(common);
|
|
3497
|
+
}
|
|
3498
|
+
return common;
|
|
3499
|
+
}
|
|
3500
|
+
function workspaceProjects(xcodeprojOrWorkspace) {
|
|
3501
|
+
const listed = xcodeprojOrWorkspace.endsWith(".xcworkspace") ? workspaceReferences(xcodeprojOrWorkspace) : [xcodeprojOrWorkspace];
|
|
3502
|
+
const projects2 = [];
|
|
3503
|
+
const projectAt = /* @__PURE__ */ new Map();
|
|
3504
|
+
const addProject = (xcodeproj) => {
|
|
3505
|
+
const key = import_node_path9.default.resolve(xcodeproj);
|
|
3506
|
+
if (projectAt.has(key) || key.split(import_node_path9.default.sep).includes("Pods")) return;
|
|
3507
|
+
if (!import_node_fs8.default.existsSync(import_node_path9.default.join(key, "project.pbxproj"))) return;
|
|
3508
|
+
const project = loadProject(key);
|
|
3509
|
+
projectAt.set(key, project);
|
|
3510
|
+
projects2.push(project);
|
|
3511
|
+
const nested = project.project.projectReferences;
|
|
3512
|
+
if (Array.isArray(nested)) {
|
|
3513
|
+
for (const entry of nested) {
|
|
3514
|
+
const ref = isDict(entry) ? str(entry.ProjectRef) : void 0;
|
|
3515
|
+
const resolved = ref ? project.resolvePath(ref) : null;
|
|
3516
|
+
if (resolved) addProject(resolved);
|
|
3517
|
+
}
|
|
3518
|
+
}
|
|
3519
|
+
};
|
|
3520
|
+
for (const reference of listed)
|
|
3521
|
+
if (reference.endsWith(".xcodeproj")) addProject(reference);
|
|
3522
|
+
if (projects2.length === 0) {
|
|
3523
|
+
throw new Error(`${import_node_path9.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
|
|
3524
|
+
}
|
|
3525
|
+
return { listed, projects: projects2, projectAt };
|
|
3526
|
+
}
|
|
3527
|
+
var nativeTargets = (project) => list(project.project.targets).flatMap((id) => {
|
|
3528
|
+
const target = project.object(id);
|
|
3529
|
+
return target?.isa === "PBXNativeTarget" ? [{ project, id, target }] : [];
|
|
3530
|
+
});
|
|
3531
|
+
function readXcodeAppTarget(xcodeprojOrWorkspace, targetName) {
|
|
3532
|
+
const workspace = xcodeprojOrWorkspace.endsWith(".xcworkspace") ? xcodeprojOrWorkspace : null;
|
|
3533
|
+
const { listed, projects: projects2, projectAt } = workspaceProjects(xcodeprojOrWorkspace);
|
|
3534
|
+
const allTargets = projects2.flatMap(nativeTargets);
|
|
3535
|
+
const appTargets = allTargets.filter((ref) => ref.target.productType === APPLICATION);
|
|
3536
|
+
const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
|
|
3537
|
+
const container = import_node_path9.default.basename(xcodeprojOrWorkspace);
|
|
3538
|
+
const named = targetName ? appTargets.filter((ref) => ref.target.name === targetName) : appTargets;
|
|
3539
|
+
if (named.length !== 1) {
|
|
3540
|
+
throw new Error(
|
|
3541
|
+
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`
|
|
3542
|
+
);
|
|
3543
|
+
}
|
|
3544
|
+
const app = named[0];
|
|
3545
|
+
const byProduct = /* @__PURE__ */ new Map();
|
|
3546
|
+
for (const ref of allTargets) {
|
|
3547
|
+
const product = ref.project.object(str(ref.target.productReference));
|
|
3548
|
+
const file = str(product?.path);
|
|
3549
|
+
if (file && !byProduct.has(import_node_path9.default.basename(file)))
|
|
3550
|
+
byProduct.set(import_node_path9.default.basename(file), ref);
|
|
3551
|
+
}
|
|
3552
|
+
const proxied = (project, proxyId) => {
|
|
3553
|
+
const proxy = project.object(proxyId);
|
|
3554
|
+
if (proxy?.isa !== "PBXContainerItemProxy") return void 0;
|
|
3555
|
+
const portal = str(proxy.containerPortal);
|
|
3556
|
+
const owner = project.object(portal)?.isa === "PBXProject" ? project : projectAt.get(import_node_path9.default.resolve(project.resolvePath(portal ?? "") ?? ""));
|
|
3557
|
+
const remote = str(proxy.remoteGlobalIDString);
|
|
3558
|
+
if (!owner || !remote) return void 0;
|
|
3559
|
+
return nativeTargets(owner).find(
|
|
3560
|
+
(ref) => ref.id === remote || str(ref.target.productReference) === remote
|
|
3561
|
+
);
|
|
3562
|
+
};
|
|
3563
|
+
const dependenciesOf = (ref) => {
|
|
3564
|
+
const { project, target } = ref;
|
|
3565
|
+
const found = [];
|
|
3566
|
+
for (const dependencyId of list(target.dependencies)) {
|
|
3567
|
+
const dependency = project.object(dependencyId);
|
|
3568
|
+
const direct = str(dependency?.target);
|
|
3569
|
+
const resolved = direct ? nativeTargets(project).find((candidate) => candidate.id === direct) : proxied(project, str(dependency?.targetProxy));
|
|
3570
|
+
if (resolved) found.push(resolved);
|
|
3571
|
+
}
|
|
3572
|
+
for (const phaseId of list(target.buildPhases)) {
|
|
3573
|
+
const phase = project.object(phaseId);
|
|
3574
|
+
if (phase?.isa !== "PBXFrameworksBuildPhase") continue;
|
|
3575
|
+
for (const buildFileId of list(phase.files)) {
|
|
3576
|
+
const file = project.object(str(project.object(buildFileId)?.fileRef));
|
|
3577
|
+
const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path9.default.basename(str(file.path) ?? "")) : void 0;
|
|
3578
|
+
if (resolved) found.push(resolved);
|
|
3579
|
+
}
|
|
3580
|
+
}
|
|
3581
|
+
return found.filter(
|
|
3582
|
+
(candidate) => MODULE_PRODUCTS.has(str(candidate.target.productType) ?? "")
|
|
3583
|
+
);
|
|
3584
|
+
};
|
|
3585
|
+
const order = [];
|
|
3586
|
+
const visited = /* @__PURE__ */ new Set();
|
|
3587
|
+
const visit = (ref) => {
|
|
3588
|
+
if (visited.has(ref)) return;
|
|
3589
|
+
visited.add(ref);
|
|
3590
|
+
for (const dependency of dependenciesOf(ref)) visit(dependency);
|
|
3591
|
+
order.push(ref);
|
|
3592
|
+
};
|
|
3593
|
+
visit(app);
|
|
3594
|
+
const moduleTarget = (ref) => {
|
|
3595
|
+
const name = str(ref.target.name) ?? ref.id;
|
|
3596
|
+
const { get: settings2, keys } = targetSettings(ref, {
|
|
3597
|
+
TARGET_NAME: name,
|
|
3598
|
+
PROJECT_NAME: import_node_path9.default.basename(ref.project.xcodeproj, ".xcodeproj"),
|
|
3599
|
+
SRCROOT: ref.project.projectDir,
|
|
3600
|
+
SOURCE_ROOT: ref.project.projectDir,
|
|
3601
|
+
PROJECT_DIR: ref.project.projectDir,
|
|
3602
|
+
DEVELOPMENT_LANGUAGE: str(ref.project.project.developmentRegion) ?? "en"
|
|
3603
|
+
});
|
|
3604
|
+
const swiftVersion = Number.parseFloat(settings2("SWIFT_VERSION") || "5");
|
|
3605
|
+
return {
|
|
3606
|
+
settings: settings2,
|
|
3607
|
+
keys,
|
|
3608
|
+
module: {
|
|
3609
|
+
name,
|
|
3610
|
+
moduleName: applyOperator(settings2("PRODUCT_MODULE_NAME"), "c99extidentifier"),
|
|
3611
|
+
...targetMembers(ref),
|
|
3612
|
+
languageMode: swiftVersion >= 6 ? 6 : 5,
|
|
3613
|
+
mainActorIsolation: settings2("SWIFT_DEFAULT_ACTOR_ISOLATION") === "MainActor"
|
|
3614
|
+
}
|
|
3615
|
+
};
|
|
3616
|
+
};
|
|
3617
|
+
const { settings, keys: settingKeys, module: module2 } = moduleTarget(app);
|
|
3618
|
+
const frameworks = order.slice(0, -1).map((ref) => moduleTarget(ref).module);
|
|
3619
|
+
const expandValue = (value) => {
|
|
3620
|
+
if (typeof value === "string") return expand(value, settings);
|
|
3621
|
+
if (Array.isArray(value)) return value.map(expandValue);
|
|
3622
|
+
if (typeof value === "object" && !(value instanceof Date) && !Buffer.isBuffer(value)) {
|
|
3623
|
+
return Object.fromEntries(
|
|
3624
|
+
Object.entries(value).map(([key, value2]) => [key, expandValue(value2)])
|
|
3625
|
+
);
|
|
3626
|
+
}
|
|
3627
|
+
return value;
|
|
3628
|
+
};
|
|
3629
|
+
const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path9.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
|
|
3630
|
+
const sourceInfo = infoPlistFile ? import_plist.default.parse(import_node_fs8.default.readFileSync(infoPlistFile, "utf8")) : {};
|
|
3631
|
+
if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
|
|
3632
|
+
throw new Error(`${module2.name} Info.plist must contain a dictionary`);
|
|
3633
|
+
}
|
|
3634
|
+
const info = {};
|
|
3635
|
+
for (const [key, value] of Object.entries(sourceInfo)) info[key] = expandValue(value);
|
|
3636
|
+
for (const key of settingKeys) {
|
|
3637
|
+
if (!key.startsWith("INFOPLIST_KEY_") || key.endsWith("_Generation")) continue;
|
|
3638
|
+
const value = settings(key);
|
|
3639
|
+
info[key.slice("INFOPLIST_KEY_".length)] = value === "YES" ? true : value === "NO" ? false : value;
|
|
3640
|
+
}
|
|
3641
|
+
if (settings("INFOPLIST_KEY_UIApplicationSceneManifest_Generation") === "YES" && info.UIApplicationSceneManifest === void 0) {
|
|
3642
|
+
info.UIApplicationSceneManifest = {
|
|
3643
|
+
UIApplicationSupportsMultipleScenes: true,
|
|
3644
|
+
UISceneConfigurations: {}
|
|
3645
|
+
};
|
|
3646
|
+
}
|
|
3647
|
+
const localPackageDirs = [
|
|
3648
|
+
...listed.filter((reference) => import_node_fs8.default.existsSync(import_node_path9.default.join(reference, "Package.swift"))),
|
|
3649
|
+
...projects2.flatMap(
|
|
3650
|
+
(project) => Object.entries(project.objects).flatMap(([id, entry]) => {
|
|
3651
|
+
if (!isDict(entry)) return [];
|
|
3652
|
+
const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path9.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
|
|
3653
|
+
return candidate && import_node_fs8.default.existsSync(import_node_path9.default.join(candidate, "Package.swift")) ? [candidate] : [];
|
|
3654
|
+
})
|
|
3655
|
+
)
|
|
3656
|
+
];
|
|
3427
3657
|
const graphs = /* @__PURE__ */ new Map();
|
|
3428
3658
|
const graphOf = (dir) => {
|
|
3429
3659
|
const cached = graphs.get(dir);
|
|
@@ -3436,26 +3666,40 @@ function readXcodeAppTarget(xcodeproj, targetName) {
|
|
|
3436
3666
|
};
|
|
3437
3667
|
const localProducts = /* @__PURE__ */ new Map();
|
|
3438
3668
|
for (const dir of localPackageDirs) {
|
|
3439
|
-
for (const product of graphOf(dir).products.keys())
|
|
3669
|
+
for (const product of graphOf(dir).products.keys()) {
|
|
3670
|
+
if (!localProducts.has(product)) localProducts.set(product, dir);
|
|
3671
|
+
}
|
|
3440
3672
|
}
|
|
3441
3673
|
const localPackages = /* @__PURE__ */ new Set();
|
|
3442
3674
|
const remoteProducts = [];
|
|
3443
3675
|
const unresolvedProducts = [];
|
|
3444
|
-
for (const
|
|
3445
|
-
const
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3676
|
+
for (const { project, target } of order) {
|
|
3677
|
+
const productDependencies = [
|
|
3678
|
+
...list(target.packageProductDependencies),
|
|
3679
|
+
...list(target.dependencies).flatMap((id) => {
|
|
3680
|
+
const productRef = str(project.object(id)?.productRef);
|
|
3681
|
+
return productRef ? [productRef] : [];
|
|
3682
|
+
})
|
|
3683
|
+
];
|
|
3684
|
+
for (const dependencyId of productDependencies) {
|
|
3685
|
+
const dependency = project.object(dependencyId);
|
|
3686
|
+
const product = str(dependency?.productName)?.replace(/^plugin:/, "");
|
|
3687
|
+
if (!dependency || !product) continue;
|
|
3688
|
+
const reference = project.object(str(dependency.package));
|
|
3689
|
+
if (reference?.isa === "XCRemoteSwiftPackageReference") {
|
|
3690
|
+
if (!remoteProducts.some((entry) => entry.product === product))
|
|
3691
|
+
remoteProducts.push({
|
|
3692
|
+
product,
|
|
3693
|
+
repositoryURL: str(reference.repositoryURL) ?? ""
|
|
3694
|
+
});
|
|
3695
|
+
} else if (reference?.isa === "XCLocalSwiftPackageReference") {
|
|
3696
|
+
localPackages.add(
|
|
3697
|
+
import_node_path9.default.resolve(project.projectDir, str(reference.relativePath) ?? "")
|
|
3698
|
+
);
|
|
3699
|
+
} else if (localProducts.has(product)) {
|
|
3700
|
+
localPackages.add(localProducts.get(product));
|
|
3701
|
+
} else if (!unresolvedProducts.includes(product)) unresolvedProducts.push(product);
|
|
3702
|
+
}
|
|
3459
3703
|
}
|
|
3460
3704
|
const pending = [...localPackages];
|
|
3461
3705
|
while (pending.length > 0) {
|
|
@@ -3477,27 +3721,29 @@ function readXcodeAppTarget(xcodeproj, targetName) {
|
|
|
3477
3721
|
}
|
|
3478
3722
|
}
|
|
3479
3723
|
}
|
|
3480
|
-
const
|
|
3481
|
-
import_node_path9.default.join(
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
)
|
|
3486
|
-
const
|
|
3724
|
+
const resolvedFile = import_node_path9.default.join(
|
|
3725
|
+
workspace ?? import_node_path9.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
|
|
3726
|
+
"xcshareddata",
|
|
3727
|
+
"swiftpm",
|
|
3728
|
+
"Package.resolved"
|
|
3729
|
+
);
|
|
3730
|
+
const used = [app, ...order].map((ref) => ref.project);
|
|
3487
3731
|
return {
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3732
|
+
...module2,
|
|
3733
|
+
rootDir: commonAncestor(
|
|
3734
|
+
[
|
|
3735
|
+
workspace ? import_node_path9.default.dirname(workspace) : app.project.projectDir,
|
|
3736
|
+
...used.map((project) => project.projectDir),
|
|
3737
|
+
...localPackages
|
|
3738
|
+
].map((dir) => import_node_fs8.default.realpathSync(dir))
|
|
3739
|
+
),
|
|
3740
|
+
pbxprojs: [...new Set(used.map((project) => project.pbxproj))].sort(),
|
|
3494
3741
|
infoPlist: import_plist.default.build(info),
|
|
3495
3742
|
infoPlistFile,
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
localPackages: [...localPackages].sort(),
|
|
3743
|
+
frameworks,
|
|
3744
|
+
localPackages: [...localPackages].map((dir) => import_node_fs8.default.realpathSync(dir)).sort(),
|
|
3499
3745
|
remoteProducts,
|
|
3500
|
-
packageResolved,
|
|
3746
|
+
packageResolved: import_node_fs8.default.existsSync(resolvedFile) ? resolvedFile : null,
|
|
3501
3747
|
unresolvedProducts,
|
|
3502
3748
|
appTargets: appTargetNames
|
|
3503
3749
|
};
|
|
@@ -3574,7 +3820,7 @@ function remotePackages(entry, app) {
|
|
|
3574
3820
|
entry.remote = {
|
|
3575
3821
|
key,
|
|
3576
3822
|
packages: resolveRemotePackages(
|
|
3577
|
-
|
|
3823
|
+
app.rootDir,
|
|
3578
3824
|
app.packageResolved,
|
|
3579
3825
|
app.remoteProducts,
|
|
3580
3826
|
entry.provided
|
|
@@ -3584,27 +3830,50 @@ function remotePackages(entry, app) {
|
|
|
3584
3830
|
return entry.remote.packages;
|
|
3585
3831
|
}
|
|
3586
3832
|
var XCODE_APP_DIR = "__app__";
|
|
3833
|
+
var XCODE_FRAMEWORKS_DIR = "__frameworks__";
|
|
3587
3834
|
var XCODE_PACKAGES_DIR = "__packages__";
|
|
3588
3835
|
var CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(import_node_path10.default.sep).join(import_node_path10.default.posix.sep)}/`;
|
|
3589
|
-
function xcodeInputKey(
|
|
3590
|
-
|
|
3836
|
+
function xcodeInputKey(layout, file, relative) {
|
|
3837
|
+
const owner = layout.targetDirs.get(file);
|
|
3838
|
+
if (owner) return import_node_path10.default.posix.join(owner, relative);
|
|
3591
3839
|
return relative.startsWith(CHECKOUTS_PREFIX) ? import_node_path10.default.posix.join(XCODE_PACKAGES_DIR, relative.slice(CHECKOUTS_PREFIX.length)) : relative;
|
|
3592
3840
|
}
|
|
3593
3841
|
function xcodeLayout(root) {
|
|
3594
3842
|
const registered = xcodeProjects.get(root);
|
|
3595
3843
|
if (!registered) return null;
|
|
3596
3844
|
const app = readXcodeAppTarget(registered.xcodeproj, registered.target);
|
|
3597
|
-
const files = /* @__PURE__ */ new Set([app.
|
|
3845
|
+
const files = /* @__PURE__ */ new Set([...app.pbxprojs, ...app.sources, ...app.resources]);
|
|
3598
3846
|
if (app.infoPlistFile) files.add(app.infoPlistFile);
|
|
3847
|
+
const targetDirs = new Map(app.sources.map((file) => [file, XCODE_APP_DIR]));
|
|
3599
3848
|
const targets = [];
|
|
3849
|
+
for (const framework of app.frameworks) {
|
|
3850
|
+
const dir = import_node_path10.default.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName);
|
|
3851
|
+
for (const file of framework.sources) {
|
|
3852
|
+
if (targetDirs.has(file)) continue;
|
|
3853
|
+
targetDirs.set(file, dir);
|
|
3854
|
+
files.add(file);
|
|
3855
|
+
}
|
|
3856
|
+
targets.push({
|
|
3857
|
+
name: framework.moduleName,
|
|
3858
|
+
path: dir,
|
|
3859
|
+
executable: false,
|
|
3860
|
+
resources: false,
|
|
3861
|
+
languageMode: framework.languageMode,
|
|
3862
|
+
mainActorIsolation: framework.mainActorIsolation
|
|
3863
|
+
});
|
|
3864
|
+
}
|
|
3600
3865
|
for (const dir of app.localPackages) {
|
|
3601
|
-
const
|
|
3602
|
-
files.add(
|
|
3866
|
+
const manifestFile = import_node_path10.default.join(dir, "Package.swift");
|
|
3867
|
+
files.add(manifestFile);
|
|
3868
|
+
const manifest = import_node_fs9.default.readFileSync(manifestFile, "utf8");
|
|
3603
3869
|
const prefix = import_node_path10.default.relative(root, dir).split(import_node_path10.default.sep).join(import_node_path10.default.posix.sep);
|
|
3604
|
-
const
|
|
3605
|
-
|
|
3870
|
+
const declared = swiftManifestTargets(manifest).filter((target) => !target.executable);
|
|
3871
|
+
const all = declared.flatMap(
|
|
3872
|
+
(target) => sourceTreeFiles(import_node_path10.default.join(dir, target.path), root).map(
|
|
3873
|
+
(file) => import_node_path10.default.relative(dir, file).split(import_node_path10.default.sep).join(import_node_path10.default.posix.sep)
|
|
3874
|
+
)
|
|
3606
3875
|
);
|
|
3607
|
-
for (const target of swiftManifestTargets(
|
|
3876
|
+
for (const target of swiftManifestTargets(manifest, all)) {
|
|
3608
3877
|
if (target.executable) continue;
|
|
3609
3878
|
targets.push({ ...target, path: import_node_path10.default.posix.join(prefix, target.path) });
|
|
3610
3879
|
for (const relative of all) {
|
|
@@ -3627,6 +3896,7 @@ function xcodeLayout(root) {
|
|
|
3627
3896
|
app,
|
|
3628
3897
|
targets,
|
|
3629
3898
|
unavailable: remote.unavailable,
|
|
3899
|
+
targetDirs,
|
|
3630
3900
|
files: [...files].sort()
|
|
3631
3901
|
};
|
|
3632
3902
|
}
|
|
@@ -3647,13 +3917,15 @@ function xcodeManifest(layout) {
|
|
|
3647
3917
|
function packageFiles(root) {
|
|
3648
3918
|
const canonicalRoot = import_node_fs9.default.realpathSync(root);
|
|
3649
3919
|
const xcode = xcodeLayout(canonicalRoot);
|
|
3650
|
-
|
|
3920
|
+
return xcode ? xcode.files : sourceTreeFiles(canonicalRoot, canonicalRoot);
|
|
3921
|
+
}
|
|
3922
|
+
function sourceTreeFiles(dir, canonicalRoot) {
|
|
3651
3923
|
const found = [];
|
|
3652
|
-
const walk2 = (
|
|
3653
|
-
for (const entry of import_node_fs9.default.readdirSync(
|
|
3924
|
+
const walk2 = (dir2) => {
|
|
3925
|
+
for (const entry of import_node_fs9.default.readdirSync(dir2, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
|
|
3654
3926
|
if (entry.name.startsWith(".") && entry.name !== NATIVE_DESCRIPTOR && entry.name !== NATIVE_GLUE || SKIP_SOURCE_DIRS.has(entry.name))
|
|
3655
3927
|
continue;
|
|
3656
|
-
const full = import_node_path10.default.join(
|
|
3928
|
+
const full = import_node_path10.default.join(dir2, entry.name);
|
|
3657
3929
|
if (entry.isSymbolicLink()) throw new Error(`swift input is a symlink: ${full}`);
|
|
3658
3930
|
const real = import_node_fs9.default.realpathSync(full);
|
|
3659
3931
|
const relative = import_node_path10.default.relative(canonicalRoot, real);
|
|
@@ -3669,7 +3941,7 @@ function packageFiles(root) {
|
|
|
3669
3941
|
}
|
|
3670
3942
|
}
|
|
3671
3943
|
};
|
|
3672
|
-
walk2(
|
|
3944
|
+
if (import_node_fs9.default.existsSync(dir)) walk2(import_node_fs9.default.realpathSync(dir));
|
|
3673
3945
|
return found;
|
|
3674
3946
|
}
|
|
3675
3947
|
function readPackageFile(root, file, maxBytes) {
|
|
@@ -3894,12 +4166,11 @@ function icuUrl(origin, artifact) {
|
|
|
3894
4166
|
}
|
|
3895
4167
|
function packageSources(packagePath) {
|
|
3896
4168
|
const xcode = xcodeLayout(packagePath);
|
|
3897
|
-
const appSources = new Set(xcode?.app.sources);
|
|
3898
4169
|
const files = {};
|
|
3899
4170
|
for (const file of sourceFiles(packagePath)) {
|
|
3900
4171
|
const relative = import_node_path10.default.relative(packagePath, file).split(import_node_path10.default.sep).join(import_node_path10.default.posix.sep);
|
|
3901
4172
|
if (xcode && import_node_path10.default.basename(file) === "Package.swift") continue;
|
|
3902
|
-
files[xcode ? xcodeInputKey(
|
|
4173
|
+
files[xcode ? xcodeInputKey(xcode, file, relative) : relative] = readPackageFile(
|
|
3903
4174
|
packagePath,
|
|
3904
4175
|
file,
|
|
3905
4176
|
MAX_SWIFT_COMPILE_SOURCE_BYTES
|
|
@@ -4028,7 +4299,7 @@ function swiftApiGapReport(output) {
|
|
|
4028
4299
|
const diagnostic = /^(\S[^:]*\.swift):(\d+):(\d+): error: (.+)$/.exec(line);
|
|
4029
4300
|
if (!diagnostic || seen.has(line)) continue;
|
|
4030
4301
|
seen.add(line);
|
|
4031
|
-
const file = diagnostic[1].replace(new RegExp(
|
|
4302
|
+
const file = diagnostic[1].replace(new RegExp(`^(?:${XCODE_APP_DIR}|${XCODE_FRAMEWORKS_DIR}/[^/]+)/`), "").replace(new RegExp(`^${XCODE_PACKAGES_DIR}/`), "");
|
|
4032
4303
|
const message = diagnostic[4];
|
|
4033
4304
|
const rule = API_GAP_PATTERNS.find(([pattern]) => pattern.test(message));
|
|
4034
4305
|
const key = rule ? rule[1](rule[0].exec(message)) : message;
|