peachsim 0.1.1673 → 0.1.1684
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/commands/control.ts +13 -1
- package/cli/commands/coverage-swift.ts +83 -27
- package/cli/commands/coverage.ts +219 -20
- package/cli/commands/detect.ts +10 -6
- package/cli/commands/inspect/core.ts +2 -0
- package/cli/commands/inspect/settling.ts +37 -4
- package/cli/commands/inspect/wait-ready.ts +7 -0
- package/cli/outbound-endpoints.ts +12 -0
- package/detox/index.ts +11 -1
- package/detox/jest-environment.cjs +14 -0
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +3299 -1665
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +43 -8
- package/dist-lib/detox/jest-environment.cjs +14 -0
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +2432 -1128
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +2908 -1601
- package/dist-lib/host/fetch-proxy-handler.cjs +22 -6
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +1941 -742
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +6215 -4283
- package/dist-lib/native-app-identity-project.cjs +31 -6
- package/dist-lib/native-app-identity-project.mjs +31 -6
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +24 -23
- package/dist-lib/public-origins-lib-static.json +1 -1
- package/dist-lib/public-origins-lib.json +134 -78
- package/dist-lib/react-native-host-modules.cjs +1 -1
- 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 +1 -1
- package/dist-lib/sdk.cjs +39 -5
- package/dist-lib/sdk.mjs +39 -5
- package/dist-lib/skills.cjs +3637 -2168
- package/dist-lib/swift-compile.cjs +496 -352
- package/dist-lib/swift-compile.mjs +494 -350
- package/dist-lib/swift-package.cjs +58 -9
- package/dist-lib/swift-package.mjs +57 -9
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +26 -11
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +2443 -1134
- package/dist-lib/vite.cjs +1907 -763
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/canvaskit-api.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/clipboardContract.d.ts +9 -1
- package/dist-types/packages/peach-engine/src/engine/paint-boundary.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/preview/upload-protocol.d.ts +11 -3
- package/dist-types/packages/peach-engine/src/rolldown-bundle-inventory.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/webview-automation-host.d.ts +6 -0
- package/dist-types/packages/peach-globals/src/clipboardBridgeContract.d.ts +2 -0
- package/dist-types/packages/peach-globals/src/compositorBridgeContract.d.ts +10 -1
- package/dist-types/packages/peach-globals/src/index.d.ts +1 -1
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +69 -2
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +44 -4
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFComposeAssistantViewController.h +29 -0
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMailComposeControllerDeferredAction.h +14 -0
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMailComposeViewController.h +162 -0
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMailDraft.h +24 -0
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMessageComposeViewController+UPI.h +31 -0
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMessageComposeViewController.h +169 -0
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MessageUI.h +13 -0
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Modules/module.modulemap +11 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h +10 -0
- package/sdk/ios/usr/include/_ctype.h +388 -0
- package/sdk/ios/usr/include/_inttypes.h +296 -0
- package/sdk/ios/usr/include/_locale.h +83 -0
- package/sdk/ios/usr/include/_locale_posix2008.h +65 -0
- package/sdk/ios/usr/include/_time.h +207 -0
- package/sdk/ios/usr/include/arm/param.h +151 -0
- package/sdk/ios/usr/include/ctype.h +70 -0
- package/sdk/ios/usr/include/dispatch/dispatch.h +72 -6
- package/sdk/ios/usr/include/dlfcn.h +1 -2
- package/sdk/ios/usr/include/inttypes.h +35 -0
- package/sdk/ios/usr/include/locale.h +59 -0
- package/sdk/ios/usr/include/machine/param.h +42 -0
- package/sdk/ios/usr/include/net/if.h +1 -2
- package/sdk/ios/usr/include/peach/pthread.h +4 -4
- package/sdk/ios/usr/include/pthread/qos.h +304 -0
- package/sdk/ios/usr/include/runetype.h +118 -0
- package/sdk/ios/usr/include/setjmp.h +99 -0
- package/sdk/ios/usr/include/sys/_types/_clock_t.h +32 -0
- package/sdk/ios/usr/include/sys/_types/_ct_rune_t.h +33 -0
- package/sdk/ios/usr/include/sys/_types/_fd_clr.h +31 -0
- package/sdk/ios/usr/include/sys/_types/_fd_copy.h +31 -0
- package/sdk/ios/usr/include/sys/_types/_fd_def.h +121 -0
- package/sdk/ios/usr/include/sys/_types/_fd_isset.h +31 -0
- package/sdk/ios/usr/include/sys/_types/_fd_set.h +31 -0
- package/sdk/ios/usr/include/sys/_types/_fd_setsize.h +31 -0
- package/sdk/ios/usr/include/sys/_types/_fd_zero.h +31 -0
- package/sdk/ios/usr/include/sys/_types/_rune_t.h +32 -0
- package/sdk/ios/usr/include/sys/_types/_time_t.h +32 -0
- package/sdk/ios/usr/include/sys/_types/_wint_t.h +33 -0
- package/sdk/ios/usr/include/sys/cdefs.h +5 -0
- package/sdk/ios/usr/include/sys/param.h +235 -0
- package/sdk/ios/usr/include/sys/proc.h +1 -0
- package/sdk/ios/usr/include/sys/qos.h +151 -12
- package/sdk/ios/usr/include/time.h +67 -2
- package/sdk/ios/wasm/include/__typedef_sigset_t.h +7 -0
- package/sdk/ios/wasm/include/fcntl.h +11 -0
- package/sdk/ios/wasm/include/mach/machine/boolean.h +2 -0
- package/sdk/ios/wasm/include/mach/machine/exception.h +5 -0
- package/sdk/ios/wasm/include/mach/machine/kern_return.h +2 -0
- package/sdk/ios/wasm/include/mach/machine/processor_info.h +2 -0
- package/sdk/ios/wasm/include/mach/machine/rpc.h +2 -0
- package/sdk/ios/wasm/include/mach/machine/thread_state.h +3 -0
- package/sdk/ios/wasm/include/mach/machine/thread_status.h +3 -0
- package/sdk/ios/wasm/include/mach/machine/vm_param.h +3 -0
- package/sdk/ios/wasm/include/mach/machine/vm_types.h +18 -0
- package/sdk/ios/wasm/include/machine/_types.h +153 -0
- package/sdk/ios/wasm/include/machine/endian.h +2 -0
- package/sdk/ios/wasm/include/machine/limits.h +2 -0
- package/sdk/ios/wasm/include/machine/types.h +30 -0
- package/sdk/ios/wasm/include/poll.h +8 -0
- package/sdk/ios/wasm/include/pthread.h +50 -0
- package/sdk/ios/wasm/include/signal.h +72 -0
- package/sdk/ios/wasm/include/stdlib.h +3 -0
- package/sdk/ios/wasm/include/string.h +10 -0
- package/sdk/ios/wasm/include/sys/_pthread/_pthread_attr_t.h +7 -0
- package/sdk/ios/wasm/include/sys/_pthread/_pthread_t.h +7 -0
- package/sdk/ios/wasm/include/sys/mman.h +122 -0
- package/sdk/ios/wasm/include/sys/select.h +37 -0
- package/sdk/ios/wasm/include/sys/signal.h +259 -0
- package/sdk/ios/wasm/include/sys/socket.h +8 -0
- package/sdk/ios/wasm/include/sys/types.h +14 -0
- package/sdk/ios/wasm/include/sys/ucontext.h +1 -0
- package/sdk/ios/wasm/include/sys/uio.h +11 -0
- package/sdk/ios/wasm/include/sys/wait.h +89 -0
- package/sdk/ios/wasm/include/time.h +8 -0
- package/sdk/ios/wasm/include/unistd.h +17 -0
- package/src/bridge-contract.ts +2 -0
- package/src/chromium-admission.ts +10 -5
- package/src/device-catalog.ts +4 -4
- package/src/host/fetch-proxy-handler.ts +20 -0
- package/src/host/rolldown-bundle-forward.ts +4 -1
- package/src/metro-plugin.ts +5 -2
- package/src/nitro-adapter.lock.json +6 -6
- package/src/nitro-compile.ts +63 -2
- package/src/numbered-lock.ts +72 -0
- package/src/react-native-coverage/capability-reference-resolution.ts +62 -5
- package/src/react-native-coverage/capability-source-references.ts +50 -13
- package/src/react-native-coverage/native-source-credit.ts +126 -0
- package/src/react-native-coverage/native-source-ranges-file.ts +38 -0
- package/src/react-native-coverage/native-surface.ts +49 -0
- package/src/react-native-coverage/verified-reach.ts +22 -2
- package/src/runtime-assets.ts +17 -0
- package/src/swift-compile.ts +84 -47
- package/src/swift-coverage/indexing.ts +17 -1
- package/src/swift-coverage/sdk.ts +71 -0
- package/src/swift-coverage/source.ts +74 -2
- package/src/swift-coverage/types.ts +6 -0
- package/src/swift-distribution.lock.json +12 -12
- package/src/swift-host.ts +133 -14
- package/src/swift-objc-compile.ts +11 -22
- package/src/swift-objc-metadata.ts +2 -8
- package/src/swift-objc-platform.ts +53 -0
- package/src/swift-objc-standin.ts +49 -0
- package/src/swift-package-manifest.ts +48 -3
- package/src/swift-package.ts +85 -12
- package/src/swift-packages.ts +157 -44
- package/src/swift-source-pods.ts +288 -0
- package/src/swift-standins.ts +4 -1
- package/src/swift-toolchain.ts +32 -10
- package/src/vite-plugin-one.ts +5 -4
- package/src/worker-system-chunks.ts +7 -1
- package/src/xcode-project.ts +40 -11
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1684 | (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)
|
|
@@ -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 path12 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, path13) {
|
|
118
|
+
const ctrl = callVisitor(key, node, visitor, path13);
|
|
119
119
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
120
|
-
replaceNode(key,
|
|
121
|
-
return visit_(key, ctrl, visitor,
|
|
120
|
+
replaceNode(key, path13, ctrl);
|
|
121
|
+
return visit_(key, ctrl, visitor, path13);
|
|
122
122
|
}
|
|
123
123
|
if (typeof ctrl !== "symbol") {
|
|
124
124
|
if (isCollection(node)) {
|
|
125
|
-
|
|
125
|
+
path13 = Object.freeze(path13.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, path13);
|
|
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, path12) {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
} else if (isPair(node)) {
|
|
138
|
-
|
|
139
|
-
const ck = visit_("key", node.key, visitor,
|
|
138
|
+
path13 = Object.freeze(path13.concat(node));
|
|
139
|
+
const ck = visit_("key", node.key, visitor, path13);
|
|
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, path13);
|
|
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, path13) {
|
|
166
|
+
const ctrl = await callVisitor(key, node, visitor, path13);
|
|
167
167
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
168
|
-
replaceNode(key,
|
|
169
|
-
return visitAsync_(key, ctrl, visitor,
|
|
168
|
+
replaceNode(key, path13, ctrl);
|
|
169
|
+
return visitAsync_(key, ctrl, visitor, path13);
|
|
170
170
|
}
|
|
171
171
|
if (typeof ctrl !== "symbol") {
|
|
172
172
|
if (isCollection(node)) {
|
|
173
|
-
|
|
173
|
+
path13 = Object.freeze(path13.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, path13);
|
|
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, path12) {
|
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
} else if (isPair(node)) {
|
|
186
|
-
|
|
187
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
186
|
+
path13 = Object.freeze(path13.concat(node));
|
|
187
|
+
const ck = await visitAsync_("key", node.key, visitor, path13);
|
|
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, path13);
|
|
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, path13) {
|
|
220
220
|
if (typeof visitor === "function")
|
|
221
|
-
return visitor(key, node,
|
|
221
|
+
return visitor(key, node, path13);
|
|
222
222
|
if (isMap(node))
|
|
223
|
-
return visitor.Map?.(key, node,
|
|
223
|
+
return visitor.Map?.(key, node, path13);
|
|
224
224
|
if (isSeq(node))
|
|
225
|
-
return visitor.Seq?.(key, node,
|
|
225
|
+
return visitor.Seq?.(key, node, path13);
|
|
226
226
|
if (isPair(node))
|
|
227
|
-
return visitor.Pair?.(key, node,
|
|
227
|
+
return visitor.Pair?.(key, node, path13);
|
|
228
228
|
if (isScalar(node))
|
|
229
|
-
return visitor.Scalar?.(key, node,
|
|
229
|
+
return visitor.Scalar?.(key, node, path13);
|
|
230
230
|
if (isAlias(node))
|
|
231
|
-
return visitor.Alias?.(key, node,
|
|
231
|
+
return visitor.Alias?.(key, node, path13);
|
|
232
232
|
return void 0;
|
|
233
233
|
}
|
|
234
|
-
function replaceNode(key,
|
|
235
|
-
const parent =
|
|
234
|
+
function replaceNode(key, path13, node) {
|
|
235
|
+
const parent = path13[path13.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, path13, value) {
|
|
765
765
|
let v = value;
|
|
766
|
-
for (let i =
|
|
767
|
-
const k =
|
|
766
|
+
for (let i = path13.length - 1; i >= 0; --i) {
|
|
767
|
+
const k = path13[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, path12, value) {
|
|
|
783
783
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
784
784
|
});
|
|
785
785
|
}
|
|
786
|
-
var isEmptyPath = (
|
|
786
|
+
var isEmptyPath = (path13) => path13 == null || typeof path13 === "object" && !!path13[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(path13, value) {
|
|
817
|
+
if (isEmptyPath(path13))
|
|
818
818
|
this.add(value);
|
|
819
819
|
else {
|
|
820
|
-
const [key, ...rest] =
|
|
820
|
+
const [key, ...rest] = path13;
|
|
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(path13) {
|
|
835
|
+
const [key, ...rest] = path13;
|
|
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(path13, keepScalar) {
|
|
850
|
+
const [key, ...rest] = path13;
|
|
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(path13) {
|
|
869
|
+
const [key, ...rest] = path13;
|
|
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(path13, value) {
|
|
880
|
+
const [key, ...rest] = path13;
|
|
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(path13, value) {
|
|
3020
3020
|
if (assertCollection(this.contents))
|
|
3021
|
-
this.contents.addIn(
|
|
3021
|
+
this.contents.addIn(path13, 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(path13) {
|
|
3097
|
+
if (isEmptyPath(path13)) {
|
|
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(path13) : 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(path13, keepScalar) {
|
|
3119
|
+
if (isEmptyPath(path13))
|
|
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(path13, 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(path13) {
|
|
3133
|
+
if (isEmptyPath(path13))
|
|
3134
3134
|
return this.contents !== void 0;
|
|
3135
|
-
return isCollection(this.contents) ? this.contents.hasIn(
|
|
3135
|
+
return isCollection(this.contents) ? this.contents.hasIn(path13) : 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(path13, value) {
|
|
3153
|
+
if (isEmptyPath(path13)) {
|
|
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(path13), value);
|
|
3157
3157
|
} else if (assertCollection(this.contents)) {
|
|
3158
|
-
this.contents.setIn(
|
|
3158
|
+
this.contents.setIn(path13, 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, path13) => {
|
|
4955
4955
|
let item = cst;
|
|
4956
|
-
for (const [field, index] of
|
|
4956
|
+
for (const [field, index] of path13) {
|
|
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, path12) => {
|
|
|
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, path13) => {
|
|
4966
|
+
const parent = visit2.itemAtPath(cst, path13.slice(0, -1));
|
|
4967
|
+
const field = path13[path13.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(path13, item, visitor) {
|
|
4974
|
+
let ctrl = visitor(item, path13);
|
|
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(path13.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(path12, item, visitor) {
|
|
|
4989
4989
|
}
|
|
4990
4990
|
}
|
|
4991
4991
|
if (typeof ctrl === "function" && field === "key")
|
|
4992
|
-
ctrl = ctrl(item,
|
|
4992
|
+
ctrl = ctrl(item, path13);
|
|
4993
4993
|
}
|
|
4994
4994
|
}
|
|
4995
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
4995
|
+
return typeof ctrl === "function" ? ctrl(item, path13) : ctrl;
|
|
4996
4996
|
}
|
|
4997
4997
|
|
|
4998
4998
|
// ../../node_modules/yaml/browser/dist/parse/cst.js
|
|
@@ -7376,9 +7376,9 @@ var EXCERPT = /^(\s*)(\d+)( \| )(.*)$/;
|
|
|
7376
7376
|
var MARKER = /^(\s*)( \| )(.*)$/;
|
|
7377
7377
|
function designTimeDiagnostic(output, files) {
|
|
7378
7378
|
const rewritten = /* @__PURE__ */ new Map();
|
|
7379
|
-
const linesOf = (
|
|
7379
|
+
const linesOf = (path13) => {
|
|
7380
7380
|
const file = Object.keys(files).find(
|
|
7381
|
-
(name2) => name2.endsWith(".swift") && (
|
|
7381
|
+
(name2) => name2.endsWith(".swift") && (path13 === name2 || path13.endsWith(`/${name2}`))
|
|
7382
7382
|
);
|
|
7383
7383
|
if (file === void 0) return null;
|
|
7384
7384
|
let lines = rewritten.get(file);
|
|
@@ -7490,20 +7490,20 @@ function swiftSdkOptions() {
|
|
|
7490
7490
|
}
|
|
7491
7491
|
return [];
|
|
7492
7492
|
}
|
|
7493
|
-
var SWIFT_HOST_COMPILER_RELEASE = "swift-6.4.0-RELEASE-custom-
|
|
7494
|
-
var SWIFT_HOST_COMPILER_ID = "
|
|
7493
|
+
var SWIFT_HOST_COMPILER_RELEASE = "swift-6.4.0-RELEASE-custom-8be2e4a7a393b003";
|
|
7494
|
+
var SWIFT_HOST_COMPILER_ID = "8be2e4a7a393b003";
|
|
7495
7495
|
var compilerArchives = {
|
|
7496
7496
|
"darwin-arm64": {
|
|
7497
|
-
checksum: "
|
|
7498
|
-
manifest: "
|
|
7497
|
+
checksum: "88d69b7ac912962adaadce9fdb2c57fe07cd19e4d8158088e0acbd247496ca6d",
|
|
7498
|
+
manifest: "70d5e2be8c959eb5dd1d9b576e6c209e1f58bfb9089f90c38c2d7e087759f0b3"
|
|
7499
7499
|
},
|
|
7500
7500
|
"linux-x64": {
|
|
7501
|
-
checksum: "
|
|
7502
|
-
manifest: "
|
|
7501
|
+
checksum: "7c42ded03742d16816e64f8ae8fca478aaaff450d22ab3d698daf78c010854b2",
|
|
7502
|
+
manifest: "90cfb09c5a0ba8c119066787cf47244a45bf3cda68dce94c6b1a16337b9b91bd"
|
|
7503
7503
|
},
|
|
7504
7504
|
"linux-arm64": {
|
|
7505
|
-
checksum: "
|
|
7506
|
-
manifest: "
|
|
7505
|
+
checksum: "f9f1d96fb1a6325d3bb30ab12a75fc06e4e8535aab58a91581e03f3d91f68fa6",
|
|
7506
|
+
manifest: "f988181dce795f6c8a6d4a8d86f7b61768f23a743b4e7bea76e64862ef328ad6"
|
|
7507
7507
|
}
|
|
7508
7508
|
};
|
|
7509
7509
|
function swiftHostCompilerArchive(release, host2 = `${process.platform}-${process.arch}`) {
|
|
@@ -9062,10 +9062,10 @@ function swiftObjCImports(graphs, options) {
|
|
|
9062
9062
|
}
|
|
9063
9063
|
|
|
9064
9064
|
// src/swift-objc-metadata.ts
|
|
9065
|
-
import { spawnSync as
|
|
9065
|
+
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
9066
9066
|
import { createHash as createHash7 } from "node:crypto";
|
|
9067
9067
|
import fs4 from "node:fs";
|
|
9068
|
-
import
|
|
9068
|
+
import path9 from "node:path";
|
|
9069
9069
|
|
|
9070
9070
|
// src/swift-objc-sdk.ts
|
|
9071
9071
|
import path6 from "node:path";
|
|
@@ -9089,11 +9089,66 @@ for (const [file, text3] of tree) {
|
|
|
9089
9089
|
}
|
|
9090
9090
|
|
|
9091
9091
|
// src/swift-objc-standin.ts
|
|
9092
|
-
import { execFileSync as execFileSync2, spawnSync as
|
|
9092
|
+
import { execFileSync as execFileSync2, spawnSync as spawnSync4 } from "node:child_process";
|
|
9093
9093
|
import { createHash as createHash6 } from "node:crypto";
|
|
9094
9094
|
import fs3 from "node:fs";
|
|
9095
|
+
import path8 from "node:path";
|
|
9096
|
+
|
|
9097
|
+
// src/swift-objc-platform.ts
|
|
9098
|
+
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
9095
9099
|
import path7 from "node:path";
|
|
9100
|
+
var platforms = /* @__PURE__ */ new Map();
|
|
9101
|
+
function swiftObjCPlatformFlags(toolchainBin, minimum) {
|
|
9102
|
+
const key = `${toolchainBin}:${minimum}`;
|
|
9103
|
+
const cached = platforms.get(key);
|
|
9104
|
+
if (cached) return cached;
|
|
9105
|
+
const version = [
|
|
9106
|
+
Math.floor(minimum / 1e4),
|
|
9107
|
+
Math.floor(minimum % 1e4 / 100),
|
|
9108
|
+
minimum % 100
|
|
9109
|
+
].join(".");
|
|
9110
|
+
const result = spawnSync3(
|
|
9111
|
+
path7.join(toolchainBin, "clang"),
|
|
9112
|
+
[
|
|
9113
|
+
"-target",
|
|
9114
|
+
`arm64-apple-ios${version}-simulator`,
|
|
9115
|
+
"-dM",
|
|
9116
|
+
"-E",
|
|
9117
|
+
"-x",
|
|
9118
|
+
"objective-c",
|
|
9119
|
+
"-"
|
|
9120
|
+
],
|
|
9121
|
+
{
|
|
9122
|
+
input: "",
|
|
9123
|
+
encoding: "utf8",
|
|
9124
|
+
env: swiftEnvironment(),
|
|
9125
|
+
timeout: 3e4,
|
|
9126
|
+
maxBuffer: 1024 * 1024
|
|
9127
|
+
}
|
|
9128
|
+
);
|
|
9129
|
+
if (result.error || result.status !== 0)
|
|
9130
|
+
throw new Error(
|
|
9131
|
+
`could not read iOS compiler platform predefines: ${result.error?.message ?? result.stderr}`
|
|
9132
|
+
);
|
|
9133
|
+
const flags = [
|
|
9134
|
+
...result.stdout.matchAll(
|
|
9135
|
+
/^#define (TARGET_OS_\w+|TARGET_IPHONE_SIMULATOR|__APPLE\w*__|__MACH__|__ENVIRONMENT_\w+) (.*)$/gm
|
|
9136
|
+
)
|
|
9137
|
+
].map(([, name2, value]) => `-D${name2}=${value}`);
|
|
9138
|
+
if (!flags.includes("-D__APPLE__=1") || !flags.includes("-D__MACH__=1"))
|
|
9139
|
+
throw new Error("iOS compiler platform predefines lack Apple and Mach identity");
|
|
9140
|
+
platforms.set(key, flags);
|
|
9141
|
+
return flags;
|
|
9142
|
+
}
|
|
9143
|
+
|
|
9144
|
+
// src/swift-objc-standin.ts
|
|
9096
9145
|
var NATIVE_GRAPH_SDK_VERSION = "27.1";
|
|
9146
|
+
var WASI_EMULATION = [
|
|
9147
|
+
"_WASI_EMULATED_SIGNAL",
|
|
9148
|
+
"_WASI_EMULATED_MMAN",
|
|
9149
|
+
"_WASI_EMULATED_PROCESS_CLOCKS"
|
|
9150
|
+
];
|
|
9151
|
+
var WASI_EMULATION_FLAGS = WASI_EMULATION.map((name2) => `-D${name2}`);
|
|
9097
9152
|
var NATIVE_GRAPH_INPUTS = {
|
|
9098
9153
|
sdk: NATIVE_GRAPH_SDK_VERSION,
|
|
9099
9154
|
settings: "e68503e5e534e9194af5efe8c636ca8b824e2d8237c5f38ec84aa4d155bc8418",
|
|
@@ -9118,13 +9173,13 @@ ${text3}`
|
|
|
9118
9173
|
}
|
|
9119
9174
|
var IOS_SDK_ID = createHash6("sha256").update(JSON.stringify(iosSdkEntries())).digest("hex").slice(0, 16);
|
|
9120
9175
|
function materializeObjcSdk(cacheDir2) {
|
|
9121
|
-
const sdk =
|
|
9176
|
+
const sdk = path8.join(cacheDir2, "ios-sdk", IOS_SDK_ID);
|
|
9122
9177
|
if (fs3.existsSync(sdk)) return sdk;
|
|
9123
|
-
fs3.mkdirSync(
|
|
9178
|
+
fs3.mkdirSync(path8.dirname(sdk), { recursive: true });
|
|
9124
9179
|
const staging = fs3.mkdtempSync(`${sdk}-`);
|
|
9125
9180
|
for (const [file, text3] of iosSdkEntries()) {
|
|
9126
|
-
fs3.mkdirSync(
|
|
9127
|
-
fs3.writeFileSync(
|
|
9181
|
+
fs3.mkdirSync(path8.dirname(path8.join(staging, file)), { recursive: true });
|
|
9182
|
+
fs3.writeFileSync(path8.join(staging, file), text3);
|
|
9128
9183
|
}
|
|
9129
9184
|
try {
|
|
9130
9185
|
fs3.renameSync(staging, sdk);
|
|
@@ -9134,6 +9189,33 @@ function materializeObjcSdk(cacheDir2) {
|
|
|
9134
9189
|
}
|
|
9135
9190
|
return sdk;
|
|
9136
9191
|
}
|
|
9192
|
+
function objcSdkIntakeFlags(headers, toolchainBin, minimum) {
|
|
9193
|
+
return [
|
|
9194
|
+
...swiftObjCPlatformFlags(toolchainBin, minimum),
|
|
9195
|
+
// AvailabilityInternal.h derives this through __is_target_os(ios), which
|
|
9196
|
+
// is false for wasm32.
|
|
9197
|
+
`-D__IPHONE_OS_VERSION_MIN_REQUIRED=${minimum}`,
|
|
9198
|
+
// apple's build setting for a 32-bit target to keep NSInteger and
|
|
9199
|
+
// NSUInteger long, the nominal types they have on arm64.
|
|
9200
|
+
"-DNS_BUILD_32_LIKE_64=1",
|
|
9201
|
+
// the installed libc's default feature set otherwise defines
|
|
9202
|
+
// _XOPEN_SOURCE, which darwin's sys/cdefs.h turns into a strict posix
|
|
9203
|
+
// level; iOS compiles at darwin's full level with neither defined.
|
|
9204
|
+
"-D_BSD_SOURCE",
|
|
9205
|
+
...WASI_EMULATION_FLAGS,
|
|
9206
|
+
"-iframework",
|
|
9207
|
+
path8.join(headers, "System/Library/Frameworks"),
|
|
9208
|
+
"-isystem",
|
|
9209
|
+
path8.join(headers, "wasm/include"),
|
|
9210
|
+
"-idirafter",
|
|
9211
|
+
path8.join(headers, "usr/include")
|
|
9212
|
+
];
|
|
9213
|
+
}
|
|
9214
|
+
function iosDeploymentMinimum(version) {
|
|
9215
|
+
const parts = /^(\d{1,2})(?:\.(\d{1,2}))?(?:\.(\d{1,2}))?$/.exec(version ?? "");
|
|
9216
|
+
if (!parts) return void 0;
|
|
9217
|
+
return Number(parts[1]) * 1e4 + Number(parts[2] ?? 0) * 100 + Number(parts[3] ?? 0);
|
|
9218
|
+
}
|
|
9137
9219
|
var headerFiles = (dir) => fs3.readdirSync(dir, { recursive: true, encoding: "utf8" }).filter((file) => file.endsWith(".h")).sort();
|
|
9138
9220
|
function missingHeader(missing) {
|
|
9139
9221
|
const lines = ["#import <Foundation/Foundation.h>", "#import <UIKit/UIKit.h>"];
|
|
@@ -9156,52 +9238,52 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
|
|
|
9156
9238
|
`this peach's Swift has no iOS simulator standard library at ${stdlib}`
|
|
9157
9239
|
);
|
|
9158
9240
|
const sdk = materializeObjcSdk(cacheDir2);
|
|
9159
|
-
const framework =
|
|
9160
|
-
const frameworks =
|
|
9161
|
-
const include =
|
|
9162
|
-
const headersDir = framework ?
|
|
9241
|
+
const framework = path8.basename(path8.dirname(surface.modulemap)) === "Modules";
|
|
9242
|
+
const frameworks = path8.join(work, "frameworks");
|
|
9243
|
+
const include = path8.join(work, "include");
|
|
9244
|
+
const headersDir = framework ? path8.join(frameworks, `${surface.module}.framework`, "Headers") : path8.join(include, surface.module);
|
|
9163
9245
|
fs3.mkdirSync(headersDir, { recursive: true });
|
|
9164
9246
|
const originals = new Map(
|
|
9165
9247
|
headerFiles(surface.headers).map((file) => [
|
|
9166
|
-
|
|
9167
|
-
fs3.readFileSync(
|
|
9248
|
+
path8.join(headersDir, file),
|
|
9249
|
+
fs3.readFileSync(path8.join(surface.headers, file), "utf8")
|
|
9168
9250
|
])
|
|
9169
9251
|
);
|
|
9170
9252
|
for (const [file, text3] of originals) {
|
|
9171
|
-
fs3.mkdirSync(
|
|
9253
|
+
fs3.mkdirSync(path8.dirname(file), { recursive: true });
|
|
9172
9254
|
fs3.writeFileSync(file, text3);
|
|
9173
9255
|
}
|
|
9174
9256
|
if (framework) {
|
|
9175
|
-
fs3.mkdirSync(
|
|
9257
|
+
fs3.mkdirSync(path8.join(frameworks, `${surface.module}.framework`, "Modules"), {
|
|
9176
9258
|
recursive: true
|
|
9177
9259
|
});
|
|
9178
9260
|
fs3.copyFileSync(
|
|
9179
9261
|
surface.modulemap,
|
|
9180
|
-
|
|
9262
|
+
path8.join(frameworks, `${surface.module}.framework`, "Modules", "module.modulemap")
|
|
9181
9263
|
);
|
|
9182
9264
|
} else {
|
|
9183
|
-
fs3.copyFileSync(surface.modulemap,
|
|
9265
|
+
fs3.copyFileSync(surface.modulemap, path8.join(headersDir, "module.modulemap"));
|
|
9184
9266
|
}
|
|
9185
9267
|
const dependencyOriginals = /* @__PURE__ */ new Map();
|
|
9186
9268
|
for (const dependency of surface.dependencies ?? []) {
|
|
9187
|
-
const dir =
|
|
9269
|
+
const dir = path8.join(include, dependency.module);
|
|
9188
9270
|
fs3.mkdirSync(dir, { recursive: true });
|
|
9189
9271
|
for (const file of headerFiles(dependency.headers)) {
|
|
9190
|
-
const destination =
|
|
9191
|
-
const text3 = fs3.readFileSync(
|
|
9272
|
+
const destination = path8.join(dir, file);
|
|
9273
|
+
const text3 = fs3.readFileSync(path8.join(dependency.headers, file), "utf8");
|
|
9192
9274
|
dependencyOriginals.set(destination, text3);
|
|
9193
|
-
fs3.mkdirSync(
|
|
9275
|
+
fs3.mkdirSync(path8.dirname(destination), { recursive: true });
|
|
9194
9276
|
fs3.writeFileSync(destination, text3);
|
|
9195
9277
|
}
|
|
9196
|
-
const supplied =
|
|
9278
|
+
const supplied = path8.join(dependency.headers, "module.modulemap");
|
|
9197
9279
|
fs3.writeFileSync(
|
|
9198
|
-
|
|
9280
|
+
path8.join(dir, "module.modulemap"),
|
|
9199
9281
|
fs3.existsSync(supplied) ? fs3.readFileSync(supplied, "utf8") : `module ${dependency.module} { umbrella "." export * }
|
|
9200
9282
|
`
|
|
9201
9283
|
);
|
|
9202
9284
|
}
|
|
9203
|
-
const stubs =
|
|
9204
|
-
const stubIncludes =
|
|
9285
|
+
const stubs = path8.join(work, "stubs");
|
|
9286
|
+
const stubIncludes = path8.join(work, "stub-include");
|
|
9205
9287
|
fs3.mkdirSync(stubs, { recursive: true });
|
|
9206
9288
|
fs3.mkdirSync(stubIncludes, { recursive: true });
|
|
9207
9289
|
const search = [
|
|
@@ -9209,11 +9291,11 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
|
|
|
9209
9291
|
sdk,
|
|
9210
9292
|
// keep compiler support headers without importing host platform modules.
|
|
9211
9293
|
"-resource-dir",
|
|
9212
|
-
|
|
9294
|
+
path8.join(sdk, "usr/lib/swift"),
|
|
9213
9295
|
"-I",
|
|
9214
|
-
|
|
9296
|
+
path8.resolve(toolchainBin, "../lib/swift/clang/include"),
|
|
9215
9297
|
"-I",
|
|
9216
|
-
|
|
9298
|
+
path8.resolve(toolchainBin, "../lib/swift/shims"),
|
|
9217
9299
|
"-I",
|
|
9218
9300
|
stdlib,
|
|
9219
9301
|
"-F",
|
|
@@ -9224,7 +9306,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
|
|
|
9224
9306
|
headersDir,
|
|
9225
9307
|
...(surface.dependencies ?? []).flatMap((dependency) => [
|
|
9226
9308
|
"-I",
|
|
9227
|
-
|
|
9309
|
+
path8.join(include, dependency.module)
|
|
9228
9310
|
]),
|
|
9229
9311
|
"-F",
|
|
9230
9312
|
stubs,
|
|
@@ -9233,7 +9315,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
|
|
|
9233
9315
|
];
|
|
9234
9316
|
const missing = /* @__PURE__ */ new Map();
|
|
9235
9317
|
const stubbed = /* @__PURE__ */ new Set();
|
|
9236
|
-
const out =
|
|
9318
|
+
const out = path8.join(work, "graphs");
|
|
9237
9319
|
const stub = (include2) => {
|
|
9238
9320
|
if (stubbed.has(include2)) return false;
|
|
9239
9321
|
stubbed.add(include2);
|
|
@@ -9245,22 +9327,22 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
|
|
|
9245
9327
|
IOS_SDK_HEADERS,
|
|
9246
9328
|
`System/Library/Frameworks/${name2}.framework/Headers/${name2}.h`
|
|
9247
9329
|
)) {
|
|
9248
|
-
const header2 =
|
|
9249
|
-
fs3.mkdirSync(
|
|
9330
|
+
const header2 = path8.join(stubIncludes, include2);
|
|
9331
|
+
fs3.mkdirSync(path8.dirname(header2), { recursive: true });
|
|
9250
9332
|
fs3.writeFileSync(header2, `#import <${umbrella}>
|
|
9251
9333
|
`);
|
|
9252
9334
|
return true;
|
|
9253
9335
|
}
|
|
9254
|
-
const root =
|
|
9255
|
-
const header =
|
|
9256
|
-
fs3.mkdirSync(
|
|
9336
|
+
const root = path8.join(stubs, `${name2}.framework`);
|
|
9337
|
+
const header = path8.join(root, "Headers", include2.slice(slash + 1));
|
|
9338
|
+
fs3.mkdirSync(path8.dirname(header), { recursive: true });
|
|
9257
9339
|
fs3.writeFileSync(
|
|
9258
9340
|
header,
|
|
9259
9341
|
"#import <Foundation/Foundation.h>\n#import <UIKit/UIKit.h>\n"
|
|
9260
9342
|
);
|
|
9261
|
-
fs3.mkdirSync(
|
|
9343
|
+
fs3.mkdirSync(path8.join(root, "Modules"), { recursive: true });
|
|
9262
9344
|
fs3.writeFileSync(
|
|
9263
|
-
|
|
9345
|
+
path8.join(root, "Modules", "module.modulemap"),
|
|
9264
9346
|
`framework module ${name2} {
|
|
9265
9347
|
umbrella "Headers"
|
|
9266
9348
|
export *
|
|
@@ -9269,19 +9351,19 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
|
|
|
9269
9351
|
`
|
|
9270
9352
|
);
|
|
9271
9353
|
} else {
|
|
9272
|
-
const header =
|
|
9273
|
-
fs3.mkdirSync(
|
|
9354
|
+
const header = path8.join(stubIncludes, include2);
|
|
9355
|
+
fs3.mkdirSync(path8.dirname(header), { recursive: true });
|
|
9274
9356
|
fs3.writeFileSync(header, "");
|
|
9275
9357
|
}
|
|
9276
9358
|
return true;
|
|
9277
9359
|
};
|
|
9278
9360
|
const declareMissing = () => {
|
|
9279
|
-
const root =
|
|
9280
|
-
fs3.mkdirSync(
|
|
9281
|
-
fs3.mkdirSync(
|
|
9282
|
-
fs3.writeFileSync(
|
|
9361
|
+
const root = path8.join(stubs, "PeachMissing.framework");
|
|
9362
|
+
fs3.mkdirSync(path8.join(root, "Headers"), { recursive: true });
|
|
9363
|
+
fs3.mkdirSync(path8.join(root, "Modules"), { recursive: true });
|
|
9364
|
+
fs3.writeFileSync(path8.join(root, "Headers", "PeachMissing.h"), missingHeader(missing));
|
|
9283
9365
|
fs3.writeFileSync(
|
|
9284
|
-
|
|
9366
|
+
path8.join(root, "Modules", "module.modulemap"),
|
|
9285
9367
|
'framework module PeachMissing {\n umbrella header "PeachMissing.h"\n export *\n}\n'
|
|
9286
9368
|
);
|
|
9287
9369
|
for (const [file, text3] of [...originals, ...dependencyOriginals])
|
|
@@ -9298,8 +9380,8 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
|
|
|
9298
9380
|
for (let round = 0; ; round++) {
|
|
9299
9381
|
fs3.rmSync(out, { recursive: true, force: true });
|
|
9300
9382
|
fs3.mkdirSync(out, { recursive: true });
|
|
9301
|
-
const run2 =
|
|
9302
|
-
|
|
9383
|
+
const run2 = spawnSync4(
|
|
9384
|
+
path8.join(toolchainBin, "swift-symbolgraph-extract"),
|
|
9303
9385
|
[
|
|
9304
9386
|
"-module-name",
|
|
9305
9387
|
surface.module,
|
|
@@ -9308,7 +9390,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
|
|
|
9308
9390
|
...search,
|
|
9309
9391
|
...original?.flags.flatMap((flag) => ["-Xcc", flag]) ?? [],
|
|
9310
9392
|
"-module-cache-path",
|
|
9311
|
-
|
|
9393
|
+
path8.join(cacheDir2, "ios-module-cache"),
|
|
9312
9394
|
"-minimum-access-level",
|
|
9313
9395
|
// symbol graphs hide public underscored names at the public threshold.
|
|
9314
9396
|
// original clang headers remain the declaration boundary.
|
|
@@ -9371,7 +9453,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
|
|
|
9371
9453
|
);
|
|
9372
9454
|
if (missing.size > 0) declareMissing();
|
|
9373
9455
|
}
|
|
9374
|
-
const graphs = fs3.readdirSync(out).filter((name2) => name2.endsWith(".symbols.json")).sort().map((name2) => JSON.parse(fs3.readFileSync(
|
|
9456
|
+
const graphs = fs3.readdirSync(out).filter((name2) => name2.endsWith(".symbols.json")).sort().map((name2) => JSON.parse(fs3.readFileSync(path8.join(out, name2), "utf8")));
|
|
9375
9457
|
const imports = /* @__PURE__ */ new Set(["Foundation", "UIKit"]);
|
|
9376
9458
|
for (const text3 of originals.values())
|
|
9377
9459
|
for (const match of text3.matchAll(
|
|
@@ -9400,7 +9482,7 @@ function objcDeclarationAST(surface, framework, toolchainBin, search, work, orig
|
|
|
9400
9482
|
const roots = [
|
|
9401
9483
|
...fs3.readFileSync(surface.modulemap, "utf8").matchAll(/(?:umbrella\s+)?header\s+"([^"]+)"/g)
|
|
9402
9484
|
].map((match) => match[1]);
|
|
9403
|
-
const probe =
|
|
9485
|
+
const probe = path8.join(work, "declarations.m");
|
|
9404
9486
|
fs3.writeFileSync(
|
|
9405
9487
|
probe,
|
|
9406
9488
|
roots.map(
|
|
@@ -9430,8 +9512,8 @@ function objcDeclarationAST(surface, framework, toolchainBin, search, work, orig
|
|
|
9430
9512
|
"-ast-dump-all=json"
|
|
9431
9513
|
];
|
|
9432
9514
|
const dump = (filter) => {
|
|
9433
|
-
const run2 =
|
|
9434
|
-
|
|
9515
|
+
const run2 = spawnSync4(
|
|
9516
|
+
path8.join(toolchainBin, "clang"),
|
|
9435
9517
|
[
|
|
9436
9518
|
...args,
|
|
9437
9519
|
...filter ? ["-Xclang", "-ast-dump-filter", "-Xclang", filter] : [],
|
|
@@ -9495,7 +9577,7 @@ function enumValues(graphs, surface, framework, toolchainBin, search, work, orig
|
|
|
9495
9577
|
const roots = [
|
|
9496
9578
|
...fs3.readFileSync(surface.modulemap, "utf8").matchAll(/(?:umbrella\s+)?header\s+"([^"]+)"/g)
|
|
9497
9579
|
].map((match) => match[1]);
|
|
9498
|
-
const probe =
|
|
9580
|
+
const probe = path8.join(work, "values.m");
|
|
9499
9581
|
fs3.writeFileSync(
|
|
9500
9582
|
probe,
|
|
9501
9583
|
roots.map(
|
|
@@ -9510,8 +9592,8 @@ function enumValues(graphs, surface, framework, toolchainBin, search, work, orig
|
|
|
9510
9592
|
if (flag === "-sdk") flags.push("-isysroot", dir);
|
|
9511
9593
|
else flags.push(flag, dir);
|
|
9512
9594
|
}
|
|
9513
|
-
const run2 =
|
|
9514
|
-
|
|
9595
|
+
const run2 = spawnSync4(
|
|
9596
|
+
path8.join(toolchainBin, "clang"),
|
|
9515
9597
|
[
|
|
9516
9598
|
"-x",
|
|
9517
9599
|
"objective-c",
|
|
@@ -9524,7 +9606,7 @@ function enumValues(graphs, surface, framework, toolchainBin, search, work, orig
|
|
|
9524
9606
|
original?.target ?? IOS_SDK_TARGET,
|
|
9525
9607
|
...flags,
|
|
9526
9608
|
...original?.flags ?? [],
|
|
9527
|
-
`-fmodules-cache-path=${
|
|
9609
|
+
`-fmodules-cache-path=${path8.join(work, "clang-modules")}`,
|
|
9528
9610
|
"-Xclang",
|
|
9529
9611
|
"-ast-dump=json",
|
|
9530
9612
|
probe
|
|
@@ -9802,8 +9884,16 @@ function clangMacroSetting(macro) {
|
|
|
9802
9884
|
const [name2, ...value] = macro.split("=");
|
|
9803
9885
|
return value.length === 0 ? `.define(${JSON.stringify(name2)})` : `.define(${JSON.stringify(name2)}, to: ${JSON.stringify(value.join("="))})`;
|
|
9804
9886
|
}
|
|
9805
|
-
|
|
9806
|
-
|
|
9887
|
+
var swiftEscapes = {
|
|
9888
|
+
"\\": "\\",
|
|
9889
|
+
'"': '"',
|
|
9890
|
+
"'": "'",
|
|
9891
|
+
n: "\n",
|
|
9892
|
+
r: "\r",
|
|
9893
|
+
t: " "
|
|
9894
|
+
};
|
|
9895
|
+
function settingsBlocks(call, tool) {
|
|
9896
|
+
const bodies = [];
|
|
9807
9897
|
for (const open of call.matchAll(new RegExp(`\\b${tool}Settings\\s*:\\s*\\[`, "g"))) {
|
|
9808
9898
|
let depth = 1;
|
|
9809
9899
|
let index = open.index + open[0].length;
|
|
@@ -9816,11 +9906,43 @@ function settingDefines(call, tool) {
|
|
|
9816
9906
|
} else if (char === "[") depth++;
|
|
9817
9907
|
else if (char === "]") depth--;
|
|
9818
9908
|
}
|
|
9819
|
-
|
|
9909
|
+
bodies.push(call.slice(start, index - 1));
|
|
9910
|
+
}
|
|
9911
|
+
return bodies;
|
|
9912
|
+
}
|
|
9913
|
+
function settingFeatures(call, setting) {
|
|
9914
|
+
const found = [];
|
|
9915
|
+
for (const body of settingsBlocks(call, "swift")) {
|
|
9916
|
+
if (setting === ".unsafeFlags") {
|
|
9917
|
+
for (const list of body.matchAll(/\.unsafeFlags\(\s*\[([^\]]*)\]/g))
|
|
9918
|
+
for (const match of list[1].matchAll(/"((?:[^"\\]|\\.)*)"/g))
|
|
9919
|
+
found.push(JSON.parse(`"${match[1]}"`));
|
|
9920
|
+
} else {
|
|
9921
|
+
const name2 = "([A-Za-z_][A-Za-z0-9_]*(?:=[A-Za-z_][A-Za-z0-9_.-]*)?)";
|
|
9922
|
+
const pattern = setting === ".enableExperimentalFeature" ? new RegExp(`\\.enableExperimentalFeature\\(\\s*"${name2}"\\s*\\)`, "g") : new RegExp(`\\.enableUpcomingFeature\\(\\s*"${name2}"\\s*\\)`, "g");
|
|
9923
|
+
for (const match of body.matchAll(pattern)) found.push(match[1]);
|
|
9924
|
+
}
|
|
9925
|
+
}
|
|
9926
|
+
return found;
|
|
9927
|
+
}
|
|
9928
|
+
function settingDefines(call, tool) {
|
|
9929
|
+
const defines = [];
|
|
9930
|
+
for (const body of settingsBlocks(call, tool)) {
|
|
9820
9931
|
for (const match of body.matchAll(
|
|
9821
|
-
/\.define\(\s*"([A-Za-z_][A-Za-z0-9_]*)"\s*(?:,\s*to:\s*"([^"]*)"\s*)?\)/g
|
|
9822
|
-
))
|
|
9823
|
-
|
|
9932
|
+
/\.define\(\s*"([A-Za-z_][A-Za-z0-9_]*)"\s*(?:,\s*to:\s*"((?:[^"\\]|\\.)*)"\s*)?\)/g
|
|
9933
|
+
)) {
|
|
9934
|
+
const name2 = match[1];
|
|
9935
|
+
defines.push(
|
|
9936
|
+
match[2] === void 0 ? name2 : `${name2}=${match[2].replace(/\\(.)/g, (_, escape) => {
|
|
9937
|
+
const value = swiftEscapes[escape];
|
|
9938
|
+
if (value === void 0)
|
|
9939
|
+
throw new Error(
|
|
9940
|
+
`Unsupported escape \\${escape} in the value of macro ${name2}`
|
|
9941
|
+
);
|
|
9942
|
+
return value;
|
|
9943
|
+
})}`
|
|
9944
|
+
);
|
|
9945
|
+
}
|
|
9824
9946
|
}
|
|
9825
9947
|
return defines;
|
|
9826
9948
|
}
|
|
@@ -9852,6 +9974,9 @@ function swiftManifestTargets(manifest, resourcePaths = []) {
|
|
|
9852
9974
|
call.replace(/"(?:\\.|[^"\\])*"/g, "")
|
|
9853
9975
|
);
|
|
9854
9976
|
const defines = settingDefines(call, "swift").map((define) => define.split("=")[0]);
|
|
9977
|
+
const experimentalFeatures = settingFeatures(call, ".enableExperimentalFeature");
|
|
9978
|
+
const upcomingFeatures = settingFeatures(call, ".enableUpcomingFeature");
|
|
9979
|
+
const swiftFlags = settingFeatures(call, ".unsafeFlags");
|
|
9855
9980
|
const cDefines = settingDefines(call, "c");
|
|
9856
9981
|
const cxxDefines = settingDefines(call, "cxx");
|
|
9857
9982
|
const linkedLibraries = [...call.matchAll(/\.linkedLibrary\(\s*"([^"]+)"\s*\)/g)].map(
|
|
@@ -9896,6 +10021,9 @@ function swiftManifestTargets(manifest, resourcePaths = []) {
|
|
|
9896
10021
|
mainActorIsolation,
|
|
9897
10022
|
...cxxInterop ? { cxxInterop: true } : {},
|
|
9898
10023
|
...defines.length === 0 ? {} : { defines },
|
|
10024
|
+
...experimentalFeatures.length === 0 ? {} : { experimentalFeatures },
|
|
10025
|
+
...upcomingFeatures.length === 0 ? {} : { upcomingFeatures },
|
|
10026
|
+
...swiftFlags.length === 0 ? {} : { swiftFlags },
|
|
9899
10027
|
...cDefines.length === 0 ? {} : { cDefines },
|
|
9900
10028
|
...cxxDefines.length === 0 ? {} : { cxxDefines },
|
|
9901
10029
|
...linkedLibraries.length === 0 ? {} : { linkedLibraries },
|
|
@@ -9983,13 +10111,13 @@ function swiftObjCResourceAccessor(bundleName) {
|
|
|
9983
10111
|
}
|
|
9984
10112
|
function swiftPackagePartition(manifest, resourcePaths = []) {
|
|
9985
10113
|
const targets = swiftManifestTargets(manifest, resourcePaths);
|
|
9986
|
-
return targets.length === 1 && targets[0].executable && targets[0].path === "." && targets[0].languageMode === 5 && !targets[0].mainActorIsolation && !targets[0].defines?.length && !targets[0].linkedLibraries?.length && !targets[0].cxxInterop && !swiftManifestCxxLanguageStandard(manifest) ? [] : targets;
|
|
10114
|
+
return targets.length === 1 && targets[0].executable && targets[0].path === "." && targets[0].languageMode === 5 && !targets[0].mainActorIsolation && !targets[0].defines?.length && !targets[0].experimentalFeatures?.length && !targets[0].upcomingFeatures?.length && !targets[0].swiftFlags?.length && !targets[0].linkedLibraries?.length && !targets[0].cxxInterop && !swiftManifestCxxLanguageStandard(manifest) ? [] : targets;
|
|
9987
10115
|
}
|
|
9988
10116
|
|
|
9989
10117
|
// src/swift-root-lock.ts
|
|
9990
10118
|
import {
|
|
9991
10119
|
spawn as spawn2,
|
|
9992
|
-
spawnSync as
|
|
10120
|
+
spawnSync as spawnSync6
|
|
9993
10121
|
} from "node:child_process";
|
|
9994
10122
|
import { createHash as createHash8, randomUUID as randomUUID2 } from "node:crypto";
|
|
9995
10123
|
import {
|
|
@@ -10000,7 +10128,7 @@ import {
|
|
|
10000
10128
|
rmSync as rmSync2,
|
|
10001
10129
|
writeFileSync as writeFileSync2
|
|
10002
10130
|
} from "node:fs";
|
|
10003
|
-
import
|
|
10131
|
+
import path10 from "node:path";
|
|
10004
10132
|
var POLL_MS = 250;
|
|
10005
10133
|
var START_TOLERANCE_MS = 2e3;
|
|
10006
10134
|
function errorCode(error) {
|
|
@@ -10012,7 +10140,7 @@ function parseStart(text3) {
|
|
|
10012
10140
|
return start;
|
|
10013
10141
|
}
|
|
10014
10142
|
function processTable() {
|
|
10015
|
-
const result =
|
|
10143
|
+
const result = spawnSync6("ps", ["-A", "-o", "pid=,pgid=,stat=,lstart="], {
|
|
10016
10144
|
encoding: "utf8",
|
|
10017
10145
|
env: { ...process.env, LC_ALL: "C", TZ: "UTC" },
|
|
10018
10146
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -10075,7 +10203,7 @@ function generationNumbers(directory) {
|
|
|
10075
10203
|
function readGeneration(directory, number) {
|
|
10076
10204
|
let owner;
|
|
10077
10205
|
try {
|
|
10078
|
-
owner = readFileSync5(
|
|
10206
|
+
owner = readFileSync5(path10.join(directory, name(number, "owner")), "utf8");
|
|
10079
10207
|
} catch (error) {
|
|
10080
10208
|
if (errorCode(error) === "ENOENT") return null;
|
|
10081
10209
|
throw error;
|
|
@@ -10088,7 +10216,7 @@ function readGeneration(directory, number) {
|
|
|
10088
10216
|
}
|
|
10089
10217
|
function readChildren(directory, number) {
|
|
10090
10218
|
const prefix = name(number, "child.");
|
|
10091
|
-
return readdirSync3(directory).filter((entry) => entry.startsWith(prefix)).map((entry) => parseIdentity(readFileSync5(
|
|
10219
|
+
return readdirSync3(directory).filter((entry) => entry.startsWith(prefix)).map((entry) => parseIdentity(readFileSync5(path10.join(directory, entry), "utf8")));
|
|
10092
10220
|
}
|
|
10093
10221
|
function groupAlive(table, leader) {
|
|
10094
10222
|
const row = table.find((candidate) => candidate.pid === leader.pid);
|
|
@@ -10096,7 +10224,7 @@ function groupAlive(table, leader) {
|
|
|
10096
10224
|
return table.some((candidate) => candidate.pgid === leader.pid && !candidate.zombie);
|
|
10097
10225
|
}
|
|
10098
10226
|
async function withSwiftRootLock(root, work, signal) {
|
|
10099
|
-
const directory =
|
|
10227
|
+
const directory = path10.join(
|
|
10100
10228
|
rnxHomeDir(),
|
|
10101
10229
|
"cache",
|
|
10102
10230
|
"swift-root-locks",
|
|
@@ -10105,7 +10233,7 @@ async function withSwiftRootLock(root, work, signal) {
|
|
|
10105
10233
|
mkdirSync(directory, { recursive: true });
|
|
10106
10234
|
const token = randomUUID2();
|
|
10107
10235
|
const owner = JSON.stringify(ownIdentity(process.pid));
|
|
10108
|
-
const pending =
|
|
10236
|
+
const pending = path10.join(directory, `pending.${token}`);
|
|
10109
10237
|
let held = 0;
|
|
10110
10238
|
for (; ; ) {
|
|
10111
10239
|
signal?.throwIfAborted();
|
|
@@ -10126,7 +10254,7 @@ async function withSwiftRootLock(root, work, signal) {
|
|
|
10126
10254
|
}
|
|
10127
10255
|
writeFileSync2(pending, owner);
|
|
10128
10256
|
try {
|
|
10129
|
-
linkSync(pending,
|
|
10257
|
+
linkSync(pending, path10.join(directory, name(newest + 1, "owner")));
|
|
10130
10258
|
} catch (error) {
|
|
10131
10259
|
if (errorCode(error) === "EEXIST") continue;
|
|
10132
10260
|
throw error;
|
|
@@ -10135,7 +10263,7 @@ async function withSwiftRootLock(root, work, signal) {
|
|
|
10135
10263
|
}
|
|
10136
10264
|
const numbers = generationNumbers(directory);
|
|
10137
10265
|
if (numbers.at(-1) !== newest + 1) {
|
|
10138
|
-
rmSync2(
|
|
10266
|
+
rmSync2(path10.join(directory, name(newest + 1, "owner")), { force: true });
|
|
10139
10267
|
continue;
|
|
10140
10268
|
}
|
|
10141
10269
|
held = newest + 1;
|
|
@@ -10143,7 +10271,7 @@ async function withSwiftRootLock(root, work, signal) {
|
|
|
10143
10271
|
if (number < held) {
|
|
10144
10272
|
for (const entry of readdirSync3(directory))
|
|
10145
10273
|
if (entry.startsWith(name(number, "")))
|
|
10146
|
-
rmSync2(
|
|
10274
|
+
rmSync2(path10.join(directory, entry), { force: true });
|
|
10147
10275
|
}
|
|
10148
10276
|
break;
|
|
10149
10277
|
}
|
|
@@ -10167,7 +10295,7 @@ async function withSwiftRootLock(root, work, signal) {
|
|
|
10167
10295
|
const childPending = `${pending}.child.${child.pid}`;
|
|
10168
10296
|
try {
|
|
10169
10297
|
writeFileSync2(childPending, JSON.stringify(ownIdentity(child.pid)));
|
|
10170
|
-
linkSync(childPending,
|
|
10298
|
+
linkSync(childPending, path10.join(directory, name(held, `child.${child.pid}`)));
|
|
10171
10299
|
} finally {
|
|
10172
10300
|
rmSync2(childPending, { force: true });
|
|
10173
10301
|
}
|
|
@@ -10183,7 +10311,7 @@ async function withSwiftRootLock(root, work, signal) {
|
|
|
10183
10311
|
return await work(lease);
|
|
10184
10312
|
} finally {
|
|
10185
10313
|
await Promise.all(children.map((child) => terminateProcessGroup(child, "SIGKILL", 0)));
|
|
10186
|
-
writeFileSync2(
|
|
10314
|
+
writeFileSync2(path10.join(directory, name(held, "released")), "");
|
|
10187
10315
|
}
|
|
10188
10316
|
}
|
|
10189
10317
|
|
|
@@ -10239,7 +10367,7 @@ function isSwiftResourceBundles(value) {
|
|
|
10239
10367
|
|
|
10240
10368
|
// src/xcode-header-search.ts
|
|
10241
10369
|
import fs5 from "node:fs";
|
|
10242
|
-
import
|
|
10370
|
+
import path11 from "node:path";
|
|
10243
10371
|
function headerMap(entries) {
|
|
10244
10372
|
const unique = /* @__PURE__ */ new Map();
|
|
10245
10373
|
for (const entry of entries)
|
|
@@ -10286,11 +10414,11 @@ function writeXcodeHeaderSearch(directory, targets) {
|
|
|
10286
10414
|
const productDirectories = /* @__PURE__ */ new Map();
|
|
10287
10415
|
for (const target of targets)
|
|
10288
10416
|
for (const [product, file] of Object.entries(target.productHeaders)) {
|
|
10289
|
-
const listed = productDirectories.get(
|
|
10290
|
-
productDirectories.set(
|
|
10291
|
-
listed.push({ name:
|
|
10417
|
+
const listed = productDirectories.get(path11.dirname(product)) ?? [];
|
|
10418
|
+
productDirectories.set(path11.dirname(product), listed);
|
|
10419
|
+
listed.push({ name: path11.basename(product), file });
|
|
10292
10420
|
}
|
|
10293
|
-
const overlay =
|
|
10421
|
+
const overlay = path11.join(directory, "all-product-headers.yaml");
|
|
10294
10422
|
fs5.writeFileSync(
|
|
10295
10423
|
overlay,
|
|
10296
10424
|
JSON.stringify({
|
|
@@ -10310,7 +10438,7 @@ function writeXcodeHeaderSearch(directory, targets) {
|
|
|
10310
10438
|
const files = [overlay];
|
|
10311
10439
|
const flags = targets.map((target, index) => {
|
|
10312
10440
|
const maps = target.headerMaps.map((map2, order) => {
|
|
10313
|
-
const file =
|
|
10441
|
+
const file = path11.join(directory, `${index}-${order}.hmap`);
|
|
10314
10442
|
fs5.writeFileSync(file, headerMap(map2.entries));
|
|
10315
10443
|
files.push(file);
|
|
10316
10444
|
return { flag: map2.flag, file };
|
|
@@ -10427,7 +10555,7 @@ function swiftBuilderHopTimeoutMs(compileTimeoutMs) {
|
|
|
10427
10555
|
return (compileTimeoutMs ?? SWIFT_BUILDER_DEFAULT_COMPILE_MS) + SWIFT_BUILDER_TRANSPORT_MARGIN_MS;
|
|
10428
10556
|
}
|
|
10429
10557
|
function swiftDistributionAt(root) {
|
|
10430
|
-
const file =
|
|
10558
|
+
const file = path12.join(root, SWIFT_DISTRIBUTION_MANIFEST);
|
|
10431
10559
|
if (!existsSync2(file)) return null;
|
|
10432
10560
|
return parseSwiftDistributionManifest(JSON.parse(readFileSync6(file, "utf8")));
|
|
10433
10561
|
}
|
|
@@ -10456,7 +10584,7 @@ function swiftModuleInputFiles(root) {
|
|
|
10456
10584
|
"toolchain.json"
|
|
10457
10585
|
];
|
|
10458
10586
|
const walk = (dir) => {
|
|
10459
|
-
for (const entry of readdirSync4(
|
|
10587
|
+
for (const entry of readdirSync4(path12.join(root, dir), {
|
|
10460
10588
|
withFileTypes: true
|
|
10461
10589
|
})) {
|
|
10462
10590
|
const relative = `${dir}/${entry.name}`;
|
|
@@ -10474,32 +10602,32 @@ function swiftMacroPlugins(moduleRoot) {
|
|
|
10474
10602
|
const distribution = swiftDistributionAt(moduleRoot);
|
|
10475
10603
|
if (distribution)
|
|
10476
10604
|
return {
|
|
10477
|
-
libraries: distribution.plugins.map((plugin) =>
|
|
10605
|
+
libraries: distribution.plugins.map((plugin) => path12.join(moduleRoot, plugin)),
|
|
10478
10606
|
stale: false
|
|
10479
10607
|
};
|
|
10480
|
-
const dir =
|
|
10608
|
+
const dir = path12.join(moduleRoot, ".build/host/RnxPreviewMacros");
|
|
10481
10609
|
const release = JSON.parse(
|
|
10482
|
-
readFileSync6(
|
|
10610
|
+
readFileSync6(path12.join(moduleRoot, "toolchain.json"), "utf8")
|
|
10483
10611
|
).release;
|
|
10484
|
-
const compilerStamp =
|
|
10612
|
+
const compilerStamp = path12.join(dir, "compiler-release");
|
|
10485
10613
|
const ext = process.platform === "darwin" ? "dylib" : "so";
|
|
10486
10614
|
const plugins = [
|
|
10487
10615
|
{
|
|
10488
|
-
library:
|
|
10489
|
-
sources: [
|
|
10616
|
+
library: path12.join(dir, `libRnxPreviewMacros.${ext}`),
|
|
10617
|
+
sources: [path12.join(moduleRoot, "Sources/RnxPreviewMacros/PreviewMacro.swift")]
|
|
10490
10618
|
},
|
|
10491
10619
|
{
|
|
10492
|
-
library:
|
|
10620
|
+
library: path12.join(dir, `libFoundationMacros.${ext}`),
|
|
10493
10621
|
sources: [
|
|
10494
|
-
|
|
10495
|
-
|
|
10622
|
+
path12.join(moduleRoot, "Sources/FoundationMacros/PredicateMacro.swift"),
|
|
10623
|
+
path12.join(moduleRoot, "Sources/SwiftMacroSupport/PredicateExpression.swift")
|
|
10496
10624
|
]
|
|
10497
10625
|
},
|
|
10498
10626
|
{
|
|
10499
|
-
library:
|
|
10627
|
+
library: path12.join(dir, `libTipKitMacros.${ext}`),
|
|
10500
10628
|
sources: [
|
|
10501
|
-
|
|
10502
|
-
|
|
10629
|
+
path12.join(moduleRoot, "Sources/TipKitMacros/TipKitMacros.swift"),
|
|
10630
|
+
path12.join(moduleRoot, "Sources/SwiftMacroSupport/PredicateExpression.swift")
|
|
10503
10631
|
]
|
|
10504
10632
|
}
|
|
10505
10633
|
];
|
|
@@ -10516,14 +10644,14 @@ async function ensureMacroPlugins(moduleRoot, toolchainBin, release, signal) {
|
|
|
10516
10644
|
await runCompiler(
|
|
10517
10645
|
"sh",
|
|
10518
10646
|
[
|
|
10519
|
-
|
|
10647
|
+
path12.join(moduleRoot, "scripts/build-preview-plugin.sh"),
|
|
10520
10648
|
toolchainBin,
|
|
10521
10649
|
libraries[0]
|
|
10522
10650
|
],
|
|
10523
10651
|
{ signal }
|
|
10524
10652
|
);
|
|
10525
10653
|
writeFileSync3(
|
|
10526
|
-
|
|
10654
|
+
path12.join(path12.dirname(libraries[0]), "compiler-release"),
|
|
10527
10655
|
`${release}
|
|
10528
10656
|
`
|
|
10529
10657
|
);
|
|
@@ -10539,7 +10667,7 @@ function swiftModuleDigest(root) {
|
|
|
10539
10667
|
const files = swiftModuleInputFiles(root);
|
|
10540
10668
|
const stampHash = createHash9("sha256");
|
|
10541
10669
|
for (const file of files) {
|
|
10542
|
-
const stat = statSync(
|
|
10670
|
+
const stat = statSync(path12.join(root, file), { bigint: true });
|
|
10543
10671
|
stampHash.update(file);
|
|
10544
10672
|
stampHash.update(
|
|
10545
10673
|
`${stat.dev}:${stat.ino}:${stat.size}:${stat.mtimeNs}:${stat.ctimeNs}
|
|
@@ -10553,7 +10681,7 @@ function swiftModuleDigest(root) {
|
|
|
10553
10681
|
for (const file of files) {
|
|
10554
10682
|
hash2.update(createHash9("sha256").update(file).digest());
|
|
10555
10683
|
hash2.update(
|
|
10556
|
-
createHash9("sha256").update(readFileSync6(
|
|
10684
|
+
createHash9("sha256").update(readFileSync6(path12.join(root, file))).digest()
|
|
10557
10685
|
);
|
|
10558
10686
|
}
|
|
10559
10687
|
const digest = hash2.digest();
|
|
@@ -10577,7 +10705,7 @@ function withNativeSourceGlue(input, glue) {
|
|
|
10577
10705
|
...input,
|
|
10578
10706
|
files: {
|
|
10579
10707
|
...input.files,
|
|
10580
|
-
[
|
|
10708
|
+
[path12.posix.join(targetPath, "OneNativeSource.generated.swift")]: glue
|
|
10581
10709
|
},
|
|
10582
10710
|
oneModule: true
|
|
10583
10711
|
};
|
|
@@ -10702,7 +10830,7 @@ function swiftImportNames(contents, available) {
|
|
|
10702
10830
|
function swiftPeachModules(moduleRoot) {
|
|
10703
10831
|
const distribution = swiftDistributionAt(moduleRoot);
|
|
10704
10832
|
return distribution ? distribution.modules : [
|
|
10705
|
-
...readFileSync6(
|
|
10833
|
+
...readFileSync6(path12.join(moduleRoot, "Package.swift"), "utf8").matchAll(
|
|
10706
10834
|
/\.(?:target|systemLibrary)\(\s*name:\s*"([^"]+)"/g
|
|
10707
10835
|
)
|
|
10708
10836
|
].map((match) => match[1]);
|
|
@@ -10714,7 +10842,7 @@ function swiftSdkPaths(moduleRoot, toolchainBin) {
|
|
|
10714
10842
|
const cached = sdkPaths.get(key);
|
|
10715
10843
|
if (cached) return cached;
|
|
10716
10844
|
const configuration = execFileSync3(
|
|
10717
|
-
|
|
10845
|
+
path12.join(toolchainBin, "swift"),
|
|
10718
10846
|
[
|
|
10719
10847
|
"sdk",
|
|
10720
10848
|
"configure",
|
|
@@ -10745,12 +10873,12 @@ function swiftAvailableModules(moduleRoot, toolchainBin) {
|
|
|
10745
10873
|
if (cached) return cached;
|
|
10746
10874
|
const modules = new Set(swiftPeachModules(moduleRoot));
|
|
10747
10875
|
const { resources } = swiftSdkPaths(moduleRoot, toolchainBin);
|
|
10748
|
-
for (const entry of readdirSync4(
|
|
10876
|
+
for (const entry of readdirSync4(path12.join(resources, "wasi"))) {
|
|
10749
10877
|
if (entry.endsWith(".swiftmodule"))
|
|
10750
10878
|
modules.add(entry.slice(0, -".swiftmodule".length));
|
|
10751
10879
|
}
|
|
10752
10880
|
for (const entry of readdirSync4(resources)) {
|
|
10753
|
-
const map2 =
|
|
10881
|
+
const map2 = path12.join(resources, entry, "module.modulemap");
|
|
10754
10882
|
if (!existsSync2(map2)) continue;
|
|
10755
10883
|
for (const match of readFileSync6(map2, "utf8").matchAll(/^module\s+([A-Za-z_]\w*)/gm))
|
|
10756
10884
|
modules.add(match[1]);
|
|
@@ -10758,12 +10886,14 @@ function swiftAvailableModules(moduleRoot, toolchainBin) {
|
|
|
10758
10886
|
availableModules.set(key, modules);
|
|
10759
10887
|
return modules;
|
|
10760
10888
|
}
|
|
10761
|
-
function missingSwiftModules(files, available) {
|
|
10889
|
+
function missingSwiftModules(files, available, providedByFile = () => []) {
|
|
10762
10890
|
const missing = /* @__PURE__ */ new Map();
|
|
10763
10891
|
for (const [file, contents] of Object.entries(files)) {
|
|
10764
10892
|
if (!file.endsWith(".swift") || file === "Package.swift") continue;
|
|
10765
|
-
|
|
10766
|
-
|
|
10893
|
+
const extra = providedByFile(file);
|
|
10894
|
+
const scoped = extra.length === 0 ? available : /* @__PURE__ */ new Set([...available, ...extra]);
|
|
10895
|
+
for (const name2 of new Set(swiftImportNames(contents, scoped))) {
|
|
10896
|
+
if (scoped.has(name2)) continue;
|
|
10767
10897
|
missing.set(name2, [...missing.get(name2) ?? [], file]);
|
|
10768
10898
|
}
|
|
10769
10899
|
}
|
|
@@ -10816,7 +10946,7 @@ var EXECUTABLE_LINK_FLAGS = ` "-Xclang-linker", "-O0",
|
|
|
10816
10946
|
`;
|
|
10817
10947
|
var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
|
|
10818
10948
|
var MULTI_MANIFEST_VERSION = 40;
|
|
10819
|
-
var compilerSourceDigest = true ? "
|
|
10949
|
+
var compilerSourceDigest = true ? "25e399c85c279ad057ea8e9dac685fe538c7bda43eb7708cf1a32edcb229391d" : swiftCompilerSourceDigest(import.meta.dirname);
|
|
10820
10950
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
10821
10951
|
const hash2 = createHash9("sha256");
|
|
10822
10952
|
hash2.update(`swift-compile
|
|
@@ -10912,11 +11042,11 @@ function emitSwiftPackageManifest(args) {
|
|
|
10912
11042
|
distributionLink.files.set(
|
|
10913
11043
|
distributionLink.path,
|
|
10914
11044
|
objects.map(
|
|
10915
|
-
(object) => `"${
|
|
11045
|
+
(object) => `"${path12.join(moduleRoot, object).replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`
|
|
10916
11046
|
).join("\n") + "\n"
|
|
10917
11047
|
);
|
|
10918
11048
|
}
|
|
10919
|
-
const overlayRoot =
|
|
11049
|
+
const overlayRoot = path12.join(
|
|
10920
11050
|
moduleRoot,
|
|
10921
11051
|
distribution ? "modules" : "cross-import-overlays"
|
|
10922
11052
|
);
|
|
@@ -10924,9 +11054,9 @@ function emitSwiftPackageManifest(args) {
|
|
|
10924
11054
|
"-Xfrontend",
|
|
10925
11055
|
"-swift-module-cross-import",
|
|
10926
11056
|
"-Xfrontend",
|
|
10927
|
-
|
|
11057
|
+
path12.basename(path12.dirname(file), ".swiftcrossimport"),
|
|
10928
11058
|
"-Xfrontend",
|
|
10929
|
-
|
|
11059
|
+
path12.join(overlayRoot, file)
|
|
10930
11060
|
]).map((flag) => `, ${JSON.stringify(flag)}`).join("");
|
|
10931
11061
|
const executable = targets.find((target) => target.executable);
|
|
10932
11062
|
if (!executable) throw new Error("swift-compile: no executable target to emit");
|
|
@@ -10941,7 +11071,10 @@ function emitSwiftPackageManifest(args) {
|
|
|
10941
11071
|
const interoperability = target.cxxInterop ? " .interoperabilityMode(.Cxx)," : "";
|
|
10942
11072
|
const exports = args.objcExports?.modules.has(target.name) || args.objcExports?.rootModule === target.name ? ' .enableExperimentalFeature("Extern"),' : "";
|
|
10943
11073
|
const defines = (target.defines ?? []).map((name2) => ` .define(${JSON.stringify(name2)}),`).join("");
|
|
10944
|
-
const
|
|
11074
|
+
const features = (target.experimentalFeatures ?? []).map((name2) => ` .enableExperimentalFeature(${JSON.stringify(name2)}),`).join("");
|
|
11075
|
+
const upcoming = (target.upcomingFeatures ?? []).map((name2) => ` .enableUpcomingFeature(${JSON.stringify(name2)}),`).join("");
|
|
11076
|
+
const upstream = (target.swiftFlags ?? []).map((flag) => `, ${JSON.stringify(flag)}`).join("");
|
|
11077
|
+
const imports = distribution ? `, "-I", ${JSON.stringify(path12.join(moduleRoot, "modules"))}` : "";
|
|
10945
11078
|
const native = args.native?.get(target.name);
|
|
10946
11079
|
const clang = native && !native.mixed;
|
|
10947
11080
|
const nativeImports = (siblings.get(target.name) ?? []).filter((name2) => args.native?.has(name2) && !args.native.get(name2)?.mixed).map(
|
|
@@ -10961,8 +11094,8 @@ function emitSwiftPackageManifest(args) {
|
|
|
10961
11094
|
const nativeImportFlags = [...importContext].flatMap((name2) => args.native?.get(name2)?.clang?.importFlags ?? []).map((flag) => `, "-Xcc", ${JSON.stringify(flag)}`).join("");
|
|
10962
11095
|
const header = args.headerDirectory && [...args.native?.values() ?? []].some(
|
|
10963
11096
|
(value) => value.late?.producers.includes(target.name)
|
|
10964
|
-
) ? `, "-emit-objc-header-path", ${JSON.stringify(
|
|
10965
|
-
const swiftSettings = `swiftSettings: [.swiftLanguageMode(.v${target.languageMode}),${isolation}${interoperability}${defines}${exports} .unsafeFlags(["-Osize", "-Xfrontend", "-enable-cross-import-overlays"${overlayFlags}${FOUNDATION_IMPLICIT_FLAGS}${oneModule ? ONE_IMPLICIT_FLAGS : ""}${imports}${nativeImports}${nativeImportFlags}${header}])]`;
|
|
11097
|
+
) ? `, "-emit-objc-header-path", ${JSON.stringify(path12.join(args.headerDirectory, `${target.name}-${args.objcExports?.modules.has(target.name) ? "Cxx" : "Swift"}.h`))}` : "";
|
|
11098
|
+
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}])]`;
|
|
10966
11099
|
const deps = [
|
|
10967
11100
|
.../* @__PURE__ */ new Set([
|
|
10968
11101
|
...target.executable ? [
|
|
@@ -11013,11 +11146,11 @@ function emitSwiftPackageManifest(args) {
|
|
|
11013
11146
|
const cDefines = macroSettings(target.cDefines);
|
|
11014
11147
|
const cxxDefines = macroSettings(target.cxxDefines);
|
|
11015
11148
|
const nativeSettings = native?.clang ? [
|
|
11016
|
-
`cSettings: [${cDefines} .unsafeFlags(${JSON.stringify([...args.
|
|
11017
|
-
`cxxSettings: [${cxxDefines} .unsafeFlags(${JSON.stringify(["-fno-cxx-modules", ...args.
|
|
11149
|
+
`cSettings: [${cDefines} .unsafeFlags(${JSON.stringify([...args.nativeFlags?.get(target.name) ?? [], ...native.clang.flags])})]`,
|
|
11150
|
+
`cxxSettings: [${cxxDefines} .unsafeFlags(${JSON.stringify(["-fno-cxx-modules", ...args.nativeFlags?.get(target.name) ?? [], ...native.clang.cxxFlags])})]`
|
|
11018
11151
|
].join(", ") : [
|
|
11019
|
-
`cSettings: [${cDefines} .unsafeFlags(${JSON.stringify([...args.
|
|
11020
|
-
`cxxSettings: [${cxxDefines} .unsafeFlags(${JSON.stringify(["-fno-cxx-modules", ...args.
|
|
11152
|
+
`cSettings: [${cDefines} .unsafeFlags(${JSON.stringify([...args.nativeFlags?.get(target.name) ?? [], ...native?.flags ?? []])})]`,
|
|
11153
|
+
`cxxSettings: [${cxxDefines} .unsafeFlags(${JSON.stringify(["-fno-cxx-modules", ...args.nativeFlags?.get(target.name) ?? [], ...native?.cxxFlags ?? []])})]`
|
|
11021
11154
|
].join(", ");
|
|
11022
11155
|
return [
|
|
11023
11156
|
` ${kind}(`,
|
|
@@ -11026,8 +11159,8 @@ function emitSwiftPackageManifest(args) {
|
|
|
11026
11159
|
` path: ${JSON.stringify(native?.clang ? "." : target.path)},`,
|
|
11027
11160
|
...native ? [` exclude: ${JSON.stringify(native.exclude ?? native.lateSources)},`] : [],
|
|
11028
11161
|
...native?.clang ? [
|
|
11029
|
-
` sources: ${JSON.stringify(native.clang.sources.map((source) =>
|
|
11030
|
-
` publicHeadersPath: ${JSON.stringify(
|
|
11162
|
+
` sources: ${JSON.stringify(native.clang.sources.map((source) => path12.posix.join(native.path, source)))},`,
|
|
11163
|
+
` publicHeadersPath: ${JSON.stringify(path12.posix.dirname(native.clang.modulemap))},`
|
|
11031
11164
|
] : native?.flags ? [` sources: ${JSON.stringify(native.sources)},`] : [],
|
|
11032
11165
|
// the native backend supplies dependency module maps without their
|
|
11033
11166
|
// compiled modules. textual c++ includes keep those dependencies usable.
|
|
@@ -11052,7 +11185,7 @@ function emitSwiftPackageManifest(args) {
|
|
|
11052
11185
|
' path: "PeachObjCExports",',
|
|
11053
11186
|
` sources: ${JSON.stringify(["root.m", ...[...args.objcExports.modules].map((name2) => `${name2}.m`)])},`,
|
|
11054
11187
|
' publicHeadersPath: "include",',
|
|
11055
|
-
` cSettings: [.unsafeFlags(${JSON.stringify([...args.objcExports.
|
|
11188
|
+
` cSettings: [.unsafeFlags(${JSON.stringify([...args.nativeFlags.get(args.objcExports.rootModule).filter((flag) => flag !== "-fobjc-arc"), "-fno-objc-arc", "-Xclang", "-disable-objc-default-synthesize-properties"])})]),`
|
|
11056
11189
|
] : [],
|
|
11057
11190
|
...[...args.native?.entries() ?? []].flatMap(([name2, native]) => {
|
|
11058
11191
|
const late = native.late;
|
|
@@ -11068,10 +11201,10 @@ function emitSwiftPackageManifest(args) {
|
|
|
11068
11201
|
` .target(name: ${JSON.stringify(group.name)},`,
|
|
11069
11202
|
` dependencies: ${JSON.stringify(native.mixed ? [] : [name2, ...late.producers])},`,
|
|
11070
11203
|
` path: ${JSON.stringify(native.clang ? "." : native.path)},`,
|
|
11071
|
-
` sources: ${JSON.stringify(native.clang ? group.sources.map((source) =>
|
|
11072
|
-
` publicHeadersPath: ${JSON.stringify(native.clang ?
|
|
11073
|
-
` cSettings: [${macroSettings(owner?.cDefines)} .unsafeFlags(${JSON.stringify([...args.
|
|
11074
|
-
` cxxSettings: [${macroSettings(owner?.cxxDefines)} .unsafeFlags(${JSON.stringify(["-fno-cxx-modules", ...args.
|
|
11204
|
+
` sources: ${JSON.stringify(native.clang ? group.sources.map((source) => path12.posix.join(native.path, source)) : group.sources)},`,
|
|
11205
|
+
` publicHeadersPath: ${JSON.stringify(native.clang ? path12.posix.dirname(native.clang.modulemap) : "include")},`,
|
|
11206
|
+
` cSettings: [${macroSettings(owner?.cDefines)} .unsafeFlags(${JSON.stringify([...args.nativeFlags?.get(name2) ?? [], ...group.flags])})],`,
|
|
11207
|
+
` cxxSettings: [${macroSettings(owner?.cxxDefines)} .unsafeFlags(${JSON.stringify(["-fno-cxx-modules", ...args.nativeFlags?.get(name2) ?? [], "-I", native.includeDirectory, "-I", args.headerDirectory, ...group.cxxFlags])})]),`
|
|
11075
11208
|
]) : [];
|
|
11076
11209
|
}),
|
|
11077
11210
|
args.cxxLanguageStandard ? ` ],
|
|
@@ -11084,7 +11217,7 @@ function syncSwiftTree(base, files) {
|
|
|
11084
11217
|
mkdirSync2(base, { recursive: true });
|
|
11085
11218
|
const walk = (dir) => {
|
|
11086
11219
|
for (const entry of readdirSync4(dir, { withFileTypes: true })) {
|
|
11087
|
-
const full =
|
|
11220
|
+
const full = path12.join(dir, entry.name);
|
|
11088
11221
|
if (dir === base && entry.name === ".build") continue;
|
|
11089
11222
|
if (entry.isDirectory()) walk(full);
|
|
11090
11223
|
else if (!files.has(full)) rmSync3(full, { force: true });
|
|
@@ -11094,7 +11227,7 @@ function syncSwiftTree(base, files) {
|
|
|
11094
11227
|
for (const [full, contents] of files) {
|
|
11095
11228
|
if (existsSync2(full) && (typeof contents === "string" ? readFileSync6(full, "utf8") === contents : readFileSync6(full).equals(contents)))
|
|
11096
11229
|
continue;
|
|
11097
|
-
mkdirSync2(
|
|
11230
|
+
mkdirSync2(path12.dirname(full), { recursive: true });
|
|
11098
11231
|
writeFileSync3(full, contents);
|
|
11099
11232
|
}
|
|
11100
11233
|
}
|
|
@@ -14870,7 +15003,7 @@ function swiftApplicationEntry(file, source) {
|
|
|
14870
15003
|
else if (source[at] === "}") depth--;
|
|
14871
15004
|
else if (depth === 0 && /^@(?:main|UIApplicationMain)\b/.test(source.slice(at)))
|
|
14872
15005
|
return true;
|
|
14873
|
-
else if (depth === 0 &&
|
|
15006
|
+
else if (depth === 0 && path12.basename(file) === "main.swift" && /^UIApplicationMain\s*\(/.test(source.slice(at)))
|
|
14874
15007
|
return true;
|
|
14875
15008
|
}
|
|
14876
15009
|
return false;
|
|
@@ -14903,7 +15036,7 @@ function installObjcPeerStartup(input, targets, compiled) {
|
|
|
14903
15036
|
);
|
|
14904
15037
|
if (entries.length === 0) {
|
|
14905
15038
|
const source2 = compiled.get(input.entry);
|
|
14906
|
-
if (
|
|
15039
|
+
if (path12.basename(input.entry) !== "main.swift" || source2 === void 0)
|
|
14907
15040
|
fail("requires main.swift or a supported @main App/UIApplicationDelegate entry");
|
|
14908
15041
|
compiled.set(input.entry, `_peachRegisterObjcPeers()
|
|
14909
15042
|
${source2}`);
|
|
@@ -15039,14 +15172,14 @@ function prepareSwiftDependency(source, destination) {
|
|
|
15039
15172
|
for (const entry of readdirSync4(from, { withFileTypes: true })) {
|
|
15040
15173
|
if (entry.name === ".git" || entry.name === ".build" || entry.name === ".swiftpm")
|
|
15041
15174
|
continue;
|
|
15042
|
-
const file =
|
|
15175
|
+
const file = path12.join(from, entry.name);
|
|
15043
15176
|
if (entry.isDirectory()) gather(file);
|
|
15044
15177
|
else if (entry.isFile() && entry.name.endsWith(".swift"))
|
|
15045
|
-
origins[
|
|
15178
|
+
origins[path12.relative(source, file)] = readFileSync6(file, "utf8");
|
|
15046
15179
|
}
|
|
15047
15180
|
};
|
|
15048
15181
|
gather(source);
|
|
15049
|
-
const manifest =
|
|
15182
|
+
const manifest = path12.join(source, "Package.swift");
|
|
15050
15183
|
const targets = existsSync2(manifest) ? swiftManifestTargets(readFileSync6(manifest, "utf8")) : [];
|
|
15051
15184
|
const compiled = compiledSwiftSources(origins, targets);
|
|
15052
15185
|
const copy = (from, to) => {
|
|
@@ -15054,11 +15187,11 @@ function prepareSwiftDependency(source, destination) {
|
|
|
15054
15187
|
for (const entry of readdirSync4(from, { withFileTypes: true })) {
|
|
15055
15188
|
if (entry.name === ".git" || entry.name === ".build" || entry.name === ".swiftpm")
|
|
15056
15189
|
continue;
|
|
15057
|
-
const file =
|
|
15058
|
-
const target =
|
|
15190
|
+
const file = path12.join(from, entry.name);
|
|
15191
|
+
const target = path12.join(to, entry.name);
|
|
15059
15192
|
if (entry.isDirectory()) copy(file, target);
|
|
15060
15193
|
else if (entry.isFile() && entry.name.endsWith(".swift"))
|
|
15061
|
-
writeFileSync3(target, compiled.get(
|
|
15194
|
+
writeFileSync3(target, compiled.get(path12.relative(source, file)));
|
|
15062
15195
|
else cpSync(file, target, { verbatimSymlinks: true });
|
|
15063
15196
|
}
|
|
15064
15197
|
};
|
|
@@ -15080,7 +15213,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15080
15213
|
const targets = distribution && compileTargets(input).length === 0 ? [
|
|
15081
15214
|
{
|
|
15082
15215
|
name: "App",
|
|
15083
|
-
path:
|
|
15216
|
+
path: path12.relative(layout.root, layout.sources),
|
|
15084
15217
|
executable: true,
|
|
15085
15218
|
languageMode: 5,
|
|
15086
15219
|
mainActorIsolation: false,
|
|
@@ -15101,17 +15234,25 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15101
15234
|
);
|
|
15102
15235
|
if (target) swiftTargets.add(target.name);
|
|
15103
15236
|
}
|
|
15104
|
-
const headerDirectory =
|
|
15105
|
-
const headerModuleDirectory =
|
|
15237
|
+
const headerDirectory = path12.join(layout.root, ".build", "peach-cxx-headers");
|
|
15238
|
+
const headerModuleDirectory = path12.join(
|
|
15106
15239
|
layout.root,
|
|
15107
15240
|
".build",
|
|
15108
15241
|
"peach-objc-export-modules"
|
|
15109
15242
|
);
|
|
15110
15243
|
const imports = /* @__PURE__ */ new Map();
|
|
15111
15244
|
const objcProducers = /* @__PURE__ */ new Set();
|
|
15245
|
+
let checkedToolchain;
|
|
15246
|
+
const nativeToolchain = () => {
|
|
15247
|
+
if (checkedToolchain) return checkedToolchain;
|
|
15248
|
+
const pin = distribution ?? JSON.parse(readFileSync6(path12.join(moduleRoot, "toolchain.json"), "utf8"));
|
|
15249
|
+
checkedToolchain = swiftToolchain(pin.release, swiftModuleSdk(moduleRoot));
|
|
15250
|
+
return checkedToolchain;
|
|
15251
|
+
};
|
|
15252
|
+
const deploymentTarget = (name2) => input.nativeTargets?.find((value) => value.name === name2)?.deploymentTarget ?? "16.0";
|
|
15112
15253
|
const targetStagedFiles = /* @__PURE__ */ new Map();
|
|
15113
15254
|
const stageTargetFile = (target, file, contents, options) => {
|
|
15114
|
-
const relative =
|
|
15255
|
+
const relative = path12.relative(layout.root, file).split(path12.sep).join(path12.posix.sep);
|
|
15115
15256
|
const prior = files.has(file) ? files.get(file) : Object.hasOwn(input.files, relative) ? input.files[relative] : void 0;
|
|
15116
15257
|
if (!options?.allowExisting && prior !== void 0)
|
|
15117
15258
|
throw new Error(`target ${target} already contains generated output ${relative}`);
|
|
@@ -15142,7 +15283,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15142
15283
|
targetStagedFiles.delete(target.name);
|
|
15143
15284
|
if (entries.some(([file]) => /\.(?:c|cc|cpp|cxx|m|mm)$/.test(file)) && (swift || input.nativeTargets?.some((value) => value.name === target.name))) {
|
|
15144
15285
|
if (!swift) {
|
|
15145
|
-
const unprepared =
|
|
15286
|
+
const unprepared = path12.join(
|
|
15146
15287
|
layout.root,
|
|
15147
15288
|
target.path,
|
|
15148
15289
|
"PeachUnprepared.generated.swift"
|
|
@@ -15157,7 +15298,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15157
15298
|
native.set(target.name, {
|
|
15158
15299
|
mixed: true,
|
|
15159
15300
|
path: target.path,
|
|
15160
|
-
includeDirectory:
|
|
15301
|
+
includeDirectory: path12.join(layout.root, target.path, "include"),
|
|
15161
15302
|
sources: [],
|
|
15162
15303
|
lateSources: [],
|
|
15163
15304
|
exclude: entries.filter(([file]) => !file.endsWith(".swift") && !file.endsWith(".metal")).map(([file]) => file.slice(prefix.length))
|
|
@@ -15169,26 +15310,26 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15169
15310
|
const contents = input.files[file];
|
|
15170
15311
|
if (contents === void 0)
|
|
15171
15312
|
throw new Error(`missing original Objective-C header ${file}`);
|
|
15172
|
-
const destination =
|
|
15173
|
-
mkdirSync2(
|
|
15313
|
+
const destination = path12.join(layout.root, file);
|
|
15314
|
+
mkdirSync2(path12.dirname(destination), { recursive: true });
|
|
15174
15315
|
writeFileSync3(destination, contents);
|
|
15175
15316
|
files.set(destination, contents);
|
|
15176
15317
|
}
|
|
15177
15318
|
for (const header of settings.publicHeaders) {
|
|
15178
|
-
const destination =
|
|
15319
|
+
const destination = path12.join(headerDirectory, settings.name, path12.basename(header));
|
|
15179
15320
|
if (files.has(destination))
|
|
15180
15321
|
throw new Error(`duplicate product header ${destination}`);
|
|
15181
|
-
const contents = `#import ${JSON.stringify(
|
|
15322
|
+
const contents = `#import ${JSON.stringify(path12.join(layout.root, header))}
|
|
15182
15323
|
`;
|
|
15183
15324
|
files.set(destination, contents);
|
|
15184
|
-
mkdirSync2(
|
|
15325
|
+
mkdirSync2(path12.dirname(destination), { recursive: true });
|
|
15185
15326
|
writeFileSync3(destination, contents);
|
|
15186
15327
|
}
|
|
15187
15328
|
}
|
|
15188
15329
|
const nativeTargets = input.nativeTargets ?? [];
|
|
15189
|
-
const fromInputRoot = (file) => file.startsWith(`${SWIFT_NATIVE_INPUT_ROOT}/`) ?
|
|
15330
|
+
const fromInputRoot = (file) => file.startsWith(`${SWIFT_NATIVE_INPUT_ROOT}/`) ? path12.join(layout.root, file.slice(SWIFT_NATIVE_INPUT_ROOT.length + 1)) : file;
|
|
15190
15331
|
const headerSearch = writeXcodeHeaderSearch(
|
|
15191
|
-
|
|
15332
|
+
path12.join(layout.root, ".build", "peach-xcode-headers"),
|
|
15192
15333
|
nativeTargets.map((settings) => ({
|
|
15193
15334
|
headerMaps: settings.headerMaps.map((map2) => ({
|
|
15194
15335
|
flag: map2.flag,
|
|
@@ -15199,12 +15340,12 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15199
15340
|
})),
|
|
15200
15341
|
productHeaders: Object.fromEntries(
|
|
15201
15342
|
Object.entries(settings.productHeaders).map(([product, file]) => [
|
|
15202
|
-
|
|
15203
|
-
|
|
15343
|
+
path12.join(layout.root, product),
|
|
15344
|
+
path12.join(layout.root, file)
|
|
15204
15345
|
])
|
|
15205
15346
|
),
|
|
15206
15347
|
userHeaderSearchPaths: settings.userHeaderSearchPaths.map(
|
|
15207
|
-
(directory) =>
|
|
15348
|
+
(directory) => path12.join(layout.root, directory)
|
|
15208
15349
|
)
|
|
15209
15350
|
}))
|
|
15210
15351
|
);
|
|
@@ -15227,7 +15368,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15227
15368
|
if (producer && targets.some((value) => value.name === producer))
|
|
15228
15369
|
producers2.add(producer);
|
|
15229
15370
|
const local = [
|
|
15230
|
-
|
|
15371
|
+
path12.posix.join(path12.posix.dirname(file), include2),
|
|
15231
15372
|
`${includes}${include2}`
|
|
15232
15373
|
].find((candidate) => input.files[candidate] !== void 0);
|
|
15233
15374
|
if (local) {
|
|
@@ -15257,21 +15398,19 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15257
15398
|
const headers = settings.headers;
|
|
15258
15399
|
const roots2 = settings.bridgingHeader ? [settings.bridgingHeader] : settings.publicHeaders;
|
|
15259
15400
|
for (const file of headers) {
|
|
15260
|
-
const destination =
|
|
15261
|
-
mkdirSync2(
|
|
15401
|
+
const destination = path12.join(layout.root, file);
|
|
15402
|
+
mkdirSync2(path12.dirname(destination), { recursive: true });
|
|
15262
15403
|
writeFileSync3(destination, input.files[file]);
|
|
15263
15404
|
}
|
|
15264
15405
|
const search = [
|
|
15265
15406
|
.../* @__PURE__ */ new Set([
|
|
15266
15407
|
...settings?.headerSearchPaths ?? [],
|
|
15267
|
-
...headers.map((file) =>
|
|
15408
|
+
...headers.map((file) => path12.posix.dirname(file))
|
|
15268
15409
|
])
|
|
15269
|
-
].flatMap((dir) => ["-I",
|
|
15270
|
-
const
|
|
15271
|
-
const release = pin.release;
|
|
15272
|
-
const toolchainBin = swiftToolchain(release, swiftModuleSdk(moduleRoot));
|
|
15410
|
+
].flatMap((dir) => ["-I", path12.join(layout.root, dir)]);
|
|
15411
|
+
const toolchainBin = nativeToolchain();
|
|
15273
15412
|
const sdkHeaders = materializeObjcSdk(
|
|
15274
|
-
|
|
15413
|
+
path12.join(layout.root, ".build", "peach-objc-sdk")
|
|
15275
15414
|
);
|
|
15276
15415
|
const stageFlags = (flags2, sdkInclude) => flags2.map(
|
|
15277
15416
|
(flag) => flag.replaceAll(SWIFT_NATIVE_INPUT_ROOT, layout.root).replaceAll(SWIFT_NATIVE_SDK_INCLUDE, sdkInclude)
|
|
@@ -15282,16 +15421,16 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15282
15421
|
...search,
|
|
15283
15422
|
...(settings?.frameworkSearchPaths ?? []).flatMap((dir) => [
|
|
15284
15423
|
"-F",
|
|
15285
|
-
|
|
15424
|
+
path12.join(layout.root, dir)
|
|
15286
15425
|
]),
|
|
15287
15426
|
"-I",
|
|
15288
15427
|
headerDirectory
|
|
15289
15428
|
];
|
|
15290
15429
|
const flags = stageFlags(
|
|
15291
15430
|
originalFlags,
|
|
15292
|
-
|
|
15431
|
+
path12.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
|
|
15293
15432
|
);
|
|
15294
|
-
const prefixHeader = settings?.prefixHeader ? ["-include",
|
|
15433
|
+
const prefixHeader = settings?.prefixHeader ? ["-include", path12.join(layout.root, settings.prefixHeader)] : [];
|
|
15295
15434
|
const bundleName = entries.some(([file]) => file.endsWith(".swift")) ? void 0 : swiftObjCResourceBundleName({
|
|
15296
15435
|
target: target.name,
|
|
15297
15436
|
path: target.path,
|
|
@@ -15302,7 +15441,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15302
15441
|
bundles: input.resourceBundles
|
|
15303
15442
|
});
|
|
15304
15443
|
const accessor = bundleName === void 0 ? void 0 : swiftObjCResourceAccessor(bundleName);
|
|
15305
|
-
const accessorHeader =
|
|
15444
|
+
const accessorHeader = path12.join(
|
|
15306
15445
|
layout.root,
|
|
15307
15446
|
target.path,
|
|
15308
15447
|
OBJC_RESOURCE_ACCESSOR_HEADER
|
|
@@ -15313,23 +15452,23 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15313
15452
|
const nativeUnits = accessor ? [...units, [accessorUnit, accessor.body]] : units;
|
|
15314
15453
|
const unitSource = (file) => {
|
|
15315
15454
|
const relative = file.slice(prefix.length);
|
|
15316
|
-
return relative.split("/").some((part) => part.startsWith(".")) ?
|
|
15455
|
+
return relative.split("/").some((part) => part.startsWith(".")) ? path12.posix.join(HIDDEN_UNITS, relative.replaceAll(/(^|\/)\./g, "$1%2E")) : relative;
|
|
15317
15456
|
};
|
|
15318
15457
|
const accessorFlags = accessor ? ["-include", accessorHeader] : [];
|
|
15319
15458
|
let nativeC = !roots2.length && !entries.some(([file]) => file.endsWith(".swift")) && !units.some(([file]) => /\.mm?$/.test(file));
|
|
15320
15459
|
if (roots2.length) {
|
|
15321
|
-
const sourceHeaders =
|
|
15460
|
+
const sourceHeaders = path12.join(
|
|
15322
15461
|
layout.root,
|
|
15323
15462
|
".build",
|
|
15324
15463
|
"peach-objc-originals",
|
|
15325
15464
|
target.name
|
|
15326
15465
|
);
|
|
15327
15466
|
mkdirSync2(sourceHeaders, { recursive: true });
|
|
15328
|
-
const modulemap =
|
|
15467
|
+
const modulemap = path12.join(sourceHeaders, "module.modulemap");
|
|
15329
15468
|
writeFileSync3(
|
|
15330
15469
|
modulemap,
|
|
15331
15470
|
`module ${swiftTargetModuleName(target.name)} {
|
|
15332
|
-
${roots2.map((file) => `header ${JSON.stringify(
|
|
15471
|
+
${roots2.map((file) => `header ${JSON.stringify(path12.join(layout.root, file))}`).join("\n")}
|
|
15333
15472
|
export *
|
|
15334
15473
|
}
|
|
15335
15474
|
`
|
|
@@ -15341,12 +15480,12 @@ export *
|
|
|
15341
15480
|
modulemap
|
|
15342
15481
|
},
|
|
15343
15482
|
toolchainBin,
|
|
15344
|
-
|
|
15345
|
-
|
|
15346
|
-
|
|
15483
|
+
path12.join(moduleRoot, "ios-simulator-stdlib"),
|
|
15484
|
+
path12.join(layout.root, ".build", "peach-objc-sdk"),
|
|
15485
|
+
path12.join(layout.root, ".build", "peach-objc-imports", target.name),
|
|
15347
15486
|
{
|
|
15348
|
-
flags: stageFlags(originalFlags,
|
|
15349
|
-
target: `arm64-apple-ios${
|
|
15487
|
+
flags: stageFlags(originalFlags, path12.join(sdkHeaders, "usr/include")),
|
|
15488
|
+
target: `arm64-apple-ios${deploymentTarget(target.name)}-simulator`
|
|
15350
15489
|
}
|
|
15351
15490
|
);
|
|
15352
15491
|
const defined = /* @__PURE__ */ new Set();
|
|
@@ -15384,7 +15523,7 @@ export *
|
|
|
15384
15523
|
imports.set(target.name, {
|
|
15385
15524
|
view,
|
|
15386
15525
|
classes: [...foreignTypes.values()],
|
|
15387
|
-
headers: roots2.map((file) =>
|
|
15526
|
+
headers: roots2.map((file) => path12.join(layout.root, file)),
|
|
15388
15527
|
foreignTypes
|
|
15389
15528
|
});
|
|
15390
15529
|
}
|
|
@@ -15393,25 +15532,25 @@ export *
|
|
|
15393
15532
|
for (const [file, contents] of nativeUnits) {
|
|
15394
15533
|
const origin = settings?.sourceDirectories[file];
|
|
15395
15534
|
if (origin) {
|
|
15396
|
-
const original =
|
|
15397
|
-
mkdirSync2(
|
|
15535
|
+
const original = path12.join(layout.root, origin, path12.posix.basename(file));
|
|
15536
|
+
mkdirSync2(path12.dirname(original), { recursive: true });
|
|
15398
15537
|
stageTargetFile(target.name, original, contents, { allowExisting: true });
|
|
15399
15538
|
}
|
|
15400
15539
|
const source = unitSource(file);
|
|
15401
15540
|
if (source !== file.slice(prefix.length))
|
|
15402
15541
|
stageTargetFile(
|
|
15403
15542
|
target.name,
|
|
15404
|
-
|
|
15543
|
+
path12.join(layout.root, target.path, source),
|
|
15405
15544
|
contents,
|
|
15406
15545
|
{
|
|
15407
15546
|
allowExisting: true
|
|
15408
15547
|
}
|
|
15409
15548
|
);
|
|
15410
15549
|
const perFile = [
|
|
15411
|
-
...origin ? ["-iquote",
|
|
15550
|
+
...origin ? ["-iquote", path12.join(layout.root, origin)] : [],
|
|
15412
15551
|
...stageFlags(
|
|
15413
15552
|
settings?.fileFlags[file] ?? [],
|
|
15414
|
-
|
|
15553
|
+
path12.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
|
|
15415
15554
|
)
|
|
15416
15555
|
];
|
|
15417
15556
|
const cxx = /\.(?:cc|cpp|cxx|mm)$/.test(file);
|
|
@@ -15432,7 +15571,7 @@ export *
|
|
|
15432
15571
|
...accessorFlags,
|
|
15433
15572
|
...stageFlags(
|
|
15434
15573
|
cxx ? settings.cxxFlags : [],
|
|
15435
|
-
|
|
15574
|
+
path12.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
|
|
15436
15575
|
),
|
|
15437
15576
|
...perFile
|
|
15438
15577
|
]
|
|
@@ -15447,12 +15586,12 @@ export *
|
|
|
15447
15586
|
flags: [...flags, "-fobjc-arc"],
|
|
15448
15587
|
cxxFlags: [...flags, "-fobjc-arc"]
|
|
15449
15588
|
});
|
|
15450
|
-
const include2 =
|
|
15589
|
+
const include2 = path12.join(layout.root, target.path, "include");
|
|
15451
15590
|
if (accessor) {
|
|
15452
15591
|
stageTargetFile(target.name, accessorHeader, accessor.header);
|
|
15453
15592
|
stageTargetFile(
|
|
15454
15593
|
target.name,
|
|
15455
|
-
|
|
15594
|
+
path12.join(layout.root, accessorUnit),
|
|
15456
15595
|
accessor.body
|
|
15457
15596
|
);
|
|
15458
15597
|
}
|
|
@@ -15491,12 +15630,12 @@ export *
|
|
|
15491
15630
|
const contents = input.files[original];
|
|
15492
15631
|
if (contents === void 0)
|
|
15493
15632
|
throw new Error(`missing original module map ${original}`);
|
|
15494
|
-
stageTargetFile(target.name,
|
|
15633
|
+
stageTargetFile(target.name, path12.join(layout.root, product), contents);
|
|
15495
15634
|
const [owner, ...implementations] = groups.values();
|
|
15496
15635
|
if (!owner) throw new Error(`target ${target.name} has no original units`);
|
|
15497
15636
|
native.set(target.name, {
|
|
15498
15637
|
path: target.path,
|
|
15499
|
-
includeDirectory:
|
|
15638
|
+
includeDirectory: path12.join(layout.root, path12.dirname(product)),
|
|
15500
15639
|
sources: nativeUnits.map(([file]) => unitSource(file)),
|
|
15501
15640
|
lateSources: implementations.flatMap((group) => group.sources),
|
|
15502
15641
|
exclude: [],
|
|
@@ -15517,7 +15656,7 @@ export *
|
|
|
15517
15656
|
}
|
|
15518
15657
|
stageTargetFile(
|
|
15519
15658
|
target.name,
|
|
15520
|
-
|
|
15659
|
+
path12.join(include2, "module.modulemap"),
|
|
15521
15660
|
`module ${target.name}ImplementationDeclarations { export * }
|
|
15522
15661
|
`
|
|
15523
15662
|
);
|
|
@@ -15553,7 +15692,7 @@ export *
|
|
|
15553
15692
|
}
|
|
15554
15693
|
native.set(target.name, {
|
|
15555
15694
|
path: target.path,
|
|
15556
|
-
includeDirectory:
|
|
15695
|
+
includeDirectory: path12.join(layout.root, includes),
|
|
15557
15696
|
sources: units.map(([file]) => file.slice(prefix.length)),
|
|
15558
15697
|
lateSources: late.map(([file]) => file.slice(prefix.length)),
|
|
15559
15698
|
...late.length > 0 ? {
|
|
@@ -15571,7 +15710,7 @@ export *
|
|
|
15571
15710
|
([file]) => file.startsWith(includes) && /\.(?:h|hpp|hh|hxx)$/.test(file) && consumers.get(file).size === 0
|
|
15572
15711
|
);
|
|
15573
15712
|
files.set(
|
|
15574
|
-
|
|
15713
|
+
path12.join(layout.root, includes, "module.modulemap"),
|
|
15575
15714
|
[
|
|
15576
15715
|
`module ${target.name} {`,
|
|
15577
15716
|
...roots.map(
|
|
@@ -15588,7 +15727,7 @@ export *
|
|
|
15588
15727
|
swiftModuleInputFiles(moduleRoot).join("\n")
|
|
15589
15728
|
);
|
|
15590
15729
|
if (!distribution) {
|
|
15591
|
-
modulePlan.update(readFileSync6(
|
|
15730
|
+
modulePlan.update(readFileSync6(path12.join(moduleRoot, "Package.swift")));
|
|
15592
15731
|
}
|
|
15593
15732
|
const resourcePlan = createHash9("sha256").update(
|
|
15594
15733
|
JSON.stringify(
|
|
@@ -15669,27 +15808,27 @@ export *
|
|
|
15669
15808
|
objcModules.add(name2);
|
|
15670
15809
|
rootOwner ?? (rootOwner = exported ? [...exported.swift.keys()][0] : `${prefix}PeachObjCImports.generated.swift`);
|
|
15671
15810
|
files.set(
|
|
15672
|
-
|
|
15811
|
+
path12.join(headerDirectory, `${name2}-Swift.h`),
|
|
15673
15812
|
exported?.header ?? "#pragma once\n"
|
|
15674
15813
|
);
|
|
15675
15814
|
files.set(
|
|
15676
|
-
|
|
15815
|
+
path12.join(headerDirectory, name2, `${name2}-Swift.h`),
|
|
15677
15816
|
`#include "../${name2}-Swift.h"
|
|
15678
15817
|
`
|
|
15679
15818
|
);
|
|
15680
15819
|
files.set(
|
|
15681
|
-
|
|
15820
|
+
path12.join(headerModuleDirectory, name2, "module.modulemap"),
|
|
15682
15821
|
`module ${swiftTargetModuleName(name2)} {
|
|
15683
15822
|
${[
|
|
15684
|
-
|
|
15685
|
-
...(input.nativeTargets?.find((target2) => target2.name === name2)?.publicHeaders ?? []).map((header) =>
|
|
15823
|
+
path12.join(headerDirectory, `${name2}-Swift.h`),
|
|
15824
|
+
...(input.nativeTargets?.find((target2) => target2.name === name2)?.publicHeaders ?? []).map((header) => path12.join(layout.root, header))
|
|
15686
15825
|
].map((header) => ` header ${JSON.stringify(header)}`).join("\n")}
|
|
15687
15826
|
export *
|
|
15688
15827
|
}
|
|
15689
15828
|
`
|
|
15690
15829
|
);
|
|
15691
15830
|
files.set(
|
|
15692
|
-
|
|
15831
|
+
path12.join(layout.root, "PeachObjCExports", `${name2}.m`),
|
|
15693
15832
|
exported?.implementation ?? `#include "${name2}-Cxx.h"
|
|
15694
15833
|
`
|
|
15695
15834
|
);
|
|
@@ -15701,13 +15840,13 @@ ${[
|
|
|
15701
15840
|
if (generated) {
|
|
15702
15841
|
const register = `_peach_objc_imports_${swiftTargetModuleName(name2)}`;
|
|
15703
15842
|
files.set(
|
|
15704
|
-
|
|
15843
|
+
path12.join(layout.root, target.path, "PeachObjCImports.generated.swift"),
|
|
15705
15844
|
generated.swift + generated.registration + `
|
|
15706
15845
|
@_cdecl("${register}") public func __peachRegisterOriginalObjC() { ${generated.registerFunction}() }
|
|
15707
15846
|
`
|
|
15708
15847
|
);
|
|
15709
15848
|
files.set(
|
|
15710
|
-
|
|
15849
|
+
path12.join(layout.root, target.path, "PeachObjCImports.generated.m"),
|
|
15711
15850
|
generated.objc
|
|
15712
15851
|
);
|
|
15713
15852
|
registrations.push(`${register}();`);
|
|
@@ -15765,7 +15904,7 @@ ${[
|
|
|
15765
15904
|
exclude: []
|
|
15766
15905
|
});
|
|
15767
15906
|
files.set(
|
|
15768
|
-
|
|
15907
|
+
path12.join(layout.root, `PeachApplication/${name2}/Entry.swift`),
|
|
15769
15908
|
`import ${swiftTargetModuleName(target.name)}
|
|
15770
15909
|
@main struct __PeachApplicationEntry { @MainActor static func main() { __peachRunApplication() } }
|
|
15771
15910
|
`
|
|
@@ -15773,21 +15912,35 @@ ${[
|
|
|
15773
15912
|
}
|
|
15774
15913
|
const nativeFlags = (() => {
|
|
15775
15914
|
if (native.size === 0) return void 0;
|
|
15776
|
-
const headers = materializeObjcSdk(
|
|
15777
|
-
|
|
15778
|
-
|
|
15779
|
-
|
|
15780
|
-
|
|
15781
|
-
|
|
15782
|
-
|
|
15783
|
-
|
|
15784
|
-
|
|
15785
|
-
|
|
15786
|
-
|
|
15787
|
-
|
|
15788
|
-
|
|
15789
|
-
|
|
15790
|
-
|
|
15915
|
+
const headers = materializeObjcSdk(path12.join(layout.root, ".build", "peach-objc-sdk"));
|
|
15916
|
+
const moduleMaps = rootOwner ? [...objcModules].map(
|
|
15917
|
+
(name2) => `-fmodule-map-file=${path12.join(headerModuleDirectory, name2, "module.modulemap")}`
|
|
15918
|
+
) : [];
|
|
15919
|
+
return new Map(
|
|
15920
|
+
targets.map((target) => {
|
|
15921
|
+
const version = deploymentTarget(target.name);
|
|
15922
|
+
const minimum = iosDeploymentMinimum(version);
|
|
15923
|
+
if (minimum === void 0)
|
|
15924
|
+
throw new Error(
|
|
15925
|
+
`${target.name}: unsupported IPHONEOS_DEPLOYMENT_TARGET ${JSON.stringify(version)}`
|
|
15926
|
+
);
|
|
15927
|
+
return [
|
|
15928
|
+
target.name,
|
|
15929
|
+
[
|
|
15930
|
+
"-fobjc-runtime=gnustep-2.2",
|
|
15931
|
+
"-fobjc-exceptions",
|
|
15932
|
+
"-fexceptions",
|
|
15933
|
+
"-fwasm-exceptions",
|
|
15934
|
+
"-fobjc-arc",
|
|
15935
|
+
"-fblocks",
|
|
15936
|
+
...objcSdkIntakeFlags(headers, nativeToolchain(), minimum),
|
|
15937
|
+
"-I",
|
|
15938
|
+
headerDirectory,
|
|
15939
|
+
...moduleMaps
|
|
15940
|
+
]
|
|
15941
|
+
];
|
|
15942
|
+
})
|
|
15943
|
+
);
|
|
15791
15944
|
})();
|
|
15792
15945
|
let objcExports;
|
|
15793
15946
|
if (rootOwner && input.objcPeerStartup)
|
|
@@ -15804,7 +15957,7 @@ ${[
|
|
|
15804
15957
|
throw new Error(
|
|
15805
15958
|
"Swift Objective-C export target conflicts with application sources"
|
|
15806
15959
|
);
|
|
15807
|
-
const ownerFile =
|
|
15960
|
+
const ownerFile = path12.join(layout.root, rootOwner);
|
|
15808
15961
|
const ownerSource = compiled.get(rootOwner) ?? files.get(ownerFile);
|
|
15809
15962
|
if (typeof ownerSource !== "string")
|
|
15810
15963
|
throw new Error("Objective-C root registration has no owning Swift source");
|
|
@@ -15821,11 +15974,11 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
|
|
|
15821
15974
|
);
|
|
15822
15975
|
if (compiled.has(rootOwner)) compiled.set(rootOwner, files.get(ownerFile).toString());
|
|
15823
15976
|
files.set(
|
|
15824
|
-
|
|
15977
|
+
path12.join(layout.root, "PeachObjCExports", "include", "module.modulemap"),
|
|
15825
15978
|
"module PeachSwiftObjCExports { export * }\n"
|
|
15826
15979
|
);
|
|
15827
15980
|
files.set(
|
|
15828
|
-
|
|
15981
|
+
path12.join(layout.root, "PeachObjCExports", "root.m"),
|
|
15829
15982
|
[
|
|
15830
15983
|
"#import <Foundation/Foundation.h>",
|
|
15831
15984
|
"extern void _peach_objc_ensure_exports(void);",
|
|
@@ -15847,24 +16000,15 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
|
|
|
15847
16000
|
""
|
|
15848
16001
|
].join("\n")
|
|
15849
16002
|
);
|
|
15850
|
-
objcExports = {
|
|
15851
|
-
modules: objcModules,
|
|
15852
|
-
rootModule,
|
|
15853
|
-
flags: [
|
|
15854
|
-
...nativeFlags,
|
|
15855
|
-
...[...objcModules].map(
|
|
15856
|
-
(name2) => `-fmodule-map-file=${path11.join(headerModuleDirectory, name2, "module.modulemap")}`
|
|
15857
|
-
)
|
|
15858
|
-
]
|
|
15859
|
-
};
|
|
16003
|
+
objcExports = { modules: objcModules, rootModule };
|
|
15860
16004
|
}
|
|
15861
16005
|
if (targets.length === 0) {
|
|
15862
16006
|
for (const [file, contents] of Object.entries(input.files)) {
|
|
15863
16007
|
if (file === "Package.swift") continue;
|
|
15864
|
-
files.set(
|
|
16008
|
+
files.set(path12.join(layout.sources, file), compiled.get(file) ?? contents);
|
|
15865
16009
|
}
|
|
15866
16010
|
let manifest = readFileSync6(
|
|
15867
|
-
|
|
16011
|
+
path12.join(moduleRoot, "scripts/contrast-app-Package.swift"),
|
|
15868
16012
|
"utf8"
|
|
15869
16013
|
).replaceAll("__SOOTSIM_SWIFT_PACKAGE__", moduleRoot);
|
|
15870
16014
|
const reactor = ` ${REACTOR_FLAG}`;
|
|
@@ -15908,21 +16052,21 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
|
|
|
15908
16052
|
manifest = manifest.replace(anchor, `${anchor}
|
|
15909
16053
|
${SPRITEKIT_PRODUCT},`);
|
|
15910
16054
|
}
|
|
15911
|
-
files.set(
|
|
16055
|
+
files.set(path12.join(layout.root, "Package.swift"), manifest + moduleFiles);
|
|
15912
16056
|
} else {
|
|
15913
16057
|
const base = layout.multi ? layout.root : layout.sources;
|
|
15914
16058
|
const libraries = /* @__PURE__ */ new Map();
|
|
15915
16059
|
for (const [target, data] of Object.entries(input.libraries ?? {})) {
|
|
15916
|
-
const file =
|
|
16060
|
+
const file = path12.join(layout.root, ".peach-libraries", `lib${target}.a`);
|
|
15917
16061
|
files.set(file, Buffer.from(data, "base64"));
|
|
15918
16062
|
libraries.set(target, file);
|
|
15919
16063
|
}
|
|
15920
16064
|
for (const [file, contents] of Object.entries(input.files)) {
|
|
15921
16065
|
if (file === "Package.swift") continue;
|
|
15922
|
-
files.set(
|
|
16066
|
+
files.set(path12.join(base, file), compiled.get(file) ?? contents);
|
|
15923
16067
|
}
|
|
15924
16068
|
files.set(
|
|
15925
|
-
|
|
16069
|
+
path12.join(layout.root, "Package.swift"),
|
|
15926
16070
|
emitSwiftPackageManifest({
|
|
15927
16071
|
targets,
|
|
15928
16072
|
native,
|
|
@@ -15941,7 +16085,7 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
|
|
|
15941
16085
|
spriteKit: importsSpriteKit(input.files),
|
|
15942
16086
|
distribution: distribution ?? void 0,
|
|
15943
16087
|
distributionLink: {
|
|
15944
|
-
path:
|
|
16088
|
+
path: path12.join(layout.root, ".peach-distribution-objects.rsp"),
|
|
15945
16089
|
files
|
|
15946
16090
|
},
|
|
15947
16091
|
libraries
|
|
@@ -15957,9 +16101,9 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
|
|
|
15957
16101
|
throw new Error(
|
|
15958
16102
|
`swift resource target ${target.name} has no matching bundle assignment`
|
|
15959
16103
|
);
|
|
15960
|
-
const directory = layout.multi ?
|
|
16104
|
+
const directory = layout.multi ? path12.join(layout.root, target.path) : layout.sources;
|
|
15961
16105
|
files.set(
|
|
15962
|
-
|
|
16106
|
+
path12.join(directory, "ResourceBundleAccessor.generated.swift"),
|
|
15963
16107
|
[
|
|
15964
16108
|
"import Foundation",
|
|
15965
16109
|
"",
|
|
@@ -15976,7 +16120,7 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
|
|
|
15976
16120
|
}
|
|
15977
16121
|
for (const [file, source] of compiled)
|
|
15978
16122
|
if (!Object.hasOwn(input.files, file))
|
|
15979
|
-
files.set(
|
|
16123
|
+
files.set(path12.join(layout.multi ? layout.root : layout.sources, file), source);
|
|
15980
16124
|
syncSwiftTree(layout.root, files);
|
|
15981
16125
|
const producers = [
|
|
15982
16126
|
.../* @__PURE__ */ new Set([
|
|
@@ -15998,10 +16142,10 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
|
|
|
15998
16142
|
targetFailures,
|
|
15999
16143
|
...rootOwner && objcExports ? {
|
|
16000
16144
|
objcImplementations: {
|
|
16001
|
-
owner:
|
|
16145
|
+
owner: path12.join(layout.root, rootOwner),
|
|
16002
16146
|
registeredClasses: [...registeredClasses],
|
|
16003
16147
|
units: [...native.values()].flatMap(
|
|
16004
|
-
(value) => value.sources.filter((file) => /\.mm?$/.test(file)).map((file) =>
|
|
16148
|
+
(value) => value.sources.filter((file) => /\.mm?$/.test(file)).map((file) => path12.join(layout.root, value.path, file))
|
|
16005
16149
|
)
|
|
16006
16150
|
}
|
|
16007
16151
|
} : {}
|
|
@@ -16023,13 +16167,13 @@ function outputOf(error) {
|
|
|
16023
16167
|
return error instanceof Error ? error.message : String(error);
|
|
16024
16168
|
}
|
|
16025
16169
|
function builtArtifact(layout) {
|
|
16026
|
-
const binDir =
|
|
16027
|
-
const manifest = readFileSync6(
|
|
16170
|
+
const binDir = path12.join(layout.root, ".build", WASM_TRIPLE, "release");
|
|
16171
|
+
const manifest = readFileSync6(path12.join(layout.root, "Package.swift"), "utf8");
|
|
16028
16172
|
const executable = swiftManifestTargets(manifest).find((target) => target.executable);
|
|
16029
16173
|
if (executable === void 0) {
|
|
16030
16174
|
throw new Error("swift-compile: the written manifest names no executable target");
|
|
16031
16175
|
}
|
|
16032
|
-
const file =
|
|
16176
|
+
const file = path12.join(binDir, `${executable.name}.wasm`);
|
|
16033
16177
|
if (!existsSync2(file)) {
|
|
16034
16178
|
const found = existsSync2(binDir) ? readdirSync4(binDir).filter((name2) => name2.endsWith(".wasm")).sort() : [];
|
|
16035
16179
|
throw new Error(
|
|
@@ -16040,7 +16184,7 @@ function builtArtifact(layout) {
|
|
|
16040
16184
|
}
|
|
16041
16185
|
function projectDiagnostic(output, layout, files) {
|
|
16042
16186
|
const base = layout.multi ? layout.root : layout.sources;
|
|
16043
|
-
const prefix = `${base}${
|
|
16187
|
+
const prefix = `${base}${path12.sep}`;
|
|
16044
16188
|
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();
|
|
16045
16189
|
}
|
|
16046
16190
|
var ROOT_LOCKS = Symbol.for("peachsim.swiftCompile.rootLocks");
|
|
@@ -16076,12 +16220,12 @@ function serialize(root, work, signal) {
|
|
|
16076
16220
|
function readCompiledArtifact(directory, hash2) {
|
|
16077
16221
|
try {
|
|
16078
16222
|
const receipt = JSON.parse(
|
|
16079
|
-
readFileSync6(
|
|
16223
|
+
readFileSync6(path12.join(directory, "artifact.json"), "utf8")
|
|
16080
16224
|
);
|
|
16081
16225
|
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")
|
|
16082
16226
|
return null;
|
|
16083
|
-
const bytes = readFileSync6(
|
|
16084
|
-
const gzip2 = readFileSync6(
|
|
16227
|
+
const bytes = readFileSync6(path12.join(directory, "app.wasm"));
|
|
16228
|
+
const gzip2 = readFileSync6(path12.join(directory, "icu.gz"));
|
|
16085
16229
|
if (createHash9("sha256").update(bytes).digest("hex") !== receipt.wasm || createHash9("sha256").update(gzip2).digest("hex") !== receipt.icu || bytes.length < 8 || bytes.readUInt32LE(0) !== 1836278016 || bytes.readUInt32LE(4) !== 1)
|
|
16086
16230
|
return null;
|
|
16087
16231
|
return { hash: hash2, bytes, icu: { sha256: receipt.icu, gzip: gzip2 } };
|
|
@@ -16092,14 +16236,14 @@ function readCompiledArtifact(directory, hash2) {
|
|
|
16092
16236
|
}
|
|
16093
16237
|
}
|
|
16094
16238
|
function saveCompiledArtifact(root, artifact) {
|
|
16095
|
-
const directory =
|
|
16239
|
+
const directory = path12.join(root, "artifact");
|
|
16096
16240
|
mkdirSync2(directory, { recursive: true });
|
|
16097
|
-
const pending = mkdtempSync2(
|
|
16241
|
+
const pending = mkdtempSync2(path12.join(root, ".artifact-"));
|
|
16098
16242
|
try {
|
|
16099
|
-
writeFileSync3(
|
|
16100
|
-
writeFileSync3(
|
|
16243
|
+
writeFileSync3(path12.join(pending, "app.wasm"), artifact.bytes);
|
|
16244
|
+
writeFileSync3(path12.join(pending, "icu.gz"), artifact.icu.gzip);
|
|
16101
16245
|
writeFileSync3(
|
|
16102
|
-
|
|
16246
|
+
path12.join(pending, "artifact.json"),
|
|
16103
16247
|
JSON.stringify({
|
|
16104
16248
|
hash: artifact.hash,
|
|
16105
16249
|
wasm: createHash9("sha256").update(artifact.bytes).digest("hex"),
|
|
@@ -16107,7 +16251,7 @@ function saveCompiledArtifact(root, artifact) {
|
|
|
16107
16251
|
})
|
|
16108
16252
|
);
|
|
16109
16253
|
for (const file of ["app.wasm", "icu.gz", "artifact.json"]) {
|
|
16110
|
-
renameSync(
|
|
16254
|
+
renameSync(path12.join(pending, file), path12.join(directory, file));
|
|
16111
16255
|
}
|
|
16112
16256
|
} finally {
|
|
16113
16257
|
rmSync3(pending, { recursive: true, force: true });
|
|
@@ -16129,16 +16273,16 @@ function renewSharedArtifact(sharedRoot) {
|
|
|
16129
16273
|
function pruneSharedArtifacts(parent, keep) {
|
|
16130
16274
|
const entries = [];
|
|
16131
16275
|
for (const name2 of readdirSync4(parent)) {
|
|
16132
|
-
const directory =
|
|
16276
|
+
const directory = path12.join(parent, name2);
|
|
16133
16277
|
if (name2.startsWith(RETIRED_PREFIX)) {
|
|
16134
16278
|
rmSync3(directory, { recursive: true, force: true });
|
|
16135
16279
|
continue;
|
|
16136
16280
|
}
|
|
16137
16281
|
try {
|
|
16138
16282
|
let bytes = 0;
|
|
16139
|
-
for (const file of readdirSync4(
|
|
16283
|
+
for (const file of readdirSync4(path12.join(directory, "artifact"))) {
|
|
16140
16284
|
try {
|
|
16141
|
-
bytes += statSync(
|
|
16285
|
+
bytes += statSync(path12.join(directory, "artifact", file)).size;
|
|
16142
16286
|
} catch (error) {
|
|
16143
16287
|
if (!vanished(error)) throw error;
|
|
16144
16288
|
}
|
|
@@ -16153,9 +16297,9 @@ function pruneSharedArtifacts(parent, keep) {
|
|
|
16153
16297
|
if (total <= SHARED_ARTIFACT_BUDGET_BYTES) break;
|
|
16154
16298
|
if (entry.directory === keep || Date.now() - entry.used < SHARED_ARTIFACT_GRACE_MS)
|
|
16155
16299
|
continue;
|
|
16156
|
-
const retired =
|
|
16300
|
+
const retired = path12.join(
|
|
16157
16301
|
parent,
|
|
16158
|
-
`${RETIRED_PREFIX}${process.pid}-${
|
|
16302
|
+
`${RETIRED_PREFIX}${process.pid}-${path12.basename(entry.directory)}`
|
|
16159
16303
|
);
|
|
16160
16304
|
try {
|
|
16161
16305
|
if (statSync(entry.directory).mtimeMs !== entry.used) continue;
|
|
@@ -16171,7 +16315,7 @@ function pruneSharedArtifacts(parent, keep) {
|
|
|
16171
16315
|
function saveSharedArtifact(sharedRoot, artifact) {
|
|
16172
16316
|
saveCompiledArtifact(sharedRoot, artifact);
|
|
16173
16317
|
renewSharedArtifact(sharedRoot);
|
|
16174
|
-
pruneSharedArtifacts(
|
|
16318
|
+
pruneSharedArtifacts(path12.dirname(sharedRoot), sharedRoot);
|
|
16175
16319
|
}
|
|
16176
16320
|
var retainedArtifacts = /* @__PURE__ */ new Map();
|
|
16177
16321
|
function retain(root, artifact) {
|
|
@@ -16188,14 +16332,14 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
16188
16332
|
options.signal?.throwIfAborted();
|
|
16189
16333
|
mkdirSync2(options.buildRoot, { recursive: true });
|
|
16190
16334
|
const root = realpathSync(options.buildRoot);
|
|
16191
|
-
const moduleRoot =
|
|
16335
|
+
const moduleRoot = path12.resolve(options.moduleRoot);
|
|
16192
16336
|
const layout = {
|
|
16193
16337
|
root,
|
|
16194
|
-
sources:
|
|
16338
|
+
sources: path12.join(root, "Sources", "App"),
|
|
16195
16339
|
multi: compileTargets(input).length > 0
|
|
16196
16340
|
};
|
|
16197
16341
|
const hash2 = swiftArtifactHash(input, options.release, moduleRoot);
|
|
16198
|
-
const sharedRoot =
|
|
16342
|
+
const sharedRoot = path12.join(rnxHomeDir(), "cache", "swift-projects", hash2);
|
|
16199
16343
|
const report = (message) => {
|
|
16200
16344
|
console.error(`[swift-project ${hash2.slice(0, 16)}] ${message}`);
|
|
16201
16345
|
options.onStage?.(message);
|
|
@@ -16209,8 +16353,8 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
16209
16353
|
report("reusing memory artifact");
|
|
16210
16354
|
return retain(root, retained);
|
|
16211
16355
|
}
|
|
16212
|
-
const cached = readCompiledArtifact(
|
|
16213
|
-
const previous = cached ?? readCompiledArtifact(
|
|
16356
|
+
const cached = readCompiledArtifact(path12.join(sharedRoot, "artifact"), hash2);
|
|
16357
|
+
const previous = cached ?? readCompiledArtifact(path12.join(root, "artifact"), hash2);
|
|
16214
16358
|
if (previous) {
|
|
16215
16359
|
if (cached) renewSharedArtifact(sharedRoot);
|
|
16216
16360
|
else saveSharedArtifact(sharedRoot, previous);
|
|
@@ -16219,8 +16363,8 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
16219
16363
|
}
|
|
16220
16364
|
if (process.platform === "darwin" && process.env.TM_SESSION && !admittedMacBuilderSlot() && process.env.CI !== "true" && moduleRoot === sourceSwiftCheckout() && !swiftDistributionAt(moduleRoot)) {
|
|
16221
16365
|
const requestRoot = mkdtempSync2(`${root}.builder-request-`);
|
|
16222
|
-
const output =
|
|
16223
|
-
const request =
|
|
16366
|
+
const output = path12.join(requestRoot, "output");
|
|
16367
|
+
const request = path12.join(requestRoot, "request.json");
|
|
16224
16368
|
writeFileSync3(
|
|
16225
16369
|
request,
|
|
16226
16370
|
JSON.stringify({
|
|
@@ -16234,12 +16378,12 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
16234
16378
|
})
|
|
16235
16379
|
);
|
|
16236
16380
|
try {
|
|
16237
|
-
const repo =
|
|
16381
|
+
const repo = path12.resolve(moduleRoot, "../..");
|
|
16238
16382
|
report("requesting builder admission or cached result");
|
|
16239
16383
|
await runCompiler(
|
|
16240
16384
|
"bun",
|
|
16241
16385
|
[
|
|
16242
|
-
|
|
16386
|
+
path12.join(repo, "scripts/build/swift-project.ts"),
|
|
16243
16387
|
"--request",
|
|
16244
16388
|
request,
|
|
16245
16389
|
"--output",
|
|
@@ -16273,7 +16417,7 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
16273
16417
|
return withSwiftRootLock(
|
|
16274
16418
|
root,
|
|
16275
16419
|
async (lease) => {
|
|
16276
|
-
const built = readCompiledArtifact(
|
|
16420
|
+
const built = readCompiledArtifact(path12.join(sharedRoot, "artifact"), hash2);
|
|
16277
16421
|
if (built) {
|
|
16278
16422
|
report("reusing verified disk artifact");
|
|
16279
16423
|
return retain(root, built);
|
|
@@ -16282,7 +16426,7 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
16282
16426
|
const unprepared = preparation.targetFailures.map(
|
|
16283
16427
|
(failure) => `error: target ${failure}`
|
|
16284
16428
|
);
|
|
16285
|
-
const swift =
|
|
16429
|
+
const swift = path12.join(options.toolchainBin, "swift");
|
|
16286
16430
|
if (!existsSync2(swift)) {
|
|
16287
16431
|
throw new Error(
|
|
16288
16432
|
`swift-compile: no swift.org toolchain at ${options.toolchainBin}; install ${options.release} and its matching wasm sdk`
|
|
@@ -16330,8 +16474,8 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
16330
16474
|
// shipped host plugins resolve against the selected compiler's runtime.
|
|
16331
16475
|
...process.platform === "linux" ? {
|
|
16332
16476
|
LD_LIBRARY_PATH: [
|
|
16333
|
-
|
|
16334
|
-
|
|
16477
|
+
path12.resolve(options.toolchainBin, "../lib/swift/linux"),
|
|
16478
|
+
path12.resolve(options.toolchainBin, "../lib/swift/host"),
|
|
16335
16479
|
process.env.LD_LIBRARY_PATH
|
|
16336
16480
|
].filter(Boolean).join(":")
|
|
16337
16481
|
} : {}
|
|
@@ -16355,7 +16499,7 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
16355
16499
|
if (preparation.objcImplementations) {
|
|
16356
16500
|
const plan = preparation.objcImplementations;
|
|
16357
16501
|
const manifest = browser_default.parse(
|
|
16358
|
-
readFileSync6(
|
|
16502
|
+
readFileSync6(path12.join(root, ".build", "release.yaml"), "utf8")
|
|
16359
16503
|
);
|
|
16360
16504
|
if (!isRecord(manifest) || !isRecord(manifest.commands))
|
|
16361
16505
|
throw new Error("missing SwiftPM native compiler commands");
|
|
@@ -16412,7 +16556,7 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
16412
16556
|
);
|
|
16413
16557
|
} catch (error) {
|
|
16414
16558
|
const output = outputOf(error);
|
|
16415
|
-
const moduleCache =
|
|
16559
|
+
const moduleCache = path12.join(
|
|
16416
16560
|
root,
|
|
16417
16561
|
".build",
|
|
16418
16562
|
WASM_TRIPLE,
|