peachsim 0.1.1692 → 0.1.1700
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/bridge-flow-runner.ts +61 -39
- package/cli/commands/agent-wrapper.ts +21 -10
- package/cli/commands/control.ts +27 -7
- package/cli/commands/coverage.ts +1 -1
- package/cli/commands/detect.ts +17 -4
- package/cli/commands/maestro-compare.ts +25 -99
- package/cli/help-core.ts +3 -4
- package/cli/maestro-compare.ts +172 -4
- package/cli/outbound-endpoints.ts +2 -10
- package/detox/index.ts +15 -0
- package/detox/launch-permissions.ts +169 -0
- package/dist-lib/agent-daemon-client.cjs +2 -2
- package/dist-lib/agent-events.cjs +2 -2
- package/dist-lib/attached-projects.cjs +2 -2
- package/dist-lib/auth/shared-session.cjs +2 -2
- package/dist-lib/backend-origin.cjs +2 -2
- package/dist-lib/beta.cjs +2 -2
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +2 -2
- package/dist-lib/bridge-contract-input.cjs +2 -2
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +2 -2
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +18273 -15925
- package/dist-lib/capture-contract.cjs +2 -2
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +2 -2
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +2 -2
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +2 -2
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +2 -2
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +104 -3
- package/dist-lib/dev-bundle-resolution.cjs +208 -44
- package/dist-lib/expo-swift-bundle.cjs +2349 -1778
- package/dist-lib/expo-swift-metadata.cjs +2 -2
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +2 -2
- package/dist-lib/host/bridge-host.cjs +7885 -3334
- package/dist-lib/host/fetch-proxy-handler.cjs +331 -39
- package/dist-lib/host/fetch-proxy-overrides.cjs +2 -2
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +2 -2
- package/dist-lib/host/websocket-proxy.cjs +2 -2
- package/dist-lib/index.cjs +297 -77
- package/dist-lib/jump-to-source-babel.cjs +2 -2
- package/dist-lib/jump-to-source-native.cjs +2 -2
- package/dist-lib/kotlin-host.cjs +2 -2
- package/dist-lib/menu.cjs +2 -2
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +2 -2
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +2 -2
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +294 -74
- package/dist-lib/native-app-identity-project.cjs +48 -37
- package/dist-lib/native-app-identity-project.mjs +47 -36
- package/dist-lib/native-app-identity.cjs +2 -2
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +2 -2
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +2 -2
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +2 -2
- package/dist-lib/public-brand.cjs +2 -2
- package/dist-lib/public-origins-lib-esm.json +24 -23
- package/dist-lib/public-origins-lib.json +199 -79
- package/dist-lib/react-native-host-modules.cjs +2 -2
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/reap-browser.cjs +2 -2
- package/dist-lib/scripts/dev-server-scanner.cjs +206 -31
- package/dist-lib/sdk.cjs +2 -2
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +19600 -15992
- package/dist-lib/swift-compile.cjs +640 -402
- package/dist-lib/swift-compile.mjs +595 -357
- package/dist-lib/swift-package.cjs +24 -20
- package/dist-lib/swift-package.mjs +23 -19
- package/dist-lib/swift-submit.cjs +2 -2
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +31 -4
- package/dist-lib/swift.cjs +2 -2
- package/dist-lib/vite-swift.cjs +1559 -1208
- package/dist-lib/vite.cjs +251 -42
- package/dist-lib/worklet-executable.cjs +2 -2
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/font-config.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/scroll-pan-contacts.d.ts +3 -1
- package/dist-types/packages/peach-engine/src/engine/scroll.d.ts +7 -0
- package/dist-types/packages/peach-engine/src/engine/types.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +2 -2
- package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/render-worker/scroll-mirror.d.ts +17 -0
- package/dist-types/packages/peach-engine/src/render-worker/worker-input-runtime.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +3 -0
- package/dist-types/packages/peach-globals/src/cameraBridgeContract.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/replayBridgeContract.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/shellHostBridgeContract.d.ts +3 -0
- package/dist-types/packages/peach-kit/src/materials/types.d.ts +1 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/scripts/dev-server-scanner.ts +4 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Alpha.h +2282 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/BasicImageTypes.h +55 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Conversion.h +10551 -6
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Convolution.h +4236 -3
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Geometry.h +827 -8
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Histogram.h +1369 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Morphology.h +1243 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Transform.h +1747 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage.h +291 -2
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_CVUtilities.h +1283 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Types.h +811 -91
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Utilities.h +1342 -25
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns.h +2738 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_constants.h +1685 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_graph.h +913 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_structures.h +1917 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/LinearAlgebra.h +23 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/arithmetic.h +209 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/base.h +104 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/linear_systems.h +77 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/matrix.h +554 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/norms.h +58 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/object.h +186 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/splat.h +86 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/vector.h +364 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Quadrature/Integration.h +195 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Quadrature/Quadrature.h +44 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/BLAS/BLAS.h +2330 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/BLAS/Types.h +123 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/Solve.h +8339 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/SolveImplementation.h +520 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/SolveImplementationTyped.h +1893 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/Sparse.h +10 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/blas_new.h +1098 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas.h +859 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas_new.h +1134 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/clapack.h +10555 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/fortran_blas.h +695 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack.h +38526 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack_types.h +60 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack_version.h +20 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/thread_api.h +50 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vBasicOps.h +1218 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vBigNum.h +1458 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vDSP.h +10377 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vDSP_translate.h +167 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vForce.h +1243 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vecLib.h +114 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vecLibTypes.h +146 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vectorOps.h +1106 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vfp.h +294 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.h +25 -1
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFArray.h +673 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFAvailability.h +232 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h +827 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFCalendar.h +121 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFCharacterSet.h +387 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFData.h +79 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDate.h +122 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDictionary.h +674 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFError.h +182 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFLocale.h +213 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFNotificationCenter.h +82 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFNumber.h +129 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFSet.h +491 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFString.h +883 -2
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFTimeZone.h +98 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +11 -229
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h +2 -6
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +2 -1
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.h +1 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecBase.h +906 -3
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecCertificate.h +613 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecItem.h +1284 -29
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecPolicy.h +441 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecTrust.h +845 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/Security.h +4 -0
- package/sdk/ios/usr/include/AvailabilityMacros.h +3985 -0
- package/sdk/ios/usr/include/copyfile.h +143 -0
- package/sdk/ios/usr/include/malloc/_malloc.h +143 -0
- package/sdk/ios/usr/include/malloc/_malloc_type.h +153 -0
- package/sdk/ios/usr/include/malloc/_platform.h +80 -0
- package/sdk/ios/usr/include/malloc/_ptrcheck.h +43 -0
- package/sdk/ios/usr/include/malloc/malloc.h +768 -0
- package/sdk/ios/usr/include/os/availability.h +168 -6
- package/sdk/ios/usr/include/os/base.h +351 -0
- package/sdk/ios/usr/include/os/clock.h +18 -0
- package/sdk/ios/usr/include/os/lock.h +232 -10
- package/sdk/ios/usr/include/os/log.h +521 -38
- package/sdk/ios/usr/include/os/object.h +320 -3
- package/sdk/ios/usr/include/os/trace.h +492 -0
- package/sdk/ios/usr/include/os/trace_base.h +167 -0
- package/sdk/ios/usr/include/os/workgroup.h +37 -0
- package/sdk/ios/usr/include/os/workgroup_base.h +91 -0
- package/sdk/ios/usr/include/os/workgroup_interval.h +156 -0
- package/sdk/ios/usr/include/os/workgroup_object.h +359 -0
- package/sdk/ios/usr/include/os/workgroup_parallel.h +76 -0
- package/sdk/ios/usr/include/sys/cdefs.h +38 -0
- package/sdk/ios/wasm/include/unistd.h +3 -0
- package/skills/contrast/SKILL.md +3 -0
- package/src/codex-client.ts +11 -6
- package/src/dev-bundle-resolution.ts +124 -48
- package/src/expo-native-workspace.ts +176 -0
- package/src/expo-swift-host.ts +161 -26
- package/src/expo-swift-ready.ts +14 -28
- package/src/expoSwiftContract.ts +4 -1
- package/src/generated/swift-c-predefines.json +68 -12
- package/src/host/bridge-host.ts +5 -0
- package/src/installed-package-versions.ts +14 -1
- package/src/metro-project-root.ts +44 -33
- package/src/native-app-identity-project.ts +1 -0
- package/src/nitro-adapter.lock.json +916 -10
- package/src/nitro-adapter.ts +33 -24
- package/src/nitro-bundle.ts +108 -22
- package/src/nitro-compile.ts +32 -5
- package/src/nitro-source.ts +13 -3
- package/src/nitroAdapterContract.ts +100 -20
- package/src/node-http-fetch.ts +116 -0
- package/src/packageVersionsContract.ts +46 -0
- package/src/serverDiscoveryContract.ts +1 -0
- package/src/settingsContract.ts +0 -30
- package/src/swift-binary-modules.ts +20 -5
- package/src/swift-compile.ts +168 -48
- package/src/swift-coverage/xcode-assets.ts +4 -3
- package/src/swift-host.ts +14 -3
- package/src/swift-objc-compile.ts +32 -5
- package/src/swift-objc-metadata.ts +2 -2
- package/src/swift-objc-platform.ts +2 -2
- package/src/swift-objc-standin.ts +43 -13
- package/src/swift-package.ts +33 -26
- package/src/swift-source-pods.ts +126 -41
- package/src/swift-standin-digest.ts +77 -0
- package/src/swift-standin-emit.ts +40 -4
- package/src/swift-standins.ts +68 -19
- package/src/swift-toolchain.ts +38 -0
- package/src/swiftContract.ts +8 -0
- package/src/vite-plugin.ts +0 -10
- package/src/xcode-project.ts +62 -42
- package/src/settings-flags.ts +0 -107
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1700 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __export = (target, all) => {
|
|
4
4
|
for (var name2 in all)
|
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
spawn as spawn3,
|
|
11
11
|
execFileSync as execFileSync3
|
|
12
12
|
} from "node:child_process";
|
|
13
|
-
import { createHash as
|
|
13
|
+
import { createHash as createHash10 } from "node:crypto";
|
|
14
14
|
import {
|
|
15
15
|
cpSync,
|
|
16
|
-
existsSync as
|
|
16
|
+
existsSync as existsSync3,
|
|
17
17
|
mkdirSync as mkdirSync2,
|
|
18
18
|
mkdtempSync as mkdtempSync2,
|
|
19
|
-
readFileSync as
|
|
19
|
+
readFileSync as readFileSync7,
|
|
20
20
|
readdirSync as readdirSync4,
|
|
21
21
|
realpathSync,
|
|
22
22
|
renameSync,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
writeFileSync as writeFileSync3
|
|
27
27
|
} from "node:fs";
|
|
28
28
|
import os2 from "node:os";
|
|
29
|
-
import
|
|
29
|
+
import path13 from "node:path";
|
|
30
30
|
|
|
31
31
|
// ../../node_modules/yaml/browser/dist/index.js
|
|
32
32
|
var dist_exports = {};
|
|
@@ -114,17 +114,17 @@ function visit(node, visitor) {
|
|
|
114
114
|
visit.BREAK = BREAK;
|
|
115
115
|
visit.SKIP = SKIP;
|
|
116
116
|
visit.REMOVE = REMOVE;
|
|
117
|
-
function visit_(key, node, visitor,
|
|
118
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
117
|
+
function visit_(key, node, visitor, path14) {
|
|
118
|
+
const ctrl = callVisitor(key, node, visitor, path14);
|
|
119
119
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
120
|
-
replaceNode(key,
|
|
121
|
-
return visit_(key, ctrl, visitor,
|
|
120
|
+
replaceNode(key, path14, ctrl);
|
|
121
|
+
return visit_(key, ctrl, visitor, path14);
|
|
122
122
|
}
|
|
123
123
|
if (typeof ctrl !== "symbol") {
|
|
124
124
|
if (isCollection(node)) {
|
|
125
|
-
|
|
125
|
+
path14 = Object.freeze(path14.concat(node));
|
|
126
126
|
for (let i = 0; i < node.items.length; ++i) {
|
|
127
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
127
|
+
const ci = visit_(i, node.items[i], visitor, path14);
|
|
128
128
|
if (typeof ci === "number")
|
|
129
129
|
i = ci - 1;
|
|
130
130
|
else if (ci === BREAK)
|
|
@@ -135,13 +135,13 @@ function visit_(key, node, visitor, path13) {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
} else if (isPair(node)) {
|
|
138
|
-
|
|
139
|
-
const ck = visit_("key", node.key, visitor,
|
|
138
|
+
path14 = Object.freeze(path14.concat(node));
|
|
139
|
+
const ck = visit_("key", node.key, visitor, path14);
|
|
140
140
|
if (ck === BREAK)
|
|
141
141
|
return BREAK;
|
|
142
142
|
else if (ck === REMOVE)
|
|
143
143
|
node.key = null;
|
|
144
|
-
const cv = visit_("value", node.value, visitor,
|
|
144
|
+
const cv = visit_("value", node.value, visitor, path14);
|
|
145
145
|
if (cv === BREAK)
|
|
146
146
|
return BREAK;
|
|
147
147
|
else if (cv === REMOVE)
|
|
@@ -162,17 +162,17 @@ async function visitAsync(node, visitor) {
|
|
|
162
162
|
visitAsync.BREAK = BREAK;
|
|
163
163
|
visitAsync.SKIP = SKIP;
|
|
164
164
|
visitAsync.REMOVE = REMOVE;
|
|
165
|
-
async function visitAsync_(key, node, visitor,
|
|
166
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
165
|
+
async function visitAsync_(key, node, visitor, path14) {
|
|
166
|
+
const ctrl = await callVisitor(key, node, visitor, path14);
|
|
167
167
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
168
|
-
replaceNode(key,
|
|
169
|
-
return visitAsync_(key, ctrl, visitor,
|
|
168
|
+
replaceNode(key, path14, ctrl);
|
|
169
|
+
return visitAsync_(key, ctrl, visitor, path14);
|
|
170
170
|
}
|
|
171
171
|
if (typeof ctrl !== "symbol") {
|
|
172
172
|
if (isCollection(node)) {
|
|
173
|
-
|
|
173
|
+
path14 = Object.freeze(path14.concat(node));
|
|
174
174
|
for (let i = 0; i < node.items.length; ++i) {
|
|
175
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
175
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path14);
|
|
176
176
|
if (typeof ci === "number")
|
|
177
177
|
i = ci - 1;
|
|
178
178
|
else if (ci === BREAK)
|
|
@@ -183,13 +183,13 @@ async function visitAsync_(key, node, visitor, path13) {
|
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
} else if (isPair(node)) {
|
|
186
|
-
|
|
187
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
186
|
+
path14 = Object.freeze(path14.concat(node));
|
|
187
|
+
const ck = await visitAsync_("key", node.key, visitor, path14);
|
|
188
188
|
if (ck === BREAK)
|
|
189
189
|
return BREAK;
|
|
190
190
|
else if (ck === REMOVE)
|
|
191
191
|
node.key = null;
|
|
192
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
192
|
+
const cv = await visitAsync_("value", node.value, visitor, path14);
|
|
193
193
|
if (cv === BREAK)
|
|
194
194
|
return BREAK;
|
|
195
195
|
else if (cv === REMOVE)
|
|
@@ -216,23 +216,23 @@ function initVisitor(visitor) {
|
|
|
216
216
|
}
|
|
217
217
|
return visitor;
|
|
218
218
|
}
|
|
219
|
-
function callVisitor(key, node, visitor,
|
|
219
|
+
function callVisitor(key, node, visitor, path14) {
|
|
220
220
|
if (typeof visitor === "function")
|
|
221
|
-
return visitor(key, node,
|
|
221
|
+
return visitor(key, node, path14);
|
|
222
222
|
if (isMap(node))
|
|
223
|
-
return visitor.Map?.(key, node,
|
|
223
|
+
return visitor.Map?.(key, node, path14);
|
|
224
224
|
if (isSeq(node))
|
|
225
|
-
return visitor.Seq?.(key, node,
|
|
225
|
+
return visitor.Seq?.(key, node, path14);
|
|
226
226
|
if (isPair(node))
|
|
227
|
-
return visitor.Pair?.(key, node,
|
|
227
|
+
return visitor.Pair?.(key, node, path14);
|
|
228
228
|
if (isScalar(node))
|
|
229
|
-
return visitor.Scalar?.(key, node,
|
|
229
|
+
return visitor.Scalar?.(key, node, path14);
|
|
230
230
|
if (isAlias(node))
|
|
231
|
-
return visitor.Alias?.(key, node,
|
|
231
|
+
return visitor.Alias?.(key, node, path14);
|
|
232
232
|
return void 0;
|
|
233
233
|
}
|
|
234
|
-
function replaceNode(key,
|
|
235
|
-
const parent =
|
|
234
|
+
function replaceNode(key, path14, node) {
|
|
235
|
+
const parent = path14[path14.length - 1];
|
|
236
236
|
if (isCollection(parent)) {
|
|
237
237
|
parent.items[key] = node;
|
|
238
238
|
} else if (isPair(parent)) {
|
|
@@ -761,10 +761,10 @@ function createNode(value, tagName, ctx) {
|
|
|
761
761
|
}
|
|
762
762
|
|
|
763
763
|
// ../../node_modules/yaml/browser/dist/nodes/Collection.js
|
|
764
|
-
function collectionFromPath(schema4,
|
|
764
|
+
function collectionFromPath(schema4, path14, value) {
|
|
765
765
|
let v = value;
|
|
766
|
-
for (let i =
|
|
767
|
-
const k =
|
|
766
|
+
for (let i = path14.length - 1; i >= 0; --i) {
|
|
767
|
+
const k = path14[i];
|
|
768
768
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
769
769
|
const a = [];
|
|
770
770
|
a[k] = v;
|
|
@@ -783,7 +783,7 @@ function collectionFromPath(schema4, path13, value) {
|
|
|
783
783
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
784
784
|
});
|
|
785
785
|
}
|
|
786
|
-
var isEmptyPath = (
|
|
786
|
+
var isEmptyPath = (path14) => path14 == null || typeof path14 === "object" && !!path14[Symbol.iterator]().next().done;
|
|
787
787
|
var Collection = class extends NodeBase {
|
|
788
788
|
constructor(type, schema4) {
|
|
789
789
|
super(type);
|
|
@@ -813,11 +813,11 @@ var Collection = class extends NodeBase {
|
|
|
813
813
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
814
814
|
* that already exists in the map.
|
|
815
815
|
*/
|
|
816
|
-
addIn(
|
|
817
|
-
if (isEmptyPath(
|
|
816
|
+
addIn(path14, value) {
|
|
817
|
+
if (isEmptyPath(path14))
|
|
818
818
|
this.add(value);
|
|
819
819
|
else {
|
|
820
|
-
const [key, ...rest] =
|
|
820
|
+
const [key, ...rest] = path14;
|
|
821
821
|
const node = this.get(key, true);
|
|
822
822
|
if (isCollection(node))
|
|
823
823
|
node.addIn(rest, value);
|
|
@@ -831,8 +831,8 @@ var Collection = class extends NodeBase {
|
|
|
831
831
|
* Removes a value from the collection.
|
|
832
832
|
* @returns `true` if the item was found and removed.
|
|
833
833
|
*/
|
|
834
|
-
deleteIn(
|
|
835
|
-
const [key, ...rest] =
|
|
834
|
+
deleteIn(path14) {
|
|
835
|
+
const [key, ...rest] = path14;
|
|
836
836
|
if (rest.length === 0)
|
|
837
837
|
return this.delete(key);
|
|
838
838
|
const node = this.get(key, true);
|
|
@@ -846,8 +846,8 @@ var Collection = class extends NodeBase {
|
|
|
846
846
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
847
847
|
* `true` (collections are always returned intact).
|
|
848
848
|
*/
|
|
849
|
-
getIn(
|
|
850
|
-
const [key, ...rest] =
|
|
849
|
+
getIn(path14, keepScalar) {
|
|
850
|
+
const [key, ...rest] = path14;
|
|
851
851
|
const node = this.get(key, true);
|
|
852
852
|
if (rest.length === 0)
|
|
853
853
|
return !keepScalar && isScalar(node) ? node.value : node;
|
|
@@ -865,8 +865,8 @@ var Collection = class extends NodeBase {
|
|
|
865
865
|
/**
|
|
866
866
|
* Checks if the collection includes a value with the key `key`.
|
|
867
867
|
*/
|
|
868
|
-
hasIn(
|
|
869
|
-
const [key, ...rest] =
|
|
868
|
+
hasIn(path14) {
|
|
869
|
+
const [key, ...rest] = path14;
|
|
870
870
|
if (rest.length === 0)
|
|
871
871
|
return this.has(key);
|
|
872
872
|
const node = this.get(key, true);
|
|
@@ -876,8 +876,8 @@ var Collection = class extends NodeBase {
|
|
|
876
876
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
877
877
|
* boolean to add/remove the item from the set.
|
|
878
878
|
*/
|
|
879
|
-
setIn(
|
|
880
|
-
const [key, ...rest] =
|
|
879
|
+
setIn(path14, value) {
|
|
880
|
+
const [key, ...rest] = path14;
|
|
881
881
|
if (rest.length === 0) {
|
|
882
882
|
this.set(key, value);
|
|
883
883
|
} else {
|
|
@@ -3016,9 +3016,9 @@ var Document = class _Document {
|
|
|
3016
3016
|
this.contents.add(value);
|
|
3017
3017
|
}
|
|
3018
3018
|
/** Adds a value to the document. */
|
|
3019
|
-
addIn(
|
|
3019
|
+
addIn(path14, value) {
|
|
3020
3020
|
if (assertCollection(this.contents))
|
|
3021
|
-
this.contents.addIn(
|
|
3021
|
+
this.contents.addIn(path14, value);
|
|
3022
3022
|
}
|
|
3023
3023
|
/**
|
|
3024
3024
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -3093,14 +3093,14 @@ var Document = class _Document {
|
|
|
3093
3093
|
* Removes a value from the document.
|
|
3094
3094
|
* @returns `true` if the item was found and removed.
|
|
3095
3095
|
*/
|
|
3096
|
-
deleteIn(
|
|
3097
|
-
if (isEmptyPath(
|
|
3096
|
+
deleteIn(path14) {
|
|
3097
|
+
if (isEmptyPath(path14)) {
|
|
3098
3098
|
if (this.contents == null)
|
|
3099
3099
|
return false;
|
|
3100
3100
|
this.contents = null;
|
|
3101
3101
|
return true;
|
|
3102
3102
|
}
|
|
3103
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
3103
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path14) : false;
|
|
3104
3104
|
}
|
|
3105
3105
|
/**
|
|
3106
3106
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -3115,10 +3115,10 @@ var Document = class _Document {
|
|
|
3115
3115
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
3116
3116
|
* `true` (collections are always returned intact).
|
|
3117
3117
|
*/
|
|
3118
|
-
getIn(
|
|
3119
|
-
if (isEmptyPath(
|
|
3118
|
+
getIn(path14, keepScalar) {
|
|
3119
|
+
if (isEmptyPath(path14))
|
|
3120
3120
|
return !keepScalar && isScalar(this.contents) ? this.contents.value : this.contents;
|
|
3121
|
-
return isCollection(this.contents) ? this.contents.getIn(
|
|
3121
|
+
return isCollection(this.contents) ? this.contents.getIn(path14, keepScalar) : void 0;
|
|
3122
3122
|
}
|
|
3123
3123
|
/**
|
|
3124
3124
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -3129,10 +3129,10 @@ var Document = class _Document {
|
|
|
3129
3129
|
/**
|
|
3130
3130
|
* Checks if the document includes a value at `path`.
|
|
3131
3131
|
*/
|
|
3132
|
-
hasIn(
|
|
3133
|
-
if (isEmptyPath(
|
|
3132
|
+
hasIn(path14) {
|
|
3133
|
+
if (isEmptyPath(path14))
|
|
3134
3134
|
return this.contents !== void 0;
|
|
3135
|
-
return isCollection(this.contents) ? this.contents.hasIn(
|
|
3135
|
+
return isCollection(this.contents) ? this.contents.hasIn(path14) : false;
|
|
3136
3136
|
}
|
|
3137
3137
|
/**
|
|
3138
3138
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -3149,13 +3149,13 @@ var Document = class _Document {
|
|
|
3149
3149
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
3150
3150
|
* boolean to add/remove the item from the set.
|
|
3151
3151
|
*/
|
|
3152
|
-
setIn(
|
|
3153
|
-
if (isEmptyPath(
|
|
3152
|
+
setIn(path14, value) {
|
|
3153
|
+
if (isEmptyPath(path14)) {
|
|
3154
3154
|
this.contents = value;
|
|
3155
3155
|
} else if (this.contents == null) {
|
|
3156
|
-
this.contents = collectionFromPath(this.schema, Array.from(
|
|
3156
|
+
this.contents = collectionFromPath(this.schema, Array.from(path14), value);
|
|
3157
3157
|
} else if (assertCollection(this.contents)) {
|
|
3158
|
-
this.contents.setIn(
|
|
3158
|
+
this.contents.setIn(path14, value);
|
|
3159
3159
|
}
|
|
3160
3160
|
}
|
|
3161
3161
|
/**
|
|
@@ -4951,9 +4951,9 @@ function visit2(cst, visitor) {
|
|
|
4951
4951
|
visit2.BREAK = BREAK2;
|
|
4952
4952
|
visit2.SKIP = SKIP2;
|
|
4953
4953
|
visit2.REMOVE = REMOVE2;
|
|
4954
|
-
visit2.itemAtPath = (cst,
|
|
4954
|
+
visit2.itemAtPath = (cst, path14) => {
|
|
4955
4955
|
let item = cst;
|
|
4956
|
-
for (const [field, index] of
|
|
4956
|
+
for (const [field, index] of path14) {
|
|
4957
4957
|
const tok = item?.[field];
|
|
4958
4958
|
if (tok && "items" in tok) {
|
|
4959
4959
|
item = tok.items[index];
|
|
@@ -4962,23 +4962,23 @@ visit2.itemAtPath = (cst, path13) => {
|
|
|
4962
4962
|
}
|
|
4963
4963
|
return item;
|
|
4964
4964
|
};
|
|
4965
|
-
visit2.parentCollection = (cst,
|
|
4966
|
-
const parent = visit2.itemAtPath(cst,
|
|
4967
|
-
const field =
|
|
4965
|
+
visit2.parentCollection = (cst, path14) => {
|
|
4966
|
+
const parent = visit2.itemAtPath(cst, path14.slice(0, -1));
|
|
4967
|
+
const field = path14[path14.length - 1][0];
|
|
4968
4968
|
const coll = parent?.[field];
|
|
4969
4969
|
if (coll && "items" in coll)
|
|
4970
4970
|
return coll;
|
|
4971
4971
|
throw new Error("Parent collection not found");
|
|
4972
4972
|
};
|
|
4973
|
-
function _visit(
|
|
4974
|
-
let ctrl = visitor(item,
|
|
4973
|
+
function _visit(path14, item, visitor) {
|
|
4974
|
+
let ctrl = visitor(item, path14);
|
|
4975
4975
|
if (typeof ctrl === "symbol")
|
|
4976
4976
|
return ctrl;
|
|
4977
4977
|
for (const field of ["key", "value"]) {
|
|
4978
4978
|
const token = item[field];
|
|
4979
4979
|
if (token && "items" in token) {
|
|
4980
4980
|
for (let i = 0; i < token.items.length; ++i) {
|
|
4981
|
-
const ci = _visit(Object.freeze(
|
|
4981
|
+
const ci = _visit(Object.freeze(path14.concat([[field, i]])), token.items[i], visitor);
|
|
4982
4982
|
if (typeof ci === "number")
|
|
4983
4983
|
i = ci - 1;
|
|
4984
4984
|
else if (ci === BREAK2)
|
|
@@ -4989,10 +4989,10 @@ function _visit(path13, item, visitor) {
|
|
|
4989
4989
|
}
|
|
4990
4990
|
}
|
|
4991
4991
|
if (typeof ctrl === "function" && field === "key")
|
|
4992
|
-
ctrl = ctrl(item,
|
|
4992
|
+
ctrl = ctrl(item, path14);
|
|
4993
4993
|
}
|
|
4994
4994
|
}
|
|
4995
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
4995
|
+
return typeof ctrl === "function" ? ctrl(item, path14) : ctrl;
|
|
4996
4996
|
}
|
|
4997
4997
|
|
|
4998
4998
|
// ../../node_modules/yaml/browser/dist/parse/cst.js
|
|
@@ -6661,9 +6661,9 @@ var swift_c_predefines_default = {
|
|
|
6661
6661
|
release: "swift-6.4.0-RELEASE-custom-8be2e4a7a393b003",
|
|
6662
6662
|
languages: {
|
|
6663
6663
|
c: {
|
|
6664
|
-
TARGET_IPHONE_SIMULATOR: "
|
|
6664
|
+
TARGET_IPHONE_SIMULATOR: "1",
|
|
6665
6665
|
TARGET_OS_DRIVERKIT: "0",
|
|
6666
|
-
TARGET_OS_EMBEDDED: "
|
|
6666
|
+
TARGET_OS_EMBEDDED: "0",
|
|
6667
6667
|
TARGET_OS_FIRMWARE: "0",
|
|
6668
6668
|
TARGET_OS_IOS: "1",
|
|
6669
6669
|
TARGET_OS_IPHONE: "1",
|
|
@@ -6672,7 +6672,7 @@ var swift_c_predefines_default = {
|
|
|
6672
6672
|
TARGET_OS_MACCATALYST: "0",
|
|
6673
6673
|
TARGET_OS_NANO: "0",
|
|
6674
6674
|
TARGET_OS_OSX: "0",
|
|
6675
|
-
TARGET_OS_SIMULATOR: "
|
|
6675
|
+
TARGET_OS_SIMULATOR: "1",
|
|
6676
6676
|
TARGET_OS_TV: "0",
|
|
6677
6677
|
TARGET_OS_UEFI: "0",
|
|
6678
6678
|
TARGET_OS_UIKITFORMAC: "0",
|
|
@@ -6686,6 +6686,7 @@ var swift_c_predefines_default = {
|
|
|
6686
6686
|
__AARCH64_CMODEL_SMALL__: "1",
|
|
6687
6687
|
__AARCH64_SIMD__: "1",
|
|
6688
6688
|
__APPLE_CC__: "6000",
|
|
6689
|
+
__APPLE_EMBEDDED_SIMULATOR__: "1",
|
|
6689
6690
|
__APPLE__: "1",
|
|
6690
6691
|
__ARM64_ARCH_8__: "1",
|
|
6691
6692
|
__ARM_64BIT_STATE: "1",
|
|
@@ -6696,15 +6697,28 @@ var swift_c_predefines_default = {
|
|
|
6696
6697
|
__ARM_ARCH_ISA_A64: "1",
|
|
6697
6698
|
__ARM_ARCH_PROFILE: "'A'",
|
|
6698
6699
|
__ARM_FEATURE_AES: "1",
|
|
6700
|
+
__ARM_FEATURE_ATOMICS: "1",
|
|
6699
6701
|
__ARM_FEATURE_CLZ: "1",
|
|
6702
|
+
__ARM_FEATURE_COMPLEX: "1",
|
|
6703
|
+
__ARM_FEATURE_CRC32: "1",
|
|
6700
6704
|
__ARM_FEATURE_CRYPTO: "1",
|
|
6701
6705
|
__ARM_FEATURE_DIRECTED_ROUNDING: "1",
|
|
6702
6706
|
__ARM_FEATURE_DIV: "1",
|
|
6707
|
+
__ARM_FEATURE_DOTPROD: "1",
|
|
6703
6708
|
__ARM_FEATURE_FMA: "1",
|
|
6709
|
+
__ARM_FEATURE_FP16_FML: "1",
|
|
6710
|
+
__ARM_FEATURE_FP16_SCALAR_ARITHMETIC: "1",
|
|
6711
|
+
__ARM_FEATURE_FP16_VECTOR_ARITHMETIC: "1",
|
|
6704
6712
|
__ARM_FEATURE_IDIV: "1",
|
|
6713
|
+
__ARM_FEATURE_JCVT: "1",
|
|
6705
6714
|
__ARM_FEATURE_LDREX: "0xF",
|
|
6706
6715
|
__ARM_FEATURE_NUMERIC_MAXMIN: "1",
|
|
6716
|
+
__ARM_FEATURE_PAUTH: "1",
|
|
6717
|
+
__ARM_FEATURE_QRDMX: "1",
|
|
6718
|
+
__ARM_FEATURE_RCPC: "1",
|
|
6707
6719
|
__ARM_FEATURE_SHA2: "1",
|
|
6720
|
+
__ARM_FEATURE_SHA3: "1",
|
|
6721
|
+
__ARM_FEATURE_SHA512: "1",
|
|
6708
6722
|
__ARM_FEATURE_UNALIGNED: "1",
|
|
6709
6723
|
__ARM_FP: "0xE",
|
|
6710
6724
|
__ARM_FP16_ARGS: "1",
|
|
@@ -7118,9 +7132,9 @@ var swift_c_predefines_default = {
|
|
|
7118
7132
|
__weak: "__attribute__((objc_gc(weak)))"
|
|
7119
7133
|
},
|
|
7120
7134
|
"c++": {
|
|
7121
|
-
TARGET_IPHONE_SIMULATOR: "
|
|
7135
|
+
TARGET_IPHONE_SIMULATOR: "1",
|
|
7122
7136
|
TARGET_OS_DRIVERKIT: "0",
|
|
7123
|
-
TARGET_OS_EMBEDDED: "
|
|
7137
|
+
TARGET_OS_EMBEDDED: "0",
|
|
7124
7138
|
TARGET_OS_FIRMWARE: "0",
|
|
7125
7139
|
TARGET_OS_IOS: "1",
|
|
7126
7140
|
TARGET_OS_IPHONE: "1",
|
|
@@ -7129,7 +7143,7 @@ var swift_c_predefines_default = {
|
|
|
7129
7143
|
TARGET_OS_MACCATALYST: "0",
|
|
7130
7144
|
TARGET_OS_NANO: "0",
|
|
7131
7145
|
TARGET_OS_OSX: "0",
|
|
7132
|
-
TARGET_OS_SIMULATOR: "
|
|
7146
|
+
TARGET_OS_SIMULATOR: "1",
|
|
7133
7147
|
TARGET_OS_TV: "0",
|
|
7134
7148
|
TARGET_OS_UEFI: "0",
|
|
7135
7149
|
TARGET_OS_UIKITFORMAC: "0",
|
|
@@ -7143,6 +7157,7 @@ var swift_c_predefines_default = {
|
|
|
7143
7157
|
__AARCH64_CMODEL_SMALL__: "1",
|
|
7144
7158
|
__AARCH64_SIMD__: "1",
|
|
7145
7159
|
__APPLE_CC__: "6000",
|
|
7160
|
+
__APPLE_EMBEDDED_SIMULATOR__: "1",
|
|
7146
7161
|
__APPLE__: "1",
|
|
7147
7162
|
__ARM64_ARCH_8__: "1",
|
|
7148
7163
|
__ARM_64BIT_STATE: "1",
|
|
@@ -7153,15 +7168,28 @@ var swift_c_predefines_default = {
|
|
|
7153
7168
|
__ARM_ARCH_ISA_A64: "1",
|
|
7154
7169
|
__ARM_ARCH_PROFILE: "'A'",
|
|
7155
7170
|
__ARM_FEATURE_AES: "1",
|
|
7171
|
+
__ARM_FEATURE_ATOMICS: "1",
|
|
7156
7172
|
__ARM_FEATURE_CLZ: "1",
|
|
7173
|
+
__ARM_FEATURE_COMPLEX: "1",
|
|
7174
|
+
__ARM_FEATURE_CRC32: "1",
|
|
7157
7175
|
__ARM_FEATURE_CRYPTO: "1",
|
|
7158
7176
|
__ARM_FEATURE_DIRECTED_ROUNDING: "1",
|
|
7159
7177
|
__ARM_FEATURE_DIV: "1",
|
|
7178
|
+
__ARM_FEATURE_DOTPROD: "1",
|
|
7160
7179
|
__ARM_FEATURE_FMA: "1",
|
|
7180
|
+
__ARM_FEATURE_FP16_FML: "1",
|
|
7181
|
+
__ARM_FEATURE_FP16_SCALAR_ARITHMETIC: "1",
|
|
7182
|
+
__ARM_FEATURE_FP16_VECTOR_ARITHMETIC: "1",
|
|
7161
7183
|
__ARM_FEATURE_IDIV: "1",
|
|
7184
|
+
__ARM_FEATURE_JCVT: "1",
|
|
7162
7185
|
__ARM_FEATURE_LDREX: "0xF",
|
|
7163
7186
|
__ARM_FEATURE_NUMERIC_MAXMIN: "1",
|
|
7187
|
+
__ARM_FEATURE_PAUTH: "1",
|
|
7188
|
+
__ARM_FEATURE_QRDMX: "1",
|
|
7189
|
+
__ARM_FEATURE_RCPC: "1",
|
|
7164
7190
|
__ARM_FEATURE_SHA2: "1",
|
|
7191
|
+
__ARM_FEATURE_SHA3: "1",
|
|
7192
|
+
__ARM_FEATURE_SHA512: "1",
|
|
7165
7193
|
__ARM_FEATURE_UNALIGNED: "1",
|
|
7166
7194
|
__ARM_FP: "0xE",
|
|
7167
7195
|
__ARM_FP16_ARGS: "1",
|
|
@@ -7648,9 +7676,9 @@ var swift_c_predefines_default = {
|
|
|
7648
7676
|
IB_DESIGNABLE: null,
|
|
7649
7677
|
OBJC_NEW_PROPERTIES: "1",
|
|
7650
7678
|
OBJC_ZEROCOST_EXCEPTIONS: "1",
|
|
7651
|
-
TARGET_IPHONE_SIMULATOR: "
|
|
7679
|
+
TARGET_IPHONE_SIMULATOR: "1",
|
|
7652
7680
|
TARGET_OS_DRIVERKIT: "0",
|
|
7653
|
-
TARGET_OS_EMBEDDED: "
|
|
7681
|
+
TARGET_OS_EMBEDDED: "0",
|
|
7654
7682
|
TARGET_OS_FIRMWARE: "0",
|
|
7655
7683
|
TARGET_OS_IOS: "1",
|
|
7656
7684
|
TARGET_OS_IPHONE: "1",
|
|
@@ -7659,7 +7687,7 @@ var swift_c_predefines_default = {
|
|
|
7659
7687
|
TARGET_OS_MACCATALYST: "0",
|
|
7660
7688
|
TARGET_OS_NANO: "0",
|
|
7661
7689
|
TARGET_OS_OSX: "0",
|
|
7662
|
-
TARGET_OS_SIMULATOR: "
|
|
7690
|
+
TARGET_OS_SIMULATOR: "1",
|
|
7663
7691
|
TARGET_OS_TV: "0",
|
|
7664
7692
|
TARGET_OS_UEFI: "0",
|
|
7665
7693
|
TARGET_OS_UIKITFORMAC: "0",
|
|
@@ -7673,6 +7701,7 @@ var swift_c_predefines_default = {
|
|
|
7673
7701
|
__AARCH64_CMODEL_SMALL__: "1",
|
|
7674
7702
|
__AARCH64_SIMD__: "1",
|
|
7675
7703
|
__APPLE_CC__: "6000",
|
|
7704
|
+
__APPLE_EMBEDDED_SIMULATOR__: "1",
|
|
7676
7705
|
__APPLE__: "1",
|
|
7677
7706
|
__ARM64_ARCH_8__: "1",
|
|
7678
7707
|
__ARM_64BIT_STATE: "1",
|
|
@@ -7683,15 +7712,28 @@ var swift_c_predefines_default = {
|
|
|
7683
7712
|
__ARM_ARCH_ISA_A64: "1",
|
|
7684
7713
|
__ARM_ARCH_PROFILE: "'A'",
|
|
7685
7714
|
__ARM_FEATURE_AES: "1",
|
|
7715
|
+
__ARM_FEATURE_ATOMICS: "1",
|
|
7686
7716
|
__ARM_FEATURE_CLZ: "1",
|
|
7717
|
+
__ARM_FEATURE_COMPLEX: "1",
|
|
7718
|
+
__ARM_FEATURE_CRC32: "1",
|
|
7687
7719
|
__ARM_FEATURE_CRYPTO: "1",
|
|
7688
7720
|
__ARM_FEATURE_DIRECTED_ROUNDING: "1",
|
|
7689
7721
|
__ARM_FEATURE_DIV: "1",
|
|
7722
|
+
__ARM_FEATURE_DOTPROD: "1",
|
|
7690
7723
|
__ARM_FEATURE_FMA: "1",
|
|
7724
|
+
__ARM_FEATURE_FP16_FML: "1",
|
|
7725
|
+
__ARM_FEATURE_FP16_SCALAR_ARITHMETIC: "1",
|
|
7726
|
+
__ARM_FEATURE_FP16_VECTOR_ARITHMETIC: "1",
|
|
7691
7727
|
__ARM_FEATURE_IDIV: "1",
|
|
7728
|
+
__ARM_FEATURE_JCVT: "1",
|
|
7692
7729
|
__ARM_FEATURE_LDREX: "0xF",
|
|
7693
7730
|
__ARM_FEATURE_NUMERIC_MAXMIN: "1",
|
|
7731
|
+
__ARM_FEATURE_PAUTH: "1",
|
|
7732
|
+
__ARM_FEATURE_QRDMX: "1",
|
|
7733
|
+
__ARM_FEATURE_RCPC: "1",
|
|
7694
7734
|
__ARM_FEATURE_SHA2: "1",
|
|
7735
|
+
__ARM_FEATURE_SHA3: "1",
|
|
7736
|
+
__ARM_FEATURE_SHA512: "1",
|
|
7695
7737
|
__ARM_FEATURE_UNALIGNED: "1",
|
|
7696
7738
|
__ARM_FP: "0xE",
|
|
7697
7739
|
__ARM_FP16_ARGS: "1",
|
|
@@ -8117,9 +8159,9 @@ var swift_c_predefines_default = {
|
|
|
8117
8159
|
IB_DESIGNABLE: null,
|
|
8118
8160
|
OBJC_NEW_PROPERTIES: "1",
|
|
8119
8161
|
OBJC_ZEROCOST_EXCEPTIONS: "1",
|
|
8120
|
-
TARGET_IPHONE_SIMULATOR: "
|
|
8162
|
+
TARGET_IPHONE_SIMULATOR: "1",
|
|
8121
8163
|
TARGET_OS_DRIVERKIT: "0",
|
|
8122
|
-
TARGET_OS_EMBEDDED: "
|
|
8164
|
+
TARGET_OS_EMBEDDED: "0",
|
|
8123
8165
|
TARGET_OS_FIRMWARE: "0",
|
|
8124
8166
|
TARGET_OS_IOS: "1",
|
|
8125
8167
|
TARGET_OS_IPHONE: "1",
|
|
@@ -8128,7 +8170,7 @@ var swift_c_predefines_default = {
|
|
|
8128
8170
|
TARGET_OS_MACCATALYST: "0",
|
|
8129
8171
|
TARGET_OS_NANO: "0",
|
|
8130
8172
|
TARGET_OS_OSX: "0",
|
|
8131
|
-
TARGET_OS_SIMULATOR: "
|
|
8173
|
+
TARGET_OS_SIMULATOR: "1",
|
|
8132
8174
|
TARGET_OS_TV: "0",
|
|
8133
8175
|
TARGET_OS_UEFI: "0",
|
|
8134
8176
|
TARGET_OS_UIKITFORMAC: "0",
|
|
@@ -8142,6 +8184,7 @@ var swift_c_predefines_default = {
|
|
|
8142
8184
|
__AARCH64_CMODEL_SMALL__: "1",
|
|
8143
8185
|
__AARCH64_SIMD__: "1",
|
|
8144
8186
|
__APPLE_CC__: "6000",
|
|
8187
|
+
__APPLE_EMBEDDED_SIMULATOR__: "1",
|
|
8145
8188
|
__APPLE__: "1",
|
|
8146
8189
|
__ARM64_ARCH_8__: "1",
|
|
8147
8190
|
__ARM_64BIT_STATE: "1",
|
|
@@ -8152,15 +8195,28 @@ var swift_c_predefines_default = {
|
|
|
8152
8195
|
__ARM_ARCH_ISA_A64: "1",
|
|
8153
8196
|
__ARM_ARCH_PROFILE: "'A'",
|
|
8154
8197
|
__ARM_FEATURE_AES: "1",
|
|
8198
|
+
__ARM_FEATURE_ATOMICS: "1",
|
|
8155
8199
|
__ARM_FEATURE_CLZ: "1",
|
|
8200
|
+
__ARM_FEATURE_COMPLEX: "1",
|
|
8201
|
+
__ARM_FEATURE_CRC32: "1",
|
|
8156
8202
|
__ARM_FEATURE_CRYPTO: "1",
|
|
8157
8203
|
__ARM_FEATURE_DIRECTED_ROUNDING: "1",
|
|
8158
8204
|
__ARM_FEATURE_DIV: "1",
|
|
8205
|
+
__ARM_FEATURE_DOTPROD: "1",
|
|
8159
8206
|
__ARM_FEATURE_FMA: "1",
|
|
8207
|
+
__ARM_FEATURE_FP16_FML: "1",
|
|
8208
|
+
__ARM_FEATURE_FP16_SCALAR_ARITHMETIC: "1",
|
|
8209
|
+
__ARM_FEATURE_FP16_VECTOR_ARITHMETIC: "1",
|
|
8160
8210
|
__ARM_FEATURE_IDIV: "1",
|
|
8211
|
+
__ARM_FEATURE_JCVT: "1",
|
|
8161
8212
|
__ARM_FEATURE_LDREX: "0xF",
|
|
8162
8213
|
__ARM_FEATURE_NUMERIC_MAXMIN: "1",
|
|
8214
|
+
__ARM_FEATURE_PAUTH: "1",
|
|
8215
|
+
__ARM_FEATURE_QRDMX: "1",
|
|
8216
|
+
__ARM_FEATURE_RCPC: "1",
|
|
8163
8217
|
__ARM_FEATURE_SHA2: "1",
|
|
8218
|
+
__ARM_FEATURE_SHA3: "1",
|
|
8219
|
+
__ARM_FEATURE_SHA512: "1",
|
|
8164
8220
|
__ARM_FEATURE_UNALIGNED: "1",
|
|
8165
8221
|
__ARM_FP: "0xE",
|
|
8166
8222
|
__ARM_FP16_ARGS: "1",
|
|
@@ -9366,9 +9422,9 @@ var EXCERPT = /^(\s*)(\d+)( \| )(.*)$/;
|
|
|
9366
9422
|
var MARKER = /^(\s*)( \| )(.*)$/;
|
|
9367
9423
|
function designTimeDiagnostic(output, files) {
|
|
9368
9424
|
const rewritten = /* @__PURE__ */ new Map();
|
|
9369
|
-
const linesOf = (
|
|
9425
|
+
const linesOf = (path14) => {
|
|
9370
9426
|
const file = Object.keys(files).find(
|
|
9371
|
-
(name2) => name2.endsWith(".swift") && (
|
|
9427
|
+
(name2) => name2.endsWith(".swift") && (path14 === name2 || path14.endsWith(`/${name2}`))
|
|
9372
9428
|
);
|
|
9373
9429
|
if (file === void 0) return null;
|
|
9374
9430
|
let lines = rewritten.get(file);
|
|
@@ -9532,6 +9588,29 @@ function swiftToolchainBin(release) {
|
|
|
9532
9588
|
return path4.join(peachHome(), "swift", "toolchains", release, "usr/bin");
|
|
9533
9589
|
return (process.env.PATH ?? "").split(path4.delimiter).find((dir) => dir && fs2.existsSync(path4.join(dir, "swift"))) ?? image;
|
|
9534
9590
|
}
|
|
9591
|
+
var SWIFT_AUTOLINK_LINKER = ".peach-wasm-ld";
|
|
9592
|
+
function writeSwiftAutolinkLinker(directory, toolchainBin) {
|
|
9593
|
+
const linker = path4.join(directory, SWIFT_AUTOLINK_LINKER);
|
|
9594
|
+
const script = `#!/bin/sh
|
|
9595
|
+
set -eu
|
|
9596
|
+
for arg in "$@"; do
|
|
9597
|
+
case $arg in
|
|
9598
|
+
@*)
|
|
9599
|
+
rsp=\${arg#@}
|
|
9600
|
+
awk 'BEGIN { RS = " "; ORS = " " } /^"-l/ { if (seen[$0]++) next } { print }' "$rsp" > "$rsp.dedup"
|
|
9601
|
+
mv "$rsp.dedup" "$rsp"
|
|
9602
|
+
;;
|
|
9603
|
+
esac
|
|
9604
|
+
done
|
|
9605
|
+
exec ${JSON.stringify(path4.join(toolchainBin, "wasm-ld"))} "$@"
|
|
9606
|
+
`;
|
|
9607
|
+
if (fs2.existsSync(linker) && fs2.readFileSync(linker, "utf8") === script) return linker;
|
|
9608
|
+
fs2.mkdirSync(directory, { recursive: true });
|
|
9609
|
+
const next = `${linker}.${process.pid}`;
|
|
9610
|
+
fs2.writeFileSync(next, script, { mode: 493 });
|
|
9611
|
+
fs2.renameSync(next, linker);
|
|
9612
|
+
return linker;
|
|
9613
|
+
}
|
|
9535
9614
|
function peachHome() {
|
|
9536
9615
|
const override = process.env.PEACH_HOME;
|
|
9537
9616
|
return override ? path4.resolve(override) : path4.join(os.homedir(), ".peach");
|
|
@@ -11053,9 +11132,9 @@ function swiftObjCImports(graphs, options) {
|
|
|
11053
11132
|
|
|
11054
11133
|
// src/swift-objc-metadata.ts
|
|
11055
11134
|
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
11056
|
-
import { createHash as
|
|
11135
|
+
import { createHash as createHash8 } from "node:crypto";
|
|
11057
11136
|
import fs4 from "node:fs";
|
|
11058
|
-
import
|
|
11137
|
+
import path10 from "node:path";
|
|
11059
11138
|
|
|
11060
11139
|
// src/swift-objc-sdk.ts
|
|
11061
11140
|
import path6 from "node:path";
|
|
@@ -11122,7 +11201,7 @@ function swiftObjCPlatformFlags(toolchainBin, minimum) {
|
|
|
11122
11201
|
);
|
|
11123
11202
|
const flags = [
|
|
11124
11203
|
...result.stdout.matchAll(
|
|
11125
|
-
/^#define (TARGET_OS_\w+|TARGET_IPHONE_SIMULATOR|__APPLE\w*__|__MACH__|__ENVIRONMENT_\w
|
|
11204
|
+
/^#define (TARGET_OS_\w+|TARGET_IPHONE_SIMULATOR|__APPLE\w*__|__MACH__|__ENVIRONMENT_\w+|__nonnull|__nullable|__null_unspecified) (.*)$/gm
|
|
11126
11205
|
)
|
|
11127
11206
|
].map(([, name2, value]) => `-D${name2}=${value}`);
|
|
11128
11207
|
if (!flags.includes("-D__APPLE__=1") || !flags.includes("-D__MACH__=1"))
|
|
@@ -11208,15 +11287,37 @@ function iosDeploymentMinimum(version) {
|
|
|
11208
11287
|
}
|
|
11209
11288
|
var headerFiles = (dir) => fs3.readdirSync(dir, { recursive: true, encoding: "utf8" }).filter((file) => file.endsWith(".h")).sort();
|
|
11210
11289
|
function moduleMapHeaders(modulemap, directoryHeaders = []) {
|
|
11211
|
-
const
|
|
11212
|
-
const
|
|
11213
|
-
|
|
11214
|
-
|
|
11215
|
-
|
|
11216
|
-
|
|
11217
|
-
|
|
11218
|
-
(
|
|
11290
|
+
const tokens = (fs3.readFileSync(modulemap, "utf8").match(/\/\*[\s\S]*?\*\/|\/\/[^\n]*|"[^"]*"|[\w.*]+|[{}\[\]]/g) ?? []).filter((token) => !token.startsWith("/"));
|
|
11291
|
+
const open = [];
|
|
11292
|
+
const declared = [];
|
|
11293
|
+
const excluded = [];
|
|
11294
|
+
const topLevel = [];
|
|
11295
|
+
let moduleBody = false;
|
|
11296
|
+
for (const [i, token] of tokens.entries()) {
|
|
11297
|
+
if (token === "module") moduleBody = tokens[i - 1] !== "extern";
|
|
11298
|
+
else if (token === "}") open.pop();
|
|
11299
|
+
else if (token === "{") {
|
|
11300
|
+
if (moduleBody) {
|
|
11301
|
+
declared.push([]);
|
|
11302
|
+
excluded.push(/* @__PURE__ */ new Set());
|
|
11303
|
+
if (open.every((index) => index < 0)) topLevel.push(declared.length - 1);
|
|
11304
|
+
open.push(declared.length - 1);
|
|
11305
|
+
} else open.push(-1);
|
|
11306
|
+
moduleBody = false;
|
|
11307
|
+
} else if (token === "header" && tokens[i + 1]?.startsWith('"')) {
|
|
11308
|
+
const index = open.findLast((owner) => owner >= 0);
|
|
11309
|
+
if (index === void 0) continue;
|
|
11310
|
+
const header = tokens[i + 1].slice(1, -1);
|
|
11311
|
+
if (tokens[i - 1] === "exclude") excluded[index].add(header);
|
|
11312
|
+
else declared[index].push(header);
|
|
11313
|
+
}
|
|
11314
|
+
}
|
|
11315
|
+
const headers = declared.flatMap(
|
|
11316
|
+
(list, index) => list.filter((header) => !excluded[index].has(header))
|
|
11219
11317
|
);
|
|
11318
|
+
if (headers.length > 0) return headers;
|
|
11319
|
+
const topExcluded = new Set(topLevel.flatMap((index) => [...excluded[index]]));
|
|
11320
|
+
return directoryHeaders.filter((header) => !topExcluded.has(header));
|
|
11220
11321
|
}
|
|
11221
11322
|
function missingHeader(missing) {
|
|
11222
11323
|
const lines = ["#import <Foundation/Foundation.h>", "#import <UIKit/UIKit.h>"];
|
|
@@ -11660,6 +11761,63 @@ function constantValue(node) {
|
|
|
11660
11761
|
return null;
|
|
11661
11762
|
}
|
|
11662
11763
|
|
|
11764
|
+
// src/swift-standin-digest.ts
|
|
11765
|
+
import { createHash as createHash7 } from "node:crypto";
|
|
11766
|
+
import { existsSync as existsSync2, readFileSync as readFileSync5 } from "node:fs";
|
|
11767
|
+
import path9 from "node:path";
|
|
11768
|
+
var STANDIN_DIGEST_ENTRYPOINTS = [
|
|
11769
|
+
"swift-standins.ts",
|
|
11770
|
+
"swift-objc-compile.ts",
|
|
11771
|
+
"swift-objc-metadata.ts"
|
|
11772
|
+
];
|
|
11773
|
+
var SPECIFIER = /from\s*['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
11774
|
+
function resolveImport(fromDir, specifier) {
|
|
11775
|
+
if (!specifier.startsWith(".")) return null;
|
|
11776
|
+
const absolute = path9.resolve(fromDir, specifier);
|
|
11777
|
+
for (const candidate of [
|
|
11778
|
+
absolute,
|
|
11779
|
+
`${absolute}.ts`,
|
|
11780
|
+
`${absolute}.tsx`,
|
|
11781
|
+
path9.join(absolute, "index.ts")
|
|
11782
|
+
])
|
|
11783
|
+
if (existsSync2(candidate)) return candidate;
|
|
11784
|
+
return null;
|
|
11785
|
+
}
|
|
11786
|
+
function standinDigestFiles(srcDir = import.meta.dirname) {
|
|
11787
|
+
for (const entry of STANDIN_DIGEST_ENTRYPOINTS)
|
|
11788
|
+
if (!existsSync2(path9.join(srcDir, entry)))
|
|
11789
|
+
throw new Error(`stand-in digest entrypoint is missing: ${entry}`);
|
|
11790
|
+
const files = [];
|
|
11791
|
+
const seen = /* @__PURE__ */ new Set();
|
|
11792
|
+
const queue = STANDIN_DIGEST_ENTRYPOINTS.map((file) => path9.join(srcDir, file));
|
|
11793
|
+
while (queue.length > 0) {
|
|
11794
|
+
const file = queue.pop();
|
|
11795
|
+
if (seen.has(file)) continue;
|
|
11796
|
+
seen.add(file);
|
|
11797
|
+
files.push(file);
|
|
11798
|
+
for (const match of readFileSync5(file, "utf8").matchAll(SPECIFIER)) {
|
|
11799
|
+
const specifier = match[1] ?? match[2];
|
|
11800
|
+
if (!specifier.startsWith(".")) continue;
|
|
11801
|
+
const hit = resolveImport(path9.dirname(file), specifier);
|
|
11802
|
+
if (hit) queue.push(hit);
|
|
11803
|
+
}
|
|
11804
|
+
}
|
|
11805
|
+
return files.sort();
|
|
11806
|
+
}
|
|
11807
|
+
function standinSourceDigest(srcDir = import.meta.dirname) {
|
|
11808
|
+
const entries = STANDIN_DIGEST_ENTRYPOINTS.map((file) => path9.join(srcDir, file));
|
|
11809
|
+
if (entries.every((file) => !existsSync2(file)))
|
|
11810
|
+
return createHash7("sha256").update(readFileSync5(import.meta.filename)).digest("hex");
|
|
11811
|
+
const hash2 = createHash7("sha256");
|
|
11812
|
+
for (const file of standinDigestFiles(srcDir)) {
|
|
11813
|
+
const key = path9.relative(srcDir, file);
|
|
11814
|
+
const bytes = readFileSync5(file);
|
|
11815
|
+
hash2.update(`${Buffer.byteLength(key)}:${key}${bytes.length}:`).update(bytes);
|
|
11816
|
+
}
|
|
11817
|
+
return hash2.digest("hex");
|
|
11818
|
+
}
|
|
11819
|
+
var STANDIN_SOURCE_DIGEST = standinSourceDigest();
|
|
11820
|
+
|
|
11663
11821
|
// src/swift-objc-metadata.ts
|
|
11664
11822
|
function validateObjcPeerStartupLibraries(libraries) {
|
|
11665
11823
|
function fail(name2, detail) {
|
|
@@ -11923,6 +12081,16 @@ var swiftEscapes = {
|
|
|
11923
12081
|
r: "\r",
|
|
11924
12082
|
t: " "
|
|
11925
12083
|
};
|
|
12084
|
+
function swiftStringValue(raw2, context) {
|
|
12085
|
+
return raw2.replace(/\\(.)/g, (_, escape) => {
|
|
12086
|
+
const value = swiftEscapes[escape];
|
|
12087
|
+
if (value === void 0)
|
|
12088
|
+
throw new Error(
|
|
12089
|
+
`Unsupported ${escape === "(" ? "interpolation" : `escape \\${escape}`} in ${context}`
|
|
12090
|
+
);
|
|
12091
|
+
return value;
|
|
12092
|
+
});
|
|
12093
|
+
}
|
|
11926
12094
|
function bracketBody(text3, openIndex) {
|
|
11927
12095
|
let depth = 1;
|
|
11928
12096
|
let index = openIndex;
|
|
@@ -11942,7 +12110,7 @@ function settingsBlocks(call, tool) {
|
|
|
11942
12110
|
bodies.push(bracketBody(call, open.index + open[0].length));
|
|
11943
12111
|
return bodies;
|
|
11944
12112
|
}
|
|
11945
|
-
function settingFeatures(call, setting) {
|
|
12113
|
+
function settingFeatures(call, setting, target) {
|
|
11946
12114
|
const found = [];
|
|
11947
12115
|
for (const body of settingsBlocks(call, "swift")) {
|
|
11948
12116
|
if (setting === ".unsafeFlags") {
|
|
@@ -11950,7 +12118,9 @@ function settingFeatures(call, setting) {
|
|
|
11950
12118
|
for (const match of bracketBody(body, open.index + open[0].length).matchAll(
|
|
11951
12119
|
/"((?:[^"\\]|\\.)*)"/g
|
|
11952
12120
|
))
|
|
11953
|
-
found.push(
|
|
12121
|
+
found.push(
|
|
12122
|
+
swiftStringValue(match[1], `unsafeFlags of target ${target} (${match[0]})`)
|
|
12123
|
+
);
|
|
11954
12124
|
} else {
|
|
11955
12125
|
const name2 = "([A-Za-z_][A-Za-z0-9_]*(?:=[A-Za-z_][A-Za-z0-9_.-]*)?)";
|
|
11956
12126
|
const pattern = setting === ".enableExperimentalFeature" ? new RegExp(`\\.enableExperimentalFeature\\(\\s*"${name2}"\\s*\\)`, "g") : new RegExp(`\\.enableUpcomingFeature\\(\\s*"${name2}"\\s*\\)`, "g");
|
|
@@ -11967,14 +12137,7 @@ function settingDefines(call, tool) {
|
|
|
11967
12137
|
)) {
|
|
11968
12138
|
const name2 = match[1];
|
|
11969
12139
|
defines.push(
|
|
11970
|
-
match[2] === void 0 ? name2 : `${name2}=${match[2]
|
|
11971
|
-
const value = swiftEscapes[escape];
|
|
11972
|
-
if (value === void 0)
|
|
11973
|
-
throw new Error(
|
|
11974
|
-
`Unsupported escape \\${escape} in the value of macro ${name2}`
|
|
11975
|
-
);
|
|
11976
|
-
return value;
|
|
11977
|
-
})}`
|
|
12140
|
+
match[2] === void 0 ? name2 : `${name2}=${swiftStringValue(match[2], `the value of macro ${name2}`)}`
|
|
11978
12141
|
);
|
|
11979
12142
|
}
|
|
11980
12143
|
}
|
|
@@ -12043,9 +12206,9 @@ function swiftManifestTargets(manifest, resourcePaths = []) {
|
|
|
12043
12206
|
call.replace(/"(?:\\.|[^"\\])*"/g, "")
|
|
12044
12207
|
);
|
|
12045
12208
|
const defines = settingDefines(call, "swift").map((define) => define.split("=")[0]);
|
|
12046
|
-
const experimentalFeatures = settingFeatures(call, ".enableExperimentalFeature");
|
|
12047
|
-
const upcomingFeatures = settingFeatures(call, ".enableUpcomingFeature");
|
|
12048
|
-
const swiftFlags = settingFeatures(call, ".unsafeFlags");
|
|
12209
|
+
const experimentalFeatures = settingFeatures(call, ".enableExperimentalFeature", name2);
|
|
12210
|
+
const upcomingFeatures = settingFeatures(call, ".enableUpcomingFeature", name2);
|
|
12211
|
+
const swiftFlags = settingFeatures(call, ".unsafeFlags", name2);
|
|
12049
12212
|
const cDefines = settingDefines(call, "c");
|
|
12050
12213
|
const cxxDefines = settingDefines(call, "cxx");
|
|
12051
12214
|
const linkedLibraries = [...call.matchAll(/\.linkedLibrary\(\s*"([^"]+)"\s*\)/g)].map(
|
|
@@ -12117,10 +12280,9 @@ function swiftObjCResourceBundleName(args) {
|
|
|
12117
12280
|
return bundle.path.slice(0, -".bundle".length);
|
|
12118
12281
|
}
|
|
12119
12282
|
function swiftObjCResourceAccessor(bundleName) {
|
|
12120
|
-
|
|
12121
|
-
|
|
12122
|
-
const
|
|
12123
|
-
const finder = `${bundleName}_SWIFTPM_MODULE_BUNDLER_FINDER`;
|
|
12283
|
+
const accessorName = swiftTargetModuleName(bundleName.replace(/[^\x00-\x7f]/gu, "_"));
|
|
12284
|
+
const symbol = `${accessorName}_SWIFTPM_MODULE_BUNDLE`;
|
|
12285
|
+
const finder = `${accessorName}_SWIFTPM_MODULE_BUNDLER_FINDER`;
|
|
12124
12286
|
return {
|
|
12125
12287
|
header: [
|
|
12126
12288
|
"#import <Foundation/Foundation.h>",
|
|
@@ -12145,7 +12307,7 @@ function swiftObjCResourceAccessor(bundleName) {
|
|
|
12145
12307
|
"@end",
|
|
12146
12308
|
"",
|
|
12147
12309
|
`NSBundle* ${symbol}() {`,
|
|
12148
|
-
` NSString *bundleName = @"${
|
|
12310
|
+
` NSString *bundleName = @"${accessorName}";`,
|
|
12149
12311
|
"",
|
|
12150
12312
|
" NSArray<NSURL*> *candidates = @[",
|
|
12151
12313
|
" NSBundle.mainBundle.resourceURL,",
|
|
@@ -12179,16 +12341,16 @@ import {
|
|
|
12179
12341
|
spawn as spawn2,
|
|
12180
12342
|
spawnSync as spawnSync6
|
|
12181
12343
|
} from "node:child_process";
|
|
12182
|
-
import { createHash as
|
|
12344
|
+
import { createHash as createHash9, randomUUID as randomUUID2 } from "node:crypto";
|
|
12183
12345
|
import {
|
|
12184
12346
|
linkSync,
|
|
12185
12347
|
mkdirSync,
|
|
12186
12348
|
readdirSync as readdirSync3,
|
|
12187
|
-
readFileSync as
|
|
12349
|
+
readFileSync as readFileSync6,
|
|
12188
12350
|
rmSync as rmSync2,
|
|
12189
12351
|
writeFileSync as writeFileSync2
|
|
12190
12352
|
} from "node:fs";
|
|
12191
|
-
import
|
|
12353
|
+
import path11 from "node:path";
|
|
12192
12354
|
var POLL_MS = 250;
|
|
12193
12355
|
var START_TOLERANCE_MS = 2e3;
|
|
12194
12356
|
function errorCode(error) {
|
|
@@ -12263,7 +12425,7 @@ function generationNumbers(directory) {
|
|
|
12263
12425
|
function readGeneration(directory, number) {
|
|
12264
12426
|
let owner;
|
|
12265
12427
|
try {
|
|
12266
|
-
owner =
|
|
12428
|
+
owner = readFileSync6(path11.join(directory, name(number, "owner")), "utf8");
|
|
12267
12429
|
} catch (error) {
|
|
12268
12430
|
if (errorCode(error) === "ENOENT") return null;
|
|
12269
12431
|
throw error;
|
|
@@ -12276,7 +12438,7 @@ function readGeneration(directory, number) {
|
|
|
12276
12438
|
}
|
|
12277
12439
|
function readChildren(directory, number) {
|
|
12278
12440
|
const prefix = name(number, "child.");
|
|
12279
|
-
return readdirSync3(directory).filter((entry) => entry.startsWith(prefix)).map((entry) => parseIdentity(
|
|
12441
|
+
return readdirSync3(directory).filter((entry) => entry.startsWith(prefix)).map((entry) => parseIdentity(readFileSync6(path11.join(directory, entry), "utf8")));
|
|
12280
12442
|
}
|
|
12281
12443
|
function groupAlive(table, leader) {
|
|
12282
12444
|
const row = table.find((candidate) => candidate.pid === leader.pid);
|
|
@@ -12284,16 +12446,16 @@ function groupAlive(table, leader) {
|
|
|
12284
12446
|
return table.some((candidate) => candidate.pgid === leader.pid && !candidate.zombie);
|
|
12285
12447
|
}
|
|
12286
12448
|
async function withSwiftRootLock(root, work, signal) {
|
|
12287
|
-
const directory =
|
|
12449
|
+
const directory = path11.join(
|
|
12288
12450
|
rnxHomeDir(),
|
|
12289
12451
|
"cache",
|
|
12290
12452
|
"swift-root-locks",
|
|
12291
|
-
|
|
12453
|
+
createHash9("sha256").update(root).digest("hex").slice(0, 32)
|
|
12292
12454
|
);
|
|
12293
12455
|
mkdirSync(directory, { recursive: true });
|
|
12294
12456
|
const token = randomUUID2();
|
|
12295
12457
|
const owner = JSON.stringify(ownIdentity(process.pid));
|
|
12296
|
-
const pending =
|
|
12458
|
+
const pending = path11.join(directory, `pending.${token}`);
|
|
12297
12459
|
let held = 0;
|
|
12298
12460
|
for (; ; ) {
|
|
12299
12461
|
signal?.throwIfAborted();
|
|
@@ -12314,7 +12476,7 @@ async function withSwiftRootLock(root, work, signal) {
|
|
|
12314
12476
|
}
|
|
12315
12477
|
writeFileSync2(pending, owner);
|
|
12316
12478
|
try {
|
|
12317
|
-
linkSync(pending,
|
|
12479
|
+
linkSync(pending, path11.join(directory, name(newest + 1, "owner")));
|
|
12318
12480
|
} catch (error) {
|
|
12319
12481
|
if (errorCode(error) === "EEXIST") continue;
|
|
12320
12482
|
throw error;
|
|
@@ -12323,7 +12485,7 @@ async function withSwiftRootLock(root, work, signal) {
|
|
|
12323
12485
|
}
|
|
12324
12486
|
const numbers = generationNumbers(directory);
|
|
12325
12487
|
if (numbers.at(-1) !== newest + 1) {
|
|
12326
|
-
rmSync2(
|
|
12488
|
+
rmSync2(path11.join(directory, name(newest + 1, "owner")), { force: true });
|
|
12327
12489
|
continue;
|
|
12328
12490
|
}
|
|
12329
12491
|
held = newest + 1;
|
|
@@ -12331,7 +12493,7 @@ async function withSwiftRootLock(root, work, signal) {
|
|
|
12331
12493
|
if (number < held) {
|
|
12332
12494
|
for (const entry of readdirSync3(directory))
|
|
12333
12495
|
if (entry.startsWith(name(number, "")))
|
|
12334
|
-
rmSync2(
|
|
12496
|
+
rmSync2(path11.join(directory, entry), { force: true });
|
|
12335
12497
|
}
|
|
12336
12498
|
break;
|
|
12337
12499
|
}
|
|
@@ -12355,7 +12517,7 @@ async function withSwiftRootLock(root, work, signal) {
|
|
|
12355
12517
|
const childPending = `${pending}.child.${child.pid}`;
|
|
12356
12518
|
try {
|
|
12357
12519
|
writeFileSync2(childPending, JSON.stringify(ownIdentity(child.pid)));
|
|
12358
|
-
linkSync(childPending,
|
|
12520
|
+
linkSync(childPending, path11.join(directory, name(held, `child.${child.pid}`)));
|
|
12359
12521
|
} finally {
|
|
12360
12522
|
rmSync2(childPending, { force: true });
|
|
12361
12523
|
}
|
|
@@ -12371,7 +12533,7 @@ async function withSwiftRootLock(root, work, signal) {
|
|
|
12371
12533
|
return await work(lease);
|
|
12372
12534
|
} finally {
|
|
12373
12535
|
await Promise.all(children.map((child) => terminateProcessGroup(child, "SIGKILL", 0)));
|
|
12374
|
-
writeFileSync2(
|
|
12536
|
+
writeFileSync2(path11.join(directory, name(held, "released")), "");
|
|
12375
12537
|
}
|
|
12376
12538
|
}
|
|
12377
12539
|
|
|
@@ -12418,6 +12580,8 @@ function swiftNativeTargetsRefusal(value) {
|
|
|
12418
12580
|
return at("deploymentTarget");
|
|
12419
12581
|
if (!paths(field("headers"))) return at("headers");
|
|
12420
12582
|
if (!paths(field("publicHeaders"))) return at("publicHeaders");
|
|
12583
|
+
if (typeof field("flattensPublicHeaders") !== "boolean")
|
|
12584
|
+
return at("flattensPublicHeaders");
|
|
12421
12585
|
if (!nullablePath("bridgingHeader")) return at("bridgingHeader");
|
|
12422
12586
|
if (!nullablePath("prefixHeader")) return at("prefixHeader");
|
|
12423
12587
|
if (!strings(searches) || !searches.every((item) => item === "." || isSwiftResourcePath(item)))
|
|
@@ -12466,7 +12630,7 @@ function isSwiftResourceBundles(value) {
|
|
|
12466
12630
|
|
|
12467
12631
|
// src/xcode-header-search.ts
|
|
12468
12632
|
import fs5 from "node:fs";
|
|
12469
|
-
import
|
|
12633
|
+
import path12 from "node:path";
|
|
12470
12634
|
function headerMap(entries) {
|
|
12471
12635
|
const unique = /* @__PURE__ */ new Map();
|
|
12472
12636
|
for (const entry of entries)
|
|
@@ -12513,11 +12677,11 @@ function writeXcodeHeaderSearch(directory, targets) {
|
|
|
12513
12677
|
const productDirectories = /* @__PURE__ */ new Map();
|
|
12514
12678
|
for (const target of targets)
|
|
12515
12679
|
for (const [product, file] of Object.entries(target.productHeaders)) {
|
|
12516
|
-
const listed = productDirectories.get(
|
|
12517
|
-
productDirectories.set(
|
|
12518
|
-
listed.push({ name:
|
|
12680
|
+
const listed = productDirectories.get(path12.dirname(product)) ?? [];
|
|
12681
|
+
productDirectories.set(path12.dirname(product), listed);
|
|
12682
|
+
listed.push({ name: path12.basename(product), file });
|
|
12519
12683
|
}
|
|
12520
|
-
const overlay =
|
|
12684
|
+
const overlay = path12.join(directory, "all-product-headers.yaml");
|
|
12521
12685
|
fs5.writeFileSync(
|
|
12522
12686
|
overlay,
|
|
12523
12687
|
JSON.stringify({
|
|
@@ -12537,7 +12701,7 @@ function writeXcodeHeaderSearch(directory, targets) {
|
|
|
12537
12701
|
const files = [overlay];
|
|
12538
12702
|
const flags = targets.map((target, index) => {
|
|
12539
12703
|
const maps = target.headerMaps.map((map2, order) => {
|
|
12540
|
-
const file =
|
|
12704
|
+
const file = path12.join(directory, `${index}-${order}.hmap`);
|
|
12541
12705
|
fs5.writeFileSync(file, headerMap(map2.entries));
|
|
12542
12706
|
files.push(file);
|
|
12543
12707
|
return { flag: map2.flag, file };
|
|
@@ -12654,9 +12818,9 @@ function swiftBuilderHopTimeoutMs(compileTimeoutMs) {
|
|
|
12654
12818
|
return (compileTimeoutMs ?? SWIFT_BUILDER_DEFAULT_COMPILE_MS) + SWIFT_BUILDER_TRANSPORT_MARGIN_MS;
|
|
12655
12819
|
}
|
|
12656
12820
|
function swiftDistributionAt(root) {
|
|
12657
|
-
const file =
|
|
12658
|
-
if (!
|
|
12659
|
-
return parseSwiftDistributionManifest(JSON.parse(
|
|
12821
|
+
const file = path13.join(root, SWIFT_DISTRIBUTION_MANIFEST);
|
|
12822
|
+
if (!existsSync3(file)) return null;
|
|
12823
|
+
return parseSwiftDistributionManifest(JSON.parse(readFileSync7(file, "utf8")));
|
|
12660
12824
|
}
|
|
12661
12825
|
function swiftModuleSdk(root) {
|
|
12662
12826
|
const pin = swiftDistributionAt(root) ?? swiftSourceSdk(root);
|
|
@@ -12683,7 +12847,7 @@ function swiftModuleInputFiles(root) {
|
|
|
12683
12847
|
"toolchain.json"
|
|
12684
12848
|
];
|
|
12685
12849
|
const walk = (dir) => {
|
|
12686
|
-
for (const entry of readdirSync4(
|
|
12850
|
+
for (const entry of readdirSync4(path13.join(root, dir), {
|
|
12687
12851
|
withFileTypes: true
|
|
12688
12852
|
})) {
|
|
12689
12853
|
const relative = `${dir}/${entry.name}`;
|
|
@@ -12701,61 +12865,65 @@ function swiftMacroPlugins(moduleRoot) {
|
|
|
12701
12865
|
const distribution = swiftDistributionAt(moduleRoot);
|
|
12702
12866
|
if (distribution)
|
|
12703
12867
|
return {
|
|
12704
|
-
libraries: distribution.plugins.map((plugin) =>
|
|
12868
|
+
libraries: distribution.plugins.filter((plugin) => path13.basename(plugin) !== "ExpoModulesMacros").map((plugin) => path13.join(moduleRoot, plugin)),
|
|
12869
|
+
executables: distribution.plugins.filter((plugin) => path13.basename(plugin) === "ExpoModulesMacros").map((plugin) => path13.join(moduleRoot, plugin)),
|
|
12705
12870
|
stale: false
|
|
12706
12871
|
};
|
|
12707
|
-
const dir =
|
|
12872
|
+
const dir = path13.join(moduleRoot, ".build/host/RnxPreviewMacros");
|
|
12708
12873
|
const release = JSON.parse(
|
|
12709
|
-
|
|
12874
|
+
readFileSync7(path13.join(moduleRoot, "toolchain.json"), "utf8")
|
|
12710
12875
|
).release;
|
|
12711
|
-
const compilerStamp =
|
|
12876
|
+
const compilerStamp = path13.join(dir, "compiler-release");
|
|
12877
|
+
const pluginScript = path13.join(moduleRoot, "scripts/build-preview-plugin.sh");
|
|
12878
|
+
const expoPlugin = path13.join(dir, "ExpoModulesMacros");
|
|
12712
12879
|
const ext = process.platform === "darwin" ? "dylib" : "so";
|
|
12713
12880
|
const plugins = [
|
|
12714
12881
|
{
|
|
12715
|
-
library:
|
|
12716
|
-
sources: [
|
|
12882
|
+
library: path13.join(dir, `libRnxPreviewMacros.${ext}`),
|
|
12883
|
+
sources: [path13.join(moduleRoot, "Sources/RnxPreviewMacros/PreviewMacro.swift")]
|
|
12717
12884
|
},
|
|
12718
12885
|
{
|
|
12719
|
-
library:
|
|
12886
|
+
library: path13.join(dir, `libFoundationMacros.${ext}`),
|
|
12720
12887
|
sources: [
|
|
12721
|
-
|
|
12722
|
-
|
|
12888
|
+
path13.join(moduleRoot, "Sources/FoundationMacros/PredicateMacro.swift"),
|
|
12889
|
+
path13.join(moduleRoot, "Sources/SwiftMacroSupport/PredicateExpression.swift")
|
|
12723
12890
|
]
|
|
12724
12891
|
},
|
|
12725
12892
|
{
|
|
12726
|
-
library:
|
|
12893
|
+
library: path13.join(dir, `libTipKitMacros.${ext}`),
|
|
12727
12894
|
sources: [
|
|
12728
|
-
|
|
12729
|
-
|
|
12895
|
+
path13.join(moduleRoot, "Sources/TipKitMacros/TipKitMacros.swift"),
|
|
12896
|
+
path13.join(moduleRoot, "Sources/SwiftMacroSupport/PredicateExpression.swift")
|
|
12730
12897
|
]
|
|
12731
12898
|
}
|
|
12732
12899
|
];
|
|
12733
12900
|
return {
|
|
12734
12901
|
libraries: plugins.map(({ library }) => library),
|
|
12735
|
-
|
|
12736
|
-
|
|
12902
|
+
executables: [expoPlugin],
|
|
12903
|
+
stale: !existsSync3(compilerStamp) || !existsSync3(expoPlugin) || statSync(pluginScript).mtimeMs > statSync(expoPlugin).mtimeMs || readFileSync7(compilerStamp, "utf8").trim() !== release || plugins.some(
|
|
12904
|
+
({ library, sources }) => !existsSync3(library) || sources.some((source) => statSync(source).mtimeMs > statSync(library).mtimeMs)
|
|
12737
12905
|
)
|
|
12738
12906
|
};
|
|
12739
12907
|
}
|
|
12740
12908
|
async function ensureMacroPlugins(moduleRoot, toolchainBin, release, signal) {
|
|
12741
|
-
const { libraries, stale } = swiftMacroPlugins(moduleRoot);
|
|
12909
|
+
const { libraries, executables, stale } = swiftMacroPlugins(moduleRoot);
|
|
12742
12910
|
if (stale) {
|
|
12743
12911
|
await runCompiler(
|
|
12744
12912
|
"sh",
|
|
12745
12913
|
[
|
|
12746
|
-
|
|
12914
|
+
path13.join(moduleRoot, "scripts/build-preview-plugin.sh"),
|
|
12747
12915
|
toolchainBin,
|
|
12748
12916
|
libraries[0]
|
|
12749
12917
|
],
|
|
12750
12918
|
{ signal }
|
|
12751
12919
|
);
|
|
12752
12920
|
writeFileSync3(
|
|
12753
|
-
|
|
12921
|
+
path13.join(path13.dirname(libraries[0]), "compiler-release"),
|
|
12754
12922
|
`${release}
|
|
12755
12923
|
`
|
|
12756
12924
|
);
|
|
12757
12925
|
}
|
|
12758
|
-
return libraries;
|
|
12926
|
+
return { libraries, executables };
|
|
12759
12927
|
}
|
|
12760
12928
|
var linkedModuleDigests = /* @__PURE__ */ new Map();
|
|
12761
12929
|
function clearLinkedModuleDigests(root) {
|
|
@@ -12764,9 +12932,9 @@ function clearLinkedModuleDigests(root) {
|
|
|
12764
12932
|
}
|
|
12765
12933
|
function swiftModuleDigest(root) {
|
|
12766
12934
|
const files = swiftModuleInputFiles(root);
|
|
12767
|
-
const stampHash =
|
|
12935
|
+
const stampHash = createHash10("sha256");
|
|
12768
12936
|
for (const file of files) {
|
|
12769
|
-
const stat = statSync(
|
|
12937
|
+
const stat = statSync(path13.join(root, file), { bigint: true });
|
|
12770
12938
|
stampHash.update(file);
|
|
12771
12939
|
stampHash.update(
|
|
12772
12940
|
`${stat.dev}:${stat.ino}:${stat.size}:${stat.mtimeNs}:${stat.ctimeNs}
|
|
@@ -12776,11 +12944,11 @@ function swiftModuleDigest(root) {
|
|
|
12776
12944
|
const stamp = stampHash.digest("hex");
|
|
12777
12945
|
const cached = linkedModuleDigests.get(root);
|
|
12778
12946
|
if (cached?.stamp === stamp) return cached.digest;
|
|
12779
|
-
const hash2 =
|
|
12947
|
+
const hash2 = createHash10("sha256");
|
|
12780
12948
|
for (const file of files) {
|
|
12781
|
-
hash2.update(
|
|
12949
|
+
hash2.update(createHash10("sha256").update(file).digest());
|
|
12782
12950
|
hash2.update(
|
|
12783
|
-
|
|
12951
|
+
createHash10("sha256").update(readFileSync7(path13.join(root, file))).digest()
|
|
12784
12952
|
);
|
|
12785
12953
|
}
|
|
12786
12954
|
const digest = hash2.digest();
|
|
@@ -12788,7 +12956,7 @@ function swiftModuleDigest(root) {
|
|
|
12788
12956
|
return digest;
|
|
12789
12957
|
}
|
|
12790
12958
|
function swiftProjectBuildKey(moduleRoot, release) {
|
|
12791
|
-
return
|
|
12959
|
+
return createHash10("sha256").update(`${release}\0${swiftModuleSdk(moduleRoot).wasmSdkId}`).update(swiftModuleDigest(moduleRoot)).digest("hex").slice(0, 32);
|
|
12792
12960
|
}
|
|
12793
12961
|
function compileTargets(input) {
|
|
12794
12962
|
const manifest = input.files["Package.swift"];
|
|
@@ -12804,7 +12972,7 @@ function withNativeSourceGlue(input, glue) {
|
|
|
12804
12972
|
...input,
|
|
12805
12973
|
files: {
|
|
12806
12974
|
...input.files,
|
|
12807
|
-
[
|
|
12975
|
+
[path13.posix.join(targetPath, "OneNativeSource.generated.swift")]: glue
|
|
12808
12976
|
},
|
|
12809
12977
|
oneModule: true
|
|
12810
12978
|
};
|
|
@@ -12855,15 +13023,15 @@ var OPTIONAL_FRAMEWORK_DEPENDENCIES = {
|
|
|
12855
13023
|
};
|
|
12856
13024
|
var OPTIONAL_FRAMEWORKS = new Set(Object.keys(OPTIONAL_FRAMEWORK_DEPENDENCIES));
|
|
12857
13025
|
var SWIFT_IMPORT = /^\s*(?:@\w+(?:\([^)]*\))?\s+)*import\s+(?:(?:typealias|struct|class|enum|protocol|let|var|func)\s+)?([A-Za-z_][A-Za-z0-9_]*)/;
|
|
13026
|
+
var kleeneNot = (value) => value === void 0 ? void 0 : !value;
|
|
13027
|
+
var kleeneAnd = (left, right) => left === false || right === false ? false : left === true && right === true ? true : void 0;
|
|
13028
|
+
var kleeneOr = (left, right) => left === true || right === true ? true : left === false && right === false ? false : void 0;
|
|
12858
13029
|
function swiftCondition(text3, available) {
|
|
12859
13030
|
const tokens = text3.match(/\w+\s*\([^()]*\)|&&|\|\||!|\(|\)|\w+/g) ?? [];
|
|
12860
13031
|
let index = 0;
|
|
12861
13032
|
const atom = () => {
|
|
12862
13033
|
const token = tokens[index++];
|
|
12863
|
-
if (token === "!")
|
|
12864
|
-
const value = atom();
|
|
12865
|
-
return value === void 0 ? void 0 : !value;
|
|
12866
|
-
}
|
|
13034
|
+
if (token === "!") return kleeneNot(atom());
|
|
12867
13035
|
if (token === "(") {
|
|
12868
13036
|
const value = either();
|
|
12869
13037
|
index++;
|
|
@@ -12884,8 +13052,7 @@ function swiftCondition(text3, available) {
|
|
|
12884
13052
|
let value = atom();
|
|
12885
13053
|
while (tokens[index] === "&&") {
|
|
12886
13054
|
index++;
|
|
12887
|
-
|
|
12888
|
-
value = value === false || next === false ? false : value && next ? true : void 0;
|
|
13055
|
+
value = kleeneAnd(value, atom());
|
|
12889
13056
|
}
|
|
12890
13057
|
return value;
|
|
12891
13058
|
};
|
|
@@ -12893,8 +13060,7 @@ function swiftCondition(text3, available) {
|
|
|
12893
13060
|
let value = both();
|
|
12894
13061
|
while (tokens[index] === "||") {
|
|
12895
13062
|
index++;
|
|
12896
|
-
|
|
12897
|
-
value = value === true || next === true ? true : value === false && next === false ? false : void 0;
|
|
13063
|
+
value = kleeneOr(value, both());
|
|
12898
13064
|
}
|
|
12899
13065
|
return value;
|
|
12900
13066
|
};
|
|
@@ -12938,8 +13104,8 @@ function swiftImportNames(contents, available) {
|
|
|
12938
13104
|
function swiftPeachModules(moduleRoot) {
|
|
12939
13105
|
const distribution = swiftDistributionAt(moduleRoot);
|
|
12940
13106
|
return distribution ? distribution.modules : swiftManifestDeclarations(
|
|
12941
|
-
|
|
12942
|
-
).filter((target) => !target.executable).map((target) => target.name);
|
|
13107
|
+
readFileSync7(path13.join(moduleRoot, "Package.swift"), "utf8")
|
|
13108
|
+
).filter((target) => !target.executable && !target.path.startsWith("fixtures/")).map((target) => target.name);
|
|
12943
13109
|
}
|
|
12944
13110
|
var sdkPaths = /* @__PURE__ */ new Map();
|
|
12945
13111
|
function swiftSdkPaths(moduleRoot, toolchainBin) {
|
|
@@ -12948,7 +13114,7 @@ function swiftSdkPaths(moduleRoot, toolchainBin) {
|
|
|
12948
13114
|
const cached = sdkPaths.get(key);
|
|
12949
13115
|
if (cached) return cached;
|
|
12950
13116
|
const configuration = execFileSync3(
|
|
12951
|
-
|
|
13117
|
+
path13.join(toolchainBin, "swift"),
|
|
12952
13118
|
[
|
|
12953
13119
|
"sdk",
|
|
12954
13120
|
"configure",
|
|
@@ -12979,14 +13145,14 @@ function swiftAvailableModules(moduleRoot, toolchainBin) {
|
|
|
12979
13145
|
if (cached) return cached;
|
|
12980
13146
|
const modules = new Set(swiftPeachModules(moduleRoot));
|
|
12981
13147
|
const { resources } = swiftSdkPaths(moduleRoot, toolchainBin);
|
|
12982
|
-
for (const entry of readdirSync4(
|
|
13148
|
+
for (const entry of readdirSync4(path13.join(resources, "wasi"))) {
|
|
12983
13149
|
if (entry.endsWith(".swiftmodule"))
|
|
12984
13150
|
modules.add(entry.slice(0, -".swiftmodule".length));
|
|
12985
13151
|
}
|
|
12986
13152
|
for (const entry of readdirSync4(resources)) {
|
|
12987
|
-
const map2 =
|
|
12988
|
-
if (!
|
|
12989
|
-
for (const match of
|
|
13153
|
+
const map2 = path13.join(resources, entry, "module.modulemap");
|
|
13154
|
+
if (!existsSync3(map2)) continue;
|
|
13155
|
+
for (const match of readFileSync7(map2, "utf8").matchAll(/^module\s+([A-Za-z_]\w*)/gm))
|
|
12990
13156
|
modules.add(match[1]);
|
|
12991
13157
|
}
|
|
12992
13158
|
availableModules.set(key, modules);
|
|
@@ -13045,16 +13211,18 @@ var FOUNDATION_IMPLICIT_FLAGS = FOUNDATION_IMPLICIT_MODULES.map(
|
|
|
13045
13211
|
(module) => `, "-Xfrontend", "-import-module", "-Xfrontend", "${module}"`
|
|
13046
13212
|
).join("");
|
|
13047
13213
|
var ONE_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "One"';
|
|
13048
|
-
var
|
|
13214
|
+
var executableLinkFlags = (root) => ` "-Xclang-linker", "-O0",
|
|
13215
|
+
"-Xclang-linker", ${JSON.stringify(`-fuse-ld=${path13.join(root, SWIFT_AUTOLINK_LINKER)}`)},
|
|
13049
13216
|
"-Xlinker", "-z", "-Xlinker", "stack-size=8372224",
|
|
13050
13217
|
"-Xlinker", "--stack-first",
|
|
13051
13218
|
"-Xlinker", "--global-base=8372224",
|
|
13219
|
+
"-Xlinker", "-lsetjmp",
|
|
13052
13220
|
`;
|
|
13053
13221
|
var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
|
|
13054
|
-
var MULTI_MANIFEST_VERSION =
|
|
13055
|
-
var compilerSourceDigest = true ? "
|
|
13222
|
+
var MULTI_MANIFEST_VERSION = 45;
|
|
13223
|
+
var compilerSourceDigest = true ? "ad79573e8515bcc2bfbbb2c1b86d3d864d7c37e3ae2098cca7b0693bb6141c4e" : swiftCompilerSourceDigest(import.meta.dirname);
|
|
13056
13224
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
13057
|
-
const hash2 =
|
|
13225
|
+
const hash2 = createHash10("sha256");
|
|
13058
13226
|
hash2.update(`swift-compile
|
|
13059
13227
|
${release}
|
|
13060
13228
|
`);
|
|
@@ -13062,32 +13230,32 @@ ${release}
|
|
|
13062
13230
|
if (input.oneModule) hash2.update("one-module\n");
|
|
13063
13231
|
hash2.update(swiftModuleDigest(moduleRoot));
|
|
13064
13232
|
for (const file of Object.keys(input.files).sort()) {
|
|
13065
|
-
hash2.update(
|
|
13066
|
-
hash2.update(
|
|
13233
|
+
hash2.update(createHash10("sha256").update(file).digest());
|
|
13234
|
+
hash2.update(createHash10("sha256").update(input.files[file]).digest());
|
|
13067
13235
|
}
|
|
13068
13236
|
for (const file of Object.keys(input.metalSources ?? {}).sort()) {
|
|
13069
13237
|
hash2.update("metal-source\n");
|
|
13070
|
-
hash2.update(
|
|
13238
|
+
hash2.update(createHash10("sha256").update(file).digest());
|
|
13071
13239
|
hash2.update(
|
|
13072
|
-
|
|
13240
|
+
createHash10("sha256").update(input.metalSources?.[file] ?? "").digest()
|
|
13073
13241
|
);
|
|
13074
13242
|
}
|
|
13075
13243
|
for (const base of Object.keys(input.resources ?? {}).sort()) {
|
|
13076
|
-
hash2.update(
|
|
13244
|
+
hash2.update(createHash10("sha256").update(base).digest());
|
|
13077
13245
|
hash2.update(
|
|
13078
|
-
|
|
13246
|
+
createHash10("sha256").update(input.resources?.[base] ?? "").digest()
|
|
13079
13247
|
);
|
|
13080
13248
|
}
|
|
13081
13249
|
for (const name2 of Object.keys(input.images ?? {}).sort()) {
|
|
13082
13250
|
const image = input.images?.[name2];
|
|
13083
13251
|
if (!image) continue;
|
|
13084
|
-
hash2.update(
|
|
13085
|
-
hash2.update(
|
|
13086
|
-
hash2.update(
|
|
13252
|
+
hash2.update(createHash10("sha256").update(name2).digest());
|
|
13253
|
+
hash2.update(createHash10("sha256").update(image.file).digest());
|
|
13254
|
+
hash2.update(createHash10("sha256").update(image.data).digest());
|
|
13087
13255
|
}
|
|
13088
13256
|
for (const file of [...new Set(input.resourcePaths ?? [])].sort()) {
|
|
13089
13257
|
hash2.update("resource-path\n");
|
|
13090
|
-
hash2.update(
|
|
13258
|
+
hash2.update(createHash10("sha256").update(file).digest());
|
|
13091
13259
|
}
|
|
13092
13260
|
hash2.update(
|
|
13093
13261
|
JSON.stringify(
|
|
@@ -13098,7 +13266,7 @@ ${release}
|
|
|
13098
13266
|
hash2.update(JSON.stringify(input.packageGuestImports ?? []));
|
|
13099
13267
|
for (const file of Object.keys(input.packageFiles ?? {}).sort()) {
|
|
13100
13268
|
hash2.update(`package-file\0${file}\0`);
|
|
13101
|
-
hash2.update(
|
|
13269
|
+
hash2.update(createHash10("sha256").update(input.packageFiles[file]).digest());
|
|
13102
13270
|
}
|
|
13103
13271
|
hash2.update(JSON.stringify(input.objcPeerStartup ?? null));
|
|
13104
13272
|
for (const target of Object.keys(input.libraries ?? {}).sort()) {
|
|
@@ -13106,7 +13274,7 @@ ${release}
|
|
|
13106
13274
|
${target}
|
|
13107
13275
|
`);
|
|
13108
13276
|
hash2.update(
|
|
13109
|
-
|
|
13277
|
+
createHash10("sha256").update(input.libraries?.[target] ?? "").digest()
|
|
13110
13278
|
);
|
|
13111
13279
|
}
|
|
13112
13280
|
const targets = compileTargets(input);
|
|
@@ -13125,7 +13293,7 @@ ${target}
|
|
|
13125
13293
|
return hash2.digest("hex");
|
|
13126
13294
|
}
|
|
13127
13295
|
function swiftCrossImportFlags(moduleRoot, distribution) {
|
|
13128
|
-
const overlayRoot =
|
|
13296
|
+
const overlayRoot = path13.join(
|
|
13129
13297
|
moduleRoot,
|
|
13130
13298
|
distribution ? "modules" : "cross-import-overlays"
|
|
13131
13299
|
);
|
|
@@ -13133,9 +13301,9 @@ function swiftCrossImportFlags(moduleRoot, distribution) {
|
|
|
13133
13301
|
"-Xfrontend",
|
|
13134
13302
|
"-swift-module-cross-import",
|
|
13135
13303
|
"-Xfrontend",
|
|
13136
|
-
|
|
13304
|
+
path13.basename(path13.dirname(file), ".swiftcrossimport"),
|
|
13137
13305
|
"-Xfrontend",
|
|
13138
|
-
|
|
13306
|
+
path13.join(overlayRoot, file)
|
|
13139
13307
|
]);
|
|
13140
13308
|
}
|
|
13141
13309
|
function emitSwiftPackageManifest(args) {
|
|
@@ -13167,7 +13335,7 @@ function emitSwiftPackageManifest(args) {
|
|
|
13167
13335
|
distributionLink.files.set(
|
|
13168
13336
|
distributionLink.path,
|
|
13169
13337
|
objects.map(
|
|
13170
|
-
(object) => `"${
|
|
13338
|
+
(object) => `"${path13.join(moduleRoot, object).replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`
|
|
13171
13339
|
).join("\n") + "\n"
|
|
13172
13340
|
);
|
|
13173
13341
|
}
|
|
@@ -13188,7 +13356,7 @@ function emitSwiftPackageManifest(args) {
|
|
|
13188
13356
|
const features = (target.experimentalFeatures ?? []).map((name2) => ` .enableExperimentalFeature(${JSON.stringify(name2)}),`).join("");
|
|
13189
13357
|
const upcoming = (target.upcomingFeatures ?? []).map((name2) => ` .enableUpcomingFeature(${JSON.stringify(name2)}),`).join("");
|
|
13190
13358
|
const upstream = (target.swiftFlags ?? []).map((flag) => `, ${JSON.stringify(flag)}`).join("");
|
|
13191
|
-
const imports = distribution ? `, "-I", ${JSON.stringify(
|
|
13359
|
+
const imports = distribution ? `, "-I", ${JSON.stringify(path13.join(moduleRoot, "modules"))}` : "";
|
|
13192
13360
|
const native = args.native?.get(target.name);
|
|
13193
13361
|
const clang = native && !native.mixed;
|
|
13194
13362
|
const nativeImports = (siblings.get(target.name) ?? []).filter((name2) => args.native?.has(name2) && !args.native.get(name2)?.mixed).map(
|
|
@@ -13205,11 +13373,18 @@ function emitSwiftPackageManifest(args) {
|
|
|
13205
13373
|
...target.executable ? linkedNativeModules : []
|
|
13206
13374
|
])
|
|
13207
13375
|
includeImportContext(dependency);
|
|
13208
|
-
const nativeImportFlags = [...importContext].flatMap((name2) =>
|
|
13376
|
+
const nativeImportFlags = [...importContext].flatMap((name2) => {
|
|
13377
|
+
const dependency = args.native?.get(name2);
|
|
13378
|
+
return dependency?.underlying ? [
|
|
13379
|
+
`-fmodule-map-file=${dependency.underlying.modulemap}`,
|
|
13380
|
+
...dependency.underlying.flags
|
|
13381
|
+
] : dependency?.clang?.importFlags ?? [];
|
|
13382
|
+
}).map((flag) => `, "-Xcc", ${JSON.stringify(flag)}`).join("");
|
|
13383
|
+
const underlying = native?.underlying ? `, "-import-underlying-module", "-Xcc", ${JSON.stringify(`-fmodule-map-file=${native.underlying.modulemap}`)}${native.underlying.flags.map((flag) => `, "-Xcc", ${JSON.stringify(flag)}`).join("")}` : "";
|
|
13209
13384
|
const header = args.headerDirectory && [...args.native?.values() ?? []].some(
|
|
13210
13385
|
(value) => value.late?.producers.includes(target.name)
|
|
13211
|
-
) ? `, "-emit-objc-header-path", ${JSON.stringify(
|
|
13212
|
-
const swiftSettings = `swiftSettings: [.swiftLanguageMode(.v${target.languageMode}),${isolation}${interoperability}${defines}${features}${upcoming}${exports} .unsafeFlags(["-Osize", "-Xfrontend", "-enable-cross-import-overlays"${overlayFlags}${FOUNDATION_IMPLICIT_FLAGS}${oneModule ? ONE_IMPLICIT_FLAGS : ""}${imports}${nativeImports}${nativeImportFlags}${header}${upstream}])]`;
|
|
13386
|
+
) ? `, "-emit-objc-header-path", ${JSON.stringify(path13.join(args.headerDirectory, `${target.name}-${args.objcExports?.modules.has(target.name) ? "Cxx" : "Swift"}.h`))}` : "";
|
|
13387
|
+
const swiftSettings = `swiftSettings: [.swiftLanguageMode(.v${target.languageMode}),${isolation}${interoperability}${defines}${features}${upcoming}${exports} .unsafeFlags(["-Osize", "-Xfrontend", "-enable-cross-import-overlays"${overlayFlags}${FOUNDATION_IMPLICIT_FLAGS}${oneModule ? ONE_IMPLICIT_FLAGS : ""}${imports}${nativeImports}${nativeImportFlags}${underlying}${header}${upstream}])]`;
|
|
13213
13388
|
const deps = [
|
|
13214
13389
|
.../* @__PURE__ */ new Set([
|
|
13215
13390
|
...(target.dependencies ?? []).flatMap(
|
|
@@ -13257,7 +13432,7 @@ function emitSwiftPackageManifest(args) {
|
|
|
13257
13432
|
linkerSettings: [
|
|
13258
13433
|
${librarySettings.map((setting) => `${setting},`).join("\n ")}
|
|
13259
13434
|
.unsafeFlags([
|
|
13260
|
-
${REACTOR_FLAG}${
|
|
13435
|
+
${REACTOR_FLAG}${executableLinkFlags(args.root)} "-Xlinker", "--export-if-defined=__main_argc_argv"${args.objcExports ? ', "-Xlinker", "--fatal-warnings"' : ""}${library},
|
|
13261
13436
|
]),
|
|
13262
13437
|
.unsafeFlags(["-Xlinker", "--strip-all"], .when(configuration: .release)),
|
|
13263
13438
|
]` : librarySettings.length > 0 ? `,
|
|
@@ -13271,15 +13446,19 @@ function emitSwiftPackageManifest(args) {
|
|
|
13271
13446
|
`cSettings: [${cDefines} .unsafeFlags(${JSON.stringify([...args.nativeFlags?.get(target.name) ?? [], ...native?.flags ?? []])})]`,
|
|
13272
13447
|
`cxxSettings: [${cxxDefines} .unsafeFlags(${JSON.stringify(["-fno-cxx-modules", ...args.nativeFlags?.get(target.name) ?? [], ...native?.cxxFlags ?? []])})]`
|
|
13273
13448
|
].join(", ");
|
|
13449
|
+
const exclusions = native?.clang ? native.exclude ?? native.lateSources : [
|
|
13450
|
+
...native ? native.exclude ?? native.lateSources : [],
|
|
13451
|
+
...target.exclude ?? []
|
|
13452
|
+
];
|
|
13274
13453
|
return [
|
|
13275
13454
|
` ${kind}(`,
|
|
13276
13455
|
` name: "${target.name}",`,
|
|
13277
13456
|
` dependencies: [${deps}],`,
|
|
13278
13457
|
` path: ${JSON.stringify(native?.clang ? "." : target.path)},`,
|
|
13279
|
-
...
|
|
13458
|
+
...exclusions.length ? [` exclude: ${JSON.stringify(exclusions)},`] : [],
|
|
13280
13459
|
...native?.clang ? [
|
|
13281
|
-
` sources: ${JSON.stringify(native.clang.sources.map((source) =>
|
|
13282
|
-
` publicHeadersPath: ${JSON.stringify(
|
|
13460
|
+
` sources: ${JSON.stringify(native.clang.sources.map((source) => path13.posix.join(native.path, source)))},`,
|
|
13461
|
+
` publicHeadersPath: ${JSON.stringify(path13.posix.dirname(native.clang.modulemap))},`
|
|
13283
13462
|
] : native?.flags ? [` sources: ${JSON.stringify(native.sources)},`] : [],
|
|
13284
13463
|
...!native?.clang && target.publicHeadersPath !== void 0 ? [` publicHeadersPath: ${JSON.stringify(target.publicHeadersPath)},`] : [],
|
|
13285
13464
|
// the native backend supplies dependency module maps without their
|
|
@@ -13326,8 +13505,8 @@ function emitSwiftPackageManifest(args) {
|
|
|
13326
13505
|
` .target(name: ${JSON.stringify(group.name)},`,
|
|
13327
13506
|
` dependencies: ${JSON.stringify(native.mixed ? [] : [name2, ...late.producers])},`,
|
|
13328
13507
|
` path: ${JSON.stringify(native.clang ? "." : native.path)},`,
|
|
13329
|
-
` sources: ${JSON.stringify(native.clang ? group.sources.map((source) =>
|
|
13330
|
-
` publicHeadersPath: ${JSON.stringify(native.clang ?
|
|
13508
|
+
` sources: ${JSON.stringify(native.clang ? group.sources.map((source) => path13.posix.join(native.path, source)) : group.sources)},`,
|
|
13509
|
+
` publicHeadersPath: ${JSON.stringify(native.clang ? path13.posix.dirname(native.clang.modulemap) : "include")},`,
|
|
13331
13510
|
` cSettings: [${macroSettings(owner?.cDefines)} .unsafeFlags(${JSON.stringify([...args.nativeFlags?.get(name2) ?? [], ...group.flags])})],`,
|
|
13332
13511
|
` cxxSettings: [${macroSettings(owner?.cxxDefines)} .unsafeFlags(${JSON.stringify(["-fno-cxx-modules", ...args.nativeFlags?.get(name2) ?? [], "-I", native.includeDirectory, "-I", args.headerDirectory, ...group.cxxFlags])})]),`
|
|
13333
13512
|
]) : [];
|
|
@@ -13342,7 +13521,7 @@ function syncSwiftTree(base, files) {
|
|
|
13342
13521
|
mkdirSync2(base, { recursive: true });
|
|
13343
13522
|
const walk = (dir) => {
|
|
13344
13523
|
for (const entry of readdirSync4(dir, { withFileTypes: true })) {
|
|
13345
|
-
const full =
|
|
13524
|
+
const full = path13.join(dir, entry.name);
|
|
13346
13525
|
if (dir === base && entry.name === ".build") continue;
|
|
13347
13526
|
if (entry.isDirectory()) walk(full);
|
|
13348
13527
|
else if (!files.has(full)) rmSync3(full, { force: true });
|
|
@@ -13350,9 +13529,9 @@ function syncSwiftTree(base, files) {
|
|
|
13350
13529
|
};
|
|
13351
13530
|
walk(base);
|
|
13352
13531
|
for (const [full, contents] of files) {
|
|
13353
|
-
if (
|
|
13532
|
+
if (existsSync3(full) && (typeof contents === "string" ? readFileSync7(full, "utf8") === contents : readFileSync7(full).equals(contents)))
|
|
13354
13533
|
continue;
|
|
13355
|
-
mkdirSync2(
|
|
13534
|
+
mkdirSync2(path13.dirname(full), { recursive: true });
|
|
13356
13535
|
writeFileSync3(full, contents);
|
|
13357
13536
|
}
|
|
13358
13537
|
}
|
|
@@ -17129,7 +17308,7 @@ function swiftApplicationEntry(file, source) {
|
|
|
17129
17308
|
else if (source[at] === "}") depth--;
|
|
17130
17309
|
else if (depth === 0 && /^@(?:main|UIApplicationMain)\b/.test(source.slice(at)))
|
|
17131
17310
|
return true;
|
|
17132
|
-
else if (depth === 0 &&
|
|
17311
|
+
else if (depth === 0 && path13.basename(file) === "main.swift" && /^UIApplicationMain\s*\(/.test(source.slice(at)))
|
|
17133
17312
|
return true;
|
|
17134
17313
|
}
|
|
17135
17314
|
return false;
|
|
@@ -17157,8 +17336,7 @@ function cMacroBareValue(name2, env) {
|
|
|
17157
17336
|
return false;
|
|
17158
17337
|
}
|
|
17159
17338
|
function cMacroNegated(name2, env) {
|
|
17160
|
-
|
|
17161
|
-
return value === void 0 ? void 0 : !value;
|
|
17339
|
+
return kleeneNot(cMacroDefined(name2, env));
|
|
17162
17340
|
}
|
|
17163
17341
|
function cConditionValue(expression, env) {
|
|
17164
17342
|
let i = 0;
|
|
@@ -17171,8 +17349,7 @@ function cConditionValue(expression, env) {
|
|
|
17171
17349
|
skipSpaces();
|
|
17172
17350
|
if (!expression.startsWith("||", i)) return value2;
|
|
17173
17351
|
i += 2;
|
|
17174
|
-
|
|
17175
|
-
value2 = value2 === void 0 || right === void 0 ? void 0 : value2 || right;
|
|
17352
|
+
value2 = kleeneOr(value2, parseAnd());
|
|
17176
17353
|
}
|
|
17177
17354
|
};
|
|
17178
17355
|
const parseAnd = () => {
|
|
@@ -17181,16 +17358,14 @@ function cConditionValue(expression, env) {
|
|
|
17181
17358
|
skipSpaces();
|
|
17182
17359
|
if (!expression.startsWith("&&", i)) return value2;
|
|
17183
17360
|
i += 2;
|
|
17184
|
-
|
|
17185
|
-
value2 = value2 === void 0 || right === void 0 ? void 0 : value2 && right;
|
|
17361
|
+
value2 = kleeneAnd(value2, parseUnary());
|
|
17186
17362
|
}
|
|
17187
17363
|
};
|
|
17188
17364
|
const parseUnary = () => {
|
|
17189
17365
|
skipSpaces();
|
|
17190
17366
|
if (expression[i] === "!") {
|
|
17191
17367
|
i++;
|
|
17192
|
-
|
|
17193
|
-
return value2 === void 0 ? void 0 : !value2;
|
|
17368
|
+
return kleeneNot(parseUnary());
|
|
17194
17369
|
}
|
|
17195
17370
|
if (expression[i] === "(") {
|
|
17196
17371
|
i++;
|
|
@@ -17313,7 +17488,19 @@ function swiftCPredefines(language) {
|
|
|
17313
17488
|
function swiftCMainEntry(file, source, env = emptyMacroEnvironment) {
|
|
17314
17489
|
if (!isSwiftNativeTranslationUnit(file)) return false;
|
|
17315
17490
|
const code = cActiveCode(stripCCode(source), env);
|
|
17491
|
+
const linkage = [];
|
|
17492
|
+
let scanned = 0;
|
|
17316
17493
|
for (const match of code.matchAll(/^\s*(?:int\s+|void\s+)?main\s*\(/gm)) {
|
|
17494
|
+
while (scanned < match.index) {
|
|
17495
|
+
if (code[scanned] === "{") {
|
|
17496
|
+
let start = scanned;
|
|
17497
|
+
while (start > 0 && code[start - 1] !== ";" && code[start - 1] !== "{" && code[start - 1] !== "}")
|
|
17498
|
+
start--;
|
|
17499
|
+
linkage.push(/(?:^|[^\w])extern\s*$/.test(code.slice(start, scanned)));
|
|
17500
|
+
} else if (code[scanned] === "}") linkage.pop();
|
|
17501
|
+
scanned += 1;
|
|
17502
|
+
}
|
|
17503
|
+
if (linkage.some((open) => !open)) continue;
|
|
17317
17504
|
let depth = 1;
|
|
17318
17505
|
let index = match.index + match[0].length;
|
|
17319
17506
|
for (; index < code.length && depth > 0; index++) {
|
|
@@ -17365,7 +17552,7 @@ function installObjcPeerStartup(input, targets, compiled) {
|
|
|
17365
17552
|
);
|
|
17366
17553
|
if (entries.length === 0) {
|
|
17367
17554
|
const source2 = compiled.get(input.entry);
|
|
17368
|
-
if (
|
|
17555
|
+
if (path13.basename(input.entry) !== "main.swift" || source2 === void 0)
|
|
17369
17556
|
fail("requires main.swift or a supported @main App/UIApplicationDelegate entry");
|
|
17370
17557
|
compiled.set(input.entry, `_peachRegisterObjcPeers()
|
|
17371
17558
|
${source2}`);
|
|
@@ -17501,26 +17688,26 @@ function prepareSwiftDependency(source, destination) {
|
|
|
17501
17688
|
for (const entry of readdirSync4(from, { withFileTypes: true })) {
|
|
17502
17689
|
if (entry.name === ".git" || entry.name === ".build" || entry.name === ".swiftpm")
|
|
17503
17690
|
continue;
|
|
17504
|
-
const file =
|
|
17691
|
+
const file = path13.join(from, entry.name);
|
|
17505
17692
|
if (entry.isDirectory()) gather(file);
|
|
17506
17693
|
else if (entry.isFile() && entry.name.endsWith(".swift"))
|
|
17507
|
-
origins[
|
|
17694
|
+
origins[path13.relative(source, file)] = readFileSync7(file, "utf8");
|
|
17508
17695
|
}
|
|
17509
17696
|
};
|
|
17510
17697
|
gather(source);
|
|
17511
|
-
const manifest =
|
|
17512
|
-
const targets =
|
|
17698
|
+
const manifest = path13.join(source, "Package.swift");
|
|
17699
|
+
const targets = existsSync3(manifest) ? swiftManifestTargets(readFileSync7(manifest, "utf8")) : [];
|
|
17513
17700
|
const compiled = compiledSwiftSources(origins, targets);
|
|
17514
17701
|
const copy = (from, to) => {
|
|
17515
17702
|
mkdirSync2(to, { recursive: true });
|
|
17516
17703
|
for (const entry of readdirSync4(from, { withFileTypes: true })) {
|
|
17517
17704
|
if (entry.name === ".git" || entry.name === ".build" || entry.name === ".swiftpm")
|
|
17518
17705
|
continue;
|
|
17519
|
-
const file =
|
|
17520
|
-
const target =
|
|
17706
|
+
const file = path13.join(from, entry.name);
|
|
17707
|
+
const target = path13.join(to, entry.name);
|
|
17521
17708
|
if (entry.isDirectory()) copy(file, target);
|
|
17522
17709
|
else if (entry.isFile() && entry.name.endsWith(".swift"))
|
|
17523
|
-
writeFileSync3(target, compiled.get(
|
|
17710
|
+
writeFileSync3(target, compiled.get(path13.relative(source, file)));
|
|
17524
17711
|
else cpSync(file, target, { verbatimSymlinks: true });
|
|
17525
17712
|
}
|
|
17526
17713
|
};
|
|
@@ -17550,7 +17737,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
17550
17737
|
const targets = distribution && compileTargets(input).length === 0 ? [
|
|
17551
17738
|
{
|
|
17552
17739
|
name: "App",
|
|
17553
|
-
path:
|
|
17740
|
+
path: path13.relative(layout.root, layout.sources),
|
|
17554
17741
|
executable: true,
|
|
17555
17742
|
languageMode: 5,
|
|
17556
17743
|
mainActorIsolation: false,
|
|
@@ -17571,8 +17758,8 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
17571
17758
|
);
|
|
17572
17759
|
if (target) swiftTargets.add(target.name);
|
|
17573
17760
|
}
|
|
17574
|
-
const headerDirectory =
|
|
17575
|
-
const headerModuleDirectory =
|
|
17761
|
+
const headerDirectory = path13.join(layout.root, ".build", "peach-cxx-headers");
|
|
17762
|
+
const headerModuleDirectory = path13.join(
|
|
17576
17763
|
layout.root,
|
|
17577
17764
|
".build",
|
|
17578
17765
|
"peach-objc-export-modules"
|
|
@@ -17582,14 +17769,14 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
17582
17769
|
let checkedToolchain;
|
|
17583
17770
|
const nativeToolchain = () => {
|
|
17584
17771
|
if (checkedToolchain) return checkedToolchain;
|
|
17585
|
-
const pin = distribution ?? JSON.parse(
|
|
17772
|
+
const pin = distribution ?? JSON.parse(readFileSync7(path13.join(moduleRoot, "toolchain.json"), "utf8"));
|
|
17586
17773
|
checkedToolchain = swiftToolchain(pin.release, swiftModuleSdk(moduleRoot));
|
|
17587
17774
|
return checkedToolchain;
|
|
17588
17775
|
};
|
|
17589
17776
|
const deploymentTarget = (name2) => input.nativeTargets?.find((value) => value.name === name2)?.deploymentTarget ?? "16.0";
|
|
17590
17777
|
const targetStagedFiles = /* @__PURE__ */ new Map();
|
|
17591
17778
|
const stageTargetFile = (target, file, contents, options) => {
|
|
17592
|
-
const relative =
|
|
17779
|
+
const relative = path13.relative(layout.root, file).split(path13.sep).join(path13.posix.sep);
|
|
17593
17780
|
const prior = files.has(file) ? files.get(file) : Object.hasOwn(input.files, relative) ? input.files[relative] : void 0;
|
|
17594
17781
|
if (!options?.allowExisting && prior !== void 0)
|
|
17595
17782
|
throw new Error(`target ${target} already contains generated output ${relative}`);
|
|
@@ -17620,7 +17807,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
17620
17807
|
targetStagedFiles.delete(target.name);
|
|
17621
17808
|
if (entries.some(([file]) => isSwiftNativeTranslationUnit(file)) && (swift || input.nativeTargets?.some((value) => value.name === target.name))) {
|
|
17622
17809
|
if (!swift) {
|
|
17623
|
-
const unprepared =
|
|
17810
|
+
const unprepared = path13.join(
|
|
17624
17811
|
layout.root,
|
|
17625
17812
|
target.path,
|
|
17626
17813
|
"PeachUnprepared.generated.swift"
|
|
@@ -17635,7 +17822,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
17635
17822
|
native.set(target.name, {
|
|
17636
17823
|
mixed: true,
|
|
17637
17824
|
path: target.path,
|
|
17638
|
-
includeDirectory:
|
|
17825
|
+
includeDirectory: path13.join(layout.root, target.path, "include"),
|
|
17639
17826
|
sources: [],
|
|
17640
17827
|
lateSources: [],
|
|
17641
17828
|
exclude: entries.filter(([file]) => !file.endsWith(".swift") && !file.endsWith(".metal")).map(([file]) => file.slice(prefix.length))
|
|
@@ -17647,26 +17834,27 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
17647
17834
|
const contents = input.files[file];
|
|
17648
17835
|
if (contents === void 0)
|
|
17649
17836
|
throw new Error(`missing original Objective-C header ${file}`);
|
|
17650
|
-
const destination =
|
|
17651
|
-
mkdirSync2(
|
|
17837
|
+
const destination = path13.join(layout.root, file);
|
|
17838
|
+
mkdirSync2(path13.dirname(destination), { recursive: true });
|
|
17652
17839
|
writeFileSync3(destination, contents);
|
|
17653
17840
|
files.set(destination, contents);
|
|
17654
17841
|
}
|
|
17842
|
+
if (!settings.flattensPublicHeaders) continue;
|
|
17655
17843
|
for (const header of settings.publicHeaders) {
|
|
17656
|
-
const destination =
|
|
17844
|
+
const destination = path13.join(headerDirectory, settings.name, path13.basename(header));
|
|
17657
17845
|
if (files.has(destination))
|
|
17658
17846
|
throw new Error(`duplicate product header ${destination}`);
|
|
17659
|
-
const contents = `#import ${JSON.stringify(
|
|
17847
|
+
const contents = `#import ${JSON.stringify(path13.join(layout.root, header))}
|
|
17660
17848
|
`;
|
|
17661
17849
|
files.set(destination, contents);
|
|
17662
|
-
mkdirSync2(
|
|
17850
|
+
mkdirSync2(path13.dirname(destination), { recursive: true });
|
|
17663
17851
|
writeFileSync3(destination, contents);
|
|
17664
17852
|
}
|
|
17665
17853
|
}
|
|
17666
17854
|
const nativeTargets = input.nativeTargets ?? [];
|
|
17667
|
-
const fromInputRoot = (file) => file.startsWith(`${SWIFT_NATIVE_INPUT_ROOT}/`) ?
|
|
17855
|
+
const fromInputRoot = (file) => file.startsWith(`${SWIFT_NATIVE_INPUT_ROOT}/`) ? path13.join(layout.root, file.slice(SWIFT_NATIVE_INPUT_ROOT.length + 1)) : file;
|
|
17668
17856
|
const headerSearch = writeXcodeHeaderSearch(
|
|
17669
|
-
|
|
17857
|
+
path13.join(layout.root, ".build", "peach-xcode-headers"),
|
|
17670
17858
|
nativeTargets.map((settings) => ({
|
|
17671
17859
|
headerMaps: settings.headerMaps.map((map2) => ({
|
|
17672
17860
|
flag: map2.flag,
|
|
@@ -17677,12 +17865,12 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
17677
17865
|
})),
|
|
17678
17866
|
productHeaders: Object.fromEntries(
|
|
17679
17867
|
Object.entries(settings.productHeaders).map(([product, file]) => [
|
|
17680
|
-
|
|
17681
|
-
|
|
17868
|
+
path13.join(layout.root, product),
|
|
17869
|
+
path13.join(layout.root, file)
|
|
17682
17870
|
])
|
|
17683
17871
|
),
|
|
17684
17872
|
userHeaderSearchPaths: settings.userHeaderSearchPaths.map(
|
|
17685
|
-
(directory) =>
|
|
17873
|
+
(directory) => path13.join(layout.root, directory)
|
|
17686
17874
|
)
|
|
17687
17875
|
}))
|
|
17688
17876
|
);
|
|
@@ -17705,7 +17893,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
17705
17893
|
if (producer && targets.some((value) => value.name === producer))
|
|
17706
17894
|
producers2.add(producer);
|
|
17707
17895
|
const local = [
|
|
17708
|
-
|
|
17896
|
+
path13.posix.join(path13.posix.dirname(file), include2),
|
|
17709
17897
|
`${includes}${include2}`
|
|
17710
17898
|
].find((candidate) => input.files[candidate] !== void 0);
|
|
17711
17899
|
if (local) {
|
|
@@ -17735,16 +17923,16 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
17735
17923
|
const headers = settings.headers;
|
|
17736
17924
|
const roots2 = settings.bridgingHeader ? [settings.bridgingHeader] : settings.publicHeaders;
|
|
17737
17925
|
for (const file of headers) {
|
|
17738
|
-
const destination =
|
|
17739
|
-
mkdirSync2(
|
|
17926
|
+
const destination = path13.join(layout.root, file);
|
|
17927
|
+
mkdirSync2(path13.dirname(destination), { recursive: true });
|
|
17740
17928
|
writeFileSync3(destination, input.files[file]);
|
|
17741
17929
|
}
|
|
17742
17930
|
const search = [.../* @__PURE__ */ new Set([...settings?.headerSearchPaths ?? []])].flatMap(
|
|
17743
|
-
(dir) => ["-I",
|
|
17931
|
+
(dir) => ["-I", path13.join(layout.root, dir)]
|
|
17744
17932
|
);
|
|
17745
17933
|
const toolchainBin = nativeToolchain();
|
|
17746
17934
|
const sdkHeaders = materializeObjcSdk(
|
|
17747
|
-
|
|
17935
|
+
path13.join(layout.root, ".build", "peach-objc-sdk")
|
|
17748
17936
|
);
|
|
17749
17937
|
const stageFlags = (flags2, sdkInclude) => flags2.map(
|
|
17750
17938
|
(flag) => flag.replaceAll(SWIFT_NATIVE_INPUT_ROOT, layout.root).replaceAll(SWIFT_NATIVE_SDK_INCLUDE, sdkInclude)
|
|
@@ -17755,16 +17943,16 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
17755
17943
|
...search,
|
|
17756
17944
|
...(settings?.frameworkSearchPaths ?? []).flatMap((dir) => [
|
|
17757
17945
|
"-F",
|
|
17758
|
-
|
|
17946
|
+
path13.join(layout.root, dir)
|
|
17759
17947
|
]),
|
|
17760
17948
|
"-I",
|
|
17761
17949
|
headerDirectory
|
|
17762
17950
|
];
|
|
17763
17951
|
const flags = stageFlags(
|
|
17764
17952
|
originalFlags,
|
|
17765
|
-
|
|
17953
|
+
path13.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
|
|
17766
17954
|
);
|
|
17767
|
-
const prefixHeader = settings?.prefixHeader ? ["-include",
|
|
17955
|
+
const prefixHeader = settings?.prefixHeader ? ["-include", path13.join(layout.root, settings.prefixHeader)] : [];
|
|
17768
17956
|
const bundleName = entries.some(([file]) => file.endsWith(".swift")) ? void 0 : swiftObjCResourceBundleName({
|
|
17769
17957
|
target: target.name,
|
|
17770
17958
|
path: target.path,
|
|
@@ -17775,7 +17963,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
17775
17963
|
bundles: input.resourceBundles
|
|
17776
17964
|
});
|
|
17777
17965
|
const accessor = bundleName === void 0 ? void 0 : swiftObjCResourceAccessor(bundleName);
|
|
17778
|
-
const accessorHeader =
|
|
17966
|
+
const accessorHeader = path13.join(
|
|
17779
17967
|
layout.root,
|
|
17780
17968
|
target.path,
|
|
17781
17969
|
OBJC_RESOURCE_ACCESSOR_HEADER
|
|
@@ -17786,23 +17974,23 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
17786
17974
|
const nativeUnits = accessor ? [...units, [accessorUnit, accessor.body]] : units;
|
|
17787
17975
|
const unitSource = (file) => {
|
|
17788
17976
|
const relative = file.slice(prefix.length);
|
|
17789
|
-
return relative.split("/").some((part) => part.startsWith(".")) ?
|
|
17977
|
+
return relative.split("/").some((part) => part.startsWith(".")) ? path13.posix.join(HIDDEN_UNITS, relative.replaceAll(/(^|\/)\./g, "$1%2E")) : relative;
|
|
17790
17978
|
};
|
|
17791
17979
|
const accessorFlags = accessor ? ["-include", accessorHeader] : [];
|
|
17792
17980
|
let nativeC = !roots2.length && !entries.some(([file]) => file.endsWith(".swift")) && !units.some(([file]) => /\.mm?$/.test(file));
|
|
17793
17981
|
if (roots2.length) {
|
|
17794
|
-
const sourceHeaders =
|
|
17982
|
+
const sourceHeaders = path13.join(
|
|
17795
17983
|
layout.root,
|
|
17796
17984
|
".build",
|
|
17797
17985
|
"peach-objc-originals",
|
|
17798
17986
|
target.name
|
|
17799
17987
|
);
|
|
17800
17988
|
mkdirSync2(sourceHeaders, { recursive: true });
|
|
17801
|
-
const modulemap =
|
|
17989
|
+
const modulemap = path13.join(sourceHeaders, "module.modulemap");
|
|
17802
17990
|
writeFileSync3(
|
|
17803
17991
|
modulemap,
|
|
17804
17992
|
`module ${swiftTargetModuleName(target.name)} {
|
|
17805
|
-
${roots2.map((file) => `header ${JSON.stringify(
|
|
17993
|
+
${roots2.map((file) => `header ${JSON.stringify(path13.join(layout.root, file))}`).join("\n")}
|
|
17806
17994
|
export *
|
|
17807
17995
|
}
|
|
17808
17996
|
`
|
|
@@ -17814,11 +18002,11 @@ export *
|
|
|
17814
18002
|
modulemap
|
|
17815
18003
|
},
|
|
17816
18004
|
toolchainBin,
|
|
17817
|
-
|
|
17818
|
-
|
|
17819
|
-
|
|
18005
|
+
path13.join(moduleRoot, "ios-simulator-stdlib"),
|
|
18006
|
+
path13.join(layout.root, ".build", "peach-objc-sdk"),
|
|
18007
|
+
path13.join(layout.root, ".build", "peach-objc-imports", target.name),
|
|
17820
18008
|
{
|
|
17821
|
-
flags: stageFlags(originalFlags,
|
|
18009
|
+
flags: stageFlags(originalFlags, path13.join(sdkHeaders, "usr/include")),
|
|
17822
18010
|
target: `arm64-apple-ios${deploymentTarget(target.name)}-simulator`
|
|
17823
18011
|
}
|
|
17824
18012
|
);
|
|
@@ -17837,7 +18025,7 @@ export *
|
|
|
17837
18025
|
if (Array.isArray(children)) for (const child of children) declarations(child);
|
|
17838
18026
|
};
|
|
17839
18027
|
declarations(view.clangAST);
|
|
17840
|
-
nativeC = !
|
|
18028
|
+
nativeC = !objcDeclarations && view.graphs.every(
|
|
17841
18029
|
(graph) => graph.symbols.every(
|
|
17842
18030
|
(symbol) => !symbol.identifier.precise.includes("c:objc(") && !(symbol.declarationFragments ?? []).some(
|
|
17843
18031
|
(fragment) => fragment.preciseIdentifier?.includes("c:objc(")
|
|
@@ -17857,7 +18045,7 @@ export *
|
|
|
17857
18045
|
imports.set(target.name, {
|
|
17858
18046
|
view,
|
|
17859
18047
|
classes: [...foreignTypes.values()],
|
|
17860
|
-
headers: roots2.map((file) =>
|
|
18048
|
+
headers: roots2.map((file) => path13.join(layout.root, file)),
|
|
17861
18049
|
foreignTypes
|
|
17862
18050
|
});
|
|
17863
18051
|
}
|
|
@@ -17866,29 +18054,29 @@ export *
|
|
|
17866
18054
|
for (const [file, contents] of nativeUnits) {
|
|
17867
18055
|
const origin = settings?.sourceDirectories[file];
|
|
17868
18056
|
if (origin) {
|
|
17869
|
-
const original =
|
|
17870
|
-
mkdirSync2(
|
|
18057
|
+
const original = path13.join(layout.root, origin, path13.posix.basename(file));
|
|
18058
|
+
mkdirSync2(path13.dirname(original), { recursive: true });
|
|
17871
18059
|
stageTargetFile(target.name, original, contents, { allowExisting: true });
|
|
17872
18060
|
}
|
|
17873
18061
|
const source = unitSource(file);
|
|
17874
18062
|
if (source !== file.slice(prefix.length))
|
|
17875
18063
|
stageTargetFile(
|
|
17876
18064
|
target.name,
|
|
17877
|
-
|
|
18065
|
+
path13.join(layout.root, target.path, source),
|
|
17878
18066
|
contents,
|
|
17879
18067
|
{
|
|
17880
18068
|
allowExisting: true
|
|
17881
18069
|
}
|
|
17882
18070
|
);
|
|
17883
18071
|
const perFile = [
|
|
17884
|
-
...origin ? ["-iquote",
|
|
18072
|
+
...origin ? ["-iquote", path13.join(layout.root, origin)] : [],
|
|
17885
18073
|
...stageFlags(
|
|
17886
18074
|
settings?.fileFlags[file] ?? [],
|
|
17887
|
-
|
|
18075
|
+
path13.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
|
|
17888
18076
|
)
|
|
17889
18077
|
];
|
|
17890
18078
|
const cxx = /\.(?:cc|cpp|cxx|mm)$/.test(file);
|
|
17891
|
-
const identity =
|
|
18079
|
+
const identity = createHash10("sha256").update(
|
|
17892
18080
|
JSON.stringify([
|
|
17893
18081
|
cxx,
|
|
17894
18082
|
perFile,
|
|
@@ -17905,7 +18093,7 @@ export *
|
|
|
17905
18093
|
...accessorFlags,
|
|
17906
18094
|
...stageFlags(
|
|
17907
18095
|
cxx ? settings.cxxFlags : [],
|
|
17908
|
-
|
|
18096
|
+
path13.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
|
|
17909
18097
|
),
|
|
17910
18098
|
...perFile
|
|
17911
18099
|
]
|
|
@@ -17920,12 +18108,12 @@ export *
|
|
|
17920
18108
|
flags: [...flags, "-fobjc-arc"],
|
|
17921
18109
|
cxxFlags: [...flags, "-fobjc-arc"]
|
|
17922
18110
|
});
|
|
17923
|
-
const include2 =
|
|
18111
|
+
const include2 = path13.join(layout.root, target.path, "include");
|
|
17924
18112
|
if (accessor) {
|
|
17925
18113
|
stageTargetFile(target.name, accessorHeader, accessor.header);
|
|
17926
18114
|
stageTargetFile(
|
|
17927
18115
|
target.name,
|
|
17928
|
-
|
|
18116
|
+
path13.join(layout.root, accessorUnit),
|
|
17929
18117
|
accessor.body
|
|
17930
18118
|
);
|
|
17931
18119
|
}
|
|
@@ -17954,6 +18142,42 @@ export *
|
|
|
17954
18142
|
});
|
|
17955
18143
|
continue;
|
|
17956
18144
|
}
|
|
18145
|
+
if (nativeC && entries.some(([file]) => file.endsWith(".swift"))) {
|
|
18146
|
+
const modulemaps = Object.entries(settings.productHeaders).filter(
|
|
18147
|
+
([product2]) => product2.endsWith(".modulemap")
|
|
18148
|
+
);
|
|
18149
|
+
if (modulemaps.length !== 1)
|
|
18150
|
+
throw new Error(`target ${target.name} requires one original module map`);
|
|
18151
|
+
const [product, original] = modulemaps[0];
|
|
18152
|
+
const contents = input.files[original];
|
|
18153
|
+
if (contents === void 0)
|
|
18154
|
+
throw new Error(`missing original module map ${original}`);
|
|
18155
|
+
stageTargetFile(target.name, path13.join(layout.root, product), contents, {
|
|
18156
|
+
allowExisting: true
|
|
18157
|
+
});
|
|
18158
|
+
const include3 = path13.join(layout.root, target.path, "include");
|
|
18159
|
+
stageTargetFile(
|
|
18160
|
+
target.name,
|
|
18161
|
+
path13.join(include3, "module.modulemap"),
|
|
18162
|
+
`module ${target.name}ImplementationDeclarations { export * }
|
|
18163
|
+
`
|
|
18164
|
+
);
|
|
18165
|
+
native.set(target.name, {
|
|
18166
|
+
mixed: true,
|
|
18167
|
+
path: target.path,
|
|
18168
|
+
includeDirectory: include3,
|
|
18169
|
+
sources: nativeUnits.map(([file]) => unitSource(file)),
|
|
18170
|
+
lateSources: nativeUnits.map(([file]) => unitSource(file)),
|
|
18171
|
+
exclude: entries.filter(([file]) => !file.endsWith(".swift") && !file.endsWith(".metal")).map(([file]) => file.slice(prefix.length)).concat("include"),
|
|
18172
|
+
underlying: { modulemap: path13.join(layout.root, product), flags },
|
|
18173
|
+
groups: [...groups.values()],
|
|
18174
|
+
late: {
|
|
18175
|
+
name: `${target.name}SwiftImplementation`,
|
|
18176
|
+
producers: nativeUnits.some(([file]) => /\.mm?$/.test(file)) ? [target.name] : []
|
|
18177
|
+
}
|
|
18178
|
+
});
|
|
18179
|
+
continue;
|
|
18180
|
+
}
|
|
17957
18181
|
if (nativeC) {
|
|
17958
18182
|
const modulemaps = Object.entries(settings.productHeaders).filter(
|
|
17959
18183
|
([product2]) => product2.endsWith("/Modules/module.modulemap")
|
|
@@ -17964,12 +18188,12 @@ export *
|
|
|
17964
18188
|
const contents = input.files[original];
|
|
17965
18189
|
if (contents === void 0)
|
|
17966
18190
|
throw new Error(`missing original module map ${original}`);
|
|
17967
|
-
stageTargetFile(target.name,
|
|
18191
|
+
stageTargetFile(target.name, path13.join(layout.root, product), contents);
|
|
17968
18192
|
const [owner, ...implementations] = groups.values();
|
|
17969
18193
|
if (!owner) throw new Error(`target ${target.name} has no original units`);
|
|
17970
18194
|
native.set(target.name, {
|
|
17971
18195
|
path: target.path,
|
|
17972
|
-
includeDirectory:
|
|
18196
|
+
includeDirectory: path13.join(layout.root, path13.dirname(product)),
|
|
17973
18197
|
sources: nativeUnits.map(([file]) => unitSource(file)),
|
|
17974
18198
|
lateSources: implementations.flatMap((group) => group.sources),
|
|
17975
18199
|
exclude: [],
|
|
@@ -17990,7 +18214,7 @@ export *
|
|
|
17990
18214
|
}
|
|
17991
18215
|
stageTargetFile(
|
|
17992
18216
|
target.name,
|
|
17993
|
-
|
|
18217
|
+
path13.join(include2, "module.modulemap"),
|
|
17994
18218
|
`module ${target.name}ImplementationDeclarations { export * }
|
|
17995
18219
|
`
|
|
17996
18220
|
);
|
|
@@ -18026,7 +18250,7 @@ export *
|
|
|
18026
18250
|
}
|
|
18027
18251
|
native.set(target.name, {
|
|
18028
18252
|
path: target.path,
|
|
18029
|
-
includeDirectory:
|
|
18253
|
+
includeDirectory: path13.join(layout.root, includes),
|
|
18030
18254
|
sources: units.map(([file]) => file.slice(prefix.length)),
|
|
18031
18255
|
lateSources: late.map(([file]) => file.slice(prefix.length)),
|
|
18032
18256
|
...late.length > 0 ? {
|
|
@@ -18044,7 +18268,7 @@ export *
|
|
|
18044
18268
|
([file]) => file.startsWith(includes) && /\.(?:h|hpp|hh|hxx)$/.test(file) && consumers.get(file).size === 0
|
|
18045
18269
|
);
|
|
18046
18270
|
files.set(
|
|
18047
|
-
|
|
18271
|
+
path13.join(layout.root, includes, "module.modulemap"),
|
|
18048
18272
|
[
|
|
18049
18273
|
`module ${target.name} {`,
|
|
18050
18274
|
...roots.map(
|
|
@@ -18057,13 +18281,13 @@ export *
|
|
|
18057
18281
|
);
|
|
18058
18282
|
}
|
|
18059
18283
|
if (native.size > 0) mkdirSync2(headerDirectory, { recursive: true });
|
|
18060
|
-
const modulePlan =
|
|
18284
|
+
const modulePlan = createHash10("sha256").update(
|
|
18061
18285
|
swiftModuleInputFiles(moduleRoot).join("\n")
|
|
18062
18286
|
);
|
|
18063
18287
|
if (!distribution) {
|
|
18064
|
-
modulePlan.update(
|
|
18288
|
+
modulePlan.update(readFileSync7(path13.join(moduleRoot, "Package.swift")));
|
|
18065
18289
|
}
|
|
18066
|
-
const resourcePlan =
|
|
18290
|
+
const resourcePlan = createHash10("sha256").update(
|
|
18067
18291
|
JSON.stringify(
|
|
18068
18292
|
resourceTargets.filter((target) => target.resources).map((target) => [
|
|
18069
18293
|
target.name,
|
|
@@ -18124,7 +18348,11 @@ export *
|
|
|
18124
18348
|
continue;
|
|
18125
18349
|
}
|
|
18126
18350
|
const original = imports.get(name2);
|
|
18127
|
-
if (!exported && !original)
|
|
18351
|
+
if (!exported && !original) {
|
|
18352
|
+
if (native.get(name2)?.lateSources.some((file) => /\.mm?$/.test(file)))
|
|
18353
|
+
rootOwner ?? (rootOwner = targetEntries(target).find(([file]) => file.endsWith(".swift"))?.[0]);
|
|
18354
|
+
continue;
|
|
18355
|
+
}
|
|
18128
18356
|
let generated;
|
|
18129
18357
|
try {
|
|
18130
18358
|
generated = original && swiftObjCImports(original.view.graphs, {
|
|
@@ -18142,27 +18370,27 @@ export *
|
|
|
18142
18370
|
objcModules.add(name2);
|
|
18143
18371
|
rootOwner ?? (rootOwner = exported ? [...exported.swift.keys()][0] : `${prefix}PeachObjCImports.generated.swift`);
|
|
18144
18372
|
files.set(
|
|
18145
|
-
|
|
18373
|
+
path13.join(headerDirectory, `${name2}-Swift.h`),
|
|
18146
18374
|
exported?.header ?? "#pragma once\n"
|
|
18147
18375
|
);
|
|
18148
18376
|
files.set(
|
|
18149
|
-
|
|
18377
|
+
path13.join(headerDirectory, name2, `${name2}-Swift.h`),
|
|
18150
18378
|
`#include "../${name2}-Swift.h"
|
|
18151
18379
|
`
|
|
18152
18380
|
);
|
|
18153
18381
|
files.set(
|
|
18154
|
-
|
|
18382
|
+
path13.join(headerModuleDirectory, name2, "module.modulemap"),
|
|
18155
18383
|
`module ${swiftTargetModuleName(name2)} {
|
|
18156
18384
|
${[
|
|
18157
|
-
|
|
18158
|
-
...(input.nativeTargets?.find((target2) => target2.name === name2)?.publicHeaders ?? []).map((header) =>
|
|
18385
|
+
path13.join(headerDirectory, `${name2}-Swift.h`),
|
|
18386
|
+
...(input.nativeTargets?.find((target2) => target2.name === name2)?.publicHeaders ?? []).map((header) => path13.join(layout.root, header))
|
|
18159
18387
|
].map((header) => ` header ${JSON.stringify(header)}`).join("\n")}
|
|
18160
18388
|
export *
|
|
18161
18389
|
}
|
|
18162
18390
|
`
|
|
18163
18391
|
);
|
|
18164
18392
|
files.set(
|
|
18165
|
-
|
|
18393
|
+
path13.join(layout.root, "PeachObjCExports", `${name2}.m`),
|
|
18166
18394
|
exported?.implementation ?? `#include "${name2}-Cxx.h"
|
|
18167
18395
|
`
|
|
18168
18396
|
);
|
|
@@ -18174,13 +18402,13 @@ ${[
|
|
|
18174
18402
|
if (generated) {
|
|
18175
18403
|
const register = `_peach_objc_imports_${swiftTargetModuleName(name2)}`;
|
|
18176
18404
|
files.set(
|
|
18177
|
-
|
|
18405
|
+
path13.join(layout.root, target.path, "PeachObjCImports.generated.swift"),
|
|
18178
18406
|
generated.swift + generated.registration + `
|
|
18179
18407
|
@_cdecl("${register}") public func __peachRegisterOriginalObjC() { ${generated.registerFunction}() }
|
|
18180
18408
|
`
|
|
18181
18409
|
);
|
|
18182
18410
|
files.set(
|
|
18183
|
-
|
|
18411
|
+
path13.join(layout.root, target.path, "PeachObjCImports.generated.m"),
|
|
18184
18412
|
generated.objc
|
|
18185
18413
|
);
|
|
18186
18414
|
registrations.push(`${register}();`);
|
|
@@ -18238,7 +18466,7 @@ ${[
|
|
|
18238
18466
|
exclude: []
|
|
18239
18467
|
});
|
|
18240
18468
|
files.set(
|
|
18241
|
-
|
|
18469
|
+
path13.join(layout.root, `PeachApplication/${name2}/Entry.swift`),
|
|
18242
18470
|
`import ${swiftTargetModuleName(target.name)}
|
|
18243
18471
|
@main struct __PeachApplicationEntry { @MainActor static func main() { __peachRunApplication() } }
|
|
18244
18472
|
`
|
|
@@ -18246,9 +18474,9 @@ ${[
|
|
|
18246
18474
|
}
|
|
18247
18475
|
const nativeFlags = (() => {
|
|
18248
18476
|
if (native.size === 0) return void 0;
|
|
18249
|
-
const headers = materializeObjcSdk(
|
|
18477
|
+
const headers = materializeObjcSdk(path13.join(layout.root, ".build", "peach-objc-sdk"));
|
|
18250
18478
|
const moduleMaps = rootOwner ? [...objcModules].map(
|
|
18251
|
-
(name2) => `-fmodule-map-file=${
|
|
18479
|
+
(name2) => `-fmodule-map-file=${path13.join(headerModuleDirectory, name2, "module.modulemap")}`
|
|
18252
18480
|
) : [];
|
|
18253
18481
|
return new Map(
|
|
18254
18482
|
targets.map((target) => {
|
|
@@ -18265,6 +18493,8 @@ ${[
|
|
|
18265
18493
|
"-fobjc-exceptions",
|
|
18266
18494
|
"-fexceptions",
|
|
18267
18495
|
"-fwasm-exceptions",
|
|
18496
|
+
"-mllvm",
|
|
18497
|
+
"-wasm-enable-sjlj",
|
|
18268
18498
|
"-fobjc-arc",
|
|
18269
18499
|
"-fblocks",
|
|
18270
18500
|
...objcSdkIntakeFlags(headers, nativeToolchain(), minimum),
|
|
@@ -18291,7 +18521,7 @@ ${[
|
|
|
18291
18521
|
throw new Error(
|
|
18292
18522
|
"Swift Objective-C export target conflicts with application sources"
|
|
18293
18523
|
);
|
|
18294
|
-
const ownerFile =
|
|
18524
|
+
const ownerFile = path13.join(layout.root, rootOwner);
|
|
18295
18525
|
const ownerSource = compiled.get(rootOwner) ?? files.get(ownerFile);
|
|
18296
18526
|
if (typeof ownerSource !== "string")
|
|
18297
18527
|
throw new Error("Objective-C root registration has no owning Swift source");
|
|
@@ -18308,11 +18538,11 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
|
|
|
18308
18538
|
);
|
|
18309
18539
|
if (compiled.has(rootOwner)) compiled.set(rootOwner, files.get(ownerFile).toString());
|
|
18310
18540
|
files.set(
|
|
18311
|
-
|
|
18541
|
+
path13.join(layout.root, "PeachObjCExports", "include", "module.modulemap"),
|
|
18312
18542
|
"module PeachSwiftObjCExports { export * }\n"
|
|
18313
18543
|
);
|
|
18314
18544
|
files.set(
|
|
18315
|
-
|
|
18545
|
+
path13.join(layout.root, "PeachObjCExports", "root.m"),
|
|
18316
18546
|
[
|
|
18317
18547
|
"#import <Foundation/Foundation.h>",
|
|
18318
18548
|
"extern void _peach_objc_ensure_exports(void);",
|
|
@@ -18339,10 +18569,10 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
|
|
|
18339
18569
|
if (targets.length === 0) {
|
|
18340
18570
|
for (const [file, contents] of Object.entries(input.files)) {
|
|
18341
18571
|
if (file === "Package.swift") continue;
|
|
18342
|
-
files.set(
|
|
18572
|
+
files.set(path13.join(layout.sources, file), compiled.get(file) ?? contents);
|
|
18343
18573
|
}
|
|
18344
|
-
let manifest =
|
|
18345
|
-
|
|
18574
|
+
let manifest = readFileSync7(
|
|
18575
|
+
path13.join(moduleRoot, "scripts/contrast-app-Package.swift"),
|
|
18346
18576
|
"utf8"
|
|
18347
18577
|
).replaceAll("__SOOTSIM_SWIFT_PACKAGE__", moduleRoot);
|
|
18348
18578
|
const reactor = ` ${REACTOR_FLAG}`;
|
|
@@ -18350,7 +18580,7 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
|
|
|
18350
18580
|
throw new Error(
|
|
18351
18581
|
"scripts/contrast-app-Package.swift lost the executable linker line"
|
|
18352
18582
|
);
|
|
18353
|
-
manifest = manifest.replace(reactor, `${reactor}${
|
|
18583
|
+
manifest = manifest.replace(reactor, `${reactor}${executableLinkFlags(layout.root)}`);
|
|
18354
18584
|
const optionalProducts = swiftTargetDependencies(input.files, [{ name: "App", path: "." }]).get("App") ?? [];
|
|
18355
18585
|
if (optionalProducts.length > 0) {
|
|
18356
18586
|
const product = '.product(name: "SwiftUI", package: "sootsim-swift"),';
|
|
@@ -18386,22 +18616,23 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
|
|
|
18386
18616
|
manifest = manifest.replace(anchor, `${anchor}
|
|
18387
18617
|
${SPRITEKIT_PRODUCT},`);
|
|
18388
18618
|
}
|
|
18389
|
-
files.set(
|
|
18619
|
+
files.set(path13.join(layout.root, "Package.swift"), manifest + moduleFiles);
|
|
18390
18620
|
} else {
|
|
18391
18621
|
const base = layout.multi ? layout.root : layout.sources;
|
|
18392
18622
|
const libraries = /* @__PURE__ */ new Map();
|
|
18393
18623
|
for (const [target, data] of Object.entries(input.libraries ?? {})) {
|
|
18394
|
-
const file =
|
|
18624
|
+
const file = path13.join(layout.root, ".peach-libraries", `lib${target}.a`);
|
|
18395
18625
|
files.set(file, Buffer.from(data, "base64"));
|
|
18396
18626
|
libraries.set(target, file);
|
|
18397
18627
|
}
|
|
18398
18628
|
for (const [file, contents] of Object.entries(input.files)) {
|
|
18399
18629
|
if (file === "Package.swift") continue;
|
|
18400
|
-
files.set(
|
|
18630
|
+
files.set(path13.join(base, file), compiled.get(file) ?? contents);
|
|
18401
18631
|
}
|
|
18402
18632
|
files.set(
|
|
18403
|
-
|
|
18633
|
+
path13.join(layout.root, "Package.swift"),
|
|
18404
18634
|
emitSwiftPackageManifest({
|
|
18635
|
+
root: layout.root,
|
|
18405
18636
|
targets,
|
|
18406
18637
|
packages,
|
|
18407
18638
|
native,
|
|
@@ -18420,7 +18651,7 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
|
|
|
18420
18651
|
spriteKit: importsSpriteKit(input.files),
|
|
18421
18652
|
distribution: distribution ?? void 0,
|
|
18422
18653
|
distributionLink: {
|
|
18423
|
-
path:
|
|
18654
|
+
path: path13.join(layout.root, ".peach-distribution-objects.rsp"),
|
|
18424
18655
|
files
|
|
18425
18656
|
},
|
|
18426
18657
|
libraries
|
|
@@ -18428,16 +18659,16 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
|
|
|
18428
18659
|
);
|
|
18429
18660
|
}
|
|
18430
18661
|
for (const [file, bytes] of Object.entries(input.packageFiles ?? {}))
|
|
18431
|
-
files.set(
|
|
18662
|
+
files.set(path13.join(layout.root, file), Buffer.from(bytes, "base64"));
|
|
18432
18663
|
if (input.packageFiles) {
|
|
18433
18664
|
files.set(
|
|
18434
|
-
|
|
18665
|
+
path13.join(layout.root, ".peach-target-toolset.json"),
|
|
18435
18666
|
JSON.stringify({
|
|
18436
18667
|
schemaVersion: "1.0",
|
|
18437
18668
|
swiftCompiler: {
|
|
18438
18669
|
extraCLIOptions: [
|
|
18439
18670
|
"-I",
|
|
18440
|
-
distribution ?
|
|
18671
|
+
distribution ? path13.join(moduleRoot, "modules") : path13.join(layout.root, ".build", WASM_TRIPLE, "release", "Modules"),
|
|
18441
18672
|
"-Xfrontend",
|
|
18442
18673
|
"-enable-cross-import-overlays",
|
|
18443
18674
|
...swiftCrossImportFlags(moduleRoot, Boolean(distribution)),
|
|
@@ -18461,9 +18692,9 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
|
|
|
18461
18692
|
throw new Error(
|
|
18462
18693
|
`swift resource target ${target.name} has no matching bundle assignment`
|
|
18463
18694
|
);
|
|
18464
|
-
const directory = layout.multi ?
|
|
18695
|
+
const directory = layout.multi ? path13.join(layout.root, target.path) : layout.sources;
|
|
18465
18696
|
files.set(
|
|
18466
|
-
|
|
18697
|
+
path13.join(directory, "ResourceBundleAccessor.generated.swift"),
|
|
18467
18698
|
[
|
|
18468
18699
|
"import Foundation",
|
|
18469
18700
|
"",
|
|
@@ -18480,7 +18711,7 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
|
|
|
18480
18711
|
}
|
|
18481
18712
|
for (const [file, source] of compiled)
|
|
18482
18713
|
if (!Object.hasOwn(input.files, file))
|
|
18483
|
-
files.set(
|
|
18714
|
+
files.set(path13.join(layout.multi ? layout.root : layout.sources, file), source);
|
|
18484
18715
|
syncSwiftTree(layout.root, files);
|
|
18485
18716
|
const producers = [
|
|
18486
18717
|
.../* @__PURE__ */ new Set([
|
|
@@ -18502,10 +18733,10 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
|
|
|
18502
18733
|
targetFailures,
|
|
18503
18734
|
...rootOwner && objcExports ? {
|
|
18504
18735
|
objcImplementations: {
|
|
18505
|
-
owner:
|
|
18736
|
+
owner: path13.join(layout.root, rootOwner),
|
|
18506
18737
|
registeredClasses: [...registeredClasses],
|
|
18507
18738
|
units: [...native.values()].flatMap(
|
|
18508
|
-
(value) => value.sources.filter((file) => /\.mm?$/.test(file)).map((file) =>
|
|
18739
|
+
(value) => value.sources.filter((file) => /\.mm?$/.test(file)).map((file) => path13.join(layout.root, value.path, file))
|
|
18509
18740
|
)
|
|
18510
18741
|
}
|
|
18511
18742
|
} : {}
|
|
@@ -18527,15 +18758,15 @@ function outputOf(error) {
|
|
|
18527
18758
|
return error instanceof Error ? error.message : String(error);
|
|
18528
18759
|
}
|
|
18529
18760
|
function builtArtifact(layout) {
|
|
18530
|
-
const binDir =
|
|
18531
|
-
const manifest =
|
|
18761
|
+
const binDir = path13.join(layout.root, ".build", WASM_TRIPLE, "release");
|
|
18762
|
+
const manifest = readFileSync7(path13.join(layout.root, "Package.swift"), "utf8");
|
|
18532
18763
|
const executable = swiftManifestTargets(manifest).find((target) => target.executable);
|
|
18533
18764
|
if (executable === void 0) {
|
|
18534
18765
|
throw new Error("swift-compile: the written manifest names no executable target");
|
|
18535
18766
|
}
|
|
18536
|
-
const file =
|
|
18537
|
-
if (!
|
|
18538
|
-
const found =
|
|
18767
|
+
const file = path13.join(binDir, `${executable.name}.wasm`);
|
|
18768
|
+
if (!existsSync3(file)) {
|
|
18769
|
+
const found = existsSync3(binDir) ? readdirSync4(binDir).filter((name2) => name2.endsWith(".wasm")).sort() : [];
|
|
18539
18770
|
throw new Error(
|
|
18540
18771
|
`swift-compile: the build produced no ${executable.name}.wasm (found: ${found.join(", ") || "none"})`
|
|
18541
18772
|
);
|
|
@@ -18544,7 +18775,7 @@ function builtArtifact(layout) {
|
|
|
18544
18775
|
}
|
|
18545
18776
|
function projectDiagnostic(output, layout, files) {
|
|
18546
18777
|
const base = layout.multi ? layout.root : layout.sources;
|
|
18547
|
-
const prefix = `${base}${
|
|
18778
|
+
const prefix = `${base}${path13.sep}`;
|
|
18548
18779
|
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();
|
|
18549
18780
|
}
|
|
18550
18781
|
var ROOT_LOCKS = Symbol.for("peachsim.swiftCompile.rootLocks");
|
|
@@ -18580,13 +18811,13 @@ function serialize(root, work, signal) {
|
|
|
18580
18811
|
function readCompiledArtifact(directory, hash2) {
|
|
18581
18812
|
try {
|
|
18582
18813
|
const receipt = JSON.parse(
|
|
18583
|
-
|
|
18814
|
+
readFileSync7(path13.join(directory, "artifact.json"), "utf8")
|
|
18584
18815
|
);
|
|
18585
18816
|
if (!receipt || typeof receipt !== "object" || !("hash" in receipt) || receipt.hash !== hash2 || !("icu" in receipt) || typeof receipt.icu !== "string" || !("wasm" in receipt) || typeof receipt.wasm !== "string")
|
|
18586
18817
|
return null;
|
|
18587
|
-
const bytes =
|
|
18588
|
-
const gzip2 =
|
|
18589
|
-
if (
|
|
18818
|
+
const bytes = readFileSync7(path13.join(directory, "app.wasm"));
|
|
18819
|
+
const gzip2 = readFileSync7(path13.join(directory, "icu.gz"));
|
|
18820
|
+
if (createHash10("sha256").update(bytes).digest("hex") !== receipt.wasm || createHash10("sha256").update(gzip2).digest("hex") !== receipt.icu || bytes.length < 8 || bytes.readUInt32LE(0) !== 1836278016 || bytes.readUInt32LE(4) !== 1)
|
|
18590
18821
|
return null;
|
|
18591
18822
|
return { hash: hash2, bytes, icu: { sha256: receipt.icu, gzip: gzip2 } };
|
|
18592
18823
|
} catch (error) {
|
|
@@ -18596,22 +18827,22 @@ function readCompiledArtifact(directory, hash2) {
|
|
|
18596
18827
|
}
|
|
18597
18828
|
}
|
|
18598
18829
|
function saveCompiledArtifact(root, artifact) {
|
|
18599
|
-
const directory =
|
|
18830
|
+
const directory = path13.join(root, "artifact");
|
|
18600
18831
|
mkdirSync2(directory, { recursive: true });
|
|
18601
|
-
const pending = mkdtempSync2(
|
|
18832
|
+
const pending = mkdtempSync2(path13.join(root, ".artifact-"));
|
|
18602
18833
|
try {
|
|
18603
|
-
writeFileSync3(
|
|
18604
|
-
writeFileSync3(
|
|
18834
|
+
writeFileSync3(path13.join(pending, "app.wasm"), artifact.bytes);
|
|
18835
|
+
writeFileSync3(path13.join(pending, "icu.gz"), artifact.icu.gzip);
|
|
18605
18836
|
writeFileSync3(
|
|
18606
|
-
|
|
18837
|
+
path13.join(pending, "artifact.json"),
|
|
18607
18838
|
JSON.stringify({
|
|
18608
18839
|
hash: artifact.hash,
|
|
18609
|
-
wasm:
|
|
18840
|
+
wasm: createHash10("sha256").update(artifact.bytes).digest("hex"),
|
|
18610
18841
|
icu: artifact.icu.sha256
|
|
18611
18842
|
})
|
|
18612
18843
|
);
|
|
18613
18844
|
for (const file of ["app.wasm", "icu.gz", "artifact.json"]) {
|
|
18614
|
-
renameSync(
|
|
18845
|
+
renameSync(path13.join(pending, file), path13.join(directory, file));
|
|
18615
18846
|
}
|
|
18616
18847
|
} finally {
|
|
18617
18848
|
rmSync3(pending, { recursive: true, force: true });
|
|
@@ -18633,16 +18864,16 @@ function renewSharedArtifact(sharedRoot) {
|
|
|
18633
18864
|
function pruneSharedArtifacts(parent, keep) {
|
|
18634
18865
|
const entries = [];
|
|
18635
18866
|
for (const name2 of readdirSync4(parent)) {
|
|
18636
|
-
const directory =
|
|
18867
|
+
const directory = path13.join(parent, name2);
|
|
18637
18868
|
if (name2.startsWith(RETIRED_PREFIX)) {
|
|
18638
18869
|
rmSync3(directory, { recursive: true, force: true });
|
|
18639
18870
|
continue;
|
|
18640
18871
|
}
|
|
18641
18872
|
try {
|
|
18642
18873
|
let bytes = 0;
|
|
18643
|
-
for (const file of readdirSync4(
|
|
18874
|
+
for (const file of readdirSync4(path13.join(directory, "artifact"))) {
|
|
18644
18875
|
try {
|
|
18645
|
-
bytes += statSync(
|
|
18876
|
+
bytes += statSync(path13.join(directory, "artifact", file)).size;
|
|
18646
18877
|
} catch (error) {
|
|
18647
18878
|
if (!vanished(error)) throw error;
|
|
18648
18879
|
}
|
|
@@ -18657,9 +18888,9 @@ function pruneSharedArtifacts(parent, keep) {
|
|
|
18657
18888
|
if (total <= SHARED_ARTIFACT_BUDGET_BYTES) break;
|
|
18658
18889
|
if (entry.directory === keep || Date.now() - entry.used < SHARED_ARTIFACT_GRACE_MS)
|
|
18659
18890
|
continue;
|
|
18660
|
-
const retired =
|
|
18891
|
+
const retired = path13.join(
|
|
18661
18892
|
parent,
|
|
18662
|
-
`${RETIRED_PREFIX}${process.pid}-${
|
|
18893
|
+
`${RETIRED_PREFIX}${process.pid}-${path13.basename(entry.directory)}`
|
|
18663
18894
|
);
|
|
18664
18895
|
try {
|
|
18665
18896
|
if (statSync(entry.directory).mtimeMs !== entry.used) continue;
|
|
@@ -18675,7 +18906,7 @@ function pruneSharedArtifacts(parent, keep) {
|
|
|
18675
18906
|
function saveSharedArtifact(sharedRoot, artifact) {
|
|
18676
18907
|
saveCompiledArtifact(sharedRoot, artifact);
|
|
18677
18908
|
renewSharedArtifact(sharedRoot);
|
|
18678
|
-
pruneSharedArtifacts(
|
|
18909
|
+
pruneSharedArtifacts(path13.dirname(sharedRoot), sharedRoot);
|
|
18679
18910
|
}
|
|
18680
18911
|
var retainedArtifacts = /* @__PURE__ */ new Map();
|
|
18681
18912
|
function retain(root, artifact) {
|
|
@@ -18692,14 +18923,14 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
18692
18923
|
options.signal?.throwIfAborted();
|
|
18693
18924
|
mkdirSync2(options.buildRoot, { recursive: true });
|
|
18694
18925
|
const root = realpathSync(options.buildRoot);
|
|
18695
|
-
const moduleRoot =
|
|
18926
|
+
const moduleRoot = path13.resolve(options.moduleRoot);
|
|
18696
18927
|
const layout = {
|
|
18697
18928
|
root,
|
|
18698
|
-
sources:
|
|
18929
|
+
sources: path13.join(root, "Sources", "App"),
|
|
18699
18930
|
multi: compileTargets(input).length > 0
|
|
18700
18931
|
};
|
|
18701
18932
|
const hash2 = swiftArtifactHash(input, options.release, moduleRoot);
|
|
18702
|
-
const sharedRoot =
|
|
18933
|
+
const sharedRoot = path13.join(rnxHomeDir(), "cache", "swift-projects", hash2);
|
|
18703
18934
|
const report = (message) => {
|
|
18704
18935
|
console.error(`[swift-project ${hash2.slice(0, 16)}] ${message}`);
|
|
18705
18936
|
options.onStage?.(message);
|
|
@@ -18713,8 +18944,8 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
18713
18944
|
report("reusing memory artifact");
|
|
18714
18945
|
return retain(root, retained);
|
|
18715
18946
|
}
|
|
18716
|
-
const cached = readCompiledArtifact(
|
|
18717
|
-
const previous = cached ?? readCompiledArtifact(
|
|
18947
|
+
const cached = readCompiledArtifact(path13.join(sharedRoot, "artifact"), hash2);
|
|
18948
|
+
const previous = cached ?? readCompiledArtifact(path13.join(root, "artifact"), hash2);
|
|
18718
18949
|
if (previous) {
|
|
18719
18950
|
if (cached) renewSharedArtifact(sharedRoot);
|
|
18720
18951
|
else saveSharedArtifact(sharedRoot, previous);
|
|
@@ -18723,8 +18954,8 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
18723
18954
|
}
|
|
18724
18955
|
if (process.platform === "darwin" && process.env.TM_SESSION && !admittedMacBuilderSlot() && process.env.CI !== "true" && moduleRoot === sourceSwiftCheckout() && !swiftDistributionAt(moduleRoot)) {
|
|
18725
18956
|
const requestRoot = mkdtempSync2(`${root}.builder-request-`);
|
|
18726
|
-
const output =
|
|
18727
|
-
const request =
|
|
18957
|
+
const output = path13.join(requestRoot, "output");
|
|
18958
|
+
const request = path13.join(requestRoot, "request.json");
|
|
18728
18959
|
writeFileSync3(
|
|
18729
18960
|
request,
|
|
18730
18961
|
JSON.stringify({
|
|
@@ -18738,12 +18969,12 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
18738
18969
|
})
|
|
18739
18970
|
);
|
|
18740
18971
|
try {
|
|
18741
|
-
const repo =
|
|
18972
|
+
const repo = path13.resolve(moduleRoot, "../..");
|
|
18742
18973
|
report("requesting builder admission or cached result");
|
|
18743
18974
|
await runCompiler(
|
|
18744
18975
|
"bun",
|
|
18745
18976
|
[
|
|
18746
|
-
|
|
18977
|
+
path13.join(repo, "scripts/build/swift-project.ts"),
|
|
18747
18978
|
"--request",
|
|
18748
18979
|
request,
|
|
18749
18980
|
"--output",
|
|
@@ -18777,7 +19008,7 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
18777
19008
|
return withSwiftRootLock(
|
|
18778
19009
|
root,
|
|
18779
19010
|
async (lease) => {
|
|
18780
|
-
const built = readCompiledArtifact(
|
|
19011
|
+
const built = readCompiledArtifact(path13.join(sharedRoot, "artifact"), hash2);
|
|
18781
19012
|
if (built) {
|
|
18782
19013
|
report("reusing verified disk artifact");
|
|
18783
19014
|
return retain(root, built);
|
|
@@ -18786,8 +19017,8 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
18786
19017
|
const unprepared = preparation.targetFailures.map(
|
|
18787
19018
|
(failure) => `error: target ${failure}`
|
|
18788
19019
|
);
|
|
18789
|
-
const swift =
|
|
18790
|
-
if (!
|
|
19020
|
+
const swift = path13.join(options.toolchainBin, "swift");
|
|
19021
|
+
if (!existsSync3(swift)) {
|
|
18791
19022
|
throw new Error(
|
|
18792
19023
|
`swift-compile: no swift.org toolchain at ${options.toolchainBin}; install ${options.release} and its matching wasm sdk`
|
|
18793
19024
|
);
|
|
@@ -18801,6 +19032,7 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
18801
19032
|
);
|
|
18802
19033
|
const sdk = swiftModuleSdk(moduleRoot).wasmSdkId;
|
|
18803
19034
|
const icu = swiftIcuAsset(options.toolchainBin, sdk);
|
|
19035
|
+
writeSwiftAutolinkLinker(root, options.toolchainBin);
|
|
18804
19036
|
const buildArgs = [
|
|
18805
19037
|
"build",
|
|
18806
19038
|
...swiftPackageCacheOptions(),
|
|
@@ -18813,7 +19045,7 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
18813
19045
|
...swiftSdkOptions(),
|
|
18814
19046
|
"--swift-sdk",
|
|
18815
19047
|
sdk,
|
|
18816
|
-
...input.packageFiles ? ["--toolset",
|
|
19048
|
+
...input.packageFiles ? ["--toolset", path13.join(root, ".peach-target-toolset.json")] : [],
|
|
18817
19049
|
"-c",
|
|
18818
19050
|
"release",
|
|
18819
19051
|
"-Xswiftc",
|
|
@@ -18822,11 +19054,17 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
18822
19054
|
"-num-threads",
|
|
18823
19055
|
"-Xswiftc",
|
|
18824
19056
|
BUILD_JOBS,
|
|
18825
|
-
...macroPlugins.flatMap((plugin) => [
|
|
19057
|
+
...macroPlugins.libraries.flatMap((plugin) => [
|
|
18826
19058
|
"-Xswiftc",
|
|
18827
19059
|
"-load-plugin-library",
|
|
18828
19060
|
"-Xswiftc",
|
|
18829
19061
|
plugin
|
|
19062
|
+
]),
|
|
19063
|
+
...macroPlugins.executables.flatMap((plugin) => [
|
|
19064
|
+
"-Xswiftc",
|
|
19065
|
+
"-load-plugin-executable",
|
|
19066
|
+
"-Xswiftc",
|
|
19067
|
+
`${plugin}#ExpoModulesMacros`
|
|
18830
19068
|
])
|
|
18831
19069
|
];
|
|
18832
19070
|
const buildOptions = {
|
|
@@ -18835,8 +19073,8 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
18835
19073
|
// shipped host plugins resolve against the selected compiler's runtime.
|
|
18836
19074
|
...process.platform === "linux" ? {
|
|
18837
19075
|
LD_LIBRARY_PATH: [
|
|
18838
|
-
|
|
18839
|
-
|
|
19076
|
+
path13.resolve(options.toolchainBin, "../lib/swift/linux"),
|
|
19077
|
+
path13.resolve(options.toolchainBin, "../lib/swift/host"),
|
|
18840
19078
|
process.env.LD_LIBRARY_PATH
|
|
18841
19079
|
].filter(Boolean).join(":")
|
|
18842
19080
|
} : {}
|
|
@@ -18871,7 +19109,7 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
18871
19109
|
if (preparation.objcImplementations) {
|
|
18872
19110
|
const plan = preparation.objcImplementations;
|
|
18873
19111
|
const manifest = browser_default.parse(
|
|
18874
|
-
|
|
19112
|
+
readFileSync7(path13.join(root, ".build", "release.yaml"), "utf8")
|
|
18875
19113
|
);
|
|
18876
19114
|
if (!isRecord(manifest) || !isRecord(manifest.commands))
|
|
18877
19115
|
throw new Error("missing SwiftPM native compiler commands");
|
|
@@ -18917,7 +19155,7 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
18917
19155
|
implementationASTs(),
|
|
18918
19156
|
plan.registeredClasses
|
|
18919
19157
|
);
|
|
18920
|
-
writeFileSync3(plan.owner,
|
|
19158
|
+
writeFileSync3(plan.owner, readFileSync7(plan.owner, "utf8") + adapter);
|
|
18921
19159
|
}
|
|
18922
19160
|
await runCompiler(
|
|
18923
19161
|
swift,
|
|
@@ -18928,14 +19166,14 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
18928
19166
|
);
|
|
18929
19167
|
} catch (error) {
|
|
18930
19168
|
const output = outputOf(error);
|
|
18931
|
-
const moduleCache =
|
|
19169
|
+
const moduleCache = path13.join(
|
|
18932
19170
|
root,
|
|
18933
19171
|
".build",
|
|
18934
19172
|
WASM_TRIPLE,
|
|
18935
19173
|
"release",
|
|
18936
19174
|
"ModuleCache"
|
|
18937
19175
|
);
|
|
18938
|
-
if (output.includes("was compiled with module cache path") &&
|
|
19176
|
+
if (output.includes("was compiled with module cache path") && existsSync3(moduleCache)) {
|
|
18939
19177
|
rmSync3(moduleCache, { recursive: true, force: true });
|
|
18940
19178
|
try {
|
|
18941
19179
|
await runCompiler(
|
|
@@ -18966,7 +19204,7 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
18966
19204
|
if (unprepared.length) throw new Error(unprepared.join("\n"));
|
|
18967
19205
|
const artifact = {
|
|
18968
19206
|
hash: hash2,
|
|
18969
|
-
bytes:
|
|
19207
|
+
bytes: readFileSync7(builtArtifact(layout)),
|
|
18970
19208
|
icu: await icu
|
|
18971
19209
|
};
|
|
18972
19210
|
saveCompiledArtifact(root, artifact);
|