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") {
|
|
@@ -151,9 +151,9 @@ function cacheDir() {
|
|
|
151
151
|
}
|
|
152
152
|
function swiftPackageCacheOptions() {
|
|
153
153
|
const root = import_node_path.default.join(cacheDir(), "swiftpm");
|
|
154
|
-
return ["cache", "config", "security"].flatMap((
|
|
155
|
-
`--${
|
|
156
|
-
import_node_path.default.join(root,
|
|
154
|
+
return ["cache", "config", "security"].flatMap((name3) => [
|
|
155
|
+
`--${name3}-path`,
|
|
156
|
+
import_node_path.default.join(root, name3)
|
|
157
157
|
]);
|
|
158
158
|
}
|
|
159
159
|
function daemonLockfilePath() {
|
|
@@ -842,7 +842,7 @@ function buildBrowserAssetProxyUrl(targetUrl) {
|
|
|
842
842
|
}
|
|
843
843
|
function isContrastBackendHost(hostname) {
|
|
844
844
|
const normalized = normalizeHostname(hostname);
|
|
845
|
-
return isLoopbackHost(normalized) || normalized === "contrast.dev" || normalized.endsWith(".contrast.dev") || normalized === PEACHSIM_NATIVE_HOST;
|
|
845
|
+
return isLoopbackHost(normalized) || normalized === "contrast.dev" || normalized.endsWith(".contrast.dev") || normalized === "peachsim.com" || normalized === "www.peachsim.com" || normalized === PEACHSIM_NATIVE_HOST;
|
|
846
846
|
}
|
|
847
847
|
function resolveContrastBackendOrigin(currentOrigin, search) {
|
|
848
848
|
const origin = new URLSearchParams(search ?? "").get("backend")?.trim() || currentOrigin?.trim();
|
|
@@ -858,7 +858,7 @@ var DEFAULT_CONTRAST_BACKEND_ORIGIN, LOOPBACK_PROBE_HOSTNAMES, PEACHSIM_NATIVE_H
|
|
|
858
858
|
var init_backend_origin = __esm({
|
|
859
859
|
"src/backend-origin.ts"() {
|
|
860
860
|
"use strict";
|
|
861
|
-
DEFAULT_CONTRAST_BACKEND_ORIGIN = "https://
|
|
861
|
+
DEFAULT_CONTRAST_BACKEND_ORIGIN = "https://peachsim.com";
|
|
862
862
|
LOOPBACK_PROBE_HOSTNAMES = ["127.0.0.1", "::1"];
|
|
863
863
|
PEACHSIM_NATIVE_HOST = "native.peachsim.com";
|
|
864
864
|
}
|
|
@@ -1059,8 +1059,8 @@ var require_build = __commonJS({
|
|
|
1059
1059
|
}
|
|
1060
1060
|
function walk_obj(next, next_child) {
|
|
1061
1061
|
var tag_type, i, prop;
|
|
1062
|
-
var
|
|
1063
|
-
if ("Undefined" ==
|
|
1062
|
+
var name3 = type(next);
|
|
1063
|
+
if ("Undefined" == name3) {
|
|
1064
1064
|
return;
|
|
1065
1065
|
} else if (Array.isArray(next)) {
|
|
1066
1066
|
next_child = next_child.ele("array");
|
|
@@ -1069,7 +1069,7 @@ var require_build = __commonJS({
|
|
|
1069
1069
|
}
|
|
1070
1070
|
} else if (Buffer.isBuffer(next)) {
|
|
1071
1071
|
next_child.ele("data").raw(next.toString("base64"));
|
|
1072
|
-
} else if ("Object" ==
|
|
1072
|
+
} else if ("Object" == name3) {
|
|
1073
1073
|
next_child = next_child.ele("dict");
|
|
1074
1074
|
for (prop in next) {
|
|
1075
1075
|
if (next.hasOwnProperty(prop)) {
|
|
@@ -1077,22 +1077,22 @@ var require_build = __commonJS({
|
|
|
1077
1077
|
walk_obj(next[prop], next_child);
|
|
1078
1078
|
}
|
|
1079
1079
|
}
|
|
1080
|
-
} else if ("Number" ==
|
|
1080
|
+
} else if ("Number" == name3) {
|
|
1081
1081
|
tag_type = next % 1 === 0 ? "integer" : "real";
|
|
1082
1082
|
next_child.ele(tag_type).txt(next.toString());
|
|
1083
|
-
} else if ("BigInt" ==
|
|
1083
|
+
} else if ("BigInt" == name3) {
|
|
1084
1084
|
next_child.ele("integer").txt(next);
|
|
1085
|
-
} else if ("Date" ==
|
|
1085
|
+
} else if ("Date" == name3) {
|
|
1086
1086
|
next_child.ele("date").txt(ISODateString(new Date(next)));
|
|
1087
|
-
} else if ("Boolean" ==
|
|
1087
|
+
} else if ("Boolean" == name3) {
|
|
1088
1088
|
next_child.ele(next ? "true" : "false");
|
|
1089
|
-
} else if ("String" ==
|
|
1089
|
+
} else if ("String" == name3) {
|
|
1090
1090
|
next_child.ele("string").txt(next);
|
|
1091
|
-
} else if ("ArrayBuffer" ==
|
|
1091
|
+
} else if ("ArrayBuffer" == name3) {
|
|
1092
1092
|
next_child.ele("data").raw(base64.fromByteArray(next));
|
|
1093
1093
|
} else if (next && next.buffer && "ArrayBuffer" == type(next.buffer)) {
|
|
1094
1094
|
next_child.ele("data").raw(base64.fromByteArray(new Uint8Array(next.buffer), next_child));
|
|
1095
|
-
} else if ("Null" ===
|
|
1095
|
+
} else if ("Null" === name3) {
|
|
1096
1096
|
next_child.ele("null").txt("");
|
|
1097
1097
|
}
|
|
1098
1098
|
}
|
|
@@ -1178,8 +1178,8 @@ var require_parse2 = __commonJS({
|
|
|
1178
1178
|
}
|
|
1179
1179
|
return root;
|
|
1180
1180
|
};
|
|
1181
|
-
function internalize(holder,
|
|
1182
|
-
const value = holder[
|
|
1181
|
+
function internalize(holder, name3, reviver) {
|
|
1182
|
+
const value = holder[name3];
|
|
1183
1183
|
if (value != null && typeof value === "object") {
|
|
1184
1184
|
if (Array.isArray(value)) {
|
|
1185
1185
|
for (let i = 0; i < value.length; i++) {
|
|
@@ -1212,7 +1212,7 @@ var require_parse2 = __commonJS({
|
|
|
1212
1212
|
}
|
|
1213
1213
|
}
|
|
1214
1214
|
}
|
|
1215
|
-
return reviver.call(holder,
|
|
1215
|
+
return reviver.call(holder, name3, value);
|
|
1216
1216
|
}
|
|
1217
1217
|
var lexState;
|
|
1218
1218
|
var buffer;
|
|
@@ -2475,39 +2475,39 @@ function findBundleFooter(source, prefix) {
|
|
|
2475
2475
|
function isFooterBlockLine(source, line, end) {
|
|
2476
2476
|
return line === end || source.startsWith("globalThis.", line) || source.startsWith("//", line);
|
|
2477
2477
|
}
|
|
2478
|
-
function readFooter(source, prefix, suffix,
|
|
2478
|
+
function readFooter(source, prefix, suffix, name3) {
|
|
2479
2479
|
const start = findBundleFooter(source, prefix);
|
|
2480
2480
|
if (start < 0) return null;
|
|
2481
2481
|
const end = source.indexOf("\n", start + 1);
|
|
2482
2482
|
const line = source.slice(start + 1, end < 0 ? void 0 : end);
|
|
2483
|
-
if (!line.endsWith(suffix)) throw new Error(`${
|
|
2483
|
+
if (!line.endsWith(suffix)) throw new Error(`${name3} footer is truncated`);
|
|
2484
2484
|
const value = JSON.parse(
|
|
2485
2485
|
line.slice(prefix.length, suffix ? -suffix.length : void 0)
|
|
2486
2486
|
);
|
|
2487
|
-
if (value === null) throw new Error(`${
|
|
2487
|
+
if (value === null) throw new Error(`${name3} footer has no metadata`);
|
|
2488
2488
|
return value;
|
|
2489
2489
|
}
|
|
2490
|
-
function readBundleMetadataFooter(source,
|
|
2491
|
-
return readFooter(source, `// peach.${
|
|
2490
|
+
function readBundleMetadataFooter(source, name3) {
|
|
2491
|
+
return readFooter(source, `// peach.${name3}=`, "", name3);
|
|
2492
2492
|
}
|
|
2493
|
-
function detachBundleGlobalFooter(source,
|
|
2494
|
-
return detachFooter(source, `globalThis.${
|
|
2493
|
+
function detachBundleGlobalFooter(source, name3) {
|
|
2494
|
+
return detachFooter(source, `globalThis.${name3}=`, ";", name3);
|
|
2495
2495
|
}
|
|
2496
|
-
function detachFooter(source, prefix, suffix,
|
|
2496
|
+
function detachFooter(source, prefix, suffix, name3) {
|
|
2497
2497
|
const start = findBundleFooter(source, prefix);
|
|
2498
2498
|
if (start < 0) return { source, value: null };
|
|
2499
|
-
const value = readFooter(source, prefix, suffix,
|
|
2499
|
+
const value = readFooter(source, prefix, suffix, name3);
|
|
2500
2500
|
const end = source.indexOf("\n", start + 1);
|
|
2501
2501
|
return { source: source.slice(0, start) + (end < 0 ? "" : source.slice(end)), value };
|
|
2502
2502
|
}
|
|
2503
|
-
function insertBundleGlobalFooter(source,
|
|
2504
|
-
return insertFooter(source, `globalThis.${
|
|
2503
|
+
function insertBundleGlobalFooter(source, name3, value) {
|
|
2504
|
+
return insertFooter(source, `globalThis.${name3}=`, ";", name3, value);
|
|
2505
2505
|
}
|
|
2506
|
-
function insertBundleMetadataFooter(source,
|
|
2507
|
-
return insertFooter(source, `// peach.${
|
|
2506
|
+
function insertBundleMetadataFooter(source, name3, value) {
|
|
2507
|
+
return insertFooter(source, `// peach.${name3}=`, "", name3, value);
|
|
2508
2508
|
}
|
|
2509
|
-
function insertFooter(source, prefix, suffix,
|
|
2510
|
-
source = detachFooter(source, prefix, suffix,
|
|
2509
|
+
function insertFooter(source, prefix, suffix, name3, value) {
|
|
2510
|
+
source = detachFooter(source, prefix, suffix, name3).source;
|
|
2511
2511
|
const json = JSON.stringify(value).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029").replace(/<\//g, "<\\/");
|
|
2512
2512
|
const footer = `
|
|
2513
2513
|
${prefix}${json}${suffix}`;
|
|
@@ -2584,7 +2584,7 @@ var init_standalone = __esm({
|
|
|
2584
2584
|
|
|
2585
2585
|
// src/androidAutolinkingContract.ts
|
|
2586
2586
|
function readAndroidAutolinkedPackages(value) {
|
|
2587
|
-
if (!Array.isArray(value) || !value.every((
|
|
2587
|
+
if (!Array.isArray(value) || !value.every((name3) => typeof name3 === "string" && name3.length > 0))
|
|
2588
2588
|
throw new Error("invalid Android autolinked packages");
|
|
2589
2589
|
return [...new Set(value)].sort((left, right) => left.localeCompare(right));
|
|
2590
2590
|
}
|
|
@@ -2684,8 +2684,8 @@ function peachKotlinModuleRoot() {
|
|
|
2684
2684
|
if (!import_node_fs40.default.existsSync(root)) {
|
|
2685
2685
|
const pending = import_node_fs40.default.mkdtempSync(import_node_path39.default.join(parent, ".install-"));
|
|
2686
2686
|
try {
|
|
2687
|
-
for (const [
|
|
2688
|
-
const file = import_node_path39.default.join(pending,
|
|
2687
|
+
for (const [name3, contents] of Object.entries(files2)) {
|
|
2688
|
+
const file = import_node_path39.default.join(pending, name3);
|
|
2689
2689
|
import_node_fs40.default.mkdirSync(import_node_path39.default.dirname(file), { recursive: true });
|
|
2690
2690
|
import_node_fs40.default.writeFileSync(file, contents);
|
|
2691
2691
|
}
|
|
@@ -2699,9 +2699,9 @@ function peachKotlinModuleRoot() {
|
|
|
2699
2699
|
import_node_fs40.default.rmSync(pending, { recursive: true, force: true });
|
|
2700
2700
|
}
|
|
2701
2701
|
}
|
|
2702
|
-
for (const [
|
|
2703
|
-
if (import_node_fs40.default.readFileSync(import_node_path39.default.join(root,
|
|
2704
|
-
throw new Error(`packaged Kotlin module differs from this CLI: ${
|
|
2702
|
+
for (const [name3, contents] of Object.entries(files2)) {
|
|
2703
|
+
if (import_node_fs40.default.readFileSync(import_node_path39.default.join(root, name3), "utf8") !== contents)
|
|
2704
|
+
throw new Error(`packaged Kotlin module differs from this CLI: ${name3}`);
|
|
2705
2705
|
}
|
|
2706
2706
|
installedRoot = root;
|
|
2707
2707
|
return root;
|
|
@@ -2770,11 +2770,11 @@ function signatureOf(row, android) {
|
|
|
2770
2770
|
function viewModelClasses(rows) {
|
|
2771
2771
|
const byName = new Map(rows.map((row) => [row.name, row]));
|
|
2772
2772
|
const base = (row, seen) => {
|
|
2773
|
-
for (const
|
|
2774
|
-
if (
|
|
2775
|
-
const parent = byName.get(
|
|
2776
|
-
if (parent && !seen.has(
|
|
2777
|
-
seen.add(
|
|
2773
|
+
for (const name3 of row.supers) {
|
|
2774
|
+
if (name3 === VIEW_MODEL || name3 === ANDROID_VIEW_MODEL) return name3;
|
|
2775
|
+
const parent = byName.get(name3);
|
|
2776
|
+
if (parent && !seen.has(name3)) {
|
|
2777
|
+
seen.add(name3);
|
|
2778
2778
|
const found = base(parent, seen);
|
|
2779
2779
|
if (found) return found;
|
|
2780
2780
|
}
|
|
@@ -2951,11 +2951,11 @@ function ensureCompilerPlugin(kotlinc, plugin) {
|
|
|
2951
2951
|
const classes = import_node_path40.default.join(work, "classes");
|
|
2952
2952
|
try {
|
|
2953
2953
|
const sources = [];
|
|
2954
|
-
for (const { name:
|
|
2955
|
-
const target = import_node_path40.default.join(work, "sources",
|
|
2954
|
+
for (const { name: name3, bytes } of plugin.files) {
|
|
2955
|
+
const target = import_node_path40.default.join(work, "sources", name3);
|
|
2956
2956
|
import_node_fs41.default.mkdirSync(import_node_path40.default.dirname(target), { recursive: true });
|
|
2957
2957
|
import_node_fs41.default.writeFileSync(target, bytes);
|
|
2958
|
-
if (
|
|
2958
|
+
if (name3.endsWith(".kt")) sources.push(target);
|
|
2959
2959
|
}
|
|
2960
2960
|
await run4(
|
|
2961
2961
|
import_node_path40.default.join(import_node_path40.default.dirname(kotlinc), "kotlinc"),
|
|
@@ -3181,11 +3181,11 @@ function expoTypeSources(files2) {
|
|
|
3181
3181
|
);
|
|
3182
3182
|
continue;
|
|
3183
3183
|
}
|
|
3184
|
-
const
|
|
3184
|
+
const name3 = literal(field.key);
|
|
3185
3185
|
const read = `{ record: ${record2.name} -> record.${field.name} }`;
|
|
3186
3186
|
const write = field.mutable && !field.initializer ? `{ record, value -> record.${field.name} = value }` : "null";
|
|
3187
3187
|
fields.push(
|
|
3188
|
-
` dev.peach.expo.PeachExpoTypes.field(${
|
|
3188
|
+
` dev.peach.expo.PeachExpoTypes.field(${name3}, ${field.required}, ${read}, ${write}),`
|
|
3189
3189
|
);
|
|
3190
3190
|
}
|
|
3191
3191
|
if (record2.hidden) continue;
|
|
@@ -3239,9 +3239,9 @@ function expoTypeSources(files2) {
|
|
|
3239
3239
|
`${file.package ? `${file.package}.` : ""}peachExpoViews${index}()`
|
|
3240
3240
|
);
|
|
3241
3241
|
}
|
|
3242
|
-
const
|
|
3243
|
-
generated[
|
|
3244
|
-
origins[
|
|
3242
|
+
const name3 = `PeachExpoSource_${index}_${import_node_path40.default.basename(file.file)}`;
|
|
3243
|
+
generated[name3] = text4;
|
|
3244
|
+
origins[name3] = file.file;
|
|
3245
3245
|
}
|
|
3246
3246
|
if (calls.length === 0) return;
|
|
3247
3247
|
generated[`PeachExpoTypes_${index}.kt`] = [
|
|
@@ -3288,7 +3288,7 @@ async function expoKotlinArtifact(root, moduleRoot, origin, modules) {
|
|
|
3288
3288
|
...types.registrations.map((call) => ` ${call}`),
|
|
3289
3289
|
" PeachExpoRuntime.register(listOf(",
|
|
3290
3290
|
...modules.modules.map(
|
|
3291
|
-
({ classifier, name:
|
|
3291
|
+
({ classifier, name: name3 }) => ` { ${classifier}() } to ${name3 === null ? "null" : JSON.stringify(name3)},`
|
|
3292
3292
|
),
|
|
3293
3293
|
" ))",
|
|
3294
3294
|
"}",
|
|
@@ -3334,8 +3334,8 @@ function viewsSource(viewIds) {
|
|
|
3334
3334
|
"}"
|
|
3335
3335
|
].join("\n");
|
|
3336
3336
|
}
|
|
3337
|
-
function viewModelInitializer({ name:
|
|
3338
|
-
const call = (args) => ` addInitializer(${
|
|
3337
|
+
function viewModelInitializer({ name: name3, signature }) {
|
|
3338
|
+
const call = (args) => ` addInitializer(${name3}::class) { ${name3}(${args}) }`;
|
|
3339
3339
|
switch (signature) {
|
|
3340
3340
|
case "none":
|
|
3341
3341
|
return call("");
|
|
@@ -3346,8 +3346,8 @@ function viewModelInitializer({ name: name2, signature }) {
|
|
|
3346
3346
|
case "application-handle":
|
|
3347
3347
|
return call("dev.peach.app.peachApplication(), createSavedStateHandle()");
|
|
3348
3348
|
case "misordered":
|
|
3349
|
-
return ` addInitializer(${
|
|
3350
|
-
`Class ${
|
|
3349
|
+
return ` addInitializer(${name3}::class) { throw UnsupportedOperationException(${JSON.stringify(
|
|
3350
|
+
`Class ${name3.split(".").pop()} must have parameters in the proper order: [class android.app.Application, class androidx.lifecycle.SavedStateHandle]`
|
|
3351
3351
|
)}) }`;
|
|
3352
3352
|
}
|
|
3353
3353
|
}
|
|
@@ -3442,7 +3442,7 @@ async function kotlinAppArtifact(app, moduleRoot, origin) {
|
|
|
3442
3442
|
);
|
|
3443
3443
|
}
|
|
3444
3444
|
function appResourceSources(app) {
|
|
3445
|
-
const field = (
|
|
3445
|
+
const field = (name3) => `\`${name3.replace(/[.-]/g, "_")}\``;
|
|
3446
3446
|
const id = (type, entry) => `0x7f${type.toString(16).padStart(2, "0")}${entry.toString(16).padStart(4, "0")}`;
|
|
3447
3447
|
const localized = (resources, render) => resources.map((resource) => ({
|
|
3448
3448
|
name: resource.name,
|
|
@@ -3528,7 +3528,7 @@ ${drawable.files.map((file) => drawableInit(file, import_node_path40.default.rel
|
|
|
3528
3528
|
"androidx.compose.ui.graphics.vector.ImageVector",
|
|
3529
3529
|
"androidx.compose.ui.graphics.vector.addPathNodes",
|
|
3530
3530
|
"androidx.compose.ui.unit.Dp"
|
|
3531
|
-
].map((
|
|
3531
|
+
].map((name3) => `import ${name3}`),
|
|
3532
3532
|
"",
|
|
3533
3533
|
...kinds.flatMap((kind) => [
|
|
3534
3534
|
`internal val ${kind.table}: Map<Int, ${kind.value}> = mapOf(`,
|
|
@@ -3611,15 +3611,15 @@ async function compileKotlin(input, origin) {
|
|
|
3611
3611
|
(file) => import_node_path40.default.relative(compilerRoot, file)
|
|
3612
3612
|
),
|
|
3613
3613
|
COMPILER_PLUGIN_SERVICE
|
|
3614
|
-
].map((
|
|
3615
|
-
name:
|
|
3616
|
-
bytes: import_node_fs41.default.readFileSync(import_node_path40.default.join(compilerRoot,
|
|
3614
|
+
].map((name3) => ({
|
|
3615
|
+
name: name3,
|
|
3616
|
+
bytes: import_node_fs41.default.readFileSync(import_node_path40.default.join(compilerRoot, name3))
|
|
3617
3617
|
}));
|
|
3618
3618
|
const compilerDigest = (0, import_node_crypto22.createHash)("sha256").update(
|
|
3619
3619
|
JSON.stringify({ format: 1, compiler: toolchain.compiler })
|
|
3620
3620
|
);
|
|
3621
|
-
for (const { name:
|
|
3622
|
-
compilerDigest.update(
|
|
3621
|
+
for (const { name: name3, bytes } of compilerFiles)
|
|
3622
|
+
compilerDigest.update(name3).update("\0").update(bytes).update("\0");
|
|
3623
3623
|
const plugin = { hash: compilerDigest.digest("hex"), files: compilerFiles };
|
|
3624
3624
|
const inputs = [...shims, ...sources].map((file) => ({
|
|
3625
3625
|
file,
|
|
@@ -3632,8 +3632,8 @@ async function compileKotlin(input, origin) {
|
|
|
3632
3632
|
for (const { file, bytes } of inputs)
|
|
3633
3633
|
digest2.update(import_node_path40.default.relative(root, file)).update("\0").update(bytes).update("\0");
|
|
3634
3634
|
if (viewModels) digest2.update(import_node_fs41.default.readFileSync(viewModels.script));
|
|
3635
|
-
for (const [
|
|
3636
|
-
digest2.update(`${
|
|
3635
|
+
for (const [name3, text4] of Object.entries(generated))
|
|
3636
|
+
digest2.update(`${name3}\0${text4}\0`);
|
|
3637
3637
|
const hash = digest2.digest("hex").slice(0, 24);
|
|
3638
3638
|
const artifact = {
|
|
3639
3639
|
url: `${origin}${KOTLIN_ARTIFACT_PREFIX}${hash}/app.mjs`,
|
|
@@ -3665,8 +3665,8 @@ async function compileKotlin(input, origin) {
|
|
|
3665
3665
|
const work = import_node_fs41.default.mkdtempSync(import_node_path40.default.join(buildsDir(), `${hash}-`));
|
|
3666
3666
|
const generatedDir = import_node_path40.default.join(work, "generated");
|
|
3667
3667
|
import_node_fs41.default.mkdirSync(generatedDir);
|
|
3668
|
-
for (const [
|
|
3669
|
-
import_node_fs41.default.writeFileSync(import_node_path40.default.join(generatedDir,
|
|
3668
|
+
for (const [name3, text4] of Object.entries(generated))
|
|
3669
|
+
import_node_fs41.default.writeFileSync(import_node_path40.default.join(generatedDir, name3), text4);
|
|
3670
3670
|
const compiledSources = inputs.map(({ file, bytes }, index) => {
|
|
3671
3671
|
const target = import_node_path40.default.join(work, "sources", String(index), import_node_path40.default.basename(file));
|
|
3672
3672
|
import_node_fs41.default.mkdirSync(import_node_path40.default.dirname(target), { recursive: true });
|
|
@@ -3700,7 +3700,7 @@ async function compileKotlin(input, origin) {
|
|
|
3700
3700
|
"-ir-output-name",
|
|
3701
3701
|
"app",
|
|
3702
3702
|
...compiledSources.map(({ target }) => target),
|
|
3703
|
-
...Object.keys(generated).map((
|
|
3703
|
+
...Object.keys(generated).map((name3) => import_node_path40.default.join(generatedDir, name3))
|
|
3704
3704
|
],
|
|
3705
3705
|
{ maxBuffer: 16 * 1024 * 1024 }
|
|
3706
3706
|
);
|
|
@@ -3779,7 +3779,7 @@ async function compileKotlin(input, origin) {
|
|
|
3779
3779
|
"const runtime = globalThis.__peachKotlinSkiko;",
|
|
3780
3780
|
"if (!runtime) throw Error('Kotlin tenant runtime was not installed before guest evaluation');",
|
|
3781
3781
|
`for (const name of ${JSON.stringify(names)}) if (!(name in runtime)) throw Error('Kotlin tenant runtime has no ' + name);`,
|
|
3782
|
-
...names.map((
|
|
3782
|
+
...names.map((name3) => `export const ${name3} = runtime.${name3};`),
|
|
3783
3783
|
""
|
|
3784
3784
|
].join("\n")
|
|
3785
3785
|
);
|
|
@@ -3817,8 +3817,8 @@ async function compileKotlin(input, origin) {
|
|
|
3817
3817
|
} catch (error) {
|
|
3818
3818
|
import_node_fs41.default.rmSync(work, { recursive: true, force: true });
|
|
3819
3819
|
let output = isRecord(error) ? `${String(error.stderr ?? "")}${String(error.stdout ?? "")}` : "";
|
|
3820
|
-
for (const [
|
|
3821
|
-
output = output.replaceAll(import_node_path40.default.join(generatedDir,
|
|
3820
|
+
for (const [name3, source] of Object.entries(origins))
|
|
3821
|
+
output = output.replaceAll(import_node_path40.default.join(generatedDir, name3), source);
|
|
3822
3822
|
for (const { file, target } of compiledSources)
|
|
3823
3823
|
output = output.replaceAll(target, file).replaceAll(import_node_path40.default.relative(process.cwd(), target), file);
|
|
3824
3824
|
throw new Error(
|
|
@@ -3866,10 +3866,10 @@ ${output.trim() || (error instanceof Error ? error.message : String(error))}`
|
|
|
3866
3866
|
}
|
|
3867
3867
|
function kotlinArtifactFiles(hash) {
|
|
3868
3868
|
const dir = import_node_path40.default.join(buildsDir(), hash, "js");
|
|
3869
|
-
return import_node_fs41.default.readdirSync(dir).sort().map((
|
|
3870
|
-
const contentType2 = CONTENT_TYPES[import_node_path40.default.extname(
|
|
3871
|
-
if (!contentType2) throw new Error(`unexpected kotlin artifact file ${
|
|
3872
|
-
return { name:
|
|
3869
|
+
return import_node_fs41.default.readdirSync(dir).sort().map((name3) => {
|
|
3870
|
+
const contentType2 = CONTENT_TYPES[import_node_path40.default.extname(name3)];
|
|
3871
|
+
if (!contentType2) throw new Error(`unexpected kotlin artifact file ${name3}`);
|
|
3872
|
+
return { name: name3, bytes: import_node_fs41.default.readFileSync(import_node_path40.default.join(dir, name3)), contentType: contentType2 };
|
|
3873
3873
|
});
|
|
3874
3874
|
}
|
|
3875
3875
|
function serveKotlinArtifact(pathname, res) {
|
|
@@ -4280,10 +4280,10 @@ function iosDevice(spec) {
|
|
|
4280
4280
|
modelName: profile.name
|
|
4281
4281
|
};
|
|
4282
4282
|
}
|
|
4283
|
-
function ipadProDevice(model,
|
|
4283
|
+
function ipadProDevice(model, name3, width, height, diagonalInches) {
|
|
4284
4284
|
return iosDevice({
|
|
4285
4285
|
model,
|
|
4286
|
-
name:
|
|
4286
|
+
name: name3,
|
|
4287
4287
|
// iPad Pro 11-inch (M5) 12GB, iOS 27.0, simulator DBD4B183, UIKit probe
|
|
4288
4288
|
// scenario `metrics`. portrait UIScreen.bounds 834×1210, scale 2,
|
|
4289
4289
|
// nativeBounds 1668×2420. the window matched the screen.
|
|
@@ -4308,7 +4308,7 @@ function ipadProDevice(model, name2, width, height, diagonalInches) {
|
|
|
4308
4308
|
safeAreaInsets: { top: 32, bottom: 20, left: 0, right: 0 },
|
|
4309
4309
|
// portrait docked keyboard, UIKeyboardFrameEndUserInfoKey
|
|
4310
4310
|
// {0, 870, 834, 340}. landscape posted a zero-height frame.
|
|
4311
|
-
keyboardPanelHeights: { qwerty:
|
|
4311
|
+
keyboardPanelHeights: { qwerty: 340, pad: 340, emoji: 427 },
|
|
4312
4312
|
// hypot(1668, 2420) / 11, measured native pixels over the device type's
|
|
4313
4313
|
// 11-inch name. not a separate density read.
|
|
4314
4314
|
physicalPPI: Math.hypot(width * 2, height * 2) / diagonalInches,
|
|
@@ -5486,13 +5486,13 @@ function readDescriptorObject(text4, start, end, pairSpans) {
|
|
|
5486
5486
|
cursor++;
|
|
5487
5487
|
}
|
|
5488
5488
|
const httpServerLocation = strings2.httpServerLocation;
|
|
5489
|
-
const
|
|
5489
|
+
const name3 = strings2.name;
|
|
5490
5490
|
const type = strings2.type;
|
|
5491
|
-
if (!httpServerLocation && !
|
|
5492
|
-
if (!httpServerLocation || !
|
|
5491
|
+
if (!httpServerLocation && !name3 && !type) return "resolved-source";
|
|
5492
|
+
if (!httpServerLocation || !name3 || !type) return null;
|
|
5493
5493
|
const descriptor = {
|
|
5494
5494
|
httpServerLocation,
|
|
5495
|
-
name:
|
|
5495
|
+
name: name3,
|
|
5496
5496
|
type,
|
|
5497
5497
|
hash: strings2.hash ?? "",
|
|
5498
5498
|
scales: scales?.filter((value) => value > 0) ?? [1]
|
|
@@ -5811,9 +5811,9 @@ async function separateMetroArtifactAssets(bundle) {
|
|
|
5811
5811
|
pieces.push(bundle.slice(cursor));
|
|
5812
5812
|
return { code: pieces.join(""), assets: assets2, resources: [...resources.values()] };
|
|
5813
5813
|
}
|
|
5814
|
-
function metroAssetScaleFilename(
|
|
5814
|
+
function metroAssetScaleFilename(name3, type, scale) {
|
|
5815
5815
|
const suffix = scale === 1 ? "" : `@${scale}x`;
|
|
5816
|
-
return `${
|
|
5816
|
+
return `${name3}${suffix}.${type}`;
|
|
5817
5817
|
}
|
|
5818
5818
|
function dropDotSegments(relative2) {
|
|
5819
5819
|
return relative2.split("/").filter((part) => part !== "" && part !== "." && part !== "..").join("/");
|
|
@@ -6061,11 +6061,11 @@ function readPackageVersions(value) {
|
|
|
6061
6061
|
throw new Error("invalid package versions");
|
|
6062
6062
|
}
|
|
6063
6063
|
const versions = {};
|
|
6064
|
-
for (const [
|
|
6065
|
-
if (
|
|
6064
|
+
for (const [name3, version] of Object.entries(value)) {
|
|
6065
|
+
if (name3.length === 0 || typeof version !== "string" || version.length === 0) {
|
|
6066
6066
|
throw new Error("invalid package versions");
|
|
6067
6067
|
}
|
|
6068
|
-
versions[
|
|
6068
|
+
versions[name3] = version;
|
|
6069
6069
|
}
|
|
6070
6070
|
return versions;
|
|
6071
6071
|
}
|
|
@@ -6100,8 +6100,8 @@ function readHostVersionEvidence(source) {
|
|
|
6100
6100
|
if (typeof outputRevision !== "number" || !Number.isSafeInteger(outputRevision) || outputRevision < 1 || typeof entries !== "object" || entries === null || Array.isArray(entries))
|
|
6101
6101
|
throw new Error("invalid host version evidence");
|
|
6102
6102
|
const packages = {};
|
|
6103
|
-
for (const [
|
|
6104
|
-
if (!/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/i.test(
|
|
6103
|
+
for (const [name3, decision] of Object.entries(entries)) {
|
|
6104
|
+
if (!/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/i.test(name3) || typeof decision !== "object" || decision === null || Array.isArray(decision))
|
|
6105
6105
|
throw new Error("invalid host version evidence");
|
|
6106
6106
|
const status = Reflect.get(decision, "status");
|
|
6107
6107
|
const address = Reflect.get(decision, "address");
|
|
@@ -6109,7 +6109,7 @@ function readHostVersionEvidence(source) {
|
|
|
6109
6109
|
throw new Error("invalid host version evidence");
|
|
6110
6110
|
if (address !== void 0 && address !== "registry" && address !== "source" && address !== "workspace" && address !== "catalog" && address !== "file")
|
|
6111
6111
|
throw new Error("invalid host version evidence");
|
|
6112
|
-
packages[
|
|
6112
|
+
packages[name3] = address === void 0 ? { status } : { status, address };
|
|
6113
6113
|
}
|
|
6114
6114
|
return { outputRevision, packages };
|
|
6115
6115
|
}
|
|
@@ -6249,8 +6249,8 @@ function addPatternNames(pattern, out) {
|
|
|
6249
6249
|
} else if (pattern.type === "RestElement") addPatternNames(pattern.argument, out);
|
|
6250
6250
|
else if (pattern.type === "AssignmentPattern") addPatternNames(pattern.left, out);
|
|
6251
6251
|
}
|
|
6252
|
-
function declares(scope,
|
|
6253
|
-
for (let at = scope; at; at = at.parent) if (at.names.has(
|
|
6252
|
+
function declares(scope, name3) {
|
|
6253
|
+
for (let at = scope; at; at = at.parent) if (at.names.has(name3)) return true;
|
|
6254
6254
|
return false;
|
|
6255
6255
|
}
|
|
6256
6256
|
function readNameRoles(node, scope, nonReferences, shorthands) {
|
|
@@ -6325,8 +6325,8 @@ function readNamespaceExports(node) {
|
|
|
6325
6325
|
for (const exported of node.properties) {
|
|
6326
6326
|
if (exported.type !== "Property" || exported.computed || exported.key.type !== "Identifier" && exported.key.type !== "Literal" || exported.value.type !== "ArrowFunctionExpression")
|
|
6327
6327
|
return "unsupported-binding";
|
|
6328
|
-
const
|
|
6329
|
-
if (typeof
|
|
6328
|
+
const name3 = exported.key.type === "Identifier" ? exported.key.name : exported.key.value;
|
|
6329
|
+
if (typeof name3 === "bigint") return "unsupported-binding";
|
|
6330
6330
|
let binding = exported.value.body;
|
|
6331
6331
|
const properties = [];
|
|
6332
6332
|
while (binding.type === "MemberExpression") {
|
|
@@ -6339,7 +6339,7 @@ function readNamespaceExports(node) {
|
|
|
6339
6339
|
binding = binding.object;
|
|
6340
6340
|
}
|
|
6341
6341
|
if (binding.type !== "Identifier") return "unsupported-binding";
|
|
6342
|
-
exports2.push({ key: JSON.stringify(
|
|
6342
|
+
exports2.push({ key: JSON.stringify(name3), target: binding.name, properties });
|
|
6343
6343
|
}
|
|
6344
6344
|
return exports2;
|
|
6345
6345
|
}
|
|
@@ -6542,8 +6542,8 @@ async function readRolldownBundleInventory(source) {
|
|
|
6542
6542
|
}
|
|
6543
6543
|
}
|
|
6544
6544
|
inventory.registrations.sort((left, right) => left.start - right.start);
|
|
6545
|
-
for (const [
|
|
6546
|
-
inventory.namespaces.set(
|
|
6545
|
+
for (const [name3, node] of namespaceNodes)
|
|
6546
|
+
inventory.namespaces.set(name3, {
|
|
6547
6547
|
start: node.start,
|
|
6548
6548
|
end: node.end,
|
|
6549
6549
|
exports: readNamespaceExports(node)
|
|
@@ -6561,13 +6561,13 @@ async function readRolldownBundleInventory(source) {
|
|
|
6561
6561
|
(left, right) => left.factory.start - right.factory.start
|
|
6562
6562
|
);
|
|
6563
6563
|
for (const binding of inventory.factoryBindings) {
|
|
6564
|
-
binding.dependencies = [...callsByFactory.get(binding.factory.start) ?? []].filter((
|
|
6565
|
-
binding.namespaces = [...namespacesByInitializer.get(binding.binding) ?? []].filter((
|
|
6564
|
+
binding.dependencies = [...callsByFactory.get(binding.factory.start) ?? []].filter((name3) => bindings.has(name3)).sort();
|
|
6565
|
+
binding.namespaces = [...namespacesByInitializer.get(binding.binding) ?? []].filter((name3) => namespaceNodes.has(name3)).sort();
|
|
6566
6566
|
}
|
|
6567
6567
|
for (const binding of inventory.factoryBindings) {
|
|
6568
6568
|
const referenced = /* @__PURE__ */ new Set();
|
|
6569
|
-
for (const
|
|
6570
|
-
const namespace = namespaceNodes.get(
|
|
6569
|
+
for (const name3 of binding.namespaces) {
|
|
6570
|
+
const namespace = namespaceNodes.get(name3);
|
|
6571
6571
|
if (!namespace) continue;
|
|
6572
6572
|
for (const property of namespace.properties) {
|
|
6573
6573
|
if (property.type !== "Property" || property.value.type !== "ArrowFunctionExpression")
|
|
@@ -6578,8 +6578,8 @@ async function readRolldownBundleInventory(source) {
|
|
|
6578
6578
|
if (value.type === "Identifier") referenced.add(value.name);
|
|
6579
6579
|
}
|
|
6580
6580
|
}
|
|
6581
|
-
binding.exportDeclarations = [...referenced].flatMap((
|
|
6582
|
-
const declaration = declarations.get(
|
|
6581
|
+
binding.exportDeclarations = [...referenced].flatMap((name3) => {
|
|
6582
|
+
const declaration = declarations.get(name3);
|
|
6583
6583
|
return declaration ? [{ start: declaration.start, end: declaration.end }] : [];
|
|
6584
6584
|
}).sort((left, right) => left.start - right.start);
|
|
6585
6585
|
}
|
|
@@ -6589,12 +6589,12 @@ async function readRolldownBundleInventory(source) {
|
|
|
6589
6589
|
for (const property of namespace.properties) {
|
|
6590
6590
|
if (property.type !== "Property" || property.value.type !== "ArrowFunctionExpression" || property.value.body.type !== "Identifier")
|
|
6591
6591
|
continue;
|
|
6592
|
-
const
|
|
6593
|
-
if (!
|
|
6592
|
+
const name3 = property.key.type === "Identifier" ? property.key.name : property.key.type === "Literal" && typeof property.key.value === "string" ? property.key.value : null;
|
|
6593
|
+
if (!name3) throw new Error("rolldown production namespace has invalid export key");
|
|
6594
6594
|
const binding = property.value.body.name;
|
|
6595
6595
|
let names = exportNames.get(binding);
|
|
6596
6596
|
if (!names) exportNames.set(binding, names = /* @__PURE__ */ new Set());
|
|
6597
|
-
names.add(
|
|
6597
|
+
names.add(name3);
|
|
6598
6598
|
}
|
|
6599
6599
|
}
|
|
6600
6600
|
const ordered = [...declarations].sort(
|
|
@@ -6613,8 +6613,8 @@ async function readRolldownBundleInventory(source) {
|
|
|
6613
6613
|
if (entry[1].start < binding.moduleStart || entry[1].end > binding.factory.start)
|
|
6614
6614
|
continue;
|
|
6615
6615
|
owned.set(entry[0], entry[1]);
|
|
6616
|
-
for (const
|
|
6617
|
-
binding.exportedBindings.push({ name:
|
|
6616
|
+
for (const name3 of exportNames.get(entry[0]) ?? [])
|
|
6617
|
+
binding.exportedBindings.push({ name: name3, binding: entry[0] });
|
|
6618
6618
|
}
|
|
6619
6619
|
const ranges = new Map(
|
|
6620
6620
|
binding.exportDeclarations.map((range2) => [range2.start, range2])
|
|
@@ -44969,11 +44969,11 @@ function canonicalText(source, names, start, end) {
|
|
|
44969
44969
|
const nameStart = names.starts[index] ?? end;
|
|
44970
44970
|
const nameEnd = names.ends[index] ?? end;
|
|
44971
44971
|
if (nameEnd > end) break;
|
|
44972
|
-
const
|
|
44973
|
-
let replacement = canonical.get(
|
|
44972
|
+
const name3 = source.slice(nameStart, nameEnd);
|
|
44973
|
+
let replacement = canonical.get(name3);
|
|
44974
44974
|
if (replacement === void 0)
|
|
44975
|
-
canonical.set(
|
|
44976
|
-
text4 += source.slice(cursor, nameStart) + (names.shorthand[index] ?
|
|
44975
|
+
canonical.set(name3, replacement = "#" + canonical.size);
|
|
44976
|
+
text4 += source.slice(cursor, nameStart) + (names.shorthand[index] ? name3 + ":" + replacement : replacement);
|
|
44977
44977
|
cursor = nameEnd;
|
|
44978
44978
|
}
|
|
44979
44979
|
return {
|
|
@@ -44990,14 +44990,14 @@ async function fingerprintInput(source) {
|
|
|
44990
44990
|
}
|
|
44991
44991
|
const factories = [];
|
|
44992
44992
|
for (const binding of inventory.factoryBindings) {
|
|
44993
|
-
const namespaces = binding.namespaces.map((
|
|
44994
|
-
const namespace = inventory.namespaces.get(
|
|
44993
|
+
const namespaces = binding.namespaces.map((name3) => {
|
|
44994
|
+
const namespace = inventory.namespaces.get(name3);
|
|
44995
44995
|
if (!namespace) throw new Error("rolldown initializer lost its export namespace");
|
|
44996
44996
|
return text4(namespace.start, namespace.end);
|
|
44997
44997
|
}).sort();
|
|
44998
44998
|
const exports2 = binding.exportDeclarations.map((range2) => text4(range2.start, range2.end)).sort();
|
|
44999
|
-
const dependencies = binding.dependencies.map((
|
|
45000
|
-
const body = bodies.get(
|
|
44999
|
+
const dependencies = binding.dependencies.map((name3) => {
|
|
45000
|
+
const body = bodies.get(name3);
|
|
45001
45001
|
if (body === void 0) throw new Error("rolldown factory lost its dependency");
|
|
45002
45002
|
return body;
|
|
45003
45003
|
}).sort();
|
|
@@ -45016,7 +45016,7 @@ async function fingerprintInput(source) {
|
|
|
45016
45016
|
exports2,
|
|
45017
45017
|
dependencies,
|
|
45018
45018
|
binding.exportedBindings.map(
|
|
45019
|
-
({ name:
|
|
45019
|
+
({ name: name3, binding: binding2 }) => `${name3},${block.canonical.get(binding2) ?? binding2}`
|
|
45020
45020
|
).sort((left, right) => left < right ? -1 : left > right ? 1 : 0)
|
|
45021
45021
|
])
|
|
45022
45022
|
)
|
|
@@ -45108,9 +45108,9 @@ async function readRolldownProductionInput(source) {
|
|
|
45108
45108
|
throw new Error("rolldown production input has no verified turbo boundary");
|
|
45109
45109
|
const accessors = turbo.binding.exportedBindings.filter((entry) => entry.name === "getEnforcing" || entry.name === "get").map((entry) => entry.binding);
|
|
45110
45110
|
const accesses = [...inventory.runtimeGlobalAccesses];
|
|
45111
|
-
for (const
|
|
45111
|
+
for (const name3 of [...accessors, "__turboModuleProxy"]) {
|
|
45112
45112
|
accesses.push(
|
|
45113
|
-
...(inventory.callsByBinding.get(
|
|
45113
|
+
...(inventory.callsByBinding.get(name3) ?? []).map((offset) => ({ offset, name: name3 }))
|
|
45114
45114
|
);
|
|
45115
45115
|
}
|
|
45116
45116
|
const verified2 = new Set(input.modules.map((module2) => module2.binding.factory.start));
|
|
@@ -45132,10 +45132,10 @@ async function readRolldownProductionInput(source) {
|
|
|
45132
45132
|
}
|
|
45133
45133
|
const nativeInterfaces = /* @__PURE__ */ new Map();
|
|
45134
45134
|
for (const call of inventory.nativePrivateCalls) {
|
|
45135
|
-
const
|
|
45136
|
-
if (!
|
|
45137
|
-
let methods = nativeInterfaces.get(
|
|
45138
|
-
if (!methods) nativeInterfaces.set(
|
|
45135
|
+
const name3 = inventory.nativePrivateSlots.get(call.key);
|
|
45136
|
+
if (!name3) continue;
|
|
45137
|
+
let methods = nativeInterfaces.get(name3);
|
|
45138
|
+
if (!methods) nativeInterfaces.set(name3, methods = /* @__PURE__ */ new Set());
|
|
45139
45139
|
methods.add(call.method);
|
|
45140
45140
|
}
|
|
45141
45141
|
return {
|
|
@@ -47278,8 +47278,8 @@ var init_directives = __esm({
|
|
|
47278
47278
|
this.atNextDocument = false;
|
|
47279
47279
|
}
|
|
47280
47280
|
const parts = line.trim().split(/[ \t]+/);
|
|
47281
|
-
const
|
|
47282
|
-
switch (
|
|
47281
|
+
const name3 = parts.shift();
|
|
47282
|
+
switch (name3) {
|
|
47283
47283
|
case "%TAG": {
|
|
47284
47284
|
if (parts.length !== 2) {
|
|
47285
47285
|
onError(0, "%TAG directive should contain exactly two parts");
|
|
@@ -47307,7 +47307,7 @@ var init_directives = __esm({
|
|
|
47307
47307
|
}
|
|
47308
47308
|
}
|
|
47309
47309
|
default:
|
|
47310
|
-
onError(0, `Unknown directive ${
|
|
47310
|
+
onError(0, `Unknown directive ${name3}`, true);
|
|
47311
47311
|
return false;
|
|
47312
47312
|
}
|
|
47313
47313
|
}
|
|
@@ -48370,8 +48370,8 @@ function getTagObject(tags, item) {
|
|
|
48370
48370
|
tagObj = tags.find((t) => t.nodeClass && obj instanceof t.nodeClass);
|
|
48371
48371
|
}
|
|
48372
48372
|
if (!tagObj) {
|
|
48373
|
-
const
|
|
48374
|
-
throw new Error(`Tag not resolved for ${
|
|
48373
|
+
const name3 = obj?.constructor?.name ?? (obj === null ? "null" : typeof obj);
|
|
48374
|
+
throw new Error(`Tag not resolved for ${name3} value`);
|
|
48375
48375
|
}
|
|
48376
48376
|
return tagObj;
|
|
48377
48377
|
}
|
|
@@ -50003,9 +50003,9 @@ function readProjectManifest(dir, files2 = nodeRepoFileReader) {
|
|
|
50003
50003
|
)
|
|
50004
50004
|
);
|
|
50005
50005
|
};
|
|
50006
|
-
const
|
|
50006
|
+
const name3 = metadataValue(parsed, "name");
|
|
50007
50007
|
return {
|
|
50008
|
-
...typeof
|
|
50008
|
+
...typeof name3 === "string" ? { name: name3 } : {},
|
|
50009
50009
|
dependencies: record2(metadataValue(parsed, "dependencies")),
|
|
50010
50010
|
devDependencies: record2(metadataValue(parsed, "devDependencies"))
|
|
50011
50011
|
};
|
|
@@ -51712,7 +51712,7 @@ function designTimeDiagnostic(output, files2) {
|
|
|
51712
51712
|
const rewritten = /* @__PURE__ */ new Map();
|
|
51713
51713
|
const linesOf = (path37) => {
|
|
51714
51714
|
const file = Object.keys(files2).find(
|
|
51715
|
-
(
|
|
51715
|
+
(name3) => name3.endsWith(".swift") && (path37 === name3 || path37.endsWith(`/${name3}`))
|
|
51716
51716
|
);
|
|
51717
51717
|
if (file === void 0) return null;
|
|
51718
51718
|
let lines = rewritten.get(file);
|
|
@@ -51908,10 +51908,10 @@ var swiftHome;
|
|
|
51908
51908
|
function confineSwiftScratch(root) {
|
|
51909
51909
|
if (scratch) return;
|
|
51910
51910
|
import_node_fs8.default.mkdirSync(root, { recursive: true });
|
|
51911
|
-
for (const
|
|
51912
|
-
const pid = Number(
|
|
51911
|
+
for (const name3 of import_node_fs8.default.readdirSync(root)) {
|
|
51912
|
+
const pid = Number(name3);
|
|
51913
51913
|
if (Number.isInteger(pid) && pid > 0 && !processRuns(pid))
|
|
51914
|
-
import_node_fs8.default.rmSync(import_node_path7.default.join(root,
|
|
51914
|
+
import_node_fs8.default.rmSync(import_node_path7.default.join(root, name3), { recursive: true, force: true });
|
|
51915
51915
|
}
|
|
51916
51916
|
const dir = import_node_path7.default.join(root, String(process.pid));
|
|
51917
51917
|
import_node_fs8.default.mkdirSync(dir, { recursive: true });
|
|
@@ -51923,11 +51923,11 @@ function confineSwiftScratch(root) {
|
|
|
51923
51923
|
const seeded = import_node_path7.default.join(import_node_os4.default.homedir(), ".swiftpm");
|
|
51924
51924
|
const dirAbsentBefore = lstatIfKnown(seeded) === null;
|
|
51925
51925
|
const absentBefore = swiftpmSeeds.filter(
|
|
51926
|
-
(
|
|
51926
|
+
(name3) => lstatIfKnown(import_node_path7.default.join(seeded, name3)) === null
|
|
51927
51927
|
);
|
|
51928
51928
|
process.once("exit", () => {
|
|
51929
51929
|
import_node_fs8.default.rmSync(dir, { recursive: true, force: true });
|
|
51930
|
-
for (const
|
|
51930
|
+
for (const name3 of absentBefore) removeSwiftpmSeed(import_node_path7.default.join(seeded, name3), name3);
|
|
51931
51931
|
if (dirAbsentBefore && lstatIfKnown(seeded)?.isDirectory())
|
|
51932
51932
|
try {
|
|
51933
51933
|
import_node_fs8.default.rmdirSync(seeded);
|
|
@@ -51944,11 +51944,11 @@ function lstatIfKnown(entry) {
|
|
|
51944
51944
|
return void 0;
|
|
51945
51945
|
}
|
|
51946
51946
|
}
|
|
51947
|
-
function removeSwiftpmSeed(entry,
|
|
51947
|
+
function removeSwiftpmSeed(entry, name3) {
|
|
51948
51948
|
const stat2 = lstatIfKnown(entry);
|
|
51949
51949
|
if (!stat2) return;
|
|
51950
51950
|
try {
|
|
51951
|
-
if (
|
|
51951
|
+
if (name3 === "cache") {
|
|
51952
51952
|
if (stat2.isSymbolicLink() && import_node_fs8.default.readlinkSync(entry).endsWith("/.cache/org.swift.swiftpm"))
|
|
51953
51953
|
import_node_fs8.default.unlinkSync(entry);
|
|
51954
51954
|
} else if (stat2.isDirectory()) {
|
|
@@ -52037,7 +52037,7 @@ function swiftSdkPayloadChecksum(bundle) {
|
|
|
52037
52037
|
hash.update(JSON.stringify([relative2, "link", import_node_fs8.default.readlinkSync(file)]) + "\n");
|
|
52038
52038
|
} else if (stat2.isDirectory()) {
|
|
52039
52039
|
hash.update(JSON.stringify([relative2, "directory"]) + "\n");
|
|
52040
|
-
for (const
|
|
52040
|
+
for (const name3 of import_node_fs8.default.readdirSync(file).sort()) visit3(import_node_path7.default.join(relative2, name3));
|
|
52041
52041
|
} else if (stat2.isFile()) {
|
|
52042
52042
|
const stamp = [stat2.dev, stat2.ino, stat2.size, stat2.mtimeNs, stat2.ctimeNs].join(":");
|
|
52043
52043
|
let cached4 = sdkFileHashes.get(file);
|
|
@@ -52265,12 +52265,12 @@ function swiftCompilerInstall(release) {
|
|
|
52265
52265
|
};
|
|
52266
52266
|
}
|
|
52267
52267
|
const platform = `debian12${process.arch === "arm64" ? "-aarch64" : ""}`;
|
|
52268
|
-
const
|
|
52268
|
+
const name3 = `${release}-${platform}`;
|
|
52269
52269
|
return {
|
|
52270
52270
|
note: " (Debian 12 shown; other distributions: https://www.swift.org/install/linux/)",
|
|
52271
52271
|
commands: [
|
|
52272
|
-
`curl -fsSL ${downloads}/${platform}/${release}/${
|
|
52273
|
-
`export PATH=/opt/${
|
|
52272
|
+
`curl -fsSL ${downloads}/${platform}/${release}/${name3}.tar.gz | tar -xz -C /opt`,
|
|
52273
|
+
`export PATH=/opt/${name3}/usr/bin:$PATH`
|
|
52274
52274
|
]
|
|
52275
52275
|
};
|
|
52276
52276
|
}
|
|
@@ -52335,7 +52335,7 @@ async function load(toolchainBin, sdk) {
|
|
|
52335
52335
|
icuSegment(archiveMember((0, import_node_fs9.readFileSync)(import_node_path8.default.join(resources, ARCHIVE)), MEMBER))
|
|
52336
52336
|
);
|
|
52337
52337
|
}
|
|
52338
|
-
function archiveMember(archive,
|
|
52338
|
+
function archiveMember(archive, name3) {
|
|
52339
52339
|
if (archive.toString("latin1", 0, 8) !== "!<arch>\n")
|
|
52340
52340
|
throw new Error("swift-icu: not an ar archive");
|
|
52341
52341
|
let names = "";
|
|
@@ -52345,10 +52345,10 @@ function archiveMember(archive, name2) {
|
|
|
52345
52345
|
const body = archive.subarray(at + 60, at + 60 + size);
|
|
52346
52346
|
if (raw2 === "//") names = body.toString("latin1");
|
|
52347
52347
|
const member = /^\/\d+$/.test(raw2) ? names.slice(Number(raw2.slice(1)), names.indexOf("/\n", Number(raw2.slice(1)))) : raw2.replace(/\/$/, "");
|
|
52348
|
-
if (member ===
|
|
52348
|
+
if (member === name3) return body;
|
|
52349
52349
|
at += 60 + size + size % 2;
|
|
52350
52350
|
}
|
|
52351
|
-
throw new Error(`swift-icu: ${
|
|
52351
|
+
throw new Error(`swift-icu: ${name3} is not in the sdk's icu archive`);
|
|
52352
52352
|
}
|
|
52353
52353
|
function icuSegment(object2) {
|
|
52354
52354
|
let at = 8;
|
|
@@ -52497,8 +52497,8 @@ var SWIFT_NATIVE_SOURCE_EXTENSIONS = [
|
|
|
52497
52497
|
".inl",
|
|
52498
52498
|
".modulemap"
|
|
52499
52499
|
];
|
|
52500
|
-
function swiftTargetModuleName(
|
|
52501
|
-
return
|
|
52500
|
+
function swiftTargetModuleName(name3) {
|
|
52501
|
+
return name3.replace(/[^A-Za-z0-9_]/g, "_").replace(/^[0-9]/, "_");
|
|
52502
52502
|
}
|
|
52503
52503
|
function swiftPackageIdentity(url) {
|
|
52504
52504
|
return (url.split("/").pop() ?? url).replace(/\.git$/, "").toLowerCase();
|
|
@@ -52513,16 +52513,16 @@ function swiftManifestTargets(manifest, resourcePaths = []) {
|
|
|
52513
52513
|
]);
|
|
52514
52514
|
const targetNames = new Set(
|
|
52515
52515
|
declarations.flatMap(({ flat }) => {
|
|
52516
|
-
const
|
|
52517
|
-
return
|
|
52516
|
+
const name3 = /\bname\s*:\s*"([^"]+)"/.exec(flat)?.[1];
|
|
52517
|
+
return name3 ? [name3] : [];
|
|
52518
52518
|
})
|
|
52519
52519
|
);
|
|
52520
52520
|
for (const { kind, flat, call } of declarations) {
|
|
52521
52521
|
const executable = kind === "executableTarget";
|
|
52522
|
-
const
|
|
52523
|
-
if (!
|
|
52522
|
+
const name3 = /\bname\s*:\s*"([^"]+)"/.exec(flat)?.[1];
|
|
52523
|
+
if (!name3) continue;
|
|
52524
52524
|
const rawPath = /\bpath\s*:\s*"([^"]*)"/.exec(flat)?.[1];
|
|
52525
|
-
const targetPath = rawPath == null || rawPath === "" ? `Sources/${
|
|
52525
|
+
const targetPath = rawPath == null || rawPath === "" ? `Sources/${name3}` : rawPath.replace(/^\.\//, "").replace(/\/+$/, "");
|
|
52526
52526
|
const languageMode = Number(
|
|
52527
52527
|
/\.swiftLanguageMode\(\s*\.v(\d+)\s*\)/.exec(call)?.[1] ?? "5"
|
|
52528
52528
|
);
|
|
@@ -52562,12 +52562,12 @@ function swiftManifestTargets(manifest, resourcePaths = []) {
|
|
|
52562
52562
|
dependencyNames.add(dependencyName);
|
|
52563
52563
|
}
|
|
52564
52564
|
}
|
|
52565
|
-
const dependencies = [...dependencyNames].map((
|
|
52565
|
+
const dependencies = [...dependencyNames].map((name4) => ({
|
|
52566
52566
|
kind: "target",
|
|
52567
|
-
name:
|
|
52567
|
+
name: name4
|
|
52568
52568
|
}));
|
|
52569
52569
|
targets.push({
|
|
52570
|
-
name:
|
|
52570
|
+
name: name3,
|
|
52571
52571
|
path: targetPath,
|
|
52572
52572
|
executable,
|
|
52573
52573
|
...kind === "systemLibrary" ? { systemLibrary: true } : {},
|
|
@@ -52615,8 +52615,8 @@ function swiftResourceBundleForFile(bundles, file) {
|
|
|
52615
52615
|
return owner;
|
|
52616
52616
|
}
|
|
52617
52617
|
function swiftResourceBundleInfoPlist(bundle) {
|
|
52618
|
-
const
|
|
52619
|
-
const escaped =
|
|
52618
|
+
const name3 = bundle.path.split("/").pop().replace(/\.(bundle|framework)$/, "");
|
|
52619
|
+
const escaped = name3.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
52620
52620
|
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>`;
|
|
52621
52621
|
}
|
|
52622
52622
|
function swiftMetalSourceFiles(files2) {
|
|
@@ -52648,39 +52648,57 @@ var import_node_crypto5 = require("node:crypto");
|
|
|
52648
52648
|
var import_node_fs10 = require("node:fs");
|
|
52649
52649
|
var import_node_path9 = __toESM(require("node:path"), 1);
|
|
52650
52650
|
init_home_paths();
|
|
52651
|
+
init_process_group();
|
|
52651
52652
|
var POLL_MS = 250;
|
|
52652
|
-
|
|
52653
|
-
|
|
52654
|
-
|
|
52655
|
-
encoding: "utf8",
|
|
52656
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
52657
|
-
}).trim() || null;
|
|
52658
|
-
} catch {
|
|
52659
|
-
return null;
|
|
52660
|
-
}
|
|
52653
|
+
var START_TOLERANCE_MS = 2e3;
|
|
52654
|
+
function errorCode(error) {
|
|
52655
|
+
return error instanceof Error && "code" in error && typeof error.code === "string" ? error.code : void 0;
|
|
52661
52656
|
}
|
|
52662
|
-
function
|
|
52663
|
-
|
|
52664
|
-
|
|
52665
|
-
|
|
52666
|
-
return { pid: value.pid, start: value.start };
|
|
52667
|
-
} catch {
|
|
52668
|
-
}
|
|
52669
|
-
return null;
|
|
52657
|
+
function parseStart(text4) {
|
|
52658
|
+
const start = Date.parse(`${text4} UTC`);
|
|
52659
|
+
if (Number.isNaN(start)) throw new Error(`unreadable process start time "${text4}"`);
|
|
52660
|
+
return start;
|
|
52670
52661
|
}
|
|
52671
|
-
function
|
|
52672
|
-
|
|
52673
|
-
|
|
52674
|
-
|
|
52675
|
-
|
|
52676
|
-
|
|
52662
|
+
function processTable() {
|
|
52663
|
+
const result = (0, import_node_child_process7.spawnSync)("ps", ["-A", "-o", "pid=,pgid=,stat=,lstart="], {
|
|
52664
|
+
encoding: "utf8",
|
|
52665
|
+
env: { ...process.env, LC_ALL: "C", TZ: "UTC" },
|
|
52666
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
52667
|
+
timeout: 1e4,
|
|
52668
|
+
killSignal: "SIGKILL"
|
|
52669
|
+
});
|
|
52670
|
+
if (result.error || result.status !== 0) {
|
|
52671
|
+
throw new Error(
|
|
52672
|
+
`swift root lock cannot read the process table: ${result.error?.message || result.stderr.trim() || `ps exited ${result.status}`}`
|
|
52673
|
+
);
|
|
52677
52674
|
}
|
|
52675
|
+
return result.stdout.split("\n").filter((line) => line.trim()).map((line) => {
|
|
52676
|
+
const match = /^\s*(\d+)\s+(\d+)\s+(\S+)\s+(.+?)\s*$/.exec(line);
|
|
52677
|
+
if (!match)
|
|
52678
|
+
throw new Error(`swift root lock cannot parse a process table row: ${line}`);
|
|
52679
|
+
return {
|
|
52680
|
+
pid: Number(match[1]),
|
|
52681
|
+
pgid: Number(match[2]),
|
|
52682
|
+
zombie: match[3].startsWith("Z"),
|
|
52683
|
+
start: parseStart(match[4])
|
|
52684
|
+
};
|
|
52685
|
+
});
|
|
52678
52686
|
}
|
|
52679
|
-
function
|
|
52680
|
-
|
|
52681
|
-
|
|
52682
|
-
|
|
52683
|
-
|
|
52687
|
+
function sameProcess(row, identity) {
|
|
52688
|
+
return row.pid === identity.pid && Math.abs(row.start - identity.start) <= START_TOLERANCE_MS;
|
|
52689
|
+
}
|
|
52690
|
+
function ownIdentity(pid) {
|
|
52691
|
+
const row = processTable().find(
|
|
52692
|
+
(candidate) => candidate.pid === pid && !candidate.zombie
|
|
52693
|
+
);
|
|
52694
|
+
if (!row) throw new Error(`swift root lock cannot find process ${pid}`);
|
|
52695
|
+
return { pid, start: row.start };
|
|
52696
|
+
}
|
|
52697
|
+
function parseIdentity(text4) {
|
|
52698
|
+
const value = JSON.parse(text4);
|
|
52699
|
+
if (value && typeof value === "object" && "pid" in value && typeof value.pid === "number" && "start" in value && typeof value.start === "number")
|
|
52700
|
+
return { pid: value.pid, start: value.start };
|
|
52701
|
+
throw new Error(`swift root lock record is not a process identity: ${text4}`);
|
|
52684
52702
|
}
|
|
52685
52703
|
function pause(ms, signal) {
|
|
52686
52704
|
return new Promise((resolve6) => {
|
|
@@ -52693,64 +52711,127 @@ function pause(ms, signal) {
|
|
|
52693
52711
|
signal?.addEventListener("abort", done, { once: true });
|
|
52694
52712
|
});
|
|
52695
52713
|
}
|
|
52714
|
+
var name2 = (number, suffix) => `${String(number).padStart(12, "0")}.${suffix}`;
|
|
52715
|
+
function generationNumbers(directory) {
|
|
52716
|
+
const numbers = /* @__PURE__ */ new Set();
|
|
52717
|
+
for (const entry of (0, import_node_fs10.readdirSync)(directory)) {
|
|
52718
|
+
const match = /^(\d{12})\./.exec(entry);
|
|
52719
|
+
if (match) numbers.add(Number(match[1]));
|
|
52720
|
+
}
|
|
52721
|
+
return [...numbers].sort((a, b) => a - b);
|
|
52722
|
+
}
|
|
52723
|
+
function readGeneration(directory, number) {
|
|
52724
|
+
let owner;
|
|
52725
|
+
try {
|
|
52726
|
+
owner = (0, import_node_fs10.readFileSync)(import_node_path9.default.join(directory, name2(number, "owner")), "utf8");
|
|
52727
|
+
} catch (error) {
|
|
52728
|
+
if (errorCode(error) === "ENOENT") return null;
|
|
52729
|
+
throw error;
|
|
52730
|
+
}
|
|
52731
|
+
return {
|
|
52732
|
+
number,
|
|
52733
|
+
holder: parseIdentity(owner),
|
|
52734
|
+
released: (0, import_node_fs10.readdirSync)(directory).includes(name2(number, "released"))
|
|
52735
|
+
};
|
|
52736
|
+
}
|
|
52737
|
+
function readChildren(directory, number) {
|
|
52738
|
+
const prefix = name2(number, "child.");
|
|
52739
|
+
return (0, import_node_fs10.readdirSync)(directory).filter((entry) => entry.startsWith(prefix)).map((entry) => parseIdentity((0, import_node_fs10.readFileSync)(import_node_path9.default.join(directory, entry), "utf8")));
|
|
52740
|
+
}
|
|
52741
|
+
function groupAlive(table, leader) {
|
|
52742
|
+
const row = table.find((candidate) => candidate.pid === leader.pid);
|
|
52743
|
+
if (row && !sameProcess(row, leader)) return false;
|
|
52744
|
+
return table.some((candidate) => candidate.pgid === leader.pid && !candidate.zombie);
|
|
52745
|
+
}
|
|
52696
52746
|
async function withSwiftRootLock(root, work, signal) {
|
|
52697
|
-
const directory = import_node_path9.default.join(
|
|
52698
|
-
|
|
52699
|
-
|
|
52700
|
-
|
|
52701
|
-
|
|
52747
|
+
const directory = import_node_path9.default.join(
|
|
52748
|
+
rnxHomeDir(),
|
|
52749
|
+
"cache",
|
|
52750
|
+
"swift-root-locks",
|
|
52751
|
+
(0, import_node_crypto5.createHash)("sha256").update(root).digest("hex").slice(0, 32)
|
|
52702
52752
|
);
|
|
52753
|
+
(0, import_node_fs10.mkdirSync)(directory, { recursive: true });
|
|
52703
52754
|
const token = (0, import_node_crypto5.randomUUID)();
|
|
52704
|
-
const owner = JSON.stringify(
|
|
52705
|
-
|
|
52706
|
-
|
|
52707
|
-
|
|
52708
|
-
|
|
52709
|
-
|
|
52710
|
-
|
|
52711
|
-
|
|
52712
|
-
|
|
52713
|
-
|
|
52714
|
-
|
|
52715
|
-
|
|
52716
|
-
|
|
52717
|
-
} catch (error) {
|
|
52718
|
-
if (!(error instanceof Error && "code" in error && error.code === "EEXIST"))
|
|
52719
|
-
throw error;
|
|
52755
|
+
const owner = JSON.stringify(ownIdentity(process.pid));
|
|
52756
|
+
const pending = import_node_path9.default.join(directory, `pending.${token}`);
|
|
52757
|
+
let held = 0;
|
|
52758
|
+
for (; ; ) {
|
|
52759
|
+
signal?.throwIfAborted();
|
|
52760
|
+
const newest = generationNumbers(directory).at(-1) ?? 0;
|
|
52761
|
+
const current = newest > 0 ? readGeneration(directory, newest) : null;
|
|
52762
|
+
if (newest > 0 && !current) continue;
|
|
52763
|
+
if (current && !current.released) {
|
|
52764
|
+
const table = processTable();
|
|
52765
|
+
if (table.some((row) => !row.zombie && sameProcess(row, current.holder))) {
|
|
52766
|
+
await pause(POLL_MS, signal);
|
|
52767
|
+
continue;
|
|
52720
52768
|
}
|
|
52721
|
-
const
|
|
52722
|
-
if (
|
|
52723
|
-
if (holderAlive(held)) {
|
|
52769
|
+
const children2 = readChildren(directory, newest);
|
|
52770
|
+
if (children2.some((child) => groupAlive(table, child))) {
|
|
52724
52771
|
await pause(POLL_MS, signal);
|
|
52725
52772
|
continue;
|
|
52726
52773
|
}
|
|
52727
|
-
|
|
52728
|
-
|
|
52729
|
-
|
|
52730
|
-
|
|
52731
|
-
|
|
52732
|
-
|
|
52774
|
+
}
|
|
52775
|
+
(0, import_node_fs10.writeFileSync)(pending, owner);
|
|
52776
|
+
try {
|
|
52777
|
+
(0, import_node_fs10.linkSync)(pending, import_node_path9.default.join(directory, name2(newest + 1, "owner")));
|
|
52778
|
+
} catch (error) {
|
|
52779
|
+
if (errorCode(error) === "EEXIST") continue;
|
|
52780
|
+
throw error;
|
|
52781
|
+
} finally {
|
|
52782
|
+
(0, import_node_fs10.rmSync)(pending, { force: true });
|
|
52783
|
+
}
|
|
52784
|
+
const numbers = generationNumbers(directory);
|
|
52785
|
+
if (numbers.at(-1) !== newest + 1) {
|
|
52786
|
+
(0, import_node_fs10.rmSync)(import_node_path9.default.join(directory, name2(newest + 1, "owner")), { force: true });
|
|
52787
|
+
continue;
|
|
52788
|
+
}
|
|
52789
|
+
held = newest + 1;
|
|
52790
|
+
for (const number of numbers)
|
|
52791
|
+
if (number < held) {
|
|
52792
|
+
for (const entry of (0, import_node_fs10.readdirSync)(directory))
|
|
52793
|
+
if (entry.startsWith(name2(number, "")))
|
|
52794
|
+
(0, import_node_fs10.rmSync)(import_node_path9.default.join(directory, entry), { force: true });
|
|
52733
52795
|
}
|
|
52796
|
+
break;
|
|
52797
|
+
}
|
|
52798
|
+
const children = [];
|
|
52799
|
+
const lease = {
|
|
52800
|
+
spawn(command, args, options) {
|
|
52801
|
+
const child = (0, import_node_child_process7.spawn)(
|
|
52802
|
+
"/bin/sh",
|
|
52803
|
+
["-c", 'IFS= read -r go || exit 1; exec "$@" </dev/null', "sh", command, ...args],
|
|
52804
|
+
{ ...options, detached: true, stdio: ["pipe", "pipe", "pipe"] }
|
|
52805
|
+
);
|
|
52806
|
+
child.stdin.on("error", () => {
|
|
52807
|
+
});
|
|
52808
|
+
children.push(child);
|
|
52734
52809
|
try {
|
|
52735
|
-
if (
|
|
52736
|
-
|
|
52737
|
-
|
|
52738
|
-
|
|
52739
|
-
if (!(error instanceof Error && "code" in error && error.code === "EEXIST"))
|
|
52740
|
-
throw error;
|
|
52741
|
-
}
|
|
52810
|
+
if (child.pid === void 0) {
|
|
52811
|
+
child.once("error", () => {
|
|
52812
|
+
});
|
|
52813
|
+
throw new Error(`could not start ${command}`);
|
|
52742
52814
|
}
|
|
52743
|
-
|
|
52744
|
-
|
|
52815
|
+
const childPending = `${pending}.child.${child.pid}`;
|
|
52816
|
+
try {
|
|
52817
|
+
(0, import_node_fs10.writeFileSync)(childPending, JSON.stringify(ownIdentity(child.pid)));
|
|
52818
|
+
(0, import_node_fs10.linkSync)(childPending, import_node_path9.default.join(directory, name2(held, `child.${child.pid}`)));
|
|
52819
|
+
} finally {
|
|
52820
|
+
(0, import_node_fs10.rmSync)(childPending, { force: true });
|
|
52821
|
+
}
|
|
52822
|
+
} catch (error) {
|
|
52823
|
+
child.stdin.destroy();
|
|
52824
|
+
throw error;
|
|
52745
52825
|
}
|
|
52826
|
+
child.stdin.end("go\n");
|
|
52827
|
+
return child;
|
|
52746
52828
|
}
|
|
52747
|
-
}
|
|
52748
|
-
(0, import_node_fs10.rmSync)(pending, { force: true });
|
|
52749
|
-
}
|
|
52829
|
+
};
|
|
52750
52830
|
try {
|
|
52751
|
-
return await work();
|
|
52831
|
+
return await work(lease);
|
|
52752
52832
|
} finally {
|
|
52753
|
-
|
|
52833
|
+
await Promise.all(children.map((child) => terminateProcessGroup(child, "SIGKILL", 0)));
|
|
52834
|
+
(0, import_node_fs10.writeFileSync)(import_node_path9.default.join(directory, name2(held, "released")), "");
|
|
52754
52835
|
}
|
|
52755
52836
|
}
|
|
52756
52837
|
|
|
@@ -52781,12 +52862,13 @@ function isSwiftMetalLibrarySources(value) {
|
|
|
52781
52862
|
async function runCompiler(command, args, options, stream = false, quiet) {
|
|
52782
52863
|
const { signal } = options;
|
|
52783
52864
|
signal?.throwIfAborted();
|
|
52784
|
-
const
|
|
52865
|
+
const launch = {
|
|
52785
52866
|
cwd: options.cwd,
|
|
52786
52867
|
env: swiftEnvironment(options.env),
|
|
52787
52868
|
detached: true,
|
|
52788
52869
|
stdio: ["ignore", "pipe", "pipe"]
|
|
52789
|
-
}
|
|
52870
|
+
};
|
|
52871
|
+
const child = options.lease ? options.lease.spawn(command, args, launch) : (0, import_node_child_process8.spawn)(command, args, launch);
|
|
52790
52872
|
let stopping;
|
|
52791
52873
|
try {
|
|
52792
52874
|
await new Promise((resolve6, reject) => {
|
|
@@ -52800,20 +52882,20 @@ async function runCompiler(command, args, options, stream = false, quiet) {
|
|
|
52800
52882
|
void stopping.catch(() => {
|
|
52801
52883
|
});
|
|
52802
52884
|
};
|
|
52803
|
-
for (const
|
|
52804
|
-
child[
|
|
52805
|
-
if (stream === true) process[
|
|
52885
|
+
for (const name3 of ["stdout", "stderr"]) {
|
|
52886
|
+
child[name3].on("data", (bytes) => {
|
|
52887
|
+
if (stream === true) process[name3].write(bytes);
|
|
52806
52888
|
else if (stream) {
|
|
52807
|
-
const lines = (partial[
|
|
52808
|
-
partial[
|
|
52889
|
+
const lines = (partial[name3] + bytes.toString()).split("\n");
|
|
52890
|
+
partial[name3] = lines.pop();
|
|
52809
52891
|
for (const line of lines)
|
|
52810
|
-
if (stream.test(line)) process[
|
|
52892
|
+
if (stream.test(line)) process[name3].write(`${line}
|
|
52811
52893
|
`);
|
|
52812
52894
|
}
|
|
52813
|
-
sizes[
|
|
52814
|
-
if (sizes[
|
|
52895
|
+
sizes[name3] += bytes.length;
|
|
52896
|
+
if (sizes[name3] <= (options.maxBuffer ?? 1024 * 1024)) chunks[name3].push(bytes);
|
|
52815
52897
|
else {
|
|
52816
|
-
failure2 = new Error(`Swift compiler ${
|
|
52898
|
+
failure2 = new Error(`Swift compiler ${name3} exceeded its output limit`);
|
|
52817
52899
|
stop();
|
|
52818
52900
|
}
|
|
52819
52901
|
});
|
|
@@ -52841,9 +52923,9 @@ async function runCompiler(command, args, options, stream = false, quiet) {
|
|
|
52841
52923
|
);
|
|
52842
52924
|
else {
|
|
52843
52925
|
if (quiet) {
|
|
52844
|
-
for (const
|
|
52845
|
-
for (const line of Buffer.concat(chunks[
|
|
52846
|
-
if (line && !quiet.test(line)) process[
|
|
52926
|
+
for (const name3 of ["stdout", "stderr"])
|
|
52927
|
+
for (const line of Buffer.concat(chunks[name3]).toString().split("\n"))
|
|
52928
|
+
if (line && !quiet.test(line)) process[name3].write(`${line}
|
|
52847
52929
|
`);
|
|
52848
52930
|
}
|
|
52849
52931
|
resolve6();
|
|
@@ -53084,11 +53166,11 @@ function swiftCondition(text4, available) {
|
|
|
53084
53166
|
if (token === "false") return false;
|
|
53085
53167
|
const call = /^(\w+)\s*\(\s*([^,()]*?)\s*(?:,[^()]*)?\)$/.exec(token ?? "");
|
|
53086
53168
|
if (!call) return void 0;
|
|
53087
|
-
const [,
|
|
53088
|
-
if (
|
|
53089
|
-
if (
|
|
53090
|
-
if (
|
|
53091
|
-
if (
|
|
53169
|
+
const [, name3, argument] = call;
|
|
53170
|
+
if (name3 === "os") return argument === "iOS" || argument === "WASI";
|
|
53171
|
+
if (name3 === "canImport") return available.has(argument);
|
|
53172
|
+
if (name3 === "targetEnvironment") return false;
|
|
53173
|
+
if (name3 === "arch") return argument === "wasm32";
|
|
53092
53174
|
return void 0;
|
|
53093
53175
|
};
|
|
53094
53176
|
const both = () => {
|
|
@@ -53132,8 +53214,8 @@ function swiftImportNames(contents, available) {
|
|
|
53132
53214
|
continue;
|
|
53133
53215
|
}
|
|
53134
53216
|
if (available && frames.some((frame) => frame.active !== true)) continue;
|
|
53135
|
-
const
|
|
53136
|
-
if (
|
|
53217
|
+
const name3 = SWIFT_IMPORT.exec(line)?.[1];
|
|
53218
|
+
if (name3) names.push(name3);
|
|
53137
53219
|
}
|
|
53138
53220
|
return names;
|
|
53139
53221
|
}
|
|
@@ -53163,9 +53245,9 @@ function swiftSdkPaths(moduleRoot, toolchainBin) {
|
|
|
53163
53245
|
],
|
|
53164
53246
|
{ encoding: "utf8", env: swiftEnvironment(), stdio: ["ignore", "pipe", "pipe"] }
|
|
53165
53247
|
);
|
|
53166
|
-
const field = (
|
|
53167
|
-
const value = new RegExp(`^${
|
|
53168
|
-
if (!value) throw new Error(`swift sdk ${sdk} reports no ${
|
|
53248
|
+
const field = (name3) => {
|
|
53249
|
+
const value = new RegExp(`^${name3}:\\s*(.+)$`, "m").exec(configuration)?.[1]?.trim();
|
|
53250
|
+
if (!value) throw new Error(`swift sdk ${sdk} reports no ${name3}`);
|
|
53169
53251
|
return value;
|
|
53170
53252
|
};
|
|
53171
53253
|
const paths = {
|
|
@@ -53200,9 +53282,9 @@ function missingSwiftModules(files2, available) {
|
|
|
53200
53282
|
const missing = /* @__PURE__ */ new Map();
|
|
53201
53283
|
for (const [file, contents] of Object.entries(files2)) {
|
|
53202
53284
|
if (!file.endsWith(".swift") || file === "Package.swift") continue;
|
|
53203
|
-
for (const
|
|
53204
|
-
if (available.has(
|
|
53205
|
-
missing.set(
|
|
53285
|
+
for (const name3 of new Set(swiftImportNames(contents, available))) {
|
|
53286
|
+
if (available.has(name3)) continue;
|
|
53287
|
+
missing.set(name3, [...missing.get(name3) ?? [], file]);
|
|
53206
53288
|
}
|
|
53207
53289
|
}
|
|
53208
53290
|
return new Map([...missing].sort(([left], [right]) => left.localeCompare(right)));
|
|
@@ -53223,8 +53305,8 @@ function swiftTargetDependencies(files2, targets) {
|
|
|
53223
53305
|
(candidate) => candidate.name !== target.name && candidate.path !== "." && candidate.path.startsWith(prefix) && file.startsWith(`${candidate.path}/`)
|
|
53224
53306
|
))
|
|
53225
53307
|
continue;
|
|
53226
|
-
for (const
|
|
53227
|
-
if (names.has(
|
|
53308
|
+
for (const name3 of swiftImportNames(contents)) {
|
|
53309
|
+
if (names.has(name3) && name3 !== target.name) deps.add(name3);
|
|
53228
53310
|
}
|
|
53229
53311
|
}
|
|
53230
53312
|
siblings.set(target.name, [...deps].sort());
|
|
@@ -53254,7 +53336,7 @@ var EXECUTABLE_LINK_FLAGS = ` "-Xclang-linker", "-O0",
|
|
|
53254
53336
|
`;
|
|
53255
53337
|
var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
|
|
53256
53338
|
var MULTI_MANIFEST_VERSION = 39;
|
|
53257
|
-
var compilerSourceDigest = true ? "
|
|
53339
|
+
var compilerSourceDigest = true ? "c2ab17198fbe6328c75dc09bbe160fe6b0fd74d4b84a08e9f8dfcd2fcf4ca1f0" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
|
|
53258
53340
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
53259
53341
|
const hash = (0, import_node_crypto6.createHash)("sha256");
|
|
53260
53342
|
hash.update(`swift-compile
|
|
@@ -53280,10 +53362,10 @@ ${release}
|
|
|
53280
53362
|
(0, import_node_crypto6.createHash)("sha256").update(input.resources?.[base] ?? "").digest()
|
|
53281
53363
|
);
|
|
53282
53364
|
}
|
|
53283
|
-
for (const
|
|
53284
|
-
const image = input.images?.[
|
|
53365
|
+
for (const name3 of Object.keys(input.images ?? {}).sort()) {
|
|
53366
|
+
const image = input.images?.[name3];
|
|
53285
53367
|
if (!image) continue;
|
|
53286
|
-
hash.update((0, import_node_crypto6.createHash)("sha256").update(
|
|
53368
|
+
hash.update((0, import_node_crypto6.createHash)("sha256").update(name3).digest());
|
|
53287
53369
|
hash.update((0, import_node_crypto6.createHash)("sha256").update(image.file).digest());
|
|
53288
53370
|
hash.update((0, import_node_crypto6.createHash)("sha256").update(image.data).digest());
|
|
53289
53371
|
}
|
|
@@ -53322,17 +53404,17 @@ ${target}
|
|
|
53322
53404
|
function emitSwiftPackageManifest(args) {
|
|
53323
53405
|
const { targets, siblings, moduleRoot, oneModule, spriteKit, distribution } = args;
|
|
53324
53406
|
const reachedFrameworks = /* @__PURE__ */ new Set();
|
|
53325
|
-
const reach = (
|
|
53326
|
-
if (reachedFrameworks.has(
|
|
53327
|
-
reachedFrameworks.add(
|
|
53328
|
-
for (const dependency of OPTIONAL_FRAMEWORK_DEPENDENCIES[
|
|
53407
|
+
const reach = (name3) => {
|
|
53408
|
+
if (reachedFrameworks.has(name3)) return;
|
|
53409
|
+
reachedFrameworks.add(name3);
|
|
53410
|
+
for (const dependency of OPTIONAL_FRAMEWORK_DEPENDENCIES[name3] ?? [])
|
|
53329
53411
|
reach(dependency);
|
|
53330
53412
|
};
|
|
53331
|
-
for (const
|
|
53332
|
-
if (OPTIONAL_FRAMEWORKS.has(
|
|
53333
|
-
reach(
|
|
53413
|
+
for (const name3 of [...siblings.values()].flat())
|
|
53414
|
+
if (OPTIONAL_FRAMEWORKS.has(name3) && !targets.some((target) => target.name === name3))
|
|
53415
|
+
reach(name3);
|
|
53334
53416
|
if (spriteKit) {
|
|
53335
|
-
for (const
|
|
53417
|
+
for (const name3 of ["SpriteKit", "PeachBox2D", "simd", "GLKit"]) reach(name3);
|
|
53336
53418
|
}
|
|
53337
53419
|
const distributionLink = args.distributionLink;
|
|
53338
53420
|
if (distribution && !distributionLink)
|
|
@@ -53342,7 +53424,7 @@ function emitSwiftPackageManifest(args) {
|
|
|
53342
53424
|
if (distribution && distributionLink) {
|
|
53343
53425
|
const objects = distribution.objects.filter(
|
|
53344
53426
|
(object2) => [...OPTIONAL_FRAMEWORKS, "SpriteKit", "PeachBox2D"].every(
|
|
53345
|
-
(
|
|
53427
|
+
(name3) => !object2.startsWith(`lib/${name3}-`) || reachedFrameworks.has(name3)
|
|
53346
53428
|
)
|
|
53347
53429
|
);
|
|
53348
53430
|
distributionLink.files.set(
|
|
@@ -53371,11 +53453,11 @@ function emitSwiftPackageManifest(args) {
|
|
|
53371
53453
|
return ` .systemLibrary(name: ${JSON.stringify(target.name)}, path: ${JSON.stringify(target.path)}),`;
|
|
53372
53454
|
const isolation = target.mainActorIsolation ? " .defaultIsolation(MainActor.self)," : "";
|
|
53373
53455
|
const interoperability = target.cxxInterop ? " .interoperabilityMode(.Cxx)," : "";
|
|
53374
|
-
const defines = (target.defines ?? []).map((
|
|
53456
|
+
const defines = (target.defines ?? []).map((name3) => ` .define(${JSON.stringify(name3)}),`).join("");
|
|
53375
53457
|
const imports = distribution ? `, "-I", ${JSON.stringify(import_node_path10.default.join(moduleRoot, "modules"))}` : "";
|
|
53376
53458
|
const native = args.native?.get(target.name);
|
|
53377
|
-
const nativeImports = (siblings.get(target.name) ?? []).filter((
|
|
53378
|
-
(
|
|
53459
|
+
const nativeImports = (siblings.get(target.name) ?? []).filter((name3) => args.native?.has(name3)).map(
|
|
53460
|
+
(name3) => `, "-Xfrontend", "-import-module", "-Xfrontend", ${JSON.stringify(swiftTargetModuleName(name3))}`
|
|
53379
53461
|
).join("");
|
|
53380
53462
|
const header = args.headerDirectory && [...args.native?.values() ?? []].some(
|
|
53381
53463
|
(value) => value.late?.producers.includes(target.name)
|
|
@@ -53397,7 +53479,7 @@ function emitSwiftPackageManifest(args) {
|
|
|
53397
53479
|
const library = distribution && distributionLink ? ["-Xclang-linker", `--config=${distributionLink.path}`, ...distribution.link].map((flag) => `, ${JSON.stringify(flag)}`).join("") : "";
|
|
53398
53480
|
const kind = target.executable ? ".executableTarget" : ".target";
|
|
53399
53481
|
const linkedLibraries = (target.linkedLibraries ?? []).map(
|
|
53400
|
-
(
|
|
53482
|
+
(name3) => `.linkedLibrary(${JSON.stringify(name3)})`
|
|
53401
53483
|
);
|
|
53402
53484
|
const librarySettings = [
|
|
53403
53485
|
...linkedLibraries,
|
|
@@ -53436,9 +53518,9 @@ function emitSwiftPackageManifest(args) {
|
|
|
53436
53518
|
" targets: [",
|
|
53437
53519
|
...targets.map(stanza),
|
|
53438
53520
|
...[...args.native?.entries() ?? []].flatMap(
|
|
53439
|
-
([
|
|
53521
|
+
([name3, native]) => native.late ? [
|
|
53440
53522
|
` .target(name: ${JSON.stringify(native.late.name)},`,
|
|
53441
|
-
` dependencies: ${JSON.stringify([
|
|
53523
|
+
` dependencies: ${JSON.stringify([name3, ...native.late.producers])},`,
|
|
53442
53524
|
` path: ${JSON.stringify(native.path)},`,
|
|
53443
53525
|
` sources: ${JSON.stringify(native.lateSources)},`,
|
|
53444
53526
|
` publicHeadersPath: "include",`,
|
|
@@ -53691,7 +53773,7 @@ function extensionOverrideEdits(source, extraObjCExtensions) {
|
|
|
53691
53773
|
if (top?.kind !== "extension") continue;
|
|
53692
53774
|
const func = OVERRIDE_FUNC.exec(rest);
|
|
53693
53775
|
if (func) {
|
|
53694
|
-
const
|
|
53776
|
+
const name3 = func[2];
|
|
53695
53777
|
const open = at + func[0].length - 1;
|
|
53696
53778
|
let depth = 0;
|
|
53697
53779
|
let close = open;
|
|
@@ -53704,12 +53786,12 @@ function extensionOverrideEdits(source, extraObjCExtensions) {
|
|
|
53704
53786
|
const clause = source.slice(close + 1, body).trim();
|
|
53705
53787
|
const args = forwardedArguments(source.slice(open + 1, close));
|
|
53706
53788
|
if (args === null) continue;
|
|
53707
|
-
const call = (clause.includes("->") ? "return " : "") + (/\b(?:throws|rethrows)\b/.test(clause) ? "try " : "") + (/\basync\b/.test(clause) ? "await " : "") + `__peach_ext_${
|
|
53708
|
-
const signature = `func ${
|
|
53709
|
-
const nameAt = at + rest.indexOf(
|
|
53789
|
+
const call = (clause.includes("->") ? "return " : "") + (/\b(?:throws|rethrows)\b/.test(clause) ? "try " : "") + (/\basync\b/.test(clause) ? "await " : "") + `__peach_ext_${name3}(${args})`;
|
|
53790
|
+
const signature = `func ${name3}${func[3] ?? ""}${source.slice(open, close + 1)}${clause ? ` ${clause}` : ""}`;
|
|
53791
|
+
const nameAt = at + rest.indexOf(name3, rest.indexOf("func", "override".length + func[1].length) + 4);
|
|
53710
53792
|
lifted.push({
|
|
53711
53793
|
type: top.name,
|
|
53712
|
-
member:
|
|
53794
|
+
member: name3,
|
|
53713
53795
|
at,
|
|
53714
53796
|
modifiers,
|
|
53715
53797
|
access,
|
|
@@ -53727,16 +53809,16 @@ function extensionOverrideEdits(source, extraObjCExtensions) {
|
|
|
53727
53809
|
if (property) {
|
|
53728
53810
|
const open = at + property[0].length - 1;
|
|
53729
53811
|
if (/\b(?:set|willSet|didSet)\b/.test(source.slice(open, closing(open)))) continue;
|
|
53730
|
-
const
|
|
53731
|
-
const nameAt = at + rest.indexOf(
|
|
53812
|
+
const name3 = property[2];
|
|
53813
|
+
const nameAt = at + rest.indexOf(name3, rest.indexOf("var"));
|
|
53732
53814
|
lifted.push({
|
|
53733
53815
|
type: top.name,
|
|
53734
|
-
member:
|
|
53816
|
+
member: name3,
|
|
53735
53817
|
at,
|
|
53736
53818
|
modifiers,
|
|
53737
53819
|
access,
|
|
53738
|
-
decl: `var ${
|
|
53739
|
-
forward: `{ __peach_ext_${
|
|
53820
|
+
decl: `var ${name3}: ${property[3].trim()}`,
|
|
53821
|
+
forward: `{ __peach_ext_${name3} };`,
|
|
53740
53822
|
nameAt,
|
|
53741
53823
|
edits: [
|
|
53742
53824
|
[at, "override".length, " ".repeat("override".length)],
|
|
@@ -53874,15 +53956,15 @@ function objcRootedClasses(sources) {
|
|
|
53874
53956
|
))
|
|
53875
53957
|
bases.set(match[1], match[2]);
|
|
53876
53958
|
const rooted = /* @__PURE__ */ new Set();
|
|
53877
|
-
for (const
|
|
53878
|
-
const seen = /* @__PURE__ */ new Set([
|
|
53879
|
-
let base = bases.get(
|
|
53959
|
+
for (const name3 of bases.keys()) {
|
|
53960
|
+
const seen = /* @__PURE__ */ new Set([name3]);
|
|
53961
|
+
let base = bases.get(name3);
|
|
53880
53962
|
while (bases.has(base) && !seen.has(base)) {
|
|
53881
53963
|
seen.add(base);
|
|
53882
53964
|
base = bases.get(base);
|
|
53883
53965
|
}
|
|
53884
53966
|
if (!bases.has(base) && APPLE_CLASS.test(base) && !APPLE_PROTOCOL.test(base) && !(base in SDK_OBJC_OPTIONAL))
|
|
53885
|
-
rooted.add(
|
|
53967
|
+
rooted.add(name3);
|
|
53886
53968
|
}
|
|
53887
53969
|
return rooted;
|
|
53888
53970
|
}
|
|
@@ -54025,8 +54107,8 @@ function inheritedTypes(sources) {
|
|
|
54025
54107
|
if (colon === -1) continue;
|
|
54026
54108
|
const inherited = parents.get(owner[1]) ?? /* @__PURE__ */ new Set();
|
|
54027
54109
|
for (const type of splitTopLevel(header.slice(colon + 1).split(/\bwhere\b/)[0])) {
|
|
54028
|
-
const
|
|
54029
|
-
if (
|
|
54110
|
+
const name3 = /^\s*(?:[A-Za-z_]\w*\.)*([A-Za-z_]\w*)/.exec(type)?.[1];
|
|
54111
|
+
if (name3 && !type.includes("<")) inherited.add(name3);
|
|
54030
54112
|
}
|
|
54031
54113
|
parents.set(owner[1], inherited);
|
|
54032
54114
|
}
|
|
@@ -54105,20 +54187,20 @@ var DECLARATION_MODIFIERS = /* @__PURE__ */ new Set([
|
|
|
54105
54187
|
"unowned"
|
|
54106
54188
|
]);
|
|
54107
54189
|
function objcSelectorName(base, labels, isAsync, isThrowing) {
|
|
54108
|
-
let
|
|
54190
|
+
let name3 = base;
|
|
54109
54191
|
labels.forEach((label, index) => {
|
|
54110
|
-
if (index > 0)
|
|
54192
|
+
if (index > 0) name3 += `${label === "_" ? "" : label}:`;
|
|
54111
54193
|
else {
|
|
54112
54194
|
if (label !== "_") {
|
|
54113
54195
|
const firstWord = label[0] + /^[^A-Z_]*/.exec(label.slice(1))[0];
|
|
54114
|
-
|
|
54196
|
+
name3 += `${OBJC_PREPOSITIONS.has(firstWord) ? "" : "With"}${label[0].toUpperCase()}${label.slice(1)}`;
|
|
54115
54197
|
}
|
|
54116
|
-
|
|
54198
|
+
name3 += ":";
|
|
54117
54199
|
}
|
|
54118
54200
|
});
|
|
54119
|
-
if (isAsync)
|
|
54120
|
-
else if (isThrowing)
|
|
54121
|
-
return
|
|
54201
|
+
if (isAsync) name3 += labels.length ? "completionHandler:" : "WithCompletionHandler:";
|
|
54202
|
+
else if (isThrowing) name3 += labels.length ? "error:" : "AndReturnError:";
|
|
54203
|
+
return name3;
|
|
54122
54204
|
}
|
|
54123
54205
|
function declarationStart(code, at, floor) {
|
|
54124
54206
|
let start = at;
|
|
@@ -54180,22 +54262,22 @@ function objcOptionalProtocols(source) {
|
|
|
54180
54262
|
...(attributes.match(/@available\s*\((?:[^()"]|"(?:[^"\\]|\\.)*")*\)/g) ?? []).map((attribute) => attribute.replace(/\s*\n\s*/g, " ")),
|
|
54181
54263
|
access ?? ""
|
|
54182
54264
|
].filter((word) => word !== "").join(" ");
|
|
54183
|
-
const
|
|
54265
|
+
const name3 = member[2];
|
|
54184
54266
|
const after = at + member[0].length;
|
|
54185
54267
|
if (member[1] === "var") {
|
|
54186
54268
|
const typed = /^\s*:\s*([^{\n]+?)\s*\{[^}]*\}/.exec(code.slice(after));
|
|
54187
54269
|
if (!typed) continue;
|
|
54188
|
-
const selector2 = explicit ??
|
|
54270
|
+
const selector2 = explicit ?? name3;
|
|
54189
54271
|
const typeMember2 = /\bstatic\b/.test(code.slice(start, at));
|
|
54190
54272
|
members.push({
|
|
54191
|
-
name:
|
|
54273
|
+
name: name3,
|
|
54192
54274
|
labels: null,
|
|
54193
54275
|
selector: selector2,
|
|
54194
54276
|
start,
|
|
54195
54277
|
end: after + typed[0].length,
|
|
54196
54278
|
result: objcTypeName(typed[1]),
|
|
54197
54279
|
typeMember: typeMember2,
|
|
54198
|
-
helper: `${head} ${typeMember2 ? "static " : ""}var ${
|
|
54280
|
+
helper: `${head} ${typeMember2 ? "static " : ""}var ${name3}: ${optionalResult(typed[1])} { _objcOptionalSend(self, Selector(${JSON.stringify(selector2)}), [], default: nil) }`
|
|
54199
54281
|
});
|
|
54200
54282
|
continue;
|
|
54201
54283
|
}
|
|
@@ -54207,10 +54289,10 @@ function objcOptionalProtocols(source) {
|
|
|
54207
54289
|
const parameters = code.slice(paren + 1, shut);
|
|
54208
54290
|
const names = parameterNames(parameters);
|
|
54209
54291
|
const labels = names.map((parameter) => parameter.label);
|
|
54210
|
-
const selector = explicit ?? objcSelectorName(
|
|
54292
|
+
const selector = explicit ?? objcSelectorName(name3, labels, tail[1] !== void 0, tail[2] !== void 0);
|
|
54211
54293
|
const typeMember = /\bstatic\b/.test(code.slice(start, at));
|
|
54212
54294
|
members.push({
|
|
54213
|
-
name:
|
|
54295
|
+
name: name3,
|
|
54214
54296
|
labels,
|
|
54215
54297
|
typeMember,
|
|
54216
54298
|
selector,
|
|
@@ -54219,12 +54301,12 @@ function objcOptionalProtocols(source) {
|
|
|
54219
54301
|
types: parameterTypes(parameters),
|
|
54220
54302
|
result: objcTypeName(tail[3]?.trim() ?? "Void"),
|
|
54221
54303
|
helper: typeMember && (tail[1] !== void 0 || tail[2] !== void 0) ? null : tail[1] !== void 0 ? objcAsyncOptionalHelper(
|
|
54222
|
-
`${head} func ${
|
|
54304
|
+
`${head} func ${name3}(${parameters.replace(/\s*\n\s*/g, " ")})`,
|
|
54223
54305
|
parameters,
|
|
54224
54306
|
selector,
|
|
54225
54307
|
tail[3]?.trim() ?? "Void",
|
|
54226
54308
|
tail[2] !== void 0
|
|
54227
|
-
) : tail[2] !== void 0 ? null : `@discardableResult ${head} ${typeMember ? "static " : ""}func ${
|
|
54309
|
+
) : 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)`)} }`
|
|
54228
54310
|
});
|
|
54229
54311
|
}
|
|
54230
54312
|
if (members.length) found.push({ name: declared[1], close, members });
|
|
@@ -54241,8 +54323,8 @@ function escapingSend(parameters, send, effects = "") {
|
|
|
54241
54323
|
if (!named || !type?.startsWith("(")) return body;
|
|
54242
54324
|
const shut = closingParen(type, 0);
|
|
54243
54325
|
if (!/^\s*(?:async\b\s*)?(?:throws\b\s*)?->/.test(type.slice(shut + 1))) return body;
|
|
54244
|
-
const
|
|
54245
|
-
return `${effects}withoutActuallyEscaping(${
|
|
54326
|
+
const name3 = named[2] ?? named[1];
|
|
54327
|
+
return `${effects}withoutActuallyEscaping(${name3}) { ${name3} in ${body} }`;
|
|
54246
54328
|
}, send);
|
|
54247
54329
|
}
|
|
54248
54330
|
function objcAsyncOptionalHelper(declaration, parameters, selector, result, throwing) {
|
|
@@ -55692,10 +55774,10 @@ function objcTypeMethods(source, found) {
|
|
|
55692
55774
|
function objcIndex(sources) {
|
|
55693
55775
|
const requirements = /* @__PURE__ */ new Map();
|
|
55694
55776
|
const callable = /* @__PURE__ */ new Map();
|
|
55695
|
-
const callableAs = (
|
|
55696
|
-
const known = callable.get(
|
|
55777
|
+
const callableAs = (name3, member, labels) => {
|
|
55778
|
+
const known = callable.get(name3);
|
|
55697
55779
|
if (known) known.labels.push(labels);
|
|
55698
|
-
else callable.set(
|
|
55780
|
+
else callable.set(name3, { member, labels: [labels] });
|
|
55699
55781
|
};
|
|
55700
55782
|
const typeMethods = /* @__PURE__ */ new Map();
|
|
55701
55783
|
const sdkParents = /* @__PURE__ */ new Map();
|
|
@@ -55713,9 +55795,9 @@ function objcIndex(sources) {
|
|
|
55713
55795
|
requirements.set(
|
|
55714
55796
|
protocol,
|
|
55715
55797
|
sdk.requirements.map(([signature, selector, typed, asyncSignature]) => {
|
|
55716
|
-
const
|
|
55717
|
-
const labels = signature.slice(
|
|
55718
|
-
if (sdk.callers) callableAs(
|
|
55798
|
+
const name3 = signature.slice(0, signature.indexOf("("));
|
|
55799
|
+
const labels = signature.slice(name3.length + 1, -1).split(":").slice(0, -1);
|
|
55800
|
+
if (sdk.callers) callableAs(name3, `_objcOptional_${name3}`, labels);
|
|
55719
55801
|
const arrow = typed?.lastIndexOf("->") ?? -1;
|
|
55720
55802
|
const types = typed?.slice(0, arrow);
|
|
55721
55803
|
const result = typed?.slice(arrow + 2);
|
|
@@ -55726,7 +55808,7 @@ function objcIndex(sources) {
|
|
|
55726
55808
|
const values = handler ? splitTopLevel(handler[1]) : [];
|
|
55727
55809
|
const asyncName = asyncSignature?.slice(0, asyncSignature.indexOf("("));
|
|
55728
55810
|
return {
|
|
55729
|
-
name:
|
|
55811
|
+
name: name3,
|
|
55730
55812
|
labels,
|
|
55731
55813
|
selector,
|
|
55732
55814
|
...parameters !== void 0 && { types: parameters },
|
|
@@ -55752,8 +55834,8 @@ function objcIndex(sources) {
|
|
|
55752
55834
|
for (const protocol of objcOptionalProtocols(source)) {
|
|
55753
55835
|
requirements.set(
|
|
55754
55836
|
protocol.name,
|
|
55755
|
-
protocol.members.map(({ name:
|
|
55756
|
-
name:
|
|
55837
|
+
protocol.members.map(({ name: name3, labels, selector, types, result, typeMember }) => ({
|
|
55838
|
+
name: name3,
|
|
55757
55839
|
labels,
|
|
55758
55840
|
selector,
|
|
55759
55841
|
...typeMember && { typeMember },
|
|
@@ -55783,18 +55865,18 @@ function objcIndex(sources) {
|
|
|
55783
55865
|
const code = swiftCodeMask(source);
|
|
55784
55866
|
const braces = [...code.matchAll(/[{}]/g)].map((match) => match.index);
|
|
55785
55867
|
for (const protocol of code.matchAll(/\bprotocol\s+([A-Za-z_]\w*)[^{}]*\{/g)) {
|
|
55786
|
-
const
|
|
55787
|
-
protocols.add(
|
|
55868
|
+
const name3 = protocol[1];
|
|
55869
|
+
protocols.add(name3);
|
|
55788
55870
|
const open = protocol.index + protocol[0].length - 1;
|
|
55789
55871
|
if (/\binit\s*[?!]?\s*\(/.test(code.slice(open + 1, closingBrace(code, braces, open))))
|
|
55790
|
-
initializers.add(
|
|
55872
|
+
initializers.add(name3);
|
|
55791
55873
|
}
|
|
55792
55874
|
}
|
|
55793
55875
|
const rooted = conformingTypes(parents, /* @__PURE__ */ new Set(["NSObject"]));
|
|
55794
55876
|
const initialized = conformingTypes(parents, initializers);
|
|
55795
55877
|
const nsObjectTypes = /* @__PURE__ */ new Set([
|
|
55796
55878
|
"NSObject",
|
|
55797
|
-
...[...protocols].filter((
|
|
55879
|
+
...[...protocols].filter((name3) => rooted.has(name3) && !initialized.has(name3))
|
|
55798
55880
|
]);
|
|
55799
55881
|
return {
|
|
55800
55882
|
requirements,
|
|
@@ -55821,8 +55903,8 @@ function objcAliases(sources) {
|
|
|
55821
55903
|
}
|
|
55822
55904
|
}
|
|
55823
55905
|
const aliases = /* @__PURE__ */ new Map();
|
|
55824
|
-
for (const [
|
|
55825
|
-
for (const [
|
|
55906
|
+
for (const [name3, type] of declared) if (type !== null) aliases.set(name3, type);
|
|
55907
|
+
for (const [name3, type] of aliases) aliases.set(name3, resolveAliases(type, aliases));
|
|
55826
55908
|
return aliases;
|
|
55827
55909
|
}
|
|
55828
55910
|
function resolveAliases(type, aliases) {
|
|
@@ -55830,7 +55912,7 @@ function resolveAliases(type, aliases) {
|
|
|
55830
55912
|
for (let pass = 0; pass < 8 && aliases.size; pass++) {
|
|
55831
55913
|
const next = resolved.replace(
|
|
55832
55914
|
/(?<![\w.])[A-Za-z_]\w*(?![\w.])/g,
|
|
55833
|
-
(
|
|
55915
|
+
(name3) => aliases.get(name3) ?? name3
|
|
55834
55916
|
);
|
|
55835
55917
|
if (next === resolved) break;
|
|
55836
55918
|
resolved = next;
|
|
@@ -55936,17 +56018,17 @@ function lowerObjCOptionalRequirements(source, index) {
|
|
|
55936
56018
|
`; extension ${protocol.name} { ${helpers.join("; ")} }`
|
|
55937
56019
|
]);
|
|
55938
56020
|
}
|
|
55939
|
-
for (const
|
|
56021
|
+
for (const name3 of code.matchAll(
|
|
55940
56022
|
/#selector\(\s*([A-Za-z_]\w*)\.([A-Za-z_]\w*)\(((?:\s*\w+\s*:)+)\s*\)\s*\)/g
|
|
55941
56023
|
)) {
|
|
55942
|
-
const signature = `${
|
|
55943
|
-
const found = SDK_OBJC_OPTIONAL[
|
|
56024
|
+
const signature = `${name3[2]}(${name3[3].replace(/\s+/g, "")})`;
|
|
56025
|
+
const found = SDK_OBJC_OPTIONAL[name3[1]]?.requirements.filter(
|
|
55944
56026
|
([requirement]) => requirement === signature
|
|
55945
56027
|
);
|
|
55946
56028
|
if (found?.length === 1)
|
|
55947
56029
|
edits.push([
|
|
55948
|
-
|
|
55949
|
-
|
|
56030
|
+
name3.index,
|
|
56031
|
+
name3[0].length,
|
|
55950
56032
|
`NSSelectorFromString(${JSON.stringify(found[0][1])})`
|
|
55951
56033
|
]);
|
|
55952
56034
|
}
|
|
@@ -55954,7 +56036,7 @@ function lowerObjCOptionalRequirements(source, index) {
|
|
|
55954
56036
|
const receivesAsProtocol = (dot) => {
|
|
55955
56037
|
const receiver = /([A-Za-z_]\w*)\s*[?!]?\s*$/.exec(code.slice(0, dot))?.[1];
|
|
55956
56038
|
if (!receiver) return false;
|
|
55957
|
-
const
|
|
56039
|
+
const name3 = /^\.\s*([A-Za-z_]\w*)/.exec(code.slice(dot))?.[1];
|
|
55958
56040
|
let innermost;
|
|
55959
56041
|
for (const declared of code.matchAll(
|
|
55960
56042
|
new RegExp(
|
|
@@ -55967,7 +56049,7 @@ function lowerObjCOptionalRequirements(source, index) {
|
|
|
55967
56049
|
if (dot > from && dot < to && (!innermost || from >= innermost.from))
|
|
55968
56050
|
innermost = { from, type: declared[1] };
|
|
55969
56051
|
}
|
|
55970
|
-
return innermost?.type !== void 0 && !!index.requirements.get(resolveAliases(innermost.type, index.aliases))?.some((wanted) => wanted.name ===
|
|
56052
|
+
return innermost?.type !== void 0 && !!index.requirements.get(resolveAliases(innermost.type, index.aliases))?.some((wanted) => wanted.name === name3);
|
|
55971
56053
|
};
|
|
55972
56054
|
for (const call of code.matchAll(/\.\s*([A-Za-z_]\w*)\s*\?(?=\s*[({])/g)) {
|
|
55973
56055
|
const callable = index.callable.get(call[1]);
|
|
@@ -55984,8 +56066,8 @@ function lowerObjCOptionalRequirements(source, index) {
|
|
|
55984
56066
|
continue;
|
|
55985
56067
|
if (callable.member === call[1]) edits.push([mark, 1, " "]);
|
|
55986
56068
|
else {
|
|
55987
|
-
const
|
|
55988
|
-
edits.push([
|
|
56069
|
+
const name3 = call.index + call[0].indexOf(call[1]);
|
|
56070
|
+
edits.push([name3, mark + 1 - name3, callable.member]);
|
|
55989
56071
|
}
|
|
55990
56072
|
}
|
|
55991
56073
|
for (const owner of code.matchAll(
|
|
@@ -56084,8 +56166,8 @@ function lowerObjCRuntimeCalls(source, index) {
|
|
|
56084
56166
|
for (const declared of code.matchAll(
|
|
56085
56167
|
/(?:\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
|
|
56086
56168
|
)) {
|
|
56087
|
-
const
|
|
56088
|
-
const list2 = declarations.get(
|
|
56169
|
+
const name3 = declared[1] ?? declared[4] ?? declared[5];
|
|
56170
|
+
const list2 = declarations.get(name3) ?? [];
|
|
56089
56171
|
let type = declared[3] ? "" : declared[2] ?? "";
|
|
56090
56172
|
if (!type && declared[4]) {
|
|
56091
56173
|
const lookup = /^\s*=\s*NSClassFromString\s*\(/.exec(
|
|
@@ -56100,7 +56182,7 @@ function lowerObjCRuntimeCalls(source, index) {
|
|
|
56100
56182
|
}
|
|
56101
56183
|
const resolved = type.endsWith(".Type") ? `${resolveAliases(type.slice(0, -5), index.aliases)}.Type` : resolveAliases(type, index.aliases);
|
|
56102
56184
|
list2.push({ at: declared.index, type: resolved });
|
|
56103
|
-
declarations.set(
|
|
56185
|
+
declarations.set(name3, list2);
|
|
56104
56186
|
}
|
|
56105
56187
|
for (const pattern of code.matchAll(/\b(?:let|var|for)\s*(?=\(|\.\s*\w+\s*\()/g)) {
|
|
56106
56188
|
const open = code.indexOf("(", pattern.index + pattern[0].length);
|
|
@@ -56113,9 +56195,9 @@ function lowerObjCRuntimeCalls(source, index) {
|
|
|
56113
56195
|
}
|
|
56114
56196
|
for (const list2 of declarations.values()) list2.sort((a, b) => a.at - b.at);
|
|
56115
56197
|
const braces = [...code.matchAll(/[{}]/g)].map((match) => match.index);
|
|
56116
|
-
const receiverType = (
|
|
56198
|
+
const receiverType = (name3, at) => {
|
|
56117
56199
|
let innermost;
|
|
56118
|
-
for (const declared of declarations.get(
|
|
56200
|
+
for (const declared of declarations.get(name3) ?? []) {
|
|
56119
56201
|
if (declared.at > at) break;
|
|
56120
56202
|
const [from, to] = declarationScope(code, braces, declared.at);
|
|
56121
56203
|
if (at > from && at < to && (!innermost || from >= innermost.from))
|
|
@@ -56954,7 +57036,7 @@ var CORE_FOUNDATION_HANDLE_IMPORTS = [
|
|
|
56954
57036
|
"CFSet",
|
|
56955
57037
|
"CFString",
|
|
56956
57038
|
"CFURL"
|
|
56957
|
-
].map((
|
|
57039
|
+
].map((name3) => `import class CoreFoundation.${name3}`).concat([
|
|
56958
57040
|
"import typealias CoreFoundation.CFPropertyList",
|
|
56959
57041
|
"import typealias CoreFoundation.CFTypeRef",
|
|
56960
57042
|
"import CoreGraphics"
|
|
@@ -57148,11 +57230,11 @@ function swiftSourceClosure(files2, roots) {
|
|
|
57148
57230
|
continue;
|
|
57149
57231
|
}
|
|
57150
57232
|
if (depth !== 0 || !match[2]) continue;
|
|
57151
|
-
const
|
|
57233
|
+
const name3 = match[2].split(".").pop();
|
|
57152
57234
|
const index = match[1] === "extension" ? extensions : owners;
|
|
57153
|
-
const set2 = index.get(
|
|
57235
|
+
const set2 = index.get(name3) ?? /* @__PURE__ */ new Set();
|
|
57154
57236
|
set2.add(file);
|
|
57155
|
-
index.set(
|
|
57237
|
+
index.set(name3, set2);
|
|
57156
57238
|
}
|
|
57157
57239
|
sources.set(file, references);
|
|
57158
57240
|
}
|
|
@@ -57160,10 +57242,10 @@ function swiftSourceClosure(files2, roots) {
|
|
|
57160
57242
|
const pending = [...roots];
|
|
57161
57243
|
const seen = /* @__PURE__ */ new Set();
|
|
57162
57244
|
while (pending.length) {
|
|
57163
|
-
const
|
|
57164
|
-
if (seen.has(
|
|
57165
|
-
seen.add(
|
|
57166
|
-
for (const file of [...owners.get(
|
|
57245
|
+
const name3 = pending.pop();
|
|
57246
|
+
if (seen.has(name3)) continue;
|
|
57247
|
+
seen.add(name3);
|
|
57248
|
+
for (const file of [...owners.get(name3) ?? [], ...extensions.get(name3) ?? []]) {
|
|
57167
57249
|
if (included.has(file)) continue;
|
|
57168
57250
|
included.add(file);
|
|
57169
57251
|
for (const reference of sources.get(file)) pending.push(reference);
|
|
@@ -57413,7 +57495,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
57413
57495
|
[
|
|
57414
57496
|
product,
|
|
57415
57497
|
...optionalProducts.map(
|
|
57416
|
-
(
|
|
57498
|
+
(name3) => `.product(name: "${name3}", package: "sootsim-swift"),`
|
|
57417
57499
|
)
|
|
57418
57500
|
].join("\n ")
|
|
57419
57501
|
);
|
|
@@ -57528,7 +57610,7 @@ function builtArtifact(layout) {
|
|
|
57528
57610
|
}
|
|
57529
57611
|
const file = import_node_path10.default.join(binDir, `${executable.name}.wasm`);
|
|
57530
57612
|
if (!(0, import_node_fs11.existsSync)(file)) {
|
|
57531
|
-
const found = (0, import_node_fs11.existsSync)(binDir) ? (0, import_node_fs11.readdirSync)(binDir).filter((
|
|
57613
|
+
const found = (0, import_node_fs11.existsSync)(binDir) ? (0, import_node_fs11.readdirSync)(binDir).filter((name3) => name3.endsWith(".wasm")).sort() : [];
|
|
57532
57614
|
throw new Error(
|
|
57533
57615
|
`swift-compile: the build produced no ${executable.name}.wasm (found: ${found.join(", ") || "none"})`
|
|
57534
57616
|
);
|
|
@@ -57708,7 +57790,7 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
57708
57790
|
}
|
|
57709
57791
|
return withSwiftRootLock(
|
|
57710
57792
|
root,
|
|
57711
|
-
async () => {
|
|
57793
|
+
async (lease) => {
|
|
57712
57794
|
const built2 = readCompiledArtifact(import_node_path10.default.join(sharedRoot, "artifact"), hash);
|
|
57713
57795
|
if (built2) {
|
|
57714
57796
|
report("reusing verified disk artifact");
|
|
@@ -57771,7 +57853,8 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
57771
57853
|
},
|
|
57772
57854
|
maxBuffer: 64 * 1024 * 1024,
|
|
57773
57855
|
timeout: options.timeoutMs,
|
|
57774
|
-
signal: options.signal
|
|
57856
|
+
signal: options.signal,
|
|
57857
|
+
lease
|
|
57775
57858
|
};
|
|
57776
57859
|
report("compiling and linking Swift modules");
|
|
57777
57860
|
try {
|
|
@@ -57888,8 +57971,8 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
57888
57971
|
const kind = text2(entry.kind) ?? "file-reference";
|
|
57889
57972
|
const raw2 = text2(entry.path) ?? "";
|
|
57890
57973
|
const located = raw2 === "" ? null : locate(raw2, parent.dir);
|
|
57891
|
-
const
|
|
57892
|
-
const node = { id: "", name:
|
|
57974
|
+
const name3 = text2(entry.name) ?? import_node_path11.default.basename(raw2);
|
|
57975
|
+
const node = { id: "", name: name3, dir: null, parent, children: [] };
|
|
57893
57976
|
if (kind === "group" || kind === "variant-group" || kind === "version-group") {
|
|
57894
57977
|
node.dir = raw2 === "" ? parent.dir : located?.sourceTree === "<absolute>" ? located.path : null;
|
|
57895
57978
|
const childIds = walk2(items(entry.children), node);
|
|
@@ -57902,7 +57985,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
57902
57985
|
isa: kind === "variant-group" ? "PBXVariantGroup" : "PBXGroup",
|
|
57903
57986
|
children: childIds,
|
|
57904
57987
|
...kind === "variant-group" ? {} : { sourceTree: "<absolute>", path: node.dir ?? "" },
|
|
57905
|
-
name:
|
|
57988
|
+
name: name3
|
|
57906
57989
|
},
|
|
57907
57990
|
text2(entry.id)
|
|
57908
57991
|
);
|
|
@@ -57920,7 +58003,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
57920
58003
|
{
|
|
57921
58004
|
isa: "PBXFileReference",
|
|
57922
58005
|
...located ?? { sourceTree: "SDKROOT", path: raw2 },
|
|
57923
|
-
name:
|
|
58006
|
+
name: name3
|
|
57924
58007
|
},
|
|
57925
58008
|
text2(entry.id)
|
|
57926
58009
|
);
|
|
@@ -57972,8 +58055,8 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
57972
58055
|
return node;
|
|
57973
58056
|
};
|
|
57974
58057
|
const configurations = items(json.configurations).flatMap((entry) => {
|
|
57975
|
-
const
|
|
57976
|
-
return
|
|
58058
|
+
const name3 = isObject(entry) ? text2(entry.name) : text2(entry);
|
|
58059
|
+
return name3 ? [{ name: name3, file: isObject(entry) ? entry.file : void 0 }] : [];
|
|
57977
58060
|
});
|
|
57978
58061
|
const settingsOf = (value) => Object.fromEntries(
|
|
57979
58062
|
Object.entries(isObject(value) ? value : {}).flatMap(
|
|
@@ -57988,11 +58071,11 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
57988
58071
|
const configurationList = (settings, specialized) => add({
|
|
57989
58072
|
isa: "XCConfigurationList",
|
|
57990
58073
|
defaultConfigurationName: text2(json["default-configuration"]) ?? "Debug",
|
|
57991
|
-
buildConfigurations: configurations.map(({ name:
|
|
57992
|
-
const base = lookup(specialized.has(
|
|
58074
|
+
buildConfigurations: configurations.map(({ name: name3, file }) => {
|
|
58075
|
+
const base = lookup(specialized.has(name3) ? specialized.get(name3) : file);
|
|
57993
58076
|
return add({
|
|
57994
58077
|
isa: "XCBuildConfiguration",
|
|
57995
|
-
name:
|
|
58078
|
+
name: name3,
|
|
57996
58079
|
buildSettings: settings,
|
|
57997
58080
|
...base ? { baseConfigurationReference: base } : {}
|
|
57998
58081
|
});
|
|
@@ -58003,9 +58086,9 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
58003
58086
|
if (!isObject(entry)) continue;
|
|
58004
58087
|
const repository = text2(entry.repository);
|
|
58005
58088
|
const local = text2(entry.path);
|
|
58006
|
-
const
|
|
58089
|
+
const name3 = local !== void 0 ? import_node_path11.default.basename(import_node_path11.default.resolve(import_node_path11.default.dirname(xcodeproj), local)) : import_node_path11.default.basename(repository ?? "").replace(/\.git$/, "");
|
|
58007
58090
|
const id = text2(entry.kind) === "local" && local !== void 0 ? add({ isa: "XCLocalSwiftPackageReference", relativePath: local }) : add({ isa: "XCRemoteSwiftPackageReference", repositoryURL: repository ?? "" });
|
|
58008
|
-
packageIds.set(
|
|
58091
|
+
packageIds.set(name3.toLowerCase(), id);
|
|
58009
58092
|
}
|
|
58010
58093
|
const productDependency = (entry) => add({
|
|
58011
58094
|
isa: "XCSwiftPackageProductDependency",
|
|
@@ -58025,12 +58108,12 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
58025
58108
|
const targets = [];
|
|
58026
58109
|
for (const entry of items(json.targets)) {
|
|
58027
58110
|
if (!isObject(entry)) continue;
|
|
58028
|
-
const
|
|
58111
|
+
const name3 = text2(entry.name) ?? "";
|
|
58029
58112
|
const productType = text2(entry["product-type"]);
|
|
58030
58113
|
const target = {
|
|
58031
58114
|
isa: text2(entry.kind) === "aggregate" ? "PBXAggregateTarget" : "PBXNativeTarget",
|
|
58032
|
-
name:
|
|
58033
|
-
productName:
|
|
58115
|
+
name: name3,
|
|
58116
|
+
productName: name3,
|
|
58034
58117
|
productType: productType ? `com.apple.product-type.${productType}` : text2(entry["full-product-type"]) ?? "",
|
|
58035
58118
|
buildPhases: [],
|
|
58036
58119
|
dependencies: [],
|
|
@@ -58040,7 +58123,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
58040
58123
|
const product = lookup(entry.product);
|
|
58041
58124
|
if (product) target.productReference = product;
|
|
58042
58125
|
const id = add(target, text2(entry.id));
|
|
58043
|
-
targetIds.set(
|
|
58126
|
+
targetIds.set(name3, id);
|
|
58044
58127
|
targets.push({ id, target, entry });
|
|
58045
58128
|
for (const phase of items(entry["build-phases"])) {
|
|
58046
58129
|
const kind = isObject(phase) ? text2(phase.kind) : text2(phase);
|
|
@@ -58052,7 +58135,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
58052
58135
|
isObject(phase) ? text2(phase.id) : void 0
|
|
58053
58136
|
);
|
|
58054
58137
|
target.buildPhases.push(phaseId);
|
|
58055
|
-
phases.set([
|
|
58138
|
+
phases.set([name3, kind, phaseName].filter(Boolean).join("/"), phaseId);
|
|
58056
58139
|
phases.set(`id:${phaseId}`, phaseId);
|
|
58057
58140
|
}
|
|
58058
58141
|
}
|
|
@@ -58068,7 +58151,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
58068
58151
|
files2?.push(add({ isa: "PBXBuildFile", fileRef: refId }));
|
|
58069
58152
|
}
|
|
58070
58153
|
for (const { target, entry } of targets) {
|
|
58071
|
-
const
|
|
58154
|
+
const name3 = text2(entry.name) ?? "";
|
|
58072
58155
|
target.buildConfigurationList = configurationList(
|
|
58073
58156
|
settingsOf(entry["build-settings"]),
|
|
58074
58157
|
new Map(
|
|
@@ -58106,7 +58189,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
58106
58189
|
const dependency = productDependency(member);
|
|
58107
58190
|
target.packageProductDependencies.push(dependency);
|
|
58108
58191
|
const buildFile = member["build-phase"];
|
|
58109
|
-
phaseFiles(isObject(buildFile) ? buildFile["build-phase"] : buildFile,
|
|
58192
|
+
phaseFiles(isObject(buildFile) ? buildFile["build-phase"] : buildFile, name3)?.push(
|
|
58110
58193
|
add({ isa: "PBXBuildFile", productRef: dependency })
|
|
58111
58194
|
);
|
|
58112
58195
|
}
|
|
@@ -58408,8 +58491,8 @@ function applyConditions(raw2, configuration) {
|
|
|
58408
58491
|
continue;
|
|
58409
58492
|
}
|
|
58410
58493
|
const matches = [...key2.slice(bracket).matchAll(/\[([^=\]]+)=([^\]]*)\]/g)].every(
|
|
58411
|
-
([,
|
|
58412
|
-
const actual =
|
|
58494
|
+
([, name3, pattern]) => {
|
|
58495
|
+
const actual = name3 === "config" ? configuration : CONDITIONS[name3];
|
|
58413
58496
|
return actual !== void 0 && new RegExp(
|
|
58414
58497
|
`^${pattern.replace(/[.+^${}()|\\]/g, "\\$&").replaceAll("*", ".*").replaceAll("?", ".")}$`
|
|
58415
58498
|
).test(actual);
|
|
@@ -58469,9 +58552,9 @@ function workspaceReferences(workspace) {
|
|
|
58469
58552
|
function enclosingXcodeWorkspace(xcodeproj) {
|
|
58470
58553
|
const project = import_node_fs12.default.realpathSync(xcodeproj);
|
|
58471
58554
|
for (let dir = import_node_path12.default.dirname(project); ; dir = import_node_path12.default.dirname(dir)) {
|
|
58472
|
-
for (const
|
|
58473
|
-
if (!
|
|
58474
|
-
const workspace = import_node_path12.default.join(dir,
|
|
58555
|
+
for (const name3 of import_node_fs12.default.readdirSync(dir).sort()) {
|
|
58556
|
+
if (!name3.endsWith(".xcworkspace")) continue;
|
|
58557
|
+
const workspace = import_node_path12.default.join(dir, name3);
|
|
58475
58558
|
if (!import_node_fs12.default.existsSync(import_node_path12.default.join(workspace, "contents.xcworkspacedata"))) continue;
|
|
58476
58559
|
if (workspaceReferences(workspace).some(
|
|
58477
58560
|
(reference) => import_node_fs12.default.existsSync(reference) && import_node_fs12.default.realpathSync(reference) === project
|
|
@@ -58489,7 +58572,7 @@ function findXcodeProject(input) {
|
|
|
58489
58572
|
if (resolved.endsWith(".xcodeproj")) return resolved;
|
|
58490
58573
|
if (!isDirectory(resolved)) return null;
|
|
58491
58574
|
for (const extension of [".xcworkspace", ".xcodeproj"]) {
|
|
58492
|
-
const found = import_node_fs12.default.readdirSync(resolved).filter((
|
|
58575
|
+
const found = import_node_fs12.default.readdirSync(resolved).filter((name3) => name3.endsWith(extension)).sort();
|
|
58493
58576
|
if (found.length > 1) {
|
|
58494
58577
|
throw new Error(
|
|
58495
58578
|
`${resolved} holds ${found.length} ${extension} bundles (${found.join(", ")}); pass one`
|
|
@@ -58501,8 +58584,8 @@ function findXcodeProject(input) {
|
|
|
58501
58584
|
}
|
|
58502
58585
|
var loaded = /* @__PURE__ */ new Map();
|
|
58503
58586
|
function xcodeProjectFile(xcodeproj) {
|
|
58504
|
-
for (const
|
|
58505
|
-
const file = import_node_path12.default.join(xcodeproj,
|
|
58587
|
+
for (const name3 of ["project.pbxproj", "project.xcproj"]) {
|
|
58588
|
+
const file = import_node_path12.default.join(xcodeproj, name3);
|
|
58506
58589
|
if (import_node_fs12.default.existsSync(file)) return file;
|
|
58507
58590
|
}
|
|
58508
58591
|
return null;
|
|
@@ -58559,7 +58642,7 @@ function targetSettings(ref, configuration, builtins, options = {}) {
|
|
|
58559
58642
|
const configs = list(configList?.buildConfigurations).map(project.object);
|
|
58560
58643
|
const config = configs.find((entry) => entry?.name === configuration) ?? configs.find((entry) => entry?.name === str(configList?.defaultConfigurationName));
|
|
58561
58644
|
if (!config) return [];
|
|
58562
|
-
const
|
|
58645
|
+
const name3 = str(config.name) ?? configuration;
|
|
58563
58646
|
const base = str(config.baseConfigurationReference);
|
|
58564
58647
|
const anchor = str(config.baseConfigurationReferenceAnchor);
|
|
58565
58648
|
const relative2 = str(config.baseConfigurationReferenceRelativePath);
|
|
@@ -58574,14 +58657,14 @@ function targetSettings(ref, configuration, builtins, options = {}) {
|
|
|
58574
58657
|
const fromFile = baseFile ? readXcconfig(baseFile, read) : {};
|
|
58575
58658
|
xcconfigs.push(...read);
|
|
58576
58659
|
return [
|
|
58577
|
-
applyConditions(fromFile,
|
|
58660
|
+
applyConditions(fromFile, name3),
|
|
58578
58661
|
applyConditions(
|
|
58579
58662
|
Object.fromEntries(
|
|
58580
58663
|
Object.entries(own).flatMap(
|
|
58581
58664
|
([key2, value]) => typeof value === "string" ? [[key2, value]] : Array.isArray(value) ? [[key2, list(value).join(" ")]] : []
|
|
58582
58665
|
)
|
|
58583
58666
|
),
|
|
58584
|
-
|
|
58667
|
+
name3
|
|
58585
58668
|
)
|
|
58586
58669
|
];
|
|
58587
58670
|
};
|
|
@@ -58601,13 +58684,13 @@ function targetSettings(ref, configuration, builtins, options = {}) {
|
|
|
58601
58684
|
resolving2.add(marker);
|
|
58602
58685
|
const value = expand(
|
|
58603
58686
|
levels[at][key2],
|
|
58604
|
-
(
|
|
58687
|
+
(name3) => name3 === "inherited" ? valueAt(key2, at - 1) : valueAt(name3, levels.length - 1)
|
|
58605
58688
|
);
|
|
58606
58689
|
resolving2.delete(marker);
|
|
58607
58690
|
return value;
|
|
58608
58691
|
};
|
|
58609
58692
|
const derived = (key2) => {
|
|
58610
|
-
const get = (
|
|
58693
|
+
const get = (name3) => valueAt(name3, levels.length - 1);
|
|
58611
58694
|
switch (key2) {
|
|
58612
58695
|
case "PRODUCT_NAME":
|
|
58613
58696
|
return get("TARGET_NAME");
|
|
@@ -58615,6 +58698,9 @@ function targetSettings(ref, configuration, builtins, options = {}) {
|
|
|
58615
58698
|
return applyOperator(get("PRODUCT_NAME"), "c99extidentifier");
|
|
58616
58699
|
case "EXECUTABLE_NAME":
|
|
58617
58700
|
return get("PRODUCT_NAME");
|
|
58701
|
+
// the native default of CoreBuildSystem.xcspec
|
|
58702
|
+
case "EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES":
|
|
58703
|
+
return "*.nib *.lproj *.framework *.gch *.xcode* *.xcassets *.icon (*) .DS_Store CVS .svn .git .hg *.pbproj *.pbxproj";
|
|
58618
58704
|
case "AppIdentifierPrefix":
|
|
58619
58705
|
case "TeamIdentifierPrefix": {
|
|
58620
58706
|
const team = get("DEVELOPMENT_TEAM");
|
|
@@ -58637,6 +58723,45 @@ function settingList(value) {
|
|
|
58637
58723
|
items2.push((quoted ?? plain).replace(/\\(.)/g, "$1"));
|
|
58638
58724
|
return items2;
|
|
58639
58725
|
}
|
|
58726
|
+
function expandSearchPath(directory, rules) {
|
|
58727
|
+
if (import_node_path12.default.basename(directory) !== "**") return [directory];
|
|
58728
|
+
const expanded = [];
|
|
58729
|
+
const seen = /* @__PURE__ */ new Set();
|
|
58730
|
+
const queue = [import_node_path12.default.dirname(directory)];
|
|
58731
|
+
for (let at = 0; at < queue.length; at++) {
|
|
58732
|
+
const current = queue[at];
|
|
58733
|
+
let real;
|
|
58734
|
+
try {
|
|
58735
|
+
real = import_node_fs12.default.realpathSync(current);
|
|
58736
|
+
} catch {
|
|
58737
|
+
continue;
|
|
58738
|
+
}
|
|
58739
|
+
if (!import_node_fs12.default.statSync(real).isDirectory() || seen.has(real)) continue;
|
|
58740
|
+
seen.add(real);
|
|
58741
|
+
expanded.push(current);
|
|
58742
|
+
for (const entry of import_node_fs12.default.readdirSync(real, { withFileTypes: true }).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0)) {
|
|
58743
|
+
if (entry.isSymbolicLink() ? !rules.followLinks : !entry.isDirectory()) continue;
|
|
58744
|
+
if (rules.excluded.some((pattern) => pattern.test(entry.name)) && !rules.included.some((pattern) => pattern.test(entry.name)))
|
|
58745
|
+
continue;
|
|
58746
|
+
queue.push(import_node_path12.default.join(current, entry.name));
|
|
58747
|
+
}
|
|
58748
|
+
}
|
|
58749
|
+
return expanded;
|
|
58750
|
+
}
|
|
58751
|
+
function recursiveSearchRules(settings) {
|
|
58752
|
+
const glob = (pattern) => new RegExp(
|
|
58753
|
+
`^${pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replaceAll("*", ".*").replaceAll("?", ".")}$`
|
|
58754
|
+
);
|
|
58755
|
+
return {
|
|
58756
|
+
excluded: settingList(settings("EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES")).map(
|
|
58757
|
+
glob
|
|
58758
|
+
),
|
|
58759
|
+
included: settingList(settings("INCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES")).map(
|
|
58760
|
+
glob
|
|
58761
|
+
),
|
|
58762
|
+
followLinks: settings("RECURSIVE_SEARCH_PATHS_FOLLOW_SYMLINKS") !== "NO"
|
|
58763
|
+
};
|
|
58764
|
+
}
|
|
58640
58765
|
function compilationConditions(settings) {
|
|
58641
58766
|
const flags = settingList(settings("OTHER_SWIFT_FLAGS"));
|
|
58642
58767
|
const defined = flags.flatMap(
|
|
@@ -58653,9 +58778,9 @@ function expand(value, lookup) {
|
|
|
58653
58778
|
return value.replace(
|
|
58654
58779
|
/\$(?:\(([A-Za-z_][A-Za-z0-9_]*)((?::[^)]*)?)\)|\{([A-Za-z_][A-Za-z0-9_]*)((?::[^}]*)?)\}|([A-Za-z_][A-Za-z0-9_]*))/g,
|
|
58655
58780
|
(_match, paren, parenOps, brace, braceOps, bare) => {
|
|
58656
|
-
const
|
|
58781
|
+
const name3 = paren ?? brace ?? bare;
|
|
58657
58782
|
const operators = parenOps ?? braceOps ?? "";
|
|
58658
|
-
return operators.split(":").slice(1).reduce((current, operator) => applyOperator(current, operator), lookup(
|
|
58783
|
+
return operators.split(":").slice(1).reduce((current, operator) => applyOperator(current, operator), lookup(name3));
|
|
58659
58784
|
}
|
|
58660
58785
|
);
|
|
58661
58786
|
}
|
|
@@ -58885,8 +59010,8 @@ function isIosAppTarget(ref, options = {}) {
|
|
|
58885
59010
|
const sdk = get("SDKROOT");
|
|
58886
59011
|
return sdk === "auto" ? settingList(get("SUPPORTED_PLATFORMS")).some(isIosPlatform) : sdk === "" || isIosPlatform(sdk);
|
|
58887
59012
|
}
|
|
58888
|
-
function isIosPlatform(
|
|
58889
|
-
return
|
|
59013
|
+
function isIosPlatform(name3) {
|
|
59014
|
+
return name3.startsWith("iphoneos") || name3.startsWith("iphonesimulator");
|
|
58890
59015
|
}
|
|
58891
59016
|
function listXcodeAppTargets(xcodeprojOrWorkspace, options = {}) {
|
|
58892
59017
|
return workspaceProjects(xcodeprojOrWorkspace).projects.flatMap(nativeTargets).filter((ref) => isIosAppTarget(ref, options)).map((ref) => str(ref.target.name) ?? ref.id);
|
|
@@ -58959,7 +59084,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
58959
59084
|
visit3(app);
|
|
58960
59085
|
const xcconfigs = /* @__PURE__ */ new Set();
|
|
58961
59086
|
const moduleTarget = (ref) => {
|
|
58962
|
-
const
|
|
59087
|
+
const name3 = str(ref.target.name) ?? ref.id;
|
|
58963
59088
|
const {
|
|
58964
59089
|
get: settings2,
|
|
58965
59090
|
keys,
|
|
@@ -58968,7 +59093,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
58968
59093
|
ref,
|
|
58969
59094
|
configuration,
|
|
58970
59095
|
{
|
|
58971
|
-
TARGET_NAME:
|
|
59096
|
+
TARGET_NAME: name3,
|
|
58972
59097
|
PROJECT_NAME: import_node_path12.default.basename(ref.project.xcodeproj, ".xcodeproj"),
|
|
58973
59098
|
SRCROOT: ref.project.projectDir,
|
|
58974
59099
|
SOURCE_ROOT: ref.project.projectDir,
|
|
@@ -58999,6 +59124,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
58999
59124
|
for (const file of read) xcconfigs.add(file);
|
|
59000
59125
|
const swiftVersion = Number.parseFloat(settings2("SWIFT_VERSION") || "5");
|
|
59001
59126
|
const members = targetMembers(ref, settings2, options, keys, xcconfigs);
|
|
59127
|
+
const searchRules = recursiveSearchRules(settings2);
|
|
59002
59128
|
const implementations = members.allSources.filter(
|
|
59003
59129
|
(file) => /\.(c|cc|cpp|cxx|m|mm)$/.test(file)
|
|
59004
59130
|
);
|
|
@@ -59023,7 +59149,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
59023
59149
|
settings: settings2,
|
|
59024
59150
|
keys,
|
|
59025
59151
|
module: {
|
|
59026
|
-
name:
|
|
59152
|
+
name: name3,
|
|
59027
59153
|
moduleName: applyOperator(settings2("PRODUCT_MODULE_NAME"), "c99extidentifier"),
|
|
59028
59154
|
...members,
|
|
59029
59155
|
languageMode: swiftVersion >= 6 ? 6 : 5,
|
|
@@ -59041,10 +59167,10 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
59041
59167
|
headerSearchPaths: [
|
|
59042
59168
|
...settingList(settings2("HEADER_SEARCH_PATHS")),
|
|
59043
59169
|
...settingList(settings2("USER_HEADER_SEARCH_PATHS"))
|
|
59044
|
-
].
|
|
59045
|
-
frameworkSearchPaths: settingList(
|
|
59046
|
-
|
|
59047
|
-
),
|
|
59170
|
+
].flatMap((raw2) => expandSearchPath(absolute(raw2), searchRules)),
|
|
59171
|
+
frameworkSearchPaths: settingList(
|
|
59172
|
+
settings2("FRAMEWORK_SEARCH_PATHS")
|
|
59173
|
+
).flatMap((raw2) => expandSearchPath(absolute(raw2), searchRules)),
|
|
59048
59174
|
flags: [
|
|
59049
59175
|
...settings2("CLANG_ENABLE_OBJC_ARC") === "YES" ? ["-fobjc-arc"] : [],
|
|
59050
59176
|
...settings2("CLANG_ENABLE_OBJC_WEAK") === "YES" ? ["-fobjc-weak"] : [],
|
|
@@ -59166,12 +59292,12 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
59166
59292
|
const fileId = str(project.object(buildFileId)?.fileRef);
|
|
59167
59293
|
const file = project.object(fileId);
|
|
59168
59294
|
const tree = str(file?.sourceTree);
|
|
59169
|
-
const
|
|
59170
|
-
if (file?.isa !== "PBXFileReference" || !
|
|
59295
|
+
const name3 = /([^/]+)\.(xc)?framework$/.exec(str(file?.path) ?? "")?.[1];
|
|
59296
|
+
if (file?.isa !== "PBXFileReference" || !name3) continue;
|
|
59171
59297
|
if (tree === "BUILT_PRODUCTS_DIR" || tree === "SDKROOT" || tree === "DEVELOPER_DIR")
|
|
59172
59298
|
continue;
|
|
59173
59299
|
const resolved = fileId ? project.resolvePath(fileId) : null;
|
|
59174
|
-
if (!binaryFrameworks.get(
|
|
59300
|
+
if (!binaryFrameworks.get(name3)) binaryFrameworks.set(name3, resolved);
|
|
59175
59301
|
}
|
|
59176
59302
|
}
|
|
59177
59303
|
}
|
|
@@ -59206,7 +59332,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
59206
59332
|
localPackageDirs: [
|
|
59207
59333
|
...new Set(localPackageDirs.map((dir) => import_node_fs12.default.realpathSync(dir)))
|
|
59208
59334
|
].sort(),
|
|
59209
|
-
binaryFrameworks: [...binaryFrameworks].map(([
|
|
59335
|
+
binaryFrameworks: [...binaryFrameworks].map(([name3, file]) => ({ name: name3, path: file })).sort((left, right) => left.name.localeCompare(right.name)),
|
|
59210
59336
|
packageResolved,
|
|
59211
59337
|
appTargets: appTargetNames,
|
|
59212
59338
|
configuration,
|
|
@@ -59475,7 +59601,7 @@ function collectBridgeModuleSources(appRoot, signal) {
|
|
|
59475
59601
|
const own = (file) => {
|
|
59476
59602
|
const resolved = import_node_fs13.default.realpathSync(file);
|
|
59477
59603
|
if ([file, resolved].some(
|
|
59478
|
-
(
|
|
59604
|
+
(name3) => name3.split(import_node_path13.default.sep).some((part) => part === "Pods" || part === "node_modules")
|
|
59479
59605
|
))
|
|
59480
59606
|
return false;
|
|
59481
59607
|
const relative2 = import_node_path13.default.relative(projectRoot, resolved);
|
|
@@ -59494,7 +59620,7 @@ function collectBridgeModuleSources(appRoot, signal) {
|
|
|
59494
59620
|
];
|
|
59495
59621
|
if (objc.length === 0) continue;
|
|
59496
59622
|
const headers = [...new Set(objc.map((file) => import_node_path13.default.dirname(file)))].flatMap(
|
|
59497
|
-
(dir) => import_node_fs13.default.readdirSync(dir).filter((
|
|
59623
|
+
(dir) => import_node_fs13.default.readdirSync(dir).filter((name3) => name3.endsWith(".h")).sort().map((name3) => import_node_path13.default.join(dir, name3)).filter(own)
|
|
59498
59624
|
);
|
|
59499
59625
|
const declarations = parseObjectiveCModules(
|
|
59500
59626
|
[...objc, ...headers].map((file) => ({
|
|
@@ -59631,7 +59757,7 @@ async function swiftBinaryModules(binary2) {
|
|
|
59631
59757
|
);
|
|
59632
59758
|
if (import_node_fs14.default.existsSync(cached4)) {
|
|
59633
59759
|
const value = JSON.parse(import_node_fs14.default.readFileSync(cached4, "utf8"));
|
|
59634
|
-
if (Array.isArray(value) && value.every((
|
|
59760
|
+
if (Array.isArray(value) && value.every((name3) => typeof name3 === "string"))
|
|
59635
59761
|
return value;
|
|
59636
59762
|
}
|
|
59637
59763
|
const modules = frameworkModules(await zipEntries(binary2.url));
|
|
@@ -60110,10 +60236,10 @@ function enumerateBundleImages(paths, readText, bundleForFile = () => ".") {
|
|
|
60110
60236
|
};
|
|
60111
60237
|
const catalogs = paths.filter((path37) => baseOf(path37) === "Contents.json");
|
|
60112
60238
|
for (const contentsPath of catalogs) {
|
|
60113
|
-
const
|
|
60114
|
-
if (
|
|
60239
|
+
const name3 = catalogEntryName(contentsPath, ".imageset", readText);
|
|
60240
|
+
if (name3 === null) continue;
|
|
60115
60241
|
const { bundlePath, names } = namesFor(contentsPath);
|
|
60116
|
-
if (names.has(
|
|
60242
|
+
if (names.has(name3)) continue;
|
|
60117
60243
|
let parsed;
|
|
60118
60244
|
try {
|
|
60119
60245
|
const text4 = readText(contentsPath);
|
|
@@ -60127,10 +60253,10 @@ function enumerateBundleImages(paths, readText, bundleForFile = () => ".") {
|
|
|
60127
60253
|
const dir = contentsPath.split("/").slice(0, -1).join("/");
|
|
60128
60254
|
const variants = imagesetFiles(images);
|
|
60129
60255
|
if (variants.length === 0) continue;
|
|
60130
|
-
names.add(
|
|
60256
|
+
names.add(name3);
|
|
60131
60257
|
for (const variant of variants)
|
|
60132
60258
|
table.push({
|
|
60133
|
-
name:
|
|
60259
|
+
name: name3,
|
|
60134
60260
|
file: `${dir}/${variant.filename}`,
|
|
60135
60261
|
scale: variant.scale,
|
|
60136
60262
|
bundlePath
|
|
@@ -60138,11 +60264,11 @@ function enumerateBundleImages(paths, readText, bundleForFile = () => ".") {
|
|
|
60138
60264
|
}
|
|
60139
60265
|
for (const path37 of paths) {
|
|
60140
60266
|
if (!isFlatResourceImage(path37)) continue;
|
|
60141
|
-
const
|
|
60267
|
+
const name3 = baseOf(path37).slice(0, -extOf(path37).length);
|
|
60142
60268
|
const { bundlePath, names } = namesFor(path37);
|
|
60143
|
-
if (
|
|
60144
|
-
names.add(
|
|
60145
|
-
table.push({ name:
|
|
60269
|
+
if (name3 === "" || names.has(name3)) continue;
|
|
60270
|
+
names.add(name3);
|
|
60271
|
+
table.push({ name: name3, file: path37, scale: flatScale(path37), bundlePath });
|
|
60146
60272
|
}
|
|
60147
60273
|
return table;
|
|
60148
60274
|
}
|
|
@@ -60172,8 +60298,8 @@ function colorsetValue(color) {
|
|
|
60172
60298
|
function enumerateBundleColors(paths, readText) {
|
|
60173
60299
|
const table = {};
|
|
60174
60300
|
for (const contentsPath of paths.filter((path37) => baseOf(path37) === "Contents.json")) {
|
|
60175
|
-
const
|
|
60176
|
-
if (
|
|
60301
|
+
const name3 = catalogEntryName(contentsPath, ".colorset", readText);
|
|
60302
|
+
if (name3 === null || name3 in table) continue;
|
|
60177
60303
|
let colors;
|
|
60178
60304
|
try {
|
|
60179
60305
|
const text4 = readText(contentsPath);
|
|
@@ -60202,8 +60328,8 @@ function enumerateBundleColors(paths, readText) {
|
|
|
60202
60328
|
else light = value;
|
|
60203
60329
|
}
|
|
60204
60330
|
if (light === null) continue;
|
|
60205
|
-
if (typeof light === "object") table[
|
|
60206
|
-
else table[
|
|
60331
|
+
if (typeof light === "object") table[name3] = light;
|
|
60332
|
+
else table[name3] = { light, dark: typeof dark === "string" ? dark : light };
|
|
60207
60333
|
}
|
|
60208
60334
|
return table;
|
|
60209
60335
|
}
|
|
@@ -60265,10 +60391,10 @@ function guide(svg, id, axis) {
|
|
|
60265
60391
|
function enumerateBundleSymbols(paths, readText, bundleForFile) {
|
|
60266
60392
|
const table = {};
|
|
60267
60393
|
for (const contentsPath of paths.filter((path37) => baseOf(path37) === "Contents.json")) {
|
|
60268
|
-
const
|
|
60269
|
-
if (
|
|
60394
|
+
const name3 = catalogEntryName(contentsPath, ".symbolset", readText);
|
|
60395
|
+
if (name3 === null) continue;
|
|
60270
60396
|
const bundle = bundleForFile(contentsPath);
|
|
60271
|
-
const key2 = bundle === "." ?
|
|
60397
|
+
const key2 = bundle === "." ? name3 : `${bundle}/${name3}`;
|
|
60272
60398
|
if (Object.hasOwn(table, key2)) continue;
|
|
60273
60399
|
let symbols;
|
|
60274
60400
|
try {
|
|
@@ -60309,7 +60435,7 @@ function enumerateBundleSymbols(paths, readText, bundleForFile) {
|
|
|
60309
60435
|
}
|
|
60310
60436
|
var COMPILED_EXTENSIONS = /* @__PURE__ */ new Set([".swift", ".metal", ".storyboard", ".xib"]);
|
|
60311
60437
|
function isCopiedResource(path37) {
|
|
60312
|
-
if (path37.split("/").some((segment) =>
|
|
60438
|
+
if (path37.split("/").some((segment) => /\.(atlasc|bundle)$/.test(segment))) return true;
|
|
60313
60439
|
const ext = extOf(path37);
|
|
60314
60440
|
if (ext === ".json" || ext === ".xcstrings") return true;
|
|
60315
60441
|
return !RASTER_EXTENSIONS.has(ext) && !COMPILED_EXTENSIONS.has(ext) && !path37.split("/").some((segment) => segment.endsWith(".xcassets"));
|
|
@@ -60326,9 +60452,7 @@ function enumerateBundleResources(paths) {
|
|
|
60326
60452
|
});
|
|
60327
60453
|
for (const file of ordered) {
|
|
60328
60454
|
const parts = file.split("/");
|
|
60329
|
-
const nested = parts.findIndex(
|
|
60330
|
-
(part) => part.endsWith(".atlasc") || part.endsWith(".lproj")
|
|
60331
|
-
);
|
|
60455
|
+
const nested = parts.findIndex((part) => /\.(atlasc|lproj|bundle)$/.test(part));
|
|
60332
60456
|
const base = nested < 0 ? baseOf(file) : parts.slice(nested).join("/");
|
|
60333
60457
|
if (seen.has(base)) continue;
|
|
60334
60458
|
seen.add(base);
|
|
@@ -60387,7 +60511,7 @@ function plural(node, specifier) {
|
|
|
60387
60511
|
const forms = dictionary();
|
|
60388
60512
|
forms.NSStringFormatSpecTypeKey = "NSStringPluralRuleType";
|
|
60389
60513
|
forms.NSStringFormatValueTypeKey = specifier;
|
|
60390
|
-
for (const [
|
|
60514
|
+
for (const [name3, value] of Object.entries(object(node))) forms[name3] = unit(value);
|
|
60391
60515
|
return forms;
|
|
60392
60516
|
}
|
|
60393
60517
|
function resolve(node, key2) {
|
|
@@ -60395,7 +60519,7 @@ function resolve(node, key2) {
|
|
|
60395
60519
|
if (value.substitutions !== void 0) {
|
|
60396
60520
|
let format = unit(value);
|
|
60397
60521
|
const rules = dictionary();
|
|
60398
|
-
for (const [
|
|
60522
|
+
for (const [name3, raw2] of Object.entries(object(value.substitutions))) {
|
|
60399
60523
|
const sub = object(raw2), specifier = typeof sub.formatSpecifier === "string" ? sub.formatSpecifier : "";
|
|
60400
60524
|
const forms = plural(object(sub.variations).plural, specifier);
|
|
60401
60525
|
for (const [category, text4] of Object.entries(forms)) {
|
|
@@ -60408,10 +60532,10 @@ function resolve(node, key2) {
|
|
|
60408
60532
|
}
|
|
60409
60533
|
if (typeof sub.argNum === "number")
|
|
60410
60534
|
format = format.replaceAll(
|
|
60411
|
-
"%#@" +
|
|
60412
|
-
"%" + sub.argNum + "$#@" +
|
|
60535
|
+
"%#@" + name3 + "@",
|
|
60536
|
+
"%" + sub.argNum + "$#@" + name3 + "@"
|
|
60413
60537
|
);
|
|
60414
|
-
rules[
|
|
60538
|
+
rules[name3] = forms;
|
|
60415
60539
|
}
|
|
60416
60540
|
return { rules: { NSStringLocalizedFormatKey: format, ...rules } };
|
|
60417
60541
|
}
|
|
@@ -60426,9 +60550,9 @@ function resolve(node, key2) {
|
|
|
60426
60550
|
const specifier = numeric.specifier;
|
|
60427
60551
|
const forms = plural(sourceForms, specifier);
|
|
60428
60552
|
if (argument > 0) {
|
|
60429
|
-
for (const [
|
|
60430
|
-
if (!
|
|
60431
|
-
forms[
|
|
60553
|
+
for (const [name3, text4] of Object.entries(forms))
|
|
60554
|
+
if (!name3.startsWith("NSString") && typeof text4 === "string")
|
|
60555
|
+
forms[name3] = positioned(text4);
|
|
60432
60556
|
}
|
|
60433
60557
|
return {
|
|
60434
60558
|
rules: {
|
|
@@ -60452,8 +60576,8 @@ function resolve(node, key2) {
|
|
|
60452
60576
|
}
|
|
60453
60577
|
throw Error("unsupported string catalog variation for " + key2);
|
|
60454
60578
|
}
|
|
60455
|
-
function compileCatalogTables(source,
|
|
60456
|
-
if (!isSwiftResourcePath(
|
|
60579
|
+
function compileCatalogTables(source, name3) {
|
|
60580
|
+
if (!isSwiftResourcePath(name3) || name3.includes("/"))
|
|
60457
60581
|
throw Error("invalid string catalog table name");
|
|
60458
60582
|
const root = object(JSON.parse(source)), strings2 = object(root.strings);
|
|
60459
60583
|
const output = {};
|
|
@@ -60476,21 +60600,21 @@ function compileCatalogTables(source, name2) {
|
|
|
60476
60600
|
const localizations = entry.localizations === void 0 ? {} : object(entry.localizations);
|
|
60477
60601
|
if (entry.extractionState === "manual") {
|
|
60478
60602
|
if (!Object.hasOwn(localizations, sourceLanguage))
|
|
60479
|
-
(output[sourceLanguage + ".lproj/" +
|
|
60603
|
+
(output[sourceLanguage + ".lproj/" + name3 + ".strings"] ??= dictionary())[key2] = key2;
|
|
60480
60604
|
const source2 = !Object.hasOwn(localizations, sourceLanguage) ? void 0 : object(localizations[sourceLanguage]);
|
|
60481
60605
|
const variations = source2?.variations === void 0 ? void 0 : object(source2.variations);
|
|
60482
60606
|
if (variations?.plural !== void 0) {
|
|
60483
60607
|
for (const language of languages)
|
|
60484
60608
|
if (!Object.hasOwn(localizations, language))
|
|
60485
|
-
(output[language + ".lproj/" +
|
|
60609
|
+
(output[language + ".lproj/" + name3 + ".strings"] ??= dictionary())[key2] = key2;
|
|
60486
60610
|
}
|
|
60487
60611
|
}
|
|
60488
60612
|
for (const [language, node] of Object.entries(localizations)) {
|
|
60489
60613
|
const resolved = resolve(node, key2);
|
|
60490
60614
|
if (resolved.text !== void 0)
|
|
60491
|
-
(output[language + ".lproj/" +
|
|
60615
|
+
(output[language + ".lproj/" + name3 + ".strings"] ??= dictionary())[key2] = resolved.text;
|
|
60492
60616
|
if (resolved.rules !== void 0)
|
|
60493
|
-
(output[language + ".lproj/" +
|
|
60617
|
+
(output[language + ".lproj/" + name3 + ".stringsdict"] ??= dictionary())[key2] = resolved.rules;
|
|
60494
60618
|
}
|
|
60495
60619
|
}
|
|
60496
60620
|
return output;
|
|
@@ -60500,9 +60624,9 @@ function plist2(value) {
|
|
|
60500
60624
|
if (typeof value === "string") return "<string>" + escaped(value) + "</string>";
|
|
60501
60625
|
return "<dict>" + Object.entries(value).map(([key2, item]) => "<key>" + escaped(key2) + "</key>" + plist2(item)).join("") + "</dict>";
|
|
60502
60626
|
}
|
|
60503
|
-
function compileStringCatalog(source,
|
|
60627
|
+
function compileStringCatalog(source, name3) {
|
|
60504
60628
|
return Object.fromEntries(
|
|
60505
|
-
Object.entries(compileCatalogTables(source,
|
|
60629
|
+
Object.entries(compileCatalogTables(source, name3)).map(([path37, table]) => [
|
|
60506
60630
|
path37,
|
|
60507
60631
|
'<?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>"
|
|
60508
60632
|
])
|
|
@@ -62645,15 +62769,15 @@ function materializeObjcSdk(cacheDir5) {
|
|
|
62645
62769
|
var headerFiles = (dir) => import_node_fs17.default.readdirSync(dir, { recursive: true, encoding: "utf8" }).filter((file) => file.endsWith(".h")).sort();
|
|
62646
62770
|
function missingHeader(missing) {
|
|
62647
62771
|
const lines = ["#import <Foundation/Foundation.h>", "#import <UIKit/UIKit.h>"];
|
|
62648
|
-
for (const [
|
|
62649
|
-
for (const [
|
|
62650
|
-
if (kind === "protocol") lines.push(`@protocol ${
|
|
62772
|
+
for (const [name3, kind] of missing) if (kind === "macro") lines.push(`#define ${name3}`);
|
|
62773
|
+
for (const [name3, kind] of missing)
|
|
62774
|
+
if (kind === "protocol") lines.push(`@protocol ${name3} <NSObject>
|
|
62651
62775
|
@end`);
|
|
62652
|
-
for (const [
|
|
62653
|
-
if (kind === "class") lines.push(`@interface ${
|
|
62776
|
+
for (const [name3, kind] of missing)
|
|
62777
|
+
if (kind === "class") lines.push(`@interface ${name3} : NSObject
|
|
62654
62778
|
@end`);
|
|
62655
|
-
for (const [
|
|
62656
|
-
if (kind === "struct") lines.push(`typedef struct ${
|
|
62779
|
+
for (const [name3, kind] of missing)
|
|
62780
|
+
if (kind === "struct") lines.push(`typedef struct ${name3} { char opaque; } ${name3};`);
|
|
62657
62781
|
return `${lines.join("\n")}
|
|
62658
62782
|
`;
|
|
62659
62783
|
}
|
|
@@ -62746,11 +62870,11 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work) {
|
|
|
62746
62870
|
stubbed.add(include2);
|
|
62747
62871
|
const slash = include2.indexOf("/");
|
|
62748
62872
|
if (slash > 0 && /^[A-Z]/.test(include2)) {
|
|
62749
|
-
const
|
|
62750
|
-
const umbrella = `${
|
|
62873
|
+
const name3 = include2.slice(0, slash);
|
|
62874
|
+
const umbrella = `${name3}/${name3}.h`;
|
|
62751
62875
|
if (Object.hasOwn(
|
|
62752
62876
|
IOS_SDK_HEADERS,
|
|
62753
|
-
`System/Library/Frameworks/${
|
|
62877
|
+
`System/Library/Frameworks/${name3}.framework/Headers/${name3}.h`
|
|
62754
62878
|
)) {
|
|
62755
62879
|
const header2 = import_node_path17.default.join(stubIncludes, include2);
|
|
62756
62880
|
import_node_fs17.default.mkdirSync(import_node_path17.default.dirname(header2), { recursive: true });
|
|
@@ -62758,7 +62882,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work) {
|
|
|
62758
62882
|
`);
|
|
62759
62883
|
return true;
|
|
62760
62884
|
}
|
|
62761
|
-
const root = import_node_path17.default.join(stubs, `${
|
|
62885
|
+
const root = import_node_path17.default.join(stubs, `${name3}.framework`);
|
|
62762
62886
|
const header = import_node_path17.default.join(root, "Headers", include2.slice(slash + 1));
|
|
62763
62887
|
import_node_fs17.default.mkdirSync(import_node_path17.default.dirname(header), { recursive: true });
|
|
62764
62888
|
import_node_fs17.default.writeFileSync(
|
|
@@ -62768,7 +62892,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work) {
|
|
|
62768
62892
|
import_node_fs17.default.mkdirSync(import_node_path17.default.join(root, "Modules"), { recursive: true });
|
|
62769
62893
|
import_node_fs17.default.writeFileSync(
|
|
62770
62894
|
import_node_path17.default.join(root, "Modules", "module.modulemap"),
|
|
62771
|
-
`framework module ${
|
|
62895
|
+
`framework module ${name3} {
|
|
62772
62896
|
umbrella "Headers"
|
|
62773
62897
|
export *
|
|
62774
62898
|
module * { export * }
|
|
@@ -62798,10 +62922,10 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work) {
|
|
|
62798
62922
|
const text4 = import_node_fs17.default.existsSync(file) ? import_node_fs17.default.readFileSync(file, "utf8").split("\n")[line - 1] : void 0;
|
|
62799
62923
|
if (text4 === void 0) return null;
|
|
62800
62924
|
const rest = text4.slice(column - 1);
|
|
62801
|
-
const
|
|
62802
|
-
return
|
|
62925
|
+
const name3 = /^[A-Za-z_]\w*/.exec(rest)?.[0];
|
|
62926
|
+
return name3 ? { name: name3, after: rest.slice(name3.length) } : null;
|
|
62803
62927
|
};
|
|
62804
|
-
const typeKind = (
|
|
62928
|
+
const typeKind = (name3, after) => /^[A-Z][A-Z0-9_]+$/.test(name3) && !/^\s*\*/.test(after) ? "macro" : /^\s*\*/.test(after) ? "class" : "struct";
|
|
62805
62929
|
for (let round = 0; ; round++) {
|
|
62806
62930
|
import_node_fs17.default.rmSync(out, { recursive: true, force: true });
|
|
62807
62931
|
import_node_fs17.default.mkdirSync(out, { recursive: true });
|
|
@@ -62830,9 +62954,9 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work) {
|
|
|
62830
62954
|
];
|
|
62831
62955
|
if (errors.length === 0 && run5.status === 0) break;
|
|
62832
62956
|
let progress = false;
|
|
62833
|
-
const learn = (
|
|
62834
|
-
if (missing.has(
|
|
62835
|
-
missing.set(
|
|
62957
|
+
const learn = (name3, kind) => {
|
|
62958
|
+
if (missing.has(name3)) return;
|
|
62959
|
+
missing.set(name3, kind);
|
|
62836
62960
|
progress = true;
|
|
62837
62961
|
};
|
|
62838
62962
|
for (const [, file, line, column, message] of errors) {
|
|
@@ -62861,8 +62985,8 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work) {
|
|
|
62861
62985
|
const unknown = /^unknown type name '(\w+)'$/.exec(message);
|
|
62862
62986
|
if ((unknown || message === "expected a type") && file && line && column) {
|
|
62863
62987
|
const token = tokenAt(file, Number(line), Number(column));
|
|
62864
|
-
const
|
|
62865
|
-
if (
|
|
62988
|
+
const name3 = unknown?.[1] ?? token?.name;
|
|
62989
|
+
if (name3) learn(name3, typeKind(name3, token?.name === name3 ? token.after : ""));
|
|
62866
62990
|
}
|
|
62867
62991
|
}
|
|
62868
62992
|
if (!progress || round === ROUNDS)
|
|
@@ -62871,7 +62995,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work) {
|
|
|
62871
62995
|
);
|
|
62872
62996
|
if (missing.size > 0) declareMissing();
|
|
62873
62997
|
}
|
|
62874
|
-
const graphs = import_node_fs17.default.readdirSync(out).filter((
|
|
62998
|
+
const graphs = import_node_fs17.default.readdirSync(out).filter((name3) => name3.endsWith(".symbols.json")).sort().map((name3) => JSON.parse(import_node_fs17.default.readFileSync(import_node_path17.default.join(out, name3), "utf8")));
|
|
62875
62999
|
const imports = /* @__PURE__ */ new Set(["Foundation", "UIKit"]);
|
|
62876
63000
|
for (const text4 of originals.values())
|
|
62877
63001
|
for (const match of text4.matchAll(
|
|
@@ -62963,8 +63087,8 @@ function enumValues(graphs, surface, framework, toolchainBin, search, work) {
|
|
|
62963
63087
|
walk2(inner);
|
|
62964
63088
|
};
|
|
62965
63089
|
walk2(JSON.parse(run5.stdout));
|
|
62966
|
-
for (const [id,
|
|
62967
|
-
const value = constants.get(
|
|
63090
|
+
for (const [id, name3] of wanted) {
|
|
63091
|
+
const value = constants.get(name3);
|
|
62968
63092
|
if (value !== void 0) values.set(id, value.toString());
|
|
62969
63093
|
}
|
|
62970
63094
|
return values;
|
|
@@ -63142,7 +63266,7 @@ function compileObjcPeerMetadata(args) {
|
|
|
63142
63266
|
const emitted = [...symbols.stdout.matchAll(/^\._OBJC_CLASS_(\w+) [^U] /gm)].map(
|
|
63143
63267
|
(match) => match[1]
|
|
63144
63268
|
);
|
|
63145
|
-
if (emitted.length !== names.size || !emitted.every((
|
|
63269
|
+
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))
|
|
63146
63270
|
throw new ObjcPeerMetadataError(
|
|
63147
63271
|
`Objective-C peer metadata contains unexpected classes or methods: ${receipt}`,
|
|
63148
63272
|
files2,
|
|
@@ -63176,10 +63300,10 @@ function swiftCommand() {
|
|
|
63176
63300
|
var cacheDir3 = import_node_path19.default.join(cacheDir(), "swift-manifests");
|
|
63177
63301
|
var evaluated = /* @__PURE__ */ new Map();
|
|
63178
63302
|
function dump(dir) {
|
|
63179
|
-
const manifests = import_node_fs19.default.readdirSync(dir).filter((
|
|
63303
|
+
const manifests = import_node_fs19.default.readdirSync(dir).filter((name3) => /^Package(@swift-[\d.]+)?\.swift$/.test(name3)).sort();
|
|
63180
63304
|
const command = swiftCommand();
|
|
63181
63305
|
const key2 = (0, import_node_crypto11.createHash)("sha256").update(JSON.stringify([command, import_node_path19.default.resolve(dir)])).update(
|
|
63182
|
-
manifests.map((
|
|
63306
|
+
manifests.map((name3) => `${name3}\0${import_node_fs19.default.readFileSync(import_node_path19.default.join(dir, name3), "utf8")}`).join("\0")
|
|
63183
63307
|
).digest("hex").slice(0, 32);
|
|
63184
63308
|
const cached4 = import_node_path19.default.join(cacheDir3, `${key2}.json`);
|
|
63185
63309
|
if (import_node_fs19.default.existsSync(cached4))
|
|
@@ -63220,16 +63344,16 @@ function defaultTraits(manifest) {
|
|
|
63220
63344
|
const traits = new Map(
|
|
63221
63345
|
array(manifest.traits).map((trait) => [
|
|
63222
63346
|
string(record(trait).name) ?? "",
|
|
63223
|
-
array(record(trait).enabledTraits).flatMap((
|
|
63347
|
+
array(record(trait).enabledTraits).flatMap((name3) => string(name3) ?? [])
|
|
63224
63348
|
])
|
|
63225
63349
|
);
|
|
63226
63350
|
const enabled = /* @__PURE__ */ new Set();
|
|
63227
63351
|
const pending = [...traits.get("default") ?? []];
|
|
63228
63352
|
while (pending.length > 0) {
|
|
63229
|
-
const
|
|
63230
|
-
if (enabled.has(
|
|
63231
|
-
enabled.add(
|
|
63232
|
-
pending.push(...traits.get(
|
|
63353
|
+
const name3 = pending.pop();
|
|
63354
|
+
if (enabled.has(name3)) continue;
|
|
63355
|
+
enabled.add(name3);
|
|
63356
|
+
pending.push(...traits.get(name3) ?? []);
|
|
63233
63357
|
}
|
|
63234
63358
|
return enabled;
|
|
63235
63359
|
}
|
|
@@ -63238,7 +63362,7 @@ function linksOnIOS(condition, traits) {
|
|
|
63238
63362
|
const platforms = array(platformNames);
|
|
63239
63363
|
if (platforms.length > 0 && !platforms.includes("ios")) return false;
|
|
63240
63364
|
const gates = array(needed);
|
|
63241
|
-
return gates.length === 0 || gates.some((
|
|
63365
|
+
return gates.length === 0 || gates.some((name3) => traits.has(string(name3) ?? ""));
|
|
63242
63366
|
}
|
|
63243
63367
|
function swiftPackageManifest(dir) {
|
|
63244
63368
|
dir = import_node_fs19.default.realpathSync(dir);
|
|
@@ -63273,10 +63397,10 @@ function swiftPackageManifest(dir) {
|
|
|
63273
63397
|
}
|
|
63274
63398
|
const products = /* @__PURE__ */ new Map();
|
|
63275
63399
|
for (const product of array(raw2.products)) {
|
|
63276
|
-
const { name:
|
|
63277
|
-
if (!string(
|
|
63400
|
+
const { name: name4, targets: targets2, type } = record(product);
|
|
63401
|
+
if (!string(name4) || !("library" in record(type))) continue;
|
|
63278
63402
|
products.set(
|
|
63279
|
-
string(
|
|
63403
|
+
string(name4),
|
|
63280
63404
|
array(targets2).flatMap((target) => string(target) ?? [])
|
|
63281
63405
|
);
|
|
63282
63406
|
}
|
|
@@ -63284,12 +63408,12 @@ function swiftPackageManifest(dir) {
|
|
|
63284
63408
|
const names = new Set(array(raw2.targets).map((target) => string(record(target).name)));
|
|
63285
63409
|
for (const entry of array(raw2.targets)) {
|
|
63286
63410
|
const target = record(entry);
|
|
63287
|
-
const
|
|
63411
|
+
const name4 = string(target.name);
|
|
63288
63412
|
const kind = string(target.type);
|
|
63289
|
-
if (!
|
|
63413
|
+
if (!name4 || !isTargetType(kind)) continue;
|
|
63290
63414
|
const declared = string(target.path);
|
|
63291
63415
|
const roots = kind === "test" ? ["Tests"] : ["Sources", "Source", "src", "srcs"];
|
|
63292
|
-
const targetDir = declared ? import_node_path19.default.resolve(dir, declared) : roots.map((root) => import_node_path19.default.join(dir, root,
|
|
63416
|
+
const targetDir = declared ? import_node_path19.default.resolve(dir, declared) : roots.map((root) => import_node_path19.default.join(dir, root, name4)).find((candidate) => import_node_fs19.default.existsSync(candidate)) ?? import_node_path19.default.join(dir, roots[0], name4);
|
|
63293
63417
|
const dependencies = [];
|
|
63294
63418
|
for (const dependency of array(target.dependencies)) {
|
|
63295
63419
|
const { target: local, product, byName } = record(dependency);
|
|
@@ -63337,7 +63461,7 @@ function swiftPackageManifest(dir) {
|
|
|
63337
63461
|
const flags = header ? ["-I", import_node_path19.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;
|
|
63338
63462
|
if (!flags)
|
|
63339
63463
|
throw new Error(
|
|
63340
|
-
`${
|
|
63464
|
+
`${name4}: unsupported ${tool} compiler setting ${JSON.stringify(rawKind)}`
|
|
63341
63465
|
);
|
|
63342
63466
|
nativeSettings.push({
|
|
63343
63467
|
tool,
|
|
@@ -63367,8 +63491,8 @@ function swiftPackageManifest(dir) {
|
|
|
63367
63491
|
});
|
|
63368
63492
|
}
|
|
63369
63493
|
}
|
|
63370
|
-
targets.set(
|
|
63371
|
-
name:
|
|
63494
|
+
targets.set(name4, {
|
|
63495
|
+
name: name4,
|
|
63372
63496
|
type: kind,
|
|
63373
63497
|
dir: targetDir,
|
|
63374
63498
|
sources: target.sources == null ? null : array(target.sources).flatMap((file) => string(file) ?? []),
|
|
@@ -63385,9 +63509,9 @@ function swiftPackageManifest(dir) {
|
|
|
63385
63509
|
checksum: string(target.checksum) ?? null
|
|
63386
63510
|
});
|
|
63387
63511
|
}
|
|
63388
|
-
const
|
|
63389
|
-
if (!
|
|
63390
|
-
const manifest = { name:
|
|
63512
|
+
const name3 = string(raw2.name);
|
|
63513
|
+
if (!name3) throw new Error(`swiftpm returned no package name for ${dir}`);
|
|
63514
|
+
const manifest = { name: name3, dir, products, targets, packages };
|
|
63391
63515
|
evaluated.set(key2, manifest);
|
|
63392
63516
|
return manifest;
|
|
63393
63517
|
}
|
|
@@ -63520,18 +63644,18 @@ function resolveSwiftPackages(options) {
|
|
|
63520
63644
|
};
|
|
63521
63645
|
const targets = /* @__PURE__ */ new Map();
|
|
63522
63646
|
const targetOutcomes = /* @__PURE__ */ new Map();
|
|
63523
|
-
const resolveTarget = (pkg,
|
|
63524
|
-
const key2 = `${pkg.manifest.dir}\0${
|
|
63647
|
+
const resolveTarget = (pkg, name3) => {
|
|
63648
|
+
const key2 = `${pkg.manifest.dir}\0${name3}`;
|
|
63525
63649
|
if (targetOutcomes.has(key2)) return targetOutcomes.get(key2);
|
|
63526
63650
|
targetOutcomes.set(key2, []);
|
|
63527
63651
|
const outcome = (() => {
|
|
63528
|
-
if (provided.has(
|
|
63529
|
-
const target = pkg.manifest.targets.get(
|
|
63652
|
+
if (provided.has(name3)) return [];
|
|
63653
|
+
const target = pkg.manifest.targets.get(name3);
|
|
63530
63654
|
if (!target)
|
|
63531
|
-
return [`${import_node_path20.default.basename(pkg.manifest.dir)} declares no target ${
|
|
63655
|
+
return [`${import_node_path20.default.basename(pkg.manifest.dir)} declares no target ${name3}`];
|
|
63532
63656
|
const files2 = target.type === "regular" || target.type === "system" ? swiftTargetFiles(pkg.manifest, target) : [];
|
|
63533
|
-
const gap = options.binaryGaps?.get(
|
|
63534
|
-
const ownReason = target.type === "binary" ? `${
|
|
63657
|
+
const gap = options.binaryGaps?.get(name3);
|
|
63658
|
+
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;
|
|
63535
63659
|
const reasons = target.dependencies.map((dependency) => {
|
|
63536
63660
|
if (dependency.kind === "target") return resolveTarget(pkg, dependency.name);
|
|
63537
63661
|
const nested = resolveDependencyProduct(pkg, dependency.package, dependency.name);
|
|
@@ -63540,8 +63664,8 @@ function resolveSwiftPackages(options) {
|
|
|
63540
63664
|
const blocked = blockers([ownReason ? [ownReason] : [], ...reasons]);
|
|
63541
63665
|
if (blocked.length > 0) return blocked;
|
|
63542
63666
|
const relative2 = files2.map((file) => import_node_path20.default.relative(target.dir, file));
|
|
63543
|
-
targets.set(`${pkg.manifest.dir}\0${
|
|
63544
|
-
name:
|
|
63667
|
+
targets.set(`${pkg.manifest.dir}\0${name3}`, {
|
|
63668
|
+
name: name3,
|
|
63545
63669
|
path: "",
|
|
63546
63670
|
dir: target.dir,
|
|
63547
63671
|
files: files2,
|
|
@@ -63555,9 +63679,9 @@ function resolveSwiftPackages(options) {
|
|
|
63555
63679
|
const source = pkg.manifest.packages.get(dependency.package);
|
|
63556
63680
|
const nested = source && packages.get("dir" in source ? import_node_path20.default.resolve(source.dir) : source.url);
|
|
63557
63681
|
return nested && typeof nested !== "string" ? (nested.manifest.products.get(dependency.name) ?? []).map(
|
|
63558
|
-
(
|
|
63682
|
+
(name4) => ({
|
|
63559
63683
|
kind: "target",
|
|
63560
|
-
name:
|
|
63684
|
+
name: name4
|
|
63561
63685
|
})
|
|
63562
63686
|
) : [];
|
|
63563
63687
|
}),
|
|
@@ -63576,7 +63700,7 @@ function resolveSwiftPackages(options) {
|
|
|
63576
63700
|
const resolveProduct = (pkg, product) => {
|
|
63577
63701
|
if (provided.has(product)) return [];
|
|
63578
63702
|
const roots = pkg.manifest.products.get(product);
|
|
63579
|
-
const reason = !roots ? [`${import_node_path20.default.basename(pkg.manifest.dir)} has no library ${product}`] : blockers(roots.map((
|
|
63703
|
+
const reason = !roots ? [`${import_node_path20.default.basename(pkg.manifest.dir)} has no library ${product}`] : blockers(roots.map((name3) => resolveTarget(pkg, name3)));
|
|
63580
63704
|
productOutcomes.set(`${pkg.manifest.dir}\0${product}`, { pkg, reason });
|
|
63581
63705
|
return reason;
|
|
63582
63706
|
};
|
|
@@ -63607,14 +63731,14 @@ function resolveSwiftPackages(options) {
|
|
|
63607
63731
|
}
|
|
63608
63732
|
for (const pkg of packages.values()) {
|
|
63609
63733
|
if (typeof pkg === "string") continue;
|
|
63610
|
-
for (const [
|
|
63734
|
+
for (const [name3, target] of pkg.manifest.targets) {
|
|
63611
63735
|
if (target.type === "test" || target.type === "plugin" || target.type === "macro")
|
|
63612
63736
|
continue;
|
|
63613
63737
|
if (target.type === "executable") continue;
|
|
63614
63738
|
const objc = target.type === "regular" && swiftTargetFiles(pkg.manifest, target).some((file) => /\.(m|mm)$/.test(file));
|
|
63615
63739
|
if (target.type === "binary" || objc)
|
|
63616
63740
|
result.binaries.push({
|
|
63617
|
-
target:
|
|
63741
|
+
target: name3,
|
|
63618
63742
|
source: pkg.source,
|
|
63619
63743
|
url: target.url,
|
|
63620
63744
|
checksum: target.checksum,
|
|
@@ -63627,9 +63751,9 @@ function resolveSwiftPackages(options) {
|
|
|
63627
63751
|
)
|
|
63628
63752
|
} : {}
|
|
63629
63753
|
});
|
|
63630
|
-
const reason = resolveTarget(pkg,
|
|
63631
|
-
if (reason.length > 0 && !result.modules.has(
|
|
63632
|
-
result.modules.set(
|
|
63754
|
+
const reason = resolveTarget(pkg, name3);
|
|
63755
|
+
if (reason.length > 0 && !result.modules.has(name3))
|
|
63756
|
+
result.modules.set(name3, { source: pkg.source, reason: reason.join("; ") });
|
|
63633
63757
|
}
|
|
63634
63758
|
}
|
|
63635
63759
|
for (const [key2, { pkg, reason }] of productOutcomes) {
|
|
@@ -63638,11 +63762,11 @@ function resolveSwiftPackages(options) {
|
|
|
63638
63762
|
result.modules.set(product, { source: pkg.source, reason: reason.join("; ") });
|
|
63639
63763
|
}
|
|
63640
63764
|
const reached = /* @__PURE__ */ new Set();
|
|
63641
|
-
const reach = (pkg,
|
|
63642
|
-
const key2 = `${pkg.manifest.dir}\0${
|
|
63765
|
+
const reach = (pkg, name3) => {
|
|
63766
|
+
const key2 = `${pkg.manifest.dir}\0${name3}`;
|
|
63643
63767
|
if (reached.has(key2)) return;
|
|
63644
63768
|
reached.add(key2);
|
|
63645
|
-
for (const dependency of pkg.manifest.targets.get(
|
|
63769
|
+
for (const dependency of pkg.manifest.targets.get(name3)?.dependencies ?? []) {
|
|
63646
63770
|
if (dependency.kind === "target") reach(pkg, dependency.name);
|
|
63647
63771
|
else {
|
|
63648
63772
|
const source = pkg.manifest.packages.get(dependency.package);
|
|
@@ -63669,11 +63793,11 @@ function resolveSwiftPackages(options) {
|
|
|
63669
63793
|
if (!pkg || typeof pkg === "string") continue;
|
|
63670
63794
|
const headers = /* @__PURE__ */ new Map();
|
|
63671
63795
|
const visited = /* @__PURE__ */ new Set();
|
|
63672
|
-
const visit3 = (owner,
|
|
63673
|
-
const key2 = `${owner.manifest.dir}\0${
|
|
63796
|
+
const visit3 = (owner, name3) => {
|
|
63797
|
+
const key2 = `${owner.manifest.dir}\0${name3}`;
|
|
63674
63798
|
if (visited.has(key2)) return;
|
|
63675
63799
|
visited.add(key2);
|
|
63676
|
-
const target = owner.manifest.targets.get(
|
|
63800
|
+
const target = owner.manifest.targets.get(name3);
|
|
63677
63801
|
if (!target) return;
|
|
63678
63802
|
const dir = import_node_path20.default.join(target.dir, target.publicHeadersPath);
|
|
63679
63803
|
for (const dependency of target.dependencies) {
|
|
@@ -63686,8 +63810,8 @@ function resolveSwiftPackages(options) {
|
|
|
63686
63810
|
visit3(nested, root);
|
|
63687
63811
|
}
|
|
63688
63812
|
}
|
|
63689
|
-
if (
|
|
63690
|
-
headers.set(
|
|
63813
|
+
if (name3 !== binary2.target && import_node_fs20.default.existsSync(dir))
|
|
63814
|
+
headers.set(name3, import_node_path20.default.relative(binary2.dir, dir));
|
|
63691
63815
|
};
|
|
63692
63816
|
visit3(pkg, binary2.target);
|
|
63693
63817
|
binary2.headerDependencies = [...headers].map(([module2, path37]) => ({ module: module2, path: path37 }));
|
|
@@ -63750,6 +63874,15 @@ function compileXcodeObjCImplementations(app, binaries, moduleRoot) {
|
|
|
63750
63874
|
`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}`
|
|
63751
63875
|
);
|
|
63752
63876
|
}
|
|
63877
|
+
function linkedStat(file) {
|
|
63878
|
+
try {
|
|
63879
|
+
return import_node_fs22.default.statSync(file);
|
|
63880
|
+
} catch (error) {
|
|
63881
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") return null;
|
|
63882
|
+
throw error;
|
|
63883
|
+
}
|
|
63884
|
+
}
|
|
63885
|
+
var isSdkInclude = (file) => file === "/usr/include" || file.startsWith("/usr/include/");
|
|
63753
63886
|
function prepareXcodeObjCImplementations(app, binaries, moduleRoot, peers) {
|
|
63754
63887
|
if (peers) validateObjcPeerClasses(peers);
|
|
63755
63888
|
const toolchain = swiftModuleToolchain(moduleRoot);
|
|
@@ -63770,13 +63903,22 @@ function prepareXcodeObjCImplementations(app, binaries, moduleRoot, peers) {
|
|
|
63770
63903
|
)
|
|
63771
63904
|
);
|
|
63772
63905
|
};
|
|
63906
|
+
const walked = /* @__PURE__ */ new Set();
|
|
63907
|
+
const ancestors = /* @__PURE__ */ new Set();
|
|
63773
63908
|
const addHeaders = (directory) => {
|
|
63909
|
+
const real = import_node_fs22.default.realpathSync(directory);
|
|
63910
|
+
if (walked.has(directory) || ancestors.has(real)) return;
|
|
63911
|
+
walked.add(directory);
|
|
63912
|
+
ancestors.add(real);
|
|
63774
63913
|
for (const entry of import_node_fs22.default.readdirSync(directory, { withFileTypes: true })) {
|
|
63775
|
-
if (entry.
|
|
63914
|
+
if (entry.name.startsWith(".") && !entry.isFile()) continue;
|
|
63776
63915
|
const file = import_node_path22.default.join(directory, entry.name);
|
|
63777
|
-
|
|
63916
|
+
const linked = entry.isSymbolicLink() ? linkedStat(file) : null;
|
|
63917
|
+
if (entry.isSymbolicLink() && !linked) continue;
|
|
63918
|
+
if (entry.isDirectory() || linked?.isDirectory()) addHeaders(file);
|
|
63778
63919
|
else if (/\.(h|hh|hpp|hxx|inc|inl|modulemap)$/.test(entry.name)) add(file, true);
|
|
63779
63920
|
}
|
|
63921
|
+
ancestors.delete(real);
|
|
63780
63922
|
};
|
|
63781
63923
|
const targets = [];
|
|
63782
63924
|
const configuration = app.configuration === "Debug" ? "debug" : "release";
|
|
@@ -63840,6 +63982,11 @@ function prepareXcodeObjCImplementations(app, binaries, moduleRoot, peers) {
|
|
|
63840
63982
|
)
|
|
63841
63983
|
])
|
|
63842
63984
|
add(file, true);
|
|
63985
|
+
for (const directory of [
|
|
63986
|
+
...target.objc.headerSearchPaths,
|
|
63987
|
+
...target.objc.frameworkSearchPaths
|
|
63988
|
+
])
|
|
63989
|
+
if (!isSdkInclude(directory) && import_node_fs22.default.existsSync(directory)) addHeaders(directory);
|
|
63843
63990
|
targets.push({
|
|
63844
63991
|
name: target.moduleName,
|
|
63845
63992
|
deploymentTarget: target.iosDeploymentTarget,
|
|
@@ -63943,16 +64090,16 @@ function prepareXcodeObjCImplementations(app, binaries, moduleRoot, peers) {
|
|
|
63943
64090
|
}
|
|
63944
64091
|
import_node_fs22.default.mkdirSync(work);
|
|
63945
64092
|
const staged = (file) => {
|
|
63946
|
-
for (const { root, name:
|
|
64093
|
+
for (const { root, name: name3 } of [
|
|
63947
64094
|
{ root: checkouts, name: "packages" },
|
|
63948
64095
|
{ root: app.rootDir, name: "project" }
|
|
63949
64096
|
]) {
|
|
63950
64097
|
const relative2 = import_node_path22.default.relative(root, file);
|
|
63951
64098
|
if (relative2 !== ".." && !relative2.startsWith(`..${import_node_path22.default.sep}`) && !import_node_path22.default.isAbsolute(relative2))
|
|
63952
|
-
return import_node_path22.default.join(work,
|
|
64099
|
+
return import_node_path22.default.join(work, name3, relative2);
|
|
63953
64100
|
}
|
|
63954
|
-
if (file
|
|
63955
|
-
return import_node_path22.default.join(sdk.sysroot, "include", file.slice("/usr/include
|
|
64101
|
+
if (isSdkInclude(file))
|
|
64102
|
+
return import_node_path22.default.join(sdk.sysroot, "include", file.slice("/usr/include".length));
|
|
63956
64103
|
throw new Error(
|
|
63957
64104
|
`Objective-C compiler input is outside the project and its pinned packages: ${file}`
|
|
63958
64105
|
);
|
|
@@ -64307,8 +64454,8 @@ function emitSwiftStandin(graphs, options) {
|
|
|
64307
64454
|
const parts = fallback.split(".");
|
|
64308
64455
|
const module2 = parts[0] === "SwiftUICore" ? "SwiftUI" : parts[0];
|
|
64309
64456
|
const unqualified = parts.slice(1).join(".") || parts[0];
|
|
64310
|
-
const
|
|
64311
|
-
return { name:
|
|
64457
|
+
const name3 = family.has(parts[0]) && parts[0] !== "SwiftUICore" ? parts.join(".") : unqualified;
|
|
64458
|
+
return { name: name3, module: module2, local: false };
|
|
64312
64459
|
};
|
|
64313
64460
|
const nsObject = nameOf("c:objc(cs)NSObject", "ObjectiveC.NSObject").name;
|
|
64314
64461
|
const nsObjectProtocol = nameOf(
|
|
@@ -64329,8 +64476,8 @@ function emitSwiftStandin(graphs, options) {
|
|
|
64329
64476
|
...all(edge.source)
|
|
64330
64477
|
]);
|
|
64331
64478
|
} else if (edge.targetFallback) {
|
|
64332
|
-
const
|
|
64333
|
-
external.set(
|
|
64479
|
+
const name3 = nameOf(edge.target, edge.targetFallback).name;
|
|
64480
|
+
external.set(name3, [...external.get(name3) ?? [], ...all(edge.source)]);
|
|
64334
64481
|
owner.set(edge.source, edge.target);
|
|
64335
64482
|
}
|
|
64336
64483
|
break;
|
|
@@ -64344,9 +64491,9 @@ function emitSwiftStandin(graphs, options) {
|
|
|
64344
64491
|
case "conformsTo": {
|
|
64345
64492
|
const target = nameOf(edge.target, edge.targetFallback);
|
|
64346
64493
|
const kept = KEEP_EXTERNAL.get(edge.target);
|
|
64347
|
-
const
|
|
64348
|
-
if (
|
|
64349
|
-
conforms.set(edge.source, [...conforms.get(edge.source) ?? [],
|
|
64494
|
+
const name3 = kept ?? (target && (target.local || family.has(target.module ?? "")) ? target.name : null);
|
|
64495
|
+
if (name3)
|
|
64496
|
+
conforms.set(edge.source, [...conforms.get(edge.source) ?? [], name3]);
|
|
64350
64497
|
if (byId.has(edge.target)) {
|
|
64351
64498
|
const map2 = source.kind.identifier === "swift.protocol" ? protocolParents : conformIds;
|
|
64352
64499
|
map2.set(edge.source, [...map2.get(edge.source) ?? [], edge.target]);
|
|
@@ -64592,13 +64739,13 @@ function emitSwiftStandin(graphs, options) {
|
|
|
64592
64739
|
if (blocked) return void skipped.push({ path: path37, reason: blocked });
|
|
64593
64740
|
const ancestors = /* @__PURE__ */ new Set();
|
|
64594
64741
|
for (let at = superId.get(id); at; at = superId.get(at))
|
|
64595
|
-
for (const
|
|
64742
|
+
for (const name3 of conforms.get(at) ?? []) ancestors.add(name3);
|
|
64596
64743
|
const list2 = [
|
|
64597
64744
|
...parent ? [parent] : [],
|
|
64598
64745
|
...(conforms.get(id) ?? []).filter(
|
|
64599
|
-
(
|
|
64746
|
+
(name3) => !ancestors.has(name3) && !(parent && [...KEEP_EXTERNAL.values()].includes(name3)) && !(name3 === nsObjectProtocol && externalRoot(id) === nsObject)
|
|
64600
64747
|
)
|
|
64601
|
-
].filter((
|
|
64748
|
+
].filter((name3, at, all2) => all2.indexOf(name3) === at);
|
|
64602
64749
|
const parentSymbol = superId.has(id) ? byId.get(superId.get(id)) : void 0;
|
|
64603
64750
|
const open = symbol.accessLevel === "open" && (!parentSymbol || parentSymbol.accessLevel === "open");
|
|
64604
64751
|
emit(
|
|
@@ -64719,7 +64866,7 @@ function emitSwiftStandin(graphs, options) {
|
|
|
64719
64866
|
reason: `no header value for ${missing.map(leaf).join(", ")}`
|
|
64720
64867
|
});
|
|
64721
64868
|
const list2 = inheritance(id, raw2 ?? void 0).filter(
|
|
64722
|
-
(
|
|
64869
|
+
(name3) => !raw2 || name3 !== "RawRepresentable"
|
|
64723
64870
|
);
|
|
64724
64871
|
emit(
|
|
64725
64872
|
`${indent}${shape.attrs}public enum ${shape.name}${shape.generics}${list2.length ? `: ${list2.join(", ")}` : ""}${shape.where} {`
|
|
@@ -64860,7 +65007,7 @@ function emitSwiftStandin(graphs, options) {
|
|
|
64860
65007
|
if (TYPE_KINDS.has(symbol.kind.identifier)) emitType(symbol, "");
|
|
64861
65008
|
else emitGlobal(symbol);
|
|
64862
65009
|
}
|
|
64863
|
-
for (const [
|
|
65010
|
+
for (const [name3, members] of [...external].sort(([a], [b]) => a.localeCompare(b))) {
|
|
64864
65011
|
const seen = /* @__PURE__ */ new Set();
|
|
64865
65012
|
const kept = members.filter((member) => {
|
|
64866
65013
|
const key2 = `${member.kind.identifier}|${text3(member)}`;
|
|
@@ -64869,7 +65016,7 @@ function emitSwiftStandin(graphs, options) {
|
|
|
64869
65016
|
return true;
|
|
64870
65017
|
});
|
|
64871
65018
|
if (kept.length === 0) continue;
|
|
64872
|
-
emit(`extension ${
|
|
65019
|
+
emit(`extension ${name3} {`);
|
|
64873
65020
|
for (const member of kept)
|
|
64874
65021
|
if (member.kind.identifier === "swift.init" && !text3(member).startsWith("convenience"))
|
|
64875
65022
|
emitMember(
|
|
@@ -64893,7 +65040,7 @@ function emitSwiftStandin(graphs, options) {
|
|
|
64893
65040
|
`// stand-in for the binary ${options.module} module, generated from ${options.source}.`,
|
|
64894
65041
|
options.inert ? "// generated from public headers; native behavior is inert in peach." : "// unconfigured bodies trap because the vendor binary cannot run in peach.",
|
|
64895
65042
|
"",
|
|
64896
|
-
...imports.map((
|
|
65043
|
+
...imports.map((name3) => `import ${name3}`),
|
|
64897
65044
|
""
|
|
64898
65045
|
];
|
|
64899
65046
|
for (const path37 of behavior.keys())
|
|
@@ -64941,7 +65088,7 @@ var KEYWORDS = /* @__PURE__ */ new Set([
|
|
|
64941
65088
|
"false",
|
|
64942
65089
|
"nil"
|
|
64943
65090
|
]);
|
|
64944
|
-
var tick = (
|
|
65091
|
+
var tick = (name3) => KEYWORDS.has(name3) ? `\`${name3}\`` : name3;
|
|
64945
65092
|
function stripDefaults(decl) {
|
|
64946
65093
|
let out = "";
|
|
64947
65094
|
let depth = 0;
|
|
@@ -65009,16 +65156,16 @@ function treeDigest(root) {
|
|
|
65009
65156
|
ancestors.delete(resolved);
|
|
65010
65157
|
};
|
|
65011
65158
|
walk2(root);
|
|
65012
|
-
const stamp = names.map((
|
|
65013
|
-
const stat2 = import_node_fs24.default.statSync(import_node_path23.default.join(root,
|
|
65014
|
-
return `${
|
|
65159
|
+
const stamp = names.map((name3) => {
|
|
65160
|
+
const stat2 = import_node_fs24.default.statSync(import_node_path23.default.join(root, name3));
|
|
65161
|
+
return `${name3}\0${stat2.size}:${stat2.mtimeMs}`;
|
|
65015
65162
|
}).join("\n");
|
|
65016
65163
|
const memo2 = digests.get(`tree\0${root}`);
|
|
65017
65164
|
if (memo2?.stamp === stamp) return memo2.digest;
|
|
65018
65165
|
const hash = (0, import_node_crypto14.createHash)("sha256");
|
|
65019
|
-
for (const
|
|
65020
|
-
hash.update(`${
|
|
65021
|
-
hash.update(import_node_fs24.default.readFileSync(import_node_path23.default.join(root,
|
|
65166
|
+
for (const name3 of names) {
|
|
65167
|
+
hash.update(`${name3}\0`);
|
|
65168
|
+
hash.update(import_node_fs24.default.readFileSync(import_node_path23.default.join(root, name3)));
|
|
65022
65169
|
hash.update("\0");
|
|
65023
65170
|
}
|
|
65024
65171
|
const digest2 = hash.digest("hex");
|
|
@@ -65097,13 +65244,13 @@ function xcframework(binary2) {
|
|
|
65097
65244
|
var files = (dir, test) => import_node_fs24.default.existsSync(dir) ? import_node_fs24.default.readdirSync(dir, { recursive: true, encoding: "utf8" }).filter((file) => test(import_node_path23.default.basename(file))).sort() : [];
|
|
65098
65245
|
var OBJC = /^\s*(?:@interface|@protocol|@class|@import|#import)\b/m;
|
|
65099
65246
|
function headerSurface(module2, modulemap, headers) {
|
|
65100
|
-
const objc = files(headers, (
|
|
65247
|
+
const objc = files(headers, (name3) => name3.endsWith(".h")).some(
|
|
65101
65248
|
(file) => OBJC.test(import_node_fs24.default.readFileSync(import_node_path23.default.join(headers, file), "utf8"))
|
|
65102
65249
|
);
|
|
65103
65250
|
return objc ? { kind: "objc", module: module2, modulemap, headers } : { kind: "c", module: module2, modulemap, headers };
|
|
65104
65251
|
}
|
|
65105
65252
|
function surfaces(xcframeworkDir) {
|
|
65106
|
-
const slice = import_node_fs24.default.readdirSync(xcframeworkDir).filter((
|
|
65253
|
+
const slice = import_node_fs24.default.readdirSync(xcframeworkDir).filter((name3) => /^ios-.+-simulator$/.test(name3)).sort()[0];
|
|
65107
65254
|
const plain = !slice && xcframeworkDir.endsWith(".framework");
|
|
65108
65255
|
if (!slice && !plain) throw new Error("it has no iOS simulator slice");
|
|
65109
65256
|
const root = plain ? import_node_path23.default.dirname(xcframeworkDir) : import_node_path23.default.join(xcframeworkDir, slice);
|
|
@@ -65115,9 +65262,9 @@ function surfaces(xcframeworkDir) {
|
|
|
65115
65262
|
const swiftmodule = import_node_path23.default.join(framework, "Modules", `${module2}.swiftmodule`);
|
|
65116
65263
|
const interfaces = files(
|
|
65117
65264
|
swiftmodule,
|
|
65118
|
-
(
|
|
65265
|
+
(name3) => name3.endsWith(".swiftinterface") && !name3.endsWith(".private.swiftinterface") && !name3.endsWith(".package.swiftinterface")
|
|
65119
65266
|
);
|
|
65120
|
-
const chosen = interfaces.find((
|
|
65267
|
+
const chosen = interfaces.find((name3) => name3.startsWith("arm64-")) ?? interfaces[0] ?? null;
|
|
65121
65268
|
const modulemap = import_node_path23.default.join(framework, "Modules", "module.modulemap");
|
|
65122
65269
|
if (chosen) {
|
|
65123
65270
|
const file = import_node_path23.default.join(swiftmodule, chosen);
|
|
@@ -65141,7 +65288,7 @@ function surfaces(xcframeworkDir) {
|
|
|
65141
65288
|
found.push(headerSurface(module2, modulemap, import_node_path23.default.join(framework, "Headers")));
|
|
65142
65289
|
}
|
|
65143
65290
|
const headers = import_node_path23.default.join(root, "Headers");
|
|
65144
|
-
for (const map2 of files(headers, (
|
|
65291
|
+
for (const map2 of files(headers, (name3) => name3 === "module.modulemap")) {
|
|
65145
65292
|
const modulemap = import_node_path23.default.join(headers, map2);
|
|
65146
65293
|
const module2 = /(?:^|\s)module\s+(\w+)/.exec(import_node_fs24.default.readFileSync(modulemap, "utf8"))?.[1];
|
|
65147
65294
|
if (module2) found.push(headerSurface(module2, modulemap, import_node_path23.default.dirname(modulemap)));
|
|
@@ -65158,7 +65305,7 @@ function peachModuleDirs(toolchain, imports) {
|
|
|
65158
65305
|
if (swiftDistributionAt(moduleRoot)) return [import_node_path23.default.join(moduleRoot, "modules")];
|
|
65159
65306
|
const peach = new Set(swiftPeachModules(moduleRoot));
|
|
65160
65307
|
const targets = [.../* @__PURE__ */ new Set([...STANDIN_IMPORTS, ...imports])].filter(
|
|
65161
|
-
(
|
|
65308
|
+
(name3) => peach.has(name3)
|
|
65162
65309
|
);
|
|
65163
65310
|
const plugins = swiftMacroPlugins(moduleRoot);
|
|
65164
65311
|
if (plugins.stale)
|
|
@@ -65199,8 +65346,8 @@ function peachModuleDirs(toolchain, imports) {
|
|
|
65199
65346
|
return [
|
|
65200
65347
|
import_node_path23.default.join(release, "Modules"),
|
|
65201
65348
|
...import_node_fs24.default.readdirSync(release).filter(
|
|
65202
|
-
(
|
|
65203
|
-
).sort().map((
|
|
65349
|
+
(name3) => name3.endsWith(".build") && import_node_fs24.default.existsSync(import_node_path23.default.join(release, name3, "module.modulemap"))
|
|
65350
|
+
).sort().map((name3) => import_node_path23.default.join(release, name3))
|
|
65204
65351
|
];
|
|
65205
65352
|
}
|
|
65206
65353
|
function swiftInterfaceForWasm(text4) {
|
|
@@ -65211,7 +65358,7 @@ function swiftInterfaceForWasm(text4) {
|
|
|
65211
65358
|
const foundation = rooted !== text4 && !/^import[ \t]+Foundation\b/m.test(rooted) ? rooted.replace(/^(?=import[ \t])/m, "import Foundation\n") : rooted;
|
|
65212
65359
|
return foundation.replace(
|
|
65213
65360
|
/^(\/\/ swift-module-flags:.*)$/m,
|
|
65214
|
-
(flags) => flags.replace(/-target \S+/, `-target ${TRIPLE}`).replace(/\s-enable-objc-interop\b/, "").replace(/\s-target-variant \S+/, "") + ` ${WASI_EMULATION.map((
|
|
65361
|
+
(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(" ")}`
|
|
65215
65362
|
).replace(
|
|
65216
65363
|
/@(?:objc(?:\s*\([^()]*\))?|objcMembers|nonobjc|IBOutlet|IBAction|IBInspectable|IBDesignable|_objcRuntimeName\([^()]*\))(?![\w(])/g,
|
|
65217
65364
|
""
|
|
@@ -65240,7 +65387,7 @@ function swiftStandin(surface, binary2, toolchain, work, behavior, siblings) {
|
|
|
65240
65387
|
"-output-dir",
|
|
65241
65388
|
out
|
|
65242
65389
|
]);
|
|
65243
|
-
const graphs = import_node_fs24.default.readdirSync(out).filter((
|
|
65390
|
+
const graphs = import_node_fs24.default.readdirSync(out).filter((name3) => name3.endsWith(".symbols.json")).sort().map((name3) => JSON.parse(import_node_fs24.default.readFileSync(import_node_path23.default.join(out, name3), "utf8")));
|
|
65244
65391
|
return graphStandin(
|
|
65245
65392
|
surface.module,
|
|
65246
65393
|
graphs,
|
|
@@ -65286,7 +65433,7 @@ function wasmFlags(toolchain, imports) {
|
|
|
65286
65433
|
"-resource-dir",
|
|
65287
65434
|
resources,
|
|
65288
65435
|
// the sdk toolset's emulation defines, which raw swiftc does not read
|
|
65289
|
-
...WASI_EMULATION.flatMap((
|
|
65436
|
+
...WASI_EMULATION.flatMap((name3) => ["-Xcc", `-D${name3}`]),
|
|
65290
65437
|
...peachModuleDirs(toolchain, imports).flatMap((dir) => ["-I", dir]),
|
|
65291
65438
|
...toolchain.standinModules ? ["-I", toolchain.standinModules] : []
|
|
65292
65439
|
];
|
|
@@ -65319,10 +65466,10 @@ function graphStandin(module2, graphs, values, wasm, binary2, toolchain, work, b
|
|
|
65319
65466
|
(graph) => graph.symbols.map((symbol) => symbol.pathComponents.join("."))
|
|
65320
65467
|
)
|
|
65321
65468
|
);
|
|
65322
|
-
for (const
|
|
65323
|
-
if (!paths.has(
|
|
65469
|
+
for (const name3 of behavior.keys()) {
|
|
65470
|
+
if (!paths.has(name3))
|
|
65324
65471
|
throw new Error(
|
|
65325
|
-
`Configured Swift behavior ${module2}.${
|
|
65472
|
+
`Configured Swift behavior ${module2}.${name3} is not in the SDK surface`
|
|
65326
65473
|
);
|
|
65327
65474
|
}
|
|
65328
65475
|
const omit = /* @__PURE__ */ new Map();
|
|
@@ -65507,7 +65654,7 @@ function cStandin(surface, binary2, toolchain, work) {
|
|
|
65507
65654
|
const named = [
|
|
65508
65655
|
...import_node_fs24.default.readFileSync(surface.modulemap, "utf8").matchAll(/(?:umbrella\s+)?header\s+"([^"]+)"/g)
|
|
65509
65656
|
].map((match) => match[1]);
|
|
65510
|
-
const headers = files(surface.headers, (
|
|
65657
|
+
const headers = files(surface.headers, (name3) => name3.endsWith(".h"));
|
|
65511
65658
|
const texts = new Map(
|
|
65512
65659
|
headers.map((file) => [
|
|
65513
65660
|
file,
|
|
@@ -65630,7 +65777,7 @@ var UNSEARCHED = /* @__PURE__ */ new Set([
|
|
|
65630
65777
|
".git",
|
|
65631
65778
|
"DerivedData"
|
|
65632
65779
|
]);
|
|
65633
|
-
function crateFor(root,
|
|
65780
|
+
function crateFor(root, name3) {
|
|
65634
65781
|
const walk2 = (dir, depth) => {
|
|
65635
65782
|
const manifest = import_node_path23.default.join(dir, "Cargo.toml");
|
|
65636
65783
|
if (import_node_fs24.default.existsSync(manifest)) {
|
|
@@ -65641,10 +65788,10 @@ function crateFor(root, name2) {
|
|
|
65641
65788
|
const field = (body, key2) => new RegExp(`^${key2}\\s*=\\s*"([^"]+)"`, "m").exec(body)?.[1];
|
|
65642
65789
|
const lib = section("lib");
|
|
65643
65790
|
const crate = field(lib, "name") ?? field(section("package"), "name")?.replaceAll("-", "_");
|
|
65644
|
-
if (crate ===
|
|
65791
|
+
if (crate === name3) {
|
|
65645
65792
|
if (!/crate-type\s*=\s*\[[^\]]*"staticlib"/.test(lib))
|
|
65646
65793
|
throw new Error(
|
|
65647
|
-
`${import_node_path23.default.relative(root, manifest)} builds lib${
|
|
65794
|
+
`${import_node_path23.default.relative(root, manifest)} builds lib${name3} without crate-type "staticlib"`
|
|
65648
65795
|
);
|
|
65649
65796
|
return manifest;
|
|
65650
65797
|
}
|
|
@@ -65666,7 +65813,7 @@ function simulatorLibraryName(dir) {
|
|
|
65666
65813
|
if (!Array.isArray(libraries)) return void 0;
|
|
65667
65814
|
return libraries.filter(
|
|
65668
65815
|
(entry) => typeof entry === "object" && entry !== null && Reflect.get(entry, "SupportedPlatform") === "ios" && Reflect.get(entry, "SupportedPlatformVariant") === "simulator"
|
|
65669
|
-
).map((entry) => Reflect.get(entry, "LibraryPath")).find((
|
|
65816
|
+
).map((entry) => Reflect.get(entry, "LibraryPath")).find((name3) => typeof name3 === "string" && /^lib.+\.a$/.test(name3));
|
|
65670
65817
|
}
|
|
65671
65818
|
function standinLibrary(binary2, searchRoot) {
|
|
65672
65819
|
if (binary2.publicHeaders !== void 0) return null;
|
|
@@ -65674,7 +65821,7 @@ function standinLibrary(binary2, searchRoot) {
|
|
|
65674
65821
|
const library = simulatorLibraryName(dir);
|
|
65675
65822
|
const supplied = import_node_path23.default.join(dir, RUST_TARGET);
|
|
65676
65823
|
if (import_node_fs24.default.existsSync(supplied)) {
|
|
65677
|
-
const found = import_node_fs24.default.readdirSync(supplied).filter((
|
|
65824
|
+
const found = import_node_fs24.default.readdirSync(supplied).filter((name3) => name3.endsWith(".a"));
|
|
65678
65825
|
const chosen = library && found.includes(library) ? library : found.length === 1 ? found[0] : null;
|
|
65679
65826
|
if (!chosen)
|
|
65680
65827
|
throw new Error(
|
|
@@ -65878,12 +66025,12 @@ function readStandinResults(receipt, generation, targets) {
|
|
|
65878
66025
|
if (!Array.isArray(entry.result))
|
|
65879
66026
|
throw new Error("invalid Swift stand-in builder result");
|
|
65880
66027
|
for (const item of entry.result) {
|
|
65881
|
-
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((
|
|
66028
|
+
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")))
|
|
65882
66029
|
throw new Error("invalid Swift stand-in builder result");
|
|
65883
66030
|
const files2 = {};
|
|
65884
|
-
for (const [
|
|
66031
|
+
for (const [name3, text4] of Object.entries(item.files)) {
|
|
65885
66032
|
if (typeof text4 !== "string") throw new Error("invalid Swift stand-in file");
|
|
65886
|
-
files2[
|
|
66033
|
+
files2[name3] = text4;
|
|
65887
66034
|
}
|
|
65888
66035
|
standins.push({
|
|
65889
66036
|
module: item.module,
|
|
@@ -65920,13 +66067,13 @@ function standinGenerationInputs(binaries, toolchain, behavior = {}) {
|
|
|
65920
66067
|
}
|
|
65921
66068
|
})
|
|
65922
66069
|
);
|
|
65923
|
-
const selected = Object.keys(behavior).filter((
|
|
66070
|
+
const selected = Object.keys(behavior).filter((name3) => modules.has(name3)).sort();
|
|
65924
66071
|
if (selected.length > 0)
|
|
65925
66072
|
parts.push(
|
|
65926
66073
|
JSON.stringify(
|
|
65927
|
-
selected.map((
|
|
65928
|
-
|
|
65929
|
-
Object.keys(behavior[
|
|
66074
|
+
selected.map((name3) => [
|
|
66075
|
+
name3,
|
|
66076
|
+
Object.keys(behavior[name3]).sort().map((member) => [member, behavior[name3][member]])
|
|
65930
66077
|
])
|
|
65931
66078
|
)
|
|
65932
66079
|
);
|
|
@@ -65976,7 +66123,7 @@ function binaryStandins(binary2, toolchain, provided, behavior, frameworks, sibl
|
|
|
65976
66123
|
const module2 = swiftTargetModuleName(binary2.target);
|
|
65977
66124
|
const modulemap = import_node_path23.default.join(work, "module.modulemap");
|
|
65978
66125
|
const supplied = import_node_path23.default.join(headers, "module.modulemap");
|
|
65979
|
-
const roots = files(headers, (
|
|
66126
|
+
const roots = files(headers, (name3) => name3.endsWith(".h"));
|
|
65980
66127
|
if (roots.length === 0)
|
|
65981
66128
|
throw new Error("its public header directory has no headers");
|
|
65982
66129
|
import_node_fs24.default.writeFileSync(
|
|
@@ -66032,7 +66179,7 @@ ${roots.map((file) => ` header "${file}"`).join("\n")}
|
|
|
66032
66179
|
for (const file of surface.kind === "swift" ? [surface.interface] : [
|
|
66033
66180
|
...surface.kind === "mixed" ? [surface.interface] : [],
|
|
66034
66181
|
surface.modulemap,
|
|
66035
|
-
...files(surface.headers, (
|
|
66182
|
+
...files(surface.headers, (name3) => name3.endsWith(".h")).map(
|
|
66036
66183
|
(file2) => import_node_path23.default.join(surface.headers, file2)
|
|
66037
66184
|
)
|
|
66038
66185
|
])
|
|
@@ -66290,7 +66437,7 @@ function isSwiftNativeModules(value) {
|
|
|
66290
66437
|
...Object.values(value.modules),
|
|
66291
66438
|
...Object.values(value.views)
|
|
66292
66439
|
].every(
|
|
66293
|
-
(names) => Array.isArray(names) && names.every((
|
|
66440
|
+
(names) => Array.isArray(names) && names.every((name3) => typeof name3 === "string")
|
|
66294
66441
|
) && Array.isArray(value.defaultViewFiles) && value.defaultViewFiles.every((file) => typeof file === "string");
|
|
66295
66442
|
}
|
|
66296
66443
|
function isSwiftCompileOutcome(value) {
|
|
@@ -66316,8 +66463,8 @@ function compileAssetUrl(value, origin) {
|
|
|
66316
66463
|
}
|
|
66317
66464
|
function resolveImageUrls(urls, origin) {
|
|
66318
66465
|
const resolved = {};
|
|
66319
|
-
for (const [
|
|
66320
|
-
resolved[
|
|
66466
|
+
for (const [name3, url] of Object.entries(urls)) {
|
|
66467
|
+
resolved[name3] = compileAssetUrl(url, origin);
|
|
66321
66468
|
}
|
|
66322
66469
|
return resolved;
|
|
66323
66470
|
}
|
|
@@ -66469,9 +66616,9 @@ function swiftPackages(entry, app) {
|
|
|
66469
66616
|
))
|
|
66470
66617
|
compileXcodeObjCImplementations(app, cached4.binaries, entry.moduleRoot);
|
|
66471
66618
|
const vendored = app.binaryFrameworks.flatMap(
|
|
66472
|
-
({ name:
|
|
66619
|
+
({ name: name3, path: dir }) => dir ? [
|
|
66473
66620
|
{
|
|
66474
|
-
target:
|
|
66621
|
+
target: name3,
|
|
66475
66622
|
source: "the project",
|
|
66476
66623
|
url: null,
|
|
66477
66624
|
checksum: null,
|
|
@@ -66596,7 +66743,7 @@ ${implementations.map((file) => ` ${file}`).join("\n")}`
|
|
|
66596
66743
|
targets.push({
|
|
66597
66744
|
name: standin.module,
|
|
66598
66745
|
path: import_node_path24.default.posix.join(SWIFT_STANDINS_DIR, standin.module),
|
|
66599
|
-
dependencies: standin.dependencies?.map((
|
|
66746
|
+
dependencies: standin.dependencies?.map((name3) => ({ kind: "target", name: name3 })),
|
|
66600
66747
|
executable: false,
|
|
66601
66748
|
resources: false,
|
|
66602
66749
|
exclude: [],
|
|
@@ -66655,9 +66802,9 @@ function xcodeManifest(layout) {
|
|
|
66655
66802
|
const settings = (target) => `swiftSettings: [${[
|
|
66656
66803
|
`.swiftLanguageMode(.v${target.languageMode})`,
|
|
66657
66804
|
...target.mainActorIsolation ? [".defaultIsolation(MainActor.self)"] : [],
|
|
66658
|
-
...(target.defines ?? []).map((
|
|
66805
|
+
...(target.defines ?? []).map((name3) => `.define(${JSON.stringify(name3)})`)
|
|
66659
66806
|
].join(", ")}]`;
|
|
66660
|
-
const libraries = (target) => target.linkedLibraries?.length ? `, linkerSettings: [${target.linkedLibraries.map((
|
|
66807
|
+
const libraries = (target) => target.linkedLibraries?.length ? `, linkerSettings: [${target.linkedLibraries.map((name3) => `.linkedLibrary(${JSON.stringify(name3)})`).join(", ")}]` : "";
|
|
66661
66808
|
return [
|
|
66662
66809
|
"// swift-tools-version: 6.2",
|
|
66663
66810
|
"import PackageDescription",
|
|
@@ -66840,7 +66987,7 @@ function buildSwiftResourceTable(project, baseUrl, inputs) {
|
|
|
66840
66987
|
registered.set(`${sha256}.metal`, { bytes, contentType: "text/plain; charset=utf-8" });
|
|
66841
66988
|
}
|
|
66842
66989
|
let imageBytes = 0;
|
|
66843
|
-
for (const { name:
|
|
66990
|
+
for (const { name: name3, file, scale, bundlePath } of found) {
|
|
66844
66991
|
const disk = byRelative.get(file);
|
|
66845
66992
|
if (!disk) continue;
|
|
66846
66993
|
if (Object.keys(images).length >= limits.images || imageBytes + import_node_fs25.default.statSync(disk).size > limits.imageTotalBytes) {
|
|
@@ -66851,7 +66998,7 @@ function buildSwiftResourceTable(project, baseUrl, inputs) {
|
|
|
66851
66998
|
const hash = (0, import_node_crypto15.createHash)("sha256").update(bytes).digest("hex").slice(0, 16);
|
|
66852
66999
|
const ext = import_node_path24.default.posix.extname(file).toLowerCase();
|
|
66853
67000
|
const bundle = table[bundlePath] ?? /* @__PURE__ */ Object.create(null);
|
|
66854
|
-
const variants = bundle[
|
|
67001
|
+
const variants = bundle[name3] ??= [];
|
|
66855
67002
|
variants.push({ uri: `${baseUrl}${RESOURCE_PATH}${hash}${ext}`, scale });
|
|
66856
67003
|
table[bundlePath] = bundle;
|
|
66857
67004
|
const key2 = layout ? xcodeInputKey(layout, disk, file) : file;
|
|
@@ -66932,10 +67079,10 @@ function buildSwiftBundleFiles(packagePath, hosted, inputs) {
|
|
|
66932
67079
|
const bytes = readPackageFile2(packagePath, disk, limits.resourceBytes);
|
|
66933
67080
|
addFile(bundlePath === "." ? base : `${bundlePath}/${base}`, bytes);
|
|
66934
67081
|
if (base.endsWith(".xcstrings")) {
|
|
66935
|
-
for (const [
|
|
67082
|
+
for (const [name3, table] of Object.entries(
|
|
66936
67083
|
compileStringCatalog(bytes.toString("utf8"), base.slice(0, -10))
|
|
66937
67084
|
)) {
|
|
66938
|
-
addFile(bundlePath === "." ?
|
|
67085
|
+
addFile(bundlePath === "." ? name3 : `${bundlePath}/${name3}`, Buffer.from(table));
|
|
66939
67086
|
}
|
|
66940
67087
|
}
|
|
66941
67088
|
}
|
|
@@ -67261,10 +67408,10 @@ var IOS_SDK_FRAMEWORKS = new Set(ios_sdk_frameworks_default.frameworks);
|
|
|
67261
67408
|
async function missingModulesMessage(packagePath, missing) {
|
|
67262
67409
|
const layout = xcodeLayout(packagePath);
|
|
67263
67410
|
const gaps = new Map([
|
|
67264
|
-
...(layout?.app.binaryFrameworks ?? []).map(({ name:
|
|
67265
|
-
const gap = layout?.projectGaps.get(
|
|
67411
|
+
...(layout?.app.binaryFrameworks ?? []).map(({ name: name3 }) => {
|
|
67412
|
+
const gap = layout?.projectGaps.get(name3);
|
|
67266
67413
|
return [
|
|
67267
|
-
|
|
67414
|
+
name3,
|
|
67268
67415
|
{
|
|
67269
67416
|
source: "the project",
|
|
67270
67417
|
reason: `a vendored binary framework${gap ? `; no stand-in: ${gap}` : ""}`
|
|
@@ -67272,9 +67419,9 @@ async function missingModulesMessage(packagePath, missing) {
|
|
|
67272
67419
|
];
|
|
67273
67420
|
}),
|
|
67274
67421
|
...[...missing.keys()].flatMap(
|
|
67275
|
-
(
|
|
67422
|
+
(name3) => IOS_SDK_FRAMEWORKS.has(name3) ? [
|
|
67276
67423
|
[
|
|
67277
|
-
|
|
67424
|
+
name3,
|
|
67278
67425
|
{ source: "the iOS SDK", reason: "a framework Peach does not provide" }
|
|
67279
67426
|
]
|
|
67280
67427
|
] : []
|
|
@@ -67283,28 +67430,28 @@ async function missingModulesMessage(packagePath, missing) {
|
|
|
67283
67430
|
...layout?.packages.unavailable ?? []
|
|
67284
67431
|
]);
|
|
67285
67432
|
const packaged = new Set(
|
|
67286
|
-
[...missing.keys()].filter((
|
|
67433
|
+
[...missing.keys()].filter((name3) => !IOS_SDK_FRAMEWORKS.has(name3))
|
|
67287
67434
|
);
|
|
67288
67435
|
if (packaged.size > 0)
|
|
67289
67436
|
await Promise.all(
|
|
67290
67437
|
(layout?.packages.binaries ?? []).map(async (binary2) => {
|
|
67291
67438
|
const modules = await swiftBinaryModules(binary2).catch(() => []);
|
|
67292
|
-
for (const
|
|
67293
|
-
if (packaged.has(
|
|
67294
|
-
gaps.set(
|
|
67439
|
+
for (const name3 of modules)
|
|
67440
|
+
if (packaged.has(name3))
|
|
67441
|
+
gaps.set(name3, {
|
|
67295
67442
|
source: binary2.source,
|
|
67296
67443
|
reason: layout?.packages.modules.get(binary2.target)?.reason ?? `${binary2.target} is a binary framework`
|
|
67297
67444
|
});
|
|
67298
67445
|
})
|
|
67299
67446
|
);
|
|
67300
|
-
const width = Math.max(...[...missing.keys()].map((
|
|
67447
|
+
const width = Math.max(...[...missing.keys()].map((name3) => name3.length));
|
|
67301
67448
|
const opened = xcodeProjects.get(packagePath)?.xcodeproj;
|
|
67302
67449
|
const workspace = opened?.endsWith(".xcodeproj") ? enclosingXcodeWorkspace(opened) : null;
|
|
67303
67450
|
return [
|
|
67304
67451
|
`Peach does not provide ${missing.size} module${missing.size === 1 ? "" : "s"} this app imports:`,
|
|
67305
|
-
...[...missing].map(([
|
|
67306
|
-
const gap = gaps.get(
|
|
67307
|
-
return ` ${
|
|
67452
|
+
...[...missing].map(([name3, files2]) => {
|
|
67453
|
+
const gap = gaps.get(name3);
|
|
67454
|
+
return ` ${name3.padEnd(width)} ${files2.length} file${files2.length === 1 ? "" : "s"}${gap ? `, ${gap.source.includes("://") ? `package ${gap.source}` : gap.source.startsWith("/") ? `package ${import_node_path24.default.relative(packagePath, gap.source) || "."}` : gap.source} (${gap.reason})` : ""}`;
|
|
67308
67455
|
}),
|
|
67309
67456
|
...workspace ? [
|
|
67310
67457
|
`${import_node_path24.default.basename(opened)} is part of ${import_node_path24.default.relative(process.cwd(), workspace)}, which holds its local packages and Package.resolved pins; pass the workspace to build what Xcode builds there.`
|
|
@@ -67590,12 +67737,12 @@ async function collectExpoSwiftSources(appRoot, signal) {
|
|
|
67590
67737
|
const classes = [];
|
|
67591
67738
|
for (const module2 of modules) {
|
|
67592
67739
|
const className = typeof module2 === "string" ? module2 : module2 && typeof module2 === "object" ? Reflect.get(module2, "class") : null;
|
|
67593
|
-
const
|
|
67594
|
-
if (typeof className !== "string" || !/^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$/.test(className) ||
|
|
67740
|
+
const name3 = typeof module2 === "string" ? null : module2 && typeof module2 === "object" ? Reflect.get(module2, "name") : null;
|
|
67741
|
+
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")
|
|
67595
67742
|
throw new Error(`${sourceRoot}: invalid Expo Apple module descriptor`);
|
|
67596
67743
|
classes.push({
|
|
67597
67744
|
name: className.split(".").pop(),
|
|
67598
|
-
registration: `(${className.includes(".") ? className : `${namespace}.${className}`}.self, ${
|
|
67745
|
+
registration: `(${className.includes(".") ? className : `${namespace}.${className}`}.self, ${name3 === null ? "nil" : JSON.stringify(name3)})`
|
|
67599
67746
|
});
|
|
67600
67747
|
}
|
|
67601
67748
|
const ios = import_node_path25.default.join(canonical, "ios");
|
|
@@ -67695,8 +67842,8 @@ ${import_node_fs26.default.readFileSync(source, "utf8")}`;
|
|
|
67695
67842
|
...dependency.flatMap((item) => item.frameworks)
|
|
67696
67843
|
])
|
|
67697
67844
|
];
|
|
67698
|
-
for (const [
|
|
67699
|
-
if (
|
|
67845
|
+
for (const [name3, source] of Object.entries(allFiles)) {
|
|
67846
|
+
if (name3.startsWith(`Sources/${namespace}/`)) unit2.files[name3] = source;
|
|
67700
67847
|
}
|
|
67701
67848
|
}
|
|
67702
67849
|
unit2.files["Package.swift"] = expoManifest(unit2.files);
|
|
@@ -67715,7 +67862,7 @@ function expoManifest(files2, generation = "", modes = /* @__PURE__ */ new Map()
|
|
|
67715
67862
|
}
|
|
67716
67863
|
return `// swift-tools-version: 6.0
|
|
67717
67864
|
import PackageDescription
|
|
67718
|
-
let package = Package(name: "PeachExpo", targets: [${[...targets].map(([
|
|
67865
|
+
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")])
|
|
67719
67866
|
// stand-in inputs: ${generation}
|
|
67720
67867
|
`;
|
|
67721
67868
|
}
|
|
@@ -67757,17 +67904,17 @@ function expoSwiftPreparedKey(base, units) {
|
|
|
67757
67904
|
for (const unit2 of units) {
|
|
67758
67905
|
hash.update("\0");
|
|
67759
67906
|
hash.update(unit2.moduleId);
|
|
67760
|
-
for (const
|
|
67907
|
+
for (const name3 of Object.keys(unit2.files).sort()) {
|
|
67761
67908
|
hash.update("\0");
|
|
67762
|
-
hash.update(
|
|
67909
|
+
hash.update(name3);
|
|
67763
67910
|
hash.update("\0");
|
|
67764
|
-
hash.update(unit2.files[
|
|
67911
|
+
hash.update(unit2.files[name3] ?? "");
|
|
67765
67912
|
}
|
|
67766
67913
|
}
|
|
67767
67914
|
return hash.digest("hex");
|
|
67768
67915
|
}
|
|
67769
|
-
function expoSwiftPackage(appKey,
|
|
67770
|
-
return import_node_path25.default.join(import_node_os7.default.tmpdir(), "peach-expo-swift", appKey, `p${process.pid}`,
|
|
67916
|
+
function expoSwiftPackage(appKey, name3) {
|
|
67917
|
+
return import_node_path25.default.join(import_node_os7.default.tmpdir(), "peach-expo-swift", appKey, `p${process.pid}`, name3);
|
|
67771
67918
|
}
|
|
67772
67919
|
var ExpoSwiftLinkRefusal = class extends Error {
|
|
67773
67920
|
};
|
|
@@ -67883,7 +68030,7 @@ async function compileExpoSwiftModules(root, base, publishArtifact, options = {}
|
|
|
67883
68030
|
(source) => swiftImportNames(source, importedAvailable)
|
|
67884
68031
|
)
|
|
67885
68032
|
);
|
|
67886
|
-
const reached = binaries.filter((item) => item.modules.some((
|
|
68033
|
+
const reached = binaries.filter((item) => item.modules.some((name3) => imports.has(name3))).map((item) => item.binary);
|
|
67887
68034
|
if (reached.length > 0) {
|
|
67888
68035
|
const toolchain = {
|
|
67889
68036
|
moduleRoot: module2.root,
|
|
@@ -67895,9 +68042,9 @@ async function compileExpoSwiftModules(root, base, publishArtifact, options = {}
|
|
|
67895
68042
|
const linkedLibraries = standinLibraries(reached, built2.standins, root);
|
|
67896
68043
|
const linkedStandins = new Set([...linkedLibraries.values()].flat());
|
|
67897
68044
|
for (const standin of built2.standins)
|
|
67898
|
-
for (const [
|
|
67899
|
-
const file = `${SWIFT_STANDINS_DIR}/${standin.module}/${
|
|
67900
|
-
const text4 = linkedStandins.has(standin) &&
|
|
68045
|
+
for (const [name3, source] of Object.entries(standin.files)) {
|
|
68046
|
+
const file = `${SWIFT_STANDINS_DIR}/${standin.module}/${name3}`;
|
|
68047
|
+
const text4 = linkedStandins.has(standin) && name3 === `${standin.module}.c` ? `// ${standin.target}'s WebAssembly library defines ${standin.module}'s functions.
|
|
67901
68048
|
` : source;
|
|
67902
68049
|
if (file in unit2.files && unit2.files[file] !== text4)
|
|
67903
68050
|
throw new Error(`conflicting Expo Swift binary source ${file}`);
|
|
@@ -67916,7 +68063,7 @@ async function compileExpoSwiftModules(root, base, publishArtifact, options = {}
|
|
|
67916
68063
|
generations.set(unit2, generation);
|
|
67917
68064
|
gaps.set(
|
|
67918
68065
|
unit2,
|
|
67919
|
-
[...built2.gaps].map(([
|
|
68066
|
+
[...built2.gaps].map(([name3, reason]) => `${name3}: no stand-in: ${reason}`)
|
|
67920
68067
|
);
|
|
67921
68068
|
unit2.files["Package.swift"] = expoManifest(
|
|
67922
68069
|
unit2.files,
|
|
@@ -67929,8 +68076,8 @@ async function compileExpoSwiftModules(root, base, publishArtifact, options = {}
|
|
|
67929
68076
|
syncSwiftTree(
|
|
67930
68077
|
packagePath,
|
|
67931
68078
|
new Map(
|
|
67932
|
-
Object.entries(unit2.files).map(([
|
|
67933
|
-
import_node_path25.default.join(packagePath,
|
|
68079
|
+
Object.entries(unit2.files).map(([name3, source]) => [
|
|
68080
|
+
import_node_path25.default.join(packagePath, name3),
|
|
67934
68081
|
source
|
|
67935
68082
|
])
|
|
67936
68083
|
)
|
|
@@ -67957,10 +68104,10 @@ async function compileExpoSwiftModules(root, base, publishArtifact, options = {}
|
|
|
67957
68104
|
const link = async (linked2) => {
|
|
67958
68105
|
const files2 = {};
|
|
67959
68106
|
for (const unit2 of linked2)
|
|
67960
|
-
for (const [
|
|
67961
|
-
if (
|
|
67962
|
-
throw new Error(`conflicting Expo Swift binary source ${
|
|
67963
|
-
files2[
|
|
68107
|
+
for (const [name3, source] of Object.entries(unit2.files)) {
|
|
68108
|
+
if (name3.startsWith(`${SWIFT_STANDINS_DIR}/`) && name3 in files2 && files2[name3] !== source)
|
|
68109
|
+
throw new Error(`conflicting Expo Swift binary source ${name3}`);
|
|
68110
|
+
files2[name3] = source;
|
|
67964
68111
|
}
|
|
67965
68112
|
files2[EXPO_SWIFT_ENTRY] = expoEntry(linked2);
|
|
67966
68113
|
files2["Package.swift"] = expoManifest(
|
|
@@ -67972,18 +68119,18 @@ async function compileExpoSwiftModules(root, base, publishArtifact, options = {}
|
|
|
67972
68119
|
syncSwiftTree(
|
|
67973
68120
|
packagePath,
|
|
67974
68121
|
new Map(
|
|
67975
|
-
Object.entries(files2).map(([
|
|
67976
|
-
import_node_path25.default.join(packagePath,
|
|
68122
|
+
Object.entries(files2).map(([name3, source]) => [
|
|
68123
|
+
import_node_path25.default.join(packagePath, name3),
|
|
67977
68124
|
source
|
|
67978
68125
|
])
|
|
67979
68126
|
)
|
|
67980
68127
|
);
|
|
67981
68128
|
const linkedLibraries = /* @__PURE__ */ new Map();
|
|
67982
68129
|
for (const unit2 of linked2)
|
|
67983
|
-
for (const [
|
|
67984
|
-
if (linkedLibraries.has(
|
|
67985
|
-
throw new Error(`conflicting Expo Swift binary libraries for ${
|
|
67986
|
-
linkedLibraries.set(
|
|
68130
|
+
for (const [name3, library] of Object.entries(libraries.get(unit2) ?? {})) {
|
|
68131
|
+
if (linkedLibraries.has(name3) && linkedLibraries.get(name3) !== library)
|
|
68132
|
+
throw new Error(`conflicting Expo Swift binary libraries for ${name3}`);
|
|
68133
|
+
linkedLibraries.set(name3, library);
|
|
67987
68134
|
}
|
|
67988
68135
|
projectFor(packagePath).libraries = linkedLibraries.size > 0 ? Object.fromEntries(linkedLibraries) : void 0;
|
|
67989
68136
|
signal.throwIfAborted();
|
|
@@ -68087,7 +68234,7 @@ async function compileExpoSwiftModules(root, base, publishArtifact, options = {}
|
|
|
68087
68234
|
);
|
|
68088
68235
|
const dropped = linked.filter(
|
|
68089
68236
|
(unit2) => Object.values(unit2.files).some(
|
|
68090
|
-
(source) => swiftImportNames(source).some((
|
|
68237
|
+
(source) => swiftImportNames(source).some((name3) => missing.has(name3))
|
|
68091
68238
|
)
|
|
68092
68239
|
);
|
|
68093
68240
|
if (dropped.length === 0) throw error;
|
|
@@ -68359,8 +68506,9 @@ function streamFile(res, stream) {
|
|
|
68359
68506
|
// src/runtime-delivery.ts
|
|
68360
68507
|
init_home_paths();
|
|
68361
68508
|
init_public_brand();
|
|
68362
|
-
var DEFAULT_RUNTIME_CDN_ORIGIN =
|
|
68363
|
-
var RNX_CHANGELOG_URL = `${
|
|
68509
|
+
var DEFAULT_RUNTIME_CDN_ORIGIN = peachPublicBrand.origin;
|
|
68510
|
+
var RNX_CHANGELOG_URL = `${peachPublicBrand.origin}/changelog`;
|
|
68511
|
+
var RNX_CHANGELOG_API_URL = `${peachPublicBrand.origin}/api/changelog/sootsim`;
|
|
68364
68512
|
var RNX_RUNTIME_PRODUCT = {
|
|
68365
68513
|
id: "peach",
|
|
68366
68514
|
defaultCdnOrigin: DEFAULT_RUNTIME_CDN_ORIGIN,
|
|
@@ -68754,10 +68902,10 @@ async function settingsBundleFingerprint(bundlePath) {
|
|
|
68754
68902
|
const names = entries.filter((entry) => entry.isFile() && entry.name.toLowerCase().endsWith(".plist")).map((entry) => entry.name).sort().slice(0, MAX_PLIST_FILES + 1);
|
|
68755
68903
|
if (names.length === 0 || names.length > MAX_PLIST_FILES) return null;
|
|
68756
68904
|
const parts = await Promise.all(
|
|
68757
|
-
names.map(async (
|
|
68758
|
-
const metadata = await (0, import_promises3.stat)((0, import_node_path26.join)(bundlePath,
|
|
68905
|
+
names.map(async (name3) => {
|
|
68906
|
+
const metadata = await (0, import_promises3.stat)((0, import_node_path26.join)(bundlePath, name3));
|
|
68759
68907
|
if (!metadata.isFile() || metadata.size > MAX_PLIST_BYTES) return null;
|
|
68760
|
-
return `${
|
|
68908
|
+
return `${name3}:${metadata.size}:${metadata.mtimeMs}:${metadata.ctimeMs}`;
|
|
68761
68909
|
})
|
|
68762
68910
|
);
|
|
68763
68911
|
if (parts.some((part) => part === null)) return null;
|
|
@@ -70100,8 +70248,8 @@ function sourceEntryPath() {
|
|
|
70100
70248
|
}
|
|
70101
70249
|
}
|
|
70102
70250
|
function isCliEntry(path37) {
|
|
70103
|
-
const
|
|
70104
|
-
return
|
|
70251
|
+
const name3 = (0, import_node_path29.basename)(path37);
|
|
70252
|
+
return name3 === "bin.ts" || name3 === "bin.js";
|
|
70105
70253
|
}
|
|
70106
70254
|
function rnxSelfInvocation() {
|
|
70107
70255
|
if (IS_STANDALONE) return { executable: process.execPath, prefixArgs: [] };
|
|
@@ -71616,7 +71764,7 @@ function applyFetchProxyCors(req, res) {
|
|
|
71616
71764
|
"access-control-expose-headers",
|
|
71617
71765
|
[
|
|
71618
71766
|
...Object.keys(res.getHeaders()).filter(
|
|
71619
|
-
(
|
|
71767
|
+
(name3) => !name3.startsWith("access-control-")
|
|
71620
71768
|
),
|
|
71621
71769
|
"x-sootsim-set-cookie"
|
|
71622
71770
|
].join(", ")
|
|
@@ -71642,7 +71790,7 @@ function buildAppApiProxyHeaders(reqHeaders, targetUrl) {
|
|
|
71642
71790
|
if (typeof nativeCookie === "string" && nativeCookie)
|
|
71643
71791
|
headers.cookie = decodeURIComponent(nativeCookie);
|
|
71644
71792
|
headers.host = targetUrl.host;
|
|
71645
|
-
if (!Object.keys(headers).some((
|
|
71793
|
+
if (!Object.keys(headers).some((name3) => name3.toLowerCase() === "mobile-origin")) {
|
|
71646
71794
|
headers.origin = targetUrl.origin;
|
|
71647
71795
|
headers.referer = `${targetUrl.origin}/`;
|
|
71648
71796
|
}
|
|
@@ -71764,7 +71912,7 @@ function handleAppApiRequest(req, res) {
|
|
|
71764
71912
|
res.setHeader("access-control-allow-credentials", "true");
|
|
71765
71913
|
res.setHeader(
|
|
71766
71914
|
"access-control-expose-headers",
|
|
71767
|
-
Object.keys(res.getHeaders()).filter((
|
|
71915
|
+
Object.keys(res.getHeaders()).filter((name3) => !name3.startsWith("access-control-") && name3 !== "set-cookie").join(", ")
|
|
71768
71916
|
);
|
|
71769
71917
|
}
|
|
71770
71918
|
});
|
|
@@ -72648,21 +72796,21 @@ function unsupportedSpecifier(specifier) {
|
|
|
72648
72796
|
`replacement modules may only import react, react-native, peach-kit, the packages rnx stubs for this app, and other project files by relative path; '${specifier}' is none of those. vendor the code into a project file, or add the package to peach.config so the simulator bridges it.`
|
|
72649
72797
|
);
|
|
72650
72798
|
}
|
|
72651
|
-
function bridgeDeclaration(
|
|
72799
|
+
function bridgeDeclaration(name3, specifier) {
|
|
72652
72800
|
const notReady = (what) => JSON.stringify(`[peach] replacement ${what} bridge is not ready`);
|
|
72653
72801
|
if (specifier === "react") {
|
|
72654
|
-
return `const ${
|
|
72802
|
+
return `const ${name3} = ${REACT_BRIDGE}; if (!${name3}) throw new Error(${notReady("React")});`;
|
|
72655
72803
|
}
|
|
72656
72804
|
if (specifier === "react-native") {
|
|
72657
|
-
return `const ${
|
|
72805
|
+
return `const ${name3} = ${REACT_NATIVE_BRIDGE}; if (!${name3}) throw new Error(${notReady("React Native")});`;
|
|
72658
72806
|
}
|
|
72659
72807
|
if (isPeachKitSpecifier(specifier)) {
|
|
72660
|
-
return `const ${
|
|
72808
|
+
return `const ${name3} = (globalThis.__peach_kit_modules && globalThis.__peach_kit_modules[${JSON.stringify(specifier)}]) || (${PACKAGE_BRIDGES} || {})[${JSON.stringify(specifier)}]; if (!${name3}) throw new Error(${JSON.stringify(`[peach] replacement package bridge ${specifier} is not ready`)});`;
|
|
72661
72809
|
}
|
|
72662
72810
|
if (JSX_RUNTIME_SPECIFIERS.has(specifier)) {
|
|
72663
|
-
return `const ${
|
|
72811
|
+
return `const ${name3} = (() => { const react = ${REACT_BRIDGE}; if (!react) throw new Error(${notReady("React")}); const jsx = (type, props, key) => react.createElement(type, key === undefined ? props : { ...props, key }); return { Fragment: react.Fragment, jsx, jsxs: jsx, jsxDEV: jsx }; })();`;
|
|
72664
72812
|
}
|
|
72665
|
-
return `const ${
|
|
72813
|
+
return `const ${name3} = (${PACKAGE_BRIDGES} || {})[${JSON.stringify(specifier)}]; if (!${name3}) throw new Error(${JSON.stringify(`[peach] replacement package bridge ${specifier} is not ready`)});`;
|
|
72666
72814
|
}
|
|
72667
72815
|
var DEFAULT_INTEROP = "__rnxReplacementDefault";
|
|
72668
72816
|
var DEFAULT_INTEROP_DECLARATION = `const ${DEFAULT_INTEROP} = (bridge) => (bridge && bridge.__esModule ? bridge.default : bridge);`;
|
|
@@ -72694,10 +72842,10 @@ function compileReplacementModule(input) {
|
|
|
72694
72842
|
const bridgeFor = (specifier) => {
|
|
72695
72843
|
const existing = bridgeNames.get(specifier);
|
|
72696
72844
|
if (existing) return existing;
|
|
72697
|
-
const
|
|
72698
|
-
bridgeNames.set(specifier,
|
|
72699
|
-
declarations.push(bridgeDeclaration(
|
|
72700
|
-
return
|
|
72845
|
+
const name3 = `__rnxReplacementBridge${bridgeNames.size}`;
|
|
72846
|
+
bridgeNames.set(specifier, name3);
|
|
72847
|
+
declarations.push(bridgeDeclaration(name3, specifier));
|
|
72848
|
+
return name3;
|
|
72701
72849
|
};
|
|
72702
72850
|
const edits = [];
|
|
72703
72851
|
const pointAtLocalModule = (specifierToken, specifier) => {
|
|
@@ -73054,8 +73202,8 @@ function isStagedHostFileRequest(rawUrl) {
|
|
|
73054
73202
|
}
|
|
73055
73203
|
async function handleStagedHostFileRequest(req, res) {
|
|
73056
73204
|
const pathname = new URL(req.url ?? "/", "http://localhost").pathname;
|
|
73057
|
-
const
|
|
73058
|
-
const match = STAGED_NAME.exec(
|
|
73205
|
+
const name3 = pathname.slice(STAGED_PREFIX.length);
|
|
73206
|
+
const match = STAGED_NAME.exec(name3);
|
|
73059
73207
|
res.setHeader("Access-Control-Allow-Origin", req.headers.origin ?? "*");
|
|
73060
73208
|
res.setHeader("Cross-Origin-Resource-Policy", "cross-origin");
|
|
73061
73209
|
if (!match) {
|
|
@@ -73077,7 +73225,7 @@ async function handleStagedHostFileRequest(req, res) {
|
|
|
73077
73225
|
return;
|
|
73078
73226
|
}
|
|
73079
73227
|
try {
|
|
73080
|
-
const bytes = await import_node_fs38.default.promises.readFile(import_node_path37.default.join(stagedDir(),
|
|
73228
|
+
const bytes = await import_node_fs38.default.promises.readFile(import_node_path37.default.join(stagedDir(), name3));
|
|
73081
73229
|
res.writeHead(200, {
|
|
73082
73230
|
"Content-Type": contentType(match[2]),
|
|
73083
73231
|
"Content-Length": String(bytes.byteLength),
|
|
@@ -73122,7 +73270,7 @@ var STRIP_UPSTREAM_HEADERS = /* @__PURE__ */ new Set([
|
|
|
73122
73270
|
]);
|
|
73123
73271
|
function rejectUpgrade(socket, status, message, headers = {}) {
|
|
73124
73272
|
try {
|
|
73125
|
-
const extraHeaders = Object.entries(headers).map(([
|
|
73273
|
+
const extraHeaders = Object.entries(headers).map(([name3, value]) => `${name3}: ${value}\r
|
|
73126
73274
|
`).join("");
|
|
73127
73275
|
socket.write(
|
|
73128
73276
|
`HTTP/1.1 ${status} ${message}\r
|
|
@@ -74389,7 +74537,7 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
|
|
|
74389
74537
|
// no traversal surface to defend: a name that is not a plain basename is
|
|
74390
74538
|
// rejected outright. range support is not optional here — chrome asks for
|
|
74391
74539
|
// byte ranges on media and cannot seek or loop a fixture without it.
|
|
74392
|
-
handleCameraFixture(
|
|
74540
|
+
handleCameraFixture(name3, req, res) {
|
|
74393
74541
|
const method = (req.method || "GET").toUpperCase();
|
|
74394
74542
|
const cors = {
|
|
74395
74543
|
"Access-Control-Allow-Origin": "*",
|
|
@@ -74409,13 +74557,13 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
|
|
|
74409
74557
|
res.end();
|
|
74410
74558
|
return;
|
|
74411
74559
|
}
|
|
74412
|
-
if (!CAMERA_FIXTURE_NAME_RE.test(
|
|
74560
|
+
if (!CAMERA_FIXTURE_NAME_RE.test(name3)) {
|
|
74413
74561
|
res.writeHead(400, { ...cors, "Content-Type": "text/plain; charset=utf-8" });
|
|
74414
74562
|
res.end("bad fixture name");
|
|
74415
74563
|
return;
|
|
74416
74564
|
}
|
|
74417
74565
|
const root = cameraFixturesDir();
|
|
74418
|
-
const filePath = import_path2.default.join(root,
|
|
74566
|
+
const filePath = import_path2.default.join(root, name3);
|
|
74419
74567
|
let stats;
|
|
74420
74568
|
try {
|
|
74421
74569
|
stats = import_fs2.default.lstatSync(filePath);
|
|
@@ -74575,7 +74723,19 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
|
|
|
74575
74723
|
* non-upgrade routes that don't match serve index.html (SPA behavior) so
|
|
74576
74724
|
* electron's webContents can navigate freely inside the runtime. */
|
|
74577
74725
|
handleHttpRequest(req, res) {
|
|
74578
|
-
|
|
74726
|
+
const method = (req.method || "GET").toUpperCase();
|
|
74727
|
+
let url;
|
|
74728
|
+
try {
|
|
74729
|
+
url = new URL(req.url || "/", `http://${req.headers.host || "localhost"}`);
|
|
74730
|
+
} catch {
|
|
74731
|
+
res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
|
|
74732
|
+
res.end("invalid request URL or host");
|
|
74733
|
+
return;
|
|
74734
|
+
}
|
|
74735
|
+
const publicEngineFont = (method === "GET" || method === "HEAD") && /^\/(?:runtime\/|sootsim\/)?engine\/fonts\/[^\\]*\.(ttf|otf|woff2?)$/.test(
|
|
74736
|
+
url.pathname
|
|
74737
|
+
);
|
|
74738
|
+
if (!publicEngineFont && rejectUntrustedBridgeOrigin(req, res)) return;
|
|
74579
74739
|
if (req.url === "/__peach/fetch-transport") {
|
|
74580
74740
|
res.writeHead(200, {
|
|
74581
74741
|
"Content-Type": "application/json",
|
|
@@ -74630,15 +74790,6 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
|
|
|
74630
74790
|
void handleReplacementModuleRequest(req, res);
|
|
74631
74791
|
return;
|
|
74632
74792
|
}
|
|
74633
|
-
const method = (req.method || "GET").toUpperCase();
|
|
74634
|
-
let url;
|
|
74635
|
-
try {
|
|
74636
|
-
url = new URL(req.url || "/", `http://${req.headers.host || "localhost"}`);
|
|
74637
|
-
} catch {
|
|
74638
|
-
res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
|
|
74639
|
-
res.end("invalid request URL or host");
|
|
74640
|
-
return;
|
|
74641
|
-
}
|
|
74642
74793
|
if (url.pathname === "/__sootsim/shared-config") {
|
|
74643
74794
|
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
74644
74795
|
res.setHeader("Access-Control-Allow-Headers", "Content-Type");
|
|
@@ -74899,7 +75050,9 @@ var SootSimBridgeHost = class _SootSimBridgeHost {
|
|
|
74899
75050
|
const contentType2 = HTTP_MIME_TYPES[ext] || "application/octet-stream";
|
|
74900
75051
|
res.writeHead(200, {
|
|
74901
75052
|
"Content-Type": contentType2,
|
|
74902
|
-
"Cache-Control": "no-store"
|
|
75053
|
+
"Cache-Control": "no-store",
|
|
75054
|
+
// native file documents have an opaque origin when reading public fonts.
|
|
75055
|
+
...publicEngineFont ? { "Access-Control-Allow-Origin": "*" } : {}
|
|
74903
75056
|
});
|
|
74904
75057
|
if (method === "HEAD") {
|
|
74905
75058
|
res.end();
|