peachsim 0.1.1641 → 0.1.1644
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/app-bundle-resources.ts +57 -0
- package/cli/commands/control.ts +12 -0
- package/cli/drivers/playwright.ts +39 -0
- package/cli/outbound-endpoints.ts +4 -2
- package/detox/motion-change.cjs +7 -5
- package/detox/motion-change.d.cts +1 -0
- package/detox/motion-leg-starts.cjs +20 -0
- package/detox/motion-leg-starts.d.cts +8 -0
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.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 +3 -3
- 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/bundle-channel.cjs +719 -572
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +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/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +7 -6
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +656 -509
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +811 -658
- 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 +89 -41
- 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 +14 -6
- package/dist-lib/menu.mjs +14 -6
- 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 +88 -41
- package/dist-lib/native-app-identity-project.cjs +90 -41
- package/dist-lib/native-app-identity-project.mjs +89 -41
- 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/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +2 -1
- package/dist-lib/sdk.mjs +2 -1
- package/dist-lib/skills.cjs +1716 -1366
- package/dist-lib/swift-compile.cjs +297 -215
- package/dist-lib/swift-compile.mjs +315 -227
- 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 +620 -473
- package/dist-lib/vite.cjs +1 -1
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/package.json +1 -1
- package/src/appBundleResourcesContract.ts +51 -0
- package/src/backend-origin.ts +3 -1
- package/src/host/bridge-host.ts +17 -11
- package/src/host/staged-host-files.ts +28 -4
- package/src/launchMetadataContract.ts +1 -0
- package/src/menu.ts +12 -4
- package/src/native-app-identity-project.ts +47 -38
- package/src/runtime-delivery.ts +6 -7
- package/src/swift-compile.ts +18 -7
- package/src/swift-compiler-digest.ts +5 -3
- package/src/swift-objc-compile.ts +34 -4
- package/src/swift-root-lock.ts +241 -92
- package/src/xcode-project.ts +67 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1644 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -14,8 +14,8 @@ var __commonJS = (cb, mod) => function __require() {
|
|
|
14
14
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
15
15
|
};
|
|
16
16
|
var __export = (target, all) => {
|
|
17
|
-
for (var
|
|
18
|
-
__defProp(target,
|
|
17
|
+
for (var name3 in all)
|
|
18
|
+
__defProp(target, name3, { get: all[name3], enumerable: true });
|
|
19
19
|
};
|
|
20
20
|
var __copyProps = (to, from, except, desc) => {
|
|
21
21
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -533,8 +533,8 @@ var require_build = __commonJS({
|
|
|
533
533
|
}
|
|
534
534
|
function walk_obj(next, next_child) {
|
|
535
535
|
var tag_type, i, prop;
|
|
536
|
-
var
|
|
537
|
-
if ("Undefined" ==
|
|
536
|
+
var name3 = type(next);
|
|
537
|
+
if ("Undefined" == name3) {
|
|
538
538
|
return;
|
|
539
539
|
} else if (Array.isArray(next)) {
|
|
540
540
|
next_child = next_child.ele("array");
|
|
@@ -543,7 +543,7 @@ var require_build = __commonJS({
|
|
|
543
543
|
}
|
|
544
544
|
} else if (Buffer.isBuffer(next)) {
|
|
545
545
|
next_child.ele("data").raw(next.toString("base64"));
|
|
546
|
-
} else if ("Object" ==
|
|
546
|
+
} else if ("Object" == name3) {
|
|
547
547
|
next_child = next_child.ele("dict");
|
|
548
548
|
for (prop in next) {
|
|
549
549
|
if (next.hasOwnProperty(prop)) {
|
|
@@ -551,22 +551,22 @@ var require_build = __commonJS({
|
|
|
551
551
|
walk_obj(next[prop], next_child);
|
|
552
552
|
}
|
|
553
553
|
}
|
|
554
|
-
} else if ("Number" ==
|
|
554
|
+
} else if ("Number" == name3) {
|
|
555
555
|
tag_type = next % 1 === 0 ? "integer" : "real";
|
|
556
556
|
next_child.ele(tag_type).txt(next.toString());
|
|
557
|
-
} else if ("BigInt" ==
|
|
557
|
+
} else if ("BigInt" == name3) {
|
|
558
558
|
next_child.ele("integer").txt(next);
|
|
559
|
-
} else if ("Date" ==
|
|
559
|
+
} else if ("Date" == name3) {
|
|
560
560
|
next_child.ele("date").txt(ISODateString(new Date(next)));
|
|
561
|
-
} else if ("Boolean" ==
|
|
561
|
+
} else if ("Boolean" == name3) {
|
|
562
562
|
next_child.ele(next ? "true" : "false");
|
|
563
|
-
} else if ("String" ==
|
|
563
|
+
} else if ("String" == name3) {
|
|
564
564
|
next_child.ele("string").txt(next);
|
|
565
|
-
} else if ("ArrayBuffer" ==
|
|
565
|
+
} else if ("ArrayBuffer" == name3) {
|
|
566
566
|
next_child.ele("data").raw(base64.fromByteArray(next));
|
|
567
567
|
} else if (next && next.buffer && "ArrayBuffer" == type(next.buffer)) {
|
|
568
568
|
next_child.ele("data").raw(base64.fromByteArray(new Uint8Array(next.buffer), next_child));
|
|
569
|
-
} else if ("Null" ===
|
|
569
|
+
} else if ("Null" === name3) {
|
|
570
570
|
next_child.ele("null").txt("");
|
|
571
571
|
}
|
|
572
572
|
}
|
|
@@ -652,8 +652,8 @@ var require_parse2 = __commonJS({
|
|
|
652
652
|
}
|
|
653
653
|
return root;
|
|
654
654
|
};
|
|
655
|
-
function internalize(holder,
|
|
656
|
-
const value = holder[
|
|
655
|
+
function internalize(holder, name3, reviver) {
|
|
656
|
+
const value = holder[name3];
|
|
657
657
|
if (value != null && typeof value === "object") {
|
|
658
658
|
if (Array.isArray(value)) {
|
|
659
659
|
for (let i = 0; i < value.length; i++) {
|
|
@@ -686,7 +686,7 @@ var require_parse2 = __commonJS({
|
|
|
686
686
|
}
|
|
687
687
|
}
|
|
688
688
|
}
|
|
689
|
-
return reviver.call(holder,
|
|
689
|
+
return reviver.call(holder, name3, value);
|
|
690
690
|
}
|
|
691
691
|
var lexState;
|
|
692
692
|
var buffer;
|
|
@@ -1719,7 +1719,7 @@ var import_node_util2 = require("node:util");
|
|
|
1719
1719
|
var RNX_FORKED_SCRIPT_ENV = "PEACH_RUNS_FORKED_SCRIPTS";
|
|
1720
1720
|
|
|
1721
1721
|
// src/backend-origin.ts
|
|
1722
|
-
var DEFAULT_CONTRAST_BACKEND_ORIGIN = "https://
|
|
1722
|
+
var DEFAULT_CONTRAST_BACKEND_ORIGIN = "https://peachsim.com";
|
|
1723
1723
|
function normalizeHostname(hostname) {
|
|
1724
1724
|
return hostname.replace(/^\[|\]$/g, "").toLowerCase();
|
|
1725
1725
|
}
|
|
@@ -1730,7 +1730,7 @@ function isLoopbackHost(hostname) {
|
|
|
1730
1730
|
var PEACHSIM_NATIVE_HOST = "native.peachsim.com";
|
|
1731
1731
|
function isContrastBackendHost(hostname) {
|
|
1732
1732
|
const normalized = normalizeHostname(hostname);
|
|
1733
|
-
return isLoopbackHost(normalized) || normalized === "contrast.dev" || normalized.endsWith(".contrast.dev") || normalized === PEACHSIM_NATIVE_HOST;
|
|
1733
|
+
return isLoopbackHost(normalized) || normalized === "contrast.dev" || normalized.endsWith(".contrast.dev") || normalized === "peachsim.com" || normalized === "www.peachsim.com" || normalized === PEACHSIM_NATIVE_HOST;
|
|
1734
1734
|
}
|
|
1735
1735
|
function resolveContrastBackendOrigin(currentOrigin, search) {
|
|
1736
1736
|
const origin = new URLSearchParams(search ?? "").get("backend")?.trim() || currentOrigin?.trim();
|
|
@@ -1800,9 +1800,9 @@ function cacheDir() {
|
|
|
1800
1800
|
}
|
|
1801
1801
|
function swiftPackageCacheOptions() {
|
|
1802
1802
|
const root = import_node_path.default.join(cacheDir(), "swiftpm");
|
|
1803
|
-
return ["cache", "config", "security"].flatMap((
|
|
1804
|
-
`--${
|
|
1805
|
-
import_node_path.default.join(root,
|
|
1803
|
+
return ["cache", "config", "security"].flatMap((name3) => [
|
|
1804
|
+
`--${name3}-path`,
|
|
1805
|
+
import_node_path.default.join(root, name3)
|
|
1806
1806
|
]);
|
|
1807
1807
|
}
|
|
1808
1808
|
var DAEMON_LOCKFILE_MAX_BYTES = 16 * 1024;
|
|
@@ -2187,7 +2187,7 @@ function designTimeDiagnostic(output, files2) {
|
|
|
2187
2187
|
const rewritten = /* @__PURE__ */ new Map();
|
|
2188
2188
|
const linesOf = (path21) => {
|
|
2189
2189
|
const file = Object.keys(files2).find(
|
|
2190
|
-
(
|
|
2190
|
+
(name3) => name3.endsWith(".swift") && (path21 === name3 || path21.endsWith(`/${name3}`))
|
|
2191
2191
|
);
|
|
2192
2192
|
if (file === void 0) return null;
|
|
2193
2193
|
let lines = rewritten.get(file);
|
|
@@ -2387,10 +2387,10 @@ var swiftHome;
|
|
|
2387
2387
|
function confineSwiftScratch(root) {
|
|
2388
2388
|
if (scratch) return;
|
|
2389
2389
|
import_node_fs2.default.mkdirSync(root, { recursive: true });
|
|
2390
|
-
for (const
|
|
2391
|
-
const pid = Number(
|
|
2390
|
+
for (const name3 of import_node_fs2.default.readdirSync(root)) {
|
|
2391
|
+
const pid = Number(name3);
|
|
2392
2392
|
if (Number.isInteger(pid) && pid > 0 && !processRuns(pid))
|
|
2393
|
-
import_node_fs2.default.rmSync(import_node_path3.default.join(root,
|
|
2393
|
+
import_node_fs2.default.rmSync(import_node_path3.default.join(root, name3), { recursive: true, force: true });
|
|
2394
2394
|
}
|
|
2395
2395
|
const dir = import_node_path3.default.join(root, String(process.pid));
|
|
2396
2396
|
import_node_fs2.default.mkdirSync(dir, { recursive: true });
|
|
@@ -2402,11 +2402,11 @@ function confineSwiftScratch(root) {
|
|
|
2402
2402
|
const seeded = import_node_path3.default.join(import_node_os3.default.homedir(), ".swiftpm");
|
|
2403
2403
|
const dirAbsentBefore = lstatIfKnown(seeded) === null;
|
|
2404
2404
|
const absentBefore = swiftpmSeeds.filter(
|
|
2405
|
-
(
|
|
2405
|
+
(name3) => lstatIfKnown(import_node_path3.default.join(seeded, name3)) === null
|
|
2406
2406
|
);
|
|
2407
2407
|
process.once("exit", () => {
|
|
2408
2408
|
import_node_fs2.default.rmSync(dir, { recursive: true, force: true });
|
|
2409
|
-
for (const
|
|
2409
|
+
for (const name3 of absentBefore) removeSwiftpmSeed(import_node_path3.default.join(seeded, name3), name3);
|
|
2410
2410
|
if (dirAbsentBefore && lstatIfKnown(seeded)?.isDirectory())
|
|
2411
2411
|
try {
|
|
2412
2412
|
import_node_fs2.default.rmdirSync(seeded);
|
|
@@ -2423,11 +2423,11 @@ function lstatIfKnown(entry) {
|
|
|
2423
2423
|
return void 0;
|
|
2424
2424
|
}
|
|
2425
2425
|
}
|
|
2426
|
-
function removeSwiftpmSeed(entry,
|
|
2426
|
+
function removeSwiftpmSeed(entry, name3) {
|
|
2427
2427
|
const stat = lstatIfKnown(entry);
|
|
2428
2428
|
if (!stat) return;
|
|
2429
2429
|
try {
|
|
2430
|
-
if (
|
|
2430
|
+
if (name3 === "cache") {
|
|
2431
2431
|
if (stat.isSymbolicLink() && import_node_fs2.default.readlinkSync(entry).endsWith("/.cache/org.swift.swiftpm"))
|
|
2432
2432
|
import_node_fs2.default.unlinkSync(entry);
|
|
2433
2433
|
} else if (stat.isDirectory()) {
|
|
@@ -2516,7 +2516,7 @@ function swiftSdkPayloadChecksum(bundle) {
|
|
|
2516
2516
|
hash.update(JSON.stringify([relative, "link", import_node_fs2.default.readlinkSync(file)]) + "\n");
|
|
2517
2517
|
} else if (stat.isDirectory()) {
|
|
2518
2518
|
hash.update(JSON.stringify([relative, "directory"]) + "\n");
|
|
2519
|
-
for (const
|
|
2519
|
+
for (const name3 of import_node_fs2.default.readdirSync(file).sort()) visit(import_node_path3.default.join(relative, name3));
|
|
2520
2520
|
} else if (stat.isFile()) {
|
|
2521
2521
|
const stamp = [stat.dev, stat.ino, stat.size, stat.mtimeNs, stat.ctimeNs].join(":");
|
|
2522
2522
|
let cached2 = sdkFileHashes.get(file);
|
|
@@ -2744,12 +2744,12 @@ function swiftCompilerInstall(release) {
|
|
|
2744
2744
|
};
|
|
2745
2745
|
}
|
|
2746
2746
|
const platform = `debian12${process.arch === "arm64" ? "-aarch64" : ""}`;
|
|
2747
|
-
const
|
|
2747
|
+
const name3 = `${release}-${platform}`;
|
|
2748
2748
|
return {
|
|
2749
2749
|
note: " (Debian 12 shown; other distributions: https://www.swift.org/install/linux/)",
|
|
2750
2750
|
commands: [
|
|
2751
|
-
`curl -fsSL ${downloads}/${platform}/${release}/${
|
|
2752
|
-
`export PATH=/opt/${
|
|
2751
|
+
`curl -fsSL ${downloads}/${platform}/${release}/${name3}.tar.gz | tar -xz -C /opt`,
|
|
2752
|
+
`export PATH=/opt/${name3}/usr/bin:$PATH`
|
|
2753
2753
|
]
|
|
2754
2754
|
};
|
|
2755
2755
|
}
|
|
@@ -2814,7 +2814,7 @@ async function load(toolchainBin, sdk) {
|
|
|
2814
2814
|
icuSegment(archiveMember((0, import_node_fs3.readFileSync)(import_node_path4.default.join(resources, ARCHIVE)), MEMBER))
|
|
2815
2815
|
);
|
|
2816
2816
|
}
|
|
2817
|
-
function archiveMember(archive,
|
|
2817
|
+
function archiveMember(archive, name3) {
|
|
2818
2818
|
if (archive.toString("latin1", 0, 8) !== "!<arch>\n")
|
|
2819
2819
|
throw new Error("swift-icu: not an ar archive");
|
|
2820
2820
|
let names = "";
|
|
@@ -2824,10 +2824,10 @@ function archiveMember(archive, name2) {
|
|
|
2824
2824
|
const body = archive.subarray(at + 60, at + 60 + size);
|
|
2825
2825
|
if (raw2 === "//") names = body.toString("latin1");
|
|
2826
2826
|
const member = /^\/\d+$/.test(raw2) ? names.slice(Number(raw2.slice(1)), names.indexOf("/\n", Number(raw2.slice(1)))) : raw2.replace(/\/$/, "");
|
|
2827
|
-
if (member ===
|
|
2827
|
+
if (member === name3) return body;
|
|
2828
2828
|
at += 60 + size + size % 2;
|
|
2829
2829
|
}
|
|
2830
|
-
throw new Error(`swift-icu: ${
|
|
2830
|
+
throw new Error(`swift-icu: ${name3} is not in the sdk's icu archive`);
|
|
2831
2831
|
}
|
|
2832
2832
|
function icuSegment(object2) {
|
|
2833
2833
|
let at = 8;
|
|
@@ -2976,8 +2976,8 @@ var SWIFT_NATIVE_SOURCE_EXTENSIONS = [
|
|
|
2976
2976
|
".inl",
|
|
2977
2977
|
".modulemap"
|
|
2978
2978
|
];
|
|
2979
|
-
function swiftTargetModuleName(
|
|
2980
|
-
return
|
|
2979
|
+
function swiftTargetModuleName(name3) {
|
|
2980
|
+
return name3.replace(/[^A-Za-z0-9_]/g, "_").replace(/^[0-9]/, "_");
|
|
2981
2981
|
}
|
|
2982
2982
|
function swiftPackageIdentity(url) {
|
|
2983
2983
|
return (url.split("/").pop() ?? url).replace(/\.git$/, "").toLowerCase();
|
|
@@ -2992,16 +2992,16 @@ function swiftManifestTargets(manifest, resourcePaths = []) {
|
|
|
2992
2992
|
]);
|
|
2993
2993
|
const targetNames = new Set(
|
|
2994
2994
|
declarations.flatMap(({ flat }) => {
|
|
2995
|
-
const
|
|
2996
|
-
return
|
|
2995
|
+
const name3 = /\bname\s*:\s*"([^"]+)"/.exec(flat)?.[1];
|
|
2996
|
+
return name3 ? [name3] : [];
|
|
2997
2997
|
})
|
|
2998
2998
|
);
|
|
2999
2999
|
for (const { kind, flat, call } of declarations) {
|
|
3000
3000
|
const executable = kind === "executableTarget";
|
|
3001
|
-
const
|
|
3002
|
-
if (!
|
|
3001
|
+
const name3 = /\bname\s*:\s*"([^"]+)"/.exec(flat)?.[1];
|
|
3002
|
+
if (!name3) continue;
|
|
3003
3003
|
const rawPath = /\bpath\s*:\s*"([^"]*)"/.exec(flat)?.[1];
|
|
3004
|
-
const targetPath = rawPath == null || rawPath === "" ? `Sources/${
|
|
3004
|
+
const targetPath = rawPath == null || rawPath === "" ? `Sources/${name3}` : rawPath.replace(/^\.\//, "").replace(/\/+$/, "");
|
|
3005
3005
|
const languageMode = Number(
|
|
3006
3006
|
/\.swiftLanguageMode\(\s*\.v(\d+)\s*\)/.exec(call)?.[1] ?? "5"
|
|
3007
3007
|
);
|
|
@@ -3041,12 +3041,12 @@ function swiftManifestTargets(manifest, resourcePaths = []) {
|
|
|
3041
3041
|
dependencyNames.add(dependencyName);
|
|
3042
3042
|
}
|
|
3043
3043
|
}
|
|
3044
|
-
const dependencies = [...dependencyNames].map((
|
|
3044
|
+
const dependencies = [...dependencyNames].map((name4) => ({
|
|
3045
3045
|
kind: "target",
|
|
3046
|
-
name:
|
|
3046
|
+
name: name4
|
|
3047
3047
|
}));
|
|
3048
3048
|
targets.push({
|
|
3049
|
-
name:
|
|
3049
|
+
name: name3,
|
|
3050
3050
|
path: targetPath,
|
|
3051
3051
|
executable,
|
|
3052
3052
|
...kind === "systemLibrary" ? { systemLibrary: true } : {},
|
|
@@ -3094,8 +3094,8 @@ function swiftResourceBundleForFile(bundles, file) {
|
|
|
3094
3094
|
return owner;
|
|
3095
3095
|
}
|
|
3096
3096
|
function swiftResourceBundleInfoPlist(bundle) {
|
|
3097
|
-
const
|
|
3098
|
-
const escaped =
|
|
3097
|
+
const name3 = bundle.path.split("/").pop().replace(/\.(bundle|framework)$/, "");
|
|
3098
|
+
const escaped = name3.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
3099
3099
|
return `<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict><key>CFBundleName</key><string>${escaped}</string><key>CFBundlePackageType</key><string>${bundle.path.endsWith(".framework") ? "FMWK" : "BNDL"}</string></dict></plist>`;
|
|
3100
3100
|
}
|
|
3101
3101
|
function swiftMetalSourceFiles(files2) {
|
|
@@ -3126,39 +3126,57 @@ var import_node_child_process5 = require("node:child_process");
|
|
|
3126
3126
|
var import_node_crypto3 = require("node:crypto");
|
|
3127
3127
|
var import_node_fs4 = require("node:fs");
|
|
3128
3128
|
var import_node_path5 = __toESM(require("node:path"), 1);
|
|
3129
|
+
init_process_group();
|
|
3129
3130
|
var POLL_MS = 250;
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
encoding: "utf8",
|
|
3134
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
3135
|
-
}).trim() || null;
|
|
3136
|
-
} catch {
|
|
3137
|
-
return null;
|
|
3138
|
-
}
|
|
3131
|
+
var START_TOLERANCE_MS = 2e3;
|
|
3132
|
+
function errorCode(error) {
|
|
3133
|
+
return error instanceof Error && "code" in error && typeof error.code === "string" ? error.code : void 0;
|
|
3139
3134
|
}
|
|
3140
|
-
function
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
return { pid: value.pid, start: value.start };
|
|
3145
|
-
} catch {
|
|
3146
|
-
}
|
|
3147
|
-
return null;
|
|
3135
|
+
function parseStart(text4) {
|
|
3136
|
+
const start = Date.parse(`${text4} UTC`);
|
|
3137
|
+
if (Number.isNaN(start)) throw new Error(`unreadable process start time "${text4}"`);
|
|
3138
|
+
return start;
|
|
3148
3139
|
}
|
|
3149
|
-
function
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3140
|
+
function processTable() {
|
|
3141
|
+
const result = (0, import_node_child_process5.spawnSync)("ps", ["-A", "-o", "pid=,pgid=,stat=,lstart="], {
|
|
3142
|
+
encoding: "utf8",
|
|
3143
|
+
env: { ...process.env, LC_ALL: "C", TZ: "UTC" },
|
|
3144
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
3145
|
+
timeout: 1e4,
|
|
3146
|
+
killSignal: "SIGKILL"
|
|
3147
|
+
});
|
|
3148
|
+
if (result.error || result.status !== 0) {
|
|
3149
|
+
throw new Error(
|
|
3150
|
+
`swift root lock cannot read the process table: ${result.error?.message || result.stderr.trim() || `ps exited ${result.status}`}`
|
|
3151
|
+
);
|
|
3155
3152
|
}
|
|
3153
|
+
return result.stdout.split("\n").filter((line) => line.trim()).map((line) => {
|
|
3154
|
+
const match = /^\s*(\d+)\s+(\d+)\s+(\S+)\s+(.+?)\s*$/.exec(line);
|
|
3155
|
+
if (!match)
|
|
3156
|
+
throw new Error(`swift root lock cannot parse a process table row: ${line}`);
|
|
3157
|
+
return {
|
|
3158
|
+
pid: Number(match[1]),
|
|
3159
|
+
pgid: Number(match[2]),
|
|
3160
|
+
zombie: match[3].startsWith("Z"),
|
|
3161
|
+
start: parseStart(match[4])
|
|
3162
|
+
};
|
|
3163
|
+
});
|
|
3156
3164
|
}
|
|
3157
|
-
function
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3165
|
+
function sameProcess(row, identity) {
|
|
3166
|
+
return row.pid === identity.pid && Math.abs(row.start - identity.start) <= START_TOLERANCE_MS;
|
|
3167
|
+
}
|
|
3168
|
+
function ownIdentity(pid) {
|
|
3169
|
+
const row = processTable().find(
|
|
3170
|
+
(candidate) => candidate.pid === pid && !candidate.zombie
|
|
3171
|
+
);
|
|
3172
|
+
if (!row) throw new Error(`swift root lock cannot find process ${pid}`);
|
|
3173
|
+
return { pid, start: row.start };
|
|
3174
|
+
}
|
|
3175
|
+
function parseIdentity(text4) {
|
|
3176
|
+
const value = JSON.parse(text4);
|
|
3177
|
+
if (value && typeof value === "object" && "pid" in value && typeof value.pid === "number" && "start" in value && typeof value.start === "number")
|
|
3178
|
+
return { pid: value.pid, start: value.start };
|
|
3179
|
+
throw new Error(`swift root lock record is not a process identity: ${text4}`);
|
|
3162
3180
|
}
|
|
3163
3181
|
function pause(ms, signal) {
|
|
3164
3182
|
return new Promise((resolve3) => {
|
|
@@ -3171,64 +3189,127 @@ function pause(ms, signal) {
|
|
|
3171
3189
|
signal?.addEventListener("abort", done, { once: true });
|
|
3172
3190
|
});
|
|
3173
3191
|
}
|
|
3192
|
+
var name = (number, suffix) => `${String(number).padStart(12, "0")}.${suffix}`;
|
|
3193
|
+
function generationNumbers(directory) {
|
|
3194
|
+
const numbers = /* @__PURE__ */ new Set();
|
|
3195
|
+
for (const entry of (0, import_node_fs4.readdirSync)(directory)) {
|
|
3196
|
+
const match = /^(\d{12})\./.exec(entry);
|
|
3197
|
+
if (match) numbers.add(Number(match[1]));
|
|
3198
|
+
}
|
|
3199
|
+
return [...numbers].sort((a, b) => a - b);
|
|
3200
|
+
}
|
|
3201
|
+
function readGeneration(directory, number) {
|
|
3202
|
+
let owner;
|
|
3203
|
+
try {
|
|
3204
|
+
owner = (0, import_node_fs4.readFileSync)(import_node_path5.default.join(directory, name(number, "owner")), "utf8");
|
|
3205
|
+
} catch (error) {
|
|
3206
|
+
if (errorCode(error) === "ENOENT") return null;
|
|
3207
|
+
throw error;
|
|
3208
|
+
}
|
|
3209
|
+
return {
|
|
3210
|
+
number,
|
|
3211
|
+
holder: parseIdentity(owner),
|
|
3212
|
+
released: (0, import_node_fs4.readdirSync)(directory).includes(name(number, "released"))
|
|
3213
|
+
};
|
|
3214
|
+
}
|
|
3215
|
+
function readChildren(directory, number) {
|
|
3216
|
+
const prefix = name(number, "child.");
|
|
3217
|
+
return (0, import_node_fs4.readdirSync)(directory).filter((entry) => entry.startsWith(prefix)).map((entry) => parseIdentity((0, import_node_fs4.readFileSync)(import_node_path5.default.join(directory, entry), "utf8")));
|
|
3218
|
+
}
|
|
3219
|
+
function groupAlive(table, leader) {
|
|
3220
|
+
const row = table.find((candidate) => candidate.pid === leader.pid);
|
|
3221
|
+
if (row && !sameProcess(row, leader)) return false;
|
|
3222
|
+
return table.some((candidate) => candidate.pgid === leader.pid && !candidate.zombie);
|
|
3223
|
+
}
|
|
3174
3224
|
async function withSwiftRootLock(root, work, signal) {
|
|
3175
|
-
const directory = import_node_path5.default.join(
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3225
|
+
const directory = import_node_path5.default.join(
|
|
3226
|
+
rnxHomeDir(),
|
|
3227
|
+
"cache",
|
|
3228
|
+
"swift-root-locks",
|
|
3229
|
+
(0, import_node_crypto3.createHash)("sha256").update(root).digest("hex").slice(0, 32)
|
|
3180
3230
|
);
|
|
3231
|
+
(0, import_node_fs4.mkdirSync)(directory, { recursive: true });
|
|
3181
3232
|
const token = (0, import_node_crypto3.randomUUID)();
|
|
3182
|
-
const owner = JSON.stringify(
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
} catch (error) {
|
|
3196
|
-
if (!(error instanceof Error && "code" in error && error.code === "EEXIST"))
|
|
3197
|
-
throw error;
|
|
3233
|
+
const owner = JSON.stringify(ownIdentity(process.pid));
|
|
3234
|
+
const pending = import_node_path5.default.join(directory, `pending.${token}`);
|
|
3235
|
+
let held = 0;
|
|
3236
|
+
for (; ; ) {
|
|
3237
|
+
signal?.throwIfAborted();
|
|
3238
|
+
const newest = generationNumbers(directory).at(-1) ?? 0;
|
|
3239
|
+
const current = newest > 0 ? readGeneration(directory, newest) : null;
|
|
3240
|
+
if (newest > 0 && !current) continue;
|
|
3241
|
+
if (current && !current.released) {
|
|
3242
|
+
const table = processTable();
|
|
3243
|
+
if (table.some((row) => !row.zombie && sameProcess(row, current.holder))) {
|
|
3244
|
+
await pause(POLL_MS, signal);
|
|
3245
|
+
continue;
|
|
3198
3246
|
}
|
|
3199
|
-
const
|
|
3200
|
-
if (
|
|
3201
|
-
if (holderAlive(held)) {
|
|
3247
|
+
const children2 = readChildren(directory, newest);
|
|
3248
|
+
if (children2.some((child) => groupAlive(table, child))) {
|
|
3202
3249
|
await pause(POLL_MS, signal);
|
|
3203
3250
|
continue;
|
|
3204
3251
|
}
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3252
|
+
}
|
|
3253
|
+
(0, import_node_fs4.writeFileSync)(pending, owner);
|
|
3254
|
+
try {
|
|
3255
|
+
(0, import_node_fs4.linkSync)(pending, import_node_path5.default.join(directory, name(newest + 1, "owner")));
|
|
3256
|
+
} catch (error) {
|
|
3257
|
+
if (errorCode(error) === "EEXIST") continue;
|
|
3258
|
+
throw error;
|
|
3259
|
+
} finally {
|
|
3260
|
+
(0, import_node_fs4.rmSync)(pending, { force: true });
|
|
3261
|
+
}
|
|
3262
|
+
const numbers = generationNumbers(directory);
|
|
3263
|
+
if (numbers.at(-1) !== newest + 1) {
|
|
3264
|
+
(0, import_node_fs4.rmSync)(import_node_path5.default.join(directory, name(newest + 1, "owner")), { force: true });
|
|
3265
|
+
continue;
|
|
3266
|
+
}
|
|
3267
|
+
held = newest + 1;
|
|
3268
|
+
for (const number of numbers)
|
|
3269
|
+
if (number < held) {
|
|
3270
|
+
for (const entry of (0, import_node_fs4.readdirSync)(directory))
|
|
3271
|
+
if (entry.startsWith(name(number, "")))
|
|
3272
|
+
(0, import_node_fs4.rmSync)(import_node_path5.default.join(directory, entry), { force: true });
|
|
3211
3273
|
}
|
|
3274
|
+
break;
|
|
3275
|
+
}
|
|
3276
|
+
const children = [];
|
|
3277
|
+
const lease = {
|
|
3278
|
+
spawn(command, args, options) {
|
|
3279
|
+
const child = (0, import_node_child_process5.spawn)(
|
|
3280
|
+
"/bin/sh",
|
|
3281
|
+
["-c", 'IFS= read -r go || exit 1; exec "$@" </dev/null', "sh", command, ...args],
|
|
3282
|
+
{ ...options, detached: true, stdio: ["pipe", "pipe", "pipe"] }
|
|
3283
|
+
);
|
|
3284
|
+
child.stdin.on("error", () => {
|
|
3285
|
+
});
|
|
3286
|
+
children.push(child);
|
|
3212
3287
|
try {
|
|
3213
|
-
if (
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
if (!(error instanceof Error && "code" in error && error.code === "EEXIST"))
|
|
3218
|
-
throw error;
|
|
3219
|
-
}
|
|
3288
|
+
if (child.pid === void 0) {
|
|
3289
|
+
child.once("error", () => {
|
|
3290
|
+
});
|
|
3291
|
+
throw new Error(`could not start ${command}`);
|
|
3220
3292
|
}
|
|
3221
|
-
|
|
3222
|
-
|
|
3293
|
+
const childPending = `${pending}.child.${child.pid}`;
|
|
3294
|
+
try {
|
|
3295
|
+
(0, import_node_fs4.writeFileSync)(childPending, JSON.stringify(ownIdentity(child.pid)));
|
|
3296
|
+
(0, import_node_fs4.linkSync)(childPending, import_node_path5.default.join(directory, name(held, `child.${child.pid}`)));
|
|
3297
|
+
} finally {
|
|
3298
|
+
(0, import_node_fs4.rmSync)(childPending, { force: true });
|
|
3299
|
+
}
|
|
3300
|
+
} catch (error) {
|
|
3301
|
+
child.stdin.destroy();
|
|
3302
|
+
throw error;
|
|
3223
3303
|
}
|
|
3304
|
+
child.stdin.end("go\n");
|
|
3305
|
+
return child;
|
|
3224
3306
|
}
|
|
3225
|
-
}
|
|
3226
|
-
(0, import_node_fs4.rmSync)(pending, { force: true });
|
|
3227
|
-
}
|
|
3307
|
+
};
|
|
3228
3308
|
try {
|
|
3229
|
-
return await work();
|
|
3309
|
+
return await work(lease);
|
|
3230
3310
|
} finally {
|
|
3231
|
-
|
|
3311
|
+
await Promise.all(children.map((child) => terminateProcessGroup(child, "SIGKILL", 0)));
|
|
3312
|
+
(0, import_node_fs4.writeFileSync)(import_node_path5.default.join(directory, name(held, "released")), "");
|
|
3232
3313
|
}
|
|
3233
3314
|
}
|
|
3234
3315
|
|
|
@@ -3259,12 +3340,13 @@ function isSwiftMetalLibrarySources(value) {
|
|
|
3259
3340
|
async function runCompiler(command, args, options, stream = false, quiet) {
|
|
3260
3341
|
const { signal } = options;
|
|
3261
3342
|
signal?.throwIfAborted();
|
|
3262
|
-
const
|
|
3343
|
+
const launch = {
|
|
3263
3344
|
cwd: options.cwd,
|
|
3264
3345
|
env: swiftEnvironment(options.env),
|
|
3265
3346
|
detached: true,
|
|
3266
3347
|
stdio: ["ignore", "pipe", "pipe"]
|
|
3267
|
-
}
|
|
3348
|
+
};
|
|
3349
|
+
const child = options.lease ? options.lease.spawn(command, args, launch) : (0, import_node_child_process6.spawn)(command, args, launch);
|
|
3268
3350
|
let stopping;
|
|
3269
3351
|
try {
|
|
3270
3352
|
await new Promise((resolve3, reject) => {
|
|
@@ -3278,20 +3360,20 @@ async function runCompiler(command, args, options, stream = false, quiet) {
|
|
|
3278
3360
|
void stopping.catch(() => {
|
|
3279
3361
|
});
|
|
3280
3362
|
};
|
|
3281
|
-
for (const
|
|
3282
|
-
child[
|
|
3283
|
-
if (stream === true) process[
|
|
3363
|
+
for (const name3 of ["stdout", "stderr"]) {
|
|
3364
|
+
child[name3].on("data", (bytes) => {
|
|
3365
|
+
if (stream === true) process[name3].write(bytes);
|
|
3284
3366
|
else if (stream) {
|
|
3285
|
-
const lines = (partial[
|
|
3286
|
-
partial[
|
|
3367
|
+
const lines = (partial[name3] + bytes.toString()).split("\n");
|
|
3368
|
+
partial[name3] = lines.pop();
|
|
3287
3369
|
for (const line of lines)
|
|
3288
|
-
if (stream.test(line)) process[
|
|
3370
|
+
if (stream.test(line)) process[name3].write(`${line}
|
|
3289
3371
|
`);
|
|
3290
3372
|
}
|
|
3291
|
-
sizes[
|
|
3292
|
-
if (sizes[
|
|
3373
|
+
sizes[name3] += bytes.length;
|
|
3374
|
+
if (sizes[name3] <= (options.maxBuffer ?? 1024 * 1024)) chunks[name3].push(bytes);
|
|
3293
3375
|
else {
|
|
3294
|
-
failure2 = new Error(`Swift compiler ${
|
|
3376
|
+
failure2 = new Error(`Swift compiler ${name3} exceeded its output limit`);
|
|
3295
3377
|
stop();
|
|
3296
3378
|
}
|
|
3297
3379
|
});
|
|
@@ -3319,9 +3401,9 @@ async function runCompiler(command, args, options, stream = false, quiet) {
|
|
|
3319
3401
|
);
|
|
3320
3402
|
else {
|
|
3321
3403
|
if (quiet) {
|
|
3322
|
-
for (const
|
|
3323
|
-
for (const line of Buffer.concat(chunks[
|
|
3324
|
-
if (line && !quiet.test(line)) process[
|
|
3404
|
+
for (const name3 of ["stdout", "stderr"])
|
|
3405
|
+
for (const line of Buffer.concat(chunks[name3]).toString().split("\n"))
|
|
3406
|
+
if (line && !quiet.test(line)) process[name3].write(`${line}
|
|
3325
3407
|
`);
|
|
3326
3408
|
}
|
|
3327
3409
|
resolve3();
|
|
@@ -3562,11 +3644,11 @@ function swiftCondition(text4, available) {
|
|
|
3562
3644
|
if (token === "false") return false;
|
|
3563
3645
|
const call = /^(\w+)\s*\(\s*([^,()]*?)\s*(?:,[^()]*)?\)$/.exec(token ?? "");
|
|
3564
3646
|
if (!call) return void 0;
|
|
3565
|
-
const [,
|
|
3566
|
-
if (
|
|
3567
|
-
if (
|
|
3568
|
-
if (
|
|
3569
|
-
if (
|
|
3647
|
+
const [, name3, argument] = call;
|
|
3648
|
+
if (name3 === "os") return argument === "iOS" || argument === "WASI";
|
|
3649
|
+
if (name3 === "canImport") return available.has(argument);
|
|
3650
|
+
if (name3 === "targetEnvironment") return false;
|
|
3651
|
+
if (name3 === "arch") return argument === "wasm32";
|
|
3570
3652
|
return void 0;
|
|
3571
3653
|
};
|
|
3572
3654
|
const both = () => {
|
|
@@ -3610,8 +3692,8 @@ function swiftImportNames(contents, available) {
|
|
|
3610
3692
|
continue;
|
|
3611
3693
|
}
|
|
3612
3694
|
if (available && frames.some((frame) => frame.active !== true)) continue;
|
|
3613
|
-
const
|
|
3614
|
-
if (
|
|
3695
|
+
const name3 = SWIFT_IMPORT.exec(line)?.[1];
|
|
3696
|
+
if (name3) names.push(name3);
|
|
3615
3697
|
}
|
|
3616
3698
|
return names;
|
|
3617
3699
|
}
|
|
@@ -3641,9 +3723,9 @@ function swiftSdkPaths(moduleRoot, toolchainBin) {
|
|
|
3641
3723
|
],
|
|
3642
3724
|
{ encoding: "utf8", env: swiftEnvironment(), stdio: ["ignore", "pipe", "pipe"] }
|
|
3643
3725
|
);
|
|
3644
|
-
const field = (
|
|
3645
|
-
const value = new RegExp(`^${
|
|
3646
|
-
if (!value) throw new Error(`swift sdk ${sdk} reports no ${
|
|
3726
|
+
const field = (name3) => {
|
|
3727
|
+
const value = new RegExp(`^${name3}:\\s*(.+)$`, "m").exec(configuration)?.[1]?.trim();
|
|
3728
|
+
if (!value) throw new Error(`swift sdk ${sdk} reports no ${name3}`);
|
|
3647
3729
|
return value;
|
|
3648
3730
|
};
|
|
3649
3731
|
const paths = {
|
|
@@ -3678,9 +3760,9 @@ function missingSwiftModules(files2, available) {
|
|
|
3678
3760
|
const missing = /* @__PURE__ */ new Map();
|
|
3679
3761
|
for (const [file, contents] of Object.entries(files2)) {
|
|
3680
3762
|
if (!file.endsWith(".swift") || file === "Package.swift") continue;
|
|
3681
|
-
for (const
|
|
3682
|
-
if (available.has(
|
|
3683
|
-
missing.set(
|
|
3763
|
+
for (const name3 of new Set(swiftImportNames(contents, available))) {
|
|
3764
|
+
if (available.has(name3)) continue;
|
|
3765
|
+
missing.set(name3, [...missing.get(name3) ?? [], file]);
|
|
3684
3766
|
}
|
|
3685
3767
|
}
|
|
3686
3768
|
return new Map([...missing].sort(([left], [right]) => left.localeCompare(right)));
|
|
@@ -3701,8 +3783,8 @@ function swiftTargetDependencies(files2, targets) {
|
|
|
3701
3783
|
(candidate) => candidate.name !== target.name && candidate.path !== "." && candidate.path.startsWith(prefix) && file.startsWith(`${candidate.path}/`)
|
|
3702
3784
|
))
|
|
3703
3785
|
continue;
|
|
3704
|
-
for (const
|
|
3705
|
-
if (names.has(
|
|
3786
|
+
for (const name3 of swiftImportNames(contents)) {
|
|
3787
|
+
if (names.has(name3) && name3 !== target.name) deps.add(name3);
|
|
3706
3788
|
}
|
|
3707
3789
|
}
|
|
3708
3790
|
siblings.set(target.name, [...deps].sort());
|
|
@@ -3732,7 +3814,7 @@ var EXECUTABLE_LINK_FLAGS = ` "-Xclang-linker", "-O0",
|
|
|
3732
3814
|
`;
|
|
3733
3815
|
var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
|
|
3734
3816
|
var MULTI_MANIFEST_VERSION = 39;
|
|
3735
|
-
var compilerSourceDigest = true ? "
|
|
3817
|
+
var compilerSourceDigest = true ? "c2ab17198fbe6328c75dc09bbe160fe6b0fd74d4b84a08e9f8dfcd2fcf4ca1f0" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
|
|
3736
3818
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
3737
3819
|
const hash = (0, import_node_crypto4.createHash)("sha256");
|
|
3738
3820
|
hash.update(`swift-compile
|
|
@@ -3758,10 +3840,10 @@ ${release}
|
|
|
3758
3840
|
(0, import_node_crypto4.createHash)("sha256").update(input.resources?.[base] ?? "").digest()
|
|
3759
3841
|
);
|
|
3760
3842
|
}
|
|
3761
|
-
for (const
|
|
3762
|
-
const image = input.images?.[
|
|
3843
|
+
for (const name3 of Object.keys(input.images ?? {}).sort()) {
|
|
3844
|
+
const image = input.images?.[name3];
|
|
3763
3845
|
if (!image) continue;
|
|
3764
|
-
hash.update((0, import_node_crypto4.createHash)("sha256").update(
|
|
3846
|
+
hash.update((0, import_node_crypto4.createHash)("sha256").update(name3).digest());
|
|
3765
3847
|
hash.update((0, import_node_crypto4.createHash)("sha256").update(image.file).digest());
|
|
3766
3848
|
hash.update((0, import_node_crypto4.createHash)("sha256").update(image.data).digest());
|
|
3767
3849
|
}
|
|
@@ -3800,17 +3882,17 @@ ${target}
|
|
|
3800
3882
|
function emitSwiftPackageManifest(args) {
|
|
3801
3883
|
const { targets, siblings, moduleRoot, oneModule, spriteKit, distribution } = args;
|
|
3802
3884
|
const reachedFrameworks = /* @__PURE__ */ new Set();
|
|
3803
|
-
const reach = (
|
|
3804
|
-
if (reachedFrameworks.has(
|
|
3805
|
-
reachedFrameworks.add(
|
|
3806
|
-
for (const dependency of OPTIONAL_FRAMEWORK_DEPENDENCIES[
|
|
3885
|
+
const reach = (name3) => {
|
|
3886
|
+
if (reachedFrameworks.has(name3)) return;
|
|
3887
|
+
reachedFrameworks.add(name3);
|
|
3888
|
+
for (const dependency of OPTIONAL_FRAMEWORK_DEPENDENCIES[name3] ?? [])
|
|
3807
3889
|
reach(dependency);
|
|
3808
3890
|
};
|
|
3809
|
-
for (const
|
|
3810
|
-
if (OPTIONAL_FRAMEWORKS.has(
|
|
3811
|
-
reach(
|
|
3891
|
+
for (const name3 of [...siblings.values()].flat())
|
|
3892
|
+
if (OPTIONAL_FRAMEWORKS.has(name3) && !targets.some((target) => target.name === name3))
|
|
3893
|
+
reach(name3);
|
|
3812
3894
|
if (spriteKit) {
|
|
3813
|
-
for (const
|
|
3895
|
+
for (const name3 of ["SpriteKit", "PeachBox2D", "simd", "GLKit"]) reach(name3);
|
|
3814
3896
|
}
|
|
3815
3897
|
const distributionLink = args.distributionLink;
|
|
3816
3898
|
if (distribution && !distributionLink)
|
|
@@ -3820,7 +3902,7 @@ function emitSwiftPackageManifest(args) {
|
|
|
3820
3902
|
if (distribution && distributionLink) {
|
|
3821
3903
|
const objects = distribution.objects.filter(
|
|
3822
3904
|
(object2) => [...OPTIONAL_FRAMEWORKS, "SpriteKit", "PeachBox2D"].every(
|
|
3823
|
-
(
|
|
3905
|
+
(name3) => !object2.startsWith(`lib/${name3}-`) || reachedFrameworks.has(name3)
|
|
3824
3906
|
)
|
|
3825
3907
|
);
|
|
3826
3908
|
distributionLink.files.set(
|
|
@@ -3849,11 +3931,11 @@ function emitSwiftPackageManifest(args) {
|
|
|
3849
3931
|
return ` .systemLibrary(name: ${JSON.stringify(target.name)}, path: ${JSON.stringify(target.path)}),`;
|
|
3850
3932
|
const isolation = target.mainActorIsolation ? " .defaultIsolation(MainActor.self)," : "";
|
|
3851
3933
|
const interoperability = target.cxxInterop ? " .interoperabilityMode(.Cxx)," : "";
|
|
3852
|
-
const defines = (target.defines ?? []).map((
|
|
3934
|
+
const defines = (target.defines ?? []).map((name3) => ` .define(${JSON.stringify(name3)}),`).join("");
|
|
3853
3935
|
const imports = distribution ? `, "-I", ${JSON.stringify(import_node_path6.default.join(moduleRoot, "modules"))}` : "";
|
|
3854
3936
|
const native = args.native?.get(target.name);
|
|
3855
|
-
const nativeImports = (siblings.get(target.name) ?? []).filter((
|
|
3856
|
-
(
|
|
3937
|
+
const nativeImports = (siblings.get(target.name) ?? []).filter((name3) => args.native?.has(name3)).map(
|
|
3938
|
+
(name3) => `, "-Xfrontend", "-import-module", "-Xfrontend", ${JSON.stringify(swiftTargetModuleName(name3))}`
|
|
3857
3939
|
).join("");
|
|
3858
3940
|
const header = args.headerDirectory && [...args.native?.values() ?? []].some(
|
|
3859
3941
|
(value) => value.late?.producers.includes(target.name)
|
|
@@ -3875,7 +3957,7 @@ function emitSwiftPackageManifest(args) {
|
|
|
3875
3957
|
const library = distribution && distributionLink ? ["-Xclang-linker", `--config=${distributionLink.path}`, ...distribution.link].map((flag) => `, ${JSON.stringify(flag)}`).join("") : "";
|
|
3876
3958
|
const kind = target.executable ? ".executableTarget" : ".target";
|
|
3877
3959
|
const linkedLibraries = (target.linkedLibraries ?? []).map(
|
|
3878
|
-
(
|
|
3960
|
+
(name3) => `.linkedLibrary(${JSON.stringify(name3)})`
|
|
3879
3961
|
);
|
|
3880
3962
|
const librarySettings = [
|
|
3881
3963
|
...linkedLibraries,
|
|
@@ -3914,9 +3996,9 @@ function emitSwiftPackageManifest(args) {
|
|
|
3914
3996
|
" targets: [",
|
|
3915
3997
|
...targets.map(stanza),
|
|
3916
3998
|
...[...args.native?.entries() ?? []].flatMap(
|
|
3917
|
-
([
|
|
3999
|
+
([name3, native]) => native.late ? [
|
|
3918
4000
|
` .target(name: ${JSON.stringify(native.late.name)},`,
|
|
3919
|
-
` dependencies: ${JSON.stringify([
|
|
4001
|
+
` dependencies: ${JSON.stringify([name3, ...native.late.producers])},`,
|
|
3920
4002
|
` path: ${JSON.stringify(native.path)},`,
|
|
3921
4003
|
` sources: ${JSON.stringify(native.lateSources)},`,
|
|
3922
4004
|
` publicHeadersPath: "include",`,
|
|
@@ -4169,7 +4251,7 @@ function extensionOverrideEdits(source, extraObjCExtensions) {
|
|
|
4169
4251
|
if (top?.kind !== "extension") continue;
|
|
4170
4252
|
const func = OVERRIDE_FUNC.exec(rest);
|
|
4171
4253
|
if (func) {
|
|
4172
|
-
const
|
|
4254
|
+
const name3 = func[2];
|
|
4173
4255
|
const open = at + func[0].length - 1;
|
|
4174
4256
|
let depth = 0;
|
|
4175
4257
|
let close = open;
|
|
@@ -4182,12 +4264,12 @@ function extensionOverrideEdits(source, extraObjCExtensions) {
|
|
|
4182
4264
|
const clause = source.slice(close + 1, body).trim();
|
|
4183
4265
|
const args = forwardedArguments(source.slice(open + 1, close));
|
|
4184
4266
|
if (args === null) continue;
|
|
4185
|
-
const call = (clause.includes("->") ? "return " : "") + (/\b(?:throws|rethrows)\b/.test(clause) ? "try " : "") + (/\basync\b/.test(clause) ? "await " : "") + `__peach_ext_${
|
|
4186
|
-
const signature = `func ${
|
|
4187
|
-
const nameAt = at + rest.indexOf(
|
|
4267
|
+
const call = (clause.includes("->") ? "return " : "") + (/\b(?:throws|rethrows)\b/.test(clause) ? "try " : "") + (/\basync\b/.test(clause) ? "await " : "") + `__peach_ext_${name3}(${args})`;
|
|
4268
|
+
const signature = `func ${name3}${func[3] ?? ""}${source.slice(open, close + 1)}${clause ? ` ${clause}` : ""}`;
|
|
4269
|
+
const nameAt = at + rest.indexOf(name3, rest.indexOf("func", "override".length + func[1].length) + 4);
|
|
4188
4270
|
lifted.push({
|
|
4189
4271
|
type: top.name,
|
|
4190
|
-
member:
|
|
4272
|
+
member: name3,
|
|
4191
4273
|
at,
|
|
4192
4274
|
modifiers,
|
|
4193
4275
|
access,
|
|
@@ -4205,16 +4287,16 @@ function extensionOverrideEdits(source, extraObjCExtensions) {
|
|
|
4205
4287
|
if (property) {
|
|
4206
4288
|
const open = at + property[0].length - 1;
|
|
4207
4289
|
if (/\b(?:set|willSet|didSet)\b/.test(source.slice(open, closing(open)))) continue;
|
|
4208
|
-
const
|
|
4209
|
-
const nameAt = at + rest.indexOf(
|
|
4290
|
+
const name3 = property[2];
|
|
4291
|
+
const nameAt = at + rest.indexOf(name3, rest.indexOf("var"));
|
|
4210
4292
|
lifted.push({
|
|
4211
4293
|
type: top.name,
|
|
4212
|
-
member:
|
|
4294
|
+
member: name3,
|
|
4213
4295
|
at,
|
|
4214
4296
|
modifiers,
|
|
4215
4297
|
access,
|
|
4216
|
-
decl: `var ${
|
|
4217
|
-
forward: `{ __peach_ext_${
|
|
4298
|
+
decl: `var ${name3}: ${property[3].trim()}`,
|
|
4299
|
+
forward: `{ __peach_ext_${name3} };`,
|
|
4218
4300
|
nameAt,
|
|
4219
4301
|
edits: [
|
|
4220
4302
|
[at, "override".length, " ".repeat("override".length)],
|
|
@@ -4352,15 +4434,15 @@ function objcRootedClasses(sources) {
|
|
|
4352
4434
|
))
|
|
4353
4435
|
bases.set(match[1], match[2]);
|
|
4354
4436
|
const rooted = /* @__PURE__ */ new Set();
|
|
4355
|
-
for (const
|
|
4356
|
-
const seen = /* @__PURE__ */ new Set([
|
|
4357
|
-
let base = bases.get(
|
|
4437
|
+
for (const name3 of bases.keys()) {
|
|
4438
|
+
const seen = /* @__PURE__ */ new Set([name3]);
|
|
4439
|
+
let base = bases.get(name3);
|
|
4358
4440
|
while (bases.has(base) && !seen.has(base)) {
|
|
4359
4441
|
seen.add(base);
|
|
4360
4442
|
base = bases.get(base);
|
|
4361
4443
|
}
|
|
4362
4444
|
if (!bases.has(base) && APPLE_CLASS.test(base) && !APPLE_PROTOCOL.test(base) && !(base in SDK_OBJC_OPTIONAL))
|
|
4363
|
-
rooted.add(
|
|
4445
|
+
rooted.add(name3);
|
|
4364
4446
|
}
|
|
4365
4447
|
return rooted;
|
|
4366
4448
|
}
|
|
@@ -4503,8 +4585,8 @@ function inheritedTypes(sources) {
|
|
|
4503
4585
|
if (colon === -1) continue;
|
|
4504
4586
|
const inherited = parents.get(owner[1]) ?? /* @__PURE__ */ new Set();
|
|
4505
4587
|
for (const type of splitTopLevel(header.slice(colon + 1).split(/\bwhere\b/)[0])) {
|
|
4506
|
-
const
|
|
4507
|
-
if (
|
|
4588
|
+
const name3 = /^\s*(?:[A-Za-z_]\w*\.)*([A-Za-z_]\w*)/.exec(type)?.[1];
|
|
4589
|
+
if (name3 && !type.includes("<")) inherited.add(name3);
|
|
4508
4590
|
}
|
|
4509
4591
|
parents.set(owner[1], inherited);
|
|
4510
4592
|
}
|
|
@@ -4583,20 +4665,20 @@ var DECLARATION_MODIFIERS = /* @__PURE__ */ new Set([
|
|
|
4583
4665
|
"unowned"
|
|
4584
4666
|
]);
|
|
4585
4667
|
function objcSelectorName(base, labels, isAsync, isThrowing) {
|
|
4586
|
-
let
|
|
4668
|
+
let name3 = base;
|
|
4587
4669
|
labels.forEach((label, index) => {
|
|
4588
|
-
if (index > 0)
|
|
4670
|
+
if (index > 0) name3 += `${label === "_" ? "" : label}:`;
|
|
4589
4671
|
else {
|
|
4590
4672
|
if (label !== "_") {
|
|
4591
4673
|
const firstWord = label[0] + /^[^A-Z_]*/.exec(label.slice(1))[0];
|
|
4592
|
-
|
|
4674
|
+
name3 += `${OBJC_PREPOSITIONS.has(firstWord) ? "" : "With"}${label[0].toUpperCase()}${label.slice(1)}`;
|
|
4593
4675
|
}
|
|
4594
|
-
|
|
4676
|
+
name3 += ":";
|
|
4595
4677
|
}
|
|
4596
4678
|
});
|
|
4597
|
-
if (isAsync)
|
|
4598
|
-
else if (isThrowing)
|
|
4599
|
-
return
|
|
4679
|
+
if (isAsync) name3 += labels.length ? "completionHandler:" : "WithCompletionHandler:";
|
|
4680
|
+
else if (isThrowing) name3 += labels.length ? "error:" : "AndReturnError:";
|
|
4681
|
+
return name3;
|
|
4600
4682
|
}
|
|
4601
4683
|
function declarationStart(code, at, floor) {
|
|
4602
4684
|
let start = at;
|
|
@@ -4658,22 +4740,22 @@ function objcOptionalProtocols(source) {
|
|
|
4658
4740
|
...(attributes.match(/@available\s*\((?:[^()"]|"(?:[^"\\]|\\.)*")*\)/g) ?? []).map((attribute) => attribute.replace(/\s*\n\s*/g, " ")),
|
|
4659
4741
|
access ?? ""
|
|
4660
4742
|
].filter((word) => word !== "").join(" ");
|
|
4661
|
-
const
|
|
4743
|
+
const name3 = member[2];
|
|
4662
4744
|
const after = at + member[0].length;
|
|
4663
4745
|
if (member[1] === "var") {
|
|
4664
4746
|
const typed = /^\s*:\s*([^{\n]+?)\s*\{[^}]*\}/.exec(code.slice(after));
|
|
4665
4747
|
if (!typed) continue;
|
|
4666
|
-
const selector2 = explicit ??
|
|
4748
|
+
const selector2 = explicit ?? name3;
|
|
4667
4749
|
const typeMember2 = /\bstatic\b/.test(code.slice(start, at));
|
|
4668
4750
|
members.push({
|
|
4669
|
-
name:
|
|
4751
|
+
name: name3,
|
|
4670
4752
|
labels: null,
|
|
4671
4753
|
selector: selector2,
|
|
4672
4754
|
start,
|
|
4673
4755
|
end: after + typed[0].length,
|
|
4674
4756
|
result: objcTypeName(typed[1]),
|
|
4675
4757
|
typeMember: typeMember2,
|
|
4676
|
-
helper: `${head} ${typeMember2 ? "static " : ""}var ${
|
|
4758
|
+
helper: `${head} ${typeMember2 ? "static " : ""}var ${name3}: ${optionalResult(typed[1])} { _objcOptionalSend(self, Selector(${JSON.stringify(selector2)}), [], default: nil) }`
|
|
4677
4759
|
});
|
|
4678
4760
|
continue;
|
|
4679
4761
|
}
|
|
@@ -4685,10 +4767,10 @@ function objcOptionalProtocols(source) {
|
|
|
4685
4767
|
const parameters = code.slice(paren + 1, shut);
|
|
4686
4768
|
const names = parameterNames(parameters);
|
|
4687
4769
|
const labels = names.map((parameter) => parameter.label);
|
|
4688
|
-
const selector = explicit ?? objcSelectorName(
|
|
4770
|
+
const selector = explicit ?? objcSelectorName(name3, labels, tail[1] !== void 0, tail[2] !== void 0);
|
|
4689
4771
|
const typeMember = /\bstatic\b/.test(code.slice(start, at));
|
|
4690
4772
|
members.push({
|
|
4691
|
-
name:
|
|
4773
|
+
name: name3,
|
|
4692
4774
|
labels,
|
|
4693
4775
|
typeMember,
|
|
4694
4776
|
selector,
|
|
@@ -4697,12 +4779,12 @@ function objcOptionalProtocols(source) {
|
|
|
4697
4779
|
types: parameterTypes(parameters),
|
|
4698
4780
|
result: objcTypeName(tail[3]?.trim() ?? "Void"),
|
|
4699
4781
|
helper: typeMember && (tail[1] !== void 0 || tail[2] !== void 0) ? null : tail[1] !== void 0 ? objcAsyncOptionalHelper(
|
|
4700
|
-
`${head} func ${
|
|
4782
|
+
`${head} func ${name3}(${parameters.replace(/\s*\n\s*/g, " ")})`,
|
|
4701
4783
|
parameters,
|
|
4702
4784
|
selector,
|
|
4703
4785
|
tail[3]?.trim() ?? "Void",
|
|
4704
4786
|
tail[2] !== void 0
|
|
4705
|
-
) : tail[2] !== void 0 ? null : `@discardableResult ${head} ${typeMember ? "static " : ""}func ${
|
|
4787
|
+
) : tail[2] !== void 0 ? null : `@discardableResult ${head} ${typeMember ? "static " : ""}func ${name3}(${parameters.replace(/\s*\n\s*/g, " ")}) -> ${optionalResult(tail[3]?.trim() ?? "Void")} { ${escapingSend(parameters, `_objcOptionalSend(self, Selector(${JSON.stringify(selector)}), [${names.map((parameter) => parameter.name).join(", ")}], default: nil)`)} }`
|
|
4706
4788
|
});
|
|
4707
4789
|
}
|
|
4708
4790
|
if (members.length) found.push({ name: declared[1], close, members });
|
|
@@ -4719,8 +4801,8 @@ function escapingSend(parameters, send, effects = "") {
|
|
|
4719
4801
|
if (!named || !type?.startsWith("(")) return body;
|
|
4720
4802
|
const shut = closingParen(type, 0);
|
|
4721
4803
|
if (!/^\s*(?:async\b\s*)?(?:throws\b\s*)?->/.test(type.slice(shut + 1))) return body;
|
|
4722
|
-
const
|
|
4723
|
-
return `${effects}withoutActuallyEscaping(${
|
|
4804
|
+
const name3 = named[2] ?? named[1];
|
|
4805
|
+
return `${effects}withoutActuallyEscaping(${name3}) { ${name3} in ${body} }`;
|
|
4724
4806
|
}, send);
|
|
4725
4807
|
}
|
|
4726
4808
|
function objcAsyncOptionalHelper(declaration, parameters, selector, result, throwing) {
|
|
@@ -6170,10 +6252,10 @@ function objcTypeMethods(source, found) {
|
|
|
6170
6252
|
function objcIndex(sources) {
|
|
6171
6253
|
const requirements = /* @__PURE__ */ new Map();
|
|
6172
6254
|
const callable = /* @__PURE__ */ new Map();
|
|
6173
|
-
const callableAs = (
|
|
6174
|
-
const known = callable.get(
|
|
6255
|
+
const callableAs = (name3, member, labels) => {
|
|
6256
|
+
const known = callable.get(name3);
|
|
6175
6257
|
if (known) known.labels.push(labels);
|
|
6176
|
-
else callable.set(
|
|
6258
|
+
else callable.set(name3, { member, labels: [labels] });
|
|
6177
6259
|
};
|
|
6178
6260
|
const typeMethods = /* @__PURE__ */ new Map();
|
|
6179
6261
|
const sdkParents = /* @__PURE__ */ new Map();
|
|
@@ -6191,9 +6273,9 @@ function objcIndex(sources) {
|
|
|
6191
6273
|
requirements.set(
|
|
6192
6274
|
protocol,
|
|
6193
6275
|
sdk.requirements.map(([signature, selector, typed, asyncSignature]) => {
|
|
6194
|
-
const
|
|
6195
|
-
const labels = signature.slice(
|
|
6196
|
-
if (sdk.callers) callableAs(
|
|
6276
|
+
const name3 = signature.slice(0, signature.indexOf("("));
|
|
6277
|
+
const labels = signature.slice(name3.length + 1, -1).split(":").slice(0, -1);
|
|
6278
|
+
if (sdk.callers) callableAs(name3, `_objcOptional_${name3}`, labels);
|
|
6197
6279
|
const arrow = typed?.lastIndexOf("->") ?? -1;
|
|
6198
6280
|
const types = typed?.slice(0, arrow);
|
|
6199
6281
|
const result = typed?.slice(arrow + 2);
|
|
@@ -6204,7 +6286,7 @@ function objcIndex(sources) {
|
|
|
6204
6286
|
const values = handler ? splitTopLevel(handler[1]) : [];
|
|
6205
6287
|
const asyncName = asyncSignature?.slice(0, asyncSignature.indexOf("("));
|
|
6206
6288
|
return {
|
|
6207
|
-
name:
|
|
6289
|
+
name: name3,
|
|
6208
6290
|
labels,
|
|
6209
6291
|
selector,
|
|
6210
6292
|
...parameters !== void 0 && { types: parameters },
|
|
@@ -6230,8 +6312,8 @@ function objcIndex(sources) {
|
|
|
6230
6312
|
for (const protocol of objcOptionalProtocols(source)) {
|
|
6231
6313
|
requirements.set(
|
|
6232
6314
|
protocol.name,
|
|
6233
|
-
protocol.members.map(({ name:
|
|
6234
|
-
name:
|
|
6315
|
+
protocol.members.map(({ name: name3, labels, selector, types, result, typeMember }) => ({
|
|
6316
|
+
name: name3,
|
|
6235
6317
|
labels,
|
|
6236
6318
|
selector,
|
|
6237
6319
|
...typeMember && { typeMember },
|
|
@@ -6261,18 +6343,18 @@ function objcIndex(sources) {
|
|
|
6261
6343
|
const code = swiftCodeMask(source);
|
|
6262
6344
|
const braces = [...code.matchAll(/[{}]/g)].map((match) => match.index);
|
|
6263
6345
|
for (const protocol of code.matchAll(/\bprotocol\s+([A-Za-z_]\w*)[^{}]*\{/g)) {
|
|
6264
|
-
const
|
|
6265
|
-
protocols.add(
|
|
6346
|
+
const name3 = protocol[1];
|
|
6347
|
+
protocols.add(name3);
|
|
6266
6348
|
const open = protocol.index + protocol[0].length - 1;
|
|
6267
6349
|
if (/\binit\s*[?!]?\s*\(/.test(code.slice(open + 1, closingBrace(code, braces, open))))
|
|
6268
|
-
initializers.add(
|
|
6350
|
+
initializers.add(name3);
|
|
6269
6351
|
}
|
|
6270
6352
|
}
|
|
6271
6353
|
const rooted = conformingTypes(parents, /* @__PURE__ */ new Set(["NSObject"]));
|
|
6272
6354
|
const initialized = conformingTypes(parents, initializers);
|
|
6273
6355
|
const nsObjectTypes = /* @__PURE__ */ new Set([
|
|
6274
6356
|
"NSObject",
|
|
6275
|
-
...[...protocols].filter((
|
|
6357
|
+
...[...protocols].filter((name3) => rooted.has(name3) && !initialized.has(name3))
|
|
6276
6358
|
]);
|
|
6277
6359
|
return {
|
|
6278
6360
|
requirements,
|
|
@@ -6299,8 +6381,8 @@ function objcAliases(sources) {
|
|
|
6299
6381
|
}
|
|
6300
6382
|
}
|
|
6301
6383
|
const aliases = /* @__PURE__ */ new Map();
|
|
6302
|
-
for (const [
|
|
6303
|
-
for (const [
|
|
6384
|
+
for (const [name3, type] of declared) if (type !== null) aliases.set(name3, type);
|
|
6385
|
+
for (const [name3, type] of aliases) aliases.set(name3, resolveAliases(type, aliases));
|
|
6304
6386
|
return aliases;
|
|
6305
6387
|
}
|
|
6306
6388
|
function resolveAliases(type, aliases) {
|
|
@@ -6308,7 +6390,7 @@ function resolveAliases(type, aliases) {
|
|
|
6308
6390
|
for (let pass = 0; pass < 8 && aliases.size; pass++) {
|
|
6309
6391
|
const next = resolved.replace(
|
|
6310
6392
|
/(?<![\w.])[A-Za-z_]\w*(?![\w.])/g,
|
|
6311
|
-
(
|
|
6393
|
+
(name3) => aliases.get(name3) ?? name3
|
|
6312
6394
|
);
|
|
6313
6395
|
if (next === resolved) break;
|
|
6314
6396
|
resolved = next;
|
|
@@ -6414,17 +6496,17 @@ function lowerObjCOptionalRequirements(source, index) {
|
|
|
6414
6496
|
`; extension ${protocol.name} { ${helpers.join("; ")} }`
|
|
6415
6497
|
]);
|
|
6416
6498
|
}
|
|
6417
|
-
for (const
|
|
6499
|
+
for (const name3 of code.matchAll(
|
|
6418
6500
|
/#selector\(\s*([A-Za-z_]\w*)\.([A-Za-z_]\w*)\(((?:\s*\w+\s*:)+)\s*\)\s*\)/g
|
|
6419
6501
|
)) {
|
|
6420
|
-
const signature = `${
|
|
6421
|
-
const found = SDK_OBJC_OPTIONAL[
|
|
6502
|
+
const signature = `${name3[2]}(${name3[3].replace(/\s+/g, "")})`;
|
|
6503
|
+
const found = SDK_OBJC_OPTIONAL[name3[1]]?.requirements.filter(
|
|
6422
6504
|
([requirement]) => requirement === signature
|
|
6423
6505
|
);
|
|
6424
6506
|
if (found?.length === 1)
|
|
6425
6507
|
edits.push([
|
|
6426
|
-
|
|
6427
|
-
|
|
6508
|
+
name3.index,
|
|
6509
|
+
name3[0].length,
|
|
6428
6510
|
`NSSelectorFromString(${JSON.stringify(found[0][1])})`
|
|
6429
6511
|
]);
|
|
6430
6512
|
}
|
|
@@ -6432,7 +6514,7 @@ function lowerObjCOptionalRequirements(source, index) {
|
|
|
6432
6514
|
const receivesAsProtocol = (dot) => {
|
|
6433
6515
|
const receiver = /([A-Za-z_]\w*)\s*[?!]?\s*$/.exec(code.slice(0, dot))?.[1];
|
|
6434
6516
|
if (!receiver) return false;
|
|
6435
|
-
const
|
|
6517
|
+
const name3 = /^\.\s*([A-Za-z_]\w*)/.exec(code.slice(dot))?.[1];
|
|
6436
6518
|
let innermost;
|
|
6437
6519
|
for (const declared of code.matchAll(
|
|
6438
6520
|
new RegExp(
|
|
@@ -6445,7 +6527,7 @@ function lowerObjCOptionalRequirements(source, index) {
|
|
|
6445
6527
|
if (dot > from && dot < to && (!innermost || from >= innermost.from))
|
|
6446
6528
|
innermost = { from, type: declared[1] };
|
|
6447
6529
|
}
|
|
6448
|
-
return innermost?.type !== void 0 && !!index.requirements.get(resolveAliases(innermost.type, index.aliases))?.some((wanted) => wanted.name ===
|
|
6530
|
+
return innermost?.type !== void 0 && !!index.requirements.get(resolveAliases(innermost.type, index.aliases))?.some((wanted) => wanted.name === name3);
|
|
6449
6531
|
};
|
|
6450
6532
|
for (const call of code.matchAll(/\.\s*([A-Za-z_]\w*)\s*\?(?=\s*[({])/g)) {
|
|
6451
6533
|
const callable = index.callable.get(call[1]);
|
|
@@ -6462,8 +6544,8 @@ function lowerObjCOptionalRequirements(source, index) {
|
|
|
6462
6544
|
continue;
|
|
6463
6545
|
if (callable.member === call[1]) edits.push([mark, 1, " "]);
|
|
6464
6546
|
else {
|
|
6465
|
-
const
|
|
6466
|
-
edits.push([
|
|
6547
|
+
const name3 = call.index + call[0].indexOf(call[1]);
|
|
6548
|
+
edits.push([name3, mark + 1 - name3, callable.member]);
|
|
6467
6549
|
}
|
|
6468
6550
|
}
|
|
6469
6551
|
for (const owner of code.matchAll(
|
|
@@ -6562,8 +6644,8 @@ function lowerObjCRuntimeCalls(source, index) {
|
|
|
6562
6644
|
for (const declared of code.matchAll(
|
|
6563
6645
|
/(?:\b(?:let|var)\s+|[(,]\s*(?:[A-Za-z_]\w*\s+)?)([A-Za-z_]\w*)\s*:\s*(?:(?:any\s+)?([A-Z]\w*(?:\.\w+)*)\s*([?!])?|[[(])|\b(?:let|var|for)\s+([A-Za-z_]\w*)\b(?!\s*:)|[{,]\s*([A-Za-z_]\w*)\s+in\b/g
|
|
6564
6646
|
)) {
|
|
6565
|
-
const
|
|
6566
|
-
const list2 = declarations.get(
|
|
6647
|
+
const name3 = declared[1] ?? declared[4] ?? declared[5];
|
|
6648
|
+
const list2 = declarations.get(name3) ?? [];
|
|
6567
6649
|
let type = declared[3] ? "" : declared[2] ?? "";
|
|
6568
6650
|
if (!type && declared[4]) {
|
|
6569
6651
|
const lookup = /^\s*=\s*NSClassFromString\s*\(/.exec(
|
|
@@ -6578,7 +6660,7 @@ function lowerObjCRuntimeCalls(source, index) {
|
|
|
6578
6660
|
}
|
|
6579
6661
|
const resolved = type.endsWith(".Type") ? `${resolveAliases(type.slice(0, -5), index.aliases)}.Type` : resolveAliases(type, index.aliases);
|
|
6580
6662
|
list2.push({ at: declared.index, type: resolved });
|
|
6581
|
-
declarations.set(
|
|
6663
|
+
declarations.set(name3, list2);
|
|
6582
6664
|
}
|
|
6583
6665
|
for (const pattern of code.matchAll(/\b(?:let|var|for)\s*(?=\(|\.\s*\w+\s*\()/g)) {
|
|
6584
6666
|
const open = code.indexOf("(", pattern.index + pattern[0].length);
|
|
@@ -6591,9 +6673,9 @@ function lowerObjCRuntimeCalls(source, index) {
|
|
|
6591
6673
|
}
|
|
6592
6674
|
for (const list2 of declarations.values()) list2.sort((a, b) => a.at - b.at);
|
|
6593
6675
|
const braces = [...code.matchAll(/[{}]/g)].map((match) => match.index);
|
|
6594
|
-
const receiverType = (
|
|
6676
|
+
const receiverType = (name3, at) => {
|
|
6595
6677
|
let innermost;
|
|
6596
|
-
for (const declared of declarations.get(
|
|
6678
|
+
for (const declared of declarations.get(name3) ?? []) {
|
|
6597
6679
|
if (declared.at > at) break;
|
|
6598
6680
|
const [from, to] = declarationScope(code, braces, declared.at);
|
|
6599
6681
|
if (at > from && at < to && (!innermost || from >= innermost.from))
|
|
@@ -7432,7 +7514,7 @@ var CORE_FOUNDATION_HANDLE_IMPORTS = [
|
|
|
7432
7514
|
"CFSet",
|
|
7433
7515
|
"CFString",
|
|
7434
7516
|
"CFURL"
|
|
7435
|
-
].map((
|
|
7517
|
+
].map((name3) => `import class CoreFoundation.${name3}`).concat([
|
|
7436
7518
|
"import typealias CoreFoundation.CFPropertyList",
|
|
7437
7519
|
"import typealias CoreFoundation.CFTypeRef",
|
|
7438
7520
|
"import CoreGraphics"
|
|
@@ -7626,11 +7708,11 @@ function swiftSourceClosure(files2, roots) {
|
|
|
7626
7708
|
continue;
|
|
7627
7709
|
}
|
|
7628
7710
|
if (depth !== 0 || !match[2]) continue;
|
|
7629
|
-
const
|
|
7711
|
+
const name3 = match[2].split(".").pop();
|
|
7630
7712
|
const index = match[1] === "extension" ? extensions : owners;
|
|
7631
|
-
const set = index.get(
|
|
7713
|
+
const set = index.get(name3) ?? /* @__PURE__ */ new Set();
|
|
7632
7714
|
set.add(file);
|
|
7633
|
-
index.set(
|
|
7715
|
+
index.set(name3, set);
|
|
7634
7716
|
}
|
|
7635
7717
|
sources.set(file, references);
|
|
7636
7718
|
}
|
|
@@ -7638,10 +7720,10 @@ function swiftSourceClosure(files2, roots) {
|
|
|
7638
7720
|
const pending = [...roots];
|
|
7639
7721
|
const seen = /* @__PURE__ */ new Set();
|
|
7640
7722
|
while (pending.length) {
|
|
7641
|
-
const
|
|
7642
|
-
if (seen.has(
|
|
7643
|
-
seen.add(
|
|
7644
|
-
for (const file of [...owners.get(
|
|
7723
|
+
const name3 = pending.pop();
|
|
7724
|
+
if (seen.has(name3)) continue;
|
|
7725
|
+
seen.add(name3);
|
|
7726
|
+
for (const file of [...owners.get(name3) ?? [], ...extensions.get(name3) ?? []]) {
|
|
7645
7727
|
if (included.has(file)) continue;
|
|
7646
7728
|
included.add(file);
|
|
7647
7729
|
for (const reference of sources.get(file)) pending.push(reference);
|
|
@@ -7891,7 +7973,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
7891
7973
|
[
|
|
7892
7974
|
product,
|
|
7893
7975
|
...optionalProducts.map(
|
|
7894
|
-
(
|
|
7976
|
+
(name3) => `.product(name: "${name3}", package: "sootsim-swift"),`
|
|
7895
7977
|
)
|
|
7896
7978
|
].join("\n ")
|
|
7897
7979
|
);
|
|
@@ -8006,7 +8088,7 @@ function builtArtifact(layout) {
|
|
|
8006
8088
|
}
|
|
8007
8089
|
const file = import_node_path6.default.join(binDir, `${executable.name}.wasm`);
|
|
8008
8090
|
if (!(0, import_node_fs5.existsSync)(file)) {
|
|
8009
|
-
const found = (0, import_node_fs5.existsSync)(binDir) ? (0, import_node_fs5.readdirSync)(binDir).filter((
|
|
8091
|
+
const found = (0, import_node_fs5.existsSync)(binDir) ? (0, import_node_fs5.readdirSync)(binDir).filter((name3) => name3.endsWith(".wasm")).sort() : [];
|
|
8010
8092
|
throw new Error(
|
|
8011
8093
|
`swift-compile: the build produced no ${executable.name}.wasm (found: ${found.join(", ") || "none"})`
|
|
8012
8094
|
);
|
|
@@ -8186,7 +8268,7 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
8186
8268
|
}
|
|
8187
8269
|
return withSwiftRootLock(
|
|
8188
8270
|
root,
|
|
8189
|
-
async () => {
|
|
8271
|
+
async (lease) => {
|
|
8190
8272
|
const built2 = readCompiledArtifact(import_node_path6.default.join(sharedRoot, "artifact"), hash);
|
|
8191
8273
|
if (built2) {
|
|
8192
8274
|
report("reusing verified disk artifact");
|
|
@@ -8249,7 +8331,8 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
8249
8331
|
},
|
|
8250
8332
|
maxBuffer: 64 * 1024 * 1024,
|
|
8251
8333
|
timeout: options.timeoutMs,
|
|
8252
|
-
signal: options.signal
|
|
8334
|
+
signal: options.signal,
|
|
8335
|
+
lease
|
|
8253
8336
|
};
|
|
8254
8337
|
report("compiling and linking Swift modules");
|
|
8255
8338
|
try {
|
|
@@ -8366,8 +8449,8 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
8366
8449
|
const kind = text2(entry.kind) ?? "file-reference";
|
|
8367
8450
|
const raw2 = text2(entry.path) ?? "";
|
|
8368
8451
|
const located = raw2 === "" ? null : locate(raw2, parent.dir);
|
|
8369
|
-
const
|
|
8370
|
-
const node = { id: "", name:
|
|
8452
|
+
const name3 = text2(entry.name) ?? import_node_path7.default.basename(raw2);
|
|
8453
|
+
const node = { id: "", name: name3, dir: null, parent, children: [] };
|
|
8371
8454
|
if (kind === "group" || kind === "variant-group" || kind === "version-group") {
|
|
8372
8455
|
node.dir = raw2 === "" ? parent.dir : located?.sourceTree === "<absolute>" ? located.path : null;
|
|
8373
8456
|
const childIds = walk2(items(entry.children), node);
|
|
@@ -8380,7 +8463,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
8380
8463
|
isa: kind === "variant-group" ? "PBXVariantGroup" : "PBXGroup",
|
|
8381
8464
|
children: childIds,
|
|
8382
8465
|
...kind === "variant-group" ? {} : { sourceTree: "<absolute>", path: node.dir ?? "" },
|
|
8383
|
-
name:
|
|
8466
|
+
name: name3
|
|
8384
8467
|
},
|
|
8385
8468
|
text2(entry.id)
|
|
8386
8469
|
);
|
|
@@ -8398,7 +8481,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
8398
8481
|
{
|
|
8399
8482
|
isa: "PBXFileReference",
|
|
8400
8483
|
...located ?? { sourceTree: "SDKROOT", path: raw2 },
|
|
8401
|
-
name:
|
|
8484
|
+
name: name3
|
|
8402
8485
|
},
|
|
8403
8486
|
text2(entry.id)
|
|
8404
8487
|
);
|
|
@@ -8450,8 +8533,8 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
8450
8533
|
return node;
|
|
8451
8534
|
};
|
|
8452
8535
|
const configurations = items(json.configurations).flatMap((entry) => {
|
|
8453
|
-
const
|
|
8454
|
-
return
|
|
8536
|
+
const name3 = isObject(entry) ? text2(entry.name) : text2(entry);
|
|
8537
|
+
return name3 ? [{ name: name3, file: isObject(entry) ? entry.file : void 0 }] : [];
|
|
8455
8538
|
});
|
|
8456
8539
|
const settingsOf = (value) => Object.fromEntries(
|
|
8457
8540
|
Object.entries(isObject(value) ? value : {}).flatMap(
|
|
@@ -8466,11 +8549,11 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
8466
8549
|
const configurationList = (settings, specialized) => add({
|
|
8467
8550
|
isa: "XCConfigurationList",
|
|
8468
8551
|
defaultConfigurationName: text2(json["default-configuration"]) ?? "Debug",
|
|
8469
|
-
buildConfigurations: configurations.map(({ name:
|
|
8470
|
-
const base = lookup(specialized.has(
|
|
8552
|
+
buildConfigurations: configurations.map(({ name: name3, file }) => {
|
|
8553
|
+
const base = lookup(specialized.has(name3) ? specialized.get(name3) : file);
|
|
8471
8554
|
return add({
|
|
8472
8555
|
isa: "XCBuildConfiguration",
|
|
8473
|
-
name:
|
|
8556
|
+
name: name3,
|
|
8474
8557
|
buildSettings: settings,
|
|
8475
8558
|
...base ? { baseConfigurationReference: base } : {}
|
|
8476
8559
|
});
|
|
@@ -8481,9 +8564,9 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
8481
8564
|
if (!isObject(entry)) continue;
|
|
8482
8565
|
const repository = text2(entry.repository);
|
|
8483
8566
|
const local = text2(entry.path);
|
|
8484
|
-
const
|
|
8567
|
+
const name3 = local !== void 0 ? import_node_path7.default.basename(import_node_path7.default.resolve(import_node_path7.default.dirname(xcodeproj), local)) : import_node_path7.default.basename(repository ?? "").replace(/\.git$/, "");
|
|
8485
8568
|
const id = text2(entry.kind) === "local" && local !== void 0 ? add({ isa: "XCLocalSwiftPackageReference", relativePath: local }) : add({ isa: "XCRemoteSwiftPackageReference", repositoryURL: repository ?? "" });
|
|
8486
|
-
packageIds.set(
|
|
8569
|
+
packageIds.set(name3.toLowerCase(), id);
|
|
8487
8570
|
}
|
|
8488
8571
|
const productDependency = (entry) => add({
|
|
8489
8572
|
isa: "XCSwiftPackageProductDependency",
|
|
@@ -8503,12 +8586,12 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
8503
8586
|
const targets = [];
|
|
8504
8587
|
for (const entry of items(json.targets)) {
|
|
8505
8588
|
if (!isObject(entry)) continue;
|
|
8506
|
-
const
|
|
8589
|
+
const name3 = text2(entry.name) ?? "";
|
|
8507
8590
|
const productType = text2(entry["product-type"]);
|
|
8508
8591
|
const target = {
|
|
8509
8592
|
isa: text2(entry.kind) === "aggregate" ? "PBXAggregateTarget" : "PBXNativeTarget",
|
|
8510
|
-
name:
|
|
8511
|
-
productName:
|
|
8593
|
+
name: name3,
|
|
8594
|
+
productName: name3,
|
|
8512
8595
|
productType: productType ? `com.apple.product-type.${productType}` : text2(entry["full-product-type"]) ?? "",
|
|
8513
8596
|
buildPhases: [],
|
|
8514
8597
|
dependencies: [],
|
|
@@ -8518,7 +8601,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
8518
8601
|
const product = lookup(entry.product);
|
|
8519
8602
|
if (product) target.productReference = product;
|
|
8520
8603
|
const id = add(target, text2(entry.id));
|
|
8521
|
-
targetIds.set(
|
|
8604
|
+
targetIds.set(name3, id);
|
|
8522
8605
|
targets.push({ id, target, entry });
|
|
8523
8606
|
for (const phase of items(entry["build-phases"])) {
|
|
8524
8607
|
const kind = isObject(phase) ? text2(phase.kind) : text2(phase);
|
|
@@ -8530,7 +8613,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
8530
8613
|
isObject(phase) ? text2(phase.id) : void 0
|
|
8531
8614
|
);
|
|
8532
8615
|
target.buildPhases.push(phaseId);
|
|
8533
|
-
phases.set([
|
|
8616
|
+
phases.set([name3, kind, phaseName].filter(Boolean).join("/"), phaseId);
|
|
8534
8617
|
phases.set(`id:${phaseId}`, phaseId);
|
|
8535
8618
|
}
|
|
8536
8619
|
}
|
|
@@ -8546,7 +8629,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
8546
8629
|
files2?.push(add({ isa: "PBXBuildFile", fileRef: refId }));
|
|
8547
8630
|
}
|
|
8548
8631
|
for (const { target, entry } of targets) {
|
|
8549
|
-
const
|
|
8632
|
+
const name3 = text2(entry.name) ?? "";
|
|
8550
8633
|
target.buildConfigurationList = configurationList(
|
|
8551
8634
|
settingsOf(entry["build-settings"]),
|
|
8552
8635
|
new Map(
|
|
@@ -8584,7 +8667,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
8584
8667
|
const dependency = productDependency(member);
|
|
8585
8668
|
target.packageProductDependencies.push(dependency);
|
|
8586
8669
|
const buildFile = member["build-phase"];
|
|
8587
|
-
phaseFiles(isObject(buildFile) ? buildFile["build-phase"] : buildFile,
|
|
8670
|
+
phaseFiles(isObject(buildFile) ? buildFile["build-phase"] : buildFile, name3)?.push(
|
|
8588
8671
|
add({ isa: "PBXBuildFile", productRef: dependency })
|
|
8589
8672
|
);
|
|
8590
8673
|
}
|
|
@@ -8886,8 +8969,8 @@ function applyConditions(raw2, configuration) {
|
|
|
8886
8969
|
continue;
|
|
8887
8970
|
}
|
|
8888
8971
|
const matches = [...key2.slice(bracket).matchAll(/\[([^=\]]+)=([^\]]*)\]/g)].every(
|
|
8889
|
-
([,
|
|
8890
|
-
const actual =
|
|
8972
|
+
([, name3, pattern]) => {
|
|
8973
|
+
const actual = name3 === "config" ? configuration : CONDITIONS[name3];
|
|
8891
8974
|
return actual !== void 0 && new RegExp(
|
|
8892
8975
|
`^${pattern.replace(/[.+^${}()|\\]/g, "\\$&").replaceAll("*", ".*").replaceAll("?", ".")}$`
|
|
8893
8976
|
).test(actual);
|
|
@@ -8947,9 +9030,9 @@ function workspaceReferences(workspace) {
|
|
|
8947
9030
|
function enclosingXcodeWorkspace(xcodeproj) {
|
|
8948
9031
|
const project = import_node_fs6.default.realpathSync(xcodeproj);
|
|
8949
9032
|
for (let dir = import_node_path8.default.dirname(project); ; dir = import_node_path8.default.dirname(dir)) {
|
|
8950
|
-
for (const
|
|
8951
|
-
if (!
|
|
8952
|
-
const workspace = import_node_path8.default.join(dir,
|
|
9033
|
+
for (const name3 of import_node_fs6.default.readdirSync(dir).sort()) {
|
|
9034
|
+
if (!name3.endsWith(".xcworkspace")) continue;
|
|
9035
|
+
const workspace = import_node_path8.default.join(dir, name3);
|
|
8953
9036
|
if (!import_node_fs6.default.existsSync(import_node_path8.default.join(workspace, "contents.xcworkspacedata"))) continue;
|
|
8954
9037
|
if (workspaceReferences(workspace).some(
|
|
8955
9038
|
(reference) => import_node_fs6.default.existsSync(reference) && import_node_fs6.default.realpathSync(reference) === project
|
|
@@ -8967,7 +9050,7 @@ function findXcodeProject(input) {
|
|
|
8967
9050
|
if (resolved.endsWith(".xcodeproj")) return resolved;
|
|
8968
9051
|
if (!isDirectory(resolved)) return null;
|
|
8969
9052
|
for (const extension of [".xcworkspace", ".xcodeproj"]) {
|
|
8970
|
-
const found = import_node_fs6.default.readdirSync(resolved).filter((
|
|
9053
|
+
const found = import_node_fs6.default.readdirSync(resolved).filter((name3) => name3.endsWith(extension)).sort();
|
|
8971
9054
|
if (found.length > 1) {
|
|
8972
9055
|
throw new Error(
|
|
8973
9056
|
`${resolved} holds ${found.length} ${extension} bundles (${found.join(", ")}); pass one`
|
|
@@ -8979,8 +9062,8 @@ function findXcodeProject(input) {
|
|
|
8979
9062
|
}
|
|
8980
9063
|
var loaded = /* @__PURE__ */ new Map();
|
|
8981
9064
|
function xcodeProjectFile(xcodeproj) {
|
|
8982
|
-
for (const
|
|
8983
|
-
const file = import_node_path8.default.join(xcodeproj,
|
|
9065
|
+
for (const name3 of ["project.pbxproj", "project.xcproj"]) {
|
|
9066
|
+
const file = import_node_path8.default.join(xcodeproj, name3);
|
|
8984
9067
|
if (import_node_fs6.default.existsSync(file)) return file;
|
|
8985
9068
|
}
|
|
8986
9069
|
return null;
|
|
@@ -9037,7 +9120,7 @@ function targetSettings(ref, configuration, builtins, options = {}) {
|
|
|
9037
9120
|
const configs = list(configList?.buildConfigurations).map(project.object);
|
|
9038
9121
|
const config = configs.find((entry) => entry?.name === configuration) ?? configs.find((entry) => entry?.name === str(configList?.defaultConfigurationName));
|
|
9039
9122
|
if (!config) return [];
|
|
9040
|
-
const
|
|
9123
|
+
const name3 = str(config.name) ?? configuration;
|
|
9041
9124
|
const base = str(config.baseConfigurationReference);
|
|
9042
9125
|
const anchor = str(config.baseConfigurationReferenceAnchor);
|
|
9043
9126
|
const relative = str(config.baseConfigurationReferenceRelativePath);
|
|
@@ -9052,14 +9135,14 @@ function targetSettings(ref, configuration, builtins, options = {}) {
|
|
|
9052
9135
|
const fromFile = baseFile ? readXcconfig(baseFile, read) : {};
|
|
9053
9136
|
xcconfigs.push(...read);
|
|
9054
9137
|
return [
|
|
9055
|
-
applyConditions(fromFile,
|
|
9138
|
+
applyConditions(fromFile, name3),
|
|
9056
9139
|
applyConditions(
|
|
9057
9140
|
Object.fromEntries(
|
|
9058
9141
|
Object.entries(own).flatMap(
|
|
9059
9142
|
([key2, value]) => typeof value === "string" ? [[key2, value]] : Array.isArray(value) ? [[key2, list(value).join(" ")]] : []
|
|
9060
9143
|
)
|
|
9061
9144
|
),
|
|
9062
|
-
|
|
9145
|
+
name3
|
|
9063
9146
|
)
|
|
9064
9147
|
];
|
|
9065
9148
|
};
|
|
@@ -9079,13 +9162,13 @@ function targetSettings(ref, configuration, builtins, options = {}) {
|
|
|
9079
9162
|
resolving.add(marker);
|
|
9080
9163
|
const value = expand(
|
|
9081
9164
|
levels[at][key2],
|
|
9082
|
-
(
|
|
9165
|
+
(name3) => name3 === "inherited" ? valueAt(key2, at - 1) : valueAt(name3, levels.length - 1)
|
|
9083
9166
|
);
|
|
9084
9167
|
resolving.delete(marker);
|
|
9085
9168
|
return value;
|
|
9086
9169
|
};
|
|
9087
9170
|
const derived = (key2) => {
|
|
9088
|
-
const get = (
|
|
9171
|
+
const get = (name3) => valueAt(name3, levels.length - 1);
|
|
9089
9172
|
switch (key2) {
|
|
9090
9173
|
case "PRODUCT_NAME":
|
|
9091
9174
|
return get("TARGET_NAME");
|
|
@@ -9093,6 +9176,9 @@ function targetSettings(ref, configuration, builtins, options = {}) {
|
|
|
9093
9176
|
return applyOperator(get("PRODUCT_NAME"), "c99extidentifier");
|
|
9094
9177
|
case "EXECUTABLE_NAME":
|
|
9095
9178
|
return get("PRODUCT_NAME");
|
|
9179
|
+
// the native default of CoreBuildSystem.xcspec
|
|
9180
|
+
case "EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES":
|
|
9181
|
+
return "*.nib *.lproj *.framework *.gch *.xcode* *.xcassets *.icon (*) .DS_Store CVS .svn .git .hg *.pbproj *.pbxproj";
|
|
9096
9182
|
case "AppIdentifierPrefix":
|
|
9097
9183
|
case "TeamIdentifierPrefix": {
|
|
9098
9184
|
const team = get("DEVELOPMENT_TEAM");
|
|
@@ -9115,6 +9201,45 @@ function settingList(value) {
|
|
|
9115
9201
|
items2.push((quoted ?? plain).replace(/\\(.)/g, "$1"));
|
|
9116
9202
|
return items2;
|
|
9117
9203
|
}
|
|
9204
|
+
function expandSearchPath(directory, rules) {
|
|
9205
|
+
if (import_node_path8.default.basename(directory) !== "**") return [directory];
|
|
9206
|
+
const expanded = [];
|
|
9207
|
+
const seen = /* @__PURE__ */ new Set();
|
|
9208
|
+
const queue = [import_node_path8.default.dirname(directory)];
|
|
9209
|
+
for (let at = 0; at < queue.length; at++) {
|
|
9210
|
+
const current = queue[at];
|
|
9211
|
+
let real;
|
|
9212
|
+
try {
|
|
9213
|
+
real = import_node_fs6.default.realpathSync(current);
|
|
9214
|
+
} catch {
|
|
9215
|
+
continue;
|
|
9216
|
+
}
|
|
9217
|
+
if (!import_node_fs6.default.statSync(real).isDirectory() || seen.has(real)) continue;
|
|
9218
|
+
seen.add(real);
|
|
9219
|
+
expanded.push(current);
|
|
9220
|
+
for (const entry of import_node_fs6.default.readdirSync(real, { withFileTypes: true }).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0)) {
|
|
9221
|
+
if (entry.isSymbolicLink() ? !rules.followLinks : !entry.isDirectory()) continue;
|
|
9222
|
+
if (rules.excluded.some((pattern) => pattern.test(entry.name)) && !rules.included.some((pattern) => pattern.test(entry.name)))
|
|
9223
|
+
continue;
|
|
9224
|
+
queue.push(import_node_path8.default.join(current, entry.name));
|
|
9225
|
+
}
|
|
9226
|
+
}
|
|
9227
|
+
return expanded;
|
|
9228
|
+
}
|
|
9229
|
+
function recursiveSearchRules(settings) {
|
|
9230
|
+
const glob = (pattern) => new RegExp(
|
|
9231
|
+
`^${pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replaceAll("*", ".*").replaceAll("?", ".")}$`
|
|
9232
|
+
);
|
|
9233
|
+
return {
|
|
9234
|
+
excluded: settingList(settings("EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES")).map(
|
|
9235
|
+
glob
|
|
9236
|
+
),
|
|
9237
|
+
included: settingList(settings("INCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES")).map(
|
|
9238
|
+
glob
|
|
9239
|
+
),
|
|
9240
|
+
followLinks: settings("RECURSIVE_SEARCH_PATHS_FOLLOW_SYMLINKS") !== "NO"
|
|
9241
|
+
};
|
|
9242
|
+
}
|
|
9118
9243
|
function compilationConditions(settings) {
|
|
9119
9244
|
const flags = settingList(settings("OTHER_SWIFT_FLAGS"));
|
|
9120
9245
|
const defined = flags.flatMap(
|
|
@@ -9131,9 +9256,9 @@ function expand(value, lookup) {
|
|
|
9131
9256
|
return value.replace(
|
|
9132
9257
|
/\$(?:\(([A-Za-z_][A-Za-z0-9_]*)((?::[^)]*)?)\)|\{([A-Za-z_][A-Za-z0-9_]*)((?::[^}]*)?)\}|([A-Za-z_][A-Za-z0-9_]*))/g,
|
|
9133
9258
|
(_match, paren, parenOps, brace, braceOps, bare) => {
|
|
9134
|
-
const
|
|
9259
|
+
const name3 = paren ?? brace ?? bare;
|
|
9135
9260
|
const operators = parenOps ?? braceOps ?? "";
|
|
9136
|
-
return operators.split(":").slice(1).reduce((current, operator) => applyOperator(current, operator), lookup(
|
|
9261
|
+
return operators.split(":").slice(1).reduce((current, operator) => applyOperator(current, operator), lookup(name3));
|
|
9137
9262
|
}
|
|
9138
9263
|
);
|
|
9139
9264
|
}
|
|
@@ -9363,8 +9488,8 @@ function isIosAppTarget(ref, options = {}) {
|
|
|
9363
9488
|
const sdk = get("SDKROOT");
|
|
9364
9489
|
return sdk === "auto" ? settingList(get("SUPPORTED_PLATFORMS")).some(isIosPlatform) : sdk === "" || isIosPlatform(sdk);
|
|
9365
9490
|
}
|
|
9366
|
-
function isIosPlatform(
|
|
9367
|
-
return
|
|
9491
|
+
function isIosPlatform(name3) {
|
|
9492
|
+
return name3.startsWith("iphoneos") || name3.startsWith("iphonesimulator");
|
|
9368
9493
|
}
|
|
9369
9494
|
function listXcodeAppTargets(xcodeprojOrWorkspace, options = {}) {
|
|
9370
9495
|
return workspaceProjects(xcodeprojOrWorkspace).projects.flatMap(nativeTargets).filter((ref) => isIosAppTarget(ref, options)).map((ref) => str(ref.target.name) ?? ref.id);
|
|
@@ -9437,7 +9562,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
9437
9562
|
visit(app);
|
|
9438
9563
|
const xcconfigs = /* @__PURE__ */ new Set();
|
|
9439
9564
|
const moduleTarget = (ref) => {
|
|
9440
|
-
const
|
|
9565
|
+
const name3 = str(ref.target.name) ?? ref.id;
|
|
9441
9566
|
const {
|
|
9442
9567
|
get: settings2,
|
|
9443
9568
|
keys,
|
|
@@ -9446,7 +9571,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
9446
9571
|
ref,
|
|
9447
9572
|
configuration,
|
|
9448
9573
|
{
|
|
9449
|
-
TARGET_NAME:
|
|
9574
|
+
TARGET_NAME: name3,
|
|
9450
9575
|
PROJECT_NAME: import_node_path8.default.basename(ref.project.xcodeproj, ".xcodeproj"),
|
|
9451
9576
|
SRCROOT: ref.project.projectDir,
|
|
9452
9577
|
SOURCE_ROOT: ref.project.projectDir,
|
|
@@ -9477,6 +9602,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
9477
9602
|
for (const file of read) xcconfigs.add(file);
|
|
9478
9603
|
const swiftVersion = Number.parseFloat(settings2("SWIFT_VERSION") || "5");
|
|
9479
9604
|
const members = targetMembers(ref, settings2, options, keys, xcconfigs);
|
|
9605
|
+
const searchRules = recursiveSearchRules(settings2);
|
|
9480
9606
|
const implementations = members.allSources.filter(
|
|
9481
9607
|
(file) => /\.(c|cc|cpp|cxx|m|mm)$/.test(file)
|
|
9482
9608
|
);
|
|
@@ -9501,7 +9627,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
9501
9627
|
settings: settings2,
|
|
9502
9628
|
keys,
|
|
9503
9629
|
module: {
|
|
9504
|
-
name:
|
|
9630
|
+
name: name3,
|
|
9505
9631
|
moduleName: applyOperator(settings2("PRODUCT_MODULE_NAME"), "c99extidentifier"),
|
|
9506
9632
|
...members,
|
|
9507
9633
|
languageMode: swiftVersion >= 6 ? 6 : 5,
|
|
@@ -9519,10 +9645,10 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
9519
9645
|
headerSearchPaths: [
|
|
9520
9646
|
...settingList(settings2("HEADER_SEARCH_PATHS")),
|
|
9521
9647
|
...settingList(settings2("USER_HEADER_SEARCH_PATHS"))
|
|
9522
|
-
].
|
|
9523
|
-
frameworkSearchPaths: settingList(
|
|
9524
|
-
|
|
9525
|
-
),
|
|
9648
|
+
].flatMap((raw2) => expandSearchPath(absolute(raw2), searchRules)),
|
|
9649
|
+
frameworkSearchPaths: settingList(
|
|
9650
|
+
settings2("FRAMEWORK_SEARCH_PATHS")
|
|
9651
|
+
).flatMap((raw2) => expandSearchPath(absolute(raw2), searchRules)),
|
|
9526
9652
|
flags: [
|
|
9527
9653
|
...settings2("CLANG_ENABLE_OBJC_ARC") === "YES" ? ["-fobjc-arc"] : [],
|
|
9528
9654
|
...settings2("CLANG_ENABLE_OBJC_WEAK") === "YES" ? ["-fobjc-weak"] : [],
|
|
@@ -9644,12 +9770,12 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
9644
9770
|
const fileId = str(project.object(buildFileId)?.fileRef);
|
|
9645
9771
|
const file = project.object(fileId);
|
|
9646
9772
|
const tree = str(file?.sourceTree);
|
|
9647
|
-
const
|
|
9648
|
-
if (file?.isa !== "PBXFileReference" || !
|
|
9773
|
+
const name3 = /([^/]+)\.(xc)?framework$/.exec(str(file?.path) ?? "")?.[1];
|
|
9774
|
+
if (file?.isa !== "PBXFileReference" || !name3) continue;
|
|
9649
9775
|
if (tree === "BUILT_PRODUCTS_DIR" || tree === "SDKROOT" || tree === "DEVELOPER_DIR")
|
|
9650
9776
|
continue;
|
|
9651
9777
|
const resolved = fileId ? project.resolvePath(fileId) : null;
|
|
9652
|
-
if (!binaryFrameworks.get(
|
|
9778
|
+
if (!binaryFrameworks.get(name3)) binaryFrameworks.set(name3, resolved);
|
|
9653
9779
|
}
|
|
9654
9780
|
}
|
|
9655
9781
|
}
|
|
@@ -9684,7 +9810,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
9684
9810
|
localPackageDirs: [
|
|
9685
9811
|
...new Set(localPackageDirs.map((dir) => import_node_fs6.default.realpathSync(dir)))
|
|
9686
9812
|
].sort(),
|
|
9687
|
-
binaryFrameworks: [...binaryFrameworks].map(([
|
|
9813
|
+
binaryFrameworks: [...binaryFrameworks].map(([name3, file]) => ({ name: name3, path: file })).sort((left, right) => left.name.localeCompare(right.name)),
|
|
9688
9814
|
packageResolved,
|
|
9689
9815
|
appTargets: appTargetNames,
|
|
9690
9816
|
configuration,
|
|
@@ -9953,7 +10079,7 @@ function collectBridgeModuleSources(appRoot, signal) {
|
|
|
9953
10079
|
const own = (file) => {
|
|
9954
10080
|
const resolved = import_node_fs7.default.realpathSync(file);
|
|
9955
10081
|
if ([file, resolved].some(
|
|
9956
|
-
(
|
|
10082
|
+
(name3) => name3.split(import_node_path9.default.sep).some((part) => part === "Pods" || part === "node_modules")
|
|
9957
10083
|
))
|
|
9958
10084
|
return false;
|
|
9959
10085
|
const relative = import_node_path9.default.relative(projectRoot, resolved);
|
|
@@ -9972,7 +10098,7 @@ function collectBridgeModuleSources(appRoot, signal) {
|
|
|
9972
10098
|
];
|
|
9973
10099
|
if (objc.length === 0) continue;
|
|
9974
10100
|
const headers = [...new Set(objc.map((file) => import_node_path9.default.dirname(file)))].flatMap(
|
|
9975
|
-
(dir) => import_node_fs7.default.readdirSync(dir).filter((
|
|
10101
|
+
(dir) => import_node_fs7.default.readdirSync(dir).filter((name3) => name3.endsWith(".h")).sort().map((name3) => import_node_path9.default.join(dir, name3)).filter(own)
|
|
9976
10102
|
);
|
|
9977
10103
|
const declarations = parseObjectiveCModules(
|
|
9978
10104
|
[...objc, ...headers].map((file) => ({
|
|
@@ -10108,7 +10234,7 @@ async function swiftBinaryModules(binary) {
|
|
|
10108
10234
|
);
|
|
10109
10235
|
if (import_node_fs8.default.existsSync(cached2)) {
|
|
10110
10236
|
const value = JSON.parse(import_node_fs8.default.readFileSync(cached2, "utf8"));
|
|
10111
|
-
if (Array.isArray(value) && value.every((
|
|
10237
|
+
if (Array.isArray(value) && value.every((name3) => typeof name3 === "string"))
|
|
10112
10238
|
return value;
|
|
10113
10239
|
}
|
|
10114
10240
|
const modules = frameworkModules(await zipEntries(binary.url));
|
|
@@ -10727,10 +10853,10 @@ function enumerateBundleImages(paths, readText, bundleForFile = () => ".") {
|
|
|
10727
10853
|
};
|
|
10728
10854
|
const catalogs = paths.filter((path21) => baseOf(path21) === "Contents.json");
|
|
10729
10855
|
for (const contentsPath of catalogs) {
|
|
10730
|
-
const
|
|
10731
|
-
if (
|
|
10856
|
+
const name3 = catalogEntryName(contentsPath, ".imageset", readText);
|
|
10857
|
+
if (name3 === null) continue;
|
|
10732
10858
|
const { bundlePath, names } = namesFor(contentsPath);
|
|
10733
|
-
if (names.has(
|
|
10859
|
+
if (names.has(name3)) continue;
|
|
10734
10860
|
let parsed;
|
|
10735
10861
|
try {
|
|
10736
10862
|
const text4 = readText(contentsPath);
|
|
@@ -10744,10 +10870,10 @@ function enumerateBundleImages(paths, readText, bundleForFile = () => ".") {
|
|
|
10744
10870
|
const dir = contentsPath.split("/").slice(0, -1).join("/");
|
|
10745
10871
|
const variants = imagesetFiles(images);
|
|
10746
10872
|
if (variants.length === 0) continue;
|
|
10747
|
-
names.add(
|
|
10873
|
+
names.add(name3);
|
|
10748
10874
|
for (const variant of variants)
|
|
10749
10875
|
table.push({
|
|
10750
|
-
name:
|
|
10876
|
+
name: name3,
|
|
10751
10877
|
file: `${dir}/${variant.filename}`,
|
|
10752
10878
|
scale: variant.scale,
|
|
10753
10879
|
bundlePath
|
|
@@ -10755,11 +10881,11 @@ function enumerateBundleImages(paths, readText, bundleForFile = () => ".") {
|
|
|
10755
10881
|
}
|
|
10756
10882
|
for (const path21 of paths) {
|
|
10757
10883
|
if (!isFlatResourceImage(path21)) continue;
|
|
10758
|
-
const
|
|
10884
|
+
const name3 = baseOf(path21).slice(0, -extOf(path21).length);
|
|
10759
10885
|
const { bundlePath, names } = namesFor(path21);
|
|
10760
|
-
if (
|
|
10761
|
-
names.add(
|
|
10762
|
-
table.push({ name:
|
|
10886
|
+
if (name3 === "" || names.has(name3)) continue;
|
|
10887
|
+
names.add(name3);
|
|
10888
|
+
table.push({ name: name3, file: path21, scale: flatScale(path21), bundlePath });
|
|
10763
10889
|
}
|
|
10764
10890
|
return table;
|
|
10765
10891
|
}
|
|
@@ -10789,8 +10915,8 @@ function colorsetValue(color) {
|
|
|
10789
10915
|
function enumerateBundleColors(paths, readText) {
|
|
10790
10916
|
const table = {};
|
|
10791
10917
|
for (const contentsPath of paths.filter((path21) => baseOf(path21) === "Contents.json")) {
|
|
10792
|
-
const
|
|
10793
|
-
if (
|
|
10918
|
+
const name3 = catalogEntryName(contentsPath, ".colorset", readText);
|
|
10919
|
+
if (name3 === null || name3 in table) continue;
|
|
10794
10920
|
let colors;
|
|
10795
10921
|
try {
|
|
10796
10922
|
const text4 = readText(contentsPath);
|
|
@@ -10819,8 +10945,8 @@ function enumerateBundleColors(paths, readText) {
|
|
|
10819
10945
|
else light = value;
|
|
10820
10946
|
}
|
|
10821
10947
|
if (light === null) continue;
|
|
10822
|
-
if (typeof light === "object") table[
|
|
10823
|
-
else table[
|
|
10948
|
+
if (typeof light === "object") table[name3] = light;
|
|
10949
|
+
else table[name3] = { light, dark: typeof dark === "string" ? dark : light };
|
|
10824
10950
|
}
|
|
10825
10951
|
return table;
|
|
10826
10952
|
}
|
|
@@ -10882,10 +11008,10 @@ function guide(svg, id, axis) {
|
|
|
10882
11008
|
function enumerateBundleSymbols(paths, readText, bundleForFile) {
|
|
10883
11009
|
const table = {};
|
|
10884
11010
|
for (const contentsPath of paths.filter((path21) => baseOf(path21) === "Contents.json")) {
|
|
10885
|
-
const
|
|
10886
|
-
if (
|
|
11011
|
+
const name3 = catalogEntryName(contentsPath, ".symbolset", readText);
|
|
11012
|
+
if (name3 === null) continue;
|
|
10887
11013
|
const bundle = bundleForFile(contentsPath);
|
|
10888
|
-
const key2 = bundle === "." ?
|
|
11014
|
+
const key2 = bundle === "." ? name3 : `${bundle}/${name3}`;
|
|
10889
11015
|
if (Object.hasOwn(table, key2)) continue;
|
|
10890
11016
|
let symbols;
|
|
10891
11017
|
try {
|
|
@@ -10926,7 +11052,7 @@ function enumerateBundleSymbols(paths, readText, bundleForFile) {
|
|
|
10926
11052
|
}
|
|
10927
11053
|
var COMPILED_EXTENSIONS = /* @__PURE__ */ new Set([".swift", ".metal", ".storyboard", ".xib"]);
|
|
10928
11054
|
function isCopiedResource(path21) {
|
|
10929
|
-
if (path21.split("/").some((segment) =>
|
|
11055
|
+
if (path21.split("/").some((segment) => /\.(atlasc|bundle)$/.test(segment))) return true;
|
|
10930
11056
|
const ext = extOf(path21);
|
|
10931
11057
|
if (ext === ".json" || ext === ".xcstrings") return true;
|
|
10932
11058
|
return !RASTER_EXTENSIONS.has(ext) && !COMPILED_EXTENSIONS.has(ext) && !path21.split("/").some((segment) => segment.endsWith(".xcassets"));
|
|
@@ -10943,9 +11069,7 @@ function enumerateBundleResources(paths) {
|
|
|
10943
11069
|
});
|
|
10944
11070
|
for (const file of ordered) {
|
|
10945
11071
|
const parts = file.split("/");
|
|
10946
|
-
const nested = parts.findIndex(
|
|
10947
|
-
(part) => part.endsWith(".atlasc") || part.endsWith(".lproj")
|
|
10948
|
-
);
|
|
11072
|
+
const nested = parts.findIndex((part) => /\.(atlasc|lproj|bundle)$/.test(part));
|
|
10949
11073
|
const base = nested < 0 ? baseOf(file) : parts.slice(nested).join("/");
|
|
10950
11074
|
if (seen.has(base)) continue;
|
|
10951
11075
|
seen.add(base);
|
|
@@ -11004,7 +11128,7 @@ function plural(node, specifier) {
|
|
|
11004
11128
|
const forms = dictionary();
|
|
11005
11129
|
forms.NSStringFormatSpecTypeKey = "NSStringPluralRuleType";
|
|
11006
11130
|
forms.NSStringFormatValueTypeKey = specifier;
|
|
11007
|
-
for (const [
|
|
11131
|
+
for (const [name3, value] of Object.entries(object(node))) forms[name3] = unit(value);
|
|
11008
11132
|
return forms;
|
|
11009
11133
|
}
|
|
11010
11134
|
function resolve(node, key2) {
|
|
@@ -11012,7 +11136,7 @@ function resolve(node, key2) {
|
|
|
11012
11136
|
if (value.substitutions !== void 0) {
|
|
11013
11137
|
let format = unit(value);
|
|
11014
11138
|
const rules = dictionary();
|
|
11015
|
-
for (const [
|
|
11139
|
+
for (const [name3, raw2] of Object.entries(object(value.substitutions))) {
|
|
11016
11140
|
const sub = object(raw2), specifier = typeof sub.formatSpecifier === "string" ? sub.formatSpecifier : "";
|
|
11017
11141
|
const forms = plural(object(sub.variations).plural, specifier);
|
|
11018
11142
|
for (const [category, text4] of Object.entries(forms)) {
|
|
@@ -11025,10 +11149,10 @@ function resolve(node, key2) {
|
|
|
11025
11149
|
}
|
|
11026
11150
|
if (typeof sub.argNum === "number")
|
|
11027
11151
|
format = format.replaceAll(
|
|
11028
|
-
"%#@" +
|
|
11029
|
-
"%" + sub.argNum + "$#@" +
|
|
11152
|
+
"%#@" + name3 + "@",
|
|
11153
|
+
"%" + sub.argNum + "$#@" + name3 + "@"
|
|
11030
11154
|
);
|
|
11031
|
-
rules[
|
|
11155
|
+
rules[name3] = forms;
|
|
11032
11156
|
}
|
|
11033
11157
|
return { rules: { NSStringLocalizedFormatKey: format, ...rules } };
|
|
11034
11158
|
}
|
|
@@ -11043,9 +11167,9 @@ function resolve(node, key2) {
|
|
|
11043
11167
|
const specifier = numeric.specifier;
|
|
11044
11168
|
const forms = plural(sourceForms, specifier);
|
|
11045
11169
|
if (argument > 0) {
|
|
11046
|
-
for (const [
|
|
11047
|
-
if (!
|
|
11048
|
-
forms[
|
|
11170
|
+
for (const [name3, text4] of Object.entries(forms))
|
|
11171
|
+
if (!name3.startsWith("NSString") && typeof text4 === "string")
|
|
11172
|
+
forms[name3] = positioned(text4);
|
|
11049
11173
|
}
|
|
11050
11174
|
return {
|
|
11051
11175
|
rules: {
|
|
@@ -11069,8 +11193,8 @@ function resolve(node, key2) {
|
|
|
11069
11193
|
}
|
|
11070
11194
|
throw Error("unsupported string catalog variation for " + key2);
|
|
11071
11195
|
}
|
|
11072
|
-
function compileCatalogTables(source,
|
|
11073
|
-
if (!isSwiftResourcePath(
|
|
11196
|
+
function compileCatalogTables(source, name3) {
|
|
11197
|
+
if (!isSwiftResourcePath(name3) || name3.includes("/"))
|
|
11074
11198
|
throw Error("invalid string catalog table name");
|
|
11075
11199
|
const root = object(JSON.parse(source)), strings = object(root.strings);
|
|
11076
11200
|
const output = {};
|
|
@@ -11093,21 +11217,21 @@ function compileCatalogTables(source, name2) {
|
|
|
11093
11217
|
const localizations = entry.localizations === void 0 ? {} : object(entry.localizations);
|
|
11094
11218
|
if (entry.extractionState === "manual") {
|
|
11095
11219
|
if (!Object.hasOwn(localizations, sourceLanguage))
|
|
11096
|
-
(output[sourceLanguage + ".lproj/" +
|
|
11220
|
+
(output[sourceLanguage + ".lproj/" + name3 + ".strings"] ??= dictionary())[key2] = key2;
|
|
11097
11221
|
const source2 = !Object.hasOwn(localizations, sourceLanguage) ? void 0 : object(localizations[sourceLanguage]);
|
|
11098
11222
|
const variations = source2?.variations === void 0 ? void 0 : object(source2.variations);
|
|
11099
11223
|
if (variations?.plural !== void 0) {
|
|
11100
11224
|
for (const language of languages)
|
|
11101
11225
|
if (!Object.hasOwn(localizations, language))
|
|
11102
|
-
(output[language + ".lproj/" +
|
|
11226
|
+
(output[language + ".lproj/" + name3 + ".strings"] ??= dictionary())[key2] = key2;
|
|
11103
11227
|
}
|
|
11104
11228
|
}
|
|
11105
11229
|
for (const [language, node] of Object.entries(localizations)) {
|
|
11106
11230
|
const resolved = resolve(node, key2);
|
|
11107
11231
|
if (resolved.text !== void 0)
|
|
11108
|
-
(output[language + ".lproj/" +
|
|
11232
|
+
(output[language + ".lproj/" + name3 + ".strings"] ??= dictionary())[key2] = resolved.text;
|
|
11109
11233
|
if (resolved.rules !== void 0)
|
|
11110
|
-
(output[language + ".lproj/" +
|
|
11234
|
+
(output[language + ".lproj/" + name3 + ".stringsdict"] ??= dictionary())[key2] = resolved.rules;
|
|
11111
11235
|
}
|
|
11112
11236
|
}
|
|
11113
11237
|
return output;
|
|
@@ -11117,9 +11241,9 @@ function plist2(value) {
|
|
|
11117
11241
|
if (typeof value === "string") return "<string>" + escaped(value) + "</string>";
|
|
11118
11242
|
return "<dict>" + Object.entries(value).map(([key2, item]) => "<key>" + escaped(key2) + "</key>" + plist2(item)).join("") + "</dict>";
|
|
11119
11243
|
}
|
|
11120
|
-
function compileStringCatalog(source,
|
|
11244
|
+
function compileStringCatalog(source, name3) {
|
|
11121
11245
|
return Object.fromEntries(
|
|
11122
|
-
Object.entries(compileCatalogTables(source,
|
|
11246
|
+
Object.entries(compileCatalogTables(source, name3)).map(([path21, table]) => [
|
|
11123
11247
|
path21,
|
|
11124
11248
|
'<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0">' + plist2(table) + "</plist>"
|
|
11125
11249
|
])
|
|
@@ -11131,9 +11255,9 @@ var import_node_fs11 = require("node:fs");
|
|
|
11131
11255
|
var import_node_path13 = require("node:path");
|
|
11132
11256
|
|
|
11133
11257
|
// src/public-brand.ts
|
|
11134
|
-
var
|
|
11258
|
+
var name2 = "Peach";
|
|
11135
11259
|
var peachPublicBrand = Object.freeze({
|
|
11136
|
-
name,
|
|
11260
|
+
name: name2,
|
|
11137
11261
|
packageName: "peachsim",
|
|
11138
11262
|
commandName: "peach",
|
|
11139
11263
|
domain: "peachsim.com",
|
|
@@ -13415,15 +13539,15 @@ function materializeObjcSdk(cacheDir5) {
|
|
|
13415
13539
|
var headerFiles = (dir) => import_node_fs12.default.readdirSync(dir, { recursive: true, encoding: "utf8" }).filter((file) => file.endsWith(".h")).sort();
|
|
13416
13540
|
function missingHeader(missing) {
|
|
13417
13541
|
const lines = ["#import <Foundation/Foundation.h>", "#import <UIKit/UIKit.h>"];
|
|
13418
|
-
for (const [
|
|
13419
|
-
for (const [
|
|
13420
|
-
if (kind === "protocol") lines.push(`@protocol ${
|
|
13542
|
+
for (const [name3, kind] of missing) if (kind === "macro") lines.push(`#define ${name3}`);
|
|
13543
|
+
for (const [name3, kind] of missing)
|
|
13544
|
+
if (kind === "protocol") lines.push(`@protocol ${name3} <NSObject>
|
|
13421
13545
|
@end`);
|
|
13422
|
-
for (const [
|
|
13423
|
-
if (kind === "class") lines.push(`@interface ${
|
|
13546
|
+
for (const [name3, kind] of missing)
|
|
13547
|
+
if (kind === "class") lines.push(`@interface ${name3} : NSObject
|
|
13424
13548
|
@end`);
|
|
13425
|
-
for (const [
|
|
13426
|
-
if (kind === "struct") lines.push(`typedef struct ${
|
|
13549
|
+
for (const [name3, kind] of missing)
|
|
13550
|
+
if (kind === "struct") lines.push(`typedef struct ${name3} { char opaque; } ${name3};`);
|
|
13427
13551
|
return `${lines.join("\n")}
|
|
13428
13552
|
`;
|
|
13429
13553
|
}
|
|
@@ -13516,11 +13640,11 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work) {
|
|
|
13516
13640
|
stubbed.add(include2);
|
|
13517
13641
|
const slash = include2.indexOf("/");
|
|
13518
13642
|
if (slash > 0 && /^[A-Z]/.test(include2)) {
|
|
13519
|
-
const
|
|
13520
|
-
const umbrella = `${
|
|
13643
|
+
const name3 = include2.slice(0, slash);
|
|
13644
|
+
const umbrella = `${name3}/${name3}.h`;
|
|
13521
13645
|
if (Object.hasOwn(
|
|
13522
13646
|
IOS_SDK_HEADERS,
|
|
13523
|
-
`System/Library/Frameworks/${
|
|
13647
|
+
`System/Library/Frameworks/${name3}.framework/Headers/${name3}.h`
|
|
13524
13648
|
)) {
|
|
13525
13649
|
const header2 = import_node_path14.default.join(stubIncludes, include2);
|
|
13526
13650
|
import_node_fs12.default.mkdirSync(import_node_path14.default.dirname(header2), { recursive: true });
|
|
@@ -13528,7 +13652,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work) {
|
|
|
13528
13652
|
`);
|
|
13529
13653
|
return true;
|
|
13530
13654
|
}
|
|
13531
|
-
const root = import_node_path14.default.join(stubs, `${
|
|
13655
|
+
const root = import_node_path14.default.join(stubs, `${name3}.framework`);
|
|
13532
13656
|
const header = import_node_path14.default.join(root, "Headers", include2.slice(slash + 1));
|
|
13533
13657
|
import_node_fs12.default.mkdirSync(import_node_path14.default.dirname(header), { recursive: true });
|
|
13534
13658
|
import_node_fs12.default.writeFileSync(
|
|
@@ -13538,7 +13662,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work) {
|
|
|
13538
13662
|
import_node_fs12.default.mkdirSync(import_node_path14.default.join(root, "Modules"), { recursive: true });
|
|
13539
13663
|
import_node_fs12.default.writeFileSync(
|
|
13540
13664
|
import_node_path14.default.join(root, "Modules", "module.modulemap"),
|
|
13541
|
-
`framework module ${
|
|
13665
|
+
`framework module ${name3} {
|
|
13542
13666
|
umbrella "Headers"
|
|
13543
13667
|
export *
|
|
13544
13668
|
module * { export * }
|
|
@@ -13568,10 +13692,10 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work) {
|
|
|
13568
13692
|
const text4 = import_node_fs12.default.existsSync(file) ? import_node_fs12.default.readFileSync(file, "utf8").split("\n")[line - 1] : void 0;
|
|
13569
13693
|
if (text4 === void 0) return null;
|
|
13570
13694
|
const rest = text4.slice(column - 1);
|
|
13571
|
-
const
|
|
13572
|
-
return
|
|
13695
|
+
const name3 = /^[A-Za-z_]\w*/.exec(rest)?.[0];
|
|
13696
|
+
return name3 ? { name: name3, after: rest.slice(name3.length) } : null;
|
|
13573
13697
|
};
|
|
13574
|
-
const typeKind = (
|
|
13698
|
+
const typeKind = (name3, after) => /^[A-Z][A-Z0-9_]+$/.test(name3) && !/^\s*\*/.test(after) ? "macro" : /^\s*\*/.test(after) ? "class" : "struct";
|
|
13575
13699
|
for (let round = 0; ; round++) {
|
|
13576
13700
|
import_node_fs12.default.rmSync(out, { recursive: true, force: true });
|
|
13577
13701
|
import_node_fs12.default.mkdirSync(out, { recursive: true });
|
|
@@ -13600,9 +13724,9 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work) {
|
|
|
13600
13724
|
];
|
|
13601
13725
|
if (errors.length === 0 && run3.status === 0) break;
|
|
13602
13726
|
let progress = false;
|
|
13603
|
-
const learn = (
|
|
13604
|
-
if (missing.has(
|
|
13605
|
-
missing.set(
|
|
13727
|
+
const learn = (name3, kind) => {
|
|
13728
|
+
if (missing.has(name3)) return;
|
|
13729
|
+
missing.set(name3, kind);
|
|
13606
13730
|
progress = true;
|
|
13607
13731
|
};
|
|
13608
13732
|
for (const [, file, line, column, message] of errors) {
|
|
@@ -13631,8 +13755,8 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work) {
|
|
|
13631
13755
|
const unknown = /^unknown type name '(\w+)'$/.exec(message);
|
|
13632
13756
|
if ((unknown || message === "expected a type") && file && line && column) {
|
|
13633
13757
|
const token = tokenAt(file, Number(line), Number(column));
|
|
13634
|
-
const
|
|
13635
|
-
if (
|
|
13758
|
+
const name3 = unknown?.[1] ?? token?.name;
|
|
13759
|
+
if (name3) learn(name3, typeKind(name3, token?.name === name3 ? token.after : ""));
|
|
13636
13760
|
}
|
|
13637
13761
|
}
|
|
13638
13762
|
if (!progress || round === ROUNDS)
|
|
@@ -13641,7 +13765,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work) {
|
|
|
13641
13765
|
);
|
|
13642
13766
|
if (missing.size > 0) declareMissing();
|
|
13643
13767
|
}
|
|
13644
|
-
const graphs = import_node_fs12.default.readdirSync(out).filter((
|
|
13768
|
+
const graphs = import_node_fs12.default.readdirSync(out).filter((name3) => name3.endsWith(".symbols.json")).sort().map((name3) => JSON.parse(import_node_fs12.default.readFileSync(import_node_path14.default.join(out, name3), "utf8")));
|
|
13645
13769
|
const imports = /* @__PURE__ */ new Set(["Foundation", "UIKit"]);
|
|
13646
13770
|
for (const text4 of originals.values())
|
|
13647
13771
|
for (const match of text4.matchAll(
|
|
@@ -13733,8 +13857,8 @@ function enumValues(graphs, surface, framework, toolchainBin, search, work) {
|
|
|
13733
13857
|
walk2(inner);
|
|
13734
13858
|
};
|
|
13735
13859
|
walk2(JSON.parse(run3.stdout));
|
|
13736
|
-
for (const [id,
|
|
13737
|
-
const value = constants.get(
|
|
13860
|
+
for (const [id, name3] of wanted) {
|
|
13861
|
+
const value = constants.get(name3);
|
|
13738
13862
|
if (value !== void 0) values.set(id, value.toString());
|
|
13739
13863
|
}
|
|
13740
13864
|
return values;
|
|
@@ -13912,7 +14036,7 @@ function compileObjcPeerMetadata(args) {
|
|
|
13912
14036
|
const emitted = [...symbols.stdout.matchAll(/^\._OBJC_CLASS_(\w+) [^U] /gm)].map(
|
|
13913
14037
|
(match) => match[1]
|
|
13914
14038
|
);
|
|
13915
|
-
if (emitted.length !== names.size || !emitted.every((
|
|
14039
|
+
if (emitted.length !== names.size || !emitted.every((name3) => names.has(name3)) || /^\._OBJC_CLASS_\w+ U(?: |$)/m.test(symbols.stdout) || /^_[ic]_\w+/m.test(symbols.stdout))
|
|
13916
14040
|
throw new ObjcPeerMetadataError(
|
|
13917
14041
|
`Objective-C peer metadata contains unexpected classes or methods: ${receipt}`,
|
|
13918
14042
|
files2,
|
|
@@ -13945,10 +14069,10 @@ function swiftCommand() {
|
|
|
13945
14069
|
var cacheDir3 = import_node_path16.default.join(cacheDir(), "swift-manifests");
|
|
13946
14070
|
var evaluated = /* @__PURE__ */ new Map();
|
|
13947
14071
|
function dump(dir) {
|
|
13948
|
-
const manifests = import_node_fs14.default.readdirSync(dir).filter((
|
|
14072
|
+
const manifests = import_node_fs14.default.readdirSync(dir).filter((name3) => /^Package(@swift-[\d.]+)?\.swift$/.test(name3)).sort();
|
|
13949
14073
|
const command = swiftCommand();
|
|
13950
14074
|
const key2 = (0, import_node_crypto10.createHash)("sha256").update(JSON.stringify([command, import_node_path16.default.resolve(dir)])).update(
|
|
13951
|
-
manifests.map((
|
|
14075
|
+
manifests.map((name3) => `${name3}\0${import_node_fs14.default.readFileSync(import_node_path16.default.join(dir, name3), "utf8")}`).join("\0")
|
|
13952
14076
|
).digest("hex").slice(0, 32);
|
|
13953
14077
|
const cached2 = import_node_path16.default.join(cacheDir3, `${key2}.json`);
|
|
13954
14078
|
if (import_node_fs14.default.existsSync(cached2))
|
|
@@ -13989,16 +14113,16 @@ function defaultTraits(manifest) {
|
|
|
13989
14113
|
const traits = new Map(
|
|
13990
14114
|
array(manifest.traits).map((trait) => [
|
|
13991
14115
|
string(record(trait).name) ?? "",
|
|
13992
|
-
array(record(trait).enabledTraits).flatMap((
|
|
14116
|
+
array(record(trait).enabledTraits).flatMap((name3) => string(name3) ?? [])
|
|
13993
14117
|
])
|
|
13994
14118
|
);
|
|
13995
14119
|
const enabled = /* @__PURE__ */ new Set();
|
|
13996
14120
|
const pending = [...traits.get("default") ?? []];
|
|
13997
14121
|
while (pending.length > 0) {
|
|
13998
|
-
const
|
|
13999
|
-
if (enabled.has(
|
|
14000
|
-
enabled.add(
|
|
14001
|
-
pending.push(...traits.get(
|
|
14122
|
+
const name3 = pending.pop();
|
|
14123
|
+
if (enabled.has(name3)) continue;
|
|
14124
|
+
enabled.add(name3);
|
|
14125
|
+
pending.push(...traits.get(name3) ?? []);
|
|
14002
14126
|
}
|
|
14003
14127
|
return enabled;
|
|
14004
14128
|
}
|
|
@@ -14007,7 +14131,7 @@ function linksOnIOS(condition, traits) {
|
|
|
14007
14131
|
const platforms = array(platformNames);
|
|
14008
14132
|
if (platforms.length > 0 && !platforms.includes("ios")) return false;
|
|
14009
14133
|
const gates = array(needed);
|
|
14010
|
-
return gates.length === 0 || gates.some((
|
|
14134
|
+
return gates.length === 0 || gates.some((name3) => traits.has(string(name3) ?? ""));
|
|
14011
14135
|
}
|
|
14012
14136
|
function swiftPackageManifest(dir) {
|
|
14013
14137
|
dir = import_node_fs14.default.realpathSync(dir);
|
|
@@ -14042,10 +14166,10 @@ function swiftPackageManifest(dir) {
|
|
|
14042
14166
|
}
|
|
14043
14167
|
const products = /* @__PURE__ */ new Map();
|
|
14044
14168
|
for (const product of array(raw2.products)) {
|
|
14045
|
-
const { name:
|
|
14046
|
-
if (!string(
|
|
14169
|
+
const { name: name4, targets: targets2, type } = record(product);
|
|
14170
|
+
if (!string(name4) || !("library" in record(type))) continue;
|
|
14047
14171
|
products.set(
|
|
14048
|
-
string(
|
|
14172
|
+
string(name4),
|
|
14049
14173
|
array(targets2).flatMap((target) => string(target) ?? [])
|
|
14050
14174
|
);
|
|
14051
14175
|
}
|
|
@@ -14053,12 +14177,12 @@ function swiftPackageManifest(dir) {
|
|
|
14053
14177
|
const names = new Set(array(raw2.targets).map((target) => string(record(target).name)));
|
|
14054
14178
|
for (const entry of array(raw2.targets)) {
|
|
14055
14179
|
const target = record(entry);
|
|
14056
|
-
const
|
|
14180
|
+
const name4 = string(target.name);
|
|
14057
14181
|
const kind = string(target.type);
|
|
14058
|
-
if (!
|
|
14182
|
+
if (!name4 || !isTargetType(kind)) continue;
|
|
14059
14183
|
const declared = string(target.path);
|
|
14060
14184
|
const roots = kind === "test" ? ["Tests"] : ["Sources", "Source", "src", "srcs"];
|
|
14061
|
-
const targetDir = declared ? import_node_path16.default.resolve(dir, declared) : roots.map((root) => import_node_path16.default.join(dir, root,
|
|
14185
|
+
const targetDir = declared ? import_node_path16.default.resolve(dir, declared) : roots.map((root) => import_node_path16.default.join(dir, root, name4)).find((candidate) => import_node_fs14.default.existsSync(candidate)) ?? import_node_path16.default.join(dir, roots[0], name4);
|
|
14062
14186
|
const dependencies = [];
|
|
14063
14187
|
for (const dependency of array(target.dependencies)) {
|
|
14064
14188
|
const { target: local, product, byName } = record(dependency);
|
|
@@ -14106,7 +14230,7 @@ function swiftPackageManifest(dir) {
|
|
|
14106
14230
|
const flags = header ? ["-I", import_node_path16.default.resolve(targetDir, header)] : definition ? [`-D${definition}${value === void 0 ? "" : `=${value}`}`] : disabledWarning !== void 0 ? [`-Wno-${disabledWarning}`] : Array.isArray(unsafe) ? unsafe.flatMap((flag) => string(flag) ?? []) : null;
|
|
14107
14231
|
if (!flags)
|
|
14108
14232
|
throw new Error(
|
|
14109
|
-
`${
|
|
14233
|
+
`${name4}: unsupported ${tool} compiler setting ${JSON.stringify(rawKind)}`
|
|
14110
14234
|
);
|
|
14111
14235
|
nativeSettings.push({
|
|
14112
14236
|
tool,
|
|
@@ -14136,8 +14260,8 @@ function swiftPackageManifest(dir) {
|
|
|
14136
14260
|
});
|
|
14137
14261
|
}
|
|
14138
14262
|
}
|
|
14139
|
-
targets.set(
|
|
14140
|
-
name:
|
|
14263
|
+
targets.set(name4, {
|
|
14264
|
+
name: name4,
|
|
14141
14265
|
type: kind,
|
|
14142
14266
|
dir: targetDir,
|
|
14143
14267
|
sources: target.sources == null ? null : array(target.sources).flatMap((file) => string(file) ?? []),
|
|
@@ -14154,9 +14278,9 @@ function swiftPackageManifest(dir) {
|
|
|
14154
14278
|
checksum: string(target.checksum) ?? null
|
|
14155
14279
|
});
|
|
14156
14280
|
}
|
|
14157
|
-
const
|
|
14158
|
-
if (!
|
|
14159
|
-
const manifest = { name:
|
|
14281
|
+
const name3 = string(raw2.name);
|
|
14282
|
+
if (!name3) throw new Error(`swiftpm returned no package name for ${dir}`);
|
|
14283
|
+
const manifest = { name: name3, dir, products, targets, packages };
|
|
14160
14284
|
evaluated.set(key2, manifest);
|
|
14161
14285
|
return manifest;
|
|
14162
14286
|
}
|
|
@@ -14288,18 +14412,18 @@ function resolveSwiftPackages(options) {
|
|
|
14288
14412
|
};
|
|
14289
14413
|
const targets = /* @__PURE__ */ new Map();
|
|
14290
14414
|
const targetOutcomes = /* @__PURE__ */ new Map();
|
|
14291
|
-
const resolveTarget = (pkg,
|
|
14292
|
-
const key2 = `${pkg.manifest.dir}\0${
|
|
14415
|
+
const resolveTarget = (pkg, name3) => {
|
|
14416
|
+
const key2 = `${pkg.manifest.dir}\0${name3}`;
|
|
14293
14417
|
if (targetOutcomes.has(key2)) return targetOutcomes.get(key2);
|
|
14294
14418
|
targetOutcomes.set(key2, []);
|
|
14295
14419
|
const outcome = (() => {
|
|
14296
|
-
if (provided.has(
|
|
14297
|
-
const target = pkg.manifest.targets.get(
|
|
14420
|
+
if (provided.has(name3)) return [];
|
|
14421
|
+
const target = pkg.manifest.targets.get(name3);
|
|
14298
14422
|
if (!target)
|
|
14299
|
-
return [`${import_node_path17.default.basename(pkg.manifest.dir)} declares no target ${
|
|
14423
|
+
return [`${import_node_path17.default.basename(pkg.manifest.dir)} declares no target ${name3}`];
|
|
14300
14424
|
const files2 = target.type === "regular" || target.type === "system" ? swiftTargetFiles(pkg.manifest, target) : [];
|
|
14301
|
-
const gap = options.binaryGaps?.get(
|
|
14302
|
-
const ownReason = target.type === "binary" ? `${
|
|
14425
|
+
const gap = options.binaryGaps?.get(name3);
|
|
14426
|
+
const ownReason = target.type === "binary" ? `${name3} ${BINARY}${gap ? `; ${gap}` : ""}` : target.type !== "regular" && target.type !== "system" ? `${name3} is a ${target.type} target` : files2.some((file) => UNSUPPORTED_NATIVE.test(file)) ? `${name3} is an Objective-C or assembly target${gap ? `; ${gap}` : ""}` : null;
|
|
14303
14427
|
const reasons = target.dependencies.map((dependency) => {
|
|
14304
14428
|
if (dependency.kind === "target") return resolveTarget(pkg, dependency.name);
|
|
14305
14429
|
const nested = resolveDependencyProduct(pkg, dependency.package, dependency.name);
|
|
@@ -14308,8 +14432,8 @@ function resolveSwiftPackages(options) {
|
|
|
14308
14432
|
const blocked = blockers([ownReason ? [ownReason] : [], ...reasons]);
|
|
14309
14433
|
if (blocked.length > 0) return blocked;
|
|
14310
14434
|
const relative = files2.map((file) => import_node_path17.default.relative(target.dir, file));
|
|
14311
|
-
targets.set(`${pkg.manifest.dir}\0${
|
|
14312
|
-
name:
|
|
14435
|
+
targets.set(`${pkg.manifest.dir}\0${name3}`, {
|
|
14436
|
+
name: name3,
|
|
14313
14437
|
path: "",
|
|
14314
14438
|
dir: target.dir,
|
|
14315
14439
|
files: files2,
|
|
@@ -14323,9 +14447,9 @@ function resolveSwiftPackages(options) {
|
|
|
14323
14447
|
const source = pkg.manifest.packages.get(dependency.package);
|
|
14324
14448
|
const nested = source && packages.get("dir" in source ? import_node_path17.default.resolve(source.dir) : source.url);
|
|
14325
14449
|
return nested && typeof nested !== "string" ? (nested.manifest.products.get(dependency.name) ?? []).map(
|
|
14326
|
-
(
|
|
14450
|
+
(name4) => ({
|
|
14327
14451
|
kind: "target",
|
|
14328
|
-
name:
|
|
14452
|
+
name: name4
|
|
14329
14453
|
})
|
|
14330
14454
|
) : [];
|
|
14331
14455
|
}),
|
|
@@ -14344,7 +14468,7 @@ function resolveSwiftPackages(options) {
|
|
|
14344
14468
|
const resolveProduct = (pkg, product) => {
|
|
14345
14469
|
if (provided.has(product)) return [];
|
|
14346
14470
|
const roots = pkg.manifest.products.get(product);
|
|
14347
|
-
const reason = !roots ? [`${import_node_path17.default.basename(pkg.manifest.dir)} has no library ${product}`] : blockers(roots.map((
|
|
14471
|
+
const reason = !roots ? [`${import_node_path17.default.basename(pkg.manifest.dir)} has no library ${product}`] : blockers(roots.map((name3) => resolveTarget(pkg, name3)));
|
|
14348
14472
|
productOutcomes.set(`${pkg.manifest.dir}\0${product}`, { pkg, reason });
|
|
14349
14473
|
return reason;
|
|
14350
14474
|
};
|
|
@@ -14375,14 +14499,14 @@ function resolveSwiftPackages(options) {
|
|
|
14375
14499
|
}
|
|
14376
14500
|
for (const pkg of packages.values()) {
|
|
14377
14501
|
if (typeof pkg === "string") continue;
|
|
14378
|
-
for (const [
|
|
14502
|
+
for (const [name3, target] of pkg.manifest.targets) {
|
|
14379
14503
|
if (target.type === "test" || target.type === "plugin" || target.type === "macro")
|
|
14380
14504
|
continue;
|
|
14381
14505
|
if (target.type === "executable") continue;
|
|
14382
14506
|
const objc = target.type === "regular" && swiftTargetFiles(pkg.manifest, target).some((file) => /\.(m|mm)$/.test(file));
|
|
14383
14507
|
if (target.type === "binary" || objc)
|
|
14384
14508
|
result.binaries.push({
|
|
14385
|
-
target:
|
|
14509
|
+
target: name3,
|
|
14386
14510
|
source: pkg.source,
|
|
14387
14511
|
url: target.url,
|
|
14388
14512
|
checksum: target.checksum,
|
|
@@ -14395,9 +14519,9 @@ function resolveSwiftPackages(options) {
|
|
|
14395
14519
|
)
|
|
14396
14520
|
} : {}
|
|
14397
14521
|
});
|
|
14398
|
-
const reason = resolveTarget(pkg,
|
|
14399
|
-
if (reason.length > 0 && !result.modules.has(
|
|
14400
|
-
result.modules.set(
|
|
14522
|
+
const reason = resolveTarget(pkg, name3);
|
|
14523
|
+
if (reason.length > 0 && !result.modules.has(name3))
|
|
14524
|
+
result.modules.set(name3, { source: pkg.source, reason: reason.join("; ") });
|
|
14401
14525
|
}
|
|
14402
14526
|
}
|
|
14403
14527
|
for (const [key2, { pkg, reason }] of productOutcomes) {
|
|
@@ -14406,11 +14530,11 @@ function resolveSwiftPackages(options) {
|
|
|
14406
14530
|
result.modules.set(product, { source: pkg.source, reason: reason.join("; ") });
|
|
14407
14531
|
}
|
|
14408
14532
|
const reached = /* @__PURE__ */ new Set();
|
|
14409
|
-
const reach = (pkg,
|
|
14410
|
-
const key2 = `${pkg.manifest.dir}\0${
|
|
14533
|
+
const reach = (pkg, name3) => {
|
|
14534
|
+
const key2 = `${pkg.manifest.dir}\0${name3}`;
|
|
14411
14535
|
if (reached.has(key2)) return;
|
|
14412
14536
|
reached.add(key2);
|
|
14413
|
-
for (const dependency of pkg.manifest.targets.get(
|
|
14537
|
+
for (const dependency of pkg.manifest.targets.get(name3)?.dependencies ?? []) {
|
|
14414
14538
|
if (dependency.kind === "target") reach(pkg, dependency.name);
|
|
14415
14539
|
else {
|
|
14416
14540
|
const source = pkg.manifest.packages.get(dependency.package);
|
|
@@ -14437,11 +14561,11 @@ function resolveSwiftPackages(options) {
|
|
|
14437
14561
|
if (!pkg || typeof pkg === "string") continue;
|
|
14438
14562
|
const headers = /* @__PURE__ */ new Map();
|
|
14439
14563
|
const visited = /* @__PURE__ */ new Set();
|
|
14440
|
-
const visit = (owner,
|
|
14441
|
-
const key2 = `${owner.manifest.dir}\0${
|
|
14564
|
+
const visit = (owner, name3) => {
|
|
14565
|
+
const key2 = `${owner.manifest.dir}\0${name3}`;
|
|
14442
14566
|
if (visited.has(key2)) return;
|
|
14443
14567
|
visited.add(key2);
|
|
14444
|
-
const target = owner.manifest.targets.get(
|
|
14568
|
+
const target = owner.manifest.targets.get(name3);
|
|
14445
14569
|
if (!target) return;
|
|
14446
14570
|
const dir = import_node_path17.default.join(target.dir, target.publicHeadersPath);
|
|
14447
14571
|
for (const dependency of target.dependencies) {
|
|
@@ -14454,8 +14578,8 @@ function resolveSwiftPackages(options) {
|
|
|
14454
14578
|
visit(nested, root);
|
|
14455
14579
|
}
|
|
14456
14580
|
}
|
|
14457
|
-
if (
|
|
14458
|
-
headers.set(
|
|
14581
|
+
if (name3 !== binary.target && import_node_fs15.default.existsSync(dir))
|
|
14582
|
+
headers.set(name3, import_node_path17.default.relative(binary.dir, dir));
|
|
14459
14583
|
};
|
|
14460
14584
|
visit(pkg, binary.target);
|
|
14461
14585
|
binary.headerDependencies = [...headers].map(([module2, path21]) => ({ module: module2, path: path21 }));
|
|
@@ -14518,6 +14642,15 @@ function compileXcodeObjCImplementations(app, binaries, moduleRoot) {
|
|
|
14518
14642
|
`Objective-C implementations compiled, but linking their original method bodies requires the canonical Swift framework object bridge. No implementation was replaced. Inputs and objects: ${prepared.receipt}`
|
|
14519
14643
|
);
|
|
14520
14644
|
}
|
|
14645
|
+
function linkedStat(file) {
|
|
14646
|
+
try {
|
|
14647
|
+
return import_node_fs17.default.statSync(file);
|
|
14648
|
+
} catch (error) {
|
|
14649
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") return null;
|
|
14650
|
+
throw error;
|
|
14651
|
+
}
|
|
14652
|
+
}
|
|
14653
|
+
var isSdkInclude = (file) => file === "/usr/include" || file.startsWith("/usr/include/");
|
|
14521
14654
|
function prepareXcodeObjCImplementations(app, binaries, moduleRoot, peers) {
|
|
14522
14655
|
if (peers) validateObjcPeerClasses(peers);
|
|
14523
14656
|
const toolchain = swiftModuleToolchain(moduleRoot);
|
|
@@ -14538,13 +14671,22 @@ function prepareXcodeObjCImplementations(app, binaries, moduleRoot, peers) {
|
|
|
14538
14671
|
)
|
|
14539
14672
|
);
|
|
14540
14673
|
};
|
|
14674
|
+
const walked = /* @__PURE__ */ new Set();
|
|
14675
|
+
const ancestors = /* @__PURE__ */ new Set();
|
|
14541
14676
|
const addHeaders = (directory) => {
|
|
14677
|
+
const real = import_node_fs17.default.realpathSync(directory);
|
|
14678
|
+
if (walked.has(directory) || ancestors.has(real)) return;
|
|
14679
|
+
walked.add(directory);
|
|
14680
|
+
ancestors.add(real);
|
|
14542
14681
|
for (const entry of import_node_fs17.default.readdirSync(directory, { withFileTypes: true })) {
|
|
14543
|
-
if (entry.
|
|
14682
|
+
if (entry.name.startsWith(".") && !entry.isFile()) continue;
|
|
14544
14683
|
const file = import_node_path19.default.join(directory, entry.name);
|
|
14545
|
-
|
|
14684
|
+
const linked = entry.isSymbolicLink() ? linkedStat(file) : null;
|
|
14685
|
+
if (entry.isSymbolicLink() && !linked) continue;
|
|
14686
|
+
if (entry.isDirectory() || linked?.isDirectory()) addHeaders(file);
|
|
14546
14687
|
else if (/\.(h|hh|hpp|hxx|inc|inl|modulemap)$/.test(entry.name)) add(file, true);
|
|
14547
14688
|
}
|
|
14689
|
+
ancestors.delete(real);
|
|
14548
14690
|
};
|
|
14549
14691
|
const targets = [];
|
|
14550
14692
|
const configuration = app.configuration === "Debug" ? "debug" : "release";
|
|
@@ -14608,6 +14750,11 @@ function prepareXcodeObjCImplementations(app, binaries, moduleRoot, peers) {
|
|
|
14608
14750
|
)
|
|
14609
14751
|
])
|
|
14610
14752
|
add(file, true);
|
|
14753
|
+
for (const directory of [
|
|
14754
|
+
...target.objc.headerSearchPaths,
|
|
14755
|
+
...target.objc.frameworkSearchPaths
|
|
14756
|
+
])
|
|
14757
|
+
if (!isSdkInclude(directory) && import_node_fs17.default.existsSync(directory)) addHeaders(directory);
|
|
14611
14758
|
targets.push({
|
|
14612
14759
|
name: target.moduleName,
|
|
14613
14760
|
deploymentTarget: target.iosDeploymentTarget,
|
|
@@ -14711,16 +14858,16 @@ function prepareXcodeObjCImplementations(app, binaries, moduleRoot, peers) {
|
|
|
14711
14858
|
}
|
|
14712
14859
|
import_node_fs17.default.mkdirSync(work);
|
|
14713
14860
|
const staged = (file) => {
|
|
14714
|
-
for (const { root, name:
|
|
14861
|
+
for (const { root, name: name3 } of [
|
|
14715
14862
|
{ root: checkouts, name: "packages" },
|
|
14716
14863
|
{ root: app.rootDir, name: "project" }
|
|
14717
14864
|
]) {
|
|
14718
14865
|
const relative = import_node_path19.default.relative(root, file);
|
|
14719
14866
|
if (relative !== ".." && !relative.startsWith(`..${import_node_path19.default.sep}`) && !import_node_path19.default.isAbsolute(relative))
|
|
14720
|
-
return import_node_path19.default.join(work,
|
|
14867
|
+
return import_node_path19.default.join(work, name3, relative);
|
|
14721
14868
|
}
|
|
14722
|
-
if (file
|
|
14723
|
-
return import_node_path19.default.join(sdk.sysroot, "include", file.slice("/usr/include
|
|
14869
|
+
if (isSdkInclude(file))
|
|
14870
|
+
return import_node_path19.default.join(sdk.sysroot, "include", file.slice("/usr/include".length));
|
|
14724
14871
|
throw new Error(
|
|
14725
14872
|
`Objective-C compiler input is outside the project and its pinned packages: ${file}`
|
|
14726
14873
|
);
|
|
@@ -15101,8 +15248,8 @@ function emitSwiftStandin(graphs, options) {
|
|
|
15101
15248
|
const parts = fallback.split(".");
|
|
15102
15249
|
const module2 = parts[0] === "SwiftUICore" ? "SwiftUI" : parts[0];
|
|
15103
15250
|
const unqualified = parts.slice(1).join(".") || parts[0];
|
|
15104
|
-
const
|
|
15105
|
-
return { name:
|
|
15251
|
+
const name3 = family.has(parts[0]) && parts[0] !== "SwiftUICore" ? parts.join(".") : unqualified;
|
|
15252
|
+
return { name: name3, module: module2, local: false };
|
|
15106
15253
|
};
|
|
15107
15254
|
const nsObject = nameOf("c:objc(cs)NSObject", "ObjectiveC.NSObject").name;
|
|
15108
15255
|
const nsObjectProtocol = nameOf(
|
|
@@ -15123,8 +15270,8 @@ function emitSwiftStandin(graphs, options) {
|
|
|
15123
15270
|
...all(edge.source)
|
|
15124
15271
|
]);
|
|
15125
15272
|
} else if (edge.targetFallback) {
|
|
15126
|
-
const
|
|
15127
|
-
external.set(
|
|
15273
|
+
const name3 = nameOf(edge.target, edge.targetFallback).name;
|
|
15274
|
+
external.set(name3, [...external.get(name3) ?? [], ...all(edge.source)]);
|
|
15128
15275
|
owner.set(edge.source, edge.target);
|
|
15129
15276
|
}
|
|
15130
15277
|
break;
|
|
@@ -15138,9 +15285,9 @@ function emitSwiftStandin(graphs, options) {
|
|
|
15138
15285
|
case "conformsTo": {
|
|
15139
15286
|
const target = nameOf(edge.target, edge.targetFallback);
|
|
15140
15287
|
const kept = KEEP_EXTERNAL.get(edge.target);
|
|
15141
|
-
const
|
|
15142
|
-
if (
|
|
15143
|
-
conforms.set(edge.source, [...conforms.get(edge.source) ?? [],
|
|
15288
|
+
const name3 = kept ?? (target && (target.local || family.has(target.module ?? "")) ? target.name : null);
|
|
15289
|
+
if (name3)
|
|
15290
|
+
conforms.set(edge.source, [...conforms.get(edge.source) ?? [], name3]);
|
|
15144
15291
|
if (byId.has(edge.target)) {
|
|
15145
15292
|
const map = source.kind.identifier === "swift.protocol" ? protocolParents : conformIds;
|
|
15146
15293
|
map.set(edge.source, [...map.get(edge.source) ?? [], edge.target]);
|
|
@@ -15386,13 +15533,13 @@ function emitSwiftStandin(graphs, options) {
|
|
|
15386
15533
|
if (blocked) return void skipped.push({ path: path21, reason: blocked });
|
|
15387
15534
|
const ancestors = /* @__PURE__ */ new Set();
|
|
15388
15535
|
for (let at = superId.get(id); at; at = superId.get(at))
|
|
15389
|
-
for (const
|
|
15536
|
+
for (const name3 of conforms.get(at) ?? []) ancestors.add(name3);
|
|
15390
15537
|
const list2 = [
|
|
15391
15538
|
...parent ? [parent] : [],
|
|
15392
15539
|
...(conforms.get(id) ?? []).filter(
|
|
15393
|
-
(
|
|
15540
|
+
(name3) => !ancestors.has(name3) && !(parent && [...KEEP_EXTERNAL.values()].includes(name3)) && !(name3 === nsObjectProtocol && externalRoot(id) === nsObject)
|
|
15394
15541
|
)
|
|
15395
|
-
].filter((
|
|
15542
|
+
].filter((name3, at, all2) => all2.indexOf(name3) === at);
|
|
15396
15543
|
const parentSymbol = superId.has(id) ? byId.get(superId.get(id)) : void 0;
|
|
15397
15544
|
const open = symbol.accessLevel === "open" && (!parentSymbol || parentSymbol.accessLevel === "open");
|
|
15398
15545
|
emit(
|
|
@@ -15513,7 +15660,7 @@ function emitSwiftStandin(graphs, options) {
|
|
|
15513
15660
|
reason: `no header value for ${missing.map(leaf).join(", ")}`
|
|
15514
15661
|
});
|
|
15515
15662
|
const list2 = inheritance(id, raw2 ?? void 0).filter(
|
|
15516
|
-
(
|
|
15663
|
+
(name3) => !raw2 || name3 !== "RawRepresentable"
|
|
15517
15664
|
);
|
|
15518
15665
|
emit(
|
|
15519
15666
|
`${indent}${shape.attrs}public enum ${shape.name}${shape.generics}${list2.length ? `: ${list2.join(", ")}` : ""}${shape.where} {`
|
|
@@ -15654,7 +15801,7 @@ function emitSwiftStandin(graphs, options) {
|
|
|
15654
15801
|
if (TYPE_KINDS.has(symbol.kind.identifier)) emitType(symbol, "");
|
|
15655
15802
|
else emitGlobal(symbol);
|
|
15656
15803
|
}
|
|
15657
|
-
for (const [
|
|
15804
|
+
for (const [name3, members] of [...external].sort(([a], [b]) => a.localeCompare(b))) {
|
|
15658
15805
|
const seen = /* @__PURE__ */ new Set();
|
|
15659
15806
|
const kept = members.filter((member) => {
|
|
15660
15807
|
const key2 = `${member.kind.identifier}|${text3(member)}`;
|
|
@@ -15663,7 +15810,7 @@ function emitSwiftStandin(graphs, options) {
|
|
|
15663
15810
|
return true;
|
|
15664
15811
|
});
|
|
15665
15812
|
if (kept.length === 0) continue;
|
|
15666
|
-
emit(`extension ${
|
|
15813
|
+
emit(`extension ${name3} {`);
|
|
15667
15814
|
for (const member of kept)
|
|
15668
15815
|
if (member.kind.identifier === "swift.init" && !text3(member).startsWith("convenience"))
|
|
15669
15816
|
emitMember(
|
|
@@ -15687,7 +15834,7 @@ function emitSwiftStandin(graphs, options) {
|
|
|
15687
15834
|
`// stand-in for the binary ${options.module} module, generated from ${options.source}.`,
|
|
15688
15835
|
options.inert ? "// generated from public headers; native behavior is inert in peach." : "// unconfigured bodies trap because the vendor binary cannot run in peach.",
|
|
15689
15836
|
"",
|
|
15690
|
-
...imports.map((
|
|
15837
|
+
...imports.map((name3) => `import ${name3}`),
|
|
15691
15838
|
""
|
|
15692
15839
|
];
|
|
15693
15840
|
for (const path21 of behavior.keys())
|
|
@@ -15735,7 +15882,7 @@ var KEYWORDS = /* @__PURE__ */ new Set([
|
|
|
15735
15882
|
"false",
|
|
15736
15883
|
"nil"
|
|
15737
15884
|
]);
|
|
15738
|
-
var tick = (
|
|
15885
|
+
var tick = (name3) => KEYWORDS.has(name3) ? `\`${name3}\`` : name3;
|
|
15739
15886
|
function stripDefaults(decl) {
|
|
15740
15887
|
let out = "";
|
|
15741
15888
|
let depth = 0;
|
|
@@ -15803,16 +15950,16 @@ function treeDigest(root) {
|
|
|
15803
15950
|
ancestors.delete(resolved);
|
|
15804
15951
|
};
|
|
15805
15952
|
walk2(root);
|
|
15806
|
-
const stamp = names.map((
|
|
15807
|
-
const stat = import_node_fs20.default.statSync(import_node_path20.default.join(root,
|
|
15808
|
-
return `${
|
|
15953
|
+
const stamp = names.map((name3) => {
|
|
15954
|
+
const stat = import_node_fs20.default.statSync(import_node_path20.default.join(root, name3));
|
|
15955
|
+
return `${name3}\0${stat.size}:${stat.mtimeMs}`;
|
|
15809
15956
|
}).join("\n");
|
|
15810
15957
|
const memo2 = digests.get(`tree\0${root}`);
|
|
15811
15958
|
if (memo2?.stamp === stamp) return memo2.digest;
|
|
15812
15959
|
const hash = (0, import_node_crypto13.createHash)("sha256");
|
|
15813
|
-
for (const
|
|
15814
|
-
hash.update(`${
|
|
15815
|
-
hash.update(import_node_fs20.default.readFileSync(import_node_path20.default.join(root,
|
|
15960
|
+
for (const name3 of names) {
|
|
15961
|
+
hash.update(`${name3}\0`);
|
|
15962
|
+
hash.update(import_node_fs20.default.readFileSync(import_node_path20.default.join(root, name3)));
|
|
15816
15963
|
hash.update("\0");
|
|
15817
15964
|
}
|
|
15818
15965
|
const digest = hash.digest("hex");
|
|
@@ -15891,13 +16038,13 @@ function xcframework(binary) {
|
|
|
15891
16038
|
var files = (dir, test) => import_node_fs20.default.existsSync(dir) ? import_node_fs20.default.readdirSync(dir, { recursive: true, encoding: "utf8" }).filter((file) => test(import_node_path20.default.basename(file))).sort() : [];
|
|
15892
16039
|
var OBJC = /^\s*(?:@interface|@protocol|@class|@import|#import)\b/m;
|
|
15893
16040
|
function headerSurface(module2, modulemap, headers) {
|
|
15894
|
-
const objc = files(headers, (
|
|
16041
|
+
const objc = files(headers, (name3) => name3.endsWith(".h")).some(
|
|
15895
16042
|
(file) => OBJC.test(import_node_fs20.default.readFileSync(import_node_path20.default.join(headers, file), "utf8"))
|
|
15896
16043
|
);
|
|
15897
16044
|
return objc ? { kind: "objc", module: module2, modulemap, headers } : { kind: "c", module: module2, modulemap, headers };
|
|
15898
16045
|
}
|
|
15899
16046
|
function surfaces(xcframeworkDir) {
|
|
15900
|
-
const slice = import_node_fs20.default.readdirSync(xcframeworkDir).filter((
|
|
16047
|
+
const slice = import_node_fs20.default.readdirSync(xcframeworkDir).filter((name3) => /^ios-.+-simulator$/.test(name3)).sort()[0];
|
|
15901
16048
|
const plain = !slice && xcframeworkDir.endsWith(".framework");
|
|
15902
16049
|
if (!slice && !plain) throw new Error("it has no iOS simulator slice");
|
|
15903
16050
|
const root = plain ? import_node_path20.default.dirname(xcframeworkDir) : import_node_path20.default.join(xcframeworkDir, slice);
|
|
@@ -15909,9 +16056,9 @@ function surfaces(xcframeworkDir) {
|
|
|
15909
16056
|
const swiftmodule = import_node_path20.default.join(framework, "Modules", `${module2}.swiftmodule`);
|
|
15910
16057
|
const interfaces = files(
|
|
15911
16058
|
swiftmodule,
|
|
15912
|
-
(
|
|
16059
|
+
(name3) => name3.endsWith(".swiftinterface") && !name3.endsWith(".private.swiftinterface") && !name3.endsWith(".package.swiftinterface")
|
|
15913
16060
|
);
|
|
15914
|
-
const chosen = interfaces.find((
|
|
16061
|
+
const chosen = interfaces.find((name3) => name3.startsWith("arm64-")) ?? interfaces[0] ?? null;
|
|
15915
16062
|
const modulemap = import_node_path20.default.join(framework, "Modules", "module.modulemap");
|
|
15916
16063
|
if (chosen) {
|
|
15917
16064
|
const file = import_node_path20.default.join(swiftmodule, chosen);
|
|
@@ -15935,7 +16082,7 @@ function surfaces(xcframeworkDir) {
|
|
|
15935
16082
|
found.push(headerSurface(module2, modulemap, import_node_path20.default.join(framework, "Headers")));
|
|
15936
16083
|
}
|
|
15937
16084
|
const headers = import_node_path20.default.join(root, "Headers");
|
|
15938
|
-
for (const map of files(headers, (
|
|
16085
|
+
for (const map of files(headers, (name3) => name3 === "module.modulemap")) {
|
|
15939
16086
|
const modulemap = import_node_path20.default.join(headers, map);
|
|
15940
16087
|
const module2 = /(?:^|\s)module\s+(\w+)/.exec(import_node_fs20.default.readFileSync(modulemap, "utf8"))?.[1];
|
|
15941
16088
|
if (module2) found.push(headerSurface(module2, modulemap, import_node_path20.default.dirname(modulemap)));
|
|
@@ -15952,7 +16099,7 @@ function peachModuleDirs(toolchain, imports) {
|
|
|
15952
16099
|
if (swiftDistributionAt(moduleRoot)) return [import_node_path20.default.join(moduleRoot, "modules")];
|
|
15953
16100
|
const peach = new Set(swiftPeachModules(moduleRoot));
|
|
15954
16101
|
const targets = [.../* @__PURE__ */ new Set([...STANDIN_IMPORTS, ...imports])].filter(
|
|
15955
|
-
(
|
|
16102
|
+
(name3) => peach.has(name3)
|
|
15956
16103
|
);
|
|
15957
16104
|
const plugins = swiftMacroPlugins(moduleRoot);
|
|
15958
16105
|
if (plugins.stale)
|
|
@@ -15993,8 +16140,8 @@ function peachModuleDirs(toolchain, imports) {
|
|
|
15993
16140
|
return [
|
|
15994
16141
|
import_node_path20.default.join(release, "Modules"),
|
|
15995
16142
|
...import_node_fs20.default.readdirSync(release).filter(
|
|
15996
|
-
(
|
|
15997
|
-
).sort().map((
|
|
16143
|
+
(name3) => name3.endsWith(".build") && import_node_fs20.default.existsSync(import_node_path20.default.join(release, name3, "module.modulemap"))
|
|
16144
|
+
).sort().map((name3) => import_node_path20.default.join(release, name3))
|
|
15998
16145
|
];
|
|
15999
16146
|
}
|
|
16000
16147
|
function swiftInterfaceForWasm(text4) {
|
|
@@ -16005,7 +16152,7 @@ function swiftInterfaceForWasm(text4) {
|
|
|
16005
16152
|
const foundation = rooted !== text4 && !/^import[ \t]+Foundation\b/m.test(rooted) ? rooted.replace(/^(?=import[ \t])/m, "import Foundation\n") : rooted;
|
|
16006
16153
|
return foundation.replace(
|
|
16007
16154
|
/^(\/\/ swift-module-flags:.*)$/m,
|
|
16008
|
-
(flags) => flags.replace(/-target \S+/, `-target ${TRIPLE}`).replace(/\s-enable-objc-interop\b/, "").replace(/\s-target-variant \S+/, "") + ` ${WASI_EMULATION.map((
|
|
16155
|
+
(flags) => flags.replace(/-target \S+/, `-target ${TRIPLE}`).replace(/\s-enable-objc-interop\b/, "").replace(/\s-target-variant \S+/, "") + ` ${WASI_EMULATION.map((name3) => `-Xcc -D${name3}`).join(" ")}`
|
|
16009
16156
|
).replace(
|
|
16010
16157
|
/@(?:objc(?:\s*\([^()]*\))?|objcMembers|nonobjc|IBOutlet|IBAction|IBInspectable|IBDesignable|_objcRuntimeName\([^()]*\))(?![\w(])/g,
|
|
16011
16158
|
""
|
|
@@ -16034,7 +16181,7 @@ function swiftStandin(surface, binary, toolchain, work, behavior, siblings) {
|
|
|
16034
16181
|
"-output-dir",
|
|
16035
16182
|
out
|
|
16036
16183
|
]);
|
|
16037
|
-
const graphs = import_node_fs20.default.readdirSync(out).filter((
|
|
16184
|
+
const graphs = import_node_fs20.default.readdirSync(out).filter((name3) => name3.endsWith(".symbols.json")).sort().map((name3) => JSON.parse(import_node_fs20.default.readFileSync(import_node_path20.default.join(out, name3), "utf8")));
|
|
16038
16185
|
return graphStandin(
|
|
16039
16186
|
surface.module,
|
|
16040
16187
|
graphs,
|
|
@@ -16080,7 +16227,7 @@ function wasmFlags(toolchain, imports) {
|
|
|
16080
16227
|
"-resource-dir",
|
|
16081
16228
|
resources,
|
|
16082
16229
|
// the sdk toolset's emulation defines, which raw swiftc does not read
|
|
16083
|
-
...WASI_EMULATION.flatMap((
|
|
16230
|
+
...WASI_EMULATION.flatMap((name3) => ["-Xcc", `-D${name3}`]),
|
|
16084
16231
|
...peachModuleDirs(toolchain, imports).flatMap((dir) => ["-I", dir]),
|
|
16085
16232
|
...toolchain.standinModules ? ["-I", toolchain.standinModules] : []
|
|
16086
16233
|
];
|
|
@@ -16113,10 +16260,10 @@ function graphStandin(module2, graphs, values, wasm, binary, toolchain, work, be
|
|
|
16113
16260
|
(graph) => graph.symbols.map((symbol) => symbol.pathComponents.join("."))
|
|
16114
16261
|
)
|
|
16115
16262
|
);
|
|
16116
|
-
for (const
|
|
16117
|
-
if (!paths.has(
|
|
16263
|
+
for (const name3 of behavior.keys()) {
|
|
16264
|
+
if (!paths.has(name3))
|
|
16118
16265
|
throw new Error(
|
|
16119
|
-
`Configured Swift behavior ${module2}.${
|
|
16266
|
+
`Configured Swift behavior ${module2}.${name3} is not in the SDK surface`
|
|
16120
16267
|
);
|
|
16121
16268
|
}
|
|
16122
16269
|
const omit = /* @__PURE__ */ new Map();
|
|
@@ -16301,7 +16448,7 @@ function cStandin(surface, binary, toolchain, work) {
|
|
|
16301
16448
|
const named = [
|
|
16302
16449
|
...import_node_fs20.default.readFileSync(surface.modulemap, "utf8").matchAll(/(?:umbrella\s+)?header\s+"([^"]+)"/g)
|
|
16303
16450
|
].map((match) => match[1]);
|
|
16304
|
-
const headers = files(surface.headers, (
|
|
16451
|
+
const headers = files(surface.headers, (name3) => name3.endsWith(".h"));
|
|
16305
16452
|
const texts = new Map(
|
|
16306
16453
|
headers.map((file) => [
|
|
16307
16454
|
file,
|
|
@@ -16424,7 +16571,7 @@ var UNSEARCHED = /* @__PURE__ */ new Set([
|
|
|
16424
16571
|
".git",
|
|
16425
16572
|
"DerivedData"
|
|
16426
16573
|
]);
|
|
16427
|
-
function crateFor(root,
|
|
16574
|
+
function crateFor(root, name3) {
|
|
16428
16575
|
const walk2 = (dir, depth) => {
|
|
16429
16576
|
const manifest = import_node_path20.default.join(dir, "Cargo.toml");
|
|
16430
16577
|
if (import_node_fs20.default.existsSync(manifest)) {
|
|
@@ -16435,10 +16582,10 @@ function crateFor(root, name2) {
|
|
|
16435
16582
|
const field = (body, key2) => new RegExp(`^${key2}\\s*=\\s*"([^"]+)"`, "m").exec(body)?.[1];
|
|
16436
16583
|
const lib = section("lib");
|
|
16437
16584
|
const crate = field(lib, "name") ?? field(section("package"), "name")?.replaceAll("-", "_");
|
|
16438
|
-
if (crate ===
|
|
16585
|
+
if (crate === name3) {
|
|
16439
16586
|
if (!/crate-type\s*=\s*\[[^\]]*"staticlib"/.test(lib))
|
|
16440
16587
|
throw new Error(
|
|
16441
|
-
`${import_node_path20.default.relative(root, manifest)} builds lib${
|
|
16588
|
+
`${import_node_path20.default.relative(root, manifest)} builds lib${name3} without crate-type "staticlib"`
|
|
16442
16589
|
);
|
|
16443
16590
|
return manifest;
|
|
16444
16591
|
}
|
|
@@ -16460,7 +16607,7 @@ function simulatorLibraryName(dir) {
|
|
|
16460
16607
|
if (!Array.isArray(libraries)) return void 0;
|
|
16461
16608
|
return libraries.filter(
|
|
16462
16609
|
(entry) => typeof entry === "object" && entry !== null && Reflect.get(entry, "SupportedPlatform") === "ios" && Reflect.get(entry, "SupportedPlatformVariant") === "simulator"
|
|
16463
|
-
).map((entry) => Reflect.get(entry, "LibraryPath")).find((
|
|
16610
|
+
).map((entry) => Reflect.get(entry, "LibraryPath")).find((name3) => typeof name3 === "string" && /^lib.+\.a$/.test(name3));
|
|
16464
16611
|
}
|
|
16465
16612
|
function standinLibrary(binary, searchRoot) {
|
|
16466
16613
|
if (binary.publicHeaders !== void 0) return null;
|
|
@@ -16468,7 +16615,7 @@ function standinLibrary(binary, searchRoot) {
|
|
|
16468
16615
|
const library = simulatorLibraryName(dir);
|
|
16469
16616
|
const supplied = import_node_path20.default.join(dir, RUST_TARGET);
|
|
16470
16617
|
if (import_node_fs20.default.existsSync(supplied)) {
|
|
16471
|
-
const found = import_node_fs20.default.readdirSync(supplied).filter((
|
|
16618
|
+
const found = import_node_fs20.default.readdirSync(supplied).filter((name3) => name3.endsWith(".a"));
|
|
16472
16619
|
const chosen = library && found.includes(library) ? library : found.length === 1 ? found[0] : null;
|
|
16473
16620
|
if (!chosen)
|
|
16474
16621
|
throw new Error(
|
|
@@ -16672,12 +16819,12 @@ function readStandinResults(receipt, generation, targets) {
|
|
|
16672
16819
|
if (!Array.isArray(entry.result))
|
|
16673
16820
|
throw new Error("invalid Swift stand-in builder result");
|
|
16674
16821
|
for (const item of entry.result) {
|
|
16675
|
-
if (!isRecord(item) || typeof item.module !== "string" || item.target !== entry.target || !isRecord(item.files) || !Object.values(item.files).every((text4) => typeof text4 === "string") || item.dependencies !== void 0 && (!Array.isArray(item.dependencies) || !item.dependencies.every((
|
|
16822
|
+
if (!isRecord(item) || typeof item.module !== "string" || item.target !== entry.target || !isRecord(item.files) || !Object.values(item.files).every((text4) => typeof text4 === "string") || item.dependencies !== void 0 && (!Array.isArray(item.dependencies) || !item.dependencies.every((name3) => typeof name3 === "string")))
|
|
16676
16823
|
throw new Error("invalid Swift stand-in builder result");
|
|
16677
16824
|
const files2 = {};
|
|
16678
|
-
for (const [
|
|
16825
|
+
for (const [name3, text4] of Object.entries(item.files)) {
|
|
16679
16826
|
if (typeof text4 !== "string") throw new Error("invalid Swift stand-in file");
|
|
16680
|
-
files2[
|
|
16827
|
+
files2[name3] = text4;
|
|
16681
16828
|
}
|
|
16682
16829
|
standins.push({
|
|
16683
16830
|
module: item.module,
|
|
@@ -16714,13 +16861,13 @@ function standinGenerationInputs(binaries, toolchain, behavior = {}) {
|
|
|
16714
16861
|
}
|
|
16715
16862
|
})
|
|
16716
16863
|
);
|
|
16717
|
-
const selected = Object.keys(behavior).filter((
|
|
16864
|
+
const selected = Object.keys(behavior).filter((name3) => modules.has(name3)).sort();
|
|
16718
16865
|
if (selected.length > 0)
|
|
16719
16866
|
parts.push(
|
|
16720
16867
|
JSON.stringify(
|
|
16721
|
-
selected.map((
|
|
16722
|
-
|
|
16723
|
-
Object.keys(behavior[
|
|
16868
|
+
selected.map((name3) => [
|
|
16869
|
+
name3,
|
|
16870
|
+
Object.keys(behavior[name3]).sort().map((member) => [member, behavior[name3][member]])
|
|
16724
16871
|
])
|
|
16725
16872
|
)
|
|
16726
16873
|
);
|
|
@@ -16770,7 +16917,7 @@ function binaryStandins(binary, toolchain, provided, behavior, frameworks, sibli
|
|
|
16770
16917
|
const module2 = swiftTargetModuleName(binary.target);
|
|
16771
16918
|
const modulemap = import_node_path20.default.join(work, "module.modulemap");
|
|
16772
16919
|
const supplied = import_node_path20.default.join(headers, "module.modulemap");
|
|
16773
|
-
const roots = files(headers, (
|
|
16920
|
+
const roots = files(headers, (name3) => name3.endsWith(".h"));
|
|
16774
16921
|
if (roots.length === 0)
|
|
16775
16922
|
throw new Error("its public header directory has no headers");
|
|
16776
16923
|
import_node_fs20.default.writeFileSync(
|
|
@@ -16826,7 +16973,7 @@ ${roots.map((file) => ` header "${file}"`).join("\n")}
|
|
|
16826
16973
|
for (const file of surface.kind === "swift" ? [surface.interface] : [
|
|
16827
16974
|
...surface.kind === "mixed" ? [surface.interface] : [],
|
|
16828
16975
|
surface.modulemap,
|
|
16829
|
-
...files(surface.headers, (
|
|
16976
|
+
...files(surface.headers, (name3) => name3.endsWith(".h")).map(
|
|
16830
16977
|
(file2) => import_node_path20.default.join(surface.headers, file2)
|
|
16831
16978
|
)
|
|
16832
16979
|
])
|
|
@@ -17083,7 +17230,7 @@ function isSwiftNativeModules(value) {
|
|
|
17083
17230
|
...Object.values(value.modules),
|
|
17084
17231
|
...Object.values(value.views)
|
|
17085
17232
|
].every(
|
|
17086
|
-
(names) => Array.isArray(names) && names.every((
|
|
17233
|
+
(names) => Array.isArray(names) && names.every((name3) => typeof name3 === "string")
|
|
17087
17234
|
) && Array.isArray(value.defaultViewFiles) && value.defaultViewFiles.every((file) => typeof file === "string");
|
|
17088
17235
|
}
|
|
17089
17236
|
function isSwiftCompileOutcome(value) {
|
|
@@ -17109,8 +17256,8 @@ function compileAssetUrl(value, origin) {
|
|
|
17109
17256
|
}
|
|
17110
17257
|
function resolveImageUrls(urls, origin) {
|
|
17111
17258
|
const resolved = {};
|
|
17112
|
-
for (const [
|
|
17113
|
-
resolved[
|
|
17259
|
+
for (const [name3, url] of Object.entries(urls)) {
|
|
17260
|
+
resolved[name3] = compileAssetUrl(url, origin);
|
|
17114
17261
|
}
|
|
17115
17262
|
return resolved;
|
|
17116
17263
|
}
|
|
@@ -17261,9 +17408,9 @@ function swiftPackages(entry, app) {
|
|
|
17261
17408
|
))
|
|
17262
17409
|
compileXcodeObjCImplementations(app, cached2.binaries, entry.moduleRoot);
|
|
17263
17410
|
const vendored = app.binaryFrameworks.flatMap(
|
|
17264
|
-
({ name:
|
|
17411
|
+
({ name: name3, path: dir }) => dir ? [
|
|
17265
17412
|
{
|
|
17266
|
-
target:
|
|
17413
|
+
target: name3,
|
|
17267
17414
|
source: "the project",
|
|
17268
17415
|
url: null,
|
|
17269
17416
|
checksum: null,
|
|
@@ -17388,7 +17535,7 @@ ${implementations.map((file) => ` ${file}`).join("\n")}`
|
|
|
17388
17535
|
targets.push({
|
|
17389
17536
|
name: standin.module,
|
|
17390
17537
|
path: import_node_path21.default.posix.join(SWIFT_STANDINS_DIR, standin.module),
|
|
17391
|
-
dependencies: standin.dependencies?.map((
|
|
17538
|
+
dependencies: standin.dependencies?.map((name3) => ({ kind: "target", name: name3 })),
|
|
17392
17539
|
executable: false,
|
|
17393
17540
|
resources: false,
|
|
17394
17541
|
exclude: [],
|
|
@@ -17447,9 +17594,9 @@ function xcodeManifest(layout) {
|
|
|
17447
17594
|
const settings = (target) => `swiftSettings: [${[
|
|
17448
17595
|
`.swiftLanguageMode(.v${target.languageMode})`,
|
|
17449
17596
|
...target.mainActorIsolation ? [".defaultIsolation(MainActor.self)"] : [],
|
|
17450
|
-
...(target.defines ?? []).map((
|
|
17597
|
+
...(target.defines ?? []).map((name3) => `.define(${JSON.stringify(name3)})`)
|
|
17451
17598
|
].join(", ")}]`;
|
|
17452
|
-
const libraries = (target) => target.linkedLibraries?.length ? `, linkerSettings: [${target.linkedLibraries.map((
|
|
17599
|
+
const libraries = (target) => target.linkedLibraries?.length ? `, linkerSettings: [${target.linkedLibraries.map((name3) => `.linkedLibrary(${JSON.stringify(name3)})`).join(", ")}]` : "";
|
|
17453
17600
|
return [
|
|
17454
17601
|
"// swift-tools-version: 6.2",
|
|
17455
17602
|
"import PackageDescription",
|
|
@@ -17632,7 +17779,7 @@ function buildSwiftResourceTable(project, baseUrl, inputs) {
|
|
|
17632
17779
|
registered.set(`${sha256}.metal`, { bytes, contentType: "text/plain; charset=utf-8" });
|
|
17633
17780
|
}
|
|
17634
17781
|
let imageBytes = 0;
|
|
17635
|
-
for (const { name:
|
|
17782
|
+
for (const { name: name3, file, scale, bundlePath } of found) {
|
|
17636
17783
|
const disk = byRelative.get(file);
|
|
17637
17784
|
if (!disk) continue;
|
|
17638
17785
|
if (Object.keys(images).length >= limits.images || imageBytes + import_node_fs21.default.statSync(disk).size > limits.imageTotalBytes) {
|
|
@@ -17643,7 +17790,7 @@ function buildSwiftResourceTable(project, baseUrl, inputs) {
|
|
|
17643
17790
|
const hash = (0, import_node_crypto14.createHash)("sha256").update(bytes).digest("hex").slice(0, 16);
|
|
17644
17791
|
const ext = import_node_path21.default.posix.extname(file).toLowerCase();
|
|
17645
17792
|
const bundle = table[bundlePath] ?? /* @__PURE__ */ Object.create(null);
|
|
17646
|
-
const variants = bundle[
|
|
17793
|
+
const variants = bundle[name3] ??= [];
|
|
17647
17794
|
variants.push({ uri: `${baseUrl}${RESOURCE_PATH}${hash}${ext}`, scale });
|
|
17648
17795
|
table[bundlePath] = bundle;
|
|
17649
17796
|
const key2 = layout ? xcodeInputKey(layout, disk, file) : file;
|
|
@@ -17724,10 +17871,10 @@ function buildSwiftBundleFiles(packagePath, hosted, inputs) {
|
|
|
17724
17871
|
const bytes = readPackageFile2(packagePath, disk, limits.resourceBytes);
|
|
17725
17872
|
addFile(bundlePath === "." ? base : `${bundlePath}/${base}`, bytes);
|
|
17726
17873
|
if (base.endsWith(".xcstrings")) {
|
|
17727
|
-
for (const [
|
|
17874
|
+
for (const [name3, table] of Object.entries(
|
|
17728
17875
|
compileStringCatalog(bytes.toString("utf8"), base.slice(0, -10))
|
|
17729
17876
|
)) {
|
|
17730
|
-
addFile(bundlePath === "." ?
|
|
17877
|
+
addFile(bundlePath === "." ? name3 : `${bundlePath}/${name3}`, Buffer.from(table));
|
|
17731
17878
|
}
|
|
17732
17879
|
}
|
|
17733
17880
|
}
|
|
@@ -18050,10 +18197,10 @@ var IOS_SDK_FRAMEWORKS = new Set(ios_sdk_frameworks_default.frameworks);
|
|
|
18050
18197
|
async function missingModulesMessage(packagePath, missing) {
|
|
18051
18198
|
const layout = xcodeLayout(packagePath);
|
|
18052
18199
|
const gaps = new Map([
|
|
18053
|
-
...(layout?.app.binaryFrameworks ?? []).map(({ name:
|
|
18054
|
-
const gap = layout?.projectGaps.get(
|
|
18200
|
+
...(layout?.app.binaryFrameworks ?? []).map(({ name: name3 }) => {
|
|
18201
|
+
const gap = layout?.projectGaps.get(name3);
|
|
18055
18202
|
return [
|
|
18056
|
-
|
|
18203
|
+
name3,
|
|
18057
18204
|
{
|
|
18058
18205
|
source: "the project",
|
|
18059
18206
|
reason: `a vendored binary framework${gap ? `; no stand-in: ${gap}` : ""}`
|
|
@@ -18061,9 +18208,9 @@ async function missingModulesMessage(packagePath, missing) {
|
|
|
18061
18208
|
];
|
|
18062
18209
|
}),
|
|
18063
18210
|
...[...missing.keys()].flatMap(
|
|
18064
|
-
(
|
|
18211
|
+
(name3) => IOS_SDK_FRAMEWORKS.has(name3) ? [
|
|
18065
18212
|
[
|
|
18066
|
-
|
|
18213
|
+
name3,
|
|
18067
18214
|
{ source: "the iOS SDK", reason: "a framework Peach does not provide" }
|
|
18068
18215
|
]
|
|
18069
18216
|
] : []
|
|
@@ -18072,28 +18219,28 @@ async function missingModulesMessage(packagePath, missing) {
|
|
|
18072
18219
|
...layout?.packages.unavailable ?? []
|
|
18073
18220
|
]);
|
|
18074
18221
|
const packaged = new Set(
|
|
18075
|
-
[...missing.keys()].filter((
|
|
18222
|
+
[...missing.keys()].filter((name3) => !IOS_SDK_FRAMEWORKS.has(name3))
|
|
18076
18223
|
);
|
|
18077
18224
|
if (packaged.size > 0)
|
|
18078
18225
|
await Promise.all(
|
|
18079
18226
|
(layout?.packages.binaries ?? []).map(async (binary) => {
|
|
18080
18227
|
const modules = await swiftBinaryModules(binary).catch(() => []);
|
|
18081
|
-
for (const
|
|
18082
|
-
if (packaged.has(
|
|
18083
|
-
gaps.set(
|
|
18228
|
+
for (const name3 of modules)
|
|
18229
|
+
if (packaged.has(name3))
|
|
18230
|
+
gaps.set(name3, {
|
|
18084
18231
|
source: binary.source,
|
|
18085
18232
|
reason: layout?.packages.modules.get(binary.target)?.reason ?? `${binary.target} is a binary framework`
|
|
18086
18233
|
});
|
|
18087
18234
|
})
|
|
18088
18235
|
);
|
|
18089
|
-
const width = Math.max(...[...missing.keys()].map((
|
|
18236
|
+
const width = Math.max(...[...missing.keys()].map((name3) => name3.length));
|
|
18090
18237
|
const opened = xcodeProjects.get(packagePath)?.xcodeproj;
|
|
18091
18238
|
const workspace = opened?.endsWith(".xcodeproj") ? enclosingXcodeWorkspace(opened) : null;
|
|
18092
18239
|
return [
|
|
18093
18240
|
`Peach does not provide ${missing.size} module${missing.size === 1 ? "" : "s"} this app imports:`,
|
|
18094
|
-
...[...missing].map(([
|
|
18095
|
-
const gap = gaps.get(
|
|
18096
|
-
return ` ${
|
|
18241
|
+
...[...missing].map(([name3, files2]) => {
|
|
18242
|
+
const gap = gaps.get(name3);
|
|
18243
|
+
return ` ${name3.padEnd(width)} ${files2.length} file${files2.length === 1 ? "" : "s"}${gap ? `, ${gap.source.includes("://") ? `package ${gap.source}` : gap.source.startsWith("/") ? `package ${import_node_path21.default.relative(packagePath, gap.source) || "."}` : gap.source} (${gap.reason})` : ""}`;
|
|
18097
18244
|
}),
|
|
18098
18245
|
...workspace ? [
|
|
18099
18246
|
`${import_node_path21.default.basename(opened)} is part of ${import_node_path21.default.relative(process.cwd(), workspace)}, which holds its local packages and Package.resolved pins; pass the workspace to build what Xcode builds there.`
|
|
@@ -18332,12 +18479,12 @@ async function collectExpoSwiftSources(appRoot, signal) {
|
|
|
18332
18479
|
const classes = [];
|
|
18333
18480
|
for (const module2 of modules) {
|
|
18334
18481
|
const className = typeof module2 === "string" ? module2 : module2 && typeof module2 === "object" ? Reflect.get(module2, "class") : null;
|
|
18335
|
-
const
|
|
18336
|
-
if (typeof className !== "string" || !/^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$/.test(className) ||
|
|
18482
|
+
const name3 = typeof module2 === "string" ? null : module2 && typeof module2 === "object" ? Reflect.get(module2, "name") : null;
|
|
18483
|
+
if (typeof className !== "string" || !/^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$/.test(className) || name3 !== null && typeof name3 !== "string")
|
|
18337
18484
|
throw new Error(`${sourceRoot}: invalid Expo Apple module descriptor`);
|
|
18338
18485
|
classes.push({
|
|
18339
18486
|
name: className.split(".").pop(),
|
|
18340
|
-
registration: `(${className.includes(".") ? className : `${namespace}.${className}`}.self, ${
|
|
18487
|
+
registration: `(${className.includes(".") ? className : `${namespace}.${className}`}.self, ${name3 === null ? "nil" : JSON.stringify(name3)})`
|
|
18341
18488
|
});
|
|
18342
18489
|
}
|
|
18343
18490
|
const ios = import_node_path22.default.join(canonical, "ios");
|
|
@@ -18437,8 +18584,8 @@ ${import_node_fs22.default.readFileSync(source, "utf8")}`;
|
|
|
18437
18584
|
...dependency.flatMap((item) => item.frameworks)
|
|
18438
18585
|
])
|
|
18439
18586
|
];
|
|
18440
|
-
for (const [
|
|
18441
|
-
if (
|
|
18587
|
+
for (const [name3, source] of Object.entries(allFiles)) {
|
|
18588
|
+
if (name3.startsWith(`Sources/${namespace}/`)) unit2.files[name3] = source;
|
|
18442
18589
|
}
|
|
18443
18590
|
}
|
|
18444
18591
|
unit2.files["Package.swift"] = expoManifest(unit2.files);
|
|
@@ -18457,7 +18604,7 @@ function expoManifest(files2, generation = "", modes = /* @__PURE__ */ new Map()
|
|
|
18457
18604
|
}
|
|
18458
18605
|
return `// swift-tools-version: 6.0
|
|
18459
18606
|
import PackageDescription
|
|
18460
|
-
let package = Package(name: "PeachExpo", targets: [${[...targets].map(([
|
|
18607
|
+
let package = Package(name: "PeachExpo", targets: [${[...targets].map(([name3, dir]) => `.target(name: ${JSON.stringify(name3)}, path: ${JSON.stringify(dir)}${dir.startsWith(`${SWIFT_STANDINS_DIR}/`) ? ", swiftSettings: [.swiftLanguageMode(.v5)]" : modes.has(name3) ? `, swiftSettings: [.swiftLanguageMode(.v${modes.get(name3)})]` : ""})`).join(", ")}, .executableTarget(name: "PeachExpoApp", path: "Sources/PeachExpoApp")])
|
|
18461
18608
|
// stand-in inputs: ${generation}
|
|
18462
18609
|
`;
|
|
18463
18610
|
}
|
|
@@ -18498,17 +18645,17 @@ function expoSwiftPreparedKey(base, units) {
|
|
|
18498
18645
|
for (const unit2 of units) {
|
|
18499
18646
|
hash.update("\0");
|
|
18500
18647
|
hash.update(unit2.moduleId);
|
|
18501
|
-
for (const
|
|
18648
|
+
for (const name3 of Object.keys(unit2.files).sort()) {
|
|
18502
18649
|
hash.update("\0");
|
|
18503
|
-
hash.update(
|
|
18650
|
+
hash.update(name3);
|
|
18504
18651
|
hash.update("\0");
|
|
18505
|
-
hash.update(unit2.files[
|
|
18652
|
+
hash.update(unit2.files[name3] ?? "");
|
|
18506
18653
|
}
|
|
18507
18654
|
}
|
|
18508
18655
|
return hash.digest("hex");
|
|
18509
18656
|
}
|
|
18510
|
-
function expoSwiftPackage(appKey,
|
|
18511
|
-
return import_node_path22.default.join(import_node_os7.default.tmpdir(), "peach-expo-swift", appKey, `p${process.pid}`,
|
|
18657
|
+
function expoSwiftPackage(appKey, name3) {
|
|
18658
|
+
return import_node_path22.default.join(import_node_os7.default.tmpdir(), "peach-expo-swift", appKey, `p${process.pid}`, name3);
|
|
18512
18659
|
}
|
|
18513
18660
|
var ExpoSwiftLinkRefusal = class extends Error {
|
|
18514
18661
|
};
|
|
@@ -18624,7 +18771,7 @@ async function compileExpoSwiftModules(root, base, publishArtifact, options = {}
|
|
|
18624
18771
|
(source) => swiftImportNames(source, importedAvailable)
|
|
18625
18772
|
)
|
|
18626
18773
|
);
|
|
18627
|
-
const reached = binaries.filter((item) => item.modules.some((
|
|
18774
|
+
const reached = binaries.filter((item) => item.modules.some((name3) => imports.has(name3))).map((item) => item.binary);
|
|
18628
18775
|
if (reached.length > 0) {
|
|
18629
18776
|
const toolchain = {
|
|
18630
18777
|
moduleRoot: module2.root,
|
|
@@ -18636,9 +18783,9 @@ async function compileExpoSwiftModules(root, base, publishArtifact, options = {}
|
|
|
18636
18783
|
const linkedLibraries = standinLibraries(reached, built2.standins, root);
|
|
18637
18784
|
const linkedStandins = new Set([...linkedLibraries.values()].flat());
|
|
18638
18785
|
for (const standin of built2.standins)
|
|
18639
|
-
for (const [
|
|
18640
|
-
const file = `${SWIFT_STANDINS_DIR}/${standin.module}/${
|
|
18641
|
-
const text4 = linkedStandins.has(standin) &&
|
|
18786
|
+
for (const [name3, source] of Object.entries(standin.files)) {
|
|
18787
|
+
const file = `${SWIFT_STANDINS_DIR}/${standin.module}/${name3}`;
|
|
18788
|
+
const text4 = linkedStandins.has(standin) && name3 === `${standin.module}.c` ? `// ${standin.target}'s WebAssembly library defines ${standin.module}'s functions.
|
|
18642
18789
|
` : source;
|
|
18643
18790
|
if (file in unit2.files && unit2.files[file] !== text4)
|
|
18644
18791
|
throw new Error(`conflicting Expo Swift binary source ${file}`);
|
|
@@ -18657,7 +18804,7 @@ async function compileExpoSwiftModules(root, base, publishArtifact, options = {}
|
|
|
18657
18804
|
generations.set(unit2, generation);
|
|
18658
18805
|
gaps.set(
|
|
18659
18806
|
unit2,
|
|
18660
|
-
[...built2.gaps].map(([
|
|
18807
|
+
[...built2.gaps].map(([name3, reason]) => `${name3}: no stand-in: ${reason}`)
|
|
18661
18808
|
);
|
|
18662
18809
|
unit2.files["Package.swift"] = expoManifest(
|
|
18663
18810
|
unit2.files,
|
|
@@ -18670,8 +18817,8 @@ async function compileExpoSwiftModules(root, base, publishArtifact, options = {}
|
|
|
18670
18817
|
syncSwiftTree(
|
|
18671
18818
|
packagePath,
|
|
18672
18819
|
new Map(
|
|
18673
|
-
Object.entries(unit2.files).map(([
|
|
18674
|
-
import_node_path22.default.join(packagePath,
|
|
18820
|
+
Object.entries(unit2.files).map(([name3, source]) => [
|
|
18821
|
+
import_node_path22.default.join(packagePath, name3),
|
|
18675
18822
|
source
|
|
18676
18823
|
])
|
|
18677
18824
|
)
|
|
@@ -18698,10 +18845,10 @@ async function compileExpoSwiftModules(root, base, publishArtifact, options = {}
|
|
|
18698
18845
|
const link = async (linked2) => {
|
|
18699
18846
|
const files2 = {};
|
|
18700
18847
|
for (const unit2 of linked2)
|
|
18701
|
-
for (const [
|
|
18702
|
-
if (
|
|
18703
|
-
throw new Error(`conflicting Expo Swift binary source ${
|
|
18704
|
-
files2[
|
|
18848
|
+
for (const [name3, source] of Object.entries(unit2.files)) {
|
|
18849
|
+
if (name3.startsWith(`${SWIFT_STANDINS_DIR}/`) && name3 in files2 && files2[name3] !== source)
|
|
18850
|
+
throw new Error(`conflicting Expo Swift binary source ${name3}`);
|
|
18851
|
+
files2[name3] = source;
|
|
18705
18852
|
}
|
|
18706
18853
|
files2[EXPO_SWIFT_ENTRY] = expoEntry(linked2);
|
|
18707
18854
|
files2["Package.swift"] = expoManifest(
|
|
@@ -18713,18 +18860,18 @@ async function compileExpoSwiftModules(root, base, publishArtifact, options = {}
|
|
|
18713
18860
|
syncSwiftTree(
|
|
18714
18861
|
packagePath,
|
|
18715
18862
|
new Map(
|
|
18716
|
-
Object.entries(files2).map(([
|
|
18717
|
-
import_node_path22.default.join(packagePath,
|
|
18863
|
+
Object.entries(files2).map(([name3, source]) => [
|
|
18864
|
+
import_node_path22.default.join(packagePath, name3),
|
|
18718
18865
|
source
|
|
18719
18866
|
])
|
|
18720
18867
|
)
|
|
18721
18868
|
);
|
|
18722
18869
|
const linkedLibraries = /* @__PURE__ */ new Map();
|
|
18723
18870
|
for (const unit2 of linked2)
|
|
18724
|
-
for (const [
|
|
18725
|
-
if (linkedLibraries.has(
|
|
18726
|
-
throw new Error(`conflicting Expo Swift binary libraries for ${
|
|
18727
|
-
linkedLibraries.set(
|
|
18871
|
+
for (const [name3, library] of Object.entries(libraries.get(unit2) ?? {})) {
|
|
18872
|
+
if (linkedLibraries.has(name3) && linkedLibraries.get(name3) !== library)
|
|
18873
|
+
throw new Error(`conflicting Expo Swift binary libraries for ${name3}`);
|
|
18874
|
+
linkedLibraries.set(name3, library);
|
|
18728
18875
|
}
|
|
18729
18876
|
projectFor(packagePath).libraries = linkedLibraries.size > 0 ? Object.fromEntries(linkedLibraries) : void 0;
|
|
18730
18877
|
signal.throwIfAborted();
|
|
@@ -18828,7 +18975,7 @@ async function compileExpoSwiftModules(root, base, publishArtifact, options = {}
|
|
|
18828
18975
|
);
|
|
18829
18976
|
const dropped = linked.filter(
|
|
18830
18977
|
(unit2) => Object.values(unit2.files).some(
|
|
18831
|
-
(source) => swiftImportNames(source).some((
|
|
18978
|
+
(source) => swiftImportNames(source).some((name3) => missing.has(name3))
|
|
18832
18979
|
)
|
|
18833
18980
|
);
|
|
18834
18981
|
if (dropped.length === 0) throw error;
|