peachsim 0.1.1625 → 0.1.1640
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 +15 -2
- package/cli/app-config.ts +18 -6
- package/cli/app-fonts.ts +37 -17
- package/cli/app-stubs.ts +284 -20
- package/cli/bridge-flow-runner.ts +66 -45
- package/cli/cloud-client.ts +60 -40
- package/cli/command-registry.ts +1 -0
- package/cli/commands/control.ts +283 -49
- package/cli/commands/doctor.ts +30 -189
- package/cli/commands/flow.ts +79 -11
- package/cli/commands/inspect/core.ts +10 -5
- package/cli/commands/inspect/settling.ts +14 -2
- package/cli/commands/inspect/shared.ts +9 -4
- package/cli/commands/inspect/wait-ready.ts +12 -0
- package/cli/commands/inspect.ts +91 -50
- package/cli/commands/install-desktop.ts +1 -0
- package/cli/commands/maestro-compare.ts +97 -38
- package/cli/commands/maestro.ts +9 -1
- package/cli/commands/preview.ts +1 -1
- package/cli/commands/record.ts +118 -48
- 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 +14 -3
- package/cli/commands/upload.ts +93 -48
- package/cli/desktop-companion.ts +102 -17
- package/cli/drivers/desktop.ts +14 -1
- package/cli/drivers/playwright-sim-host.ts +103 -45
- package/cli/drivers/playwright.ts +9 -8
- package/cli/drivers/types.ts +5 -0
- package/cli/maestro-accessibility.ts +1 -1
- package/cli/maestro-compare.ts +84 -12
- package/cli/main.ts +3 -2
- package/cli/outbound-endpoints.ts +20 -6
- package/cli/pause-aware-timeout.ts +106 -0
- package/cli/scene-video.ts +89 -0
- package/cli/ws-bridge.ts +37 -19
- package/detox/attempt-events.cjs +66 -5
- package/detox/attempt-events.d.cts +7 -0
- package/detox/expectations.ts +7 -3
- package/detox/index.ts +269 -170
- package/detox/motion-change.cjs +206 -21
- package/detox/motion-change.d.cts +39 -2
- package/detox/navigation-lifecycle.ts +35 -3
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +8 -7
- 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 +11887 -7900
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +6 -3
- package/dist-lib/config.mjs +6 -3
- package/dist-lib/detox/index.cjs +1379 -725
- package/dist-lib/dev-bundle-resolution.cjs +14 -2
- package/dist-lib/expo-swift-bundle.cjs +9341 -5462
- package/dist-lib/expo-swift-metadata.cjs +11 -7
- package/dist-lib/expo-swift-metadata.mjs +11 -7
- package/dist-lib/home-paths.cjs +32 -3
- package/dist-lib/host/bridge-host.cjs +50204 -7258
- 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 +3541 -448
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +2931 -104
- package/dist-lib/native-app-identity-project.cjs +289 -49
- package/dist-lib/native-app-identity-project.mjs +289 -49
- package/dist-lib/native-app-identity.cjs +77 -26
- package/dist-lib/native-app-identity.mjs +76 -26
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/react-native-host-modules.cjs +6 -2
- package/dist-lib/react-native-host-modules.mjs +6 -2
- package/dist-lib/scripts/dev-server-scanner.cjs +22 -8
- package/dist-lib/sdk.cjs +27 -11
- package/dist-lib/sdk.mjs +27 -10
- package/dist-lib/skills.cjs +72201 -26208
- package/dist-lib/swift-compile.cjs +1007 -140
- package/dist-lib/swift-compile.mjs +1049 -174
- package/dist-lib/swift-package.cjs +12 -3
- package/dist-lib/swift-package.mjs +12 -3
- package/dist-lib/swift-submit.cjs +13 -5
- package/dist-lib/swift-submit.mjs +11 -5
- package/dist-lib/swift-toolchain.cjs +423 -33
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +8628 -5268
- package/dist-lib/vite.cjs +2859 -12
- package/dist-lib/worklet-executable.cjs +14 -2
- package/dist-lib/worklet-executable.mjs +14 -2
- package/kotlin/AppSources/dev/peach/app/PeachDrawable.kt +21 -14
- package/kotlin/Sources/androidx/annotation/DrawableRes.kt +14 -0
- package/package.json +1 -1
- package/scripts/dev-server-scanner.ts +2 -1
- package/skills/peach-perf/SKILL.md +11 -5
- package/skills/peach-setup/SKILL.md +16 -19
- package/src/backend-origin.ts +13 -6
- package/src/bridge-constants.ts +11 -0
- package/src/bridge-contract.ts +22 -34
- package/src/config.ts +15 -0
- package/src/desktop-host-delivery.ts +5 -1
- package/src/dev-bundle-resolution.ts +2 -1
- package/src/expo-manifest-body.ts +13 -0
- package/src/expo-swift-host.ts +196 -49
- package/src/expo-swift-ready.ts +78 -0
- package/src/expoKotlinContract.ts +4 -7
- package/src/expoSwiftContract.ts +17 -6
- package/src/home-paths.ts +48 -2
- package/src/host/bridge-host.ts +5 -2
- package/src/host/staged-host-files.ts +9 -0
- package/src/native-app-identity-project.ts +27 -6
- package/src/native-app-identity.ts +91 -4
- package/src/native-firebase-config.ts +209 -13
- package/src/nativeAppIconContract.ts +1 -4
- package/src/output-lock-stdio.ts +36 -0
- package/src/process-group.ts +25 -2
- package/src/react-native-bridge-modules.ts +431 -0
- package/src/react-native-host-modules.ts +8 -1
- package/src/settings-bundle.ts +1 -4
- package/src/swift-binary-modules.ts +2 -2
- package/src/swift-compile.ts +918 -109
- package/src/swift-compiler-digest.ts +14 -0
- package/src/swift-distribution.lock.json +24 -12
- package/src/swift-distribution.ts +103 -4
- package/src/swift-host.ts +180 -55
- package/src/swift-icu.ts +27 -13
- package/src/swift-objc-compile.ts +355 -0
- package/src/swift-objc-sdk.ts +821 -27
- package/src/swift-objc-standin.ts +148 -14
- package/src/swift-package-manifest.ts +60 -7
- package/src/swift-package.ts +15 -1
- package/src/swift-packages.ts +154 -81
- package/src/swift-standin-emit.ts +96 -15
- package/src/swift-standins.ts +530 -116
- package/src/swift-submit.ts +13 -5
- package/src/swift-toolchain.ts +500 -42
- package/src/vite-plugin.ts +12 -1
- package/src/worker-system-chunks.ts +11 -12
- package/src/worklet-executable.ts +19 -1
- package/src/xcode-project.ts +270 -30
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1640 | (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
|
|
11
|
+
readFileSync as readFileSync4,
|
|
12
12
|
readdirSync as readdirSync2,
|
|
13
13
|
realpathSync,
|
|
14
14
|
renameSync,
|
|
@@ -16,8 +16,8 @@ import {
|
|
|
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
23
|
import { spawnSync } from "node:child_process";
|
|
@@ -56,6 +56,16 @@ function rnxHomeDir() {
|
|
|
56
56
|
if (override && override.length > 0) return path.resolve(override);
|
|
57
57
|
return path.join(homedir(), ".peach");
|
|
58
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
|
+
]);
|
|
68
|
+
}
|
|
59
69
|
var DAEMON_LOCKFILE_MAX_BYTES = 16 * 1024;
|
|
60
70
|
|
|
61
71
|
// src/process-group.ts
|
|
@@ -73,6 +83,7 @@ import { join } from "node:path";
|
|
|
73
83
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
74
84
|
var GRACEFUL_TIMEOUT_MS = 3e3;
|
|
75
85
|
var FORCED_EXIT_TIMEOUT_MS = 1e3;
|
|
86
|
+
var FREEZE_GUARD_NAME = "process-freeze-guard";
|
|
76
87
|
function listProcessChildren(parents, timeoutMs = 3e3) {
|
|
77
88
|
if (parents.some((pid) => !Number.isInteger(pid) || pid <= 1))
|
|
78
89
|
throw new Error("process inspection requires valid parent pids");
|
|
@@ -159,7 +170,7 @@ pid ${rootPid}
|
|
|
159
170
|
'
|
|
160
171
|
if ! IFS= read -r command || [ "$command" != disarm ]; then cleanup; fi
|
|
161
172
|
`,
|
|
162
|
-
|
|
173
|
+
FREEZE_GUARD_NAME,
|
|
163
174
|
journal
|
|
164
175
|
],
|
|
165
176
|
{
|
|
@@ -205,6 +216,21 @@ pid ${rootPid}
|
|
|
205
216
|
}
|
|
206
217
|
};
|
|
207
218
|
}
|
|
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
|
+
}
|
|
208
234
|
function processesHaveExited(pids, pgid) {
|
|
209
235
|
const mayExist = [-pgid, ...pids].some((target) => {
|
|
210
236
|
try {
|
|
@@ -268,7 +294,7 @@ async function terminateProcessGroup(child, signal = "SIGTERM", gracefulTimeoutM
|
|
|
268
294
|
}
|
|
269
295
|
let children;
|
|
270
296
|
try {
|
|
271
|
-
children = listProcessChildren(parents, remaining);
|
|
297
|
+
children = withoutFreezeGuards(listProcessChildren(parents, remaining));
|
|
272
298
|
} catch (error) {
|
|
273
299
|
inspectionError = new Error(`could not inspect descendants: ${String(error)}`);
|
|
274
300
|
break;
|
|
@@ -356,6 +382,11 @@ async function terminateProcessGroup(child, signal = "SIGTERM", gracefulTimeoutM
|
|
|
356
382
|
if (inspectionError) throw inspectionError;
|
|
357
383
|
}
|
|
358
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
|
+
|
|
359
390
|
// src/swift-design-time.ts
|
|
360
391
|
var IDENT = /[A-Za-z_À-$0-9]/;
|
|
361
392
|
function tokenize(source) {
|
|
@@ -702,9 +733,9 @@ var EXCERPT = /^(\s*)(\d+)( \| )(.*)$/;
|
|
|
702
733
|
var MARKER = /^(\s*)( \| )(.*)$/;
|
|
703
734
|
function designTimeDiagnostic(output, files) {
|
|
704
735
|
const rewritten = /* @__PURE__ */ new Map();
|
|
705
|
-
const linesOf = (
|
|
736
|
+
const linesOf = (path6) => {
|
|
706
737
|
const file = Object.keys(files).find(
|
|
707
|
-
(name) => name.endsWith(".swift") && (
|
|
738
|
+
(name) => name.endsWith(".swift") && (path6 === name || path6.endsWith(`/${name}`))
|
|
708
739
|
);
|
|
709
740
|
if (file === void 0) return null;
|
|
710
741
|
let lines = rewritten.get(file);
|
|
@@ -785,11 +816,31 @@ function parseSwiftDistributionManifest(value) {
|
|
|
785
816
|
|
|
786
817
|
// src/swift-icu.ts
|
|
787
818
|
import { execFile } from "node:child_process";
|
|
788
|
-
import { createHash } from "node:crypto";
|
|
789
|
-
import { existsSync, readFileSync as
|
|
790
|
-
import
|
|
819
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
820
|
+
import { existsSync, readFileSync as readFileSync3 } from "node:fs";
|
|
821
|
+
import path4 from "node:path";
|
|
791
822
|
import { promisify } from "node:util";
|
|
792
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
|
+
import { fileURLToPath } from "node:url";
|
|
832
|
+
function swiftSdkOptions() {
|
|
833
|
+
const directory = process.env.PEACH_SWIFT_SDKS_PATH;
|
|
834
|
+
return directory ? ["--swift-sdks-path", path3.resolve(directory)] : [];
|
|
835
|
+
}
|
|
836
|
+
var scratch;
|
|
837
|
+
var swiftHome;
|
|
838
|
+
function swiftEnvironment(base = process.env) {
|
|
839
|
+
if (!scratch) return base;
|
|
840
|
+
return swiftHome ? { ...base, TMPDIR: scratch, HOME: swiftHome } : { ...base, TMPDIR: scratch };
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
// src/swift-icu.ts
|
|
793
844
|
var run = promisify(execFile);
|
|
794
845
|
var deflate = promisify(gzip);
|
|
795
846
|
var ARCHIVE = "wasi/lib_FoundationICU.a";
|
|
@@ -806,32 +857,47 @@ function memo(cache, key, load2) {
|
|
|
806
857
|
return pending;
|
|
807
858
|
}
|
|
808
859
|
function swiftIcuData(toolchainBin, sdk) {
|
|
809
|
-
return memo(
|
|
860
|
+
return memo(
|
|
861
|
+
raw,
|
|
862
|
+
JSON.stringify([toolchainBin, sdk, swiftSdkOptions()]),
|
|
863
|
+
() => load(toolchainBin, sdk)
|
|
864
|
+
);
|
|
810
865
|
}
|
|
811
866
|
function swiftIcuAsset(toolchainBin, sdk) {
|
|
812
|
-
return memo(
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
867
|
+
return memo(
|
|
868
|
+
assets,
|
|
869
|
+
JSON.stringify([toolchainBin, sdk, swiftSdkOptions()]),
|
|
870
|
+
async () => {
|
|
871
|
+
const zipped = await deflate(await swiftIcuData(toolchainBin, sdk));
|
|
872
|
+
return { sha256: createHash3("sha256").update(zipped).digest("hex"), gzip: zipped };
|
|
873
|
+
}
|
|
874
|
+
);
|
|
816
875
|
}
|
|
817
876
|
async function load(toolchainBin, sdk) {
|
|
818
|
-
const swift =
|
|
877
|
+
const swift = path4.join(toolchainBin, "swift");
|
|
819
878
|
if (!existsSync(swift))
|
|
820
879
|
throw new Error(`swift-icu: no swift at ${swift} for the ${sdk} SDK's icu data`);
|
|
821
|
-
const { stdout: listed } = await run(swift, ["sdk", "list"]
|
|
880
|
+
const { stdout: listed } = await run(swift, ["sdk", "list", ...swiftSdkOptions()], {
|
|
881
|
+
env: swiftEnvironment()
|
|
882
|
+
});
|
|
822
883
|
if (!listed.split("\n").some((line) => line.trim() === sdk))
|
|
823
884
|
throw new Error(`swift-icu: ${sdk} is not installed for ${swift}`);
|
|
824
|
-
const { stdout } = await run(
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
885
|
+
const { stdout } = await run(
|
|
886
|
+
swift,
|
|
887
|
+
[
|
|
888
|
+
"sdk",
|
|
889
|
+
"configure",
|
|
890
|
+
...swiftSdkOptions(),
|
|
891
|
+
"--show-configuration",
|
|
892
|
+
sdk,
|
|
893
|
+
"wasm32-unknown-wasip1"
|
|
894
|
+
],
|
|
895
|
+
{ env: swiftEnvironment() }
|
|
896
|
+
);
|
|
831
897
|
const resources = /^swiftStaticResourcesPath: (.+)$/m.exec(stdout)?.[1]?.trim();
|
|
832
898
|
if (!resources) throw new Error(`swift-icu: ${sdk} names no static resources`);
|
|
833
899
|
return Buffer.from(
|
|
834
|
-
icuSegment(archiveMember(
|
|
900
|
+
icuSegment(archiveMember(readFileSync3(path4.join(resources, ARCHIVE)), MEMBER))
|
|
835
901
|
);
|
|
836
902
|
}
|
|
837
903
|
function archiveMember(archive, name) {
|
|
@@ -987,7 +1053,11 @@ function swiftTargetModuleName(name) {
|
|
|
987
1053
|
function swiftManifestTargets(manifest, resourcePaths = []) {
|
|
988
1054
|
const implicitResources = swiftImplicitResourcePaths(resourcePaths);
|
|
989
1055
|
const targets = [];
|
|
990
|
-
const declarations = manifestCalls(manifest, [
|
|
1056
|
+
const declarations = manifestCalls(manifest, [
|
|
1057
|
+
"executableTarget",
|
|
1058
|
+
"target",
|
|
1059
|
+
"systemLibrary"
|
|
1060
|
+
]);
|
|
991
1061
|
const targetNames = new Set(
|
|
992
1062
|
declarations.flatMap(({ flat }) => {
|
|
993
1063
|
const name = /\bname\s*:\s*"([^"]+)"/.exec(flat)?.[1];
|
|
@@ -1010,6 +1080,9 @@ function swiftManifestTargets(manifest, resourcePaths = []) {
|
|
|
1010
1080
|
const defines = [
|
|
1011
1081
|
...call.matchAll(/\.define\(\s*"([A-Za-z_][A-Za-z0-9_]*)"\s*\)/g)
|
|
1012
1082
|
].map((match) => match[1]);
|
|
1083
|
+
const linkedLibraries = [...call.matchAll(/\.linkedLibrary\(\s*"([^"]+)"\s*\)/g)].map(
|
|
1084
|
+
(match) => match[1]
|
|
1085
|
+
);
|
|
1013
1086
|
const excluded = [
|
|
1014
1087
|
...(/\bexclude\s*:\s*\[([^\]]*)\]/.exec(flat)?.[1] ?? "").matchAll(/"([^"]+)"/g)
|
|
1015
1088
|
].map((match) => match[1].replace(/^\.\//, "").replace(/\/+$/, ""));
|
|
@@ -1044,10 +1117,12 @@ function swiftManifestTargets(manifest, resourcePaths = []) {
|
|
|
1044
1117
|
name,
|
|
1045
1118
|
path: targetPath,
|
|
1046
1119
|
executable,
|
|
1120
|
+
...kind === "systemLibrary" ? { systemLibrary: true } : {},
|
|
1047
1121
|
languageMode,
|
|
1048
1122
|
mainActorIsolation,
|
|
1049
1123
|
...cxxInterop ? { cxxInterop: true } : {},
|
|
1050
1124
|
...defines.length === 0 ? {} : { defines },
|
|
1125
|
+
...linkedLibraries.length === 0 ? {} : { linkedLibraries },
|
|
1051
1126
|
resources,
|
|
1052
1127
|
...dependencies.length === 0 ? {} : { dependencies },
|
|
1053
1128
|
...excluded.length === 0 ? {} : { exclude: excluded }
|
|
@@ -1063,7 +1138,7 @@ function swiftManifestCxxLanguageStandard(manifest) {
|
|
|
1063
1138
|
}
|
|
1064
1139
|
function swiftPackagePartition(manifest, resourcePaths = []) {
|
|
1065
1140
|
const targets = swiftManifestTargets(manifest, resourcePaths);
|
|
1066
|
-
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;
|
|
1141
|
+
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;
|
|
1067
1142
|
}
|
|
1068
1143
|
|
|
1069
1144
|
// src/swiftContract.ts
|
|
@@ -1080,12 +1155,12 @@ function isSwiftResourceBundles(value) {
|
|
|
1080
1155
|
}
|
|
1081
1156
|
|
|
1082
1157
|
// src/swift-compile.ts
|
|
1083
|
-
async function runCompiler(command, args, options, stream = false) {
|
|
1158
|
+
async function runCompiler(command, args, options, stream = false, quiet) {
|
|
1084
1159
|
const { signal } = options;
|
|
1085
1160
|
signal?.throwIfAborted();
|
|
1086
1161
|
const child = spawn2(command, args, {
|
|
1087
1162
|
cwd: options.cwd,
|
|
1088
|
-
env: options.env,
|
|
1163
|
+
env: swiftEnvironment(options.env),
|
|
1089
1164
|
detached: true,
|
|
1090
1165
|
stdio: ["ignore", "pipe", "pipe"]
|
|
1091
1166
|
});
|
|
@@ -1096,6 +1171,7 @@ async function runCompiler(command, args, options, stream = false) {
|
|
|
1096
1171
|
let timeout;
|
|
1097
1172
|
const chunks = { stdout: [], stderr: [] };
|
|
1098
1173
|
const sizes = { stdout: 0, stderr: 0 };
|
|
1174
|
+
const partial = { stdout: "", stderr: "" };
|
|
1099
1175
|
const stop = () => {
|
|
1100
1176
|
stopping ?? (stopping = terminateProcessGroup(child));
|
|
1101
1177
|
void stopping.catch(() => {
|
|
@@ -1103,7 +1179,14 @@ async function runCompiler(command, args, options, stream = false) {
|
|
|
1103
1179
|
};
|
|
1104
1180
|
for (const name of ["stdout", "stderr"]) {
|
|
1105
1181
|
child[name].on("data", (bytes) => {
|
|
1106
|
-
if (stream) process[name].write(bytes);
|
|
1182
|
+
if (stream === true) process[name].write(bytes);
|
|
1183
|
+
else if (stream) {
|
|
1184
|
+
const lines = (partial[name] + bytes.toString()).split("\n");
|
|
1185
|
+
partial[name] = lines.pop();
|
|
1186
|
+
for (const line of lines)
|
|
1187
|
+
if (stream.test(line)) process[name].write(`${line}
|
|
1188
|
+
`);
|
|
1189
|
+
}
|
|
1107
1190
|
sizes[name] += bytes.length;
|
|
1108
1191
|
if (sizes[name] <= (options.maxBuffer ?? 1024 * 1024)) chunks[name].push(bytes);
|
|
1109
1192
|
else {
|
|
@@ -1133,7 +1216,15 @@ async function runCompiler(command, args, options, stream = false) {
|
|
|
1133
1216
|
}
|
|
1134
1217
|
)
|
|
1135
1218
|
);
|
|
1136
|
-
else
|
|
1219
|
+
else {
|
|
1220
|
+
if (quiet) {
|
|
1221
|
+
for (const name of ["stdout", "stderr"])
|
|
1222
|
+
for (const line of Buffer.concat(chunks[name]).toString().split("\n"))
|
|
1223
|
+
if (line && !quiet.test(line)) process[name].write(`${line}
|
|
1224
|
+
`);
|
|
1225
|
+
}
|
|
1226
|
+
resolve();
|
|
1227
|
+
}
|
|
1137
1228
|
});
|
|
1138
1229
|
if (options.timeout)
|
|
1139
1230
|
timeout = setTimeout(() => {
|
|
@@ -1147,16 +1238,18 @@ async function runCompiler(command, args, options, stream = false) {
|
|
|
1147
1238
|
}
|
|
1148
1239
|
}
|
|
1149
1240
|
var WASM_TRIPLE = "wasm32-unknown-wasip1";
|
|
1241
|
+
var SWIFTPM_PROGRESS = /^\[\d+\/\d+\] /;
|
|
1242
|
+
var SWIFTPM_NOISE = /^(?:\[\d+\/\d+\] |Building for production\.\.\.$|warning: '--build-system native' has been deprecated)/;
|
|
1150
1243
|
var BUILD_JOBS = String(
|
|
1151
|
-
Math.min(4, Math.max(1, Math.floor(
|
|
1244
|
+
Math.min(4, Math.max(1, Math.floor(os2.availableParallelism() / 2)))
|
|
1152
1245
|
);
|
|
1153
1246
|
function swiftDistributionAt(root) {
|
|
1154
|
-
const file =
|
|
1247
|
+
const file = path5.join(root, SWIFT_DISTRIBUTION_MANIFEST);
|
|
1155
1248
|
if (!existsSync2(file)) return null;
|
|
1156
|
-
return parseSwiftDistributionManifest(JSON.parse(
|
|
1249
|
+
return parseSwiftDistributionManifest(JSON.parse(readFileSync4(file, "utf8")));
|
|
1157
1250
|
}
|
|
1158
1251
|
function swiftModuleSdk(root) {
|
|
1159
|
-
const pin = swiftDistributionAt(root) ?? JSON.parse(
|
|
1252
|
+
const pin = swiftDistributionAt(root) ?? JSON.parse(readFileSync4(path5.join(root, "toolchain.json"), "utf8"));
|
|
1160
1253
|
if (!pin || typeof pin !== "object" || typeof Reflect.get(pin, "wasmSdkId") !== "string" || typeof Reflect.get(pin, "wasmSdkUrl") !== "string" || typeof Reflect.get(pin, "wasmSdkChecksum") !== "string")
|
|
1161
1254
|
throw new Error(`${root} pins no wasm SDK id, url and checksum`);
|
|
1162
1255
|
return {
|
|
@@ -1172,13 +1265,17 @@ function swiftModuleInputFiles(root) {
|
|
|
1172
1265
|
"scripts/contrast-app-Package.swift",
|
|
1173
1266
|
"scripts/build-distribution.ts",
|
|
1174
1267
|
"scripts/distribution-clang.ts",
|
|
1268
|
+
"scripts/distribution-libxml2.ts",
|
|
1269
|
+
"scripts/distribution-libxml2.json",
|
|
1270
|
+
"Sources/libxml2/include/module.modulemap",
|
|
1271
|
+
"Sources/libxml2/COPYING",
|
|
1175
1272
|
"scripts/build-distribution-plugins.sh",
|
|
1176
1273
|
"scripts/build-distribution-plugins-docker.sh",
|
|
1177
1274
|
"scripts/build-preview-plugin.sh",
|
|
1178
1275
|
"toolchain.json"
|
|
1179
1276
|
];
|
|
1180
1277
|
const walk = (dir) => {
|
|
1181
|
-
for (const entry of readdirSync2(
|
|
1278
|
+
for (const entry of readdirSync2(path5.join(root, dir), {
|
|
1182
1279
|
withFileTypes: true
|
|
1183
1280
|
})) {
|
|
1184
1281
|
const relative = `${dir}/${entry.name}`;
|
|
@@ -1196,29 +1293,39 @@ function swiftMacroPlugins(moduleRoot) {
|
|
|
1196
1293
|
const distribution = swiftDistributionAt(moduleRoot);
|
|
1197
1294
|
if (distribution)
|
|
1198
1295
|
return {
|
|
1199
|
-
libraries: distribution.plugins.map((plugin) =>
|
|
1296
|
+
libraries: distribution.plugins.map((plugin) => path5.join(moduleRoot, plugin)),
|
|
1200
1297
|
stale: false
|
|
1201
1298
|
};
|
|
1202
|
-
const dir =
|
|
1299
|
+
const dir = path5.join(moduleRoot, ".build/host/RnxPreviewMacros");
|
|
1203
1300
|
const release = JSON.parse(
|
|
1204
|
-
|
|
1301
|
+
readFileSync4(path5.join(moduleRoot, "toolchain.json"), "utf8")
|
|
1205
1302
|
).release;
|
|
1206
|
-
const compilerStamp =
|
|
1303
|
+
const compilerStamp = path5.join(dir, "compiler-release");
|
|
1207
1304
|
const ext = process.platform === "darwin" ? "dylib" : "so";
|
|
1208
1305
|
const plugins = [
|
|
1209
1306
|
{
|
|
1210
|
-
library:
|
|
1211
|
-
|
|
1307
|
+
library: path5.join(dir, `libRnxPreviewMacros.${ext}`),
|
|
1308
|
+
sources: [path5.join(moduleRoot, "Sources/RnxPreviewMacros/PreviewMacro.swift")]
|
|
1309
|
+
},
|
|
1310
|
+
{
|
|
1311
|
+
library: path5.join(dir, `libFoundationMacros.${ext}`),
|
|
1312
|
+
sources: [
|
|
1313
|
+
path5.join(moduleRoot, "Sources/FoundationMacros/PredicateMacro.swift"),
|
|
1314
|
+
path5.join(moduleRoot, "Sources/SwiftMacroSupport/PredicateExpression.swift")
|
|
1315
|
+
]
|
|
1212
1316
|
},
|
|
1213
1317
|
{
|
|
1214
|
-
library:
|
|
1215
|
-
|
|
1318
|
+
library: path5.join(dir, `libTipKitMacros.${ext}`),
|
|
1319
|
+
sources: [
|
|
1320
|
+
path5.join(moduleRoot, "Sources/TipKitMacros/TipKitMacros.swift"),
|
|
1321
|
+
path5.join(moduleRoot, "Sources/SwiftMacroSupport/PredicateExpression.swift")
|
|
1322
|
+
]
|
|
1216
1323
|
}
|
|
1217
1324
|
];
|
|
1218
1325
|
return {
|
|
1219
1326
|
libraries: plugins.map(({ library }) => library),
|
|
1220
|
-
stale: !existsSync2(compilerStamp) ||
|
|
1221
|
-
({ library,
|
|
1327
|
+
stale: !existsSync2(compilerStamp) || readFileSync4(compilerStamp, "utf8").trim() !== release || plugins.some(
|
|
1328
|
+
({ library, sources }) => !existsSync2(library) || sources.some((source) => statSync(source).mtimeMs > statSync(library).mtimeMs)
|
|
1222
1329
|
)
|
|
1223
1330
|
};
|
|
1224
1331
|
}
|
|
@@ -1228,14 +1335,14 @@ async function ensureMacroPlugins(moduleRoot, toolchainBin, release, signal) {
|
|
|
1228
1335
|
await runCompiler(
|
|
1229
1336
|
"sh",
|
|
1230
1337
|
[
|
|
1231
|
-
|
|
1338
|
+
path5.join(moduleRoot, "scripts/build-preview-plugin.sh"),
|
|
1232
1339
|
toolchainBin,
|
|
1233
1340
|
libraries[0]
|
|
1234
1341
|
],
|
|
1235
1342
|
{ signal }
|
|
1236
1343
|
);
|
|
1237
1344
|
writeFileSync2(
|
|
1238
|
-
|
|
1345
|
+
path5.join(path5.dirname(libraries[0]), "compiler-release"),
|
|
1239
1346
|
`${release}
|
|
1240
1347
|
`
|
|
1241
1348
|
);
|
|
@@ -1249,9 +1356,9 @@ function clearLinkedModuleDigests(root) {
|
|
|
1249
1356
|
}
|
|
1250
1357
|
function swiftModuleDigest(root) {
|
|
1251
1358
|
const files = swiftModuleInputFiles(root);
|
|
1252
|
-
const stampHash =
|
|
1359
|
+
const stampHash = createHash4("sha256");
|
|
1253
1360
|
for (const file of files) {
|
|
1254
|
-
const stat = statSync(
|
|
1361
|
+
const stat = statSync(path5.join(root, file), { bigint: true });
|
|
1255
1362
|
stampHash.update(file);
|
|
1256
1363
|
stampHash.update(
|
|
1257
1364
|
`${stat.dev}:${stat.ino}:${stat.size}:${stat.mtimeNs}:${stat.ctimeNs}
|
|
@@ -1261,17 +1368,20 @@ function swiftModuleDigest(root) {
|
|
|
1261
1368
|
const stamp = stampHash.digest("hex");
|
|
1262
1369
|
const cached = linkedModuleDigests.get(root);
|
|
1263
1370
|
if (cached?.stamp === stamp) return cached.digest;
|
|
1264
|
-
const hash =
|
|
1371
|
+
const hash = createHash4("sha256");
|
|
1265
1372
|
for (const file of files) {
|
|
1266
|
-
hash.update(
|
|
1373
|
+
hash.update(createHash4("sha256").update(file).digest());
|
|
1267
1374
|
hash.update(
|
|
1268
|
-
|
|
1375
|
+
createHash4("sha256").update(readFileSync4(path5.join(root, file))).digest()
|
|
1269
1376
|
);
|
|
1270
1377
|
}
|
|
1271
1378
|
const digest = hash.digest();
|
|
1272
1379
|
linkedModuleDigests.set(root, { stamp, digest });
|
|
1273
1380
|
return digest;
|
|
1274
1381
|
}
|
|
1382
|
+
function swiftProjectBuildKey(moduleRoot, release) {
|
|
1383
|
+
return createHash4("sha256").update(`${release}\0${swiftModuleSdk(moduleRoot).wasmSdkId}`).update(swiftModuleDigest(moduleRoot)).digest("hex").slice(0, 32);
|
|
1384
|
+
}
|
|
1275
1385
|
function compileTargets(input) {
|
|
1276
1386
|
const manifest = input.files["Package.swift"];
|
|
1277
1387
|
return manifest === void 0 ? [] : swiftPackagePartition(manifest, input.resourcePaths);
|
|
@@ -1286,7 +1396,7 @@ function withNativeSourceGlue(input, glue) {
|
|
|
1286
1396
|
...input,
|
|
1287
1397
|
files: {
|
|
1288
1398
|
...input.files,
|
|
1289
|
-
[
|
|
1399
|
+
[path5.posix.join(targetPath, "OneNativeSource.generated.swift")]: glue
|
|
1290
1400
|
},
|
|
1291
1401
|
oneModule: true
|
|
1292
1402
|
};
|
|
@@ -1294,21 +1404,24 @@ function withNativeSourceGlue(input, glue) {
|
|
|
1294
1404
|
var OPTIONAL_FRAMEWORK_DEPENDENCIES = {
|
|
1295
1405
|
GameplayKit: [],
|
|
1296
1406
|
simd: [],
|
|
1297
|
-
|
|
1407
|
+
ModelIO: ["simd"],
|
|
1408
|
+
GLKit: ["ModelIO"],
|
|
1298
1409
|
Accelerate: [],
|
|
1299
1410
|
CryptoKit: [],
|
|
1300
1411
|
CommonCrypto: [],
|
|
1412
|
+
ImagePlayground: [],
|
|
1413
|
+
QuickLookThumbnailing: [],
|
|
1414
|
+
libxml2: [],
|
|
1301
1415
|
CoreText: [],
|
|
1302
1416
|
Compression: ["PeachCodec"],
|
|
1303
1417
|
zlib: ["PeachCodec"],
|
|
1304
1418
|
PeachCodec: [],
|
|
1305
|
-
Security: ["CryptoKit"],
|
|
1306
1419
|
TikTokBusinessSDK: [],
|
|
1307
1420
|
nSure: [],
|
|
1308
1421
|
Statsig: [],
|
|
1309
1422
|
TOCropViewController: [],
|
|
1310
1423
|
RiveRuntime: ["MetalKit"],
|
|
1311
|
-
MetalKit: [],
|
|
1424
|
+
MetalKit: ["ModelIO"],
|
|
1312
1425
|
DatadogCore: [],
|
|
1313
1426
|
DatadogLogs: ["DatadogCore"],
|
|
1314
1427
|
DatadogRUM: ["DatadogCore"],
|
|
@@ -1408,7 +1521,7 @@ function swiftImportNames(contents, available) {
|
|
|
1408
1521
|
function swiftPeachModules(moduleRoot) {
|
|
1409
1522
|
const distribution = swiftDistributionAt(moduleRoot);
|
|
1410
1523
|
return distribution ? distribution.modules : [
|
|
1411
|
-
...
|
|
1524
|
+
...readFileSync4(path5.join(moduleRoot, "Package.swift"), "utf8").matchAll(
|
|
1412
1525
|
/\.(?:target|systemLibrary)\(\s*name:\s*"([^"]+)"/g
|
|
1413
1526
|
)
|
|
1414
1527
|
].map((match) => match[1]);
|
|
@@ -1416,13 +1529,20 @@ function swiftPeachModules(moduleRoot) {
|
|
|
1416
1529
|
var sdkPaths = /* @__PURE__ */ new Map();
|
|
1417
1530
|
function swiftSdkPaths(moduleRoot, toolchainBin) {
|
|
1418
1531
|
const sdk = swiftModuleSdk(moduleRoot).wasmSdkId;
|
|
1419
|
-
const key =
|
|
1532
|
+
const key = JSON.stringify([toolchainBin, sdk, swiftSdkOptions()]);
|
|
1420
1533
|
const cached = sdkPaths.get(key);
|
|
1421
1534
|
if (cached) return cached;
|
|
1422
|
-
const configuration =
|
|
1423
|
-
|
|
1424
|
-
[
|
|
1425
|
-
|
|
1535
|
+
const configuration = execFileSync2(
|
|
1536
|
+
path5.join(toolchainBin, "swift"),
|
|
1537
|
+
[
|
|
1538
|
+
"sdk",
|
|
1539
|
+
"configure",
|
|
1540
|
+
...swiftSdkOptions(),
|
|
1541
|
+
"--show-configuration",
|
|
1542
|
+
sdk,
|
|
1543
|
+
"wasm32-unknown-wasip1"
|
|
1544
|
+
],
|
|
1545
|
+
{ encoding: "utf8", env: swiftEnvironment(), stdio: ["ignore", "pipe", "pipe"] }
|
|
1426
1546
|
);
|
|
1427
1547
|
const field = (name) => {
|
|
1428
1548
|
const value = new RegExp(`^${name}:\\s*(.+)$`, "m").exec(configuration)?.[1]?.trim();
|
|
@@ -1439,19 +1559,19 @@ function swiftSdkPaths(moduleRoot, toolchainBin) {
|
|
|
1439
1559
|
var availableModules = /* @__PURE__ */ new Map();
|
|
1440
1560
|
function swiftAvailableModules(moduleRoot, toolchainBin) {
|
|
1441
1561
|
const sdk = swiftModuleSdk(moduleRoot).wasmSdkId;
|
|
1442
|
-
const key =
|
|
1562
|
+
const key = JSON.stringify([moduleRoot, sdk, swiftSdkOptions()]);
|
|
1443
1563
|
const cached = availableModules.get(key);
|
|
1444
1564
|
if (cached) return cached;
|
|
1445
1565
|
const modules = new Set(swiftPeachModules(moduleRoot));
|
|
1446
1566
|
const { resources } = swiftSdkPaths(moduleRoot, toolchainBin);
|
|
1447
|
-
for (const entry of readdirSync2(
|
|
1567
|
+
for (const entry of readdirSync2(path5.join(resources, "wasi"))) {
|
|
1448
1568
|
if (entry.endsWith(".swiftmodule"))
|
|
1449
1569
|
modules.add(entry.slice(0, -".swiftmodule".length));
|
|
1450
1570
|
}
|
|
1451
1571
|
for (const entry of readdirSync2(resources)) {
|
|
1452
|
-
const map =
|
|
1572
|
+
const map = path5.join(resources, entry, "module.modulemap");
|
|
1453
1573
|
if (!existsSync2(map)) continue;
|
|
1454
|
-
for (const match of
|
|
1574
|
+
for (const match of readFileSync4(map, "utf8").matchAll(/^module\s+([A-Za-z_]\w*)/gm))
|
|
1455
1575
|
modules.add(match[1]);
|
|
1456
1576
|
}
|
|
1457
1577
|
availableModules.set(key, modules);
|
|
@@ -1514,41 +1634,43 @@ var EXECUTABLE_LINK_FLAGS = ` "-Xclang-linker", "-O0",
|
|
|
1514
1634
|
"-Xlinker", "--global-base=8372224",
|
|
1515
1635
|
`;
|
|
1516
1636
|
var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
|
|
1517
|
-
var MULTI_MANIFEST_VERSION =
|
|
1637
|
+
var MULTI_MANIFEST_VERSION = 39;
|
|
1638
|
+
var compilerSourceDigest = true ? "0c614fef8e4e656ac3500002f7d1f2746f20f462321142e2f69a93e94f2321c4" : swiftCompilerSourceDigest(import.meta.dirname);
|
|
1518
1639
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
1519
|
-
const hash =
|
|
1520
|
-
hash.update(`swift-compile
|
|
1640
|
+
const hash = createHash4("sha256");
|
|
1641
|
+
hash.update(`swift-compile
|
|
1521
1642
|
${release}
|
|
1522
1643
|
`);
|
|
1644
|
+
hash.update(compilerSourceDigest);
|
|
1523
1645
|
if (input.oneModule) hash.update("one-module\n");
|
|
1524
1646
|
hash.update(swiftModuleDigest(moduleRoot));
|
|
1525
1647
|
for (const file of Object.keys(input.files).sort()) {
|
|
1526
|
-
hash.update(
|
|
1527
|
-
hash.update(
|
|
1648
|
+
hash.update(createHash4("sha256").update(file).digest());
|
|
1649
|
+
hash.update(createHash4("sha256").update(input.files[file]).digest());
|
|
1528
1650
|
}
|
|
1529
1651
|
for (const file of Object.keys(input.metalSources ?? {}).sort()) {
|
|
1530
1652
|
hash.update("metal-source\n");
|
|
1531
|
-
hash.update(
|
|
1653
|
+
hash.update(createHash4("sha256").update(file).digest());
|
|
1532
1654
|
hash.update(
|
|
1533
|
-
|
|
1655
|
+
createHash4("sha256").update(input.metalSources?.[file] ?? "").digest()
|
|
1534
1656
|
);
|
|
1535
1657
|
}
|
|
1536
1658
|
for (const base of Object.keys(input.resources ?? {}).sort()) {
|
|
1537
|
-
hash.update(
|
|
1659
|
+
hash.update(createHash4("sha256").update(base).digest());
|
|
1538
1660
|
hash.update(
|
|
1539
|
-
|
|
1661
|
+
createHash4("sha256").update(input.resources?.[base] ?? "").digest()
|
|
1540
1662
|
);
|
|
1541
1663
|
}
|
|
1542
1664
|
for (const name of Object.keys(input.images ?? {}).sort()) {
|
|
1543
1665
|
const image = input.images?.[name];
|
|
1544
1666
|
if (!image) continue;
|
|
1545
|
-
hash.update(
|
|
1546
|
-
hash.update(
|
|
1547
|
-
hash.update(
|
|
1667
|
+
hash.update(createHash4("sha256").update(name).digest());
|
|
1668
|
+
hash.update(createHash4("sha256").update(image.file).digest());
|
|
1669
|
+
hash.update(createHash4("sha256").update(image.data).digest());
|
|
1548
1670
|
}
|
|
1549
1671
|
for (const file of [...new Set(input.resourcePaths ?? [])].sort()) {
|
|
1550
1672
|
hash.update("resource-path\n");
|
|
1551
|
-
hash.update(
|
|
1673
|
+
hash.update(createHash4("sha256").update(file).digest());
|
|
1552
1674
|
}
|
|
1553
1675
|
hash.update(
|
|
1554
1676
|
JSON.stringify(
|
|
@@ -1560,7 +1682,7 @@ ${release}
|
|
|
1560
1682
|
${target}
|
|
1561
1683
|
`);
|
|
1562
1684
|
hash.update(
|
|
1563
|
-
|
|
1685
|
+
createHash4("sha256").update(input.libraries?.[target] ?? "").digest()
|
|
1564
1686
|
);
|
|
1565
1687
|
}
|
|
1566
1688
|
const targets = compileTargets(input);
|
|
@@ -1580,14 +1702,18 @@ ${target}
|
|
|
1580
1702
|
}
|
|
1581
1703
|
function emitSwiftPackageManifest(args) {
|
|
1582
1704
|
const { targets, siblings, moduleRoot, oneModule, spriteKit, distribution } = args;
|
|
1583
|
-
const reachedFrameworks = new Set(
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1705
|
+
const reachedFrameworks = /* @__PURE__ */ new Set();
|
|
1706
|
+
const reach = (name) => {
|
|
1707
|
+
if (reachedFrameworks.has(name)) return;
|
|
1708
|
+
reachedFrameworks.add(name);
|
|
1709
|
+
for (const dependency of OPTIONAL_FRAMEWORK_DEPENDENCIES[name] ?? [])
|
|
1710
|
+
reach(dependency);
|
|
1711
|
+
};
|
|
1712
|
+
for (const name of [...siblings.values()].flat())
|
|
1713
|
+
if (OPTIONAL_FRAMEWORKS.has(name) && !targets.some((target) => target.name === name))
|
|
1714
|
+
reach(name);
|
|
1588
1715
|
if (spriteKit) {
|
|
1589
|
-
|
|
1590
|
-
reachedFrameworks.add("PeachBox2D");
|
|
1716
|
+
for (const name of ["SpriteKit", "PeachBox2D", "simd", "GLKit"]) reach(name);
|
|
1591
1717
|
}
|
|
1592
1718
|
const distributionLink = args.distributionLink;
|
|
1593
1719
|
if (distribution && !distributionLink)
|
|
@@ -1603,11 +1729,11 @@ function emitSwiftPackageManifest(args) {
|
|
|
1603
1729
|
distributionLink.files.set(
|
|
1604
1730
|
distributionLink.path,
|
|
1605
1731
|
objects.map(
|
|
1606
|
-
(object) => `"${
|
|
1732
|
+
(object) => `"${path5.join(moduleRoot, object).replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`
|
|
1607
1733
|
).join("\n") + "\n"
|
|
1608
1734
|
);
|
|
1609
1735
|
}
|
|
1610
|
-
const overlayRoot =
|
|
1736
|
+
const overlayRoot = path5.join(
|
|
1611
1737
|
moduleRoot,
|
|
1612
1738
|
distribution ? "modules" : "cross-import-overlays"
|
|
1613
1739
|
);
|
|
@@ -1615,24 +1741,26 @@ function emitSwiftPackageManifest(args) {
|
|
|
1615
1741
|
"-Xfrontend",
|
|
1616
1742
|
"-swift-module-cross-import",
|
|
1617
1743
|
"-Xfrontend",
|
|
1618
|
-
|
|
1744
|
+
path5.basename(path5.dirname(file), ".swiftcrossimport"),
|
|
1619
1745
|
"-Xfrontend",
|
|
1620
|
-
|
|
1746
|
+
path5.join(overlayRoot, file)
|
|
1621
1747
|
]).map((flag) => `, ${JSON.stringify(flag)}`).join("");
|
|
1622
1748
|
const executable = targets.find((target) => target.executable);
|
|
1623
1749
|
if (!executable) throw new Error("swift-compile: no executable target to emit");
|
|
1624
1750
|
const stanza = (target) => {
|
|
1751
|
+
if (target.systemLibrary)
|
|
1752
|
+
return ` .systemLibrary(name: ${JSON.stringify(target.name)}, path: ${JSON.stringify(target.path)}),`;
|
|
1625
1753
|
const isolation = target.mainActorIsolation ? " .defaultIsolation(MainActor.self)," : "";
|
|
1626
1754
|
const interoperability = target.cxxInterop ? " .interoperabilityMode(.Cxx)," : "";
|
|
1627
1755
|
const defines = (target.defines ?? []).map((name) => ` .define(${JSON.stringify(name)}),`).join("");
|
|
1628
|
-
const imports = distribution ? `, "-I", ${JSON.stringify(
|
|
1756
|
+
const imports = distribution ? `, "-I", ${JSON.stringify(path5.join(moduleRoot, "modules"))}` : "";
|
|
1629
1757
|
const native = args.native?.get(target.name);
|
|
1630
1758
|
const nativeImports = (siblings.get(target.name) ?? []).filter((name) => args.native?.has(name)).map(
|
|
1631
1759
|
(name) => `, "-Xfrontend", "-import-module", "-Xfrontend", ${JSON.stringify(swiftTargetModuleName(name))}`
|
|
1632
1760
|
).join("");
|
|
1633
1761
|
const header = args.headerDirectory && [...args.native?.values() ?? []].some(
|
|
1634
1762
|
(value) => value.late?.producers.includes(target.name)
|
|
1635
|
-
) ? `, "-emit-objc-header-path", ${JSON.stringify(
|
|
1763
|
+
) ? `, "-emit-objc-header-path", ${JSON.stringify(path5.join(args.headerDirectory, `${target.name}-Swift.h`))}` : "";
|
|
1636
1764
|
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}])]`;
|
|
1637
1765
|
const deps = [
|
|
1638
1766
|
...target.executable ? [...args.native?.values() ?? []].flatMap(
|
|
@@ -1649,14 +1777,22 @@ function emitSwiftPackageManifest(args) {
|
|
|
1649
1777
|
].join(", ");
|
|
1650
1778
|
const library = distribution && distributionLink ? ["-Xlinker", `@${distributionLink.path}`, ...distribution.link].map((flag) => `, ${JSON.stringify(flag)}`).join("") : "";
|
|
1651
1779
|
const kind = target.executable ? ".executableTarget" : ".target";
|
|
1780
|
+
const linkedLibraries = (target.linkedLibraries ?? []).map(
|
|
1781
|
+
(name) => `.linkedLibrary(${JSON.stringify(name)})`
|
|
1782
|
+
);
|
|
1783
|
+
const librarySettings = [
|
|
1784
|
+
...linkedLibraries,
|
|
1785
|
+
...args.libraries?.has(target.name) ? [`.unsafeFlags([${JSON.stringify(args.libraries.get(target.name))}])`] : []
|
|
1786
|
+
];
|
|
1652
1787
|
const link = target.executable ? `,
|
|
1653
1788
|
linkerSettings: [
|
|
1789
|
+
${linkedLibraries.map((setting) => `${setting},`).join("\n ")}
|
|
1654
1790
|
.unsafeFlags([
|
|
1655
1791
|
${REACTOR_FLAG}${EXECUTABLE_LINK_FLAGS} "-Xlinker", "--export-if-defined=__main_argc_argv"${library},
|
|
1656
1792
|
]),
|
|
1657
1793
|
.unsafeFlags(["-Xlinker", "--strip-all"], .when(configuration: .release)),
|
|
1658
|
-
]` :
|
|
1659
|
-
linkerSettings: [
|
|
1794
|
+
]` : librarySettings.length > 0 ? `,
|
|
1795
|
+
linkerSettings: [${librarySettings.join(", ")}]` : "";
|
|
1660
1796
|
return [
|
|
1661
1797
|
` ${kind}(`,
|
|
1662
1798
|
` name: "${target.name}",`,
|
|
@@ -1700,7 +1836,7 @@ function syncSwiftTree(base, files) {
|
|
|
1700
1836
|
mkdirSync(base, { recursive: true });
|
|
1701
1837
|
const walk = (dir) => {
|
|
1702
1838
|
for (const entry of readdirSync2(dir, { withFileTypes: true })) {
|
|
1703
|
-
const full =
|
|
1839
|
+
const full = path5.join(dir, entry.name);
|
|
1704
1840
|
if (dir === base && entry.name === ".build") continue;
|
|
1705
1841
|
if (entry.isDirectory()) walk(full);
|
|
1706
1842
|
else if (!files.has(full)) rmSync2(full, { force: true });
|
|
@@ -1708,14 +1844,14 @@ function syncSwiftTree(base, files) {
|
|
|
1708
1844
|
};
|
|
1709
1845
|
walk(base);
|
|
1710
1846
|
for (const [full, contents] of files) {
|
|
1711
|
-
if (existsSync2(full) && (typeof contents === "string" ?
|
|
1847
|
+
if (existsSync2(full) && (typeof contents === "string" ? readFileSync4(full, "utf8") === contents : readFileSync4(full).equals(contents)))
|
|
1712
1848
|
continue;
|
|
1713
|
-
mkdirSync(
|
|
1849
|
+
mkdirSync(path5.dirname(full), { recursive: true });
|
|
1714
1850
|
writeFileSync2(full, contents);
|
|
1715
1851
|
}
|
|
1716
1852
|
}
|
|
1717
1853
|
var DIRECTIVE = /^[ \t]*#(?:if|elseif)\b/;
|
|
1718
|
-
var OS_IOS = /\
|
|
1854
|
+
var OS_IOS = /\b(?:os\(\s*iOS\s*\)|targetEnvironment\(\s*simulator\s*\))/g;
|
|
1719
1855
|
var OBJC_ATTRIBUTE = /^@(?:objcMembers\b|objc\b(?:(\s*)\(([^()]*)\))?|IBAction\b)/;
|
|
1720
1856
|
var SELECTOR = /^#selector\b/;
|
|
1721
1857
|
var PROTOCOL_NAME = /^\s+[A-Za-z_]\w*(\s*:)?/;
|
|
@@ -2134,19 +2270,24 @@ function objcRootedClasses(sources) {
|
|
|
2134
2270
|
function hideObjCClassesFromCxx(source, rooted) {
|
|
2135
2271
|
if (rooted.size === 0) return source;
|
|
2136
2272
|
const code = swiftCodeMask(source);
|
|
2137
|
-
const
|
|
2273
|
+
const insertions = [];
|
|
2138
2274
|
let depth = 0;
|
|
2139
2275
|
for (const match of code.matchAll(
|
|
2140
2276
|
/[{}]|\bclass\s+(?!(?:func|var|let|subscript)\b)([A-Za-z_]\w*)/g
|
|
2141
2277
|
)) {
|
|
2142
2278
|
if (match[0] === "{") depth++;
|
|
2143
2279
|
else if (match[0] === "}") depth--;
|
|
2144
|
-
else if (depth === 0 && rooted.has(match[1]))
|
|
2145
|
-
|
|
2280
|
+
else if (depth === 0 && rooted.has(match[1])) {
|
|
2281
|
+
const start = declarationStart(code, match.index, 0);
|
|
2282
|
+
const main = /@main\b/.exec(code.slice(start, match.index));
|
|
2283
|
+
insertions.push(
|
|
2284
|
+
main ? { at: start + main.index + main[0].length, text: " @_expose(!Cxx)" } : { at: start, text: "@_expose(!Cxx) " }
|
|
2285
|
+
);
|
|
2286
|
+
}
|
|
2146
2287
|
}
|
|
2147
2288
|
let out = source;
|
|
2148
|
-
for (const at of
|
|
2149
|
-
out = `${out.slice(0, at)}
|
|
2289
|
+
for (const { at, text: text2 } of insertions.reverse())
|
|
2290
|
+
out = `${out.slice(0, at)}${text2}${out.slice(at)}`;
|
|
2150
2291
|
return out;
|
|
2151
2292
|
}
|
|
2152
2293
|
function lowerAnyObjectDoubleValue(source) {
|
|
@@ -4511,6 +4652,694 @@ function swiftCodeMask(source) {
|
|
|
4511
4652
|
scanCode(0, false);
|
|
4512
4653
|
return chars.join("");
|
|
4513
4654
|
}
|
|
4655
|
+
var FOUNDATION_NETWORKING_TYPES = /* @__PURE__ */ new Set([
|
|
4656
|
+
"CachedURLResponse",
|
|
4657
|
+
"HTTPCookieStorage",
|
|
4658
|
+
"HTTPURLResponse",
|
|
4659
|
+
"NSMutableURLRequest",
|
|
4660
|
+
"NSURLConnection",
|
|
4661
|
+
"NSURLConnectionDataDelegate",
|
|
4662
|
+
"NSURLConnectionDelegate",
|
|
4663
|
+
"NSURLConnectionDownloadDelegate",
|
|
4664
|
+
"URLAuthenticationChallenge",
|
|
4665
|
+
"URLAuthenticationChallengeSender",
|
|
4666
|
+
"URLCache",
|
|
4667
|
+
"URLCredential",
|
|
4668
|
+
"URLCredentialStorage",
|
|
4669
|
+
"URLProtectionSpace",
|
|
4670
|
+
"URLProtocol",
|
|
4671
|
+
"URLProtocolClient",
|
|
4672
|
+
"URLRequest",
|
|
4673
|
+
"URLResponse",
|
|
4674
|
+
"URLSession",
|
|
4675
|
+
"URLSessionConfiguration",
|
|
4676
|
+
"URLSessionDataDelegate",
|
|
4677
|
+
"URLSessionDataTask",
|
|
4678
|
+
"URLSessionDelegate",
|
|
4679
|
+
"URLSessionDownloadDelegate",
|
|
4680
|
+
"URLSessionDownloadTask",
|
|
4681
|
+
"URLSessionStreamDelegate",
|
|
4682
|
+
"URLSessionStreamTask",
|
|
4683
|
+
"URLSessionTask",
|
|
4684
|
+
"URLSessionTaskDelegate",
|
|
4685
|
+
"URLSessionTaskMetrics",
|
|
4686
|
+
"URLSessionTaskTransactionMetrics",
|
|
4687
|
+
"URLSessionUploadTask",
|
|
4688
|
+
"URLSessionWebSocketDelegate",
|
|
4689
|
+
"URLSessionWebSocketTask"
|
|
4690
|
+
]);
|
|
4691
|
+
var FOUNDATION_OVERLAY_TYPES = /* @__PURE__ */ new Set([
|
|
4692
|
+
"AsyncCharacterSequence",
|
|
4693
|
+
"AsyncLineSequence",
|
|
4694
|
+
"AsyncUnicodeScalarSequence",
|
|
4695
|
+
"BlockOperation",
|
|
4696
|
+
"DateComponentsFormatter",
|
|
4697
|
+
"ErrorUserInfoKey",
|
|
4698
|
+
"FileWrapper",
|
|
4699
|
+
"HTTPCookie",
|
|
4700
|
+
"HTTPCookiePropertyKey",
|
|
4701
|
+
"HTTPCookieStringPolicy",
|
|
4702
|
+
"InlinePresentationIntent",
|
|
4703
|
+
"ListFormatter",
|
|
4704
|
+
"LocalizedStringResource",
|
|
4705
|
+
"MachError",
|
|
4706
|
+
"MeasurementFormatUnitUsage",
|
|
4707
|
+
"MeasurementFormatter",
|
|
4708
|
+
"MessagePort",
|
|
4709
|
+
"NSAssertionHandler",
|
|
4710
|
+
"NSAttributedStringFormattingContextKey",
|
|
4711
|
+
"NSBundleResourceRequest",
|
|
4712
|
+
"NSCollectionChangeType",
|
|
4713
|
+
"NSConditionLock",
|
|
4714
|
+
"NSDataDetector",
|
|
4715
|
+
"NSException",
|
|
4716
|
+
"NSExtensionContext",
|
|
4717
|
+
"NSExtensionItem",
|
|
4718
|
+
"NSExtensionRequestHandling",
|
|
4719
|
+
"NSFastEnumerationIterator",
|
|
4720
|
+
"NSFastEnumerationState",
|
|
4721
|
+
"NSFileAccessIntent",
|
|
4722
|
+
"NSFileCoordinator",
|
|
4723
|
+
"NSFileManagerResumeSyncBehavior",
|
|
4724
|
+
"NSFileManagerSupportedSyncControls",
|
|
4725
|
+
"NSFileManagerUploadLocalVersionConflictPolicy",
|
|
4726
|
+
"NSFileProviderService",
|
|
4727
|
+
"NSFileProviderServiceName",
|
|
4728
|
+
"NSFileSecurity",
|
|
4729
|
+
"NSFileVersion",
|
|
4730
|
+
"NSGrammaticalCase",
|
|
4731
|
+
"NSGrammaticalDefiniteness",
|
|
4732
|
+
"NSGrammaticalDetermination",
|
|
4733
|
+
"NSGrammaticalGender",
|
|
4734
|
+
"NSGrammaticalNumber",
|
|
4735
|
+
"NSGrammaticalPartOfSpeech",
|
|
4736
|
+
"NSGrammaticalPerson",
|
|
4737
|
+
"NSGrammaticalPronounType",
|
|
4738
|
+
"NSHashEnumerator",
|
|
4739
|
+
"NSHashTable",
|
|
4740
|
+
"NSHashTableCallBacks",
|
|
4741
|
+
"NSItemProvider",
|
|
4742
|
+
"NSItemProviderFileOptions",
|
|
4743
|
+
"NSItemProviderRepresentationVisibility",
|
|
4744
|
+
"NSKeyValueOperator",
|
|
4745
|
+
"NSKeyValueSetMutationKind",
|
|
4746
|
+
"NSKeyValueSharedObservers",
|
|
4747
|
+
"NSLinguisticTag",
|
|
4748
|
+
"NSLinguisticTagScheme",
|
|
4749
|
+
"NSLinguisticTagger",
|
|
4750
|
+
"NSLinguisticTaggerUnit",
|
|
4751
|
+
"NSMachPort",
|
|
4752
|
+
"NSMapEnumerator",
|
|
4753
|
+
"NSMapTable",
|
|
4754
|
+
"NSMapTableKeyCallBacks",
|
|
4755
|
+
"NSMapTableValueCallBacks",
|
|
4756
|
+
"NSMetadataItem",
|
|
4757
|
+
"NSMetadataQuery",
|
|
4758
|
+
"NSMetadataQueryAttributeValueTuple",
|
|
4759
|
+
"NSMetadataQueryDelegate",
|
|
4760
|
+
"NSMetadataQueryResultGroup",
|
|
4761
|
+
"NSOrderedCollectionChange",
|
|
4762
|
+
"NSOrderedCollectionDifference",
|
|
4763
|
+
"NSOrderedCollectionDifferenceCalculationOptions",
|
|
4764
|
+
"NSPointerArray",
|
|
4765
|
+
"NSPointerFunctions",
|
|
4766
|
+
"NSPredicateValidating",
|
|
4767
|
+
"NSProxy",
|
|
4768
|
+
"NSPurgeableData",
|
|
4769
|
+
"NSSecureUnarchiveFromDataTransformer",
|
|
4770
|
+
"NSSwappedDouble",
|
|
4771
|
+
"NSSwappedFloat",
|
|
4772
|
+
"NSURLRequest",
|
|
4773
|
+
"NSUbiquitousKeyValueStore",
|
|
4774
|
+
"NSUserActivity",
|
|
4775
|
+
"NSUserActivityDelegate",
|
|
4776
|
+
"NSValueTransformerName",
|
|
4777
|
+
"NSXPCCoder",
|
|
4778
|
+
"NSXPCConnection",
|
|
4779
|
+
"NSXPCInterface",
|
|
4780
|
+
"NSXPCListener",
|
|
4781
|
+
"NSXPCListenerDelegate",
|
|
4782
|
+
"NSXPCListenerEndpoint",
|
|
4783
|
+
"NetService",
|
|
4784
|
+
"NetServiceBrowser",
|
|
4785
|
+
"NetServiceBrowserDelegate",
|
|
4786
|
+
"NetServiceDelegate",
|
|
4787
|
+
"NotificationQueue",
|
|
4788
|
+
"Operation",
|
|
4789
|
+
"OperationQueue",
|
|
4790
|
+
"PredicateCodableConfiguration",
|
|
4791
|
+
"PresentationIntent",
|
|
4792
|
+
"Progress",
|
|
4793
|
+
"ProgressKind",
|
|
4794
|
+
"ProgressUserInfoKey",
|
|
4795
|
+
"RelativeDateTimeFormatter",
|
|
4796
|
+
"SocketPort",
|
|
4797
|
+
"StringEncodingDetectionOptionsKey",
|
|
4798
|
+
"TermOfAddress",
|
|
4799
|
+
"URLFileProtection",
|
|
4800
|
+
"URLResource",
|
|
4801
|
+
"URLThumbnailDictionaryItem",
|
|
4802
|
+
"URLUbiquitousItemDownloadingStatus",
|
|
4803
|
+
"URLUbiquitousSharedItemPermissions",
|
|
4804
|
+
"URLUbiquitousSharedItemRole",
|
|
4805
|
+
"UndoManager",
|
|
4806
|
+
"ValueTransformer",
|
|
4807
|
+
"XMLParser",
|
|
4808
|
+
"XMLParserDelegate"
|
|
4809
|
+
]);
|
|
4810
|
+
var FOUNDATION_OVERLAY_GLOBALS = /* @__PURE__ */ new Set([
|
|
4811
|
+
"CFBridgingRetain",
|
|
4812
|
+
"NSASCIIStringEncoding",
|
|
4813
|
+
"NSAllHashTableObjects",
|
|
4814
|
+
"NSAllMapTableKeys",
|
|
4815
|
+
"NSAllMapTableValues",
|
|
4816
|
+
"NSAllocateMemoryPages",
|
|
4817
|
+
"NSAssertionHandlerKey",
|
|
4818
|
+
"NSBuddhistCalendar",
|
|
4819
|
+
"NSBundleErrorMaximum",
|
|
4820
|
+
"NSBundleErrorMinimum",
|
|
4821
|
+
"NSBundleExecutableArchitectureARM64",
|
|
4822
|
+
"NSBundleExecutableArchitectureI386",
|
|
4823
|
+
"NSBundleExecutableArchitecturePPC",
|
|
4824
|
+
"NSBundleExecutableArchitecturePPC64",
|
|
4825
|
+
"NSBundleExecutableArchitectureX86_64",
|
|
4826
|
+
"NSBundleOnDemandResourceExceededMaximumSizeError",
|
|
4827
|
+
"NSBundleOnDemandResourceInvalidTagError",
|
|
4828
|
+
"NSBundleOnDemandResourceOutOfSpaceError",
|
|
4829
|
+
"NSBundleResourceRequestLoadingPriorityUrgent",
|
|
4830
|
+
"NSChineseCalendar",
|
|
4831
|
+
"NSCloudSharingConflictError",
|
|
4832
|
+
"NSCloudSharingErrorMaximum",
|
|
4833
|
+
"NSCloudSharingErrorMinimum",
|
|
4834
|
+
"NSCloudSharingNetworkFailureError",
|
|
4835
|
+
"NSCloudSharingNoPermissionError",
|
|
4836
|
+
"NSCloudSharingOtherError",
|
|
4837
|
+
"NSCloudSharingQuotaExceededError",
|
|
4838
|
+
"NSCloudSharingTooManyParticipantsError",
|
|
4839
|
+
"NSCoderErrorMaximum",
|
|
4840
|
+
"NSCoderErrorMinimum",
|
|
4841
|
+
"NSCoderInvalidValueError",
|
|
4842
|
+
"NSCompareHashTables",
|
|
4843
|
+
"NSCompareMapTables",
|
|
4844
|
+
"NSCompressionErrorMaximum",
|
|
4845
|
+
"NSCompressionErrorMinimum",
|
|
4846
|
+
"NSCompressionFailedError",
|
|
4847
|
+
"NSConvertHostDoubleToSwapped",
|
|
4848
|
+
"NSConvertHostFloatToSwapped",
|
|
4849
|
+
"NSConvertSwappedDoubleToHost",
|
|
4850
|
+
"NSConvertSwappedFloatToHost",
|
|
4851
|
+
"NSCopyMemoryPages",
|
|
4852
|
+
"NSCountHashTable",
|
|
4853
|
+
"NSCountMapTable",
|
|
4854
|
+
"NSCreateHashTable",
|
|
4855
|
+
"NSCreateMapTable",
|
|
4856
|
+
"NSDeallocateMemoryPages",
|
|
4857
|
+
"NSDecompressionFailedError",
|
|
4858
|
+
"NSEndHashTableEnumeration",
|
|
4859
|
+
"NSEndMapTableEnumeration",
|
|
4860
|
+
"NSEnumerateHashTable",
|
|
4861
|
+
"NSEnumerateMapTable",
|
|
4862
|
+
"NSExecutableErrorMaximum",
|
|
4863
|
+
"NSExecutableErrorMinimum",
|
|
4864
|
+
"NSExtensionItemAttachmentsKey",
|
|
4865
|
+
"NSExtensionItemAttributedContentTextKey",
|
|
4866
|
+
"NSExtensionItemAttributedTitleKey",
|
|
4867
|
+
"NSExtensionItemsAndErrorsKey",
|
|
4868
|
+
"NSExtensionJavaScriptFinalizeArgumentKey",
|
|
4869
|
+
"NSExtensionJavaScriptPreprocessingResultsKey",
|
|
4870
|
+
"NSFileErrorMaximum",
|
|
4871
|
+
"NSFileErrorMinimum",
|
|
4872
|
+
"NSFormattingErrorMaximum",
|
|
4873
|
+
"NSFormattingErrorMinimum",
|
|
4874
|
+
"NSFoundationVersionNumber",
|
|
4875
|
+
"NSFoundationVersionNumber10_0",
|
|
4876
|
+
"NSFoundationVersionNumber10_1",
|
|
4877
|
+
"NSFoundationVersionNumber10_10",
|
|
4878
|
+
"NSFoundationVersionNumber10_10_1",
|
|
4879
|
+
"NSFoundationVersionNumber10_10_2",
|
|
4880
|
+
"NSFoundationVersionNumber10_10_3",
|
|
4881
|
+
"NSFoundationVersionNumber10_10_4",
|
|
4882
|
+
"NSFoundationVersionNumber10_10_5",
|
|
4883
|
+
"NSFoundationVersionNumber10_10_Max",
|
|
4884
|
+
"NSFoundationVersionNumber10_11",
|
|
4885
|
+
"NSFoundationVersionNumber10_11_1",
|
|
4886
|
+
"NSFoundationVersionNumber10_11_2",
|
|
4887
|
+
"NSFoundationVersionNumber10_11_3",
|
|
4888
|
+
"NSFoundationVersionNumber10_11_4",
|
|
4889
|
+
"NSFoundationVersionNumber10_11_Max",
|
|
4890
|
+
"NSFoundationVersionNumber10_1_1",
|
|
4891
|
+
"NSFoundationVersionNumber10_1_2",
|
|
4892
|
+
"NSFoundationVersionNumber10_1_3",
|
|
4893
|
+
"NSFoundationVersionNumber10_1_4",
|
|
4894
|
+
"NSFoundationVersionNumber10_2",
|
|
4895
|
+
"NSFoundationVersionNumber10_2_1",
|
|
4896
|
+
"NSFoundationVersionNumber10_2_2",
|
|
4897
|
+
"NSFoundationVersionNumber10_2_3",
|
|
4898
|
+
"NSFoundationVersionNumber10_2_4",
|
|
4899
|
+
"NSFoundationVersionNumber10_2_5",
|
|
4900
|
+
"NSFoundationVersionNumber10_2_6",
|
|
4901
|
+
"NSFoundationVersionNumber10_2_7",
|
|
4902
|
+
"NSFoundationVersionNumber10_2_8",
|
|
4903
|
+
"NSFoundationVersionNumber10_3",
|
|
4904
|
+
"NSFoundationVersionNumber10_3_1",
|
|
4905
|
+
"NSFoundationVersionNumber10_3_2",
|
|
4906
|
+
"NSFoundationVersionNumber10_3_3",
|
|
4907
|
+
"NSFoundationVersionNumber10_3_4",
|
|
4908
|
+
"NSFoundationVersionNumber10_3_5",
|
|
4909
|
+
"NSFoundationVersionNumber10_3_6",
|
|
4910
|
+
"NSFoundationVersionNumber10_3_7",
|
|
4911
|
+
"NSFoundationVersionNumber10_3_8",
|
|
4912
|
+
"NSFoundationVersionNumber10_3_9",
|
|
4913
|
+
"NSFoundationVersionNumber10_4",
|
|
4914
|
+
"NSFoundationVersionNumber10_4_1",
|
|
4915
|
+
"NSFoundationVersionNumber10_4_10",
|
|
4916
|
+
"NSFoundationVersionNumber10_4_11",
|
|
4917
|
+
"NSFoundationVersionNumber10_4_2",
|
|
4918
|
+
"NSFoundationVersionNumber10_4_3",
|
|
4919
|
+
"NSFoundationVersionNumber10_4_4_Intel",
|
|
4920
|
+
"NSFoundationVersionNumber10_4_4_PowerPC",
|
|
4921
|
+
"NSFoundationVersionNumber10_4_5",
|
|
4922
|
+
"NSFoundationVersionNumber10_4_6",
|
|
4923
|
+
"NSFoundationVersionNumber10_4_7",
|
|
4924
|
+
"NSFoundationVersionNumber10_4_8",
|
|
4925
|
+
"NSFoundationVersionNumber10_4_9",
|
|
4926
|
+
"NSFoundationVersionNumber10_5",
|
|
4927
|
+
"NSFoundationVersionNumber10_5_1",
|
|
4928
|
+
"NSFoundationVersionNumber10_5_2",
|
|
4929
|
+
"NSFoundationVersionNumber10_5_3",
|
|
4930
|
+
"NSFoundationVersionNumber10_5_4",
|
|
4931
|
+
"NSFoundationVersionNumber10_5_5",
|
|
4932
|
+
"NSFoundationVersionNumber10_5_6",
|
|
4933
|
+
"NSFoundationVersionNumber10_5_7",
|
|
4934
|
+
"NSFoundationVersionNumber10_5_8",
|
|
4935
|
+
"NSFoundationVersionNumber10_6",
|
|
4936
|
+
"NSFoundationVersionNumber10_6_1",
|
|
4937
|
+
"NSFoundationVersionNumber10_6_2",
|
|
4938
|
+
"NSFoundationVersionNumber10_6_3",
|
|
4939
|
+
"NSFoundationVersionNumber10_6_4",
|
|
4940
|
+
"NSFoundationVersionNumber10_6_5",
|
|
4941
|
+
"NSFoundationVersionNumber10_6_6",
|
|
4942
|
+
"NSFoundationVersionNumber10_6_7",
|
|
4943
|
+
"NSFoundationVersionNumber10_6_8",
|
|
4944
|
+
"NSFoundationVersionNumber10_7",
|
|
4945
|
+
"NSFoundationVersionNumber10_7_1",
|
|
4946
|
+
"NSFoundationVersionNumber10_7_2",
|
|
4947
|
+
"NSFoundationVersionNumber10_7_3",
|
|
4948
|
+
"NSFoundationVersionNumber10_7_4",
|
|
4949
|
+
"NSFoundationVersionNumber10_8",
|
|
4950
|
+
"NSFoundationVersionNumber10_8_1",
|
|
4951
|
+
"NSFoundationVersionNumber10_8_2",
|
|
4952
|
+
"NSFoundationVersionNumber10_8_3",
|
|
4953
|
+
"NSFoundationVersionNumber10_8_4",
|
|
4954
|
+
"NSFoundationVersionNumber10_9",
|
|
4955
|
+
"NSFoundationVersionNumber10_9_1",
|
|
4956
|
+
"NSFoundationVersionNumber10_9_2",
|
|
4957
|
+
"NSFoundationVersionNumber_iOS_4_0",
|
|
4958
|
+
"NSFoundationVersionNumber_iOS_4_1",
|
|
4959
|
+
"NSFoundationVersionNumber_iOS_4_2",
|
|
4960
|
+
"NSFoundationVersionNumber_iOS_4_3",
|
|
4961
|
+
"NSFoundationVersionNumber_iOS_5_0",
|
|
4962
|
+
"NSFoundationVersionNumber_iOS_5_1",
|
|
4963
|
+
"NSFoundationVersionNumber_iOS_6_0",
|
|
4964
|
+
"NSFoundationVersionNumber_iOS_6_1",
|
|
4965
|
+
"NSFoundationVersionNumber_iOS_7_0",
|
|
4966
|
+
"NSFoundationVersionNumber_iOS_7_1",
|
|
4967
|
+
"NSFoundationVersionNumber_iOS_8_0",
|
|
4968
|
+
"NSFoundationVersionNumber_iOS_8_1",
|
|
4969
|
+
"NSFoundationVersionNumber_iOS_8_2",
|
|
4970
|
+
"NSFoundationVersionNumber_iOS_8_3",
|
|
4971
|
+
"NSFoundationVersionNumber_iOS_8_4",
|
|
4972
|
+
"NSFoundationVersionNumber_iOS_8_x_Max",
|
|
4973
|
+
"NSFoundationVersionNumber_iOS_9_0",
|
|
4974
|
+
"NSFoundationVersionNumber_iOS_9_1",
|
|
4975
|
+
"NSFoundationVersionNumber_iOS_9_2",
|
|
4976
|
+
"NSFoundationVersionNumber_iOS_9_3",
|
|
4977
|
+
"NSFoundationVersionNumber_iOS_9_4",
|
|
4978
|
+
"NSFoundationVersionNumber_iOS_9_x_Max",
|
|
4979
|
+
"NSFoundationVersionNumber_iPhoneOS_2_0",
|
|
4980
|
+
"NSFoundationVersionNumber_iPhoneOS_2_1",
|
|
4981
|
+
"NSFoundationVersionNumber_iPhoneOS_2_2",
|
|
4982
|
+
"NSFoundationVersionNumber_iPhoneOS_3_0",
|
|
4983
|
+
"NSFoundationVersionNumber_iPhoneOS_3_1",
|
|
4984
|
+
"NSFoundationVersionNumber_iPhoneOS_3_2",
|
|
4985
|
+
"NSFoundationVersionWithFileManagerResourceForkSupport",
|
|
4986
|
+
"NSFreeHashTable",
|
|
4987
|
+
"NSFreeMapTable",
|
|
4988
|
+
"NSGetUncaughtExceptionHandler",
|
|
4989
|
+
"NSGregorianCalendar",
|
|
4990
|
+
"NSHPUXOperatingSystem",
|
|
4991
|
+
"NSHashGet",
|
|
4992
|
+
"NSHashInsert",
|
|
4993
|
+
"NSHashInsertIfAbsent",
|
|
4994
|
+
"NSHashInsertKnownAbsent",
|
|
4995
|
+
"NSHashRemove",
|
|
4996
|
+
"NSHashTableCopyIn",
|
|
4997
|
+
"NSHashTableObjectPointerPersonality",
|
|
4998
|
+
"NSHashTableStrongMemory",
|
|
4999
|
+
"NSHashTableWeakMemory",
|
|
5000
|
+
"NSHebrewCalendar",
|
|
5001
|
+
"NSHostByteOrder",
|
|
5002
|
+
"NSISO2022JPStringEncoding",
|
|
5003
|
+
"NSISO8601Calendar",
|
|
5004
|
+
"NSISOLatin1StringEncoding",
|
|
5005
|
+
"NSISOLatin2StringEncoding",
|
|
5006
|
+
"NSIndianCalendar",
|
|
5007
|
+
"NSIslamicCalendar",
|
|
5008
|
+
"NSIslamicCivilCalendar",
|
|
5009
|
+
"NSItemProviderPreferredImageSizeKey",
|
|
5010
|
+
"NSJapaneseCalendar",
|
|
5011
|
+
"NSJapaneseEUCStringEncoding",
|
|
5012
|
+
"NSLoadedClasses",
|
|
5013
|
+
"NSLocalizedFailureErrorKey",
|
|
5014
|
+
"NSLogPageSize",
|
|
5015
|
+
"NSMACHOperatingSystem",
|
|
5016
|
+
"NSMacOSRomanStringEncoding",
|
|
5017
|
+
"NSMapGet",
|
|
5018
|
+
"NSMapInsert",
|
|
5019
|
+
"NSMapInsertIfAbsent",
|
|
5020
|
+
"NSMapInsertKnownAbsent",
|
|
5021
|
+
"NSMapMember",
|
|
5022
|
+
"NSMapRemove",
|
|
5023
|
+
"NSMapTableCopyIn",
|
|
5024
|
+
"NSMapTableObjectPointerPersonality",
|
|
5025
|
+
"NSMapTableStrongMemory",
|
|
5026
|
+
"NSMapTableWeakMemory",
|
|
5027
|
+
"NSMetadataItemContentTypeKey",
|
|
5028
|
+
"NSMetadataItemContentTypeTreeKey",
|
|
5029
|
+
"NSMetadataItemDisplayNameKey",
|
|
5030
|
+
"NSMetadataItemFSContentChangeDateKey",
|
|
5031
|
+
"NSMetadataItemFSCreationDateKey",
|
|
5032
|
+
"NSMetadataItemFSNameKey",
|
|
5033
|
+
"NSMetadataItemFSSizeKey",
|
|
5034
|
+
"NSMetadataItemIsUbiquitousKey",
|
|
5035
|
+
"NSMetadataItemPathKey",
|
|
5036
|
+
"NSMetadataItemURLKey",
|
|
5037
|
+
"NSMetadataQueryAccessibleUbiquitousExternalDocumentsScope",
|
|
5038
|
+
"NSMetadataQueryResultContentRelevanceAttribute",
|
|
5039
|
+
"NSMetadataQueryUbiquitousDataScope",
|
|
5040
|
+
"NSMetadataQueryUbiquitousDocumentsScope",
|
|
5041
|
+
"NSMetadataQueryUpdateAddedItemsKey",
|
|
5042
|
+
"NSMetadataQueryUpdateChangedItemsKey",
|
|
5043
|
+
"NSMetadataQueryUpdateRemovedItemsKey",
|
|
5044
|
+
"NSMetadataUbiquitousItemContainerDisplayNameKey",
|
|
5045
|
+
"NSMetadataUbiquitousItemDownloadRequestedKey",
|
|
5046
|
+
"NSMetadataUbiquitousItemDownloadingErrorKey",
|
|
5047
|
+
"NSMetadataUbiquitousItemDownloadingStatusCurrent",
|
|
5048
|
+
"NSMetadataUbiquitousItemDownloadingStatusDownloaded",
|
|
5049
|
+
"NSMetadataUbiquitousItemDownloadingStatusKey",
|
|
5050
|
+
"NSMetadataUbiquitousItemDownloadingStatusNotDownloaded",
|
|
5051
|
+
"NSMetadataUbiquitousItemHasUnresolvedConflictsKey",
|
|
5052
|
+
"NSMetadataUbiquitousItemIsDownloadingKey",
|
|
5053
|
+
"NSMetadataUbiquitousItemIsExternalDocumentKey",
|
|
5054
|
+
"NSMetadataUbiquitousItemIsSharedKey",
|
|
5055
|
+
"NSMetadataUbiquitousItemIsUploadedKey",
|
|
5056
|
+
"NSMetadataUbiquitousItemIsUploadingKey",
|
|
5057
|
+
"NSMetadataUbiquitousItemPercentDownloadedKey",
|
|
5058
|
+
"NSMetadataUbiquitousItemPercentUploadedKey",
|
|
5059
|
+
"NSMetadataUbiquitousItemURLInLocalContainerKey",
|
|
5060
|
+
"NSMetadataUbiquitousItemUploadingErrorKey",
|
|
5061
|
+
"NSMetadataUbiquitousSharedItemCurrentUserPermissionsKey",
|
|
5062
|
+
"NSMetadataUbiquitousSharedItemCurrentUserRoleKey",
|
|
5063
|
+
"NSMetadataUbiquitousSharedItemMostRecentEditorNameComponentsKey",
|
|
5064
|
+
"NSMetadataUbiquitousSharedItemOwnerNameComponentsKey",
|
|
5065
|
+
"NSMetadataUbiquitousSharedItemPermissionsReadOnly",
|
|
5066
|
+
"NSMetadataUbiquitousSharedItemPermissionsReadWrite",
|
|
5067
|
+
"NSMetadataUbiquitousSharedItemRoleOwner",
|
|
5068
|
+
"NSMetadataUbiquitousSharedItemRoleParticipant",
|
|
5069
|
+
"NSMultipleUnderlyingErrorsKey",
|
|
5070
|
+
"NSNEXTSTEPStringEncoding",
|
|
5071
|
+
"NSNextHashEnumeratorItem",
|
|
5072
|
+
"NSNextMapEnumeratorPair",
|
|
5073
|
+
"NSNonLossyASCIIStringEncoding",
|
|
5074
|
+
"NSNonOwnedPointerHashCallBacks",
|
|
5075
|
+
"NSNonOwnedPointerMapKeyCallBacks",
|
|
5076
|
+
"NSNonOwnedPointerMapValueCallBacks",
|
|
5077
|
+
"NSNonOwnedPointerOrNullMapKeyCallBacks",
|
|
5078
|
+
"NSNonRetainedObjectHashCallBacks",
|
|
5079
|
+
"NSNonRetainedObjectMapKeyCallBacks",
|
|
5080
|
+
"NSNonRetainedObjectMapValueCallBacks",
|
|
5081
|
+
"NSOSF1OperatingSystem",
|
|
5082
|
+
"NSObjectHashCallBacks",
|
|
5083
|
+
"NSObjectMapKeyCallBacks",
|
|
5084
|
+
"NSObjectMapValueCallBacks",
|
|
5085
|
+
"NSOpenStepRootDirectory",
|
|
5086
|
+
"NSOpenStepUnicodeReservedBase",
|
|
5087
|
+
"NSOwnedObjectIdentityHashCallBacks",
|
|
5088
|
+
"NSOwnedPointerHashCallBacks",
|
|
5089
|
+
"NSOwnedPointerMapKeyCallBacks",
|
|
5090
|
+
"NSOwnedPointerMapValueCallBacks",
|
|
5091
|
+
"NSPersianCalendar",
|
|
5092
|
+
"NSPointerToStructHashCallBacks",
|
|
5093
|
+
"NSPropertyListErrorMaximum",
|
|
5094
|
+
"NSPropertyListErrorMinimum",
|
|
5095
|
+
"NSProprietaryStringEncoding",
|
|
5096
|
+
"NSProtocolFromString",
|
|
5097
|
+
"NSRepublicOfChinaCalendar",
|
|
5098
|
+
"NSResetHashTable",
|
|
5099
|
+
"NSResetMapTable",
|
|
5100
|
+
"NSShiftJISStringEncoding",
|
|
5101
|
+
"NSSolarisOperatingSystem",
|
|
5102
|
+
"NSStringFromHashTable",
|
|
5103
|
+
"NSStringFromMapTable",
|
|
5104
|
+
"NSStringFromProtocol",
|
|
5105
|
+
"NSSunOSOperatingSystem",
|
|
5106
|
+
"NSSwapBigDoubleToHost",
|
|
5107
|
+
"NSSwapBigFloatToHost",
|
|
5108
|
+
"NSSwapBigIntToHost",
|
|
5109
|
+
"NSSwapBigLongLongToHost",
|
|
5110
|
+
"NSSwapBigLongToHost",
|
|
5111
|
+
"NSSwapBigShortToHost",
|
|
5112
|
+
"NSSwapDouble",
|
|
5113
|
+
"NSSwapFloat",
|
|
5114
|
+
"NSSwapHostDoubleToBig",
|
|
5115
|
+
"NSSwapHostDoubleToLittle",
|
|
5116
|
+
"NSSwapHostFloatToBig",
|
|
5117
|
+
"NSSwapHostFloatToLittle",
|
|
5118
|
+
"NSSwapHostIntToBig",
|
|
5119
|
+
"NSSwapHostIntToLittle",
|
|
5120
|
+
"NSSwapHostLongLongToBig",
|
|
5121
|
+
"NSSwapHostLongLongToLittle",
|
|
5122
|
+
"NSSwapHostLongToBig",
|
|
5123
|
+
"NSSwapHostLongToLittle",
|
|
5124
|
+
"NSSwapHostShortToBig",
|
|
5125
|
+
"NSSwapHostShortToLittle",
|
|
5126
|
+
"NSSwapInt",
|
|
5127
|
+
"NSSwapLittleDoubleToHost",
|
|
5128
|
+
"NSSwapLittleFloatToHost",
|
|
5129
|
+
"NSSwapLittleIntToHost",
|
|
5130
|
+
"NSSwapLittleLongLongToHost",
|
|
5131
|
+
"NSSwapLittleLongToHost",
|
|
5132
|
+
"NSSwapLittleShortToHost",
|
|
5133
|
+
"NSSwapLong",
|
|
5134
|
+
"NSSwapLongLong",
|
|
5135
|
+
"NSSwapShort",
|
|
5136
|
+
"NSSymbolStringEncoding",
|
|
5137
|
+
"NSTextCheckingAllCustomTypes",
|
|
5138
|
+
"NSTextCheckingAllSystemTypes",
|
|
5139
|
+
"NSTextCheckingAllTypes",
|
|
5140
|
+
"NSURLAuthenticationMethodHTMLForm",
|
|
5141
|
+
"NSURLAuthenticationMethodNTLM",
|
|
5142
|
+
"NSURLAuthenticationMethodNegotiate",
|
|
5143
|
+
"NSURLCredentialStorageRemoveSynchronizableCredentials",
|
|
5144
|
+
"NSURLErrorFileOutsideSafeArea",
|
|
5145
|
+
"NSURLFileScheme",
|
|
5146
|
+
"NSURLProtectionSpaceFTP",
|
|
5147
|
+
"NSURLProtectionSpaceFTPProxy",
|
|
5148
|
+
"NSURLProtectionSpaceHTTP",
|
|
5149
|
+
"NSURLProtectionSpaceHTTPProxy",
|
|
5150
|
+
"NSURLProtectionSpaceHTTPS",
|
|
5151
|
+
"NSURLProtectionSpaceHTTPSProxy",
|
|
5152
|
+
"NSURLProtectionSpaceSOCKSProxy",
|
|
5153
|
+
"NSURLSessionDownloadTaskResumeData",
|
|
5154
|
+
"NSURLSessionTransferSizeUnknown",
|
|
5155
|
+
"NSURLSessionUploadTaskResumeData",
|
|
5156
|
+
"NSUTF16BigEndianStringEncoding",
|
|
5157
|
+
"NSUTF16LittleEndianStringEncoding",
|
|
5158
|
+
"NSUTF16StringEncoding",
|
|
5159
|
+
"NSUTF32BigEndianStringEncoding",
|
|
5160
|
+
"NSUTF32LittleEndianStringEncoding",
|
|
5161
|
+
"NSUTF32StringEncoding",
|
|
5162
|
+
"NSUTF8StringEncoding",
|
|
5163
|
+
"NSUbiquitousFileErrorMaximum",
|
|
5164
|
+
"NSUbiquitousFileErrorMinimum",
|
|
5165
|
+
"NSUbiquitousKeyValueStoreAccountChange",
|
|
5166
|
+
"NSUbiquitousKeyValueStoreChangeReasonKey",
|
|
5167
|
+
"NSUbiquitousKeyValueStoreChangedKeysKey",
|
|
5168
|
+
"NSUbiquitousKeyValueStoreInitialSyncChange",
|
|
5169
|
+
"NSUbiquitousKeyValueStoreQuotaViolationChange",
|
|
5170
|
+
"NSUbiquitousKeyValueStoreServerChange",
|
|
5171
|
+
"NSUndefinedDateComponent",
|
|
5172
|
+
"NSUndoCloseGroupingRunLoopOrdering",
|
|
5173
|
+
"NSUndoManagerGroupIsDiscardableKey",
|
|
5174
|
+
"NSUnicodeStringEncoding",
|
|
5175
|
+
"NSUserActivityErrorMaximum",
|
|
5176
|
+
"NSUserActivityErrorMinimum",
|
|
5177
|
+
"NSUserActivityTypeBrowsingWeb",
|
|
5178
|
+
"NSValidationErrorMaximum",
|
|
5179
|
+
"NSValidationErrorMinimum",
|
|
5180
|
+
"NSWindows95OperatingSystem",
|
|
5181
|
+
"NSWindowsCP1250StringEncoding",
|
|
5182
|
+
"NSWindowsCP1251StringEncoding",
|
|
5183
|
+
"NSWindowsCP1252StringEncoding",
|
|
5184
|
+
"NSWindowsCP1253StringEncoding",
|
|
5185
|
+
"NSWindowsCP1254StringEncoding",
|
|
5186
|
+
"NSWindowsNTOperatingSystem",
|
|
5187
|
+
"NSWrapCalendarComponents",
|
|
5188
|
+
"NSXPCConnectionCodeSigningRequirementFailure",
|
|
5189
|
+
"NSXPCConnectionErrorMaximum",
|
|
5190
|
+
"NSXPCConnectionErrorMinimum",
|
|
5191
|
+
"NS_BigEndian",
|
|
5192
|
+
"NS_LittleEndian",
|
|
5193
|
+
"NS_UnknownByteOrder",
|
|
5194
|
+
"kCFStringEncodingASCII"
|
|
5195
|
+
]);
|
|
5196
|
+
var CORE_FOUNDATION_OVERLAY_GLOBALS = /* @__PURE__ */ new Set([
|
|
5197
|
+
"kCFCoreFoundationVersionNumber10_0",
|
|
5198
|
+
"kCFCoreFoundationVersionNumber10_0_3",
|
|
5199
|
+
"kCFCoreFoundationVersionNumber10_1",
|
|
5200
|
+
"kCFCoreFoundationVersionNumber10_10",
|
|
5201
|
+
"kCFCoreFoundationVersionNumber10_10_1",
|
|
5202
|
+
"kCFCoreFoundationVersionNumber10_10_2",
|
|
5203
|
+
"kCFCoreFoundationVersionNumber10_10_3",
|
|
5204
|
+
"kCFCoreFoundationVersionNumber10_10_4",
|
|
5205
|
+
"kCFCoreFoundationVersionNumber10_10_5",
|
|
5206
|
+
"kCFCoreFoundationVersionNumber10_10_Max",
|
|
5207
|
+
"kCFCoreFoundationVersionNumber10_11",
|
|
5208
|
+
"kCFCoreFoundationVersionNumber10_11_1",
|
|
5209
|
+
"kCFCoreFoundationVersionNumber10_11_2",
|
|
5210
|
+
"kCFCoreFoundationVersionNumber10_11_3",
|
|
5211
|
+
"kCFCoreFoundationVersionNumber10_11_4",
|
|
5212
|
+
"kCFCoreFoundationVersionNumber10_11_Max",
|
|
5213
|
+
"kCFCoreFoundationVersionNumber10_1_1",
|
|
5214
|
+
"kCFCoreFoundationVersionNumber10_1_2",
|
|
5215
|
+
"kCFCoreFoundationVersionNumber10_1_3",
|
|
5216
|
+
"kCFCoreFoundationVersionNumber10_1_4",
|
|
5217
|
+
"kCFCoreFoundationVersionNumber10_2",
|
|
5218
|
+
"kCFCoreFoundationVersionNumber10_2_1",
|
|
5219
|
+
"kCFCoreFoundationVersionNumber10_2_2",
|
|
5220
|
+
"kCFCoreFoundationVersionNumber10_2_3",
|
|
5221
|
+
"kCFCoreFoundationVersionNumber10_2_4",
|
|
5222
|
+
"kCFCoreFoundationVersionNumber10_2_5",
|
|
5223
|
+
"kCFCoreFoundationVersionNumber10_2_6",
|
|
5224
|
+
"kCFCoreFoundationVersionNumber10_2_7",
|
|
5225
|
+
"kCFCoreFoundationVersionNumber10_2_8",
|
|
5226
|
+
"kCFCoreFoundationVersionNumber10_3",
|
|
5227
|
+
"kCFCoreFoundationVersionNumber10_3_1",
|
|
5228
|
+
"kCFCoreFoundationVersionNumber10_3_2",
|
|
5229
|
+
"kCFCoreFoundationVersionNumber10_3_3",
|
|
5230
|
+
"kCFCoreFoundationVersionNumber10_3_4",
|
|
5231
|
+
"kCFCoreFoundationVersionNumber10_3_5",
|
|
5232
|
+
"kCFCoreFoundationVersionNumber10_3_6",
|
|
5233
|
+
"kCFCoreFoundationVersionNumber10_3_7",
|
|
5234
|
+
"kCFCoreFoundationVersionNumber10_3_8",
|
|
5235
|
+
"kCFCoreFoundationVersionNumber10_3_9",
|
|
5236
|
+
"kCFCoreFoundationVersionNumber10_4",
|
|
5237
|
+
"kCFCoreFoundationVersionNumber10_4_1",
|
|
5238
|
+
"kCFCoreFoundationVersionNumber10_4_10",
|
|
5239
|
+
"kCFCoreFoundationVersionNumber10_4_11",
|
|
5240
|
+
"kCFCoreFoundationVersionNumber10_4_2",
|
|
5241
|
+
"kCFCoreFoundationVersionNumber10_4_3",
|
|
5242
|
+
"kCFCoreFoundationVersionNumber10_4_4_Intel",
|
|
5243
|
+
"kCFCoreFoundationVersionNumber10_4_4_PowerPC",
|
|
5244
|
+
"kCFCoreFoundationVersionNumber10_4_5_Intel",
|
|
5245
|
+
"kCFCoreFoundationVersionNumber10_4_5_PowerPC",
|
|
5246
|
+
"kCFCoreFoundationVersionNumber10_4_6_Intel",
|
|
5247
|
+
"kCFCoreFoundationVersionNumber10_4_6_PowerPC",
|
|
5248
|
+
"kCFCoreFoundationVersionNumber10_4_7",
|
|
5249
|
+
"kCFCoreFoundationVersionNumber10_4_8",
|
|
5250
|
+
"kCFCoreFoundationVersionNumber10_4_9",
|
|
5251
|
+
"kCFCoreFoundationVersionNumber10_5",
|
|
5252
|
+
"kCFCoreFoundationVersionNumber10_5_1",
|
|
5253
|
+
"kCFCoreFoundationVersionNumber10_5_2",
|
|
5254
|
+
"kCFCoreFoundationVersionNumber10_5_3",
|
|
5255
|
+
"kCFCoreFoundationVersionNumber10_5_4",
|
|
5256
|
+
"kCFCoreFoundationVersionNumber10_5_5",
|
|
5257
|
+
"kCFCoreFoundationVersionNumber10_5_6",
|
|
5258
|
+
"kCFCoreFoundationVersionNumber10_5_7",
|
|
5259
|
+
"kCFCoreFoundationVersionNumber10_5_8",
|
|
5260
|
+
"kCFCoreFoundationVersionNumber10_6",
|
|
5261
|
+
"kCFCoreFoundationVersionNumber10_6_1",
|
|
5262
|
+
"kCFCoreFoundationVersionNumber10_6_2",
|
|
5263
|
+
"kCFCoreFoundationVersionNumber10_6_3",
|
|
5264
|
+
"kCFCoreFoundationVersionNumber10_6_4",
|
|
5265
|
+
"kCFCoreFoundationVersionNumber10_6_5",
|
|
5266
|
+
"kCFCoreFoundationVersionNumber10_6_6",
|
|
5267
|
+
"kCFCoreFoundationVersionNumber10_6_7",
|
|
5268
|
+
"kCFCoreFoundationVersionNumber10_6_8",
|
|
5269
|
+
"kCFCoreFoundationVersionNumber10_7",
|
|
5270
|
+
"kCFCoreFoundationVersionNumber10_7_1",
|
|
5271
|
+
"kCFCoreFoundationVersionNumber10_7_2",
|
|
5272
|
+
"kCFCoreFoundationVersionNumber10_7_3",
|
|
5273
|
+
"kCFCoreFoundationVersionNumber10_7_4",
|
|
5274
|
+
"kCFCoreFoundationVersionNumber10_7_5",
|
|
5275
|
+
"kCFCoreFoundationVersionNumber10_8",
|
|
5276
|
+
"kCFCoreFoundationVersionNumber10_8_1",
|
|
5277
|
+
"kCFCoreFoundationVersionNumber10_8_2",
|
|
5278
|
+
"kCFCoreFoundationVersionNumber10_8_3",
|
|
5279
|
+
"kCFCoreFoundationVersionNumber10_8_4",
|
|
5280
|
+
"kCFCoreFoundationVersionNumber10_9",
|
|
5281
|
+
"kCFCoreFoundationVersionNumber10_9_1",
|
|
5282
|
+
"kCFCoreFoundationVersionNumber10_9_2",
|
|
5283
|
+
"kCFCoreFoundationVersionNumber_iOS_4_0",
|
|
5284
|
+
"kCFCoreFoundationVersionNumber_iOS_4_1",
|
|
5285
|
+
"kCFCoreFoundationVersionNumber_iOS_4_2",
|
|
5286
|
+
"kCFCoreFoundationVersionNumber_iOS_4_3",
|
|
5287
|
+
"kCFCoreFoundationVersionNumber_iOS_5_0",
|
|
5288
|
+
"kCFCoreFoundationVersionNumber_iOS_5_1",
|
|
5289
|
+
"kCFCoreFoundationVersionNumber_iOS_6_0",
|
|
5290
|
+
"kCFCoreFoundationVersionNumber_iOS_6_1",
|
|
5291
|
+
"kCFCoreFoundationVersionNumber_iOS_7_0",
|
|
5292
|
+
"kCFCoreFoundationVersionNumber_iOS_7_1",
|
|
5293
|
+
"kCFCoreFoundationVersionNumber_iOS_8_0",
|
|
5294
|
+
"kCFCoreFoundationVersionNumber_iOS_8_1",
|
|
5295
|
+
"kCFCoreFoundationVersionNumber_iOS_8_2",
|
|
5296
|
+
"kCFCoreFoundationVersionNumber_iOS_8_3",
|
|
5297
|
+
"kCFCoreFoundationVersionNumber_iOS_8_4",
|
|
5298
|
+
"kCFCoreFoundationVersionNumber_iOS_8_x_Max",
|
|
5299
|
+
"kCFCoreFoundationVersionNumber_iOS_9_0",
|
|
5300
|
+
"kCFCoreFoundationVersionNumber_iOS_9_1",
|
|
5301
|
+
"kCFCoreFoundationVersionNumber_iOS_9_2",
|
|
5302
|
+
"kCFCoreFoundationVersionNumber_iOS_9_3",
|
|
5303
|
+
"kCFCoreFoundationVersionNumber_iOS_9_4",
|
|
5304
|
+
"kCFCoreFoundationVersionNumber_iOS_9_x_Max",
|
|
5305
|
+
"kCFCoreFoundationVersionNumber_iPhoneOS_2_0",
|
|
5306
|
+
"kCFCoreFoundationVersionNumber_iPhoneOS_2_1",
|
|
5307
|
+
"kCFCoreFoundationVersionNumber_iPhoneOS_2_2",
|
|
5308
|
+
"kCFCoreFoundationVersionNumber_iPhoneOS_3_0",
|
|
5309
|
+
"kCFCoreFoundationVersionNumber_iPhoneOS_3_1",
|
|
5310
|
+
"kCFCoreFoundationVersionNumber_iPhoneOS_3_2"
|
|
5311
|
+
]);
|
|
5312
|
+
var CORE_FOUNDATION_GEOMETRY_TYPES = /* @__PURE__ */ new Set([
|
|
5313
|
+
"CGFloat",
|
|
5314
|
+
"CGPoint",
|
|
5315
|
+
"CGSize",
|
|
5316
|
+
"CGRect",
|
|
5317
|
+
"CGRectEdge"
|
|
5318
|
+
]);
|
|
5319
|
+
var CORE_FOUNDATION_GRAPHICS_TYPES = /* @__PURE__ */ new Set([
|
|
5320
|
+
"CGAffineTransform",
|
|
5321
|
+
"CGAffineTransformComponents",
|
|
5322
|
+
"CGVector"
|
|
5323
|
+
]);
|
|
5324
|
+
var CORE_FOUNDATION_HANDLE_IMPORTS = [
|
|
5325
|
+
"CFAllocator",
|
|
5326
|
+
"CFArray",
|
|
5327
|
+
"CFAttributedString",
|
|
5328
|
+
"CFBoolean",
|
|
5329
|
+
"CFData",
|
|
5330
|
+
"CFDate",
|
|
5331
|
+
"CFDictionary",
|
|
5332
|
+
"CFError",
|
|
5333
|
+
"CFMutableData",
|
|
5334
|
+
"CFNumber",
|
|
5335
|
+
"CFSet",
|
|
5336
|
+
"CFString",
|
|
5337
|
+
"CFURL"
|
|
5338
|
+
].map((name) => `import class CoreFoundation.${name}`).concat([
|
|
5339
|
+
"import typealias CoreFoundation.CFPropertyList",
|
|
5340
|
+
"import typealias CoreFoundation.CFTypeRef",
|
|
5341
|
+
"import CoreGraphics"
|
|
5342
|
+
]).join("; ");
|
|
4514
5343
|
function swiftSourceAsIOS(original, extraObjCExtensions, objc = objcIndex([original])) {
|
|
4515
5344
|
const source = liftExtensionOverrides(
|
|
4516
5345
|
lowerObjCRuntimeCalls(lowerObjCOptionalRequirements(original, objc), objc),
|
|
@@ -4558,21 +5387,55 @@ function swiftSourceAsIOS(original, extraObjCExtensions, objc = objcIndex([origi
|
|
|
4558
5387
|
const imported = /^import\s+([A-Za-z_]\w*)(?:\s*\.\s*[A-Za-z_]\w*)+/.exec(rest);
|
|
4559
5388
|
if (imported) {
|
|
4560
5389
|
out += conditioned.slice(copied, at) + `import ${imported[1]}`.padEnd(imported[0].length);
|
|
5390
|
+
if (imported[1] === "CoreFoundation") out += `; ${CORE_FOUNDATION_HANDLE_IMPORTS}`;
|
|
4561
5391
|
copied = at + imported[0].length;
|
|
4562
5392
|
continue;
|
|
4563
5393
|
}
|
|
5394
|
+
const coreFoundationImport = /^import\s+CoreFoundation\b/.exec(rest);
|
|
5395
|
+
if (coreFoundationImport) {
|
|
5396
|
+
out += conditioned.slice(copied, at) + coreFoundationImport[0] + `; ${CORE_FOUNDATION_HANDLE_IMPORTS}`;
|
|
5397
|
+
copied = at + coreFoundationImport[0].length;
|
|
5398
|
+
continue;
|
|
5399
|
+
}
|
|
4564
5400
|
if (/^NSClassFromString\b/.test(rest)) {
|
|
4565
5401
|
out += conditioned.slice(copied, at) + "_peachClassFromString";
|
|
4566
5402
|
copied = at + "NSClassFromString".length;
|
|
4567
5403
|
continue;
|
|
4568
5404
|
}
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
5405
|
+
const foundationMember = /^Foundation\s*\.\s*(?:`([A-Za-z_]\w*)`|([A-Za-z_]\w*)\b)/.exec(rest);
|
|
5406
|
+
const foundationName = foundationMember?.[1] ?? foundationMember?.[2];
|
|
5407
|
+
let foundationOwner;
|
|
5408
|
+
if (foundationName !== void 0) {
|
|
5409
|
+
if (foundationName === "NSClassFromString" || foundationName === "NSKeyValueChange" || foundationName === "NSKeyValueObservedChange" || foundationName === "NSKeyValueObservation")
|
|
5410
|
+
foundationOwner = "PeachObjC";
|
|
5411
|
+
else if (foundationName === "DispatchData") foundationOwner = "Dispatch";
|
|
5412
|
+
else if (FOUNDATION_NETWORKING_TYPES.has(foundationName))
|
|
5413
|
+
foundationOwner = "FoundationNetworking";
|
|
5414
|
+
else if (FOUNDATION_OVERLAY_TYPES.has(foundationName) || FOUNDATION_OVERLAY_GLOBALS.has(foundationName) || CORE_FOUNDATION_OVERLAY_GLOBALS.has(foundationName))
|
|
5415
|
+
foundationOwner = "PeachFoundation";
|
|
5416
|
+
}
|
|
5417
|
+
if (foundationOwner !== void 0) {
|
|
5418
|
+
out += conditioned.slice(copied, at) + foundationOwner;
|
|
4573
5419
|
copied = at + "Foundation".length;
|
|
4574
5420
|
continue;
|
|
4575
5421
|
}
|
|
5422
|
+
const coreFoundationMember = /^CoreFoundation\s*\.\s*(?:`([A-Za-z_]\w*)`|([A-Za-z_]\w*)\b)/.exec(rest);
|
|
5423
|
+
const coreFoundationName = coreFoundationMember?.[1] ?? coreFoundationMember?.[2];
|
|
5424
|
+
if (coreFoundationName !== void 0 && CORE_FOUNDATION_OVERLAY_GLOBALS.has(coreFoundationName)) {
|
|
5425
|
+
out += conditioned.slice(copied, at) + "PeachFoundation";
|
|
5426
|
+
copied = at + "CoreFoundation".length;
|
|
5427
|
+
continue;
|
|
5428
|
+
}
|
|
5429
|
+
if (coreFoundationName !== void 0 && CORE_FOUNDATION_GEOMETRY_TYPES.has(coreFoundationName)) {
|
|
5430
|
+
out += conditioned.slice(copied, at) + "Foundation";
|
|
5431
|
+
copied = at + "CoreFoundation".length;
|
|
5432
|
+
continue;
|
|
5433
|
+
}
|
|
5434
|
+
if (coreFoundationName !== void 0 && CORE_FOUNDATION_GRAPHICS_TYPES.has(coreFoundationName)) {
|
|
5435
|
+
out += conditioned.slice(copied, at) + "CoreGraphics";
|
|
5436
|
+
copied = at + "CoreFoundation".length;
|
|
5437
|
+
continue;
|
|
5438
|
+
}
|
|
4576
5439
|
if (rest.startsWith("class")) {
|
|
4577
5440
|
const declared2 = CLASS_BASE.exec(rest);
|
|
4578
5441
|
if (declared2 && reusableViews.has(declared2[2].split(".").pop())) {
|
|
@@ -4697,7 +5560,7 @@ function swiftApplicationEntry(file, source) {
|
|
|
4697
5560
|
else if (source[at] === "}") depth--;
|
|
4698
5561
|
else if (depth === 0 && /^@(?:main|UIApplicationMain)\b/.test(source.slice(at)))
|
|
4699
5562
|
return true;
|
|
4700
|
-
else if (depth === 0 &&
|
|
5563
|
+
else if (depth === 0 && path5.basename(file) === "main.swift" && /^UIApplicationMain\s*\(/.test(source.slice(at)))
|
|
4701
5564
|
return true;
|
|
4702
5565
|
}
|
|
4703
5566
|
return false;
|
|
@@ -4784,7 +5647,7 @@ function swiftCodeScan(source) {
|
|
|
4784
5647
|
else top.parens--;
|
|
4785
5648
|
i++;
|
|
4786
5649
|
} else {
|
|
4787
|
-
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;
|
|
5650
|
+
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;
|
|
4788
5651
|
if (keyword && !/[\w$]/.test(source[i - 1] ?? "") && !/[\w$]/.test(source[i + keyword.length] ?? "")) {
|
|
4789
5652
|
tokens.push(i);
|
|
4790
5653
|
i += keyword.length;
|
|
@@ -4803,26 +5666,26 @@ function prepareSwiftDependency(source, destination) {
|
|
|
4803
5666
|
for (const entry of readdirSync2(from, { withFileTypes: true })) {
|
|
4804
5667
|
if (entry.name === ".git" || entry.name === ".build" || entry.name === ".swiftpm")
|
|
4805
5668
|
continue;
|
|
4806
|
-
const file =
|
|
5669
|
+
const file = path5.join(from, entry.name);
|
|
4807
5670
|
if (entry.isDirectory()) gather(file);
|
|
4808
5671
|
else if (entry.isFile() && entry.name.endsWith(".swift"))
|
|
4809
|
-
origins[
|
|
5672
|
+
origins[path5.relative(source, file)] = readFileSync4(file, "utf8");
|
|
4810
5673
|
}
|
|
4811
5674
|
};
|
|
4812
5675
|
gather(source);
|
|
4813
|
-
const manifest =
|
|
4814
|
-
const targets = existsSync2(manifest) ? swiftManifestTargets(
|
|
5676
|
+
const manifest = path5.join(source, "Package.swift");
|
|
5677
|
+
const targets = existsSync2(manifest) ? swiftManifestTargets(readFileSync4(manifest, "utf8")) : [];
|
|
4815
5678
|
const compiled = compiledSwiftSources(origins, targets);
|
|
4816
5679
|
const copy = (from, to) => {
|
|
4817
5680
|
mkdirSync(to, { recursive: true });
|
|
4818
5681
|
for (const entry of readdirSync2(from, { withFileTypes: true })) {
|
|
4819
5682
|
if (entry.name === ".git" || entry.name === ".build" || entry.name === ".swiftpm")
|
|
4820
5683
|
continue;
|
|
4821
|
-
const file =
|
|
4822
|
-
const target =
|
|
5684
|
+
const file = path5.join(from, entry.name);
|
|
5685
|
+
const target = path5.join(to, entry.name);
|
|
4823
5686
|
if (entry.isDirectory()) copy(file, target);
|
|
4824
5687
|
else if (entry.isFile() && entry.name.endsWith(".swift"))
|
|
4825
|
-
writeFileSync2(target, compiled.get(
|
|
5688
|
+
writeFileSync2(target, compiled.get(path5.relative(source, file)));
|
|
4826
5689
|
else cpSync(file, target, { verbatimSymlinks: true });
|
|
4827
5690
|
}
|
|
4828
5691
|
};
|
|
@@ -4839,7 +5702,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
4839
5702
|
const targets = distribution && compileTargets(input).length === 0 ? [
|
|
4840
5703
|
{
|
|
4841
5704
|
name: "App",
|
|
4842
|
-
path:
|
|
5705
|
+
path: path5.relative(layout.root, layout.sources),
|
|
4843
5706
|
executable: true,
|
|
4844
5707
|
languageMode: 5,
|
|
4845
5708
|
mainActorIsolation: false,
|
|
@@ -4848,7 +5711,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
4848
5711
|
] : compileTargets(input);
|
|
4849
5712
|
const files = /* @__PURE__ */ new Map();
|
|
4850
5713
|
const native = /* @__PURE__ */ new Map();
|
|
4851
|
-
const headerDirectory =
|
|
5714
|
+
const headerDirectory = path5.join(layout.root, ".build", "peach-cxx-headers");
|
|
4852
5715
|
for (const target of targets) {
|
|
4853
5716
|
const prefix = target.path === "." ? "" : `${target.path}/`;
|
|
4854
5717
|
const entries = Object.entries(input.files).filter(
|
|
@@ -4871,7 +5734,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
4871
5734
|
if (producer && targets.some((value) => value.name === producer))
|
|
4872
5735
|
producers.add(producer);
|
|
4873
5736
|
const local = [
|
|
4874
|
-
|
|
5737
|
+
path5.posix.join(path5.posix.dirname(file), include),
|
|
4875
5738
|
`${includes}${include}`
|
|
4876
5739
|
].find((candidate) => input.files[candidate] !== void 0);
|
|
4877
5740
|
if (local) {
|
|
@@ -4893,7 +5756,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
4893
5756
|
const late = units.filter(([file]) => consumers.get(file).size > 0);
|
|
4894
5757
|
native.set(target.name, {
|
|
4895
5758
|
path: target.path,
|
|
4896
|
-
includeDirectory:
|
|
5759
|
+
includeDirectory: path5.join(layout.root, includes),
|
|
4897
5760
|
lateSources: late.map(([file]) => file.slice(prefix.length)),
|
|
4898
5761
|
...late.length > 0 ? {
|
|
4899
5762
|
late: {
|
|
@@ -4910,7 +5773,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
4910
5773
|
([file]) => file.startsWith(includes) && /\.(?:h|hpp|hh|hxx)$/.test(file) && consumers.get(file).size === 0
|
|
4911
5774
|
);
|
|
4912
5775
|
files.set(
|
|
4913
|
-
|
|
5776
|
+
path5.join(layout.root, includes, "module.modulemap"),
|
|
4914
5777
|
[
|
|
4915
5778
|
`module ${target.name} {`,
|
|
4916
5779
|
...roots.map(
|
|
@@ -4923,13 +5786,13 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
4923
5786
|
);
|
|
4924
5787
|
}
|
|
4925
5788
|
if (native.size > 0) mkdirSync(headerDirectory, { recursive: true });
|
|
4926
|
-
const modulePlan =
|
|
5789
|
+
const modulePlan = createHash4("sha256").update(
|
|
4927
5790
|
swiftModuleInputFiles(moduleRoot).join("\n")
|
|
4928
5791
|
);
|
|
4929
5792
|
if (!distribution) {
|
|
4930
|
-
modulePlan.update(
|
|
5793
|
+
modulePlan.update(readFileSync4(path5.join(moduleRoot, "Package.swift")));
|
|
4931
5794
|
}
|
|
4932
|
-
const resourcePlan =
|
|
5795
|
+
const resourcePlan = createHash4("sha256").update(
|
|
4933
5796
|
JSON.stringify(
|
|
4934
5797
|
resourceTargets.filter((target) => target.resources).map((target) => [
|
|
4935
5798
|
target.name,
|
|
@@ -4954,10 +5817,10 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
4954
5817
|
if (targets.length === 0) {
|
|
4955
5818
|
for (const [file, contents] of Object.entries(input.files)) {
|
|
4956
5819
|
if (file === "Package.swift") continue;
|
|
4957
|
-
files.set(
|
|
5820
|
+
files.set(path5.join(layout.sources, file), compiled.get(file) ?? contents);
|
|
4958
5821
|
}
|
|
4959
|
-
let manifest =
|
|
4960
|
-
|
|
5822
|
+
let manifest = readFileSync4(
|
|
5823
|
+
path5.join(moduleRoot, "scripts/contrast-app-Package.swift"),
|
|
4961
5824
|
"utf8"
|
|
4962
5825
|
).replaceAll("__SOOTSIM_SWIFT_PACKAGE__", moduleRoot);
|
|
4963
5826
|
const reactor = ` ${REACTOR_FLAG}`;
|
|
@@ -5001,21 +5864,21 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
5001
5864
|
manifest = manifest.replace(anchor, `${anchor}
|
|
5002
5865
|
${SPRITEKIT_PRODUCT},`);
|
|
5003
5866
|
}
|
|
5004
|
-
files.set(
|
|
5867
|
+
files.set(path5.join(layout.root, "Package.swift"), manifest + moduleFiles);
|
|
5005
5868
|
} else {
|
|
5006
5869
|
const base = layout.multi ? layout.root : layout.sources;
|
|
5007
5870
|
const libraries = /* @__PURE__ */ new Map();
|
|
5008
5871
|
for (const [target, data] of Object.entries(input.libraries ?? {})) {
|
|
5009
|
-
const file =
|
|
5872
|
+
const file = path5.join(layout.root, ".peach-libraries", `lib${target}.a`);
|
|
5010
5873
|
files.set(file, Buffer.from(data, "base64"));
|
|
5011
5874
|
libraries.set(target, file);
|
|
5012
5875
|
}
|
|
5013
5876
|
for (const [file, contents] of Object.entries(input.files)) {
|
|
5014
5877
|
if (file === "Package.swift") continue;
|
|
5015
|
-
files.set(
|
|
5878
|
+
files.set(path5.join(base, file), compiled.get(file) ?? contents);
|
|
5016
5879
|
}
|
|
5017
5880
|
files.set(
|
|
5018
|
-
|
|
5881
|
+
path5.join(layout.root, "Package.swift"),
|
|
5019
5882
|
emitSwiftPackageManifest({
|
|
5020
5883
|
targets,
|
|
5021
5884
|
native,
|
|
@@ -5032,7 +5895,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
5032
5895
|
spriteKit: importsSpriteKit(input.files),
|
|
5033
5896
|
distribution: distribution ?? void 0,
|
|
5034
5897
|
distributionLink: {
|
|
5035
|
-
path:
|
|
5898
|
+
path: path5.join(layout.root, ".peach-distribution-objects.rsp"),
|
|
5036
5899
|
files
|
|
5037
5900
|
},
|
|
5038
5901
|
libraries
|
|
@@ -5048,9 +5911,9 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
5048
5911
|
throw new Error(
|
|
5049
5912
|
`swift resource target ${target.name} has no matching bundle assignment`
|
|
5050
5913
|
);
|
|
5051
|
-
const directory = layout.multi ?
|
|
5914
|
+
const directory = layout.multi ? path5.join(layout.root, target.path) : layout.sources;
|
|
5052
5915
|
files.set(
|
|
5053
|
-
|
|
5916
|
+
path5.join(directory, "ResourceBundleAccessor.generated.swift"),
|
|
5054
5917
|
[
|
|
5055
5918
|
"import Foundation",
|
|
5056
5919
|
"",
|
|
@@ -5083,13 +5946,13 @@ function outputOf(error) {
|
|
|
5083
5946
|
return error instanceof Error ? error.message : String(error);
|
|
5084
5947
|
}
|
|
5085
5948
|
function builtArtifact(layout) {
|
|
5086
|
-
const binDir =
|
|
5087
|
-
const manifest =
|
|
5949
|
+
const binDir = path5.join(layout.root, ".build", WASM_TRIPLE, "release");
|
|
5950
|
+
const manifest = readFileSync4(path5.join(layout.root, "Package.swift"), "utf8");
|
|
5088
5951
|
const executable = swiftManifestTargets(manifest).find((target) => target.executable);
|
|
5089
5952
|
if (executable === void 0) {
|
|
5090
5953
|
throw new Error("swift-compile: the written manifest names no executable target");
|
|
5091
5954
|
}
|
|
5092
|
-
const file =
|
|
5955
|
+
const file = path5.join(binDir, `${executable.name}.wasm`);
|
|
5093
5956
|
if (!existsSync2(file)) {
|
|
5094
5957
|
const found = existsSync2(binDir) ? readdirSync2(binDir).filter((name) => name.endsWith(".wasm")).sort() : [];
|
|
5095
5958
|
throw new Error(
|
|
@@ -5100,8 +5963,8 @@ function builtArtifact(layout) {
|
|
|
5100
5963
|
}
|
|
5101
5964
|
function projectDiagnostic(output, layout, files) {
|
|
5102
5965
|
const base = layout.multi ? layout.root : layout.sources;
|
|
5103
|
-
const prefix = `${base}${
|
|
5104
|
-
return designTimeDiagnostic(output, files).split("\n").map((line) => line.startsWith(prefix) ? line.slice(prefix.length) : line).join("\n").trim();
|
|
5966
|
+
const prefix = `${base}${path5.sep}`;
|
|
5967
|
+
return designTimeDiagnostic(output, files).split("\n").filter((line) => !SWIFTPM_NOISE.test(line)).map((line) => line.startsWith(prefix) ? line.slice(prefix.length) : line).join("\n").trim();
|
|
5105
5968
|
}
|
|
5106
5969
|
var ROOT_LOCKS = Symbol.for("peachsim.swiftCompile.rootLocks");
|
|
5107
5970
|
var host = globalThis;
|
|
@@ -5136,13 +5999,13 @@ function serialize(root, work, signal) {
|
|
|
5136
5999
|
function readCompiledArtifact(directory, hash) {
|
|
5137
6000
|
try {
|
|
5138
6001
|
const receipt = JSON.parse(
|
|
5139
|
-
|
|
6002
|
+
readFileSync4(path5.join(directory, "artifact.json"), "utf8")
|
|
5140
6003
|
);
|
|
5141
6004
|
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")
|
|
5142
6005
|
return null;
|
|
5143
|
-
const bytes =
|
|
5144
|
-
const gzip2 =
|
|
5145
|
-
if (
|
|
6006
|
+
const bytes = readFileSync4(path5.join(directory, "app.wasm"));
|
|
6007
|
+
const gzip2 = readFileSync4(path5.join(directory, "icu.gz"));
|
|
6008
|
+
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)
|
|
5146
6009
|
return null;
|
|
5147
6010
|
return { hash, bytes, icu: { sha256: receipt.icu, gzip: gzip2 } };
|
|
5148
6011
|
} catch (error) {
|
|
@@ -5152,22 +6015,22 @@ function readCompiledArtifact(directory, hash) {
|
|
|
5152
6015
|
}
|
|
5153
6016
|
}
|
|
5154
6017
|
function saveCompiledArtifact(root, artifact) {
|
|
5155
|
-
const directory =
|
|
6018
|
+
const directory = path5.join(root, "artifact");
|
|
5156
6019
|
mkdirSync(directory, { recursive: true });
|
|
5157
|
-
const pending = mkdtempSync2(
|
|
6020
|
+
const pending = mkdtempSync2(path5.join(root, ".artifact-"));
|
|
5158
6021
|
try {
|
|
5159
|
-
writeFileSync2(
|
|
5160
|
-
writeFileSync2(
|
|
6022
|
+
writeFileSync2(path5.join(pending, "app.wasm"), artifact.bytes);
|
|
6023
|
+
writeFileSync2(path5.join(pending, "icu.gz"), artifact.icu.gzip);
|
|
5161
6024
|
writeFileSync2(
|
|
5162
|
-
|
|
6025
|
+
path5.join(pending, "artifact.json"),
|
|
5163
6026
|
JSON.stringify({
|
|
5164
6027
|
hash: artifact.hash,
|
|
5165
|
-
wasm:
|
|
6028
|
+
wasm: createHash4("sha256").update(artifact.bytes).digest("hex"),
|
|
5166
6029
|
icu: artifact.icu.sha256
|
|
5167
6030
|
})
|
|
5168
6031
|
);
|
|
5169
6032
|
for (const file of ["app.wasm", "icu.gz", "artifact.json"]) {
|
|
5170
|
-
renameSync(
|
|
6033
|
+
renameSync(path5.join(pending, file), path5.join(directory, file));
|
|
5171
6034
|
}
|
|
5172
6035
|
} finally {
|
|
5173
6036
|
rmSync2(pending, { recursive: true, force: true });
|
|
@@ -5188,14 +6051,14 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
5188
6051
|
options.signal?.throwIfAborted();
|
|
5189
6052
|
mkdirSync(options.buildRoot, { recursive: true });
|
|
5190
6053
|
const root = realpathSync(options.buildRoot);
|
|
5191
|
-
const moduleRoot =
|
|
6054
|
+
const moduleRoot = path5.resolve(options.moduleRoot);
|
|
5192
6055
|
const layout = {
|
|
5193
6056
|
root,
|
|
5194
|
-
sources:
|
|
6057
|
+
sources: path5.join(root, "Sources", "App"),
|
|
5195
6058
|
multi: compileTargets(input).length > 0
|
|
5196
6059
|
};
|
|
5197
6060
|
const hash = swiftArtifactHash(input, options.release, moduleRoot);
|
|
5198
|
-
const sharedRoot =
|
|
6061
|
+
const sharedRoot = path5.join(rnxHomeDir(), "cache", "swift-projects", hash);
|
|
5199
6062
|
const report = (message) => console.error(`[swift-project ${hash.slice(0, 16)}] ${message}`);
|
|
5200
6063
|
report("checking verified artifacts");
|
|
5201
6064
|
return serialize(
|
|
@@ -5206,17 +6069,17 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
5206
6069
|
report("reusing memory artifact");
|
|
5207
6070
|
return retain(root, retained);
|
|
5208
6071
|
}
|
|
5209
|
-
const cached = readCompiledArtifact(
|
|
5210
|
-
const previous = cached ?? readCompiledArtifact(
|
|
6072
|
+
const cached = readCompiledArtifact(path5.join(sharedRoot, "artifact"), hash);
|
|
6073
|
+
const previous = cached ?? readCompiledArtifact(path5.join(root, "artifact"), hash);
|
|
5211
6074
|
if (previous) {
|
|
5212
6075
|
if (!cached) saveCompiledArtifact(sharedRoot, previous);
|
|
5213
6076
|
report("reusing verified disk artifact");
|
|
5214
6077
|
return retain(root, previous);
|
|
5215
6078
|
}
|
|
5216
|
-
if (process.platform === "darwin" && process.env.TM_SESSION && !admittedMacBuilderSlot() && process.env.CI !== "true" && moduleRoot ===
|
|
5217
|
-
const requestRoot = mkdtempSync2(
|
|
5218
|
-
const output =
|
|
5219
|
-
const request =
|
|
6079
|
+
if (process.platform === "darwin" && process.env.TM_SESSION && !admittedMacBuilderSlot() && process.env.CI !== "true" && moduleRoot === path5.resolve(import.meta.dirname, "../../sootsim-swift") && !swiftDistributionAt(moduleRoot)) {
|
|
6080
|
+
const requestRoot = mkdtempSync2(path5.join(root, ".builder-request-"));
|
|
6081
|
+
const output = path5.join(requestRoot, "output");
|
|
6082
|
+
const request = path5.join(requestRoot, "request.json");
|
|
5220
6083
|
writeFileSync2(
|
|
5221
6084
|
request,
|
|
5222
6085
|
JSON.stringify({
|
|
@@ -5224,16 +6087,18 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
5224
6087
|
hash,
|
|
5225
6088
|
release: options.release,
|
|
5226
6089
|
timeoutMs: options.timeoutMs,
|
|
5227
|
-
|
|
6090
|
+
// framework sources and compiler inputs own the shared object tree;
|
|
6091
|
+
// unrelated app edits reuse it without retaining stale private ABI.
|
|
6092
|
+
buildKey: swiftProjectBuildKey(moduleRoot, options.release)
|
|
5228
6093
|
})
|
|
5229
6094
|
);
|
|
5230
6095
|
try {
|
|
5231
|
-
const repo =
|
|
6096
|
+
const repo = path5.resolve(moduleRoot, "../..");
|
|
5232
6097
|
report("requesting builder admission or cached result");
|
|
5233
6098
|
await runCompiler(
|
|
5234
6099
|
"bun",
|
|
5235
6100
|
[
|
|
5236
|
-
|
|
6101
|
+
path5.join(repo, "scripts/build/swift-project.ts"),
|
|
5237
6102
|
"--request",
|
|
5238
6103
|
request,
|
|
5239
6104
|
"--output",
|
|
@@ -5265,7 +6130,7 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
5265
6130
|
}
|
|
5266
6131
|
}
|
|
5267
6132
|
writeSwiftProject(layout, input, moduleRoot);
|
|
5268
|
-
const swift =
|
|
6133
|
+
const swift = path5.join(options.toolchainBin, "swift");
|
|
5269
6134
|
if (!existsSync2(swift)) {
|
|
5270
6135
|
throw new Error(
|
|
5271
6136
|
`swift-compile: no swift.org toolchain at ${options.toolchainBin}; install ${options.release} and its matching wasm sdk`
|
|
@@ -5282,12 +6147,14 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
5282
6147
|
const icu = swiftIcuAsset(options.toolchainBin, sdk);
|
|
5283
6148
|
const buildArgs = [
|
|
5284
6149
|
"build",
|
|
6150
|
+
...swiftPackageCacheOptions(),
|
|
5285
6151
|
"--build-system",
|
|
5286
6152
|
"native",
|
|
5287
6153
|
"-j",
|
|
5288
6154
|
BUILD_JOBS,
|
|
5289
6155
|
"--package-path",
|
|
5290
6156
|
root,
|
|
6157
|
+
...swiftSdkOptions(),
|
|
5291
6158
|
"--swift-sdk",
|
|
5292
6159
|
sdk,
|
|
5293
6160
|
"-c",
|
|
@@ -5311,8 +6178,8 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
5311
6178
|
// shipped host plugins resolve against the selected compiler's runtime.
|
|
5312
6179
|
...process.platform === "linux" ? {
|
|
5313
6180
|
LD_LIBRARY_PATH: [
|
|
5314
|
-
|
|
5315
|
-
|
|
6181
|
+
path5.resolve(options.toolchainBin, "../lib/swift/linux"),
|
|
6182
|
+
path5.resolve(options.toolchainBin, "../lib/swift/host"),
|
|
5316
6183
|
process.env.LD_LIBRARY_PATH
|
|
5317
6184
|
].filter(Boolean).join(":")
|
|
5318
6185
|
} : {}
|
|
@@ -5323,10 +6190,10 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
5323
6190
|
};
|
|
5324
6191
|
report("compiling and linking Swift modules");
|
|
5325
6192
|
try {
|
|
5326
|
-
await runCompiler(swift, buildArgs, buildOptions,
|
|
6193
|
+
await runCompiler(swift, buildArgs, buildOptions, SWIFTPM_PROGRESS, SWIFTPM_NOISE);
|
|
5327
6194
|
} catch (error) {
|
|
5328
6195
|
const output = outputOf(error);
|
|
5329
|
-
const moduleCache =
|
|
6196
|
+
const moduleCache = path5.join(
|
|
5330
6197
|
root,
|
|
5331
6198
|
".build",
|
|
5332
6199
|
WASM_TRIPLE,
|
|
@@ -5336,7 +6203,13 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
5336
6203
|
if (output.includes("was compiled with module cache path") && existsSync2(moduleCache)) {
|
|
5337
6204
|
rmSync2(moduleCache, { recursive: true, force: true });
|
|
5338
6205
|
try {
|
|
5339
|
-
await runCompiler(
|
|
6206
|
+
await runCompiler(
|
|
6207
|
+
swift,
|
|
6208
|
+
buildArgs,
|
|
6209
|
+
buildOptions,
|
|
6210
|
+
SWIFTPM_PROGRESS,
|
|
6211
|
+
SWIFTPM_NOISE
|
|
6212
|
+
);
|
|
5340
6213
|
} catch (retryError) {
|
|
5341
6214
|
throw new Error(
|
|
5342
6215
|
projectDiagnostic(outputOf(retryError), layout, input.files),
|
|
@@ -5353,7 +6226,7 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
5353
6226
|
}
|
|
5354
6227
|
const artifact = {
|
|
5355
6228
|
hash,
|
|
5356
|
-
bytes:
|
|
6229
|
+
bytes: readFileSync4(builtArtifact(layout)),
|
|
5357
6230
|
icu: await icu
|
|
5358
6231
|
};
|
|
5359
6232
|
saveCompiledArtifact(root, artifact);
|
|
@@ -5381,6 +6254,7 @@ export {
|
|
|
5381
6254
|
swiftApplicationEntry,
|
|
5382
6255
|
swiftArtifactHash,
|
|
5383
6256
|
swiftAvailableModules,
|
|
6257
|
+
swiftCodeMask,
|
|
5384
6258
|
swiftDistributionAt,
|
|
5385
6259
|
swiftIcuAsset,
|
|
5386
6260
|
swiftImportNames,
|
|
@@ -5389,6 +6263,7 @@ export {
|
|
|
5389
6263
|
swiftModuleInputFiles,
|
|
5390
6264
|
swiftModuleSdk,
|
|
5391
6265
|
swiftPeachModules,
|
|
6266
|
+
swiftProjectBuildKey,
|
|
5392
6267
|
swiftSdkPaths,
|
|
5393
6268
|
swiftSourceAsIOS,
|
|
5394
6269
|
swiftSourceClosure,
|