peachsim 0.1.1674 → 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/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 +3274 -1663
- 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 +6 -4
- 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 +2407 -1126
- 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 +2879 -1598
- package/dist-lib/host/fetch-proxy-handler.cjs +18 -5
- 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 +1904 -741
- 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 +2 -1
- package/dist-lib/sdk.mjs +2 -1
- package/dist-lib/skills.cjs +3570 -2160
- package/dist-lib/swift-compile.cjs +473 -351
- package/dist-lib/swift-compile.mjs +471 -349
- package/dist-lib/swift-package.cjs +36 -6
- package/dist-lib/swift-package.mjs +35 -6
- 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 +2418 -1132
- package/dist-lib/vite.cjs +1907 -766
- 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/preview/upload-protocol.d.ts +11 -3
- 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/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +51 -2
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +21 -0
- 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/arm/param.h +151 -0
- package/sdk/ios/usr/include/dispatch/dispatch.h +3 -0
- package/sdk/ios/usr/include/dlfcn.h +1 -2
- 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/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/cdefs.h +3 -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/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/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 -48
- 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 +6 -21
- package/src/swift-objc-metadata.ts +2 -8
- package/src/swift-objc-platform.ts +53 -0
- package/src/swift-objc-standin.ts +45 -1
- package/src/swift-package-manifest.ts +48 -3
- package/src/swift-package.ts +59 -9
- package/src/swift-packages.ts +157 -44
- package/src/swift-source-pods.ts +288 -0
- 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
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -70,11 +70,11 @@ __export(swift_compile_exports, {
|
|
|
70
70
|
writeSwiftProject: () => writeSwiftProject
|
|
71
71
|
});
|
|
72
72
|
module.exports = __toCommonJS(swift_compile_exports);
|
|
73
|
-
var
|
|
73
|
+
var import_node_child_process8 = require("node:child_process");
|
|
74
74
|
var import_node_crypto7 = require("node:crypto");
|
|
75
75
|
var import_node_fs8 = require("node:fs");
|
|
76
76
|
var import_node_os4 = __toESM(require("node:os"), 1);
|
|
77
|
-
var
|
|
77
|
+
var import_node_path11 = __toESM(require("node:path"), 1);
|
|
78
78
|
|
|
79
79
|
// ../../node_modules/yaml/browser/dist/index.js
|
|
80
80
|
var dist_exports = {};
|
|
@@ -162,17 +162,17 @@ function visit(node, visitor) {
|
|
|
162
162
|
visit.BREAK = BREAK;
|
|
163
163
|
visit.SKIP = SKIP;
|
|
164
164
|
visit.REMOVE = REMOVE;
|
|
165
|
-
function visit_(key, node, visitor,
|
|
166
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
165
|
+
function visit_(key, node, visitor, path11) {
|
|
166
|
+
const ctrl = callVisitor(key, node, visitor, path11);
|
|
167
167
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
168
|
-
replaceNode(key,
|
|
169
|
-
return visit_(key, ctrl, visitor,
|
|
168
|
+
replaceNode(key, path11, ctrl);
|
|
169
|
+
return visit_(key, ctrl, visitor, path11);
|
|
170
170
|
}
|
|
171
171
|
if (typeof ctrl !== "symbol") {
|
|
172
172
|
if (isCollection(node)) {
|
|
173
|
-
|
|
173
|
+
path11 = Object.freeze(path11.concat(node));
|
|
174
174
|
for (let i = 0; i < node.items.length; ++i) {
|
|
175
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
175
|
+
const ci = visit_(i, node.items[i], visitor, path11);
|
|
176
176
|
if (typeof ci === "number")
|
|
177
177
|
i = ci - 1;
|
|
178
178
|
else if (ci === BREAK)
|
|
@@ -183,13 +183,13 @@ function visit_(key, node, visitor, path10) {
|
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
} else if (isPair(node)) {
|
|
186
|
-
|
|
187
|
-
const ck = visit_("key", node.key, visitor,
|
|
186
|
+
path11 = Object.freeze(path11.concat(node));
|
|
187
|
+
const ck = visit_("key", node.key, visitor, path11);
|
|
188
188
|
if (ck === BREAK)
|
|
189
189
|
return BREAK;
|
|
190
190
|
else if (ck === REMOVE)
|
|
191
191
|
node.key = null;
|
|
192
|
-
const cv = visit_("value", node.value, visitor,
|
|
192
|
+
const cv = visit_("value", node.value, visitor, path11);
|
|
193
193
|
if (cv === BREAK)
|
|
194
194
|
return BREAK;
|
|
195
195
|
else if (cv === REMOVE)
|
|
@@ -210,17 +210,17 @@ async function visitAsync(node, visitor) {
|
|
|
210
210
|
visitAsync.BREAK = BREAK;
|
|
211
211
|
visitAsync.SKIP = SKIP;
|
|
212
212
|
visitAsync.REMOVE = REMOVE;
|
|
213
|
-
async function visitAsync_(key, node, visitor,
|
|
214
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
213
|
+
async function visitAsync_(key, node, visitor, path11) {
|
|
214
|
+
const ctrl = await callVisitor(key, node, visitor, path11);
|
|
215
215
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
216
|
-
replaceNode(key,
|
|
217
|
-
return visitAsync_(key, ctrl, visitor,
|
|
216
|
+
replaceNode(key, path11, ctrl);
|
|
217
|
+
return visitAsync_(key, ctrl, visitor, path11);
|
|
218
218
|
}
|
|
219
219
|
if (typeof ctrl !== "symbol") {
|
|
220
220
|
if (isCollection(node)) {
|
|
221
|
-
|
|
221
|
+
path11 = Object.freeze(path11.concat(node));
|
|
222
222
|
for (let i = 0; i < node.items.length; ++i) {
|
|
223
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
223
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path11);
|
|
224
224
|
if (typeof ci === "number")
|
|
225
225
|
i = ci - 1;
|
|
226
226
|
else if (ci === BREAK)
|
|
@@ -231,13 +231,13 @@ async function visitAsync_(key, node, visitor, path10) {
|
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
233
|
} else if (isPair(node)) {
|
|
234
|
-
|
|
235
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
234
|
+
path11 = Object.freeze(path11.concat(node));
|
|
235
|
+
const ck = await visitAsync_("key", node.key, visitor, path11);
|
|
236
236
|
if (ck === BREAK)
|
|
237
237
|
return BREAK;
|
|
238
238
|
else if (ck === REMOVE)
|
|
239
239
|
node.key = null;
|
|
240
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
240
|
+
const cv = await visitAsync_("value", node.value, visitor, path11);
|
|
241
241
|
if (cv === BREAK)
|
|
242
242
|
return BREAK;
|
|
243
243
|
else if (cv === REMOVE)
|
|
@@ -264,23 +264,23 @@ function initVisitor(visitor) {
|
|
|
264
264
|
}
|
|
265
265
|
return visitor;
|
|
266
266
|
}
|
|
267
|
-
function callVisitor(key, node, visitor,
|
|
267
|
+
function callVisitor(key, node, visitor, path11) {
|
|
268
268
|
if (typeof visitor === "function")
|
|
269
|
-
return visitor(key, node,
|
|
269
|
+
return visitor(key, node, path11);
|
|
270
270
|
if (isMap(node))
|
|
271
|
-
return visitor.Map?.(key, node,
|
|
271
|
+
return visitor.Map?.(key, node, path11);
|
|
272
272
|
if (isSeq(node))
|
|
273
|
-
return visitor.Seq?.(key, node,
|
|
273
|
+
return visitor.Seq?.(key, node, path11);
|
|
274
274
|
if (isPair(node))
|
|
275
|
-
return visitor.Pair?.(key, node,
|
|
275
|
+
return visitor.Pair?.(key, node, path11);
|
|
276
276
|
if (isScalar(node))
|
|
277
|
-
return visitor.Scalar?.(key, node,
|
|
277
|
+
return visitor.Scalar?.(key, node, path11);
|
|
278
278
|
if (isAlias(node))
|
|
279
|
-
return visitor.Alias?.(key, node,
|
|
279
|
+
return visitor.Alias?.(key, node, path11);
|
|
280
280
|
return void 0;
|
|
281
281
|
}
|
|
282
|
-
function replaceNode(key,
|
|
283
|
-
const parent =
|
|
282
|
+
function replaceNode(key, path11, node) {
|
|
283
|
+
const parent = path11[path11.length - 1];
|
|
284
284
|
if (isCollection(parent)) {
|
|
285
285
|
parent.items[key] = node;
|
|
286
286
|
} else if (isPair(parent)) {
|
|
@@ -809,10 +809,10 @@ function createNode(value, tagName, ctx) {
|
|
|
809
809
|
}
|
|
810
810
|
|
|
811
811
|
// ../../node_modules/yaml/browser/dist/nodes/Collection.js
|
|
812
|
-
function collectionFromPath(schema4,
|
|
812
|
+
function collectionFromPath(schema4, path11, value) {
|
|
813
813
|
let v = value;
|
|
814
|
-
for (let i =
|
|
815
|
-
const k =
|
|
814
|
+
for (let i = path11.length - 1; i >= 0; --i) {
|
|
815
|
+
const k = path11[i];
|
|
816
816
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
817
817
|
const a = [];
|
|
818
818
|
a[k] = v;
|
|
@@ -831,7 +831,7 @@ function collectionFromPath(schema4, path10, value) {
|
|
|
831
831
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
832
832
|
});
|
|
833
833
|
}
|
|
834
|
-
var isEmptyPath = (
|
|
834
|
+
var isEmptyPath = (path11) => path11 == null || typeof path11 === "object" && !!path11[Symbol.iterator]().next().done;
|
|
835
835
|
var Collection = class extends NodeBase {
|
|
836
836
|
constructor(type, schema4) {
|
|
837
837
|
super(type);
|
|
@@ -861,11 +861,11 @@ var Collection = class extends NodeBase {
|
|
|
861
861
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
862
862
|
* that already exists in the map.
|
|
863
863
|
*/
|
|
864
|
-
addIn(
|
|
865
|
-
if (isEmptyPath(
|
|
864
|
+
addIn(path11, value) {
|
|
865
|
+
if (isEmptyPath(path11))
|
|
866
866
|
this.add(value);
|
|
867
867
|
else {
|
|
868
|
-
const [key, ...rest] =
|
|
868
|
+
const [key, ...rest] = path11;
|
|
869
869
|
const node = this.get(key, true);
|
|
870
870
|
if (isCollection(node))
|
|
871
871
|
node.addIn(rest, value);
|
|
@@ -879,8 +879,8 @@ var Collection = class extends NodeBase {
|
|
|
879
879
|
* Removes a value from the collection.
|
|
880
880
|
* @returns `true` if the item was found and removed.
|
|
881
881
|
*/
|
|
882
|
-
deleteIn(
|
|
883
|
-
const [key, ...rest] =
|
|
882
|
+
deleteIn(path11) {
|
|
883
|
+
const [key, ...rest] = path11;
|
|
884
884
|
if (rest.length === 0)
|
|
885
885
|
return this.delete(key);
|
|
886
886
|
const node = this.get(key, true);
|
|
@@ -894,8 +894,8 @@ var Collection = class extends NodeBase {
|
|
|
894
894
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
895
895
|
* `true` (collections are always returned intact).
|
|
896
896
|
*/
|
|
897
|
-
getIn(
|
|
898
|
-
const [key, ...rest] =
|
|
897
|
+
getIn(path11, keepScalar) {
|
|
898
|
+
const [key, ...rest] = path11;
|
|
899
899
|
const node = this.get(key, true);
|
|
900
900
|
if (rest.length === 0)
|
|
901
901
|
return !keepScalar && isScalar(node) ? node.value : node;
|
|
@@ -913,8 +913,8 @@ var Collection = class extends NodeBase {
|
|
|
913
913
|
/**
|
|
914
914
|
* Checks if the collection includes a value with the key `key`.
|
|
915
915
|
*/
|
|
916
|
-
hasIn(
|
|
917
|
-
const [key, ...rest] =
|
|
916
|
+
hasIn(path11) {
|
|
917
|
+
const [key, ...rest] = path11;
|
|
918
918
|
if (rest.length === 0)
|
|
919
919
|
return this.has(key);
|
|
920
920
|
const node = this.get(key, true);
|
|
@@ -924,8 +924,8 @@ var Collection = class extends NodeBase {
|
|
|
924
924
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
925
925
|
* boolean to add/remove the item from the set.
|
|
926
926
|
*/
|
|
927
|
-
setIn(
|
|
928
|
-
const [key, ...rest] =
|
|
927
|
+
setIn(path11, value) {
|
|
928
|
+
const [key, ...rest] = path11;
|
|
929
929
|
if (rest.length === 0) {
|
|
930
930
|
this.set(key, value);
|
|
931
931
|
} else {
|
|
@@ -3064,9 +3064,9 @@ var Document = class _Document {
|
|
|
3064
3064
|
this.contents.add(value);
|
|
3065
3065
|
}
|
|
3066
3066
|
/** Adds a value to the document. */
|
|
3067
|
-
addIn(
|
|
3067
|
+
addIn(path11, value) {
|
|
3068
3068
|
if (assertCollection(this.contents))
|
|
3069
|
-
this.contents.addIn(
|
|
3069
|
+
this.contents.addIn(path11, value);
|
|
3070
3070
|
}
|
|
3071
3071
|
/**
|
|
3072
3072
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -3141,14 +3141,14 @@ var Document = class _Document {
|
|
|
3141
3141
|
* Removes a value from the document.
|
|
3142
3142
|
* @returns `true` if the item was found and removed.
|
|
3143
3143
|
*/
|
|
3144
|
-
deleteIn(
|
|
3145
|
-
if (isEmptyPath(
|
|
3144
|
+
deleteIn(path11) {
|
|
3145
|
+
if (isEmptyPath(path11)) {
|
|
3146
3146
|
if (this.contents == null)
|
|
3147
3147
|
return false;
|
|
3148
3148
|
this.contents = null;
|
|
3149
3149
|
return true;
|
|
3150
3150
|
}
|
|
3151
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
3151
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path11) : false;
|
|
3152
3152
|
}
|
|
3153
3153
|
/**
|
|
3154
3154
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -3163,10 +3163,10 @@ var Document = class _Document {
|
|
|
3163
3163
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
3164
3164
|
* `true` (collections are always returned intact).
|
|
3165
3165
|
*/
|
|
3166
|
-
getIn(
|
|
3167
|
-
if (isEmptyPath(
|
|
3166
|
+
getIn(path11, keepScalar) {
|
|
3167
|
+
if (isEmptyPath(path11))
|
|
3168
3168
|
return !keepScalar && isScalar(this.contents) ? this.contents.value : this.contents;
|
|
3169
|
-
return isCollection(this.contents) ? this.contents.getIn(
|
|
3169
|
+
return isCollection(this.contents) ? this.contents.getIn(path11, keepScalar) : void 0;
|
|
3170
3170
|
}
|
|
3171
3171
|
/**
|
|
3172
3172
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -3177,10 +3177,10 @@ var Document = class _Document {
|
|
|
3177
3177
|
/**
|
|
3178
3178
|
* Checks if the document includes a value at `path`.
|
|
3179
3179
|
*/
|
|
3180
|
-
hasIn(
|
|
3181
|
-
if (isEmptyPath(
|
|
3180
|
+
hasIn(path11) {
|
|
3181
|
+
if (isEmptyPath(path11))
|
|
3182
3182
|
return this.contents !== void 0;
|
|
3183
|
-
return isCollection(this.contents) ? this.contents.hasIn(
|
|
3183
|
+
return isCollection(this.contents) ? this.contents.hasIn(path11) : false;
|
|
3184
3184
|
}
|
|
3185
3185
|
/**
|
|
3186
3186
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -3197,13 +3197,13 @@ var Document = class _Document {
|
|
|
3197
3197
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
3198
3198
|
* boolean to add/remove the item from the set.
|
|
3199
3199
|
*/
|
|
3200
|
-
setIn(
|
|
3201
|
-
if (isEmptyPath(
|
|
3200
|
+
setIn(path11, value) {
|
|
3201
|
+
if (isEmptyPath(path11)) {
|
|
3202
3202
|
this.contents = value;
|
|
3203
3203
|
} else if (this.contents == null) {
|
|
3204
|
-
this.contents = collectionFromPath(this.schema, Array.from(
|
|
3204
|
+
this.contents = collectionFromPath(this.schema, Array.from(path11), value);
|
|
3205
3205
|
} else if (assertCollection(this.contents)) {
|
|
3206
|
-
this.contents.setIn(
|
|
3206
|
+
this.contents.setIn(path11, value);
|
|
3207
3207
|
}
|
|
3208
3208
|
}
|
|
3209
3209
|
/**
|
|
@@ -4999,9 +4999,9 @@ function visit2(cst, visitor) {
|
|
|
4999
4999
|
visit2.BREAK = BREAK2;
|
|
5000
5000
|
visit2.SKIP = SKIP2;
|
|
5001
5001
|
visit2.REMOVE = REMOVE2;
|
|
5002
|
-
visit2.itemAtPath = (cst,
|
|
5002
|
+
visit2.itemAtPath = (cst, path11) => {
|
|
5003
5003
|
let item = cst;
|
|
5004
|
-
for (const [field, index] of
|
|
5004
|
+
for (const [field, index] of path11) {
|
|
5005
5005
|
const tok = item?.[field];
|
|
5006
5006
|
if (tok && "items" in tok) {
|
|
5007
5007
|
item = tok.items[index];
|
|
@@ -5010,23 +5010,23 @@ visit2.itemAtPath = (cst, path10) => {
|
|
|
5010
5010
|
}
|
|
5011
5011
|
return item;
|
|
5012
5012
|
};
|
|
5013
|
-
visit2.parentCollection = (cst,
|
|
5014
|
-
const parent = visit2.itemAtPath(cst,
|
|
5015
|
-
const field =
|
|
5013
|
+
visit2.parentCollection = (cst, path11) => {
|
|
5014
|
+
const parent = visit2.itemAtPath(cst, path11.slice(0, -1));
|
|
5015
|
+
const field = path11[path11.length - 1][0];
|
|
5016
5016
|
const coll = parent?.[field];
|
|
5017
5017
|
if (coll && "items" in coll)
|
|
5018
5018
|
return coll;
|
|
5019
5019
|
throw new Error("Parent collection not found");
|
|
5020
5020
|
};
|
|
5021
|
-
function _visit(
|
|
5022
|
-
let ctrl = visitor(item,
|
|
5021
|
+
function _visit(path11, item, visitor) {
|
|
5022
|
+
let ctrl = visitor(item, path11);
|
|
5023
5023
|
if (typeof ctrl === "symbol")
|
|
5024
5024
|
return ctrl;
|
|
5025
5025
|
for (const field of ["key", "value"]) {
|
|
5026
5026
|
const token = item[field];
|
|
5027
5027
|
if (token && "items" in token) {
|
|
5028
5028
|
for (let i = 0; i < token.items.length; ++i) {
|
|
5029
|
-
const ci = _visit(Object.freeze(
|
|
5029
|
+
const ci = _visit(Object.freeze(path11.concat([[field, i]])), token.items[i], visitor);
|
|
5030
5030
|
if (typeof ci === "number")
|
|
5031
5031
|
i = ci - 1;
|
|
5032
5032
|
else if (ci === BREAK2)
|
|
@@ -5037,10 +5037,10 @@ function _visit(path10, item, visitor) {
|
|
|
5037
5037
|
}
|
|
5038
5038
|
}
|
|
5039
5039
|
if (typeof ctrl === "function" && field === "key")
|
|
5040
|
-
ctrl = ctrl(item,
|
|
5040
|
+
ctrl = ctrl(item, path11);
|
|
5041
5041
|
}
|
|
5042
5042
|
}
|
|
5043
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
5043
|
+
return typeof ctrl === "function" ? ctrl(item, path11) : ctrl;
|
|
5044
5044
|
}
|
|
5045
5045
|
|
|
5046
5046
|
// ../../node_modules/yaml/browser/dist/parse/cst.js
|
|
@@ -7410,9 +7410,9 @@ var EXCERPT = /^(\s*)(\d+)( \| )(.*)$/;
|
|
|
7410
7410
|
var MARKER = /^(\s*)( \| )(.*)$/;
|
|
7411
7411
|
function designTimeDiagnostic(output, files) {
|
|
7412
7412
|
const rewritten = /* @__PURE__ */ new Map();
|
|
7413
|
-
const linesOf = (
|
|
7413
|
+
const linesOf = (path11) => {
|
|
7414
7414
|
const file = Object.keys(files).find(
|
|
7415
|
-
(name2) => name2.endsWith(".swift") && (
|
|
7415
|
+
(name2) => name2.endsWith(".swift") && (path11 === name2 || path11.endsWith(`/${name2}`))
|
|
7416
7416
|
);
|
|
7417
7417
|
if (file === void 0) return null;
|
|
7418
7418
|
let lines = rewritten.get(file);
|
|
@@ -7523,20 +7523,20 @@ function swiftSdkOptions() {
|
|
|
7523
7523
|
}
|
|
7524
7524
|
return [];
|
|
7525
7525
|
}
|
|
7526
|
-
var SWIFT_HOST_COMPILER_RELEASE = "swift-6.4.0-RELEASE-custom-
|
|
7527
|
-
var SWIFT_HOST_COMPILER_ID = "
|
|
7526
|
+
var SWIFT_HOST_COMPILER_RELEASE = "swift-6.4.0-RELEASE-custom-8be2e4a7a393b003";
|
|
7527
|
+
var SWIFT_HOST_COMPILER_ID = "8be2e4a7a393b003";
|
|
7528
7528
|
var compilerArchives = {
|
|
7529
7529
|
"darwin-arm64": {
|
|
7530
|
-
checksum: "
|
|
7531
|
-
manifest: "
|
|
7530
|
+
checksum: "88d69b7ac912962adaadce9fdb2c57fe07cd19e4d8158088e0acbd247496ca6d",
|
|
7531
|
+
manifest: "70d5e2be8c959eb5dd1d9b576e6c209e1f58bfb9089f90c38c2d7e087759f0b3"
|
|
7532
7532
|
},
|
|
7533
7533
|
"linux-x64": {
|
|
7534
|
-
checksum: "
|
|
7535
|
-
manifest: "
|
|
7534
|
+
checksum: "7c42ded03742d16816e64f8ae8fca478aaaff450d22ab3d698daf78c010854b2",
|
|
7535
|
+
manifest: "90cfb09c5a0ba8c119066787cf47244a45bf3cda68dce94c6b1a16337b9b91bd"
|
|
7536
7536
|
},
|
|
7537
7537
|
"linux-arm64": {
|
|
7538
|
-
checksum: "
|
|
7539
|
-
manifest: "
|
|
7538
|
+
checksum: "f9f1d96fb1a6325d3bb30ab12a75fc06e4e8535aab58a91581e03f3d91f68fa6",
|
|
7539
|
+
manifest: "f988181dce795f6c8a6d4a8d86f7b61768f23a743b4e7bea76e64862ef328ad6"
|
|
7540
7540
|
}
|
|
7541
7541
|
};
|
|
7542
7542
|
function swiftHostCompilerArchive(release, host2 = `${process.platform}-${process.arch}`) {
|
|
@@ -9116,12 +9116,65 @@ for (const [file, text3] of tree) {
|
|
|
9116
9116
|
}
|
|
9117
9117
|
|
|
9118
9118
|
// src/swift-objc-standin.ts
|
|
9119
|
-
var
|
|
9119
|
+
var import_node_child_process6 = require("node:child_process");
|
|
9120
9120
|
var import_node_crypto5 = require("node:crypto");
|
|
9121
9121
|
var import_node_fs5 = __toESM(require("node:fs"), 1);
|
|
9122
|
+
var import_node_path8 = __toESM(require("node:path"), 1);
|
|
9123
|
+
|
|
9124
|
+
// src/swift-objc-platform.ts
|
|
9125
|
+
var import_node_child_process5 = require("node:child_process");
|
|
9122
9126
|
var import_node_path7 = __toESM(require("node:path"), 1);
|
|
9127
|
+
var platforms = /* @__PURE__ */ new Map();
|
|
9128
|
+
function swiftObjCPlatformFlags(toolchainBin, minimum) {
|
|
9129
|
+
const key = `${toolchainBin}:${minimum}`;
|
|
9130
|
+
const cached = platforms.get(key);
|
|
9131
|
+
if (cached) return cached;
|
|
9132
|
+
const version = [
|
|
9133
|
+
Math.floor(minimum / 1e4),
|
|
9134
|
+
Math.floor(minimum % 1e4 / 100),
|
|
9135
|
+
minimum % 100
|
|
9136
|
+
].join(".");
|
|
9137
|
+
const result = (0, import_node_child_process5.spawnSync)(
|
|
9138
|
+
import_node_path7.default.join(toolchainBin, "clang"),
|
|
9139
|
+
[
|
|
9140
|
+
"-target",
|
|
9141
|
+
`arm64-apple-ios${version}-simulator`,
|
|
9142
|
+
"-dM",
|
|
9143
|
+
"-E",
|
|
9144
|
+
"-x",
|
|
9145
|
+
"objective-c",
|
|
9146
|
+
"-"
|
|
9147
|
+
],
|
|
9148
|
+
{
|
|
9149
|
+
input: "",
|
|
9150
|
+
encoding: "utf8",
|
|
9151
|
+
env: swiftEnvironment(),
|
|
9152
|
+
timeout: 3e4,
|
|
9153
|
+
maxBuffer: 1024 * 1024
|
|
9154
|
+
}
|
|
9155
|
+
);
|
|
9156
|
+
if (result.error || result.status !== 0)
|
|
9157
|
+
throw new Error(
|
|
9158
|
+
`could not read iOS compiler platform predefines: ${result.error?.message ?? result.stderr}`
|
|
9159
|
+
);
|
|
9160
|
+
const flags = [
|
|
9161
|
+
...result.stdout.matchAll(
|
|
9162
|
+
/^#define (TARGET_OS_\w+|TARGET_IPHONE_SIMULATOR|__APPLE\w*__|__MACH__|__ENVIRONMENT_\w+) (.*)$/gm
|
|
9163
|
+
)
|
|
9164
|
+
].map(([, name2, value]) => `-D${name2}=${value}`);
|
|
9165
|
+
if (!flags.includes("-D__APPLE__=1") || !flags.includes("-D__MACH__=1"))
|
|
9166
|
+
throw new Error("iOS compiler platform predefines lack Apple and Mach identity");
|
|
9167
|
+
platforms.set(key, flags);
|
|
9168
|
+
return flags;
|
|
9169
|
+
}
|
|
9170
|
+
|
|
9171
|
+
// src/swift-objc-standin.ts
|
|
9123
9172
|
var NATIVE_GRAPH_SDK_VERSION = "27.1";
|
|
9124
|
-
var WASI_EMULATION = [
|
|
9173
|
+
var WASI_EMULATION = [
|
|
9174
|
+
"_WASI_EMULATED_SIGNAL",
|
|
9175
|
+
"_WASI_EMULATED_MMAN",
|
|
9176
|
+
"_WASI_EMULATED_PROCESS_CLOCKS"
|
|
9177
|
+
];
|
|
9125
9178
|
var WASI_EMULATION_FLAGS = WASI_EMULATION.map((name2) => `-D${name2}`);
|
|
9126
9179
|
var NATIVE_GRAPH_INPUTS = {
|
|
9127
9180
|
sdk: NATIVE_GRAPH_SDK_VERSION,
|
|
@@ -9147,13 +9200,13 @@ ${text3}`
|
|
|
9147
9200
|
}
|
|
9148
9201
|
var IOS_SDK_ID = (0, import_node_crypto5.createHash)("sha256").update(JSON.stringify(iosSdkEntries())).digest("hex").slice(0, 16);
|
|
9149
9202
|
function materializeObjcSdk(cacheDir2) {
|
|
9150
|
-
const sdk =
|
|
9203
|
+
const sdk = import_node_path8.default.join(cacheDir2, "ios-sdk", IOS_SDK_ID);
|
|
9151
9204
|
if (import_node_fs5.default.existsSync(sdk)) return sdk;
|
|
9152
|
-
import_node_fs5.default.mkdirSync(
|
|
9205
|
+
import_node_fs5.default.mkdirSync(import_node_path8.default.dirname(sdk), { recursive: true });
|
|
9153
9206
|
const staging = import_node_fs5.default.mkdtempSync(`${sdk}-`);
|
|
9154
9207
|
for (const [file, text3] of iosSdkEntries()) {
|
|
9155
|
-
import_node_fs5.default.mkdirSync(
|
|
9156
|
-
import_node_fs5.default.writeFileSync(
|
|
9208
|
+
import_node_fs5.default.mkdirSync(import_node_path8.default.dirname(import_node_path8.default.join(staging, file)), { recursive: true });
|
|
9209
|
+
import_node_fs5.default.writeFileSync(import_node_path8.default.join(staging, file), text3);
|
|
9157
9210
|
}
|
|
9158
9211
|
try {
|
|
9159
9212
|
import_node_fs5.default.renameSync(staging, sdk);
|
|
@@ -9163,6 +9216,33 @@ function materializeObjcSdk(cacheDir2) {
|
|
|
9163
9216
|
}
|
|
9164
9217
|
return sdk;
|
|
9165
9218
|
}
|
|
9219
|
+
function objcSdkIntakeFlags(headers, toolchainBin, minimum) {
|
|
9220
|
+
return [
|
|
9221
|
+
...swiftObjCPlatformFlags(toolchainBin, minimum),
|
|
9222
|
+
// AvailabilityInternal.h derives this through __is_target_os(ios), which
|
|
9223
|
+
// is false for wasm32.
|
|
9224
|
+
`-D__IPHONE_OS_VERSION_MIN_REQUIRED=${minimum}`,
|
|
9225
|
+
// apple's build setting for a 32-bit target to keep NSInteger and
|
|
9226
|
+
// NSUInteger long, the nominal types they have on arm64.
|
|
9227
|
+
"-DNS_BUILD_32_LIKE_64=1",
|
|
9228
|
+
// the installed libc's default feature set otherwise defines
|
|
9229
|
+
// _XOPEN_SOURCE, which darwin's sys/cdefs.h turns into a strict posix
|
|
9230
|
+
// level; iOS compiles at darwin's full level with neither defined.
|
|
9231
|
+
"-D_BSD_SOURCE",
|
|
9232
|
+
...WASI_EMULATION_FLAGS,
|
|
9233
|
+
"-iframework",
|
|
9234
|
+
import_node_path8.default.join(headers, "System/Library/Frameworks"),
|
|
9235
|
+
"-isystem",
|
|
9236
|
+
import_node_path8.default.join(headers, "wasm/include"),
|
|
9237
|
+
"-idirafter",
|
|
9238
|
+
import_node_path8.default.join(headers, "usr/include")
|
|
9239
|
+
];
|
|
9240
|
+
}
|
|
9241
|
+
function iosDeploymentMinimum(version) {
|
|
9242
|
+
const parts = /^(\d{1,2})(?:\.(\d{1,2}))?(?:\.(\d{1,2}))?$/.exec(version ?? "");
|
|
9243
|
+
if (!parts) return void 0;
|
|
9244
|
+
return Number(parts[1]) * 1e4 + Number(parts[2] ?? 0) * 100 + Number(parts[3] ?? 0);
|
|
9245
|
+
}
|
|
9166
9246
|
var headerFiles = (dir) => import_node_fs5.default.readdirSync(dir, { recursive: true, encoding: "utf8" }).filter((file) => file.endsWith(".h")).sort();
|
|
9167
9247
|
function missingHeader(missing) {
|
|
9168
9248
|
const lines = ["#import <Foundation/Foundation.h>", "#import <UIKit/UIKit.h>"];
|
|
@@ -9185,52 +9265,52 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
|
|
|
9185
9265
|
`this peach's Swift has no iOS simulator standard library at ${stdlib}`
|
|
9186
9266
|
);
|
|
9187
9267
|
const sdk = materializeObjcSdk(cacheDir2);
|
|
9188
|
-
const framework =
|
|
9189
|
-
const frameworks =
|
|
9190
|
-
const include =
|
|
9191
|
-
const headersDir = framework ?
|
|
9268
|
+
const framework = import_node_path8.default.basename(import_node_path8.default.dirname(surface.modulemap)) === "Modules";
|
|
9269
|
+
const frameworks = import_node_path8.default.join(work, "frameworks");
|
|
9270
|
+
const include = import_node_path8.default.join(work, "include");
|
|
9271
|
+
const headersDir = framework ? import_node_path8.default.join(frameworks, `${surface.module}.framework`, "Headers") : import_node_path8.default.join(include, surface.module);
|
|
9192
9272
|
import_node_fs5.default.mkdirSync(headersDir, { recursive: true });
|
|
9193
9273
|
const originals = new Map(
|
|
9194
9274
|
headerFiles(surface.headers).map((file) => [
|
|
9195
|
-
|
|
9196
|
-
import_node_fs5.default.readFileSync(
|
|
9275
|
+
import_node_path8.default.join(headersDir, file),
|
|
9276
|
+
import_node_fs5.default.readFileSync(import_node_path8.default.join(surface.headers, file), "utf8")
|
|
9197
9277
|
])
|
|
9198
9278
|
);
|
|
9199
9279
|
for (const [file, text3] of originals) {
|
|
9200
|
-
import_node_fs5.default.mkdirSync(
|
|
9280
|
+
import_node_fs5.default.mkdirSync(import_node_path8.default.dirname(file), { recursive: true });
|
|
9201
9281
|
import_node_fs5.default.writeFileSync(file, text3);
|
|
9202
9282
|
}
|
|
9203
9283
|
if (framework) {
|
|
9204
|
-
import_node_fs5.default.mkdirSync(
|
|
9284
|
+
import_node_fs5.default.mkdirSync(import_node_path8.default.join(frameworks, `${surface.module}.framework`, "Modules"), {
|
|
9205
9285
|
recursive: true
|
|
9206
9286
|
});
|
|
9207
9287
|
import_node_fs5.default.copyFileSync(
|
|
9208
9288
|
surface.modulemap,
|
|
9209
|
-
|
|
9289
|
+
import_node_path8.default.join(frameworks, `${surface.module}.framework`, "Modules", "module.modulemap")
|
|
9210
9290
|
);
|
|
9211
9291
|
} else {
|
|
9212
|
-
import_node_fs5.default.copyFileSync(surface.modulemap,
|
|
9292
|
+
import_node_fs5.default.copyFileSync(surface.modulemap, import_node_path8.default.join(headersDir, "module.modulemap"));
|
|
9213
9293
|
}
|
|
9214
9294
|
const dependencyOriginals = /* @__PURE__ */ new Map();
|
|
9215
9295
|
for (const dependency of surface.dependencies ?? []) {
|
|
9216
|
-
const dir =
|
|
9296
|
+
const dir = import_node_path8.default.join(include, dependency.module);
|
|
9217
9297
|
import_node_fs5.default.mkdirSync(dir, { recursive: true });
|
|
9218
9298
|
for (const file of headerFiles(dependency.headers)) {
|
|
9219
|
-
const destination =
|
|
9220
|
-
const text3 = import_node_fs5.default.readFileSync(
|
|
9299
|
+
const destination = import_node_path8.default.join(dir, file);
|
|
9300
|
+
const text3 = import_node_fs5.default.readFileSync(import_node_path8.default.join(dependency.headers, file), "utf8");
|
|
9221
9301
|
dependencyOriginals.set(destination, text3);
|
|
9222
|
-
import_node_fs5.default.mkdirSync(
|
|
9302
|
+
import_node_fs5.default.mkdirSync(import_node_path8.default.dirname(destination), { recursive: true });
|
|
9223
9303
|
import_node_fs5.default.writeFileSync(destination, text3);
|
|
9224
9304
|
}
|
|
9225
|
-
const supplied =
|
|
9305
|
+
const supplied = import_node_path8.default.join(dependency.headers, "module.modulemap");
|
|
9226
9306
|
import_node_fs5.default.writeFileSync(
|
|
9227
|
-
|
|
9307
|
+
import_node_path8.default.join(dir, "module.modulemap"),
|
|
9228
9308
|
import_node_fs5.default.existsSync(supplied) ? import_node_fs5.default.readFileSync(supplied, "utf8") : `module ${dependency.module} { umbrella "." export * }
|
|
9229
9309
|
`
|
|
9230
9310
|
);
|
|
9231
9311
|
}
|
|
9232
|
-
const stubs =
|
|
9233
|
-
const stubIncludes =
|
|
9312
|
+
const stubs = import_node_path8.default.join(work, "stubs");
|
|
9313
|
+
const stubIncludes = import_node_path8.default.join(work, "stub-include");
|
|
9234
9314
|
import_node_fs5.default.mkdirSync(stubs, { recursive: true });
|
|
9235
9315
|
import_node_fs5.default.mkdirSync(stubIncludes, { recursive: true });
|
|
9236
9316
|
const search = [
|
|
@@ -9238,11 +9318,11 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
|
|
|
9238
9318
|
sdk,
|
|
9239
9319
|
// keep compiler support headers without importing host platform modules.
|
|
9240
9320
|
"-resource-dir",
|
|
9241
|
-
|
|
9321
|
+
import_node_path8.default.join(sdk, "usr/lib/swift"),
|
|
9242
9322
|
"-I",
|
|
9243
|
-
|
|
9323
|
+
import_node_path8.default.resolve(toolchainBin, "../lib/swift/clang/include"),
|
|
9244
9324
|
"-I",
|
|
9245
|
-
|
|
9325
|
+
import_node_path8.default.resolve(toolchainBin, "../lib/swift/shims"),
|
|
9246
9326
|
"-I",
|
|
9247
9327
|
stdlib,
|
|
9248
9328
|
"-F",
|
|
@@ -9253,7 +9333,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
|
|
|
9253
9333
|
headersDir,
|
|
9254
9334
|
...(surface.dependencies ?? []).flatMap((dependency) => [
|
|
9255
9335
|
"-I",
|
|
9256
|
-
|
|
9336
|
+
import_node_path8.default.join(include, dependency.module)
|
|
9257
9337
|
]),
|
|
9258
9338
|
"-F",
|
|
9259
9339
|
stubs,
|
|
@@ -9262,7 +9342,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
|
|
|
9262
9342
|
];
|
|
9263
9343
|
const missing = /* @__PURE__ */ new Map();
|
|
9264
9344
|
const stubbed = /* @__PURE__ */ new Set();
|
|
9265
|
-
const out =
|
|
9345
|
+
const out = import_node_path8.default.join(work, "graphs");
|
|
9266
9346
|
const stub = (include2) => {
|
|
9267
9347
|
if (stubbed.has(include2)) return false;
|
|
9268
9348
|
stubbed.add(include2);
|
|
@@ -9274,22 +9354,22 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
|
|
|
9274
9354
|
IOS_SDK_HEADERS,
|
|
9275
9355
|
`System/Library/Frameworks/${name2}.framework/Headers/${name2}.h`
|
|
9276
9356
|
)) {
|
|
9277
|
-
const header2 =
|
|
9278
|
-
import_node_fs5.default.mkdirSync(
|
|
9357
|
+
const header2 = import_node_path8.default.join(stubIncludes, include2);
|
|
9358
|
+
import_node_fs5.default.mkdirSync(import_node_path8.default.dirname(header2), { recursive: true });
|
|
9279
9359
|
import_node_fs5.default.writeFileSync(header2, `#import <${umbrella}>
|
|
9280
9360
|
`);
|
|
9281
9361
|
return true;
|
|
9282
9362
|
}
|
|
9283
|
-
const root =
|
|
9284
|
-
const header =
|
|
9285
|
-
import_node_fs5.default.mkdirSync(
|
|
9363
|
+
const root = import_node_path8.default.join(stubs, `${name2}.framework`);
|
|
9364
|
+
const header = import_node_path8.default.join(root, "Headers", include2.slice(slash + 1));
|
|
9365
|
+
import_node_fs5.default.mkdirSync(import_node_path8.default.dirname(header), { recursive: true });
|
|
9286
9366
|
import_node_fs5.default.writeFileSync(
|
|
9287
9367
|
header,
|
|
9288
9368
|
"#import <Foundation/Foundation.h>\n#import <UIKit/UIKit.h>\n"
|
|
9289
9369
|
);
|
|
9290
|
-
import_node_fs5.default.mkdirSync(
|
|
9370
|
+
import_node_fs5.default.mkdirSync(import_node_path8.default.join(root, "Modules"), { recursive: true });
|
|
9291
9371
|
import_node_fs5.default.writeFileSync(
|
|
9292
|
-
|
|
9372
|
+
import_node_path8.default.join(root, "Modules", "module.modulemap"),
|
|
9293
9373
|
`framework module ${name2} {
|
|
9294
9374
|
umbrella "Headers"
|
|
9295
9375
|
export *
|
|
@@ -9298,19 +9378,19 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
|
|
|
9298
9378
|
`
|
|
9299
9379
|
);
|
|
9300
9380
|
} else {
|
|
9301
|
-
const header =
|
|
9302
|
-
import_node_fs5.default.mkdirSync(
|
|
9381
|
+
const header = import_node_path8.default.join(stubIncludes, include2);
|
|
9382
|
+
import_node_fs5.default.mkdirSync(import_node_path8.default.dirname(header), { recursive: true });
|
|
9303
9383
|
import_node_fs5.default.writeFileSync(header, "");
|
|
9304
9384
|
}
|
|
9305
9385
|
return true;
|
|
9306
9386
|
};
|
|
9307
9387
|
const declareMissing = () => {
|
|
9308
|
-
const root =
|
|
9309
|
-
import_node_fs5.default.mkdirSync(
|
|
9310
|
-
import_node_fs5.default.mkdirSync(
|
|
9311
|
-
import_node_fs5.default.writeFileSync(
|
|
9388
|
+
const root = import_node_path8.default.join(stubs, "PeachMissing.framework");
|
|
9389
|
+
import_node_fs5.default.mkdirSync(import_node_path8.default.join(root, "Headers"), { recursive: true });
|
|
9390
|
+
import_node_fs5.default.mkdirSync(import_node_path8.default.join(root, "Modules"), { recursive: true });
|
|
9391
|
+
import_node_fs5.default.writeFileSync(import_node_path8.default.join(root, "Headers", "PeachMissing.h"), missingHeader(missing));
|
|
9312
9392
|
import_node_fs5.default.writeFileSync(
|
|
9313
|
-
|
|
9393
|
+
import_node_path8.default.join(root, "Modules", "module.modulemap"),
|
|
9314
9394
|
'framework module PeachMissing {\n umbrella header "PeachMissing.h"\n export *\n}\n'
|
|
9315
9395
|
);
|
|
9316
9396
|
for (const [file, text3] of [...originals, ...dependencyOriginals])
|
|
@@ -9327,8 +9407,8 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
|
|
|
9327
9407
|
for (let round = 0; ; round++) {
|
|
9328
9408
|
import_node_fs5.default.rmSync(out, { recursive: true, force: true });
|
|
9329
9409
|
import_node_fs5.default.mkdirSync(out, { recursive: true });
|
|
9330
|
-
const run2 = (0,
|
|
9331
|
-
|
|
9410
|
+
const run2 = (0, import_node_child_process6.spawnSync)(
|
|
9411
|
+
import_node_path8.default.join(toolchainBin, "swift-symbolgraph-extract"),
|
|
9332
9412
|
[
|
|
9333
9413
|
"-module-name",
|
|
9334
9414
|
surface.module,
|
|
@@ -9337,7 +9417,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
|
|
|
9337
9417
|
...search,
|
|
9338
9418
|
...original?.flags.flatMap((flag) => ["-Xcc", flag]) ?? [],
|
|
9339
9419
|
"-module-cache-path",
|
|
9340
|
-
|
|
9420
|
+
import_node_path8.default.join(cacheDir2, "ios-module-cache"),
|
|
9341
9421
|
"-minimum-access-level",
|
|
9342
9422
|
// symbol graphs hide public underscored names at the public threshold.
|
|
9343
9423
|
// original clang headers remain the declaration boundary.
|
|
@@ -9400,7 +9480,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir2, work, original) {
|
|
|
9400
9480
|
);
|
|
9401
9481
|
if (missing.size > 0) declareMissing();
|
|
9402
9482
|
}
|
|
9403
|
-
const graphs = import_node_fs5.default.readdirSync(out).filter((name2) => name2.endsWith(".symbols.json")).sort().map((name2) => JSON.parse(import_node_fs5.default.readFileSync(
|
|
9483
|
+
const graphs = import_node_fs5.default.readdirSync(out).filter((name2) => name2.endsWith(".symbols.json")).sort().map((name2) => JSON.parse(import_node_fs5.default.readFileSync(import_node_path8.default.join(out, name2), "utf8")));
|
|
9404
9484
|
const imports = /* @__PURE__ */ new Set(["Foundation", "UIKit"]);
|
|
9405
9485
|
for (const text3 of originals.values())
|
|
9406
9486
|
for (const match of text3.matchAll(
|
|
@@ -9429,7 +9509,7 @@ function objcDeclarationAST(surface, framework, toolchainBin, search, work, orig
|
|
|
9429
9509
|
const roots = [
|
|
9430
9510
|
...import_node_fs5.default.readFileSync(surface.modulemap, "utf8").matchAll(/(?:umbrella\s+)?header\s+"([^"]+)"/g)
|
|
9431
9511
|
].map((match) => match[1]);
|
|
9432
|
-
const probe =
|
|
9512
|
+
const probe = import_node_path8.default.join(work, "declarations.m");
|
|
9433
9513
|
import_node_fs5.default.writeFileSync(
|
|
9434
9514
|
probe,
|
|
9435
9515
|
roots.map(
|
|
@@ -9459,8 +9539,8 @@ function objcDeclarationAST(surface, framework, toolchainBin, search, work, orig
|
|
|
9459
9539
|
"-ast-dump-all=json"
|
|
9460
9540
|
];
|
|
9461
9541
|
const dump = (filter) => {
|
|
9462
|
-
const run2 = (0,
|
|
9463
|
-
|
|
9542
|
+
const run2 = (0, import_node_child_process6.spawnSync)(
|
|
9543
|
+
import_node_path8.default.join(toolchainBin, "clang"),
|
|
9464
9544
|
[
|
|
9465
9545
|
...args,
|
|
9466
9546
|
...filter ? ["-Xclang", "-ast-dump-filter", "-Xclang", filter] : [],
|
|
@@ -9524,7 +9604,7 @@ function enumValues(graphs, surface, framework, toolchainBin, search, work, orig
|
|
|
9524
9604
|
const roots = [
|
|
9525
9605
|
...import_node_fs5.default.readFileSync(surface.modulemap, "utf8").matchAll(/(?:umbrella\s+)?header\s+"([^"]+)"/g)
|
|
9526
9606
|
].map((match) => match[1]);
|
|
9527
|
-
const probe =
|
|
9607
|
+
const probe = import_node_path8.default.join(work, "values.m");
|
|
9528
9608
|
import_node_fs5.default.writeFileSync(
|
|
9529
9609
|
probe,
|
|
9530
9610
|
roots.map(
|
|
@@ -9539,8 +9619,8 @@ function enumValues(graphs, surface, framework, toolchainBin, search, work, orig
|
|
|
9539
9619
|
if (flag === "-sdk") flags.push("-isysroot", dir);
|
|
9540
9620
|
else flags.push(flag, dir);
|
|
9541
9621
|
}
|
|
9542
|
-
const run2 = (0,
|
|
9543
|
-
|
|
9622
|
+
const run2 = (0, import_node_child_process6.spawnSync)(
|
|
9623
|
+
import_node_path8.default.join(toolchainBin, "clang"),
|
|
9544
9624
|
[
|
|
9545
9625
|
"-x",
|
|
9546
9626
|
"objective-c",
|
|
@@ -9553,7 +9633,7 @@ function enumValues(graphs, surface, framework, toolchainBin, search, work, orig
|
|
|
9553
9633
|
original?.target ?? IOS_SDK_TARGET,
|
|
9554
9634
|
...flags,
|
|
9555
9635
|
...original?.flags ?? [],
|
|
9556
|
-
`-fmodules-cache-path=${
|
|
9636
|
+
`-fmodules-cache-path=${import_node_path8.default.join(work, "clang-modules")}`,
|
|
9557
9637
|
"-Xclang",
|
|
9558
9638
|
"-ast-dump=json",
|
|
9559
9639
|
probe
|
|
@@ -9839,8 +9919,8 @@ var swiftEscapes = {
|
|
|
9839
9919
|
r: "\r",
|
|
9840
9920
|
t: " "
|
|
9841
9921
|
};
|
|
9842
|
-
function
|
|
9843
|
-
const
|
|
9922
|
+
function settingsBlocks(call, tool) {
|
|
9923
|
+
const bodies = [];
|
|
9844
9924
|
for (const open of call.matchAll(new RegExp(`\\b${tool}Settings\\s*:\\s*\\[`, "g"))) {
|
|
9845
9925
|
let depth = 1;
|
|
9846
9926
|
let index = open.index + open[0].length;
|
|
@@ -9853,7 +9933,28 @@ function settingDefines(call, tool) {
|
|
|
9853
9933
|
} else if (char === "[") depth++;
|
|
9854
9934
|
else if (char === "]") depth--;
|
|
9855
9935
|
}
|
|
9856
|
-
|
|
9936
|
+
bodies.push(call.slice(start, index - 1));
|
|
9937
|
+
}
|
|
9938
|
+
return bodies;
|
|
9939
|
+
}
|
|
9940
|
+
function settingFeatures(call, setting) {
|
|
9941
|
+
const found = [];
|
|
9942
|
+
for (const body of settingsBlocks(call, "swift")) {
|
|
9943
|
+
if (setting === ".unsafeFlags") {
|
|
9944
|
+
for (const list of body.matchAll(/\.unsafeFlags\(\s*\[([^\]]*)\]/g))
|
|
9945
|
+
for (const match of list[1].matchAll(/"((?:[^"\\]|\\.)*)"/g))
|
|
9946
|
+
found.push(JSON.parse(`"${match[1]}"`));
|
|
9947
|
+
} else {
|
|
9948
|
+
const name2 = "([A-Za-z_][A-Za-z0-9_]*(?:=[A-Za-z_][A-Za-z0-9_.-]*)?)";
|
|
9949
|
+
const pattern = setting === ".enableExperimentalFeature" ? new RegExp(`\\.enableExperimentalFeature\\(\\s*"${name2}"\\s*\\)`, "g") : new RegExp(`\\.enableUpcomingFeature\\(\\s*"${name2}"\\s*\\)`, "g");
|
|
9950
|
+
for (const match of body.matchAll(pattern)) found.push(match[1]);
|
|
9951
|
+
}
|
|
9952
|
+
}
|
|
9953
|
+
return found;
|
|
9954
|
+
}
|
|
9955
|
+
function settingDefines(call, tool) {
|
|
9956
|
+
const defines = [];
|
|
9957
|
+
for (const body of settingsBlocks(call, tool)) {
|
|
9857
9958
|
for (const match of body.matchAll(
|
|
9858
9959
|
/\.define\(\s*"([A-Za-z_][A-Za-z0-9_]*)"\s*(?:,\s*to:\s*"((?:[^"\\]|\\.)*)"\s*)?\)/g
|
|
9859
9960
|
)) {
|
|
@@ -9900,6 +10001,9 @@ function swiftManifestTargets(manifest, resourcePaths = []) {
|
|
|
9900
10001
|
call.replace(/"(?:\\.|[^"\\])*"/g, "")
|
|
9901
10002
|
);
|
|
9902
10003
|
const defines = settingDefines(call, "swift").map((define) => define.split("=")[0]);
|
|
10004
|
+
const experimentalFeatures = settingFeatures(call, ".enableExperimentalFeature");
|
|
10005
|
+
const upcomingFeatures = settingFeatures(call, ".enableUpcomingFeature");
|
|
10006
|
+
const swiftFlags = settingFeatures(call, ".unsafeFlags");
|
|
9903
10007
|
const cDefines = settingDefines(call, "c");
|
|
9904
10008
|
const cxxDefines = settingDefines(call, "cxx");
|
|
9905
10009
|
const linkedLibraries = [...call.matchAll(/\.linkedLibrary\(\s*"([^"]+)"\s*\)/g)].map(
|
|
@@ -9944,6 +10048,9 @@ function swiftManifestTargets(manifest, resourcePaths = []) {
|
|
|
9944
10048
|
mainActorIsolation,
|
|
9945
10049
|
...cxxInterop ? { cxxInterop: true } : {},
|
|
9946
10050
|
...defines.length === 0 ? {} : { defines },
|
|
10051
|
+
...experimentalFeatures.length === 0 ? {} : { experimentalFeatures },
|
|
10052
|
+
...upcomingFeatures.length === 0 ? {} : { upcomingFeatures },
|
|
10053
|
+
...swiftFlags.length === 0 ? {} : { swiftFlags },
|
|
9947
10054
|
...cDefines.length === 0 ? {} : { cDefines },
|
|
9948
10055
|
...cxxDefines.length === 0 ? {} : { cxxDefines },
|
|
9949
10056
|
...linkedLibraries.length === 0 ? {} : { linkedLibraries },
|
|
@@ -10031,14 +10138,14 @@ function swiftObjCResourceAccessor(bundleName) {
|
|
|
10031
10138
|
}
|
|
10032
10139
|
function swiftPackagePartition(manifest, resourcePaths = []) {
|
|
10033
10140
|
const targets = swiftManifestTargets(manifest, resourcePaths);
|
|
10034
|
-
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;
|
|
10141
|
+
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;
|
|
10035
10142
|
}
|
|
10036
10143
|
|
|
10037
10144
|
// src/swift-root-lock.ts
|
|
10038
|
-
var
|
|
10145
|
+
var import_node_child_process7 = require("node:child_process");
|
|
10039
10146
|
var import_node_crypto6 = require("node:crypto");
|
|
10040
10147
|
var import_node_fs6 = require("node:fs");
|
|
10041
|
-
var
|
|
10148
|
+
var import_node_path9 = __toESM(require("node:path"), 1);
|
|
10042
10149
|
var POLL_MS = 250;
|
|
10043
10150
|
var START_TOLERANCE_MS = 2e3;
|
|
10044
10151
|
function errorCode(error) {
|
|
@@ -10050,7 +10157,7 @@ function parseStart(text3) {
|
|
|
10050
10157
|
return start;
|
|
10051
10158
|
}
|
|
10052
10159
|
function processTable() {
|
|
10053
|
-
const result = (0,
|
|
10160
|
+
const result = (0, import_node_child_process7.spawnSync)("ps", ["-A", "-o", "pid=,pgid=,stat=,lstart="], {
|
|
10054
10161
|
encoding: "utf8",
|
|
10055
10162
|
env: { ...process.env, LC_ALL: "C", TZ: "UTC" },
|
|
10056
10163
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -10113,7 +10220,7 @@ function generationNumbers(directory) {
|
|
|
10113
10220
|
function readGeneration(directory, number) {
|
|
10114
10221
|
let owner;
|
|
10115
10222
|
try {
|
|
10116
|
-
owner = (0, import_node_fs6.readFileSync)(
|
|
10223
|
+
owner = (0, import_node_fs6.readFileSync)(import_node_path9.default.join(directory, name(number, "owner")), "utf8");
|
|
10117
10224
|
} catch (error) {
|
|
10118
10225
|
if (errorCode(error) === "ENOENT") return null;
|
|
10119
10226
|
throw error;
|
|
@@ -10126,7 +10233,7 @@ function readGeneration(directory, number) {
|
|
|
10126
10233
|
}
|
|
10127
10234
|
function readChildren(directory, number) {
|
|
10128
10235
|
const prefix = name(number, "child.");
|
|
10129
|
-
return (0, import_node_fs6.readdirSync)(directory).filter((entry) => entry.startsWith(prefix)).map((entry) => parseIdentity((0, import_node_fs6.readFileSync)(
|
|
10236
|
+
return (0, import_node_fs6.readdirSync)(directory).filter((entry) => entry.startsWith(prefix)).map((entry) => parseIdentity((0, import_node_fs6.readFileSync)(import_node_path9.default.join(directory, entry), "utf8")));
|
|
10130
10237
|
}
|
|
10131
10238
|
function groupAlive(table, leader) {
|
|
10132
10239
|
const row = table.find((candidate) => candidate.pid === leader.pid);
|
|
@@ -10134,7 +10241,7 @@ function groupAlive(table, leader) {
|
|
|
10134
10241
|
return table.some((candidate) => candidate.pgid === leader.pid && !candidate.zombie);
|
|
10135
10242
|
}
|
|
10136
10243
|
async function withSwiftRootLock(root, work, signal) {
|
|
10137
|
-
const directory =
|
|
10244
|
+
const directory = import_node_path9.default.join(
|
|
10138
10245
|
rnxHomeDir(),
|
|
10139
10246
|
"cache",
|
|
10140
10247
|
"swift-root-locks",
|
|
@@ -10143,7 +10250,7 @@ async function withSwiftRootLock(root, work, signal) {
|
|
|
10143
10250
|
(0, import_node_fs6.mkdirSync)(directory, { recursive: true });
|
|
10144
10251
|
const token = (0, import_node_crypto6.randomUUID)();
|
|
10145
10252
|
const owner = JSON.stringify(ownIdentity(process.pid));
|
|
10146
|
-
const pending =
|
|
10253
|
+
const pending = import_node_path9.default.join(directory, `pending.${token}`);
|
|
10147
10254
|
let held = 0;
|
|
10148
10255
|
for (; ; ) {
|
|
10149
10256
|
signal?.throwIfAborted();
|
|
@@ -10164,7 +10271,7 @@ async function withSwiftRootLock(root, work, signal) {
|
|
|
10164
10271
|
}
|
|
10165
10272
|
(0, import_node_fs6.writeFileSync)(pending, owner);
|
|
10166
10273
|
try {
|
|
10167
|
-
(0, import_node_fs6.linkSync)(pending,
|
|
10274
|
+
(0, import_node_fs6.linkSync)(pending, import_node_path9.default.join(directory, name(newest + 1, "owner")));
|
|
10168
10275
|
} catch (error) {
|
|
10169
10276
|
if (errorCode(error) === "EEXIST") continue;
|
|
10170
10277
|
throw error;
|
|
@@ -10173,7 +10280,7 @@ async function withSwiftRootLock(root, work, signal) {
|
|
|
10173
10280
|
}
|
|
10174
10281
|
const numbers = generationNumbers(directory);
|
|
10175
10282
|
if (numbers.at(-1) !== newest + 1) {
|
|
10176
|
-
(0, import_node_fs6.rmSync)(
|
|
10283
|
+
(0, import_node_fs6.rmSync)(import_node_path9.default.join(directory, name(newest + 1, "owner")), { force: true });
|
|
10177
10284
|
continue;
|
|
10178
10285
|
}
|
|
10179
10286
|
held = newest + 1;
|
|
@@ -10181,14 +10288,14 @@ async function withSwiftRootLock(root, work, signal) {
|
|
|
10181
10288
|
if (number < held) {
|
|
10182
10289
|
for (const entry of (0, import_node_fs6.readdirSync)(directory))
|
|
10183
10290
|
if (entry.startsWith(name(number, "")))
|
|
10184
|
-
(0, import_node_fs6.rmSync)(
|
|
10291
|
+
(0, import_node_fs6.rmSync)(import_node_path9.default.join(directory, entry), { force: true });
|
|
10185
10292
|
}
|
|
10186
10293
|
break;
|
|
10187
10294
|
}
|
|
10188
10295
|
const children = [];
|
|
10189
10296
|
const lease = {
|
|
10190
10297
|
spawn(command, args, options) {
|
|
10191
|
-
const child = (0,
|
|
10298
|
+
const child = (0, import_node_child_process7.spawn)(
|
|
10192
10299
|
"/bin/sh",
|
|
10193
10300
|
["-c", 'IFS= read -r go || exit 1; exec "$@" </dev/null', "sh", command, ...args],
|
|
10194
10301
|
{ ...options, detached: true, stdio: ["pipe", "pipe", "pipe"] }
|
|
@@ -10205,7 +10312,7 @@ async function withSwiftRootLock(root, work, signal) {
|
|
|
10205
10312
|
const childPending = `${pending}.child.${child.pid}`;
|
|
10206
10313
|
try {
|
|
10207
10314
|
(0, import_node_fs6.writeFileSync)(childPending, JSON.stringify(ownIdentity(child.pid)));
|
|
10208
|
-
(0, import_node_fs6.linkSync)(childPending,
|
|
10315
|
+
(0, import_node_fs6.linkSync)(childPending, import_node_path9.default.join(directory, name(held, `child.${child.pid}`)));
|
|
10209
10316
|
} finally {
|
|
10210
10317
|
(0, import_node_fs6.rmSync)(childPending, { force: true });
|
|
10211
10318
|
}
|
|
@@ -10221,7 +10328,7 @@ async function withSwiftRootLock(root, work, signal) {
|
|
|
10221
10328
|
return await work(lease);
|
|
10222
10329
|
} finally {
|
|
10223
10330
|
await Promise.all(children.map((child) => terminateProcessGroup(child, "SIGKILL", 0)));
|
|
10224
|
-
(0, import_node_fs6.writeFileSync)(
|
|
10331
|
+
(0, import_node_fs6.writeFileSync)(import_node_path9.default.join(directory, name(held, "released")), "");
|
|
10225
10332
|
}
|
|
10226
10333
|
}
|
|
10227
10334
|
|
|
@@ -10277,7 +10384,7 @@ function isSwiftResourceBundles(value) {
|
|
|
10277
10384
|
|
|
10278
10385
|
// src/xcode-header-search.ts
|
|
10279
10386
|
var import_node_fs7 = __toESM(require("node:fs"), 1);
|
|
10280
|
-
var
|
|
10387
|
+
var import_node_path10 = __toESM(require("node:path"), 1);
|
|
10281
10388
|
function headerMap(entries) {
|
|
10282
10389
|
const unique = /* @__PURE__ */ new Map();
|
|
10283
10390
|
for (const entry of entries)
|
|
@@ -10324,11 +10431,11 @@ function writeXcodeHeaderSearch(directory, targets) {
|
|
|
10324
10431
|
const productDirectories = /* @__PURE__ */ new Map();
|
|
10325
10432
|
for (const target of targets)
|
|
10326
10433
|
for (const [product, file] of Object.entries(target.productHeaders)) {
|
|
10327
|
-
const listed = productDirectories.get(
|
|
10328
|
-
productDirectories.set(
|
|
10329
|
-
listed.push({ name:
|
|
10434
|
+
const listed = productDirectories.get(import_node_path10.default.dirname(product)) ?? [];
|
|
10435
|
+
productDirectories.set(import_node_path10.default.dirname(product), listed);
|
|
10436
|
+
listed.push({ name: import_node_path10.default.basename(product), file });
|
|
10330
10437
|
}
|
|
10331
|
-
const overlay =
|
|
10438
|
+
const overlay = import_node_path10.default.join(directory, "all-product-headers.yaml");
|
|
10332
10439
|
import_node_fs7.default.writeFileSync(
|
|
10333
10440
|
overlay,
|
|
10334
10441
|
JSON.stringify({
|
|
@@ -10348,7 +10455,7 @@ function writeXcodeHeaderSearch(directory, targets) {
|
|
|
10348
10455
|
const files = [overlay];
|
|
10349
10456
|
const flags = targets.map((target, index) => {
|
|
10350
10457
|
const maps = target.headerMaps.map((map2, order) => {
|
|
10351
|
-
const file =
|
|
10458
|
+
const file = import_node_path10.default.join(directory, `${index}-${order}.hmap`);
|
|
10352
10459
|
import_node_fs7.default.writeFileSync(file, headerMap(map2.entries));
|
|
10353
10460
|
files.push(file);
|
|
10354
10461
|
return { flag: map2.flag, file };
|
|
@@ -10374,7 +10481,7 @@ async function runCompiler(command, args, options, stream = false, quiet) {
|
|
|
10374
10481
|
detached: true,
|
|
10375
10482
|
stdio: ["ignore", "pipe", "pipe"]
|
|
10376
10483
|
};
|
|
10377
|
-
const child = options.lease ? options.lease.spawn(command, args, launch) : (0,
|
|
10484
|
+
const child = options.lease ? options.lease.spawn(command, args, launch) : (0, import_node_child_process8.spawn)(command, args, launch);
|
|
10378
10485
|
let stopping;
|
|
10379
10486
|
try {
|
|
10380
10487
|
return await new Promise((resolve, reject) => {
|
|
@@ -10465,7 +10572,7 @@ function swiftBuilderHopTimeoutMs(compileTimeoutMs) {
|
|
|
10465
10572
|
return (compileTimeoutMs ?? SWIFT_BUILDER_DEFAULT_COMPILE_MS) + SWIFT_BUILDER_TRANSPORT_MARGIN_MS;
|
|
10466
10573
|
}
|
|
10467
10574
|
function swiftDistributionAt(root) {
|
|
10468
|
-
const file =
|
|
10575
|
+
const file = import_node_path11.default.join(root, SWIFT_DISTRIBUTION_MANIFEST);
|
|
10469
10576
|
if (!(0, import_node_fs8.existsSync)(file)) return null;
|
|
10470
10577
|
return parseSwiftDistributionManifest(JSON.parse((0, import_node_fs8.readFileSync)(file, "utf8")));
|
|
10471
10578
|
}
|
|
@@ -10494,7 +10601,7 @@ function swiftModuleInputFiles(root) {
|
|
|
10494
10601
|
"toolchain.json"
|
|
10495
10602
|
];
|
|
10496
10603
|
const walk = (dir) => {
|
|
10497
|
-
for (const entry of (0, import_node_fs8.readdirSync)(
|
|
10604
|
+
for (const entry of (0, import_node_fs8.readdirSync)(import_node_path11.default.join(root, dir), {
|
|
10498
10605
|
withFileTypes: true
|
|
10499
10606
|
})) {
|
|
10500
10607
|
const relative = `${dir}/${entry.name}`;
|
|
@@ -10512,32 +10619,32 @@ function swiftMacroPlugins(moduleRoot) {
|
|
|
10512
10619
|
const distribution = swiftDistributionAt(moduleRoot);
|
|
10513
10620
|
if (distribution)
|
|
10514
10621
|
return {
|
|
10515
|
-
libraries: distribution.plugins.map((plugin) =>
|
|
10622
|
+
libraries: distribution.plugins.map((plugin) => import_node_path11.default.join(moduleRoot, plugin)),
|
|
10516
10623
|
stale: false
|
|
10517
10624
|
};
|
|
10518
|
-
const dir =
|
|
10625
|
+
const dir = import_node_path11.default.join(moduleRoot, ".build/host/RnxPreviewMacros");
|
|
10519
10626
|
const release = JSON.parse(
|
|
10520
|
-
(0, import_node_fs8.readFileSync)(
|
|
10627
|
+
(0, import_node_fs8.readFileSync)(import_node_path11.default.join(moduleRoot, "toolchain.json"), "utf8")
|
|
10521
10628
|
).release;
|
|
10522
|
-
const compilerStamp =
|
|
10629
|
+
const compilerStamp = import_node_path11.default.join(dir, "compiler-release");
|
|
10523
10630
|
const ext = process.platform === "darwin" ? "dylib" : "so";
|
|
10524
10631
|
const plugins = [
|
|
10525
10632
|
{
|
|
10526
|
-
library:
|
|
10527
|
-
sources: [
|
|
10633
|
+
library: import_node_path11.default.join(dir, `libRnxPreviewMacros.${ext}`),
|
|
10634
|
+
sources: [import_node_path11.default.join(moduleRoot, "Sources/RnxPreviewMacros/PreviewMacro.swift")]
|
|
10528
10635
|
},
|
|
10529
10636
|
{
|
|
10530
|
-
library:
|
|
10637
|
+
library: import_node_path11.default.join(dir, `libFoundationMacros.${ext}`),
|
|
10531
10638
|
sources: [
|
|
10532
|
-
|
|
10533
|
-
|
|
10639
|
+
import_node_path11.default.join(moduleRoot, "Sources/FoundationMacros/PredicateMacro.swift"),
|
|
10640
|
+
import_node_path11.default.join(moduleRoot, "Sources/SwiftMacroSupport/PredicateExpression.swift")
|
|
10534
10641
|
]
|
|
10535
10642
|
},
|
|
10536
10643
|
{
|
|
10537
|
-
library:
|
|
10644
|
+
library: import_node_path11.default.join(dir, `libTipKitMacros.${ext}`),
|
|
10538
10645
|
sources: [
|
|
10539
|
-
|
|
10540
|
-
|
|
10646
|
+
import_node_path11.default.join(moduleRoot, "Sources/TipKitMacros/TipKitMacros.swift"),
|
|
10647
|
+
import_node_path11.default.join(moduleRoot, "Sources/SwiftMacroSupport/PredicateExpression.swift")
|
|
10541
10648
|
]
|
|
10542
10649
|
}
|
|
10543
10650
|
];
|
|
@@ -10554,14 +10661,14 @@ async function ensureMacroPlugins(moduleRoot, toolchainBin, release, signal) {
|
|
|
10554
10661
|
await runCompiler(
|
|
10555
10662
|
"sh",
|
|
10556
10663
|
[
|
|
10557
|
-
|
|
10664
|
+
import_node_path11.default.join(moduleRoot, "scripts/build-preview-plugin.sh"),
|
|
10558
10665
|
toolchainBin,
|
|
10559
10666
|
libraries[0]
|
|
10560
10667
|
],
|
|
10561
10668
|
{ signal }
|
|
10562
10669
|
);
|
|
10563
10670
|
(0, import_node_fs8.writeFileSync)(
|
|
10564
|
-
|
|
10671
|
+
import_node_path11.default.join(import_node_path11.default.dirname(libraries[0]), "compiler-release"),
|
|
10565
10672
|
`${release}
|
|
10566
10673
|
`
|
|
10567
10674
|
);
|
|
@@ -10577,7 +10684,7 @@ function swiftModuleDigest(root) {
|
|
|
10577
10684
|
const files = swiftModuleInputFiles(root);
|
|
10578
10685
|
const stampHash = (0, import_node_crypto7.createHash)("sha256");
|
|
10579
10686
|
for (const file of files) {
|
|
10580
|
-
const stat = (0, import_node_fs8.statSync)(
|
|
10687
|
+
const stat = (0, import_node_fs8.statSync)(import_node_path11.default.join(root, file), { bigint: true });
|
|
10581
10688
|
stampHash.update(file);
|
|
10582
10689
|
stampHash.update(
|
|
10583
10690
|
`${stat.dev}:${stat.ino}:${stat.size}:${stat.mtimeNs}:${stat.ctimeNs}
|
|
@@ -10591,7 +10698,7 @@ function swiftModuleDigest(root) {
|
|
|
10591
10698
|
for (const file of files) {
|
|
10592
10699
|
hash2.update((0, import_node_crypto7.createHash)("sha256").update(file).digest());
|
|
10593
10700
|
hash2.update(
|
|
10594
|
-
(0, import_node_crypto7.createHash)("sha256").update((0, import_node_fs8.readFileSync)(
|
|
10701
|
+
(0, import_node_crypto7.createHash)("sha256").update((0, import_node_fs8.readFileSync)(import_node_path11.default.join(root, file))).digest()
|
|
10595
10702
|
);
|
|
10596
10703
|
}
|
|
10597
10704
|
const digest = hash2.digest();
|
|
@@ -10615,7 +10722,7 @@ function withNativeSourceGlue(input, glue) {
|
|
|
10615
10722
|
...input,
|
|
10616
10723
|
files: {
|
|
10617
10724
|
...input.files,
|
|
10618
|
-
[
|
|
10725
|
+
[import_node_path11.default.posix.join(targetPath, "OneNativeSource.generated.swift")]: glue
|
|
10619
10726
|
},
|
|
10620
10727
|
oneModule: true
|
|
10621
10728
|
};
|
|
@@ -10740,7 +10847,7 @@ function swiftImportNames(contents, available) {
|
|
|
10740
10847
|
function swiftPeachModules(moduleRoot) {
|
|
10741
10848
|
const distribution = swiftDistributionAt(moduleRoot);
|
|
10742
10849
|
return distribution ? distribution.modules : [
|
|
10743
|
-
...(0, import_node_fs8.readFileSync)(
|
|
10850
|
+
...(0, import_node_fs8.readFileSync)(import_node_path11.default.join(moduleRoot, "Package.swift"), "utf8").matchAll(
|
|
10744
10851
|
/\.(?:target|systemLibrary)\(\s*name:\s*"([^"]+)"/g
|
|
10745
10852
|
)
|
|
10746
10853
|
].map((match) => match[1]);
|
|
@@ -10751,8 +10858,8 @@ function swiftSdkPaths(moduleRoot, toolchainBin) {
|
|
|
10751
10858
|
const key = JSON.stringify([toolchainBin, sdk, swiftSdkOptions()]);
|
|
10752
10859
|
const cached = sdkPaths.get(key);
|
|
10753
10860
|
if (cached) return cached;
|
|
10754
|
-
const configuration = (0,
|
|
10755
|
-
|
|
10861
|
+
const configuration = (0, import_node_child_process8.execFileSync)(
|
|
10862
|
+
import_node_path11.default.join(toolchainBin, "swift"),
|
|
10756
10863
|
[
|
|
10757
10864
|
"sdk",
|
|
10758
10865
|
"configure",
|
|
@@ -10783,12 +10890,12 @@ function swiftAvailableModules(moduleRoot, toolchainBin) {
|
|
|
10783
10890
|
if (cached) return cached;
|
|
10784
10891
|
const modules = new Set(swiftPeachModules(moduleRoot));
|
|
10785
10892
|
const { resources } = swiftSdkPaths(moduleRoot, toolchainBin);
|
|
10786
|
-
for (const entry of (0, import_node_fs8.readdirSync)(
|
|
10893
|
+
for (const entry of (0, import_node_fs8.readdirSync)(import_node_path11.default.join(resources, "wasi"))) {
|
|
10787
10894
|
if (entry.endsWith(".swiftmodule"))
|
|
10788
10895
|
modules.add(entry.slice(0, -".swiftmodule".length));
|
|
10789
10896
|
}
|
|
10790
10897
|
for (const entry of (0, import_node_fs8.readdirSync)(resources)) {
|
|
10791
|
-
const map2 =
|
|
10898
|
+
const map2 = import_node_path11.default.join(resources, entry, "module.modulemap");
|
|
10792
10899
|
if (!(0, import_node_fs8.existsSync)(map2)) continue;
|
|
10793
10900
|
for (const match of (0, import_node_fs8.readFileSync)(map2, "utf8").matchAll(/^module\s+([A-Za-z_]\w*)/gm))
|
|
10794
10901
|
modules.add(match[1]);
|
|
@@ -10796,12 +10903,14 @@ function swiftAvailableModules(moduleRoot, toolchainBin) {
|
|
|
10796
10903
|
availableModules.set(key, modules);
|
|
10797
10904
|
return modules;
|
|
10798
10905
|
}
|
|
10799
|
-
function missingSwiftModules(files, available) {
|
|
10906
|
+
function missingSwiftModules(files, available, providedByFile = () => []) {
|
|
10800
10907
|
const missing = /* @__PURE__ */ new Map();
|
|
10801
10908
|
for (const [file, contents] of Object.entries(files)) {
|
|
10802
10909
|
if (!file.endsWith(".swift") || file === "Package.swift") continue;
|
|
10803
|
-
|
|
10804
|
-
|
|
10910
|
+
const extra = providedByFile(file);
|
|
10911
|
+
const scoped = extra.length === 0 ? available : /* @__PURE__ */ new Set([...available, ...extra]);
|
|
10912
|
+
for (const name2 of new Set(swiftImportNames(contents, scoped))) {
|
|
10913
|
+
if (scoped.has(name2)) continue;
|
|
10805
10914
|
missing.set(name2, [...missing.get(name2) ?? [], file]);
|
|
10806
10915
|
}
|
|
10807
10916
|
}
|
|
@@ -10854,7 +10963,7 @@ var EXECUTABLE_LINK_FLAGS = ` "-Xclang-linker", "-O0",
|
|
|
10854
10963
|
`;
|
|
10855
10964
|
var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
|
|
10856
10965
|
var MULTI_MANIFEST_VERSION = 40;
|
|
10857
|
-
var compilerSourceDigest = true ? "
|
|
10966
|
+
var compilerSourceDigest = true ? "25e399c85c279ad057ea8e9dac685fe538c7bda43eb7708cf1a32edcb229391d" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
|
|
10858
10967
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
10859
10968
|
const hash2 = (0, import_node_crypto7.createHash)("sha256");
|
|
10860
10969
|
hash2.update(`swift-compile
|
|
@@ -10950,11 +11059,11 @@ function emitSwiftPackageManifest(args) {
|
|
|
10950
11059
|
distributionLink.files.set(
|
|
10951
11060
|
distributionLink.path,
|
|
10952
11061
|
objects.map(
|
|
10953
|
-
(object) => `"${
|
|
11062
|
+
(object) => `"${import_node_path11.default.join(moduleRoot, object).replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`
|
|
10954
11063
|
).join("\n") + "\n"
|
|
10955
11064
|
);
|
|
10956
11065
|
}
|
|
10957
|
-
const overlayRoot =
|
|
11066
|
+
const overlayRoot = import_node_path11.default.join(
|
|
10958
11067
|
moduleRoot,
|
|
10959
11068
|
distribution ? "modules" : "cross-import-overlays"
|
|
10960
11069
|
);
|
|
@@ -10962,9 +11071,9 @@ function emitSwiftPackageManifest(args) {
|
|
|
10962
11071
|
"-Xfrontend",
|
|
10963
11072
|
"-swift-module-cross-import",
|
|
10964
11073
|
"-Xfrontend",
|
|
10965
|
-
|
|
11074
|
+
import_node_path11.default.basename(import_node_path11.default.dirname(file), ".swiftcrossimport"),
|
|
10966
11075
|
"-Xfrontend",
|
|
10967
|
-
|
|
11076
|
+
import_node_path11.default.join(overlayRoot, file)
|
|
10968
11077
|
]).map((flag) => `, ${JSON.stringify(flag)}`).join("");
|
|
10969
11078
|
const executable = targets.find((target) => target.executable);
|
|
10970
11079
|
if (!executable) throw new Error("swift-compile: no executable target to emit");
|
|
@@ -10979,7 +11088,10 @@ function emitSwiftPackageManifest(args) {
|
|
|
10979
11088
|
const interoperability = target.cxxInterop ? " .interoperabilityMode(.Cxx)," : "";
|
|
10980
11089
|
const exports2 = args.objcExports?.modules.has(target.name) || args.objcExports?.rootModule === target.name ? ' .enableExperimentalFeature("Extern"),' : "";
|
|
10981
11090
|
const defines = (target.defines ?? []).map((name2) => ` .define(${JSON.stringify(name2)}),`).join("");
|
|
10982
|
-
const
|
|
11091
|
+
const features = (target.experimentalFeatures ?? []).map((name2) => ` .enableExperimentalFeature(${JSON.stringify(name2)}),`).join("");
|
|
11092
|
+
const upcoming = (target.upcomingFeatures ?? []).map((name2) => ` .enableUpcomingFeature(${JSON.stringify(name2)}),`).join("");
|
|
11093
|
+
const upstream = (target.swiftFlags ?? []).map((flag) => `, ${JSON.stringify(flag)}`).join("");
|
|
11094
|
+
const imports = distribution ? `, "-I", ${JSON.stringify(import_node_path11.default.join(moduleRoot, "modules"))}` : "";
|
|
10983
11095
|
const native = args.native?.get(target.name);
|
|
10984
11096
|
const clang = native && !native.mixed;
|
|
10985
11097
|
const nativeImports = (siblings.get(target.name) ?? []).filter((name2) => args.native?.has(name2) && !args.native.get(name2)?.mixed).map(
|
|
@@ -10999,8 +11111,8 @@ function emitSwiftPackageManifest(args) {
|
|
|
10999
11111
|
const nativeImportFlags = [...importContext].flatMap((name2) => args.native?.get(name2)?.clang?.importFlags ?? []).map((flag) => `, "-Xcc", ${JSON.stringify(flag)}`).join("");
|
|
11000
11112
|
const header = args.headerDirectory && [...args.native?.values() ?? []].some(
|
|
11001
11113
|
(value) => value.late?.producers.includes(target.name)
|
|
11002
|
-
) ? `, "-emit-objc-header-path", ${JSON.stringify(
|
|
11003
|
-
const swiftSettings = `swiftSettings: [.swiftLanguageMode(.v${target.languageMode}),${isolation}${interoperability}${defines}${exports2} .unsafeFlags(["-Osize", "-Xfrontend", "-enable-cross-import-overlays"${overlayFlags}${FOUNDATION_IMPLICIT_FLAGS}${oneModule ? ONE_IMPLICIT_FLAGS : ""}${imports}${nativeImports}${nativeImportFlags}${header}])]`;
|
|
11114
|
+
) ? `, "-emit-objc-header-path", ${JSON.stringify(import_node_path11.default.join(args.headerDirectory, `${target.name}-${args.objcExports?.modules.has(target.name) ? "Cxx" : "Swift"}.h`))}` : "";
|
|
11115
|
+
const swiftSettings = `swiftSettings: [.swiftLanguageMode(.v${target.languageMode}),${isolation}${interoperability}${defines}${features}${upcoming}${exports2} .unsafeFlags(["-Osize", "-Xfrontend", "-enable-cross-import-overlays"${overlayFlags}${FOUNDATION_IMPLICIT_FLAGS}${oneModule ? ONE_IMPLICIT_FLAGS : ""}${imports}${nativeImports}${nativeImportFlags}${header}${upstream}])]`;
|
|
11004
11116
|
const deps = [
|
|
11005
11117
|
.../* @__PURE__ */ new Set([
|
|
11006
11118
|
...target.executable ? [
|
|
@@ -11051,11 +11163,11 @@ function emitSwiftPackageManifest(args) {
|
|
|
11051
11163
|
const cDefines = macroSettings(target.cDefines);
|
|
11052
11164
|
const cxxDefines = macroSettings(target.cxxDefines);
|
|
11053
11165
|
const nativeSettings = native?.clang ? [
|
|
11054
|
-
`cSettings: [${cDefines} .unsafeFlags(${JSON.stringify([...args.
|
|
11055
|
-
`cxxSettings: [${cxxDefines} .unsafeFlags(${JSON.stringify(["-fno-cxx-modules", ...args.
|
|
11166
|
+
`cSettings: [${cDefines} .unsafeFlags(${JSON.stringify([...args.nativeFlags?.get(target.name) ?? [], ...native.clang.flags])})]`,
|
|
11167
|
+
`cxxSettings: [${cxxDefines} .unsafeFlags(${JSON.stringify(["-fno-cxx-modules", ...args.nativeFlags?.get(target.name) ?? [], ...native.clang.cxxFlags])})]`
|
|
11056
11168
|
].join(", ") : [
|
|
11057
|
-
`cSettings: [${cDefines} .unsafeFlags(${JSON.stringify([...args.
|
|
11058
|
-
`cxxSettings: [${cxxDefines} .unsafeFlags(${JSON.stringify(["-fno-cxx-modules", ...args.
|
|
11169
|
+
`cSettings: [${cDefines} .unsafeFlags(${JSON.stringify([...args.nativeFlags?.get(target.name) ?? [], ...native?.flags ?? []])})]`,
|
|
11170
|
+
`cxxSettings: [${cxxDefines} .unsafeFlags(${JSON.stringify(["-fno-cxx-modules", ...args.nativeFlags?.get(target.name) ?? [], ...native?.cxxFlags ?? []])})]`
|
|
11059
11171
|
].join(", ");
|
|
11060
11172
|
return [
|
|
11061
11173
|
` ${kind}(`,
|
|
@@ -11064,8 +11176,8 @@ function emitSwiftPackageManifest(args) {
|
|
|
11064
11176
|
` path: ${JSON.stringify(native?.clang ? "." : target.path)},`,
|
|
11065
11177
|
...native ? [` exclude: ${JSON.stringify(native.exclude ?? native.lateSources)},`] : [],
|
|
11066
11178
|
...native?.clang ? [
|
|
11067
|
-
` sources: ${JSON.stringify(native.clang.sources.map((source) =>
|
|
11068
|
-
` publicHeadersPath: ${JSON.stringify(
|
|
11179
|
+
` sources: ${JSON.stringify(native.clang.sources.map((source) => import_node_path11.default.posix.join(native.path, source)))},`,
|
|
11180
|
+
` publicHeadersPath: ${JSON.stringify(import_node_path11.default.posix.dirname(native.clang.modulemap))},`
|
|
11069
11181
|
] : native?.flags ? [` sources: ${JSON.stringify(native.sources)},`] : [],
|
|
11070
11182
|
// the native backend supplies dependency module maps without their
|
|
11071
11183
|
// compiled modules. textual c++ includes keep those dependencies usable.
|
|
@@ -11090,7 +11202,7 @@ function emitSwiftPackageManifest(args) {
|
|
|
11090
11202
|
' path: "PeachObjCExports",',
|
|
11091
11203
|
` sources: ${JSON.stringify(["root.m", ...[...args.objcExports.modules].map((name2) => `${name2}.m`)])},`,
|
|
11092
11204
|
' publicHeadersPath: "include",',
|
|
11093
|
-
` cSettings: [.unsafeFlags(${JSON.stringify([...args.objcExports.
|
|
11205
|
+
` cSettings: [.unsafeFlags(${JSON.stringify([...args.nativeFlags.get(args.objcExports.rootModule).filter((flag) => flag !== "-fobjc-arc"), "-fno-objc-arc", "-Xclang", "-disable-objc-default-synthesize-properties"])})]),`
|
|
11094
11206
|
] : [],
|
|
11095
11207
|
...[...args.native?.entries() ?? []].flatMap(([name2, native]) => {
|
|
11096
11208
|
const late = native.late;
|
|
@@ -11106,10 +11218,10 @@ function emitSwiftPackageManifest(args) {
|
|
|
11106
11218
|
` .target(name: ${JSON.stringify(group.name)},`,
|
|
11107
11219
|
` dependencies: ${JSON.stringify(native.mixed ? [] : [name2, ...late.producers])},`,
|
|
11108
11220
|
` path: ${JSON.stringify(native.clang ? "." : native.path)},`,
|
|
11109
|
-
` sources: ${JSON.stringify(native.clang ? group.sources.map((source) =>
|
|
11110
|
-
` publicHeadersPath: ${JSON.stringify(native.clang ?
|
|
11111
|
-
` cSettings: [${macroSettings(owner?.cDefines)} .unsafeFlags(${JSON.stringify([...args.
|
|
11112
|
-
` cxxSettings: [${macroSettings(owner?.cxxDefines)} .unsafeFlags(${JSON.stringify(["-fno-cxx-modules", ...args.
|
|
11221
|
+
` sources: ${JSON.stringify(native.clang ? group.sources.map((source) => import_node_path11.default.posix.join(native.path, source)) : group.sources)},`,
|
|
11222
|
+
` publicHeadersPath: ${JSON.stringify(native.clang ? import_node_path11.default.posix.dirname(native.clang.modulemap) : "include")},`,
|
|
11223
|
+
` cSettings: [${macroSettings(owner?.cDefines)} .unsafeFlags(${JSON.stringify([...args.nativeFlags?.get(name2) ?? [], ...group.flags])})],`,
|
|
11224
|
+
` cxxSettings: [${macroSettings(owner?.cxxDefines)} .unsafeFlags(${JSON.stringify(["-fno-cxx-modules", ...args.nativeFlags?.get(name2) ?? [], "-I", native.includeDirectory, "-I", args.headerDirectory, ...group.cxxFlags])})]),`
|
|
11113
11225
|
]) : [];
|
|
11114
11226
|
}),
|
|
11115
11227
|
args.cxxLanguageStandard ? ` ],
|
|
@@ -11122,7 +11234,7 @@ function syncSwiftTree(base, files) {
|
|
|
11122
11234
|
(0, import_node_fs8.mkdirSync)(base, { recursive: true });
|
|
11123
11235
|
const walk = (dir) => {
|
|
11124
11236
|
for (const entry of (0, import_node_fs8.readdirSync)(dir, { withFileTypes: true })) {
|
|
11125
|
-
const full =
|
|
11237
|
+
const full = import_node_path11.default.join(dir, entry.name);
|
|
11126
11238
|
if (dir === base && entry.name === ".build") continue;
|
|
11127
11239
|
if (entry.isDirectory()) walk(full);
|
|
11128
11240
|
else if (!files.has(full)) (0, import_node_fs8.rmSync)(full, { force: true });
|
|
@@ -11132,7 +11244,7 @@ function syncSwiftTree(base, files) {
|
|
|
11132
11244
|
for (const [full, contents] of files) {
|
|
11133
11245
|
if ((0, import_node_fs8.existsSync)(full) && (typeof contents === "string" ? (0, import_node_fs8.readFileSync)(full, "utf8") === contents : (0, import_node_fs8.readFileSync)(full).equals(contents)))
|
|
11134
11246
|
continue;
|
|
11135
|
-
(0, import_node_fs8.mkdirSync)(
|
|
11247
|
+
(0, import_node_fs8.mkdirSync)(import_node_path11.default.dirname(full), { recursive: true });
|
|
11136
11248
|
(0, import_node_fs8.writeFileSync)(full, contents);
|
|
11137
11249
|
}
|
|
11138
11250
|
}
|
|
@@ -14908,7 +15020,7 @@ function swiftApplicationEntry(file, source) {
|
|
|
14908
15020
|
else if (source[at] === "}") depth--;
|
|
14909
15021
|
else if (depth === 0 && /^@(?:main|UIApplicationMain)\b/.test(source.slice(at)))
|
|
14910
15022
|
return true;
|
|
14911
|
-
else if (depth === 0 &&
|
|
15023
|
+
else if (depth === 0 && import_node_path11.default.basename(file) === "main.swift" && /^UIApplicationMain\s*\(/.test(source.slice(at)))
|
|
14912
15024
|
return true;
|
|
14913
15025
|
}
|
|
14914
15026
|
return false;
|
|
@@ -14941,7 +15053,7 @@ function installObjcPeerStartup(input, targets, compiled) {
|
|
|
14941
15053
|
);
|
|
14942
15054
|
if (entries.length === 0) {
|
|
14943
15055
|
const source2 = compiled.get(input.entry);
|
|
14944
|
-
if (
|
|
15056
|
+
if (import_node_path11.default.basename(input.entry) !== "main.swift" || source2 === void 0)
|
|
14945
15057
|
fail("requires main.swift or a supported @main App/UIApplicationDelegate entry");
|
|
14946
15058
|
compiled.set(input.entry, `_peachRegisterObjcPeers()
|
|
14947
15059
|
${source2}`);
|
|
@@ -15077,14 +15189,14 @@ function prepareSwiftDependency(source, destination) {
|
|
|
15077
15189
|
for (const entry of (0, import_node_fs8.readdirSync)(from, { withFileTypes: true })) {
|
|
15078
15190
|
if (entry.name === ".git" || entry.name === ".build" || entry.name === ".swiftpm")
|
|
15079
15191
|
continue;
|
|
15080
|
-
const file =
|
|
15192
|
+
const file = import_node_path11.default.join(from, entry.name);
|
|
15081
15193
|
if (entry.isDirectory()) gather(file);
|
|
15082
15194
|
else if (entry.isFile() && entry.name.endsWith(".swift"))
|
|
15083
|
-
origins[
|
|
15195
|
+
origins[import_node_path11.default.relative(source, file)] = (0, import_node_fs8.readFileSync)(file, "utf8");
|
|
15084
15196
|
}
|
|
15085
15197
|
};
|
|
15086
15198
|
gather(source);
|
|
15087
|
-
const manifest =
|
|
15199
|
+
const manifest = import_node_path11.default.join(source, "Package.swift");
|
|
15088
15200
|
const targets = (0, import_node_fs8.existsSync)(manifest) ? swiftManifestTargets((0, import_node_fs8.readFileSync)(manifest, "utf8")) : [];
|
|
15089
15201
|
const compiled = compiledSwiftSources(origins, targets);
|
|
15090
15202
|
const copy = (from, to) => {
|
|
@@ -15092,11 +15204,11 @@ function prepareSwiftDependency(source, destination) {
|
|
|
15092
15204
|
for (const entry of (0, import_node_fs8.readdirSync)(from, { withFileTypes: true })) {
|
|
15093
15205
|
if (entry.name === ".git" || entry.name === ".build" || entry.name === ".swiftpm")
|
|
15094
15206
|
continue;
|
|
15095
|
-
const file =
|
|
15096
|
-
const target =
|
|
15207
|
+
const file = import_node_path11.default.join(from, entry.name);
|
|
15208
|
+
const target = import_node_path11.default.join(to, entry.name);
|
|
15097
15209
|
if (entry.isDirectory()) copy(file, target);
|
|
15098
15210
|
else if (entry.isFile() && entry.name.endsWith(".swift"))
|
|
15099
|
-
(0, import_node_fs8.writeFileSync)(target, compiled.get(
|
|
15211
|
+
(0, import_node_fs8.writeFileSync)(target, compiled.get(import_node_path11.default.relative(source, file)));
|
|
15100
15212
|
else (0, import_node_fs8.cpSync)(file, target, { verbatimSymlinks: true });
|
|
15101
15213
|
}
|
|
15102
15214
|
};
|
|
@@ -15118,7 +15230,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15118
15230
|
const targets = distribution && compileTargets(input).length === 0 ? [
|
|
15119
15231
|
{
|
|
15120
15232
|
name: "App",
|
|
15121
|
-
path:
|
|
15233
|
+
path: import_node_path11.default.relative(layout.root, layout.sources),
|
|
15122
15234
|
executable: true,
|
|
15123
15235
|
languageMode: 5,
|
|
15124
15236
|
mainActorIsolation: false,
|
|
@@ -15139,17 +15251,25 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15139
15251
|
);
|
|
15140
15252
|
if (target) swiftTargets.add(target.name);
|
|
15141
15253
|
}
|
|
15142
|
-
const headerDirectory =
|
|
15143
|
-
const headerModuleDirectory =
|
|
15254
|
+
const headerDirectory = import_node_path11.default.join(layout.root, ".build", "peach-cxx-headers");
|
|
15255
|
+
const headerModuleDirectory = import_node_path11.default.join(
|
|
15144
15256
|
layout.root,
|
|
15145
15257
|
".build",
|
|
15146
15258
|
"peach-objc-export-modules"
|
|
15147
15259
|
);
|
|
15148
15260
|
const imports = /* @__PURE__ */ new Map();
|
|
15149
15261
|
const objcProducers = /* @__PURE__ */ new Set();
|
|
15262
|
+
let checkedToolchain;
|
|
15263
|
+
const nativeToolchain = () => {
|
|
15264
|
+
if (checkedToolchain) return checkedToolchain;
|
|
15265
|
+
const pin = distribution ?? JSON.parse((0, import_node_fs8.readFileSync)(import_node_path11.default.join(moduleRoot, "toolchain.json"), "utf8"));
|
|
15266
|
+
checkedToolchain = swiftToolchain(pin.release, swiftModuleSdk(moduleRoot));
|
|
15267
|
+
return checkedToolchain;
|
|
15268
|
+
};
|
|
15269
|
+
const deploymentTarget = (name2) => input.nativeTargets?.find((value) => value.name === name2)?.deploymentTarget ?? "16.0";
|
|
15150
15270
|
const targetStagedFiles = /* @__PURE__ */ new Map();
|
|
15151
15271
|
const stageTargetFile = (target, file, contents, options) => {
|
|
15152
|
-
const relative =
|
|
15272
|
+
const relative = import_node_path11.default.relative(layout.root, file).split(import_node_path11.default.sep).join(import_node_path11.default.posix.sep);
|
|
15153
15273
|
const prior = files.has(file) ? files.get(file) : Object.hasOwn(input.files, relative) ? input.files[relative] : void 0;
|
|
15154
15274
|
if (!options?.allowExisting && prior !== void 0)
|
|
15155
15275
|
throw new Error(`target ${target} already contains generated output ${relative}`);
|
|
@@ -15180,7 +15300,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15180
15300
|
targetStagedFiles.delete(target.name);
|
|
15181
15301
|
if (entries.some(([file]) => /\.(?:c|cc|cpp|cxx|m|mm)$/.test(file)) && (swift || input.nativeTargets?.some((value) => value.name === target.name))) {
|
|
15182
15302
|
if (!swift) {
|
|
15183
|
-
const unprepared =
|
|
15303
|
+
const unprepared = import_node_path11.default.join(
|
|
15184
15304
|
layout.root,
|
|
15185
15305
|
target.path,
|
|
15186
15306
|
"PeachUnprepared.generated.swift"
|
|
@@ -15195,7 +15315,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15195
15315
|
native.set(target.name, {
|
|
15196
15316
|
mixed: true,
|
|
15197
15317
|
path: target.path,
|
|
15198
|
-
includeDirectory:
|
|
15318
|
+
includeDirectory: import_node_path11.default.join(layout.root, target.path, "include"),
|
|
15199
15319
|
sources: [],
|
|
15200
15320
|
lateSources: [],
|
|
15201
15321
|
exclude: entries.filter(([file]) => !file.endsWith(".swift") && !file.endsWith(".metal")).map(([file]) => file.slice(prefix.length))
|
|
@@ -15207,26 +15327,26 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15207
15327
|
const contents = input.files[file];
|
|
15208
15328
|
if (contents === void 0)
|
|
15209
15329
|
throw new Error(`missing original Objective-C header ${file}`);
|
|
15210
|
-
const destination =
|
|
15211
|
-
(0, import_node_fs8.mkdirSync)(
|
|
15330
|
+
const destination = import_node_path11.default.join(layout.root, file);
|
|
15331
|
+
(0, import_node_fs8.mkdirSync)(import_node_path11.default.dirname(destination), { recursive: true });
|
|
15212
15332
|
(0, import_node_fs8.writeFileSync)(destination, contents);
|
|
15213
15333
|
files.set(destination, contents);
|
|
15214
15334
|
}
|
|
15215
15335
|
for (const header of settings.publicHeaders) {
|
|
15216
|
-
const destination =
|
|
15336
|
+
const destination = import_node_path11.default.join(headerDirectory, settings.name, import_node_path11.default.basename(header));
|
|
15217
15337
|
if (files.has(destination))
|
|
15218
15338
|
throw new Error(`duplicate product header ${destination}`);
|
|
15219
|
-
const contents = `#import ${JSON.stringify(
|
|
15339
|
+
const contents = `#import ${JSON.stringify(import_node_path11.default.join(layout.root, header))}
|
|
15220
15340
|
`;
|
|
15221
15341
|
files.set(destination, contents);
|
|
15222
|
-
(0, import_node_fs8.mkdirSync)(
|
|
15342
|
+
(0, import_node_fs8.mkdirSync)(import_node_path11.default.dirname(destination), { recursive: true });
|
|
15223
15343
|
(0, import_node_fs8.writeFileSync)(destination, contents);
|
|
15224
15344
|
}
|
|
15225
15345
|
}
|
|
15226
15346
|
const nativeTargets = input.nativeTargets ?? [];
|
|
15227
|
-
const fromInputRoot = (file) => file.startsWith(`${SWIFT_NATIVE_INPUT_ROOT}/`) ?
|
|
15347
|
+
const fromInputRoot = (file) => file.startsWith(`${SWIFT_NATIVE_INPUT_ROOT}/`) ? import_node_path11.default.join(layout.root, file.slice(SWIFT_NATIVE_INPUT_ROOT.length + 1)) : file;
|
|
15228
15348
|
const headerSearch = writeXcodeHeaderSearch(
|
|
15229
|
-
|
|
15349
|
+
import_node_path11.default.join(layout.root, ".build", "peach-xcode-headers"),
|
|
15230
15350
|
nativeTargets.map((settings) => ({
|
|
15231
15351
|
headerMaps: settings.headerMaps.map((map2) => ({
|
|
15232
15352
|
flag: map2.flag,
|
|
@@ -15237,12 +15357,12 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15237
15357
|
})),
|
|
15238
15358
|
productHeaders: Object.fromEntries(
|
|
15239
15359
|
Object.entries(settings.productHeaders).map(([product, file]) => [
|
|
15240
|
-
|
|
15241
|
-
|
|
15360
|
+
import_node_path11.default.join(layout.root, product),
|
|
15361
|
+
import_node_path11.default.join(layout.root, file)
|
|
15242
15362
|
])
|
|
15243
15363
|
),
|
|
15244
15364
|
userHeaderSearchPaths: settings.userHeaderSearchPaths.map(
|
|
15245
|
-
(directory) =>
|
|
15365
|
+
(directory) => import_node_path11.default.join(layout.root, directory)
|
|
15246
15366
|
)
|
|
15247
15367
|
}))
|
|
15248
15368
|
);
|
|
@@ -15265,7 +15385,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15265
15385
|
if (producer && targets.some((value) => value.name === producer))
|
|
15266
15386
|
producers2.add(producer);
|
|
15267
15387
|
const local = [
|
|
15268
|
-
|
|
15388
|
+
import_node_path11.default.posix.join(import_node_path11.default.posix.dirname(file), include2),
|
|
15269
15389
|
`${includes}${include2}`
|
|
15270
15390
|
].find((candidate) => input.files[candidate] !== void 0);
|
|
15271
15391
|
if (local) {
|
|
@@ -15295,21 +15415,19 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15295
15415
|
const headers = settings.headers;
|
|
15296
15416
|
const roots2 = settings.bridgingHeader ? [settings.bridgingHeader] : settings.publicHeaders;
|
|
15297
15417
|
for (const file of headers) {
|
|
15298
|
-
const destination =
|
|
15299
|
-
(0, import_node_fs8.mkdirSync)(
|
|
15418
|
+
const destination = import_node_path11.default.join(layout.root, file);
|
|
15419
|
+
(0, import_node_fs8.mkdirSync)(import_node_path11.default.dirname(destination), { recursive: true });
|
|
15300
15420
|
(0, import_node_fs8.writeFileSync)(destination, input.files[file]);
|
|
15301
15421
|
}
|
|
15302
15422
|
const search = [
|
|
15303
15423
|
.../* @__PURE__ */ new Set([
|
|
15304
15424
|
...settings?.headerSearchPaths ?? [],
|
|
15305
|
-
...headers.map((file) =>
|
|
15425
|
+
...headers.map((file) => import_node_path11.default.posix.dirname(file))
|
|
15306
15426
|
])
|
|
15307
|
-
].flatMap((dir) => ["-I",
|
|
15308
|
-
const
|
|
15309
|
-
const release = pin.release;
|
|
15310
|
-
const toolchainBin = swiftToolchain(release, swiftModuleSdk(moduleRoot));
|
|
15427
|
+
].flatMap((dir) => ["-I", import_node_path11.default.join(layout.root, dir)]);
|
|
15428
|
+
const toolchainBin = nativeToolchain();
|
|
15311
15429
|
const sdkHeaders = materializeObjcSdk(
|
|
15312
|
-
|
|
15430
|
+
import_node_path11.default.join(layout.root, ".build", "peach-objc-sdk")
|
|
15313
15431
|
);
|
|
15314
15432
|
const stageFlags = (flags2, sdkInclude) => flags2.map(
|
|
15315
15433
|
(flag) => flag.replaceAll(SWIFT_NATIVE_INPUT_ROOT, layout.root).replaceAll(SWIFT_NATIVE_SDK_INCLUDE, sdkInclude)
|
|
@@ -15320,16 +15438,16 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15320
15438
|
...search,
|
|
15321
15439
|
...(settings?.frameworkSearchPaths ?? []).flatMap((dir) => [
|
|
15322
15440
|
"-F",
|
|
15323
|
-
|
|
15441
|
+
import_node_path11.default.join(layout.root, dir)
|
|
15324
15442
|
]),
|
|
15325
15443
|
"-I",
|
|
15326
15444
|
headerDirectory
|
|
15327
15445
|
];
|
|
15328
15446
|
const flags = stageFlags(
|
|
15329
15447
|
originalFlags,
|
|
15330
|
-
|
|
15448
|
+
import_node_path11.default.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
|
|
15331
15449
|
);
|
|
15332
|
-
const prefixHeader = settings?.prefixHeader ? ["-include",
|
|
15450
|
+
const prefixHeader = settings?.prefixHeader ? ["-include", import_node_path11.default.join(layout.root, settings.prefixHeader)] : [];
|
|
15333
15451
|
const bundleName = entries.some(([file]) => file.endsWith(".swift")) ? void 0 : swiftObjCResourceBundleName({
|
|
15334
15452
|
target: target.name,
|
|
15335
15453
|
path: target.path,
|
|
@@ -15340,7 +15458,7 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15340
15458
|
bundles: input.resourceBundles
|
|
15341
15459
|
});
|
|
15342
15460
|
const accessor = bundleName === void 0 ? void 0 : swiftObjCResourceAccessor(bundleName);
|
|
15343
|
-
const accessorHeader =
|
|
15461
|
+
const accessorHeader = import_node_path11.default.join(
|
|
15344
15462
|
layout.root,
|
|
15345
15463
|
target.path,
|
|
15346
15464
|
OBJC_RESOURCE_ACCESSOR_HEADER
|
|
@@ -15351,23 +15469,23 @@ function writeSwiftProject(layout, input, moduleRoot) {
|
|
|
15351
15469
|
const nativeUnits = accessor ? [...units, [accessorUnit, accessor.body]] : units;
|
|
15352
15470
|
const unitSource = (file) => {
|
|
15353
15471
|
const relative = file.slice(prefix.length);
|
|
15354
|
-
return relative.split("/").some((part) => part.startsWith(".")) ?
|
|
15472
|
+
return relative.split("/").some((part) => part.startsWith(".")) ? import_node_path11.default.posix.join(HIDDEN_UNITS, relative.replaceAll(/(^|\/)\./g, "$1%2E")) : relative;
|
|
15355
15473
|
};
|
|
15356
15474
|
const accessorFlags = accessor ? ["-include", accessorHeader] : [];
|
|
15357
15475
|
let nativeC = !roots2.length && !entries.some(([file]) => file.endsWith(".swift")) && !units.some(([file]) => /\.mm?$/.test(file));
|
|
15358
15476
|
if (roots2.length) {
|
|
15359
|
-
const sourceHeaders =
|
|
15477
|
+
const sourceHeaders = import_node_path11.default.join(
|
|
15360
15478
|
layout.root,
|
|
15361
15479
|
".build",
|
|
15362
15480
|
"peach-objc-originals",
|
|
15363
15481
|
target.name
|
|
15364
15482
|
);
|
|
15365
15483
|
(0, import_node_fs8.mkdirSync)(sourceHeaders, { recursive: true });
|
|
15366
|
-
const modulemap =
|
|
15484
|
+
const modulemap = import_node_path11.default.join(sourceHeaders, "module.modulemap");
|
|
15367
15485
|
(0, import_node_fs8.writeFileSync)(
|
|
15368
15486
|
modulemap,
|
|
15369
15487
|
`module ${swiftTargetModuleName(target.name)} {
|
|
15370
|
-
${roots2.map((file) => `header ${JSON.stringify(
|
|
15488
|
+
${roots2.map((file) => `header ${JSON.stringify(import_node_path11.default.join(layout.root, file))}`).join("\n")}
|
|
15371
15489
|
export *
|
|
15372
15490
|
}
|
|
15373
15491
|
`
|
|
@@ -15379,12 +15497,12 @@ export *
|
|
|
15379
15497
|
modulemap
|
|
15380
15498
|
},
|
|
15381
15499
|
toolchainBin,
|
|
15382
|
-
|
|
15383
|
-
|
|
15384
|
-
|
|
15500
|
+
import_node_path11.default.join(moduleRoot, "ios-simulator-stdlib"),
|
|
15501
|
+
import_node_path11.default.join(layout.root, ".build", "peach-objc-sdk"),
|
|
15502
|
+
import_node_path11.default.join(layout.root, ".build", "peach-objc-imports", target.name),
|
|
15385
15503
|
{
|
|
15386
|
-
flags: stageFlags(originalFlags,
|
|
15387
|
-
target: `arm64-apple-ios${
|
|
15504
|
+
flags: stageFlags(originalFlags, import_node_path11.default.join(sdkHeaders, "usr/include")),
|
|
15505
|
+
target: `arm64-apple-ios${deploymentTarget(target.name)}-simulator`
|
|
15388
15506
|
}
|
|
15389
15507
|
);
|
|
15390
15508
|
const defined = /* @__PURE__ */ new Set();
|
|
@@ -15422,7 +15540,7 @@ export *
|
|
|
15422
15540
|
imports.set(target.name, {
|
|
15423
15541
|
view,
|
|
15424
15542
|
classes: [...foreignTypes.values()],
|
|
15425
|
-
headers: roots2.map((file) =>
|
|
15543
|
+
headers: roots2.map((file) => import_node_path11.default.join(layout.root, file)),
|
|
15426
15544
|
foreignTypes
|
|
15427
15545
|
});
|
|
15428
15546
|
}
|
|
@@ -15431,25 +15549,25 @@ export *
|
|
|
15431
15549
|
for (const [file, contents] of nativeUnits) {
|
|
15432
15550
|
const origin = settings?.sourceDirectories[file];
|
|
15433
15551
|
if (origin) {
|
|
15434
|
-
const original =
|
|
15435
|
-
(0, import_node_fs8.mkdirSync)(
|
|
15552
|
+
const original = import_node_path11.default.join(layout.root, origin, import_node_path11.default.posix.basename(file));
|
|
15553
|
+
(0, import_node_fs8.mkdirSync)(import_node_path11.default.dirname(original), { recursive: true });
|
|
15436
15554
|
stageTargetFile(target.name, original, contents, { allowExisting: true });
|
|
15437
15555
|
}
|
|
15438
15556
|
const source = unitSource(file);
|
|
15439
15557
|
if (source !== file.slice(prefix.length))
|
|
15440
15558
|
stageTargetFile(
|
|
15441
15559
|
target.name,
|
|
15442
|
-
|
|
15560
|
+
import_node_path11.default.join(layout.root, target.path, source),
|
|
15443
15561
|
contents,
|
|
15444
15562
|
{
|
|
15445
15563
|
allowExisting: true
|
|
15446
15564
|
}
|
|
15447
15565
|
);
|
|
15448
15566
|
const perFile = [
|
|
15449
|
-
...origin ? ["-iquote",
|
|
15567
|
+
...origin ? ["-iquote", import_node_path11.default.join(layout.root, origin)] : [],
|
|
15450
15568
|
...stageFlags(
|
|
15451
15569
|
settings?.fileFlags[file] ?? [],
|
|
15452
|
-
|
|
15570
|
+
import_node_path11.default.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
|
|
15453
15571
|
)
|
|
15454
15572
|
];
|
|
15455
15573
|
const cxx = /\.(?:cc|cpp|cxx|mm)$/.test(file);
|
|
@@ -15470,7 +15588,7 @@ export *
|
|
|
15470
15588
|
...accessorFlags,
|
|
15471
15589
|
...stageFlags(
|
|
15472
15590
|
cxx ? settings.cxxFlags : [],
|
|
15473
|
-
|
|
15591
|
+
import_node_path11.default.join(swiftSdkPaths(moduleRoot, toolchainBin).sysroot, "include")
|
|
15474
15592
|
),
|
|
15475
15593
|
...perFile
|
|
15476
15594
|
]
|
|
@@ -15485,12 +15603,12 @@ export *
|
|
|
15485
15603
|
flags: [...flags, "-fobjc-arc"],
|
|
15486
15604
|
cxxFlags: [...flags, "-fobjc-arc"]
|
|
15487
15605
|
});
|
|
15488
|
-
const include2 =
|
|
15606
|
+
const include2 = import_node_path11.default.join(layout.root, target.path, "include");
|
|
15489
15607
|
if (accessor) {
|
|
15490
15608
|
stageTargetFile(target.name, accessorHeader, accessor.header);
|
|
15491
15609
|
stageTargetFile(
|
|
15492
15610
|
target.name,
|
|
15493
|
-
|
|
15611
|
+
import_node_path11.default.join(layout.root, accessorUnit),
|
|
15494
15612
|
accessor.body
|
|
15495
15613
|
);
|
|
15496
15614
|
}
|
|
@@ -15529,12 +15647,12 @@ export *
|
|
|
15529
15647
|
const contents = input.files[original];
|
|
15530
15648
|
if (contents === void 0)
|
|
15531
15649
|
throw new Error(`missing original module map ${original}`);
|
|
15532
|
-
stageTargetFile(target.name,
|
|
15650
|
+
stageTargetFile(target.name, import_node_path11.default.join(layout.root, product), contents);
|
|
15533
15651
|
const [owner, ...implementations] = groups.values();
|
|
15534
15652
|
if (!owner) throw new Error(`target ${target.name} has no original units`);
|
|
15535
15653
|
native.set(target.name, {
|
|
15536
15654
|
path: target.path,
|
|
15537
|
-
includeDirectory:
|
|
15655
|
+
includeDirectory: import_node_path11.default.join(layout.root, import_node_path11.default.dirname(product)),
|
|
15538
15656
|
sources: nativeUnits.map(([file]) => unitSource(file)),
|
|
15539
15657
|
lateSources: implementations.flatMap((group) => group.sources),
|
|
15540
15658
|
exclude: [],
|
|
@@ -15555,7 +15673,7 @@ export *
|
|
|
15555
15673
|
}
|
|
15556
15674
|
stageTargetFile(
|
|
15557
15675
|
target.name,
|
|
15558
|
-
|
|
15676
|
+
import_node_path11.default.join(include2, "module.modulemap"),
|
|
15559
15677
|
`module ${target.name}ImplementationDeclarations { export * }
|
|
15560
15678
|
`
|
|
15561
15679
|
);
|
|
@@ -15591,7 +15709,7 @@ export *
|
|
|
15591
15709
|
}
|
|
15592
15710
|
native.set(target.name, {
|
|
15593
15711
|
path: target.path,
|
|
15594
|
-
includeDirectory:
|
|
15712
|
+
includeDirectory: import_node_path11.default.join(layout.root, includes),
|
|
15595
15713
|
sources: units.map(([file]) => file.slice(prefix.length)),
|
|
15596
15714
|
lateSources: late.map(([file]) => file.slice(prefix.length)),
|
|
15597
15715
|
...late.length > 0 ? {
|
|
@@ -15609,7 +15727,7 @@ export *
|
|
|
15609
15727
|
([file]) => file.startsWith(includes) && /\.(?:h|hpp|hh|hxx)$/.test(file) && consumers.get(file).size === 0
|
|
15610
15728
|
);
|
|
15611
15729
|
files.set(
|
|
15612
|
-
|
|
15730
|
+
import_node_path11.default.join(layout.root, includes, "module.modulemap"),
|
|
15613
15731
|
[
|
|
15614
15732
|
`module ${target.name} {`,
|
|
15615
15733
|
...roots.map(
|
|
@@ -15626,7 +15744,7 @@ export *
|
|
|
15626
15744
|
swiftModuleInputFiles(moduleRoot).join("\n")
|
|
15627
15745
|
);
|
|
15628
15746
|
if (!distribution) {
|
|
15629
|
-
modulePlan.update((0, import_node_fs8.readFileSync)(
|
|
15747
|
+
modulePlan.update((0, import_node_fs8.readFileSync)(import_node_path11.default.join(moduleRoot, "Package.swift")));
|
|
15630
15748
|
}
|
|
15631
15749
|
const resourcePlan = (0, import_node_crypto7.createHash)("sha256").update(
|
|
15632
15750
|
JSON.stringify(
|
|
@@ -15707,27 +15825,27 @@ export *
|
|
|
15707
15825
|
objcModules.add(name2);
|
|
15708
15826
|
rootOwner ??= exported ? [...exported.swift.keys()][0] : `${prefix}PeachObjCImports.generated.swift`;
|
|
15709
15827
|
files.set(
|
|
15710
|
-
|
|
15828
|
+
import_node_path11.default.join(headerDirectory, `${name2}-Swift.h`),
|
|
15711
15829
|
exported?.header ?? "#pragma once\n"
|
|
15712
15830
|
);
|
|
15713
15831
|
files.set(
|
|
15714
|
-
|
|
15832
|
+
import_node_path11.default.join(headerDirectory, name2, `${name2}-Swift.h`),
|
|
15715
15833
|
`#include "../${name2}-Swift.h"
|
|
15716
15834
|
`
|
|
15717
15835
|
);
|
|
15718
15836
|
files.set(
|
|
15719
|
-
|
|
15837
|
+
import_node_path11.default.join(headerModuleDirectory, name2, "module.modulemap"),
|
|
15720
15838
|
`module ${swiftTargetModuleName(name2)} {
|
|
15721
15839
|
${[
|
|
15722
|
-
|
|
15723
|
-
...(input.nativeTargets?.find((target2) => target2.name === name2)?.publicHeaders ?? []).map((header) =>
|
|
15840
|
+
import_node_path11.default.join(headerDirectory, `${name2}-Swift.h`),
|
|
15841
|
+
...(input.nativeTargets?.find((target2) => target2.name === name2)?.publicHeaders ?? []).map((header) => import_node_path11.default.join(layout.root, header))
|
|
15724
15842
|
].map((header) => ` header ${JSON.stringify(header)}`).join("\n")}
|
|
15725
15843
|
export *
|
|
15726
15844
|
}
|
|
15727
15845
|
`
|
|
15728
15846
|
);
|
|
15729
15847
|
files.set(
|
|
15730
|
-
|
|
15848
|
+
import_node_path11.default.join(layout.root, "PeachObjCExports", `${name2}.m`),
|
|
15731
15849
|
exported?.implementation ?? `#include "${name2}-Cxx.h"
|
|
15732
15850
|
`
|
|
15733
15851
|
);
|
|
@@ -15739,13 +15857,13 @@ ${[
|
|
|
15739
15857
|
if (generated) {
|
|
15740
15858
|
const register = `_peach_objc_imports_${swiftTargetModuleName(name2)}`;
|
|
15741
15859
|
files.set(
|
|
15742
|
-
|
|
15860
|
+
import_node_path11.default.join(layout.root, target.path, "PeachObjCImports.generated.swift"),
|
|
15743
15861
|
generated.swift + generated.registration + `
|
|
15744
15862
|
@_cdecl("${register}") public func __peachRegisterOriginalObjC() { ${generated.registerFunction}() }
|
|
15745
15863
|
`
|
|
15746
15864
|
);
|
|
15747
15865
|
files.set(
|
|
15748
|
-
|
|
15866
|
+
import_node_path11.default.join(layout.root, target.path, "PeachObjCImports.generated.m"),
|
|
15749
15867
|
generated.objc
|
|
15750
15868
|
);
|
|
15751
15869
|
registrations.push(`${register}();`);
|
|
@@ -15803,7 +15921,7 @@ ${[
|
|
|
15803
15921
|
exclude: []
|
|
15804
15922
|
});
|
|
15805
15923
|
files.set(
|
|
15806
|
-
|
|
15924
|
+
import_node_path11.default.join(layout.root, `PeachApplication/${name2}/Entry.swift`),
|
|
15807
15925
|
`import ${swiftTargetModuleName(target.name)}
|
|
15808
15926
|
@main struct __PeachApplicationEntry { @MainActor static func main() { __peachRunApplication() } }
|
|
15809
15927
|
`
|
|
@@ -15811,22 +15929,35 @@ ${[
|
|
|
15811
15929
|
}
|
|
15812
15930
|
const nativeFlags = (() => {
|
|
15813
15931
|
if (native.size === 0) return void 0;
|
|
15814
|
-
const headers = materializeObjcSdk(
|
|
15815
|
-
|
|
15816
|
-
|
|
15817
|
-
|
|
15818
|
-
|
|
15819
|
-
|
|
15820
|
-
|
|
15821
|
-
|
|
15822
|
-
|
|
15823
|
-
|
|
15824
|
-
|
|
15825
|
-
|
|
15826
|
-
|
|
15827
|
-
|
|
15828
|
-
|
|
15829
|
-
|
|
15932
|
+
const headers = materializeObjcSdk(import_node_path11.default.join(layout.root, ".build", "peach-objc-sdk"));
|
|
15933
|
+
const moduleMaps = rootOwner ? [...objcModules].map(
|
|
15934
|
+
(name2) => `-fmodule-map-file=${import_node_path11.default.join(headerModuleDirectory, name2, "module.modulemap")}`
|
|
15935
|
+
) : [];
|
|
15936
|
+
return new Map(
|
|
15937
|
+
targets.map((target) => {
|
|
15938
|
+
const version = deploymentTarget(target.name);
|
|
15939
|
+
const minimum = iosDeploymentMinimum(version);
|
|
15940
|
+
if (minimum === void 0)
|
|
15941
|
+
throw new Error(
|
|
15942
|
+
`${target.name}: unsupported IPHONEOS_DEPLOYMENT_TARGET ${JSON.stringify(version)}`
|
|
15943
|
+
);
|
|
15944
|
+
return [
|
|
15945
|
+
target.name,
|
|
15946
|
+
[
|
|
15947
|
+
"-fobjc-runtime=gnustep-2.2",
|
|
15948
|
+
"-fobjc-exceptions",
|
|
15949
|
+
"-fexceptions",
|
|
15950
|
+
"-fwasm-exceptions",
|
|
15951
|
+
"-fobjc-arc",
|
|
15952
|
+
"-fblocks",
|
|
15953
|
+
...objcSdkIntakeFlags(headers, nativeToolchain(), minimum),
|
|
15954
|
+
"-I",
|
|
15955
|
+
headerDirectory,
|
|
15956
|
+
...moduleMaps
|
|
15957
|
+
]
|
|
15958
|
+
];
|
|
15959
|
+
})
|
|
15960
|
+
);
|
|
15830
15961
|
})();
|
|
15831
15962
|
let objcExports;
|
|
15832
15963
|
if (rootOwner && input.objcPeerStartup)
|
|
@@ -15843,7 +15974,7 @@ ${[
|
|
|
15843
15974
|
throw new Error(
|
|
15844
15975
|
"Swift Objective-C export target conflicts with application sources"
|
|
15845
15976
|
);
|
|
15846
|
-
const ownerFile =
|
|
15977
|
+
const ownerFile = import_node_path11.default.join(layout.root, rootOwner);
|
|
15847
15978
|
const ownerSource = compiled.get(rootOwner) ?? files.get(ownerFile);
|
|
15848
15979
|
if (typeof ownerSource !== "string")
|
|
15849
15980
|
throw new Error("Objective-C root registration has no owning Swift source");
|
|
@@ -15860,11 +15991,11 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
|
|
|
15860
15991
|
);
|
|
15861
15992
|
if (compiled.has(rootOwner)) compiled.set(rootOwner, files.get(ownerFile).toString());
|
|
15862
15993
|
files.set(
|
|
15863
|
-
|
|
15994
|
+
import_node_path11.default.join(layout.root, "PeachObjCExports", "include", "module.modulemap"),
|
|
15864
15995
|
"module PeachSwiftObjCExports { export * }\n"
|
|
15865
15996
|
);
|
|
15866
15997
|
files.set(
|
|
15867
|
-
|
|
15998
|
+
import_node_path11.default.join(layout.root, "PeachObjCExports", "root.m"),
|
|
15868
15999
|
[
|
|
15869
16000
|
"#import <Foundation/Foundation.h>",
|
|
15870
16001
|
"extern void _peach_objc_ensure_exports(void);",
|
|
@@ -15886,24 +16017,15 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
|
|
|
15886
16017
|
""
|
|
15887
16018
|
].join("\n")
|
|
15888
16019
|
);
|
|
15889
|
-
objcExports = {
|
|
15890
|
-
modules: objcModules,
|
|
15891
|
-
rootModule,
|
|
15892
|
-
flags: [
|
|
15893
|
-
...nativeFlags,
|
|
15894
|
-
...[...objcModules].map(
|
|
15895
|
-
(name2) => `-fmodule-map-file=${import_node_path10.default.join(headerModuleDirectory, name2, "module.modulemap")}`
|
|
15896
|
-
)
|
|
15897
|
-
]
|
|
15898
|
-
};
|
|
16020
|
+
objcExports = { modules: objcModules, rootModule };
|
|
15899
16021
|
}
|
|
15900
16022
|
if (targets.length === 0) {
|
|
15901
16023
|
for (const [file, contents] of Object.entries(input.files)) {
|
|
15902
16024
|
if (file === "Package.swift") continue;
|
|
15903
|
-
files.set(
|
|
16025
|
+
files.set(import_node_path11.default.join(layout.sources, file), compiled.get(file) ?? contents);
|
|
15904
16026
|
}
|
|
15905
16027
|
let manifest = (0, import_node_fs8.readFileSync)(
|
|
15906
|
-
|
|
16028
|
+
import_node_path11.default.join(moduleRoot, "scripts/contrast-app-Package.swift"),
|
|
15907
16029
|
"utf8"
|
|
15908
16030
|
).replaceAll("__SOOTSIM_SWIFT_PACKAGE__", moduleRoot);
|
|
15909
16031
|
const reactor = ` ${REACTOR_FLAG}`;
|
|
@@ -15947,21 +16069,21 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
|
|
|
15947
16069
|
manifest = manifest.replace(anchor, `${anchor}
|
|
15948
16070
|
${SPRITEKIT_PRODUCT},`);
|
|
15949
16071
|
}
|
|
15950
|
-
files.set(
|
|
16072
|
+
files.set(import_node_path11.default.join(layout.root, "Package.swift"), manifest + moduleFiles);
|
|
15951
16073
|
} else {
|
|
15952
16074
|
const base = layout.multi ? layout.root : layout.sources;
|
|
15953
16075
|
const libraries = /* @__PURE__ */ new Map();
|
|
15954
16076
|
for (const [target, data] of Object.entries(input.libraries ?? {})) {
|
|
15955
|
-
const file =
|
|
16077
|
+
const file = import_node_path11.default.join(layout.root, ".peach-libraries", `lib${target}.a`);
|
|
15956
16078
|
files.set(file, Buffer.from(data, "base64"));
|
|
15957
16079
|
libraries.set(target, file);
|
|
15958
16080
|
}
|
|
15959
16081
|
for (const [file, contents] of Object.entries(input.files)) {
|
|
15960
16082
|
if (file === "Package.swift") continue;
|
|
15961
|
-
files.set(
|
|
16083
|
+
files.set(import_node_path11.default.join(base, file), compiled.get(file) ?? contents);
|
|
15962
16084
|
}
|
|
15963
16085
|
files.set(
|
|
15964
|
-
|
|
16086
|
+
import_node_path11.default.join(layout.root, "Package.swift"),
|
|
15965
16087
|
emitSwiftPackageManifest({
|
|
15966
16088
|
targets,
|
|
15967
16089
|
native,
|
|
@@ -15980,7 +16102,7 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
|
|
|
15980
16102
|
spriteKit: importsSpriteKit(input.files),
|
|
15981
16103
|
distribution: distribution ?? void 0,
|
|
15982
16104
|
distributionLink: {
|
|
15983
|
-
path:
|
|
16105
|
+
path: import_node_path11.default.join(layout.root, ".peach-distribution-objects.rsp"),
|
|
15984
16106
|
files
|
|
15985
16107
|
},
|
|
15986
16108
|
libraries
|
|
@@ -15996,9 +16118,9 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
|
|
|
15996
16118
|
throw new Error(
|
|
15997
16119
|
`swift resource target ${target.name} has no matching bundle assignment`
|
|
15998
16120
|
);
|
|
15999
|
-
const directory = layout.multi ?
|
|
16121
|
+
const directory = layout.multi ? import_node_path11.default.join(layout.root, target.path) : layout.sources;
|
|
16000
16122
|
files.set(
|
|
16001
|
-
|
|
16123
|
+
import_node_path11.default.join(directory, "ResourceBundleAccessor.generated.swift"),
|
|
16002
16124
|
[
|
|
16003
16125
|
"import Foundation",
|
|
16004
16126
|
"",
|
|
@@ -16015,7 +16137,7 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
|
|
|
16015
16137
|
}
|
|
16016
16138
|
for (const [file, source] of compiled)
|
|
16017
16139
|
if (!Object.hasOwn(input.files, file))
|
|
16018
|
-
files.set(
|
|
16140
|
+
files.set(import_node_path11.default.join(layout.multi ? layout.root : layout.sources, file), source);
|
|
16019
16141
|
syncSwiftTree(layout.root, files);
|
|
16020
16142
|
const producers = [
|
|
16021
16143
|
.../* @__PURE__ */ new Set([
|
|
@@ -16037,10 +16159,10 @@ public func __peachObjcExportRoot() { _objcRegisterPeerClass(NSObject.self, nati
|
|
|
16037
16159
|
targetFailures,
|
|
16038
16160
|
...rootOwner && objcExports ? {
|
|
16039
16161
|
objcImplementations: {
|
|
16040
|
-
owner:
|
|
16162
|
+
owner: import_node_path11.default.join(layout.root, rootOwner),
|
|
16041
16163
|
registeredClasses: [...registeredClasses],
|
|
16042
16164
|
units: [...native.values()].flatMap(
|
|
16043
|
-
(value) => value.sources.filter((file) => /\.mm?$/.test(file)).map((file) =>
|
|
16165
|
+
(value) => value.sources.filter((file) => /\.mm?$/.test(file)).map((file) => import_node_path11.default.join(layout.root, value.path, file))
|
|
16044
16166
|
)
|
|
16045
16167
|
}
|
|
16046
16168
|
} : {}
|
|
@@ -16062,13 +16184,13 @@ function outputOf(error) {
|
|
|
16062
16184
|
return error instanceof Error ? error.message : String(error);
|
|
16063
16185
|
}
|
|
16064
16186
|
function builtArtifact(layout) {
|
|
16065
|
-
const binDir =
|
|
16066
|
-
const manifest = (0, import_node_fs8.readFileSync)(
|
|
16187
|
+
const binDir = import_node_path11.default.join(layout.root, ".build", WASM_TRIPLE, "release");
|
|
16188
|
+
const manifest = (0, import_node_fs8.readFileSync)(import_node_path11.default.join(layout.root, "Package.swift"), "utf8");
|
|
16067
16189
|
const executable = swiftManifestTargets(manifest).find((target) => target.executable);
|
|
16068
16190
|
if (executable === void 0) {
|
|
16069
16191
|
throw new Error("swift-compile: the written manifest names no executable target");
|
|
16070
16192
|
}
|
|
16071
|
-
const file =
|
|
16193
|
+
const file = import_node_path11.default.join(binDir, `${executable.name}.wasm`);
|
|
16072
16194
|
if (!(0, import_node_fs8.existsSync)(file)) {
|
|
16073
16195
|
const found = (0, import_node_fs8.existsSync)(binDir) ? (0, import_node_fs8.readdirSync)(binDir).filter((name2) => name2.endsWith(".wasm")).sort() : [];
|
|
16074
16196
|
throw new Error(
|
|
@@ -16079,7 +16201,7 @@ function builtArtifact(layout) {
|
|
|
16079
16201
|
}
|
|
16080
16202
|
function projectDiagnostic(output, layout, files) {
|
|
16081
16203
|
const base = layout.multi ? layout.root : layout.sources;
|
|
16082
|
-
const prefix = `${base}${
|
|
16204
|
+
const prefix = `${base}${import_node_path11.default.sep}`;
|
|
16083
16205
|
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();
|
|
16084
16206
|
}
|
|
16085
16207
|
var ROOT_LOCKS = Symbol.for("peachsim.swiftCompile.rootLocks");
|
|
@@ -16115,12 +16237,12 @@ function serialize(root, work, signal) {
|
|
|
16115
16237
|
function readCompiledArtifact(directory, hash2) {
|
|
16116
16238
|
try {
|
|
16117
16239
|
const receipt = JSON.parse(
|
|
16118
|
-
(0, import_node_fs8.readFileSync)(
|
|
16240
|
+
(0, import_node_fs8.readFileSync)(import_node_path11.default.join(directory, "artifact.json"), "utf8")
|
|
16119
16241
|
);
|
|
16120
16242
|
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")
|
|
16121
16243
|
return null;
|
|
16122
|
-
const bytes = (0, import_node_fs8.readFileSync)(
|
|
16123
|
-
const gzip2 = (0, import_node_fs8.readFileSync)(
|
|
16244
|
+
const bytes = (0, import_node_fs8.readFileSync)(import_node_path11.default.join(directory, "app.wasm"));
|
|
16245
|
+
const gzip2 = (0, import_node_fs8.readFileSync)(import_node_path11.default.join(directory, "icu.gz"));
|
|
16124
16246
|
if ((0, import_node_crypto7.createHash)("sha256").update(bytes).digest("hex") !== receipt.wasm || (0, import_node_crypto7.createHash)("sha256").update(gzip2).digest("hex") !== receipt.icu || bytes.length < 8 || bytes.readUInt32LE(0) !== 1836278016 || bytes.readUInt32LE(4) !== 1)
|
|
16125
16247
|
return null;
|
|
16126
16248
|
return { hash: hash2, bytes, icu: { sha256: receipt.icu, gzip: gzip2 } };
|
|
@@ -16131,14 +16253,14 @@ function readCompiledArtifact(directory, hash2) {
|
|
|
16131
16253
|
}
|
|
16132
16254
|
}
|
|
16133
16255
|
function saveCompiledArtifact(root, artifact) {
|
|
16134
|
-
const directory =
|
|
16256
|
+
const directory = import_node_path11.default.join(root, "artifact");
|
|
16135
16257
|
(0, import_node_fs8.mkdirSync)(directory, { recursive: true });
|
|
16136
|
-
const pending = (0, import_node_fs8.mkdtempSync)(
|
|
16258
|
+
const pending = (0, import_node_fs8.mkdtempSync)(import_node_path11.default.join(root, ".artifact-"));
|
|
16137
16259
|
try {
|
|
16138
|
-
(0, import_node_fs8.writeFileSync)(
|
|
16139
|
-
(0, import_node_fs8.writeFileSync)(
|
|
16260
|
+
(0, import_node_fs8.writeFileSync)(import_node_path11.default.join(pending, "app.wasm"), artifact.bytes);
|
|
16261
|
+
(0, import_node_fs8.writeFileSync)(import_node_path11.default.join(pending, "icu.gz"), artifact.icu.gzip);
|
|
16140
16262
|
(0, import_node_fs8.writeFileSync)(
|
|
16141
|
-
|
|
16263
|
+
import_node_path11.default.join(pending, "artifact.json"),
|
|
16142
16264
|
JSON.stringify({
|
|
16143
16265
|
hash: artifact.hash,
|
|
16144
16266
|
wasm: (0, import_node_crypto7.createHash)("sha256").update(artifact.bytes).digest("hex"),
|
|
@@ -16146,7 +16268,7 @@ function saveCompiledArtifact(root, artifact) {
|
|
|
16146
16268
|
})
|
|
16147
16269
|
);
|
|
16148
16270
|
for (const file of ["app.wasm", "icu.gz", "artifact.json"]) {
|
|
16149
|
-
(0, import_node_fs8.renameSync)(
|
|
16271
|
+
(0, import_node_fs8.renameSync)(import_node_path11.default.join(pending, file), import_node_path11.default.join(directory, file));
|
|
16150
16272
|
}
|
|
16151
16273
|
} finally {
|
|
16152
16274
|
(0, import_node_fs8.rmSync)(pending, { recursive: true, force: true });
|
|
@@ -16168,16 +16290,16 @@ function renewSharedArtifact(sharedRoot) {
|
|
|
16168
16290
|
function pruneSharedArtifacts(parent, keep) {
|
|
16169
16291
|
const entries = [];
|
|
16170
16292
|
for (const name2 of (0, import_node_fs8.readdirSync)(parent)) {
|
|
16171
|
-
const directory =
|
|
16293
|
+
const directory = import_node_path11.default.join(parent, name2);
|
|
16172
16294
|
if (name2.startsWith(RETIRED_PREFIX)) {
|
|
16173
16295
|
(0, import_node_fs8.rmSync)(directory, { recursive: true, force: true });
|
|
16174
16296
|
continue;
|
|
16175
16297
|
}
|
|
16176
16298
|
try {
|
|
16177
16299
|
let bytes = 0;
|
|
16178
|
-
for (const file of (0, import_node_fs8.readdirSync)(
|
|
16300
|
+
for (const file of (0, import_node_fs8.readdirSync)(import_node_path11.default.join(directory, "artifact"))) {
|
|
16179
16301
|
try {
|
|
16180
|
-
bytes += (0, import_node_fs8.statSync)(
|
|
16302
|
+
bytes += (0, import_node_fs8.statSync)(import_node_path11.default.join(directory, "artifact", file)).size;
|
|
16181
16303
|
} catch (error) {
|
|
16182
16304
|
if (!vanished(error)) throw error;
|
|
16183
16305
|
}
|
|
@@ -16192,9 +16314,9 @@ function pruneSharedArtifacts(parent, keep) {
|
|
|
16192
16314
|
if (total <= SHARED_ARTIFACT_BUDGET_BYTES) break;
|
|
16193
16315
|
if (entry.directory === keep || Date.now() - entry.used < SHARED_ARTIFACT_GRACE_MS)
|
|
16194
16316
|
continue;
|
|
16195
|
-
const retired =
|
|
16317
|
+
const retired = import_node_path11.default.join(
|
|
16196
16318
|
parent,
|
|
16197
|
-
`${RETIRED_PREFIX}${process.pid}-${
|
|
16319
|
+
`${RETIRED_PREFIX}${process.pid}-${import_node_path11.default.basename(entry.directory)}`
|
|
16198
16320
|
);
|
|
16199
16321
|
try {
|
|
16200
16322
|
if ((0, import_node_fs8.statSync)(entry.directory).mtimeMs !== entry.used) continue;
|
|
@@ -16210,7 +16332,7 @@ function pruneSharedArtifacts(parent, keep) {
|
|
|
16210
16332
|
function saveSharedArtifact(sharedRoot, artifact) {
|
|
16211
16333
|
saveCompiledArtifact(sharedRoot, artifact);
|
|
16212
16334
|
renewSharedArtifact(sharedRoot);
|
|
16213
|
-
pruneSharedArtifacts(
|
|
16335
|
+
pruneSharedArtifacts(import_node_path11.default.dirname(sharedRoot), sharedRoot);
|
|
16214
16336
|
}
|
|
16215
16337
|
var retainedArtifacts = /* @__PURE__ */ new Map();
|
|
16216
16338
|
function retain(root, artifact) {
|
|
@@ -16227,14 +16349,14 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
16227
16349
|
options.signal?.throwIfAborted();
|
|
16228
16350
|
(0, import_node_fs8.mkdirSync)(options.buildRoot, { recursive: true });
|
|
16229
16351
|
const root = (0, import_node_fs8.realpathSync)(options.buildRoot);
|
|
16230
|
-
const moduleRoot =
|
|
16352
|
+
const moduleRoot = import_node_path11.default.resolve(options.moduleRoot);
|
|
16231
16353
|
const layout = {
|
|
16232
16354
|
root,
|
|
16233
|
-
sources:
|
|
16355
|
+
sources: import_node_path11.default.join(root, "Sources", "App"),
|
|
16234
16356
|
multi: compileTargets(input).length > 0
|
|
16235
16357
|
};
|
|
16236
16358
|
const hash2 = swiftArtifactHash(input, options.release, moduleRoot);
|
|
16237
|
-
const sharedRoot =
|
|
16359
|
+
const sharedRoot = import_node_path11.default.join(rnxHomeDir(), "cache", "swift-projects", hash2);
|
|
16238
16360
|
const report = (message) => {
|
|
16239
16361
|
console.error(`[swift-project ${hash2.slice(0, 16)}] ${message}`);
|
|
16240
16362
|
options.onStage?.(message);
|
|
@@ -16248,8 +16370,8 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
16248
16370
|
report("reusing memory artifact");
|
|
16249
16371
|
return retain(root, retained);
|
|
16250
16372
|
}
|
|
16251
|
-
const cached = readCompiledArtifact(
|
|
16252
|
-
const previous = cached ?? readCompiledArtifact(
|
|
16373
|
+
const cached = readCompiledArtifact(import_node_path11.default.join(sharedRoot, "artifact"), hash2);
|
|
16374
|
+
const previous = cached ?? readCompiledArtifact(import_node_path11.default.join(root, "artifact"), hash2);
|
|
16253
16375
|
if (previous) {
|
|
16254
16376
|
if (cached) renewSharedArtifact(sharedRoot);
|
|
16255
16377
|
else saveSharedArtifact(sharedRoot, previous);
|
|
@@ -16258,8 +16380,8 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
16258
16380
|
}
|
|
16259
16381
|
if (process.platform === "darwin" && process.env.TM_SESSION && !admittedMacBuilderSlot() && process.env.CI !== "true" && moduleRoot === sourceSwiftCheckout() && !swiftDistributionAt(moduleRoot)) {
|
|
16260
16382
|
const requestRoot = (0, import_node_fs8.mkdtempSync)(`${root}.builder-request-`);
|
|
16261
|
-
const output =
|
|
16262
|
-
const request =
|
|
16383
|
+
const output = import_node_path11.default.join(requestRoot, "output");
|
|
16384
|
+
const request = import_node_path11.default.join(requestRoot, "request.json");
|
|
16263
16385
|
(0, import_node_fs8.writeFileSync)(
|
|
16264
16386
|
request,
|
|
16265
16387
|
JSON.stringify({
|
|
@@ -16273,12 +16395,12 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
16273
16395
|
})
|
|
16274
16396
|
);
|
|
16275
16397
|
try {
|
|
16276
|
-
const repo =
|
|
16398
|
+
const repo = import_node_path11.default.resolve(moduleRoot, "../..");
|
|
16277
16399
|
report("requesting builder admission or cached result");
|
|
16278
16400
|
await runCompiler(
|
|
16279
16401
|
"bun",
|
|
16280
16402
|
[
|
|
16281
|
-
|
|
16403
|
+
import_node_path11.default.join(repo, "scripts/build/swift-project.ts"),
|
|
16282
16404
|
"--request",
|
|
16283
16405
|
request,
|
|
16284
16406
|
"--output",
|
|
@@ -16312,7 +16434,7 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
16312
16434
|
return withSwiftRootLock(
|
|
16313
16435
|
root,
|
|
16314
16436
|
async (lease) => {
|
|
16315
|
-
const built = readCompiledArtifact(
|
|
16437
|
+
const built = readCompiledArtifact(import_node_path11.default.join(sharedRoot, "artifact"), hash2);
|
|
16316
16438
|
if (built) {
|
|
16317
16439
|
report("reusing verified disk artifact");
|
|
16318
16440
|
return retain(root, built);
|
|
@@ -16321,7 +16443,7 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
16321
16443
|
const unprepared = preparation.targetFailures.map(
|
|
16322
16444
|
(failure) => `error: target ${failure}`
|
|
16323
16445
|
);
|
|
16324
|
-
const swift =
|
|
16446
|
+
const swift = import_node_path11.default.join(options.toolchainBin, "swift");
|
|
16325
16447
|
if (!(0, import_node_fs8.existsSync)(swift)) {
|
|
16326
16448
|
throw new Error(
|
|
16327
16449
|
`swift-compile: no swift.org toolchain at ${options.toolchainBin}; install ${options.release} and its matching wasm sdk`
|
|
@@ -16369,8 +16491,8 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
16369
16491
|
// shipped host plugins resolve against the selected compiler's runtime.
|
|
16370
16492
|
...process.platform === "linux" ? {
|
|
16371
16493
|
LD_LIBRARY_PATH: [
|
|
16372
|
-
|
|
16373
|
-
|
|
16494
|
+
import_node_path11.default.resolve(options.toolchainBin, "../lib/swift/linux"),
|
|
16495
|
+
import_node_path11.default.resolve(options.toolchainBin, "../lib/swift/host"),
|
|
16374
16496
|
process.env.LD_LIBRARY_PATH
|
|
16375
16497
|
].filter(Boolean).join(":")
|
|
16376
16498
|
} : {}
|
|
@@ -16394,7 +16516,7 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
16394
16516
|
if (preparation.objcImplementations) {
|
|
16395
16517
|
const plan = preparation.objcImplementations;
|
|
16396
16518
|
const manifest = browser_default.parse(
|
|
16397
|
-
(0, import_node_fs8.readFileSync)(
|
|
16519
|
+
(0, import_node_fs8.readFileSync)(import_node_path11.default.join(root, ".build", "release.yaml"), "utf8")
|
|
16398
16520
|
);
|
|
16399
16521
|
if (!isRecord(manifest) || !isRecord(manifest.commands))
|
|
16400
16522
|
throw new Error("missing SwiftPM native compiler commands");
|
|
@@ -16451,7 +16573,7 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
16451
16573
|
);
|
|
16452
16574
|
} catch (error) {
|
|
16453
16575
|
const output = outputOf(error);
|
|
16454
|
-
const moduleCache =
|
|
16576
|
+
const moduleCache = import_node_path11.default.join(
|
|
16455
16577
|
root,
|
|
16456
16578
|
".build",
|
|
16457
16579
|
WASM_TRIPLE,
|