peachsim 0.1.1620 → 0.1.1635
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/LICENSE +1 -1
- package/README.md +45 -6
- package/cli/app-config.ts +4 -1
- package/cli/app-fonts.ts +39 -18
- package/cli/app-stubs.ts +224 -9
- package/cli/bridge-flow-runner.ts +248 -156
- package/cli/cloud-client.ts +68 -57
- package/cli/command-registry.ts +1 -0
- package/cli/commands/box/search-command.ts +3 -2
- package/cli/commands/box.ts +10 -29
- package/cli/commands/control.ts +391 -92
- package/cli/commands/doctor.ts +17 -184
- package/cli/commands/flow.ts +79 -11
- package/cli/commands/inspect/core.ts +10 -5
- package/cli/commands/inspect/settling.ts +71 -22
- package/cli/commands/inspect/wait-ready.ts +12 -0
- package/cli/commands/inspect.ts +26 -3
- package/cli/commands/install-desktop.ts +1 -0
- package/cli/commands/maestro-compare.ts +105 -67
- package/cli/commands/maestro.ts +9 -1
- package/cli/commands/platform.ts +71 -36
- package/cli/commands/record.ts +21 -1
- package/cli/commands/screenshot.ts +23 -1
- package/cli/commands/serve.ts +7 -2
- package/cli/commands/setup.ts +19 -42
- package/cli/commands/swift.ts +5 -0
- package/cli/commands/upload.ts +51 -8
- package/cli/desktop-companion.ts +102 -17
- package/cli/dev-build-freshness.ts +37 -2
- package/cli/drivers/desktop.ts +14 -1
- package/cli/drivers/playwright-sim-host.ts +44 -8
- package/cli/drivers/playwright.ts +9 -8
- package/cli/drivers/types.ts +5 -0
- package/cli/maestro-accessibility.ts +53 -0
- package/cli/maestro-compare.ts +108 -12
- package/cli/main.ts +2 -1
- package/cli/outbound-endpoints.ts +35 -6
- package/cli/parent-pid.ts +0 -9
- package/cli/pause-aware-timeout.ts +102 -0
- package/cli/remote-simulators.ts +112 -0
- package/cli/remoteSimulatorContract.ts +21 -0
- package/cli/scene-video.ts +89 -0
- package/cli/ws-bridge.ts +23 -14
- package/detox/attempt-events.cjs +4 -0
- package/detox/expectations.ts +5 -1
- package/detox/index.ts +241 -181
- package/detox/motion-change.cjs +73 -0
- package/detox/motion-change.d.cts +21 -0
- package/detox/navigation-lifecycle.ts +22 -4
- package/dist-lib/agent-daemon-client.cjs +3 -2
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +3 -2
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +13 -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 +14 -8
- package/dist-lib/bridge-contract.mjs +13 -7
- package/dist-lib/bundle-channel.cjs +10480 -7962
- 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 +3 -2
- package/dist-lib/cloud.mjs +3 -2
- package/dist-lib/config.cjs +10 -6
- package/dist-lib/config.mjs +10 -6
- package/dist-lib/detox/index.cjs +1854 -966
- package/dist-lib/dev-bundle-resolution.cjs +64 -24
- package/dist-lib/expo-swift-bundle.cjs +8715 -6271
- package/dist-lib/expo-swift-metadata.cjs +7 -4
- package/dist-lib/expo-swift-metadata.mjs +7 -4
- package/dist-lib/home-paths.cjs +32 -3
- package/dist-lib/host/bridge-host.cjs +10135 -7060
- 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 +1843 -408
- 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 +3 -2
- package/dist-lib/menu.mjs +3 -2
- 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 +5 -4
- package/dist-lib/metro-production-bundle.mjs +5 -4
- package/dist-lib/metro.cjs +1182 -418
- package/dist-lib/native-app-identity-project.cjs +782 -23
- package/dist-lib/native-app-identity-project.mjs +781 -23
- package/dist-lib/native-app-identity.cjs +276 -9
- package/dist-lib/native-app-identity.mjs +273 -8
- package/dist-lib/native-firebase-metadata.cjs +5 -4
- package/dist-lib/native-firebase-metadata.mjs +5 -4
- 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 +3 -2
- package/dist-lib/react-native-host-modules.cjs +8 -1
- package/dist-lib/react-native-host-modules.mjs +8 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +106 -28
- package/dist-lib/sdk.cjs +115 -34
- package/dist-lib/sdk.mjs +115 -33
- package/dist-lib/skills.cjs +15274 -9904
- package/dist-lib/swift-compile.cjs +1165 -173
- package/dist-lib/swift-compile.mjs +1212 -203
- package/dist-lib/swift-package.cjs +12 -3
- package/dist-lib/swift-package.mjs +12 -3
- package/dist-lib/swift-submit.cjs +7 -1
- package/dist-lib/swift-submit.mjs +5 -1
- package/dist-lib/swift-toolchain.cjs +133 -18
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +2648 -862
- package/dist-lib/vite.cjs +70 -14
- package/dist-lib/worklet-executable.cjs +25 -2
- package/dist-lib/worklet-executable.mjs +25 -2
- package/kotlin/AppSources/dev/peach/app/PeachDrawable.kt +21 -14
- package/kotlin/Sources/androidx/annotation/DrawableRes.kt +14 -0
- package/package.json +2 -2
- package/scripts/dev-server-scanner.ts +35 -14
- package/skills/peach-perf/SKILL.md +11 -5
- package/skills/peach-setup/SKILL.md +16 -19
- package/src/admitted-mac-build.ts +34 -8
- package/src/android-app-identity.ts +146 -0
- package/src/android-autolinking.ts +75 -0
- package/src/android-string-value.ts +36 -0
- package/src/android-strings.ts +5 -36
- package/src/androidAutolinkingContract.ts +40 -0
- package/src/bridge-constants.ts +11 -0
- package/src/bridge-contract.ts +22 -34
- package/src/bundleGlobalFooter.ts +26 -7
- package/src/codex-client.ts +3 -2
- package/src/config.ts +15 -0
- package/src/desktop-host-delivery.ts +5 -1
- package/src/dev-bundle-resolution.ts +60 -26
- package/src/expo-kotlin-host.ts +6 -36
- package/src/expo-manifest-body.ts +13 -0
- package/src/expo-swift-bundle.ts +17 -12
- package/src/expo-swift-host.ts +640 -192
- package/src/expo-swift-ready.ts +78 -0
- package/src/expoSwiftContract.ts +19 -0
- package/src/home-paths.ts +48 -2
- package/src/host/bridge-host.ts +12 -57
- package/src/host/staged-host-files.ts +29 -2
- package/src/installed-package-versions.ts +54 -14
- package/src/launchMetadataContract.ts +24 -0
- package/src/metro-plugin.ts +37 -42
- package/src/native-app-identity-project.ts +142 -5
- package/src/native-app-identity.ts +176 -11
- package/src/native-firebase-config.ts +209 -13
- package/src/nitro-compile.ts +2 -5
- package/src/nitro-source.ts +147 -63
- package/src/process-group.ts +114 -61
- package/src/process-output.ts +0 -9
- package/src/public-brand.ts +1 -0
- package/src/react-native-bridge-modules.ts +416 -0
- package/src/react-native-host-modules.ts +7 -0
- package/src/sim-client.ts +6 -4
- package/src/swift-binary-modules.ts +2 -2
- package/src/swift-compile.ts +1007 -108
- package/src/swift-compiler-digest.ts +14 -0
- package/src/swift-distribution.lock.json +40 -12
- package/src/swift-distribution.ts +61 -9
- package/src/swift-host.ts +149 -56
- package/src/swift-icu.ts +14 -6
- package/src/swift-objc-sdk.ts +133 -10
- package/src/swift-objc-standin.ts +38 -3
- package/src/swift-package-manifest.ts +21 -6
- package/src/swift-package.ts +15 -1
- package/src/swift-packages.ts +119 -60
- package/src/swift-standin-emit.ts +57 -9
- package/src/swift-standins.ts +185 -25
- package/src/swift-submit.ts +10 -0
- package/src/swift-toolchain.ts +149 -23
- package/src/vite-plugin.ts +20 -20
- package/src/worklet-executable.ts +30 -3
- package/src/worklets-babel.ts +35 -14
- package/src/xcode-project.ts +10 -0
|
@@ -1,37 +1,134 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1635 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
|
|
3
3
|
// src/swift-compile.ts
|
|
4
|
-
import { spawn as spawn2, execFileSync } from "node:child_process";
|
|
5
|
-
import { createHash as
|
|
4
|
+
import { spawn as spawn2, execFileSync as execFileSync2 } from "node:child_process";
|
|
5
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
6
6
|
import {
|
|
7
7
|
cpSync,
|
|
8
8
|
existsSync as existsSync2,
|
|
9
9
|
mkdirSync,
|
|
10
10
|
mkdtempSync as mkdtempSync2,
|
|
11
|
-
readFileSync as
|
|
12
|
-
readdirSync,
|
|
11
|
+
readFileSync as readFileSync4,
|
|
12
|
+
readdirSync as readdirSync2,
|
|
13
13
|
realpathSync,
|
|
14
14
|
renameSync,
|
|
15
15
|
rmSync as rmSync2,
|
|
16
16
|
statSync,
|
|
17
17
|
writeFileSync as writeFileSync2
|
|
18
18
|
} from "node:fs";
|
|
19
|
-
import
|
|
20
|
-
import
|
|
19
|
+
import os2 from "node:os";
|
|
20
|
+
import path5 from "node:path";
|
|
21
21
|
|
|
22
22
|
// src/admitted-mac-build.ts
|
|
23
|
+
import { spawnSync } from "node:child_process";
|
|
24
|
+
function windowAdmission() {
|
|
25
|
+
const result = spawnSync("tm", ["window", "ancestor", "--json"], {
|
|
26
|
+
encoding: "utf8",
|
|
27
|
+
stdio: ["ignore", "pipe", "inherit"]
|
|
28
|
+
});
|
|
29
|
+
if (result.error) throw result.error;
|
|
30
|
+
if (result.status === 1) return null;
|
|
31
|
+
if (result.status !== 0) throw new Error(`tm window ancestor exited ${result.status}`);
|
|
32
|
+
const entry = JSON.parse(result.stdout);
|
|
33
|
+
if (entry.kind === "external")
|
|
34
|
+
return { kind: "external", name: entry.name ?? "", cores: null };
|
|
35
|
+
if (entry.kind !== "heavy" && entry.kind !== "quiet")
|
|
36
|
+
throw new Error(`tm window ancestor returned kind ${entry.kind}`);
|
|
37
|
+
return {
|
|
38
|
+
kind: entry.kind,
|
|
39
|
+
cores: entry.cores && entry.cores > 0 ? entry.cores : null,
|
|
40
|
+
scopes: entry.scopes ?? []
|
|
41
|
+
};
|
|
42
|
+
}
|
|
23
43
|
function admittedMacBuilderSlot(env = process.env) {
|
|
24
|
-
|
|
44
|
+
if (process.platform !== "darwin" || env.REMOTE_MAC_SLOT_HELD !== "1") return false;
|
|
45
|
+
return windowAdmission() !== null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// src/home-paths.ts
|
|
49
|
+
import { randomUUID } from "node:crypto";
|
|
50
|
+
import fs from "node:fs";
|
|
51
|
+
import { homedir } from "node:os";
|
|
52
|
+
import path from "node:path";
|
|
53
|
+
var PEACH_HOME_ENV = "PEACH_HOME";
|
|
54
|
+
function rnxHomeDir() {
|
|
55
|
+
const override = process.env[PEACH_HOME_ENV];
|
|
56
|
+
if (override && override.length > 0) return path.resolve(override);
|
|
57
|
+
return path.join(homedir(), ".peach");
|
|
58
|
+
}
|
|
59
|
+
function cacheDir() {
|
|
60
|
+
return path.join(rnxHomeDir(), "cache");
|
|
61
|
+
}
|
|
62
|
+
function swiftPackageCacheOptions() {
|
|
63
|
+
const root = path.join(cacheDir(), "swiftpm");
|
|
64
|
+
return ["cache", "config", "security"].flatMap((name) => [
|
|
65
|
+
`--${name}-path`,
|
|
66
|
+
path.join(root, name)
|
|
67
|
+
]);
|
|
25
68
|
}
|
|
69
|
+
var DAEMON_LOCKFILE_MAX_BYTES = 16 * 1024;
|
|
26
70
|
|
|
27
71
|
// src/process-group.ts
|
|
28
|
-
import { spawn, spawnSync } from "node:child_process";
|
|
29
|
-
import {
|
|
72
|
+
import { spawn, spawnSync as spawnSync2 } from "node:child_process";
|
|
73
|
+
import {
|
|
74
|
+
appendFileSync,
|
|
75
|
+
mkdtempSync,
|
|
76
|
+
readdirSync,
|
|
77
|
+
readFileSync,
|
|
78
|
+
rmSync,
|
|
79
|
+
writeFileSync
|
|
80
|
+
} from "node:fs";
|
|
30
81
|
import { tmpdir } from "node:os";
|
|
31
82
|
import { join } from "node:path";
|
|
32
83
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
33
84
|
var GRACEFUL_TIMEOUT_MS = 3e3;
|
|
34
85
|
var FORCED_EXIT_TIMEOUT_MS = 1e3;
|
|
86
|
+
var FREEZE_GUARD_NAME = "process-freeze-guard";
|
|
87
|
+
function listProcessChildren(parents, timeoutMs = 3e3) {
|
|
88
|
+
if (parents.some((pid) => !Number.isInteger(pid) || pid <= 1))
|
|
89
|
+
throw new Error("process inspection requires valid parent pids");
|
|
90
|
+
if (parents.length === 0) return [];
|
|
91
|
+
const deadline = Date.now() + timeoutMs;
|
|
92
|
+
let children;
|
|
93
|
+
if (process.platform === "linux") {
|
|
94
|
+
const lists = [];
|
|
95
|
+
for (const parent of parents) {
|
|
96
|
+
try {
|
|
97
|
+
const tasks = `/proc/${parent}/task`;
|
|
98
|
+
for (const thread of readdirSync(tasks)) {
|
|
99
|
+
if (Date.now() >= deadline)
|
|
100
|
+
throw new Error("process descendant inspection exceeded its deadline");
|
|
101
|
+
try {
|
|
102
|
+
lists.push(readFileSync(`${tasks}/${thread}/children`, "utf8"));
|
|
103
|
+
} catch (error) {
|
|
104
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT"))
|
|
105
|
+
throw error;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
} catch (error) {
|
|
109
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT"))
|
|
110
|
+
throw error;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
children = lists.join(" ");
|
|
114
|
+
} else {
|
|
115
|
+
const result = spawnSync2("pgrep", ["-P", parents.join(",")], {
|
|
116
|
+
encoding: "utf8",
|
|
117
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
118
|
+
timeout: Math.max(1, timeoutMs),
|
|
119
|
+
killSignal: "SIGKILL"
|
|
120
|
+
});
|
|
121
|
+
if (result.error || result.status !== 0 && result.status !== 1) {
|
|
122
|
+
throw new Error(
|
|
123
|
+
`could not inspect descendants of processes ${parents.join(",")}: ${result.error?.message || result.stderr.trim() || `pgrep exited ${result.status}`}`
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
children = result.stdout;
|
|
127
|
+
}
|
|
128
|
+
return [...new Set(children.trim().split(/\s+/).map(Number))].filter(
|
|
129
|
+
(pid) => Number.isInteger(pid) && pid > 1 && !parents.includes(pid)
|
|
130
|
+
);
|
|
131
|
+
}
|
|
35
132
|
function signalProcessGroup(child, signal) {
|
|
36
133
|
if (!child.pid) return;
|
|
37
134
|
try {
|
|
@@ -73,7 +170,7 @@ pid ${rootPid}
|
|
|
73
170
|
'
|
|
74
171
|
if ! IFS= read -r command || [ "$command" != disarm ]; then cleanup; fi
|
|
75
172
|
`,
|
|
76
|
-
|
|
173
|
+
FREEZE_GUARD_NAME,
|
|
77
174
|
journal
|
|
78
175
|
],
|
|
79
176
|
{
|
|
@@ -119,36 +216,50 @@ pid ${rootPid}
|
|
|
119
216
|
}
|
|
120
217
|
};
|
|
121
218
|
}
|
|
122
|
-
function
|
|
123
|
-
|
|
219
|
+
function withoutFreezeGuards(pids) {
|
|
220
|
+
if (pids.length === 0) return pids;
|
|
221
|
+
const result = spawnSync2("ps", ["-o", "pid=,command=", "-p", pids.join(",")], {
|
|
222
|
+
encoding: "utf8",
|
|
223
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
224
|
+
timeout: FORCED_EXIT_TIMEOUT_MS,
|
|
225
|
+
killSignal: "SIGKILL"
|
|
226
|
+
});
|
|
227
|
+
if (result.error || result.status !== 0 && result.status !== 1)
|
|
228
|
+
throw new Error(result.error?.message || `ps exited ${result.status}`);
|
|
229
|
+
const guards = new Set(
|
|
230
|
+
result.stdout.split("\n").filter((line) => line.includes(FREEZE_GUARD_NAME)).map((line) => Number(line.trim().split(/\s+/)[0]))
|
|
231
|
+
);
|
|
232
|
+
return pids.filter((pid) => !guards.has(pid));
|
|
233
|
+
}
|
|
234
|
+
function processesHaveExited(pids, pgid) {
|
|
235
|
+
const mayExist = [-pgid, ...pids].some((target) => {
|
|
124
236
|
try {
|
|
125
|
-
process.kill(
|
|
237
|
+
process.kill(target, 0);
|
|
126
238
|
return true;
|
|
127
239
|
} catch (error) {
|
|
128
|
-
return error instanceof Error && "code" in error && error.code === "
|
|
240
|
+
return !(error instanceof Error && "code" in error && error.code === "ESRCH");
|
|
129
241
|
}
|
|
130
242
|
});
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
try {
|
|
134
|
-
process.kill(-pgid, 0);
|
|
135
|
-
} catch (error) {
|
|
136
|
-
if (!(error instanceof Error && "code" in error && error.code === "EPERM"))
|
|
137
|
-
return true;
|
|
138
|
-
}
|
|
139
|
-
const result = spawnSync("ps", ["-A", "-o", "pgid=,stat="], {
|
|
243
|
+
if (!mayExist) return true;
|
|
244
|
+
const result = spawnSync2("ps", ["-A", "-o", "pid=,pgid=,stat="], {
|
|
140
245
|
encoding: "utf8",
|
|
141
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
246
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
247
|
+
timeout: FORCED_EXIT_TIMEOUT_MS,
|
|
248
|
+
killSignal: "SIGKILL"
|
|
142
249
|
});
|
|
143
250
|
if (result.error || result.status !== 0) return false;
|
|
251
|
+
const knownPids = new Set(pids);
|
|
144
252
|
return !result.stdout.split("\n").some((line) => {
|
|
145
|
-
const [group, state] = line.trim().split(/\s+/);
|
|
146
|
-
return Number(group) === pgid && state !== void 0 && !state.startsWith("Z");
|
|
253
|
+
const [pid, group, state] = line.trim().split(/\s+/);
|
|
254
|
+
return (Number(group) === pgid || knownPids.has(Number(pid))) && state !== void 0 && !state.startsWith("Z");
|
|
147
255
|
});
|
|
148
256
|
}
|
|
257
|
+
function groupIsEmpty(pgid) {
|
|
258
|
+
return processesHaveExited([], pgid);
|
|
259
|
+
}
|
|
149
260
|
async function waitForExit(pids, pgid, timeoutMs) {
|
|
150
261
|
const deadline = Date.now() + timeoutMs;
|
|
151
|
-
const gone = () =>
|
|
262
|
+
const gone = () => processesHaveExited(pids, pgid);
|
|
152
263
|
while (Date.now() < deadline) {
|
|
153
264
|
if (gone()) return true;
|
|
154
265
|
await sleep(50);
|
|
@@ -181,22 +292,16 @@ async function terminateProcessGroup(child, signal = "SIGTERM", gracefulTimeoutM
|
|
|
181
292
|
inspectionError = new Error("process descendant inspection exceeded its deadline");
|
|
182
293
|
break;
|
|
183
294
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
});
|
|
190
|
-
if (result.error || result.status !== 0 && result.status !== 1) {
|
|
191
|
-
inspectionError = new Error(
|
|
192
|
-
`could not inspect descendants of processes ${parents.join(",")}: ${result.error?.message || result.stderr.trim() || `pgrep exited ${result.status}`}`
|
|
193
|
-
);
|
|
295
|
+
let children;
|
|
296
|
+
try {
|
|
297
|
+
children = withoutFreezeGuards(listProcessChildren(parents, remaining));
|
|
298
|
+
} catch (error) {
|
|
299
|
+
inspectionError = new Error(`could not inspect descendants: ${String(error)}`);
|
|
194
300
|
break;
|
|
195
301
|
}
|
|
196
302
|
const next = [];
|
|
197
|
-
for (const
|
|
198
|
-
|
|
199
|
-
if (Number.isInteger(descendantPid) && descendantPid > 1 && !descendants.has(descendantPid)) {
|
|
303
|
+
for (const descendantPid of children) {
|
|
304
|
+
if (!descendants.has(descendantPid)) {
|
|
200
305
|
freeze.record(descendantPid);
|
|
201
306
|
descendants.add(descendantPid);
|
|
202
307
|
next.push(descendantPid);
|
|
@@ -277,6 +382,11 @@ async function terminateProcessGroup(child, signal = "SIGTERM", gracefulTimeoutM
|
|
|
277
382
|
if (inspectionError) throw inspectionError;
|
|
278
383
|
}
|
|
279
384
|
|
|
385
|
+
// src/swift-compiler-digest.ts
|
|
386
|
+
import { createHash } from "node:crypto";
|
|
387
|
+
import { readFileSync as readFileSync2 } from "node:fs";
|
|
388
|
+
import path2 from "node:path";
|
|
389
|
+
|
|
280
390
|
// src/swift-design-time.ts
|
|
281
391
|
var IDENT = /[A-Za-z_À-$0-9]/;
|
|
282
392
|
function tokenize(source) {
|
|
@@ -623,9 +733,9 @@ var EXCERPT = /^(\s*)(\d+)( \| )(.*)$/;
|
|
|
623
733
|
var MARKER = /^(\s*)( \| )(.*)$/;
|
|
624
734
|
function designTimeDiagnostic(output, files) {
|
|
625
735
|
const rewritten = /* @__PURE__ */ new Map();
|
|
626
|
-
const linesOf = (
|
|
736
|
+
const linesOf = (path6) => {
|
|
627
737
|
const file = Object.keys(files).find(
|
|
628
|
-
(name) => name.endsWith(".swift") && (
|
|
738
|
+
(name) => name.endsWith(".swift") && (path6 === name || path6.endsWith(`/${name}`))
|
|
629
739
|
);
|
|
630
740
|
if (file === void 0) return null;
|
|
631
741
|
let lines = rewritten.get(file);
|
|
@@ -706,11 +816,24 @@ function parseSwiftDistributionManifest(value) {
|
|
|
706
816
|
|
|
707
817
|
// src/swift-icu.ts
|
|
708
818
|
import { execFile } from "node:child_process";
|
|
709
|
-
import { createHash } from "node:crypto";
|
|
710
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
711
|
-
import
|
|
819
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
820
|
+
import { existsSync, readFileSync as readFileSync3 } from "node:fs";
|
|
821
|
+
import path4 from "node:path";
|
|
712
822
|
import { promisify } from "node:util";
|
|
713
823
|
import { gzip } from "node:zlib";
|
|
824
|
+
|
|
825
|
+
// src/swift-toolchain.ts
|
|
826
|
+
import { execFileSync } from "node:child_process";
|
|
827
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
828
|
+
import fs2 from "node:fs";
|
|
829
|
+
import os from "node:os";
|
|
830
|
+
import path3 from "node:path";
|
|
831
|
+
function swiftSdkOptions() {
|
|
832
|
+
const directory = process.env.PEACH_SWIFT_SDKS_PATH;
|
|
833
|
+
return directory ? ["--swift-sdks-path", path3.resolve(directory)] : [];
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
// src/swift-icu.ts
|
|
714
837
|
var run = promisify(execFile);
|
|
715
838
|
var deflate = promisify(gzip);
|
|
716
839
|
var ARCHIVE = "wasi/lib_FoundationICU.a";
|
|
@@ -727,24 +850,33 @@ function memo(cache, key, load2) {
|
|
|
727
850
|
return pending;
|
|
728
851
|
}
|
|
729
852
|
function swiftIcuData(toolchainBin, sdk) {
|
|
730
|
-
return memo(
|
|
853
|
+
return memo(
|
|
854
|
+
raw,
|
|
855
|
+
JSON.stringify([toolchainBin, sdk, swiftSdkOptions()]),
|
|
856
|
+
() => load(toolchainBin, sdk)
|
|
857
|
+
);
|
|
731
858
|
}
|
|
732
859
|
function swiftIcuAsset(toolchainBin, sdk) {
|
|
733
|
-
return memo(
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
860
|
+
return memo(
|
|
861
|
+
assets,
|
|
862
|
+
JSON.stringify([toolchainBin, sdk, swiftSdkOptions()]),
|
|
863
|
+
async () => {
|
|
864
|
+
const zipped = await deflate(await swiftIcuData(toolchainBin, sdk));
|
|
865
|
+
return { sha256: createHash3("sha256").update(zipped).digest("hex"), gzip: zipped };
|
|
866
|
+
}
|
|
867
|
+
);
|
|
737
868
|
}
|
|
738
869
|
async function load(toolchainBin, sdk) {
|
|
739
|
-
const swift =
|
|
870
|
+
const swift = path4.join(toolchainBin, "swift");
|
|
740
871
|
if (!existsSync(swift))
|
|
741
872
|
throw new Error(`swift-icu: no swift at ${swift} for the ${sdk} SDK's icu data`);
|
|
742
|
-
const { stdout: listed } = await run(swift, ["sdk", "list"]);
|
|
873
|
+
const { stdout: listed } = await run(swift, ["sdk", "list", ...swiftSdkOptions()]);
|
|
743
874
|
if (!listed.split("\n").some((line) => line.trim() === sdk))
|
|
744
875
|
throw new Error(`swift-icu: ${sdk} is not installed for ${swift}`);
|
|
745
876
|
const { stdout } = await run(swift, [
|
|
746
877
|
"sdk",
|
|
747
878
|
"configure",
|
|
879
|
+
...swiftSdkOptions(),
|
|
748
880
|
"--show-configuration",
|
|
749
881
|
sdk,
|
|
750
882
|
"wasm32-unknown-wasip1"
|
|
@@ -752,7 +884,7 @@ async function load(toolchainBin, sdk) {
|
|
|
752
884
|
const resources = /^swiftStaticResourcesPath: (.+)$/m.exec(stdout)?.[1]?.trim();
|
|
753
885
|
if (!resources) throw new Error(`swift-icu: ${sdk} names no static resources`);
|
|
754
886
|
return Buffer.from(
|
|
755
|
-
icuSegment(archiveMember(
|
|
887
|
+
icuSegment(archiveMember(readFileSync3(path4.join(resources, ARCHIVE)), MEMBER))
|
|
756
888
|
);
|
|
757
889
|
}
|
|
758
890
|
function archiveMember(archive, name) {
|
|
@@ -908,7 +1040,11 @@ function swiftTargetModuleName(name) {
|
|
|
908
1040
|
function swiftManifestTargets(manifest, resourcePaths = []) {
|
|
909
1041
|
const implicitResources = swiftImplicitResourcePaths(resourcePaths);
|
|
910
1042
|
const targets = [];
|
|
911
|
-
const declarations = manifestCalls(manifest, [
|
|
1043
|
+
const declarations = manifestCalls(manifest, [
|
|
1044
|
+
"executableTarget",
|
|
1045
|
+
"target",
|
|
1046
|
+
"systemLibrary"
|
|
1047
|
+
]);
|
|
912
1048
|
const targetNames = new Set(
|
|
913
1049
|
declarations.flatMap(({ flat }) => {
|
|
914
1050
|
const name = /\bname\s*:\s*"([^"]+)"/.exec(flat)?.[1];
|
|
@@ -931,6 +1067,9 @@ function swiftManifestTargets(manifest, resourcePaths = []) {
|
|
|
931
1067
|
const defines = [
|
|
932
1068
|
...call.matchAll(/\.define\(\s*"([A-Za-z_][A-Za-z0-9_]*)"\s*\)/g)
|
|
933
1069
|
].map((match) => match[1]);
|
|
1070
|
+
const linkedLibraries = [...call.matchAll(/\.linkedLibrary\(\s*"([^"]+)"\s*\)/g)].map(
|
|
1071
|
+
(match) => match[1]
|
|
1072
|
+
);
|
|
934
1073
|
const excluded = [
|
|
935
1074
|
...(/\bexclude\s*:\s*\[([^\]]*)\]/.exec(flat)?.[1] ?? "").matchAll(/"([^"]+)"/g)
|
|
936
1075
|
].map((match) => match[1].replace(/^\.\//, "").replace(/\/+$/, ""));
|
|
@@ -965,10 +1104,12 @@ function swiftManifestTargets(manifest, resourcePaths = []) {
|
|
|
965
1104
|
name,
|
|
966
1105
|
path: targetPath,
|
|
967
1106
|
executable,
|
|
1107
|
+
...kind === "systemLibrary" ? { systemLibrary: true } : {},
|
|
968
1108
|
languageMode,
|
|
969
1109
|
mainActorIsolation,
|
|
970
1110
|
...cxxInterop ? { cxxInterop: true } : {},
|
|
971
1111
|
...defines.length === 0 ? {} : { defines },
|
|
1112
|
+
...linkedLibraries.length === 0 ? {} : { linkedLibraries },
|
|
972
1113
|
resources,
|
|
973
1114
|
...dependencies.length === 0 ? {} : { dependencies },
|
|
974
1115
|
...excluded.length === 0 ? {} : { exclude: excluded }
|
|
@@ -984,7 +1125,7 @@ function swiftManifestCxxLanguageStandard(manifest) {
|
|
|
984
1125
|
}
|
|
985
1126
|
function swiftPackagePartition(manifest, resourcePaths = []) {
|
|
986
1127
|
const targets = swiftManifestTargets(manifest, resourcePaths);
|
|
987
|
-
return targets.length === 1 && targets[0].executable && targets[0].path === "." && targets[0].languageMode === 5 && !targets[0].mainActorIsolation && !targets[0].defines?.length && !targets[0].cxxInterop && !swiftManifestCxxLanguageStandard(manifest) ? [] : targets;
|
|
1128
|
+
return targets.length === 1 && targets[0].executable && targets[0].path === "." && targets[0].languageMode === 5 && !targets[0].mainActorIsolation && !targets[0].defines?.length && !targets[0].linkedLibraries?.length && !targets[0].cxxInterop && !swiftManifestCxxLanguageStandard(manifest) ? [] : targets;
|
|
988
1129
|
}
|
|
989
1130
|
|
|
990
1131
|
// src/swiftContract.ts
|
|
@@ -1069,15 +1210,15 @@ async function runCompiler(command, args, options, stream = false) {
|
|
|
1069
1210
|
}
|
|
1070
1211
|
var WASM_TRIPLE = "wasm32-unknown-wasip1";
|
|
1071
1212
|
var BUILD_JOBS = String(
|
|
1072
|
-
Math.min(4, Math.max(1, Math.floor(
|
|
1213
|
+
Math.min(4, Math.max(1, Math.floor(os2.availableParallelism() / 2)))
|
|
1073
1214
|
);
|
|
1074
1215
|
function swiftDistributionAt(root) {
|
|
1075
|
-
const file =
|
|
1216
|
+
const file = path5.join(root, SWIFT_DISTRIBUTION_MANIFEST);
|
|
1076
1217
|
if (!existsSync2(file)) return null;
|
|
1077
|
-
return parseSwiftDistributionManifest(JSON.parse(
|
|
1218
|
+
return parseSwiftDistributionManifest(JSON.parse(readFileSync4(file, "utf8")));
|
|
1078
1219
|
}
|
|
1079
1220
|
function swiftModuleSdk(root) {
|
|
1080
|
-
const pin = swiftDistributionAt(root) ?? JSON.parse(
|
|
1221
|
+
const pin = swiftDistributionAt(root) ?? JSON.parse(readFileSync4(path5.join(root, "toolchain.json"), "utf8"));
|
|
1081
1222
|
if (!pin || typeof pin !== "object" || typeof Reflect.get(pin, "wasmSdkId") !== "string" || typeof Reflect.get(pin, "wasmSdkUrl") !== "string" || typeof Reflect.get(pin, "wasmSdkChecksum") !== "string")
|
|
1082
1223
|
throw new Error(`${root} pins no wasm SDK id, url and checksum`);
|
|
1083
1224
|
return {
|
|
@@ -1099,7 +1240,7 @@ function swiftModuleInputFiles(root) {
|
|
|
1099
1240
|
"toolchain.json"
|
|
1100
1241
|
];
|
|
1101
1242
|
const walk = (dir) => {
|
|
1102
|
-
for (const entry of
|
|
1243
|
+
for (const entry of readdirSync2(path5.join(root, dir), {
|
|
1103
1244
|
withFileTypes: true
|
|
1104
1245
|
})) {
|
|
1105
1246
|
const relative = `${dir}/${entry.name}`;
|
|
@@ -1117,28 +1258,28 @@ function swiftMacroPlugins(moduleRoot) {
|
|
|
1117
1258
|
const distribution = swiftDistributionAt(moduleRoot);
|
|
1118
1259
|
if (distribution)
|
|
1119
1260
|
return {
|
|
1120
|
-
libraries: distribution.plugins.map((plugin) =>
|
|
1261
|
+
libraries: distribution.plugins.map((plugin) => path5.join(moduleRoot, plugin)),
|
|
1121
1262
|
stale: false
|
|
1122
1263
|
};
|
|
1123
|
-
const dir =
|
|
1264
|
+
const dir = path5.join(moduleRoot, ".build/host/RnxPreviewMacros");
|
|
1124
1265
|
const release = JSON.parse(
|
|
1125
|
-
|
|
1266
|
+
readFileSync4(path5.join(moduleRoot, "toolchain.json"), "utf8")
|
|
1126
1267
|
).release;
|
|
1127
|
-
const compilerStamp =
|
|
1268
|
+
const compilerStamp = path5.join(dir, "compiler-release");
|
|
1128
1269
|
const ext = process.platform === "darwin" ? "dylib" : "so";
|
|
1129
1270
|
const plugins = [
|
|
1130
1271
|
{
|
|
1131
|
-
library:
|
|
1132
|
-
source:
|
|
1272
|
+
library: path5.join(dir, `libRnxPreviewMacros.${ext}`),
|
|
1273
|
+
source: path5.join(moduleRoot, "Sources/RnxPreviewMacros/PreviewMacro.swift")
|
|
1133
1274
|
},
|
|
1134
1275
|
{
|
|
1135
|
-
library:
|
|
1136
|
-
source:
|
|
1276
|
+
library: path5.join(dir, `libFoundationMacros.${ext}`),
|
|
1277
|
+
source: path5.join(moduleRoot, "Sources/FoundationMacros/PredicateMacro.swift")
|
|
1137
1278
|
}
|
|
1138
1279
|
];
|
|
1139
1280
|
return {
|
|
1140
1281
|
libraries: plugins.map(({ library }) => library),
|
|
1141
|
-
stale: !existsSync2(compilerStamp) ||
|
|
1282
|
+
stale: !existsSync2(compilerStamp) || readFileSync4(compilerStamp, "utf8").trim() !== release || plugins.some(
|
|
1142
1283
|
({ library, source }) => !existsSync2(library) || statSync(source).mtimeMs > statSync(library).mtimeMs
|
|
1143
1284
|
)
|
|
1144
1285
|
};
|
|
@@ -1149,14 +1290,14 @@ async function ensureMacroPlugins(moduleRoot, toolchainBin, release, signal) {
|
|
|
1149
1290
|
await runCompiler(
|
|
1150
1291
|
"sh",
|
|
1151
1292
|
[
|
|
1152
|
-
|
|
1293
|
+
path5.join(moduleRoot, "scripts/build-preview-plugin.sh"),
|
|
1153
1294
|
toolchainBin,
|
|
1154
1295
|
libraries[0]
|
|
1155
1296
|
],
|
|
1156
1297
|
{ signal }
|
|
1157
1298
|
);
|
|
1158
1299
|
writeFileSync2(
|
|
1159
|
-
|
|
1300
|
+
path5.join(path5.dirname(libraries[0]), "compiler-release"),
|
|
1160
1301
|
`${release}
|
|
1161
1302
|
`
|
|
1162
1303
|
);
|
|
@@ -1170,9 +1311,9 @@ function clearLinkedModuleDigests(root) {
|
|
|
1170
1311
|
}
|
|
1171
1312
|
function swiftModuleDigest(root) {
|
|
1172
1313
|
const files = swiftModuleInputFiles(root);
|
|
1173
|
-
const stampHash =
|
|
1314
|
+
const stampHash = createHash4("sha256");
|
|
1174
1315
|
for (const file of files) {
|
|
1175
|
-
const stat = statSync(
|
|
1316
|
+
const stat = statSync(path5.join(root, file), { bigint: true });
|
|
1176
1317
|
stampHash.update(file);
|
|
1177
1318
|
stampHash.update(
|
|
1178
1319
|
`${stat.dev}:${stat.ino}:${stat.size}:${stat.mtimeNs}:${stat.ctimeNs}
|
|
@@ -1182,11 +1323,11 @@ function swiftModuleDigest(root) {
|
|
|
1182
1323
|
const stamp = stampHash.digest("hex");
|
|
1183
1324
|
const cached = linkedModuleDigests.get(root);
|
|
1184
1325
|
if (cached?.stamp === stamp) return cached.digest;
|
|
1185
|
-
const hash =
|
|
1326
|
+
const hash = createHash4("sha256");
|
|
1186
1327
|
for (const file of files) {
|
|
1187
|
-
hash.update(
|
|
1328
|
+
hash.update(createHash4("sha256").update(file).digest());
|
|
1188
1329
|
hash.update(
|
|
1189
|
-
|
|
1330
|
+
createHash4("sha256").update(readFileSync4(path5.join(root, file))).digest()
|
|
1190
1331
|
);
|
|
1191
1332
|
}
|
|
1192
1333
|
const digest = hash.digest();
|
|
@@ -1207,7 +1348,7 @@ function withNativeSourceGlue(input, glue) {
|
|
|
1207
1348
|
...input,
|
|
1208
1349
|
files: {
|
|
1209
1350
|
...input.files,
|
|
1210
|
-
[
|
|
1351
|
+
[path5.posix.join(targetPath, "OneNativeSource.generated.swift")]: glue
|
|
1211
1352
|
},
|
|
1212
1353
|
oneModule: true
|
|
1213
1354
|
};
|
|
@@ -1215,7 +1356,8 @@ function withNativeSourceGlue(input, glue) {
|
|
|
1215
1356
|
var OPTIONAL_FRAMEWORK_DEPENDENCIES = {
|
|
1216
1357
|
GameplayKit: [],
|
|
1217
1358
|
simd: [],
|
|
1218
|
-
|
|
1359
|
+
ModelIO: ["simd"],
|
|
1360
|
+
GLKit: ["ModelIO"],
|
|
1219
1361
|
Accelerate: [],
|
|
1220
1362
|
CryptoKit: [],
|
|
1221
1363
|
CommonCrypto: [],
|
|
@@ -1229,7 +1371,7 @@ var OPTIONAL_FRAMEWORK_DEPENDENCIES = {
|
|
|
1229
1371
|
Statsig: [],
|
|
1230
1372
|
TOCropViewController: [],
|
|
1231
1373
|
RiveRuntime: ["MetalKit"],
|
|
1232
|
-
MetalKit: [],
|
|
1374
|
+
MetalKit: ["ModelIO"],
|
|
1233
1375
|
DatadogCore: [],
|
|
1234
1376
|
DatadogLogs: ["DatadogCore"],
|
|
1235
1377
|
DatadogRUM: ["DatadogCore"],
|
|
@@ -1329,7 +1471,7 @@ function swiftImportNames(contents, available) {
|
|
|
1329
1471
|
function swiftPeachModules(moduleRoot) {
|
|
1330
1472
|
const distribution = swiftDistributionAt(moduleRoot);
|
|
1331
1473
|
return distribution ? distribution.modules : [
|
|
1332
|
-
...
|
|
1474
|
+
...readFileSync4(path5.join(moduleRoot, "Package.swift"), "utf8").matchAll(
|
|
1333
1475
|
/\.(?:target|systemLibrary)\(\s*name:\s*"([^"]+)"/g
|
|
1334
1476
|
)
|
|
1335
1477
|
].map((match) => match[1]);
|
|
@@ -1337,12 +1479,19 @@ function swiftPeachModules(moduleRoot) {
|
|
|
1337
1479
|
var sdkPaths = /* @__PURE__ */ new Map();
|
|
1338
1480
|
function swiftSdkPaths(moduleRoot, toolchainBin) {
|
|
1339
1481
|
const sdk = swiftModuleSdk(moduleRoot).wasmSdkId;
|
|
1340
|
-
const key =
|
|
1482
|
+
const key = JSON.stringify([toolchainBin, sdk, swiftSdkOptions()]);
|
|
1341
1483
|
const cached = sdkPaths.get(key);
|
|
1342
1484
|
if (cached) return cached;
|
|
1343
|
-
const configuration =
|
|
1344
|
-
|
|
1345
|
-
[
|
|
1485
|
+
const configuration = execFileSync2(
|
|
1486
|
+
path5.join(toolchainBin, "swift"),
|
|
1487
|
+
[
|
|
1488
|
+
"sdk",
|
|
1489
|
+
"configure",
|
|
1490
|
+
...swiftSdkOptions(),
|
|
1491
|
+
"--show-configuration",
|
|
1492
|
+
sdk,
|
|
1493
|
+
"wasm32-unknown-wasip1"
|
|
1494
|
+
],
|
|
1346
1495
|
{ encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }
|
|
1347
1496
|
);
|
|
1348
1497
|
const field = (name) => {
|
|
@@ -1360,19 +1509,19 @@ function swiftSdkPaths(moduleRoot, toolchainBin) {
|
|
|
1360
1509
|
var availableModules = /* @__PURE__ */ new Map();
|
|
1361
1510
|
function swiftAvailableModules(moduleRoot, toolchainBin) {
|
|
1362
1511
|
const sdk = swiftModuleSdk(moduleRoot).wasmSdkId;
|
|
1363
|
-
const key =
|
|
1512
|
+
const key = JSON.stringify([moduleRoot, sdk, swiftSdkOptions()]);
|
|
1364
1513
|
const cached = availableModules.get(key);
|
|
1365
1514
|
if (cached) return cached;
|
|
1366
1515
|
const modules = new Set(swiftPeachModules(moduleRoot));
|
|
1367
1516
|
const { resources } = swiftSdkPaths(moduleRoot, toolchainBin);
|
|
1368
|
-
for (const entry of
|
|
1517
|
+
for (const entry of readdirSync2(path5.join(resources, "wasi"))) {
|
|
1369
1518
|
if (entry.endsWith(".swiftmodule"))
|
|
1370
1519
|
modules.add(entry.slice(0, -".swiftmodule".length));
|
|
1371
1520
|
}
|
|
1372
|
-
for (const entry of
|
|
1373
|
-
const map =
|
|
1521
|
+
for (const entry of readdirSync2(resources)) {
|
|
1522
|
+
const map = path5.join(resources, entry, "module.modulemap");
|
|
1374
1523
|
if (!existsSync2(map)) continue;
|
|
1375
|
-
for (const match of
|
|
1524
|
+
for (const match of readFileSync4(map, "utf8").matchAll(/^module\s+([A-Za-z_]\w*)/gm))
|
|
1376
1525
|
modules.add(match[1]);
|
|
1377
1526
|
}
|
|
1378
1527
|
availableModules.set(key, modules);
|
|
@@ -1435,41 +1584,43 @@ var EXECUTABLE_LINK_FLAGS = ` "-Xclang-linker", "-O0",
|
|
|
1435
1584
|
"-Xlinker", "--global-base=8372224",
|
|
1436
1585
|
`;
|
|
1437
1586
|
var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
|
|
1438
|
-
var MULTI_MANIFEST_VERSION =
|
|
1587
|
+
var MULTI_MANIFEST_VERSION = 39;
|
|
1588
|
+
var compilerSourceDigest = true ? "fe15160b7f10d0c1ea06e54dc06a1de4d770f6f968e547bd41bd11fc6f5dbd8f" : swiftCompilerSourceDigest(import.meta.dirname);
|
|
1439
1589
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
1440
|
-
const hash =
|
|
1441
|
-
hash.update(`swift-compile
|
|
1590
|
+
const hash = createHash4("sha256");
|
|
1591
|
+
hash.update(`swift-compile
|
|
1442
1592
|
${release}
|
|
1443
1593
|
`);
|
|
1594
|
+
hash.update(compilerSourceDigest);
|
|
1444
1595
|
if (input.oneModule) hash.update("one-module\n");
|
|
1445
1596
|
hash.update(swiftModuleDigest(moduleRoot));
|
|
1446
1597
|
for (const file of Object.keys(input.files).sort()) {
|
|
1447
|
-
hash.update(
|
|
1448
|
-
hash.update(
|
|
1598
|
+
hash.update(createHash4("sha256").update(file).digest());
|
|
1599
|
+
hash.update(createHash4("sha256").update(input.files[file]).digest());
|
|
1449
1600
|
}
|
|
1450
1601
|
for (const file of Object.keys(input.metalSources ?? {}).sort()) {
|
|
1451
1602
|
hash.update("metal-source\n");
|
|
1452
|
-
hash.update(
|
|
1603
|
+
hash.update(createHash4("sha256").update(file).digest());
|
|
1453
1604
|
hash.update(
|
|
1454
|
-
|
|
1605
|
+
createHash4("sha256").update(input.metalSources?.[file] ?? "").digest()
|
|
1455
1606
|
);
|
|
1456
1607
|
}
|
|
1457
1608
|
for (const base of Object.keys(input.resources ?? {}).sort()) {
|
|
1458
|
-
hash.update(
|
|
1609
|
+
hash.update(createHash4("sha256").update(base).digest());
|
|
1459
1610
|
hash.update(
|
|
1460
|
-
|
|
1611
|
+
createHash4("sha256").update(input.resources?.[base] ?? "").digest()
|
|
1461
1612
|
);
|
|
1462
1613
|
}
|
|
1463
1614
|
for (const name of Object.keys(input.images ?? {}).sort()) {
|
|
1464
1615
|
const image = input.images?.[name];
|
|
1465
1616
|
if (!image) continue;
|
|
1466
|
-
hash.update(
|
|
1467
|
-
hash.update(
|
|
1468
|
-
hash.update(
|
|
1617
|
+
hash.update(createHash4("sha256").update(name).digest());
|
|
1618
|
+
hash.update(createHash4("sha256").update(image.file).digest());
|
|
1619
|
+
hash.update(createHash4("sha256").update(image.data).digest());
|
|
1469
1620
|
}
|
|
1470
1621
|
for (const file of [...new Set(input.resourcePaths ?? [])].sort()) {
|
|
1471
1622
|
hash.update("resource-path\n");
|
|
1472
|
-
hash.update(
|
|
1623
|
+
hash.update(createHash4("sha256").update(file).digest());
|
|
1473
1624
|
}
|
|
1474
1625
|
hash.update(
|
|
1475
1626
|
JSON.stringify(
|
|
@@ -1481,7 +1632,7 @@ ${release}
|
|
|
1481
1632
|
${target}
|
|
1482
1633
|
`);
|
|
1483
1634
|
hash.update(
|
|
1484
|
-
|
|
1635
|
+
createHash4("sha256").update(input.libraries?.[target] ?? "").digest()
|
|
1485
1636
|
);
|
|
1486
1637
|
}
|
|
1487
1638
|
const targets = compileTargets(input);
|
|
@@ -1501,14 +1652,18 @@ ${target}
|
|
|
1501
1652
|
}
|
|
1502
1653
|
function emitSwiftPackageManifest(args) {
|
|
1503
1654
|
const { targets, siblings, moduleRoot, oneModule, spriteKit, distribution } = args;
|
|
1504
|
-
const reachedFrameworks = new Set(
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1655
|
+
const reachedFrameworks = /* @__PURE__ */ new Set();
|
|
1656
|
+
const reach = (name) => {
|
|
1657
|
+
if (reachedFrameworks.has(name)) return;
|
|
1658
|
+
reachedFrameworks.add(name);
|
|
1659
|
+
for (const dependency of OPTIONAL_FRAMEWORK_DEPENDENCIES[name] ?? [])
|
|
1660
|
+
reach(dependency);
|
|
1661
|
+
};
|
|
1662
|
+
for (const name of [...siblings.values()].flat())
|
|
1663
|
+
if (OPTIONAL_FRAMEWORKS.has(name) && !targets.some((target) => target.name === name))
|
|
1664
|
+
reach(name);
|
|
1509
1665
|
if (spriteKit) {
|
|
1510
|
-
|
|
1511
|
-
reachedFrameworks.add("PeachBox2D");
|
|
1666
|
+
for (const name of ["SpriteKit", "PeachBox2D", "simd", "GLKit"]) reach(name);
|
|
1512
1667
|
}
|
|
1513
1668
|
const distributionLink = args.distributionLink;
|
|
1514
1669
|
if (distribution && !distributionLink)
|
|
@@ -1524,36 +1679,38 @@ function emitSwiftPackageManifest(args) {
|
|
|
1524
1679
|
distributionLink.files.set(
|
|
1525
1680
|
distributionLink.path,
|
|
1526
1681
|
objects.map(
|
|
1527
|
-
(object) => `"${
|
|
1682
|
+
(object) => `"${path5.join(moduleRoot, object).replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`
|
|
1528
1683
|
).join("\n") + "\n"
|
|
1529
1684
|
);
|
|
1530
1685
|
}
|
|
1531
|
-
const overlayRoot =
|
|
1686
|
+
const overlayRoot = path5.join(
|
|
1532
1687
|
moduleRoot,
|
|
1533
1688
|
distribution ? "modules" : "cross-import-overlays"
|
|
1534
1689
|
);
|
|
1535
|
-
const overlayFlags =
|
|
1690
|
+
const overlayFlags = readdirSync2(overlayRoot, { encoding: "utf8", recursive: true }).filter((file) => file.endsWith(".swiftoverlay")).sort((left, right) => left.localeCompare(right)).flatMap((file) => [
|
|
1536
1691
|
"-Xfrontend",
|
|
1537
1692
|
"-swift-module-cross-import",
|
|
1538
1693
|
"-Xfrontend",
|
|
1539
|
-
|
|
1694
|
+
path5.basename(path5.dirname(file), ".swiftcrossimport"),
|
|
1540
1695
|
"-Xfrontend",
|
|
1541
|
-
|
|
1696
|
+
path5.join(overlayRoot, file)
|
|
1542
1697
|
]).map((flag) => `, ${JSON.stringify(flag)}`).join("");
|
|
1543
1698
|
const executable = targets.find((target) => target.executable);
|
|
1544
1699
|
if (!executable) throw new Error("swift-compile: no executable target to emit");
|
|
1545
1700
|
const stanza = (target) => {
|
|
1701
|
+
if (target.systemLibrary)
|
|
1702
|
+
return ` .systemLibrary(name: ${JSON.stringify(target.name)}, path: ${JSON.stringify(target.path)}),`;
|
|
1546
1703
|
const isolation = target.mainActorIsolation ? " .defaultIsolation(MainActor.self)," : "";
|
|
1547
1704
|
const interoperability = target.cxxInterop ? " .interoperabilityMode(.Cxx)," : "";
|
|
1548
1705
|
const defines = (target.defines ?? []).map((name) => ` .define(${JSON.stringify(name)}),`).join("");
|
|
1549
|
-
const imports = distribution ? `, "-I", ${JSON.stringify(
|
|
1706
|
+
const imports = distribution ? `, "-I", ${JSON.stringify(path5.join(moduleRoot, "modules"))}` : "";
|
|
1550
1707
|
const native = args.native?.get(target.name);
|
|
1551
1708
|
const nativeImports = (siblings.get(target.name) ?? []).filter((name) => args.native?.has(name)).map(
|
|
1552
1709
|
(name) => `, "-Xfrontend", "-import-module", "-Xfrontend", ${JSON.stringify(swiftTargetModuleName(name))}`
|
|
1553
1710
|
).join("");
|
|
1554
1711
|
const header = args.headerDirectory && [...args.native?.values() ?? []].some(
|
|
1555
1712
|
(value) => value.late?.producers.includes(target.name)
|
|
1556
|
-
) ? `, "-emit-objc-header-path", ${JSON.stringify(
|
|
1713
|
+
) ? `, "-emit-objc-header-path", ${JSON.stringify(path5.join(args.headerDirectory, `${target.name}-Swift.h`))}` : "";
|
|
1557
1714
|
const swiftSettings = `swiftSettings: [.swiftLanguageMode(.v${target.languageMode}),${isolation}${interoperability}${defines} .unsafeFlags(["-Osize", "-Xfrontend", "-enable-cross-import-overlays"${overlayFlags}${FOUNDATION_IMPLICIT_FLAGS}${oneModule ? ONE_IMPLICIT_FLAGS : ""}${imports}${nativeImports}${header}])]`;
|
|
1558
1715
|
const deps = [
|
|
1559
1716
|
...target.executable ? [...args.native?.values() ?? []].flatMap(
|
|
@@ -1570,14 +1727,22 @@ function emitSwiftPackageManifest(args) {
|
|
|
1570
1727
|
].join(", ");
|
|
1571
1728
|
const library = distribution && distributionLink ? ["-Xlinker", `@${distributionLink.path}`, ...distribution.link].map((flag) => `, ${JSON.stringify(flag)}`).join("") : "";
|
|
1572
1729
|
const kind = target.executable ? ".executableTarget" : ".target";
|
|
1730
|
+
const linkedLibraries = (target.linkedLibraries ?? []).map(
|
|
1731
|
+
(name) => `.linkedLibrary(${JSON.stringify(name)})`
|
|
1732
|
+
);
|
|
1733
|
+
const librarySettings = [
|
|
1734
|
+
...linkedLibraries,
|
|
1735
|
+
...args.libraries?.has(target.name) ? [`.unsafeFlags([${JSON.stringify(args.libraries.get(target.name))}])`] : []
|
|
1736
|
+
];
|
|
1573
1737
|
const link = target.executable ? `,
|
|
1574
1738
|
linkerSettings: [
|
|
1739
|
+
${linkedLibraries.map((setting) => `${setting},`).join("\n ")}
|
|
1575
1740
|
.unsafeFlags([
|
|
1576
1741
|
${REACTOR_FLAG}${EXECUTABLE_LINK_FLAGS} "-Xlinker", "--export-if-defined=__main_argc_argv"${library},
|
|
1577
1742
|
]),
|
|
1578
1743
|
.unsafeFlags(["-Xlinker", "--strip-all"], .when(configuration: .release)),
|
|
1579
|
-
]` :
|
|
1580
|
-
linkerSettings: [
|
|
1744
|
+
]` : librarySettings.length > 0 ? `,
|
|
1745
|
+
linkerSettings: [${librarySettings.join(", ")}]` : "";
|
|
1581
1746
|
return [
|
|
1582
1747
|
` ${kind}(`,
|
|
1583
1748
|
` name: "${target.name}",`,
|
|
@@ -1620,8 +1785,8 @@ function emitSwiftPackageManifest(args) {
|
|
|
1620
1785
|
function syncSwiftTree(base, files) {
|
|
1621
1786
|
mkdirSync(base, { recursive: true });
|
|
1622
1787
|
const walk = (dir) => {
|
|
1623
|
-
for (const entry of
|
|
1624
|
-
const full =
|
|
1788
|
+
for (const entry of readdirSync2(dir, { withFileTypes: true })) {
|
|
1789
|
+
const full = path5.join(dir, entry.name);
|
|
1625
1790
|
if (dir === base && entry.name === ".build") continue;
|
|
1626
1791
|
if (entry.isDirectory()) walk(full);
|
|
1627
1792
|
else if (!files.has(full)) rmSync2(full, { force: true });
|
|
@@ -1629,14 +1794,14 @@ function syncSwiftTree(base, files) {
|
|
|
1629
1794
|
};
|
|
1630
1795
|
walk(base);
|
|
1631
1796
|
for (const [full, contents] of files) {
|
|
1632
|
-
if (existsSync2(full) && (typeof contents === "string" ?
|
|
1797
|
+
if (existsSync2(full) && (typeof contents === "string" ? readFileSync4(full, "utf8") === contents : readFileSync4(full).equals(contents)))
|
|
1633
1798
|
continue;
|
|
1634
|
-
mkdirSync(
|
|
1799
|
+
mkdirSync(path5.dirname(full), { recursive: true });
|
|
1635
1800
|
writeFileSync2(full, contents);
|
|
1636
1801
|
}
|
|
1637
1802
|
}
|
|
1638
1803
|
var DIRECTIVE = /^[ \t]*#(?:if|elseif)\b/;
|
|
1639
|
-
var OS_IOS = /\
|
|
1804
|
+
var OS_IOS = /\b(?:os\(\s*iOS\s*\)|targetEnvironment\(\s*simulator\s*\))/g;
|
|
1640
1805
|
var OBJC_ATTRIBUTE = /^@(?:objcMembers\b|objc\b(?:(\s*)\(([^()]*)\))?|IBAction\b)/;
|
|
1641
1806
|
var SELECTOR = /^#selector\b/;
|
|
1642
1807
|
var PROTOCOL_NAME = /^\s+[A-Za-z_]\w*(\s*:)?/;
|
|
@@ -2022,11 +2187,54 @@ function compiledSwiftSources(files, targets) {
|
|
|
2022
2187
|
const sources = lifted.map(([, contents]) => contents);
|
|
2023
2188
|
const extensions = objcExtensionMemberIndex(sources);
|
|
2024
2189
|
const objc = objcIndex(sources);
|
|
2190
|
+
const rooted = objcRootedClasses(sources);
|
|
2025
2191
|
for (const [file, contents] of lifted)
|
|
2026
|
-
compiled.set(
|
|
2192
|
+
compiled.set(
|
|
2193
|
+
file,
|
|
2194
|
+
hideObjCClassesFromCxx(swiftSourceAsIOS(contents, extensions, objc), rooted)
|
|
2195
|
+
);
|
|
2027
2196
|
}
|
|
2028
2197
|
return compiled;
|
|
2029
2198
|
}
|
|
2199
|
+
var APPLE_PROTOCOL = /^NS(?:Mutable)?Copying$|^NS(?:Secure)?Coding$|^NSLocking$|^NSFastEnumeration$|^NSObjectProtocol$|(?:Delegate|DataSource)$/;
|
|
2200
|
+
function objcRootedClasses(sources) {
|
|
2201
|
+
const bases = /* @__PURE__ */ new Map();
|
|
2202
|
+
for (const source of sources)
|
|
2203
|
+
for (const match of swiftCodeMask(source).matchAll(
|
|
2204
|
+
/\bclass\s+(?!(?:func|var|let|subscript)\b)([A-Za-z_]\w*)\s*(?:<[^>{]*>)?\s*:\s*(?:[A-Za-z_]\w*\.)*([A-Za-z_]\w*)/g
|
|
2205
|
+
))
|
|
2206
|
+
bases.set(match[1], match[2]);
|
|
2207
|
+
const rooted = /* @__PURE__ */ new Set();
|
|
2208
|
+
for (const name of bases.keys()) {
|
|
2209
|
+
const seen = /* @__PURE__ */ new Set([name]);
|
|
2210
|
+
let base = bases.get(name);
|
|
2211
|
+
while (bases.has(base) && !seen.has(base)) {
|
|
2212
|
+
seen.add(base);
|
|
2213
|
+
base = bases.get(base);
|
|
2214
|
+
}
|
|
2215
|
+
if (!bases.has(base) && APPLE_CLASS.test(base) && !APPLE_PROTOCOL.test(base) && !(base in SDK_OBJC_OPTIONAL))
|
|
2216
|
+
rooted.add(name);
|
|
2217
|
+
}
|
|
2218
|
+
return rooted;
|
|
2219
|
+
}
|
|
2220
|
+
function hideObjCClassesFromCxx(source, rooted) {
|
|
2221
|
+
if (rooted.size === 0) return source;
|
|
2222
|
+
const code = swiftCodeMask(source);
|
|
2223
|
+
const starts = [];
|
|
2224
|
+
let depth = 0;
|
|
2225
|
+
for (const match of code.matchAll(
|
|
2226
|
+
/[{}]|\bclass\s+(?!(?:func|var|let|subscript)\b)([A-Za-z_]\w*)/g
|
|
2227
|
+
)) {
|
|
2228
|
+
if (match[0] === "{") depth++;
|
|
2229
|
+
else if (match[0] === "}") depth--;
|
|
2230
|
+
else if (depth === 0 && rooted.has(match[1]))
|
|
2231
|
+
starts.push(declarationStart(code, match.index, 0));
|
|
2232
|
+
}
|
|
2233
|
+
let out = source;
|
|
2234
|
+
for (const at of starts.reverse())
|
|
2235
|
+
out = `${out.slice(0, at)}@_expose(!Cxx) ${out.slice(at)}`;
|
|
2236
|
+
return out;
|
|
2237
|
+
}
|
|
2030
2238
|
function lowerAnyObjectDoubleValue(source) {
|
|
2031
2239
|
const masked = swiftCodeMask(source);
|
|
2032
2240
|
const names = /* @__PURE__ */ new Set();
|
|
@@ -3890,11 +4098,39 @@ function objcIndex(sources) {
|
|
|
3890
4098
|
/\b(?:var|let)\s+([A-Za-z_]\w*)/g
|
|
3891
4099
|
))
|
|
3892
4100
|
variables.add(declared[1]);
|
|
3893
|
-
const parents =
|
|
4101
|
+
const parents = inheritedTypes(sources);
|
|
3894
4102
|
for (const [protocol, inherited] of sdkParents)
|
|
3895
4103
|
parents.set(protocol, /* @__PURE__ */ new Set([...parents.get(protocol) ?? [], ...inherited]));
|
|
3896
4104
|
const conformers = requirements.size ? conformingTypes(parents, new Set(requirements.keys())) : /* @__PURE__ */ new Map();
|
|
3897
|
-
|
|
4105
|
+
const protocols = /* @__PURE__ */ new Set();
|
|
4106
|
+
const initializers = /* @__PURE__ */ new Set();
|
|
4107
|
+
for (const source of sources) {
|
|
4108
|
+
if (!/\bprotocol\b/.test(source)) continue;
|
|
4109
|
+
const code = swiftCodeMask(source);
|
|
4110
|
+
const braces = [...code.matchAll(/[{}]/g)].map((match) => match.index);
|
|
4111
|
+
for (const protocol of code.matchAll(/\bprotocol\s+([A-Za-z_]\w*)[^{}]*\{/g)) {
|
|
4112
|
+
const name = protocol[1];
|
|
4113
|
+
protocols.add(name);
|
|
4114
|
+
const open = protocol.index + protocol[0].length - 1;
|
|
4115
|
+
if (/\binit\s*[?!]?\s*\(/.test(code.slice(open + 1, closingBrace(code, braces, open))))
|
|
4116
|
+
initializers.add(name);
|
|
4117
|
+
}
|
|
4118
|
+
}
|
|
4119
|
+
const rooted = conformingTypes(parents, /* @__PURE__ */ new Set(["NSObject"]));
|
|
4120
|
+
const initialized = conformingTypes(parents, initializers);
|
|
4121
|
+
const nsObjectTypes = /* @__PURE__ */ new Set([
|
|
4122
|
+
"NSObject",
|
|
4123
|
+
...[...protocols].filter((name) => rooted.has(name) && !initialized.has(name))
|
|
4124
|
+
]);
|
|
4125
|
+
return {
|
|
4126
|
+
requirements,
|
|
4127
|
+
conformers,
|
|
4128
|
+
callable,
|
|
4129
|
+
variables,
|
|
4130
|
+
aliases,
|
|
4131
|
+
typeMethods,
|
|
4132
|
+
nsObjectTypes
|
|
4133
|
+
};
|
|
3898
4134
|
}
|
|
3899
4135
|
function objcAliases(sources) {
|
|
3900
4136
|
const declared = /* @__PURE__ */ new Map();
|
|
@@ -4142,7 +4378,7 @@ function lowerObjCOptionalRequirements(source, index) {
|
|
|
4142
4378
|
var IMP_CONVENTION = /@convention\(c\)(?=\s*\(\s*AnyObject\s*,\s*Selector\b)/g;
|
|
4143
4379
|
function lowerObjCRuntimeCalls(source, index) {
|
|
4144
4380
|
const casts = source.includes("@convention(c)");
|
|
4145
|
-
const classes = /\b(?:AnyClass|AnyObject)\b/.test(source);
|
|
4381
|
+
const classes = /\b(?:AnyClass|AnyObject)\b|\.\s*init\s*\(/.test(source);
|
|
4146
4382
|
if (!casts && !classes) return source;
|
|
4147
4383
|
const code = swiftCodeMask(source);
|
|
4148
4384
|
const edits = [];
|
|
@@ -4172,11 +4408,24 @@ function lowerObjCRuntimeCalls(source, index) {
|
|
|
4172
4408
|
if (classes) {
|
|
4173
4409
|
const declarations = /* @__PURE__ */ new Map();
|
|
4174
4410
|
for (const declared of code.matchAll(
|
|
4175
|
-
/(?:\b(?:let|var)\s+|[(,]\s*(?:[A-Za-z_]\w*\s+)?)([A-Za-z_]\w*)\s*:\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
|
|
4411
|
+
/(?:\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
|
|
4176
4412
|
)) {
|
|
4177
4413
|
const name = declared[1] ?? declared[4] ?? declared[5];
|
|
4178
4414
|
const list = declarations.get(name) ?? [];
|
|
4179
|
-
|
|
4415
|
+
let type = declared[3] ? "" : declared[2] ?? "";
|
|
4416
|
+
if (!type && declared[4]) {
|
|
4417
|
+
const lookup = /^\s*=\s*NSClassFromString\s*\(/.exec(
|
|
4418
|
+
code.slice(declared.index + declared[0].length)
|
|
4419
|
+
);
|
|
4420
|
+
if (lookup) {
|
|
4421
|
+
const open = declared.index + declared[0].length + lookup[0].length - 1;
|
|
4422
|
+
type = /^\s*as\?\s*([A-Za-z_]\w*(?:\.\w+)*\.Type)\b/.exec(
|
|
4423
|
+
code.slice(closingParen(code, open) + 1)
|
|
4424
|
+
)?.[1] ?? "";
|
|
4425
|
+
}
|
|
4426
|
+
}
|
|
4427
|
+
const resolved = type.endsWith(".Type") ? `${resolveAliases(type.slice(0, -5), index.aliases)}.Type` : resolveAliases(type, index.aliases);
|
|
4428
|
+
list.push({ at: declared.index, type: resolved });
|
|
4180
4429
|
declarations.set(name, list);
|
|
4181
4430
|
}
|
|
4182
4431
|
for (const pattern of code.matchAll(/\b(?:let|var|for)\s*(?=\(|\.\s*\w+\s*\()/g)) {
|
|
@@ -4190,7 +4439,7 @@ function lowerObjCRuntimeCalls(source, index) {
|
|
|
4190
4439
|
}
|
|
4191
4440
|
for (const list of declarations.values()) list.sort((a, b) => a.at - b.at);
|
|
4192
4441
|
const braces = [...code.matchAll(/[{}]/g)].map((match) => match.index);
|
|
4193
|
-
const
|
|
4442
|
+
const receiverType = (name, at) => {
|
|
4194
4443
|
let innermost;
|
|
4195
4444
|
for (const declared of declarations.get(name) ?? []) {
|
|
4196
4445
|
if (declared.at > at) break;
|
|
@@ -4198,17 +4447,31 @@ function lowerObjCRuntimeCalls(source, index) {
|
|
|
4198
4447
|
if (at > from && at < to && (!innermost || from >= innermost.from))
|
|
4199
4448
|
innermost = { from, type: declared.type };
|
|
4200
4449
|
}
|
|
4201
|
-
return innermost?.type
|
|
4450
|
+
return innermost?.type;
|
|
4202
4451
|
};
|
|
4203
4452
|
let reached = -1;
|
|
4204
4453
|
for (const call of code.matchAll(
|
|
4205
4454
|
/(?<![\w.])((?:type\s*\(\s*of\s*:\s*([A-Za-z_]\w*)\s*\))|[A-Za-z_]\w*)\s*\.\s*([A-Za-z_]\w*)\s*\(/g
|
|
4206
4455
|
)) {
|
|
4207
|
-
if (call.index < reached
|
|
4208
|
-
|
|
4456
|
+
if (call.index < reached) continue;
|
|
4457
|
+
const type = receiverType(call[2] ?? call[1], call.index);
|
|
4458
|
+
const constructed = call[2] ? type : type?.replace(/\.Type$/, "");
|
|
4459
|
+
const constructs = call[3] === "init" && constructed && (call[2] || type?.endsWith(".Type")) && index.nsObjectTypes.has(constructed.replace(/^Foundation\./, ""));
|
|
4460
|
+
if (!constructs && type !== (call[2] ? "AnyObject" : "AnyClass")) continue;
|
|
4209
4461
|
const open = call.index + call[0].length - 1;
|
|
4210
4462
|
const shut = closingParen(code, open);
|
|
4211
4463
|
const passed = callArguments(source, code, open, shut);
|
|
4464
|
+
if (constructs && passed.length === 0) {
|
|
4465
|
+
const result2 = constructed.replace(/^Foundation\./, "") === "NSObject" ? constructed : `any ${constructed}`;
|
|
4466
|
+
edits.push([
|
|
4467
|
+
call.index,
|
|
4468
|
+
shut + 1 - call.index,
|
|
4469
|
+
`_objcNSObjectDefaultInit(${call[1]}, returning: (${result2}).self)`
|
|
4470
|
+
]);
|
|
4471
|
+
reached = shut + 1;
|
|
4472
|
+
continue;
|
|
4473
|
+
}
|
|
4474
|
+
if (type !== (call[2] ? "AnyObject" : "AnyClass")) continue;
|
|
4212
4475
|
const selector = objcSelectorName(
|
|
4213
4476
|
call[3],
|
|
4214
4477
|
passed.map(({ label }) => label),
|
|
@@ -4334,6 +4597,694 @@ function swiftCodeMask(source) {
|
|
|
4334
4597
|
scanCode(0, false);
|
|
4335
4598
|
return chars.join("");
|
|
4336
4599
|
}
|
|
4600
|
+
var FOUNDATION_NETWORKING_TYPES = /* @__PURE__ */ new Set([
|
|
4601
|
+
"CachedURLResponse",
|
|
4602
|
+
"HTTPCookieStorage",
|
|
4603
|
+
"HTTPURLResponse",
|
|
4604
|
+
"NSMutableURLRequest",
|
|
4605
|
+
"NSURLConnection",
|
|
4606
|
+
"NSURLConnectionDataDelegate",
|
|
4607
|
+
"NSURLConnectionDelegate",
|
|
4608
|
+
"NSURLConnectionDownloadDelegate",
|
|
4609
|
+
"URLAuthenticationChallenge",
|
|
4610
|
+
"URLAuthenticationChallengeSender",
|
|
4611
|
+
"URLCache",
|
|
4612
|
+
"URLCredential",
|
|
4613
|
+
"URLCredentialStorage",
|
|
4614
|
+
"URLProtectionSpace",
|
|
4615
|
+
"URLProtocol",
|
|
4616
|
+
"URLProtocolClient",
|
|
4617
|
+
"URLRequest",
|
|
4618
|
+
"URLResponse",
|
|
4619
|
+
"URLSession",
|
|
4620
|
+
"URLSessionConfiguration",
|
|
4621
|
+
"URLSessionDataDelegate",
|
|
4622
|
+
"URLSessionDataTask",
|
|
4623
|
+
"URLSessionDelegate",
|
|
4624
|
+
"URLSessionDownloadDelegate",
|
|
4625
|
+
"URLSessionDownloadTask",
|
|
4626
|
+
"URLSessionStreamDelegate",
|
|
4627
|
+
"URLSessionStreamTask",
|
|
4628
|
+
"URLSessionTask",
|
|
4629
|
+
"URLSessionTaskDelegate",
|
|
4630
|
+
"URLSessionTaskMetrics",
|
|
4631
|
+
"URLSessionTaskTransactionMetrics",
|
|
4632
|
+
"URLSessionUploadTask",
|
|
4633
|
+
"URLSessionWebSocketDelegate",
|
|
4634
|
+
"URLSessionWebSocketTask"
|
|
4635
|
+
]);
|
|
4636
|
+
var FOUNDATION_OVERLAY_TYPES = /* @__PURE__ */ new Set([
|
|
4637
|
+
"AsyncCharacterSequence",
|
|
4638
|
+
"AsyncLineSequence",
|
|
4639
|
+
"AsyncUnicodeScalarSequence",
|
|
4640
|
+
"BlockOperation",
|
|
4641
|
+
"DateComponentsFormatter",
|
|
4642
|
+
"ErrorUserInfoKey",
|
|
4643
|
+
"FileWrapper",
|
|
4644
|
+
"HTTPCookie",
|
|
4645
|
+
"HTTPCookiePropertyKey",
|
|
4646
|
+
"HTTPCookieStringPolicy",
|
|
4647
|
+
"InlinePresentationIntent",
|
|
4648
|
+
"ListFormatter",
|
|
4649
|
+
"LocalizedStringResource",
|
|
4650
|
+
"MachError",
|
|
4651
|
+
"MeasurementFormatUnitUsage",
|
|
4652
|
+
"MeasurementFormatter",
|
|
4653
|
+
"MessagePort",
|
|
4654
|
+
"NSAssertionHandler",
|
|
4655
|
+
"NSAttributedStringFormattingContextKey",
|
|
4656
|
+
"NSBundleResourceRequest",
|
|
4657
|
+
"NSCollectionChangeType",
|
|
4658
|
+
"NSConditionLock",
|
|
4659
|
+
"NSDataDetector",
|
|
4660
|
+
"NSException",
|
|
4661
|
+
"NSExtensionContext",
|
|
4662
|
+
"NSExtensionItem",
|
|
4663
|
+
"NSExtensionRequestHandling",
|
|
4664
|
+
"NSFastEnumerationIterator",
|
|
4665
|
+
"NSFastEnumerationState",
|
|
4666
|
+
"NSFileAccessIntent",
|
|
4667
|
+
"NSFileCoordinator",
|
|
4668
|
+
"NSFileManagerResumeSyncBehavior",
|
|
4669
|
+
"NSFileManagerSupportedSyncControls",
|
|
4670
|
+
"NSFileManagerUploadLocalVersionConflictPolicy",
|
|
4671
|
+
"NSFileProviderService",
|
|
4672
|
+
"NSFileProviderServiceName",
|
|
4673
|
+
"NSFileSecurity",
|
|
4674
|
+
"NSFileVersion",
|
|
4675
|
+
"NSGrammaticalCase",
|
|
4676
|
+
"NSGrammaticalDefiniteness",
|
|
4677
|
+
"NSGrammaticalDetermination",
|
|
4678
|
+
"NSGrammaticalGender",
|
|
4679
|
+
"NSGrammaticalNumber",
|
|
4680
|
+
"NSGrammaticalPartOfSpeech",
|
|
4681
|
+
"NSGrammaticalPerson",
|
|
4682
|
+
"NSGrammaticalPronounType",
|
|
4683
|
+
"NSHashEnumerator",
|
|
4684
|
+
"NSHashTable",
|
|
4685
|
+
"NSHashTableCallBacks",
|
|
4686
|
+
"NSItemProvider",
|
|
4687
|
+
"NSItemProviderFileOptions",
|
|
4688
|
+
"NSItemProviderRepresentationVisibility",
|
|
4689
|
+
"NSKeyValueOperator",
|
|
4690
|
+
"NSKeyValueSetMutationKind",
|
|
4691
|
+
"NSKeyValueSharedObservers",
|
|
4692
|
+
"NSLinguisticTag",
|
|
4693
|
+
"NSLinguisticTagScheme",
|
|
4694
|
+
"NSLinguisticTagger",
|
|
4695
|
+
"NSLinguisticTaggerUnit",
|
|
4696
|
+
"NSMachPort",
|
|
4697
|
+
"NSMapEnumerator",
|
|
4698
|
+
"NSMapTable",
|
|
4699
|
+
"NSMapTableKeyCallBacks",
|
|
4700
|
+
"NSMapTableValueCallBacks",
|
|
4701
|
+
"NSMetadataItem",
|
|
4702
|
+
"NSMetadataQuery",
|
|
4703
|
+
"NSMetadataQueryAttributeValueTuple",
|
|
4704
|
+
"NSMetadataQueryDelegate",
|
|
4705
|
+
"NSMetadataQueryResultGroup",
|
|
4706
|
+
"NSOrderedCollectionChange",
|
|
4707
|
+
"NSOrderedCollectionDifference",
|
|
4708
|
+
"NSOrderedCollectionDifferenceCalculationOptions",
|
|
4709
|
+
"NSPointerArray",
|
|
4710
|
+
"NSPointerFunctions",
|
|
4711
|
+
"NSPredicateValidating",
|
|
4712
|
+
"NSProxy",
|
|
4713
|
+
"NSPurgeableData",
|
|
4714
|
+
"NSSecureUnarchiveFromDataTransformer",
|
|
4715
|
+
"NSSwappedDouble",
|
|
4716
|
+
"NSSwappedFloat",
|
|
4717
|
+
"NSURLRequest",
|
|
4718
|
+
"NSUbiquitousKeyValueStore",
|
|
4719
|
+
"NSUserActivity",
|
|
4720
|
+
"NSUserActivityDelegate",
|
|
4721
|
+
"NSValueTransformerName",
|
|
4722
|
+
"NSXPCCoder",
|
|
4723
|
+
"NSXPCConnection",
|
|
4724
|
+
"NSXPCInterface",
|
|
4725
|
+
"NSXPCListener",
|
|
4726
|
+
"NSXPCListenerDelegate",
|
|
4727
|
+
"NSXPCListenerEndpoint",
|
|
4728
|
+
"NetService",
|
|
4729
|
+
"NetServiceBrowser",
|
|
4730
|
+
"NetServiceBrowserDelegate",
|
|
4731
|
+
"NetServiceDelegate",
|
|
4732
|
+
"NotificationQueue",
|
|
4733
|
+
"Operation",
|
|
4734
|
+
"OperationQueue",
|
|
4735
|
+
"PredicateCodableConfiguration",
|
|
4736
|
+
"PresentationIntent",
|
|
4737
|
+
"Progress",
|
|
4738
|
+
"ProgressKind",
|
|
4739
|
+
"ProgressUserInfoKey",
|
|
4740
|
+
"RelativeDateTimeFormatter",
|
|
4741
|
+
"SocketPort",
|
|
4742
|
+
"StringEncodingDetectionOptionsKey",
|
|
4743
|
+
"TermOfAddress",
|
|
4744
|
+
"URLFileProtection",
|
|
4745
|
+
"URLResource",
|
|
4746
|
+
"URLThumbnailDictionaryItem",
|
|
4747
|
+
"URLUbiquitousItemDownloadingStatus",
|
|
4748
|
+
"URLUbiquitousSharedItemPermissions",
|
|
4749
|
+
"URLUbiquitousSharedItemRole",
|
|
4750
|
+
"UndoManager",
|
|
4751
|
+
"ValueTransformer",
|
|
4752
|
+
"XMLParser",
|
|
4753
|
+
"XMLParserDelegate"
|
|
4754
|
+
]);
|
|
4755
|
+
var FOUNDATION_OVERLAY_GLOBALS = /* @__PURE__ */ new Set([
|
|
4756
|
+
"CFBridgingRetain",
|
|
4757
|
+
"NSASCIIStringEncoding",
|
|
4758
|
+
"NSAllHashTableObjects",
|
|
4759
|
+
"NSAllMapTableKeys",
|
|
4760
|
+
"NSAllMapTableValues",
|
|
4761
|
+
"NSAllocateMemoryPages",
|
|
4762
|
+
"NSAssertionHandlerKey",
|
|
4763
|
+
"NSBuddhistCalendar",
|
|
4764
|
+
"NSBundleErrorMaximum",
|
|
4765
|
+
"NSBundleErrorMinimum",
|
|
4766
|
+
"NSBundleExecutableArchitectureARM64",
|
|
4767
|
+
"NSBundleExecutableArchitectureI386",
|
|
4768
|
+
"NSBundleExecutableArchitecturePPC",
|
|
4769
|
+
"NSBundleExecutableArchitecturePPC64",
|
|
4770
|
+
"NSBundleExecutableArchitectureX86_64",
|
|
4771
|
+
"NSBundleOnDemandResourceExceededMaximumSizeError",
|
|
4772
|
+
"NSBundleOnDemandResourceInvalidTagError",
|
|
4773
|
+
"NSBundleOnDemandResourceOutOfSpaceError",
|
|
4774
|
+
"NSBundleResourceRequestLoadingPriorityUrgent",
|
|
4775
|
+
"NSChineseCalendar",
|
|
4776
|
+
"NSCloudSharingConflictError",
|
|
4777
|
+
"NSCloudSharingErrorMaximum",
|
|
4778
|
+
"NSCloudSharingErrorMinimum",
|
|
4779
|
+
"NSCloudSharingNetworkFailureError",
|
|
4780
|
+
"NSCloudSharingNoPermissionError",
|
|
4781
|
+
"NSCloudSharingOtherError",
|
|
4782
|
+
"NSCloudSharingQuotaExceededError",
|
|
4783
|
+
"NSCloudSharingTooManyParticipantsError",
|
|
4784
|
+
"NSCoderErrorMaximum",
|
|
4785
|
+
"NSCoderErrorMinimum",
|
|
4786
|
+
"NSCoderInvalidValueError",
|
|
4787
|
+
"NSCompareHashTables",
|
|
4788
|
+
"NSCompareMapTables",
|
|
4789
|
+
"NSCompressionErrorMaximum",
|
|
4790
|
+
"NSCompressionErrorMinimum",
|
|
4791
|
+
"NSCompressionFailedError",
|
|
4792
|
+
"NSConvertHostDoubleToSwapped",
|
|
4793
|
+
"NSConvertHostFloatToSwapped",
|
|
4794
|
+
"NSConvertSwappedDoubleToHost",
|
|
4795
|
+
"NSConvertSwappedFloatToHost",
|
|
4796
|
+
"NSCopyMemoryPages",
|
|
4797
|
+
"NSCountHashTable",
|
|
4798
|
+
"NSCountMapTable",
|
|
4799
|
+
"NSCreateHashTable",
|
|
4800
|
+
"NSCreateMapTable",
|
|
4801
|
+
"NSDeallocateMemoryPages",
|
|
4802
|
+
"NSDecompressionFailedError",
|
|
4803
|
+
"NSEndHashTableEnumeration",
|
|
4804
|
+
"NSEndMapTableEnumeration",
|
|
4805
|
+
"NSEnumerateHashTable",
|
|
4806
|
+
"NSEnumerateMapTable",
|
|
4807
|
+
"NSExecutableErrorMaximum",
|
|
4808
|
+
"NSExecutableErrorMinimum",
|
|
4809
|
+
"NSExtensionItemAttachmentsKey",
|
|
4810
|
+
"NSExtensionItemAttributedContentTextKey",
|
|
4811
|
+
"NSExtensionItemAttributedTitleKey",
|
|
4812
|
+
"NSExtensionItemsAndErrorsKey",
|
|
4813
|
+
"NSExtensionJavaScriptFinalizeArgumentKey",
|
|
4814
|
+
"NSExtensionJavaScriptPreprocessingResultsKey",
|
|
4815
|
+
"NSFileErrorMaximum",
|
|
4816
|
+
"NSFileErrorMinimum",
|
|
4817
|
+
"NSFormattingErrorMaximum",
|
|
4818
|
+
"NSFormattingErrorMinimum",
|
|
4819
|
+
"NSFoundationVersionNumber",
|
|
4820
|
+
"NSFoundationVersionNumber10_0",
|
|
4821
|
+
"NSFoundationVersionNumber10_1",
|
|
4822
|
+
"NSFoundationVersionNumber10_10",
|
|
4823
|
+
"NSFoundationVersionNumber10_10_1",
|
|
4824
|
+
"NSFoundationVersionNumber10_10_2",
|
|
4825
|
+
"NSFoundationVersionNumber10_10_3",
|
|
4826
|
+
"NSFoundationVersionNumber10_10_4",
|
|
4827
|
+
"NSFoundationVersionNumber10_10_5",
|
|
4828
|
+
"NSFoundationVersionNumber10_10_Max",
|
|
4829
|
+
"NSFoundationVersionNumber10_11",
|
|
4830
|
+
"NSFoundationVersionNumber10_11_1",
|
|
4831
|
+
"NSFoundationVersionNumber10_11_2",
|
|
4832
|
+
"NSFoundationVersionNumber10_11_3",
|
|
4833
|
+
"NSFoundationVersionNumber10_11_4",
|
|
4834
|
+
"NSFoundationVersionNumber10_11_Max",
|
|
4835
|
+
"NSFoundationVersionNumber10_1_1",
|
|
4836
|
+
"NSFoundationVersionNumber10_1_2",
|
|
4837
|
+
"NSFoundationVersionNumber10_1_3",
|
|
4838
|
+
"NSFoundationVersionNumber10_1_4",
|
|
4839
|
+
"NSFoundationVersionNumber10_2",
|
|
4840
|
+
"NSFoundationVersionNumber10_2_1",
|
|
4841
|
+
"NSFoundationVersionNumber10_2_2",
|
|
4842
|
+
"NSFoundationVersionNumber10_2_3",
|
|
4843
|
+
"NSFoundationVersionNumber10_2_4",
|
|
4844
|
+
"NSFoundationVersionNumber10_2_5",
|
|
4845
|
+
"NSFoundationVersionNumber10_2_6",
|
|
4846
|
+
"NSFoundationVersionNumber10_2_7",
|
|
4847
|
+
"NSFoundationVersionNumber10_2_8",
|
|
4848
|
+
"NSFoundationVersionNumber10_3",
|
|
4849
|
+
"NSFoundationVersionNumber10_3_1",
|
|
4850
|
+
"NSFoundationVersionNumber10_3_2",
|
|
4851
|
+
"NSFoundationVersionNumber10_3_3",
|
|
4852
|
+
"NSFoundationVersionNumber10_3_4",
|
|
4853
|
+
"NSFoundationVersionNumber10_3_5",
|
|
4854
|
+
"NSFoundationVersionNumber10_3_6",
|
|
4855
|
+
"NSFoundationVersionNumber10_3_7",
|
|
4856
|
+
"NSFoundationVersionNumber10_3_8",
|
|
4857
|
+
"NSFoundationVersionNumber10_3_9",
|
|
4858
|
+
"NSFoundationVersionNumber10_4",
|
|
4859
|
+
"NSFoundationVersionNumber10_4_1",
|
|
4860
|
+
"NSFoundationVersionNumber10_4_10",
|
|
4861
|
+
"NSFoundationVersionNumber10_4_11",
|
|
4862
|
+
"NSFoundationVersionNumber10_4_2",
|
|
4863
|
+
"NSFoundationVersionNumber10_4_3",
|
|
4864
|
+
"NSFoundationVersionNumber10_4_4_Intel",
|
|
4865
|
+
"NSFoundationVersionNumber10_4_4_PowerPC",
|
|
4866
|
+
"NSFoundationVersionNumber10_4_5",
|
|
4867
|
+
"NSFoundationVersionNumber10_4_6",
|
|
4868
|
+
"NSFoundationVersionNumber10_4_7",
|
|
4869
|
+
"NSFoundationVersionNumber10_4_8",
|
|
4870
|
+
"NSFoundationVersionNumber10_4_9",
|
|
4871
|
+
"NSFoundationVersionNumber10_5",
|
|
4872
|
+
"NSFoundationVersionNumber10_5_1",
|
|
4873
|
+
"NSFoundationVersionNumber10_5_2",
|
|
4874
|
+
"NSFoundationVersionNumber10_5_3",
|
|
4875
|
+
"NSFoundationVersionNumber10_5_4",
|
|
4876
|
+
"NSFoundationVersionNumber10_5_5",
|
|
4877
|
+
"NSFoundationVersionNumber10_5_6",
|
|
4878
|
+
"NSFoundationVersionNumber10_5_7",
|
|
4879
|
+
"NSFoundationVersionNumber10_5_8",
|
|
4880
|
+
"NSFoundationVersionNumber10_6",
|
|
4881
|
+
"NSFoundationVersionNumber10_6_1",
|
|
4882
|
+
"NSFoundationVersionNumber10_6_2",
|
|
4883
|
+
"NSFoundationVersionNumber10_6_3",
|
|
4884
|
+
"NSFoundationVersionNumber10_6_4",
|
|
4885
|
+
"NSFoundationVersionNumber10_6_5",
|
|
4886
|
+
"NSFoundationVersionNumber10_6_6",
|
|
4887
|
+
"NSFoundationVersionNumber10_6_7",
|
|
4888
|
+
"NSFoundationVersionNumber10_6_8",
|
|
4889
|
+
"NSFoundationVersionNumber10_7",
|
|
4890
|
+
"NSFoundationVersionNumber10_7_1",
|
|
4891
|
+
"NSFoundationVersionNumber10_7_2",
|
|
4892
|
+
"NSFoundationVersionNumber10_7_3",
|
|
4893
|
+
"NSFoundationVersionNumber10_7_4",
|
|
4894
|
+
"NSFoundationVersionNumber10_8",
|
|
4895
|
+
"NSFoundationVersionNumber10_8_1",
|
|
4896
|
+
"NSFoundationVersionNumber10_8_2",
|
|
4897
|
+
"NSFoundationVersionNumber10_8_3",
|
|
4898
|
+
"NSFoundationVersionNumber10_8_4",
|
|
4899
|
+
"NSFoundationVersionNumber10_9",
|
|
4900
|
+
"NSFoundationVersionNumber10_9_1",
|
|
4901
|
+
"NSFoundationVersionNumber10_9_2",
|
|
4902
|
+
"NSFoundationVersionNumber_iOS_4_0",
|
|
4903
|
+
"NSFoundationVersionNumber_iOS_4_1",
|
|
4904
|
+
"NSFoundationVersionNumber_iOS_4_2",
|
|
4905
|
+
"NSFoundationVersionNumber_iOS_4_3",
|
|
4906
|
+
"NSFoundationVersionNumber_iOS_5_0",
|
|
4907
|
+
"NSFoundationVersionNumber_iOS_5_1",
|
|
4908
|
+
"NSFoundationVersionNumber_iOS_6_0",
|
|
4909
|
+
"NSFoundationVersionNumber_iOS_6_1",
|
|
4910
|
+
"NSFoundationVersionNumber_iOS_7_0",
|
|
4911
|
+
"NSFoundationVersionNumber_iOS_7_1",
|
|
4912
|
+
"NSFoundationVersionNumber_iOS_8_0",
|
|
4913
|
+
"NSFoundationVersionNumber_iOS_8_1",
|
|
4914
|
+
"NSFoundationVersionNumber_iOS_8_2",
|
|
4915
|
+
"NSFoundationVersionNumber_iOS_8_3",
|
|
4916
|
+
"NSFoundationVersionNumber_iOS_8_4",
|
|
4917
|
+
"NSFoundationVersionNumber_iOS_8_x_Max",
|
|
4918
|
+
"NSFoundationVersionNumber_iOS_9_0",
|
|
4919
|
+
"NSFoundationVersionNumber_iOS_9_1",
|
|
4920
|
+
"NSFoundationVersionNumber_iOS_9_2",
|
|
4921
|
+
"NSFoundationVersionNumber_iOS_9_3",
|
|
4922
|
+
"NSFoundationVersionNumber_iOS_9_4",
|
|
4923
|
+
"NSFoundationVersionNumber_iOS_9_x_Max",
|
|
4924
|
+
"NSFoundationVersionNumber_iPhoneOS_2_0",
|
|
4925
|
+
"NSFoundationVersionNumber_iPhoneOS_2_1",
|
|
4926
|
+
"NSFoundationVersionNumber_iPhoneOS_2_2",
|
|
4927
|
+
"NSFoundationVersionNumber_iPhoneOS_3_0",
|
|
4928
|
+
"NSFoundationVersionNumber_iPhoneOS_3_1",
|
|
4929
|
+
"NSFoundationVersionNumber_iPhoneOS_3_2",
|
|
4930
|
+
"NSFoundationVersionWithFileManagerResourceForkSupport",
|
|
4931
|
+
"NSFreeHashTable",
|
|
4932
|
+
"NSFreeMapTable",
|
|
4933
|
+
"NSGetUncaughtExceptionHandler",
|
|
4934
|
+
"NSGregorianCalendar",
|
|
4935
|
+
"NSHPUXOperatingSystem",
|
|
4936
|
+
"NSHashGet",
|
|
4937
|
+
"NSHashInsert",
|
|
4938
|
+
"NSHashInsertIfAbsent",
|
|
4939
|
+
"NSHashInsertKnownAbsent",
|
|
4940
|
+
"NSHashRemove",
|
|
4941
|
+
"NSHashTableCopyIn",
|
|
4942
|
+
"NSHashTableObjectPointerPersonality",
|
|
4943
|
+
"NSHashTableStrongMemory",
|
|
4944
|
+
"NSHashTableWeakMemory",
|
|
4945
|
+
"NSHebrewCalendar",
|
|
4946
|
+
"NSHostByteOrder",
|
|
4947
|
+
"NSISO2022JPStringEncoding",
|
|
4948
|
+
"NSISO8601Calendar",
|
|
4949
|
+
"NSISOLatin1StringEncoding",
|
|
4950
|
+
"NSISOLatin2StringEncoding",
|
|
4951
|
+
"NSIndianCalendar",
|
|
4952
|
+
"NSIslamicCalendar",
|
|
4953
|
+
"NSIslamicCivilCalendar",
|
|
4954
|
+
"NSItemProviderPreferredImageSizeKey",
|
|
4955
|
+
"NSJapaneseCalendar",
|
|
4956
|
+
"NSJapaneseEUCStringEncoding",
|
|
4957
|
+
"NSLoadedClasses",
|
|
4958
|
+
"NSLocalizedFailureErrorKey",
|
|
4959
|
+
"NSLogPageSize",
|
|
4960
|
+
"NSMACHOperatingSystem",
|
|
4961
|
+
"NSMacOSRomanStringEncoding",
|
|
4962
|
+
"NSMapGet",
|
|
4963
|
+
"NSMapInsert",
|
|
4964
|
+
"NSMapInsertIfAbsent",
|
|
4965
|
+
"NSMapInsertKnownAbsent",
|
|
4966
|
+
"NSMapMember",
|
|
4967
|
+
"NSMapRemove",
|
|
4968
|
+
"NSMapTableCopyIn",
|
|
4969
|
+
"NSMapTableObjectPointerPersonality",
|
|
4970
|
+
"NSMapTableStrongMemory",
|
|
4971
|
+
"NSMapTableWeakMemory",
|
|
4972
|
+
"NSMetadataItemContentTypeKey",
|
|
4973
|
+
"NSMetadataItemContentTypeTreeKey",
|
|
4974
|
+
"NSMetadataItemDisplayNameKey",
|
|
4975
|
+
"NSMetadataItemFSContentChangeDateKey",
|
|
4976
|
+
"NSMetadataItemFSCreationDateKey",
|
|
4977
|
+
"NSMetadataItemFSNameKey",
|
|
4978
|
+
"NSMetadataItemFSSizeKey",
|
|
4979
|
+
"NSMetadataItemIsUbiquitousKey",
|
|
4980
|
+
"NSMetadataItemPathKey",
|
|
4981
|
+
"NSMetadataItemURLKey",
|
|
4982
|
+
"NSMetadataQueryAccessibleUbiquitousExternalDocumentsScope",
|
|
4983
|
+
"NSMetadataQueryResultContentRelevanceAttribute",
|
|
4984
|
+
"NSMetadataQueryUbiquitousDataScope",
|
|
4985
|
+
"NSMetadataQueryUbiquitousDocumentsScope",
|
|
4986
|
+
"NSMetadataQueryUpdateAddedItemsKey",
|
|
4987
|
+
"NSMetadataQueryUpdateChangedItemsKey",
|
|
4988
|
+
"NSMetadataQueryUpdateRemovedItemsKey",
|
|
4989
|
+
"NSMetadataUbiquitousItemContainerDisplayNameKey",
|
|
4990
|
+
"NSMetadataUbiquitousItemDownloadRequestedKey",
|
|
4991
|
+
"NSMetadataUbiquitousItemDownloadingErrorKey",
|
|
4992
|
+
"NSMetadataUbiquitousItemDownloadingStatusCurrent",
|
|
4993
|
+
"NSMetadataUbiquitousItemDownloadingStatusDownloaded",
|
|
4994
|
+
"NSMetadataUbiquitousItemDownloadingStatusKey",
|
|
4995
|
+
"NSMetadataUbiquitousItemDownloadingStatusNotDownloaded",
|
|
4996
|
+
"NSMetadataUbiquitousItemHasUnresolvedConflictsKey",
|
|
4997
|
+
"NSMetadataUbiquitousItemIsDownloadingKey",
|
|
4998
|
+
"NSMetadataUbiquitousItemIsExternalDocumentKey",
|
|
4999
|
+
"NSMetadataUbiquitousItemIsSharedKey",
|
|
5000
|
+
"NSMetadataUbiquitousItemIsUploadedKey",
|
|
5001
|
+
"NSMetadataUbiquitousItemIsUploadingKey",
|
|
5002
|
+
"NSMetadataUbiquitousItemPercentDownloadedKey",
|
|
5003
|
+
"NSMetadataUbiquitousItemPercentUploadedKey",
|
|
5004
|
+
"NSMetadataUbiquitousItemURLInLocalContainerKey",
|
|
5005
|
+
"NSMetadataUbiquitousItemUploadingErrorKey",
|
|
5006
|
+
"NSMetadataUbiquitousSharedItemCurrentUserPermissionsKey",
|
|
5007
|
+
"NSMetadataUbiquitousSharedItemCurrentUserRoleKey",
|
|
5008
|
+
"NSMetadataUbiquitousSharedItemMostRecentEditorNameComponentsKey",
|
|
5009
|
+
"NSMetadataUbiquitousSharedItemOwnerNameComponentsKey",
|
|
5010
|
+
"NSMetadataUbiquitousSharedItemPermissionsReadOnly",
|
|
5011
|
+
"NSMetadataUbiquitousSharedItemPermissionsReadWrite",
|
|
5012
|
+
"NSMetadataUbiquitousSharedItemRoleOwner",
|
|
5013
|
+
"NSMetadataUbiquitousSharedItemRoleParticipant",
|
|
5014
|
+
"NSMultipleUnderlyingErrorsKey",
|
|
5015
|
+
"NSNEXTSTEPStringEncoding",
|
|
5016
|
+
"NSNextHashEnumeratorItem",
|
|
5017
|
+
"NSNextMapEnumeratorPair",
|
|
5018
|
+
"NSNonLossyASCIIStringEncoding",
|
|
5019
|
+
"NSNonOwnedPointerHashCallBacks",
|
|
5020
|
+
"NSNonOwnedPointerMapKeyCallBacks",
|
|
5021
|
+
"NSNonOwnedPointerMapValueCallBacks",
|
|
5022
|
+
"NSNonOwnedPointerOrNullMapKeyCallBacks",
|
|
5023
|
+
"NSNonRetainedObjectHashCallBacks",
|
|
5024
|
+
"NSNonRetainedObjectMapKeyCallBacks",
|
|
5025
|
+
"NSNonRetainedObjectMapValueCallBacks",
|
|
5026
|
+
"NSOSF1OperatingSystem",
|
|
5027
|
+
"NSObjectHashCallBacks",
|
|
5028
|
+
"NSObjectMapKeyCallBacks",
|
|
5029
|
+
"NSObjectMapValueCallBacks",
|
|
5030
|
+
"NSOpenStepRootDirectory",
|
|
5031
|
+
"NSOpenStepUnicodeReservedBase",
|
|
5032
|
+
"NSOwnedObjectIdentityHashCallBacks",
|
|
5033
|
+
"NSOwnedPointerHashCallBacks",
|
|
5034
|
+
"NSOwnedPointerMapKeyCallBacks",
|
|
5035
|
+
"NSOwnedPointerMapValueCallBacks",
|
|
5036
|
+
"NSPersianCalendar",
|
|
5037
|
+
"NSPointerToStructHashCallBacks",
|
|
5038
|
+
"NSPropertyListErrorMaximum",
|
|
5039
|
+
"NSPropertyListErrorMinimum",
|
|
5040
|
+
"NSProprietaryStringEncoding",
|
|
5041
|
+
"NSProtocolFromString",
|
|
5042
|
+
"NSRepublicOfChinaCalendar",
|
|
5043
|
+
"NSResetHashTable",
|
|
5044
|
+
"NSResetMapTable",
|
|
5045
|
+
"NSShiftJISStringEncoding",
|
|
5046
|
+
"NSSolarisOperatingSystem",
|
|
5047
|
+
"NSStringFromHashTable",
|
|
5048
|
+
"NSStringFromMapTable",
|
|
5049
|
+
"NSStringFromProtocol",
|
|
5050
|
+
"NSSunOSOperatingSystem",
|
|
5051
|
+
"NSSwapBigDoubleToHost",
|
|
5052
|
+
"NSSwapBigFloatToHost",
|
|
5053
|
+
"NSSwapBigIntToHost",
|
|
5054
|
+
"NSSwapBigLongLongToHost",
|
|
5055
|
+
"NSSwapBigLongToHost",
|
|
5056
|
+
"NSSwapBigShortToHost",
|
|
5057
|
+
"NSSwapDouble",
|
|
5058
|
+
"NSSwapFloat",
|
|
5059
|
+
"NSSwapHostDoubleToBig",
|
|
5060
|
+
"NSSwapHostDoubleToLittle",
|
|
5061
|
+
"NSSwapHostFloatToBig",
|
|
5062
|
+
"NSSwapHostFloatToLittle",
|
|
5063
|
+
"NSSwapHostIntToBig",
|
|
5064
|
+
"NSSwapHostIntToLittle",
|
|
5065
|
+
"NSSwapHostLongLongToBig",
|
|
5066
|
+
"NSSwapHostLongLongToLittle",
|
|
5067
|
+
"NSSwapHostLongToBig",
|
|
5068
|
+
"NSSwapHostLongToLittle",
|
|
5069
|
+
"NSSwapHostShortToBig",
|
|
5070
|
+
"NSSwapHostShortToLittle",
|
|
5071
|
+
"NSSwapInt",
|
|
5072
|
+
"NSSwapLittleDoubleToHost",
|
|
5073
|
+
"NSSwapLittleFloatToHost",
|
|
5074
|
+
"NSSwapLittleIntToHost",
|
|
5075
|
+
"NSSwapLittleLongLongToHost",
|
|
5076
|
+
"NSSwapLittleLongToHost",
|
|
5077
|
+
"NSSwapLittleShortToHost",
|
|
5078
|
+
"NSSwapLong",
|
|
5079
|
+
"NSSwapLongLong",
|
|
5080
|
+
"NSSwapShort",
|
|
5081
|
+
"NSSymbolStringEncoding",
|
|
5082
|
+
"NSTextCheckingAllCustomTypes",
|
|
5083
|
+
"NSTextCheckingAllSystemTypes",
|
|
5084
|
+
"NSTextCheckingAllTypes",
|
|
5085
|
+
"NSURLAuthenticationMethodHTMLForm",
|
|
5086
|
+
"NSURLAuthenticationMethodNTLM",
|
|
5087
|
+
"NSURLAuthenticationMethodNegotiate",
|
|
5088
|
+
"NSURLCredentialStorageRemoveSynchronizableCredentials",
|
|
5089
|
+
"NSURLErrorFileOutsideSafeArea",
|
|
5090
|
+
"NSURLFileScheme",
|
|
5091
|
+
"NSURLProtectionSpaceFTP",
|
|
5092
|
+
"NSURLProtectionSpaceFTPProxy",
|
|
5093
|
+
"NSURLProtectionSpaceHTTP",
|
|
5094
|
+
"NSURLProtectionSpaceHTTPProxy",
|
|
5095
|
+
"NSURLProtectionSpaceHTTPS",
|
|
5096
|
+
"NSURLProtectionSpaceHTTPSProxy",
|
|
5097
|
+
"NSURLProtectionSpaceSOCKSProxy",
|
|
5098
|
+
"NSURLSessionDownloadTaskResumeData",
|
|
5099
|
+
"NSURLSessionTransferSizeUnknown",
|
|
5100
|
+
"NSURLSessionUploadTaskResumeData",
|
|
5101
|
+
"NSUTF16BigEndianStringEncoding",
|
|
5102
|
+
"NSUTF16LittleEndianStringEncoding",
|
|
5103
|
+
"NSUTF16StringEncoding",
|
|
5104
|
+
"NSUTF32BigEndianStringEncoding",
|
|
5105
|
+
"NSUTF32LittleEndianStringEncoding",
|
|
5106
|
+
"NSUTF32StringEncoding",
|
|
5107
|
+
"NSUTF8StringEncoding",
|
|
5108
|
+
"NSUbiquitousFileErrorMaximum",
|
|
5109
|
+
"NSUbiquitousFileErrorMinimum",
|
|
5110
|
+
"NSUbiquitousKeyValueStoreAccountChange",
|
|
5111
|
+
"NSUbiquitousKeyValueStoreChangeReasonKey",
|
|
5112
|
+
"NSUbiquitousKeyValueStoreChangedKeysKey",
|
|
5113
|
+
"NSUbiquitousKeyValueStoreInitialSyncChange",
|
|
5114
|
+
"NSUbiquitousKeyValueStoreQuotaViolationChange",
|
|
5115
|
+
"NSUbiquitousKeyValueStoreServerChange",
|
|
5116
|
+
"NSUndefinedDateComponent",
|
|
5117
|
+
"NSUndoCloseGroupingRunLoopOrdering",
|
|
5118
|
+
"NSUndoManagerGroupIsDiscardableKey",
|
|
5119
|
+
"NSUnicodeStringEncoding",
|
|
5120
|
+
"NSUserActivityErrorMaximum",
|
|
5121
|
+
"NSUserActivityErrorMinimum",
|
|
5122
|
+
"NSUserActivityTypeBrowsingWeb",
|
|
5123
|
+
"NSValidationErrorMaximum",
|
|
5124
|
+
"NSValidationErrorMinimum",
|
|
5125
|
+
"NSWindows95OperatingSystem",
|
|
5126
|
+
"NSWindowsCP1250StringEncoding",
|
|
5127
|
+
"NSWindowsCP1251StringEncoding",
|
|
5128
|
+
"NSWindowsCP1252StringEncoding",
|
|
5129
|
+
"NSWindowsCP1253StringEncoding",
|
|
5130
|
+
"NSWindowsCP1254StringEncoding",
|
|
5131
|
+
"NSWindowsNTOperatingSystem",
|
|
5132
|
+
"NSWrapCalendarComponents",
|
|
5133
|
+
"NSXPCConnectionCodeSigningRequirementFailure",
|
|
5134
|
+
"NSXPCConnectionErrorMaximum",
|
|
5135
|
+
"NSXPCConnectionErrorMinimum",
|
|
5136
|
+
"NS_BigEndian",
|
|
5137
|
+
"NS_LittleEndian",
|
|
5138
|
+
"NS_UnknownByteOrder",
|
|
5139
|
+
"kCFStringEncodingASCII"
|
|
5140
|
+
]);
|
|
5141
|
+
var CORE_FOUNDATION_OVERLAY_GLOBALS = /* @__PURE__ */ new Set([
|
|
5142
|
+
"kCFCoreFoundationVersionNumber10_0",
|
|
5143
|
+
"kCFCoreFoundationVersionNumber10_0_3",
|
|
5144
|
+
"kCFCoreFoundationVersionNumber10_1",
|
|
5145
|
+
"kCFCoreFoundationVersionNumber10_10",
|
|
5146
|
+
"kCFCoreFoundationVersionNumber10_10_1",
|
|
5147
|
+
"kCFCoreFoundationVersionNumber10_10_2",
|
|
5148
|
+
"kCFCoreFoundationVersionNumber10_10_3",
|
|
5149
|
+
"kCFCoreFoundationVersionNumber10_10_4",
|
|
5150
|
+
"kCFCoreFoundationVersionNumber10_10_5",
|
|
5151
|
+
"kCFCoreFoundationVersionNumber10_10_Max",
|
|
5152
|
+
"kCFCoreFoundationVersionNumber10_11",
|
|
5153
|
+
"kCFCoreFoundationVersionNumber10_11_1",
|
|
5154
|
+
"kCFCoreFoundationVersionNumber10_11_2",
|
|
5155
|
+
"kCFCoreFoundationVersionNumber10_11_3",
|
|
5156
|
+
"kCFCoreFoundationVersionNumber10_11_4",
|
|
5157
|
+
"kCFCoreFoundationVersionNumber10_11_Max",
|
|
5158
|
+
"kCFCoreFoundationVersionNumber10_1_1",
|
|
5159
|
+
"kCFCoreFoundationVersionNumber10_1_2",
|
|
5160
|
+
"kCFCoreFoundationVersionNumber10_1_3",
|
|
5161
|
+
"kCFCoreFoundationVersionNumber10_1_4",
|
|
5162
|
+
"kCFCoreFoundationVersionNumber10_2",
|
|
5163
|
+
"kCFCoreFoundationVersionNumber10_2_1",
|
|
5164
|
+
"kCFCoreFoundationVersionNumber10_2_2",
|
|
5165
|
+
"kCFCoreFoundationVersionNumber10_2_3",
|
|
5166
|
+
"kCFCoreFoundationVersionNumber10_2_4",
|
|
5167
|
+
"kCFCoreFoundationVersionNumber10_2_5",
|
|
5168
|
+
"kCFCoreFoundationVersionNumber10_2_6",
|
|
5169
|
+
"kCFCoreFoundationVersionNumber10_2_7",
|
|
5170
|
+
"kCFCoreFoundationVersionNumber10_2_8",
|
|
5171
|
+
"kCFCoreFoundationVersionNumber10_3",
|
|
5172
|
+
"kCFCoreFoundationVersionNumber10_3_1",
|
|
5173
|
+
"kCFCoreFoundationVersionNumber10_3_2",
|
|
5174
|
+
"kCFCoreFoundationVersionNumber10_3_3",
|
|
5175
|
+
"kCFCoreFoundationVersionNumber10_3_4",
|
|
5176
|
+
"kCFCoreFoundationVersionNumber10_3_5",
|
|
5177
|
+
"kCFCoreFoundationVersionNumber10_3_6",
|
|
5178
|
+
"kCFCoreFoundationVersionNumber10_3_7",
|
|
5179
|
+
"kCFCoreFoundationVersionNumber10_3_8",
|
|
5180
|
+
"kCFCoreFoundationVersionNumber10_3_9",
|
|
5181
|
+
"kCFCoreFoundationVersionNumber10_4",
|
|
5182
|
+
"kCFCoreFoundationVersionNumber10_4_1",
|
|
5183
|
+
"kCFCoreFoundationVersionNumber10_4_10",
|
|
5184
|
+
"kCFCoreFoundationVersionNumber10_4_11",
|
|
5185
|
+
"kCFCoreFoundationVersionNumber10_4_2",
|
|
5186
|
+
"kCFCoreFoundationVersionNumber10_4_3",
|
|
5187
|
+
"kCFCoreFoundationVersionNumber10_4_4_Intel",
|
|
5188
|
+
"kCFCoreFoundationVersionNumber10_4_4_PowerPC",
|
|
5189
|
+
"kCFCoreFoundationVersionNumber10_4_5_Intel",
|
|
5190
|
+
"kCFCoreFoundationVersionNumber10_4_5_PowerPC",
|
|
5191
|
+
"kCFCoreFoundationVersionNumber10_4_6_Intel",
|
|
5192
|
+
"kCFCoreFoundationVersionNumber10_4_6_PowerPC",
|
|
5193
|
+
"kCFCoreFoundationVersionNumber10_4_7",
|
|
5194
|
+
"kCFCoreFoundationVersionNumber10_4_8",
|
|
5195
|
+
"kCFCoreFoundationVersionNumber10_4_9",
|
|
5196
|
+
"kCFCoreFoundationVersionNumber10_5",
|
|
5197
|
+
"kCFCoreFoundationVersionNumber10_5_1",
|
|
5198
|
+
"kCFCoreFoundationVersionNumber10_5_2",
|
|
5199
|
+
"kCFCoreFoundationVersionNumber10_5_3",
|
|
5200
|
+
"kCFCoreFoundationVersionNumber10_5_4",
|
|
5201
|
+
"kCFCoreFoundationVersionNumber10_5_5",
|
|
5202
|
+
"kCFCoreFoundationVersionNumber10_5_6",
|
|
5203
|
+
"kCFCoreFoundationVersionNumber10_5_7",
|
|
5204
|
+
"kCFCoreFoundationVersionNumber10_5_8",
|
|
5205
|
+
"kCFCoreFoundationVersionNumber10_6",
|
|
5206
|
+
"kCFCoreFoundationVersionNumber10_6_1",
|
|
5207
|
+
"kCFCoreFoundationVersionNumber10_6_2",
|
|
5208
|
+
"kCFCoreFoundationVersionNumber10_6_3",
|
|
5209
|
+
"kCFCoreFoundationVersionNumber10_6_4",
|
|
5210
|
+
"kCFCoreFoundationVersionNumber10_6_5",
|
|
5211
|
+
"kCFCoreFoundationVersionNumber10_6_6",
|
|
5212
|
+
"kCFCoreFoundationVersionNumber10_6_7",
|
|
5213
|
+
"kCFCoreFoundationVersionNumber10_6_8",
|
|
5214
|
+
"kCFCoreFoundationVersionNumber10_7",
|
|
5215
|
+
"kCFCoreFoundationVersionNumber10_7_1",
|
|
5216
|
+
"kCFCoreFoundationVersionNumber10_7_2",
|
|
5217
|
+
"kCFCoreFoundationVersionNumber10_7_3",
|
|
5218
|
+
"kCFCoreFoundationVersionNumber10_7_4",
|
|
5219
|
+
"kCFCoreFoundationVersionNumber10_7_5",
|
|
5220
|
+
"kCFCoreFoundationVersionNumber10_8",
|
|
5221
|
+
"kCFCoreFoundationVersionNumber10_8_1",
|
|
5222
|
+
"kCFCoreFoundationVersionNumber10_8_2",
|
|
5223
|
+
"kCFCoreFoundationVersionNumber10_8_3",
|
|
5224
|
+
"kCFCoreFoundationVersionNumber10_8_4",
|
|
5225
|
+
"kCFCoreFoundationVersionNumber10_9",
|
|
5226
|
+
"kCFCoreFoundationVersionNumber10_9_1",
|
|
5227
|
+
"kCFCoreFoundationVersionNumber10_9_2",
|
|
5228
|
+
"kCFCoreFoundationVersionNumber_iOS_4_0",
|
|
5229
|
+
"kCFCoreFoundationVersionNumber_iOS_4_1",
|
|
5230
|
+
"kCFCoreFoundationVersionNumber_iOS_4_2",
|
|
5231
|
+
"kCFCoreFoundationVersionNumber_iOS_4_3",
|
|
5232
|
+
"kCFCoreFoundationVersionNumber_iOS_5_0",
|
|
5233
|
+
"kCFCoreFoundationVersionNumber_iOS_5_1",
|
|
5234
|
+
"kCFCoreFoundationVersionNumber_iOS_6_0",
|
|
5235
|
+
"kCFCoreFoundationVersionNumber_iOS_6_1",
|
|
5236
|
+
"kCFCoreFoundationVersionNumber_iOS_7_0",
|
|
5237
|
+
"kCFCoreFoundationVersionNumber_iOS_7_1",
|
|
5238
|
+
"kCFCoreFoundationVersionNumber_iOS_8_0",
|
|
5239
|
+
"kCFCoreFoundationVersionNumber_iOS_8_1",
|
|
5240
|
+
"kCFCoreFoundationVersionNumber_iOS_8_2",
|
|
5241
|
+
"kCFCoreFoundationVersionNumber_iOS_8_3",
|
|
5242
|
+
"kCFCoreFoundationVersionNumber_iOS_8_4",
|
|
5243
|
+
"kCFCoreFoundationVersionNumber_iOS_8_x_Max",
|
|
5244
|
+
"kCFCoreFoundationVersionNumber_iOS_9_0",
|
|
5245
|
+
"kCFCoreFoundationVersionNumber_iOS_9_1",
|
|
5246
|
+
"kCFCoreFoundationVersionNumber_iOS_9_2",
|
|
5247
|
+
"kCFCoreFoundationVersionNumber_iOS_9_3",
|
|
5248
|
+
"kCFCoreFoundationVersionNumber_iOS_9_4",
|
|
5249
|
+
"kCFCoreFoundationVersionNumber_iOS_9_x_Max",
|
|
5250
|
+
"kCFCoreFoundationVersionNumber_iPhoneOS_2_0",
|
|
5251
|
+
"kCFCoreFoundationVersionNumber_iPhoneOS_2_1",
|
|
5252
|
+
"kCFCoreFoundationVersionNumber_iPhoneOS_2_2",
|
|
5253
|
+
"kCFCoreFoundationVersionNumber_iPhoneOS_3_0",
|
|
5254
|
+
"kCFCoreFoundationVersionNumber_iPhoneOS_3_1",
|
|
5255
|
+
"kCFCoreFoundationVersionNumber_iPhoneOS_3_2"
|
|
5256
|
+
]);
|
|
5257
|
+
var CORE_FOUNDATION_GEOMETRY_TYPES = /* @__PURE__ */ new Set([
|
|
5258
|
+
"CGFloat",
|
|
5259
|
+
"CGPoint",
|
|
5260
|
+
"CGSize",
|
|
5261
|
+
"CGRect",
|
|
5262
|
+
"CGRectEdge"
|
|
5263
|
+
]);
|
|
5264
|
+
var CORE_FOUNDATION_GRAPHICS_TYPES = /* @__PURE__ */ new Set([
|
|
5265
|
+
"CGAffineTransform",
|
|
5266
|
+
"CGAffineTransformComponents",
|
|
5267
|
+
"CGVector"
|
|
5268
|
+
]);
|
|
5269
|
+
var CORE_FOUNDATION_HANDLE_IMPORTS = [
|
|
5270
|
+
"CFAllocator",
|
|
5271
|
+
"CFArray",
|
|
5272
|
+
"CFAttributedString",
|
|
5273
|
+
"CFBoolean",
|
|
5274
|
+
"CFData",
|
|
5275
|
+
"CFDate",
|
|
5276
|
+
"CFDictionary",
|
|
5277
|
+
"CFError",
|
|
5278
|
+
"CFMutableData",
|
|
5279
|
+
"CFNumber",
|
|
5280
|
+
"CFSet",
|
|
5281
|
+
"CFString",
|
|
5282
|
+
"CFURL"
|
|
5283
|
+
].map((name) => `import class CoreFoundation.${name}`).concat([
|
|
5284
|
+
"import typealias CoreFoundation.CFPropertyList",
|
|
5285
|
+
"import typealias CoreFoundation.CFTypeRef",
|
|
5286
|
+
"import CoreGraphics"
|
|
5287
|
+
]).join("; ");
|
|
4337
5288
|
function swiftSourceAsIOS(original, extraObjCExtensions, objc = objcIndex([original])) {
|
|
4338
5289
|
const source = liftExtensionOverrides(
|
|
4339
5290
|
lowerObjCRuntimeCalls(lowerObjCOptionalRequirements(original, objc), objc),
|
|
@@ -4381,21 +5332,55 @@ function swiftSourceAsIOS(original, extraObjCExtensions, objc = objcIndex([origi
|
|
|
4381
5332
|
const imported = /^import\s+([A-Za-z_]\w*)(?:\s*\.\s*[A-Za-z_]\w*)+/.exec(rest);
|
|
4382
5333
|
if (imported) {
|
|
4383
5334
|
out += conditioned.slice(copied, at) + `import ${imported[1]}`.padEnd(imported[0].length);
|
|
5335
|
+
if (imported[1] === "CoreFoundation") out += `; ${CORE_FOUNDATION_HANDLE_IMPORTS}`;
|
|
4384
5336
|
copied = at + imported[0].length;
|
|
4385
5337
|
continue;
|
|
4386
5338
|
}
|
|
5339
|
+
const coreFoundationImport = /^import\s+CoreFoundation\b/.exec(rest);
|
|
5340
|
+
if (coreFoundationImport) {
|
|
5341
|
+
out += conditioned.slice(copied, at) + coreFoundationImport[0] + `; ${CORE_FOUNDATION_HANDLE_IMPORTS}`;
|
|
5342
|
+
copied = at + coreFoundationImport[0].length;
|
|
5343
|
+
continue;
|
|
5344
|
+
}
|
|
4387
5345
|
if (/^NSClassFromString\b/.test(rest)) {
|
|
4388
5346
|
out += conditioned.slice(copied, at) + "_peachClassFromString";
|
|
4389
5347
|
copied = at + "NSClassFromString".length;
|
|
4390
5348
|
continue;
|
|
4391
5349
|
}
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
5350
|
+
const foundationMember = /^Foundation\s*\.\s*(?:`([A-Za-z_]\w*)`|([A-Za-z_]\w*)\b)/.exec(rest);
|
|
5351
|
+
const foundationName = foundationMember?.[1] ?? foundationMember?.[2];
|
|
5352
|
+
let foundationOwner;
|
|
5353
|
+
if (foundationName !== void 0) {
|
|
5354
|
+
if (foundationName === "NSClassFromString" || foundationName === "NSKeyValueChange" || foundationName === "NSKeyValueObservedChange" || foundationName === "NSKeyValueObservation")
|
|
5355
|
+
foundationOwner = "PeachObjC";
|
|
5356
|
+
else if (foundationName === "DispatchData") foundationOwner = "Dispatch";
|
|
5357
|
+
else if (FOUNDATION_NETWORKING_TYPES.has(foundationName))
|
|
5358
|
+
foundationOwner = "FoundationNetworking";
|
|
5359
|
+
else if (FOUNDATION_OVERLAY_TYPES.has(foundationName) || FOUNDATION_OVERLAY_GLOBALS.has(foundationName) || CORE_FOUNDATION_OVERLAY_GLOBALS.has(foundationName))
|
|
5360
|
+
foundationOwner = "PeachFoundation";
|
|
5361
|
+
}
|
|
5362
|
+
if (foundationOwner !== void 0) {
|
|
5363
|
+
out += conditioned.slice(copied, at) + foundationOwner;
|
|
4396
5364
|
copied = at + "Foundation".length;
|
|
4397
5365
|
continue;
|
|
4398
5366
|
}
|
|
5367
|
+
const coreFoundationMember = /^CoreFoundation\s*\.\s*(?:`([A-Za-z_]\w*)`|([A-Za-z_]\w*)\b)/.exec(rest);
|
|
5368
|
+
const coreFoundationName = coreFoundationMember?.[1] ?? coreFoundationMember?.[2];
|
|
5369
|
+
if (coreFoundationName !== void 0 && CORE_FOUNDATION_OVERLAY_GLOBALS.has(coreFoundationName)) {
|
|
5370
|
+
out += conditioned.slice(copied, at) + "PeachFoundation";
|
|
5371
|
+
copied = at + "CoreFoundation".length;
|
|
5372
|
+
continue;
|
|
5373
|
+
}
|
|
5374
|
+
if (coreFoundationName !== void 0 && CORE_FOUNDATION_GEOMETRY_TYPES.has(coreFoundationName)) {
|
|
5375
|
+
out += conditioned.slice(copied, at) + "Foundation";
|
|
5376
|
+
copied = at + "CoreFoundation".length;
|
|
5377
|
+
continue;
|
|
5378
|
+
}
|
|
5379
|
+
if (coreFoundationName !== void 0 && CORE_FOUNDATION_GRAPHICS_TYPES.has(coreFoundationName)) {
|
|
5380
|
+
out += conditioned.slice(copied, at) + "CoreGraphics";
|
|
5381
|
+
copied = at + "CoreFoundation".length;
|
|
5382
|
+
continue;
|
|
5383
|
+
}
|
|
4399
5384
|
if (rest.startsWith("class")) {
|
|
4400
5385
|
const declared2 = CLASS_BASE.exec(rest);
|
|
4401
5386
|
if (declared2 && reusableViews.has(declared2[2].split(".").pop())) {
|
|
@@ -4520,7 +5505,7 @@ function swiftApplicationEntry(file, source) {
|
|
|
4520
5505
|
else if (source[at] === "}") depth--;
|
|
4521
5506
|
else if (depth === 0 && /^@(?:main|UIApplicationMain)\b/.test(source.slice(at)))
|
|
4522
5507
|
return true;
|
|
4523
|
-
else if (depth === 0 &&
|
|
5508
|
+
else if (depth === 0 && path5.basename(file) === "main.swift" && /^UIApplicationMain\s*\(/.test(source.slice(at)))
|
|
4524
5509
|
return true;
|
|
4525
5510
|
}
|
|
4526
5511
|
return false;
|
|
@@ -4607,7 +5592,7 @@ function swiftCodeScan(source) {
|
|
|
4607
5592
|
else top.parens--;
|
|
4608
5593
|
i++;
|
|
4609
5594
|
} else {
|
|
4610
|
-
const keyword = source.startsWith("class", i) ? "class" : source.startsWith("extension", i) ? "extension" : source.startsWith("override", i) ? "override" : source.startsWith("import", i) ? "import" : source.startsWith("func", i) ? "func" : source.startsWith("UIApplicationMain", i) ? "UIApplicationMain" : source.startsWith("NSClassFromString", i) ? "NSClassFromString" : source.startsWith("Foundation", i) ? "Foundation" : null;
|
|
5595
|
+
const keyword = source.startsWith("class", i) ? "class" : source.startsWith("extension", i) ? "extension" : source.startsWith("override", i) ? "override" : source.startsWith("import", i) ? "import" : source.startsWith("func", i) ? "func" : source.startsWith("UIApplicationMain", i) ? "UIApplicationMain" : source.startsWith("NSClassFromString", i) ? "NSClassFromString" : source.startsWith("Foundation", i) ? "Foundation" : source.startsWith("CoreFoundation", i) ? "CoreFoundation" : null;
|
|
4611
5596
|
if (keyword && !/[\w$]/.test(source[i - 1] ?? "") && !/[\w$]/.test(source[i + keyword.length] ?? "")) {
|
|
4612
5597
|
tokens.push(i);
|
|
4613
5598
|
i += keyword.length;
|
|
@@ -4623,29 +5608,29 @@ function prepareSwiftDependency(source, destination) {
|
|
|
4623
5608
|
rmSync2(destination, { recursive: true, force: true });
|
|
4624
5609
|
const origins = {};
|
|
4625
5610
|
const gather = (from) => {
|
|
4626
|
-
for (const entry of
|
|
5611
|
+
for (const entry of readdirSync2(from, { withFileTypes: true })) {
|
|
4627
5612
|
if (entry.name === ".git" || entry.name === ".build" || entry.name === ".swiftpm")
|
|
4628
5613
|
continue;
|
|
4629
|
-
const file =
|
|
5614
|
+
const file = path5.join(from, entry.name);
|
|
4630
5615
|
if (entry.isDirectory()) gather(file);
|
|
4631
5616
|
else if (entry.isFile() && entry.name.endsWith(".swift"))
|
|
4632
|
-
origins[
|
|
5617
|
+
origins[path5.relative(source, file)] = readFileSync4(file, "utf8");
|
|
4633
5618
|
}
|
|
4634
5619
|
};
|
|
4635
5620
|
gather(source);
|
|
4636
|
-
const manifest =
|
|
4637
|
-
const targets = existsSync2(manifest) ? swiftManifestTargets(
|
|
5621
|
+
const manifest = path5.join(source, "Package.swift");
|
|
5622
|
+
const targets = existsSync2(manifest) ? swiftManifestTargets(readFileSync4(manifest, "utf8")) : [];
|
|
4638
5623
|
const compiled = compiledSwiftSources(origins, targets);
|
|
4639
5624
|
const copy = (from, to) => {
|
|
4640
5625
|
mkdirSync(to, { recursive: true });
|
|
4641
|
-
for (const entry of
|
|
5626
|
+
for (const entry of readdirSync2(from, { withFileTypes: true })) {
|
|
4642
5627
|
if (entry.name === ".git" || entry.name === ".build" || entry.name === ".swiftpm")
|
|
4643
5628
|
continue;
|
|
4644
|
-
const file =
|
|
4645
|
-
const target =
|
|
5629
|
+
const file = path5.join(from, entry.name);
|
|
5630
|
+
const target = path5.join(to, entry.name);
|
|
4646
5631
|
if (entry.isDirectory()) copy(file, target);
|
|
4647
5632
|
else if (entry.isFile() && entry.name.endsWith(".swift"))
|
|
4648
|
-
writeFileSync2(target, compiled.get(
|
|
5633
|
+
writeFileSync2(target, compiled.get(path5.relative(source, file)));
|
|
4649
5634
|
else cpSync(file, target, { verbatimSymlinks: true });
|
|
4650
5635
|
}
|
|
4651
5636
|
};
|
|
@@ -4662,7 +5647,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
4662
5647
|
const targets = distribution && compileTargets(input).length === 0 ? [
|
|
4663
5648
|
{
|
|
4664
5649
|
name: "App",
|
|
4665
|
-
path:
|
|
5650
|
+
path: path5.relative(layout.root, layout.sources),
|
|
4666
5651
|
executable: true,
|
|
4667
5652
|
languageMode: 5,
|
|
4668
5653
|
mainActorIsolation: false,
|
|
@@ -4671,7 +5656,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
4671
5656
|
] : compileTargets(input);
|
|
4672
5657
|
const files = /* @__PURE__ */ new Map();
|
|
4673
5658
|
const native = /* @__PURE__ */ new Map();
|
|
4674
|
-
const headerDirectory =
|
|
5659
|
+
const headerDirectory = path5.join(layout.root, ".build", "peach-cxx-headers");
|
|
4675
5660
|
for (const target of targets) {
|
|
4676
5661
|
const prefix = target.path === "." ? "" : `${target.path}/`;
|
|
4677
5662
|
const entries = Object.entries(input.files).filter(
|
|
@@ -4694,7 +5679,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
4694
5679
|
if (producer && targets.some((value) => value.name === producer))
|
|
4695
5680
|
producers.add(producer);
|
|
4696
5681
|
const local = [
|
|
4697
|
-
|
|
5682
|
+
path5.posix.join(path5.posix.dirname(file), include),
|
|
4698
5683
|
`${includes}${include}`
|
|
4699
5684
|
].find((candidate) => input.files[candidate] !== void 0);
|
|
4700
5685
|
if (local) {
|
|
@@ -4716,7 +5701,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
4716
5701
|
const late = units.filter(([file]) => consumers.get(file).size > 0);
|
|
4717
5702
|
native.set(target.name, {
|
|
4718
5703
|
path: target.path,
|
|
4719
|
-
includeDirectory:
|
|
5704
|
+
includeDirectory: path5.join(layout.root, includes),
|
|
4720
5705
|
lateSources: late.map(([file]) => file.slice(prefix.length)),
|
|
4721
5706
|
...late.length > 0 ? {
|
|
4722
5707
|
late: {
|
|
@@ -4733,7 +5718,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
4733
5718
|
([file]) => file.startsWith(includes) && /\.(?:h|hpp|hh|hxx)$/.test(file) && consumers.get(file).size === 0
|
|
4734
5719
|
);
|
|
4735
5720
|
files.set(
|
|
4736
|
-
|
|
5721
|
+
path5.join(layout.root, includes, "module.modulemap"),
|
|
4737
5722
|
[
|
|
4738
5723
|
`module ${target.name} {`,
|
|
4739
5724
|
...roots.map(
|
|
@@ -4746,13 +5731,13 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
4746
5731
|
);
|
|
4747
5732
|
}
|
|
4748
5733
|
if (native.size > 0) mkdirSync(headerDirectory, { recursive: true });
|
|
4749
|
-
const modulePlan =
|
|
5734
|
+
const modulePlan = createHash4("sha256").update(
|
|
4750
5735
|
swiftModuleInputFiles(moduleRoot).join("\n")
|
|
4751
5736
|
);
|
|
4752
5737
|
if (!distribution) {
|
|
4753
|
-
modulePlan.update(
|
|
5738
|
+
modulePlan.update(readFileSync4(path5.join(moduleRoot, "Package.swift")));
|
|
4754
5739
|
}
|
|
4755
|
-
const resourcePlan =
|
|
5740
|
+
const resourcePlan = createHash4("sha256").update(
|
|
4756
5741
|
JSON.stringify(
|
|
4757
5742
|
resourceTargets.filter((target) => target.resources).map((target) => [
|
|
4758
5743
|
target.name,
|
|
@@ -4777,10 +5762,10 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
4777
5762
|
if (targets.length === 0) {
|
|
4778
5763
|
for (const [file, contents] of Object.entries(input.files)) {
|
|
4779
5764
|
if (file === "Package.swift") continue;
|
|
4780
|
-
files.set(
|
|
5765
|
+
files.set(path5.join(layout.sources, file), compiled.get(file) ?? contents);
|
|
4781
5766
|
}
|
|
4782
|
-
let manifest =
|
|
4783
|
-
|
|
5767
|
+
let manifest = readFileSync4(
|
|
5768
|
+
path5.join(moduleRoot, "scripts/contrast-app-Package.swift"),
|
|
4784
5769
|
"utf8"
|
|
4785
5770
|
).replaceAll("__SOOTSIM_SWIFT_PACKAGE__", moduleRoot);
|
|
4786
5771
|
const reactor = ` ${REACTOR_FLAG}`;
|
|
@@ -4824,21 +5809,21 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
4824
5809
|
manifest = manifest.replace(anchor, `${anchor}
|
|
4825
5810
|
${SPRITEKIT_PRODUCT},`);
|
|
4826
5811
|
}
|
|
4827
|
-
files.set(
|
|
5812
|
+
files.set(path5.join(layout.root, "Package.swift"), manifest + moduleFiles);
|
|
4828
5813
|
} else {
|
|
4829
5814
|
const base = layout.multi ? layout.root : layout.sources;
|
|
4830
5815
|
const libraries = /* @__PURE__ */ new Map();
|
|
4831
5816
|
for (const [target, data] of Object.entries(input.libraries ?? {})) {
|
|
4832
|
-
const file =
|
|
5817
|
+
const file = path5.join(layout.root, ".peach-libraries", `lib${target}.a`);
|
|
4833
5818
|
files.set(file, Buffer.from(data, "base64"));
|
|
4834
5819
|
libraries.set(target, file);
|
|
4835
5820
|
}
|
|
4836
5821
|
for (const [file, contents] of Object.entries(input.files)) {
|
|
4837
5822
|
if (file === "Package.swift") continue;
|
|
4838
|
-
files.set(
|
|
5823
|
+
files.set(path5.join(base, file), compiled.get(file) ?? contents);
|
|
4839
5824
|
}
|
|
4840
5825
|
files.set(
|
|
4841
|
-
|
|
5826
|
+
path5.join(layout.root, "Package.swift"),
|
|
4842
5827
|
emitSwiftPackageManifest({
|
|
4843
5828
|
targets,
|
|
4844
5829
|
native,
|
|
@@ -4855,7 +5840,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
4855
5840
|
spriteKit: importsSpriteKit(input.files),
|
|
4856
5841
|
distribution: distribution ?? void 0,
|
|
4857
5842
|
distributionLink: {
|
|
4858
|
-
path:
|
|
5843
|
+
path: path5.join(layout.root, ".peach-distribution-objects.rsp"),
|
|
4859
5844
|
files
|
|
4860
5845
|
},
|
|
4861
5846
|
libraries
|
|
@@ -4871,9 +5856,9 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
4871
5856
|
throw new Error(
|
|
4872
5857
|
`swift resource target ${target.name} has no matching bundle assignment`
|
|
4873
5858
|
);
|
|
4874
|
-
const directory = layout.multi ?
|
|
5859
|
+
const directory = layout.multi ? path5.join(layout.root, target.path) : layout.sources;
|
|
4875
5860
|
files.set(
|
|
4876
|
-
|
|
5861
|
+
path5.join(directory, "ResourceBundleAccessor.generated.swift"),
|
|
4877
5862
|
[
|
|
4878
5863
|
"import Foundation",
|
|
4879
5864
|
"",
|
|
@@ -4906,15 +5891,15 @@ function outputOf(error) {
|
|
|
4906
5891
|
return error instanceof Error ? error.message : String(error);
|
|
4907
5892
|
}
|
|
4908
5893
|
function builtArtifact(layout) {
|
|
4909
|
-
const binDir =
|
|
4910
|
-
const manifest =
|
|
5894
|
+
const binDir = path5.join(layout.root, ".build", WASM_TRIPLE, "release");
|
|
5895
|
+
const manifest = readFileSync4(path5.join(layout.root, "Package.swift"), "utf8");
|
|
4911
5896
|
const executable = swiftManifestTargets(manifest).find((target) => target.executable);
|
|
4912
5897
|
if (executable === void 0) {
|
|
4913
5898
|
throw new Error("swift-compile: the written manifest names no executable target");
|
|
4914
5899
|
}
|
|
4915
|
-
const file =
|
|
5900
|
+
const file = path5.join(binDir, `${executable.name}.wasm`);
|
|
4916
5901
|
if (!existsSync2(file)) {
|
|
4917
|
-
const found = existsSync2(binDir) ?
|
|
5902
|
+
const found = existsSync2(binDir) ? readdirSync2(binDir).filter((name) => name.endsWith(".wasm")).sort() : [];
|
|
4918
5903
|
throw new Error(
|
|
4919
5904
|
`swift-compile: the build produced no ${executable.name}.wasm (found: ${found.join(", ") || "none"})`
|
|
4920
5905
|
);
|
|
@@ -4923,7 +5908,7 @@ function builtArtifact(layout) {
|
|
|
4923
5908
|
}
|
|
4924
5909
|
function projectDiagnostic(output, layout, files) {
|
|
4925
5910
|
const base = layout.multi ? layout.root : layout.sources;
|
|
4926
|
-
const prefix = `${base}${
|
|
5911
|
+
const prefix = `${base}${path5.sep}`;
|
|
4927
5912
|
return designTimeDiagnostic(output, files).split("\n").map((line) => line.startsWith(prefix) ? line.slice(prefix.length) : line).join("\n").trim();
|
|
4928
5913
|
}
|
|
4929
5914
|
var ROOT_LOCKS = Symbol.for("peachsim.swiftCompile.rootLocks");
|
|
@@ -4959,13 +5944,13 @@ function serialize(root, work, signal) {
|
|
|
4959
5944
|
function readCompiledArtifact(directory, hash) {
|
|
4960
5945
|
try {
|
|
4961
5946
|
const receipt = JSON.parse(
|
|
4962
|
-
|
|
5947
|
+
readFileSync4(path5.join(directory, "artifact.json"), "utf8")
|
|
4963
5948
|
);
|
|
4964
5949
|
if (!receipt || typeof receipt !== "object" || !("hash" in receipt) || receipt.hash !== hash || !("icu" in receipt) || typeof receipt.icu !== "string" || !("wasm" in receipt) || typeof receipt.wasm !== "string")
|
|
4965
5950
|
return null;
|
|
4966
|
-
const bytes =
|
|
4967
|
-
const gzip2 =
|
|
4968
|
-
if (
|
|
5951
|
+
const bytes = readFileSync4(path5.join(directory, "app.wasm"));
|
|
5952
|
+
const gzip2 = readFileSync4(path5.join(directory, "icu.gz"));
|
|
5953
|
+
if (createHash4("sha256").update(bytes).digest("hex") !== receipt.wasm || createHash4("sha256").update(gzip2).digest("hex") !== receipt.icu || bytes.length < 8 || bytes.readUInt32LE(0) !== 1836278016 || bytes.readUInt32LE(4) !== 1)
|
|
4969
5954
|
return null;
|
|
4970
5955
|
return { hash, bytes, icu: { sha256: receipt.icu, gzip: gzip2 } };
|
|
4971
5956
|
} catch (error) {
|
|
@@ -4975,22 +5960,22 @@ function readCompiledArtifact(directory, hash) {
|
|
|
4975
5960
|
}
|
|
4976
5961
|
}
|
|
4977
5962
|
function saveCompiledArtifact(root, artifact) {
|
|
4978
|
-
const directory =
|
|
5963
|
+
const directory = path5.join(root, "artifact");
|
|
4979
5964
|
mkdirSync(directory, { recursive: true });
|
|
4980
|
-
const pending = mkdtempSync2(
|
|
5965
|
+
const pending = mkdtempSync2(path5.join(root, ".artifact-"));
|
|
4981
5966
|
try {
|
|
4982
|
-
writeFileSync2(
|
|
4983
|
-
writeFileSync2(
|
|
5967
|
+
writeFileSync2(path5.join(pending, "app.wasm"), artifact.bytes);
|
|
5968
|
+
writeFileSync2(path5.join(pending, "icu.gz"), artifact.icu.gzip);
|
|
4984
5969
|
writeFileSync2(
|
|
4985
|
-
|
|
5970
|
+
path5.join(pending, "artifact.json"),
|
|
4986
5971
|
JSON.stringify({
|
|
4987
5972
|
hash: artifact.hash,
|
|
4988
|
-
wasm:
|
|
5973
|
+
wasm: createHash4("sha256").update(artifact.bytes).digest("hex"),
|
|
4989
5974
|
icu: artifact.icu.sha256
|
|
4990
5975
|
})
|
|
4991
5976
|
);
|
|
4992
5977
|
for (const file of ["app.wasm", "icu.gz", "artifact.json"]) {
|
|
4993
|
-
renameSync(
|
|
5978
|
+
renameSync(path5.join(pending, file), path5.join(directory, file));
|
|
4994
5979
|
}
|
|
4995
5980
|
} finally {
|
|
4996
5981
|
rmSync2(pending, { recursive: true, force: true });
|
|
@@ -5011,24 +5996,35 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
5011
5996
|
options.signal?.throwIfAborted();
|
|
5012
5997
|
mkdirSync(options.buildRoot, { recursive: true });
|
|
5013
5998
|
const root = realpathSync(options.buildRoot);
|
|
5014
|
-
const moduleRoot =
|
|
5999
|
+
const moduleRoot = path5.resolve(options.moduleRoot);
|
|
5015
6000
|
const layout = {
|
|
5016
6001
|
root,
|
|
5017
|
-
sources:
|
|
6002
|
+
sources: path5.join(root, "Sources", "App"),
|
|
5018
6003
|
multi: compileTargets(input).length > 0
|
|
5019
6004
|
};
|
|
5020
6005
|
const hash = swiftArtifactHash(input, options.release, moduleRoot);
|
|
6006
|
+
const sharedRoot = path5.join(rnxHomeDir(), "cache", "swift-projects", hash);
|
|
6007
|
+
const report = (message) => console.error(`[swift-project ${hash.slice(0, 16)}] ${message}`);
|
|
6008
|
+
report("checking verified artifacts");
|
|
5021
6009
|
return serialize(
|
|
5022
6010
|
root,
|
|
5023
6011
|
async () => {
|
|
5024
6012
|
const retained = retainedArtifacts.get(root)?.find((old) => old.hash === hash);
|
|
5025
|
-
if (retained)
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
6013
|
+
if (retained) {
|
|
6014
|
+
report("reusing memory artifact");
|
|
6015
|
+
return retain(root, retained);
|
|
6016
|
+
}
|
|
6017
|
+
const cached = readCompiledArtifact(path5.join(sharedRoot, "artifact"), hash);
|
|
6018
|
+
const previous = cached ?? readCompiledArtifact(path5.join(root, "artifact"), hash);
|
|
6019
|
+
if (previous) {
|
|
6020
|
+
if (!cached) saveCompiledArtifact(sharedRoot, previous);
|
|
6021
|
+
report("reusing verified disk artifact");
|
|
6022
|
+
return retain(root, previous);
|
|
6023
|
+
}
|
|
6024
|
+
if (process.platform === "darwin" && process.env.TM_SESSION && !admittedMacBuilderSlot() && process.env.CI !== "true" && moduleRoot === path5.resolve(import.meta.dirname, "../../sootsim-swift") && !swiftDistributionAt(moduleRoot)) {
|
|
6025
|
+
const requestRoot = mkdtempSync2(path5.join(root, ".builder-request-"));
|
|
6026
|
+
const output = path5.join(requestRoot, "output");
|
|
6027
|
+
const request = path5.join(requestRoot, "request.json");
|
|
5032
6028
|
writeFileSync2(
|
|
5033
6029
|
request,
|
|
5034
6030
|
JSON.stringify({
|
|
@@ -5036,15 +6032,19 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
5036
6032
|
hash,
|
|
5037
6033
|
release: options.release,
|
|
5038
6034
|
timeoutMs: options.timeoutMs,
|
|
5039
|
-
|
|
6035
|
+
// the builder's swiftpm tree holds the sootsim-swift objects, which
|
|
6036
|
+
// depend on the toolchain and sdk and not on the caller's checkout
|
|
6037
|
+
// path, so every caller shares one warm tree per toolchain.
|
|
6038
|
+
buildKey: createHash4("sha256").update(`${options.release}\0${swiftModuleSdk(moduleRoot).wasmSdkId}`).digest("hex").slice(0, 32)
|
|
5040
6039
|
})
|
|
5041
6040
|
);
|
|
5042
6041
|
try {
|
|
5043
|
-
const repo =
|
|
6042
|
+
const repo = path5.resolve(moduleRoot, "../..");
|
|
6043
|
+
report("requesting builder admission or cached result");
|
|
5044
6044
|
await runCompiler(
|
|
5045
6045
|
"bun",
|
|
5046
6046
|
[
|
|
5047
|
-
|
|
6047
|
+
path5.join(repo, "scripts/build/swift-project.ts"),
|
|
5048
6048
|
"--request",
|
|
5049
6049
|
request,
|
|
5050
6050
|
"--output",
|
|
@@ -5068,18 +6068,21 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
5068
6068
|
);
|
|
5069
6069
|
}
|
|
5070
6070
|
saveCompiledArtifact(root, artifact2);
|
|
6071
|
+
saveCompiledArtifact(sharedRoot, artifact2);
|
|
6072
|
+
report("builder artifact verified");
|
|
5071
6073
|
return retain(root, artifact2);
|
|
5072
6074
|
} finally {
|
|
5073
6075
|
rmSync2(requestRoot, { recursive: true, force: true });
|
|
5074
6076
|
}
|
|
5075
6077
|
}
|
|
5076
6078
|
writeSwiftProject(layout, input, moduleRoot);
|
|
5077
|
-
const swift =
|
|
6079
|
+
const swift = path5.join(options.toolchainBin, "swift");
|
|
5078
6080
|
if (!existsSync2(swift)) {
|
|
5079
6081
|
throw new Error(
|
|
5080
6082
|
`swift-compile: no swift.org toolchain at ${options.toolchainBin}; install ${options.release} and its matching wasm sdk`
|
|
5081
6083
|
);
|
|
5082
6084
|
}
|
|
6085
|
+
report("preparing compiler plugins");
|
|
5083
6086
|
const macroPlugins = await ensureMacroPlugins(
|
|
5084
6087
|
moduleRoot,
|
|
5085
6088
|
options.toolchainBin,
|
|
@@ -5090,12 +6093,14 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
5090
6093
|
const icu = swiftIcuAsset(options.toolchainBin, sdk);
|
|
5091
6094
|
const buildArgs = [
|
|
5092
6095
|
"build",
|
|
6096
|
+
...swiftPackageCacheOptions(),
|
|
5093
6097
|
"--build-system",
|
|
5094
6098
|
"native",
|
|
5095
6099
|
"-j",
|
|
5096
6100
|
BUILD_JOBS,
|
|
5097
6101
|
"--package-path",
|
|
5098
6102
|
root,
|
|
6103
|
+
...swiftSdkOptions(),
|
|
5099
6104
|
"--swift-sdk",
|
|
5100
6105
|
sdk,
|
|
5101
6106
|
"-c",
|
|
@@ -5119,8 +6124,8 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
5119
6124
|
// shipped host plugins resolve against the selected compiler's runtime.
|
|
5120
6125
|
...process.platform === "linux" ? {
|
|
5121
6126
|
LD_LIBRARY_PATH: [
|
|
5122
|
-
|
|
5123
|
-
|
|
6127
|
+
path5.resolve(options.toolchainBin, "../lib/swift/linux"),
|
|
6128
|
+
path5.resolve(options.toolchainBin, "../lib/swift/host"),
|
|
5124
6129
|
process.env.LD_LIBRARY_PATH
|
|
5125
6130
|
].filter(Boolean).join(":")
|
|
5126
6131
|
} : {}
|
|
@@ -5129,11 +6134,12 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
5129
6134
|
timeout: options.timeoutMs,
|
|
5130
6135
|
signal: options.signal
|
|
5131
6136
|
};
|
|
6137
|
+
report("compiling and linking Swift modules");
|
|
5132
6138
|
try {
|
|
5133
|
-
await runCompiler(swift, buildArgs, buildOptions);
|
|
6139
|
+
await runCompiler(swift, buildArgs, buildOptions, true);
|
|
5134
6140
|
} catch (error) {
|
|
5135
6141
|
const output = outputOf(error);
|
|
5136
|
-
const moduleCache =
|
|
6142
|
+
const moduleCache = path5.join(
|
|
5137
6143
|
root,
|
|
5138
6144
|
".build",
|
|
5139
6145
|
WASM_TRIPLE,
|
|
@@ -5143,7 +6149,7 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
5143
6149
|
if (output.includes("was compiled with module cache path") && existsSync2(moduleCache)) {
|
|
5144
6150
|
rmSync2(moduleCache, { recursive: true, force: true });
|
|
5145
6151
|
try {
|
|
5146
|
-
await runCompiler(swift, buildArgs, buildOptions);
|
|
6152
|
+
await runCompiler(swift, buildArgs, buildOptions, true);
|
|
5147
6153
|
} catch (retryError) {
|
|
5148
6154
|
throw new Error(
|
|
5149
6155
|
projectDiagnostic(outputOf(retryError), layout, input.files),
|
|
@@ -5160,10 +6166,12 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
5160
6166
|
}
|
|
5161
6167
|
const artifact = {
|
|
5162
6168
|
hash,
|
|
5163
|
-
bytes:
|
|
6169
|
+
bytes: readFileSync4(builtArtifact(layout)),
|
|
5164
6170
|
icu: await icu
|
|
5165
6171
|
};
|
|
5166
6172
|
saveCompiledArtifact(root, artifact);
|
|
6173
|
+
saveCompiledArtifact(sharedRoot, artifact);
|
|
6174
|
+
report("compiled artifact verified");
|
|
5167
6175
|
return retain(root, artifact);
|
|
5168
6176
|
},
|
|
5169
6177
|
options.signal
|
|
@@ -5186,6 +6194,7 @@ export {
|
|
|
5186
6194
|
swiftApplicationEntry,
|
|
5187
6195
|
swiftArtifactHash,
|
|
5188
6196
|
swiftAvailableModules,
|
|
6197
|
+
swiftCodeMask,
|
|
5189
6198
|
swiftDistributionAt,
|
|
5190
6199
|
swiftIcuAsset,
|
|
5191
6200
|
swiftImportNames,
|