peachsim 0.1.1808 → 0.1.1811
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/README.md +4 -2
- package/cli/app-bundle-resources.ts +15 -2
- package/cli/cloud-box-artifact.ts +115 -0
- package/cli/cloud-client.ts +95 -53
- package/cli/cloud-dispatch.ts +4 -4
- package/cli/cloud-session.ts +60 -22
- package/cli/commands/box.ts +8 -2
- package/cli/commands/compat.ts +7 -4
- package/cli/commands/control.ts +60 -3
- package/cli/commands/coverage.ts +14 -4
- package/cli/commands/daemon.ts +41 -0
- package/cli/commands/no-bridge-hint.ts +9 -0
- package/cli/commands/package.ts +31 -56
- package/cli/commands/platform.ts +70 -52
- package/cli/commands/preview.ts +73 -24
- package/cli/commands/record.ts +10 -2
- package/cli/commands/screenshot.ts +17 -60
- package/cli/commands/setup.ts +3 -1
- package/cli/commands/three-mode.ts +22 -12
- package/cli/commands/upload.ts +2 -1
- package/cli/desktop-companion.ts +6 -1
- package/cli/drivers/desktop.ts +4 -1
- package/cli/main.ts +12 -2
- package/cli/metro-bundle-assets.ts +14 -4
- package/cli/outbound-endpoints.ts +7 -3
- package/cli/output-redaction.ts +38 -0
- package/cli/privacy.ts +2 -2
- package/cli/recording-access.ts +5 -0
- package/cli/remote-project-bundle.ts +83 -0
- package/cli/shell-init.ts +7 -11
- package/cli/telemetry.ts +41 -4
- package/cli/usage-error.ts +3 -0
- package/cli/ws-bridge.ts +42 -6
- 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 +42783 -40717
- package/dist-lib/capture-contract.cjs +7 -8
- package/dist-lib/capture-contract.mjs +7 -8
- 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 +13 -7
- package/dist-lib/dev-bundle-resolution.cjs +10 -4
- package/dist-lib/expo-swift-bundle.cjs +15819 -15559
- package/dist-lib/expo-swift-metadata.cjs +2 -1
- package/dist-lib/expo-swift-metadata.mjs +2 -1
- package/dist-lib/home-paths.cjs +2 -33
- package/dist-lib/host/bridge-host.cjs +20857 -18756
- package/dist-lib/host/fetch-proxy-handler.cjs +10 -10
- 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 +588 -544
- 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 +25 -19
- package/dist-lib/native-app-identity-project.cjs +15 -6
- package/dist-lib/native-app-identity-project.mjs +23 -12
- 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/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.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 +27 -26
- package/dist-lib/public-origins-lib.json +104 -81
- 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 +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +30496 -24309
- package/dist-lib/swift-compile.cjs +292 -213
- package/dist-lib/swift-compile.mjs +334 -254
- package/dist-lib/swift-package.cjs +8 -4
- package/dist-lib/swift-package.mjs +8 -4
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +32 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +19172 -18941
- package/dist-lib/vite.cjs +11 -11
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/animated.d.ts +4 -0
- package/dist-types/packages/peach-engine/src/engine/animation-graph.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/expo-manifest.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/preview/upload-protocol.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +8 -1
- package/dist-types/packages/peach-globals/src/electronBridgeContract.d.ts +2 -1
- package/dist-types/packages/peach-kit/src/capabilities.d.ts +1 -0
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCall.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCallCenter.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCarrier.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTSubscriber.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTSubscriberInfo.h +1 -1
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h +1 -1
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSDictionary.h +1 -1
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSExtensionItem.h +1 -1
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/AVFoundation+MPNowPlayingInfoLanguageOptionAdditions.h +39 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/AVPlayerItem+MediaPlayerAdditions.h +26 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPContentItem.h +67 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPError.h +33 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaEntity.h +53 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaItem.h +346 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaItemCollection.h +42 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaLibrary.h +76 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaPickerController.h +64 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaPlayback.h +47 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaPlaylist.h +82 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaQuery.h +120 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaQuerySection.h +26 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMoviePlayerController.h +444 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMoviePlayerViewController.h +43 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMusicPlayerApplicationController.h +47 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMusicPlayerController.h +147 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMusicPlayerQueueDescriptor.h +75 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPNowPlayingInfoCenter.h +197 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPNowPlayingInfoLanguageOption.h +107 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPNowPlayingSession.h +89 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPPlayableContentDataSource.h +59 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPPlayableContentDelegate.h +64 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPPlayableContentManager.h +46 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPPlayableContentManagerContext.h +32 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPRemoteCommand.h +143 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPRemoteCommandCenter.h +66 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPRemoteCommandEvent.h +128 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPRemoteControlTypes.h +27 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPVolumeSettings.h +20 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPVolumeView.h +82 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MediaPlayer.apinotes +74 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MediaPlayer.h +40 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MediaPlayerDefines.h +84 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/NSUserActivity+MediaPlayerAdditions.h +20 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Modules/module.modulemap +5 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibilityCustomRotor.h +2 -2
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIAction.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIBackgroundConfiguration.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIButtonConfiguration.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIContextMenuConfiguration.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIContextMenuInteraction.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIDeferredMenuElement.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIMenu.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIPointerStyle.h +5 -5
- package/sdk/ios/usr/include/dispatch.modulemap +22 -0
- package/sdk/ios/usr/include/net/if.h +24 -0
- package/sdk/ios/usr/include/sys/time.h +1 -1
- package/sdk/ios/usr/lib/swift/Foundation.swiftmodule/arm64-apple-ios-simulator.swiftinterface +265 -0
- package/sdk/ios/usr/lib/swift/ObjectiveC.swiftmodule/arm64-apple-ios-simulator.swiftinterface +2 -0
- package/sdk/ios/wasm/include/fcntl.h +2 -0
- package/sdk/ios/wasm/include/pthread.h +3 -0
- package/sdk/ios/wasm/include/stdlib.h +2 -0
- package/sdk/ios/wasm/include/unistd.h +2 -2
- package/skills/contrast/SKILL.md +2 -2
- package/src/bundle-channel.mjs +9 -72
- package/src/capture-contract.ts +12 -9
- package/src/desktop-host-delivery.ts +16 -2
- package/src/dev-bundle-resolution.ts +12 -3
- package/src/expo-native-workspace.ts +57 -19
- package/src/expo-swift-host.ts +17 -12
- package/src/expo-swift-ready.ts +4 -1
- package/src/expoSwiftContract.ts +1 -0
- package/src/home-paths.ts +4 -48
- package/src/host/bridge-host.ts +1 -0
- package/src/installed-native-libraries.ts +2 -8
- package/src/metro-project-root.ts +2 -1
- package/src/native-bundles.ts +122 -0
- package/src/native-static-libraries.ts +65 -8
- package/src/nitro-adapter.lock.json +278 -278
- package/src/nitro-bundle.ts +2 -2
- package/src/nitro-compile.ts +68 -28
- package/src/nitro-source.ts +24 -6
- package/src/nitro-superset.lock.json +94 -34
- package/src/nitroContract.ts +2 -0
- package/src/podspec-sources.ts +1966 -0
- package/src/storageSnapshotContract.ts +40 -0
- package/src/swift-compile.ts +57 -20
- package/src/swift-design-time.ts +18 -1
- package/src/swift-distribution.lock.json +11 -11
- package/src/swift-distribution.ts +9 -6
- package/src/swift-host.ts +1 -2
- package/src/swift-objc-standin.ts +316 -112
- package/src/swift-package-manifest.ts +4 -3
- package/src/swift-package.ts +10 -3
- package/src/swift-root-lock.ts +11 -0
- package/src/swift-shared-sdk.ts +10 -9
- package/src/swift-source-pods.ts +2 -2
- package/src/swift-standins.ts +40 -143
- package/src/swift-toolchain.ts +42 -0
- package/src/swift-wasm-prune.ts +53 -21
- package/src/turbo-bundle.ts +2 -2
- package/src/turbo-codegen-intake.ts +111 -108
- package/src/turbo-compile.ts +63 -33
- package/src/turbo-runtime.lock.json +21 -21
- package/src/turbo-source.ts +171 -76
- package/src/wasm-optimize.ts +31 -2
- package/src/xcode-project.ts +36 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1811 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -86,7 +86,7 @@ __export(swift_compile_exports, {
|
|
|
86
86
|
writeSwiftProject: () => writeSwiftProject
|
|
87
87
|
});
|
|
88
88
|
module.exports = __toCommonJS(swift_compile_exports);
|
|
89
|
-
var
|
|
89
|
+
var import_node_child_process14 = require("node:child_process");
|
|
90
90
|
var import_node_crypto8 = require("node:crypto");
|
|
91
91
|
var import_node_fs17 = require("node:fs");
|
|
92
92
|
var import_node_os9 = __toESM(require("node:os"), 1);
|
|
@@ -2162,57 +2162,21 @@ var swift_c_predefines_default = {
|
|
|
2162
2162
|
}
|
|
2163
2163
|
};
|
|
2164
2164
|
|
|
2165
|
-
// src/home-paths.ts
|
|
2166
|
-
var import_node_os = require("node:os");
|
|
2167
|
-
var import_node_path = __toESM(require("node:path"), 1);
|
|
2168
|
-
var PEACH_HOME_ENV = "PEACH_HOME";
|
|
2169
|
-
function ambientHomeDir() {
|
|
2170
|
-
return import_node_path.default.join((0, import_node_os.homedir)(), ".peach");
|
|
2171
|
-
}
|
|
2172
|
-
function rnxHomeDir() {
|
|
2173
|
-
const override = process.env[PEACH_HOME_ENV];
|
|
2174
|
-
if (override && override.length > 0) return import_node_path.default.resolve(override);
|
|
2175
|
-
return ambientHomeDir();
|
|
2176
|
-
}
|
|
2177
|
-
function cacheDir() {
|
|
2178
|
-
return import_node_path.default.join(rnxHomeDir(), "cache");
|
|
2179
|
-
}
|
|
2180
|
-
var BUILDERS_ROOT_ENV = "CONTRAST_BUILDERS_ROOT";
|
|
2181
|
-
function buildersRootEnv() {
|
|
2182
|
-
const root = process.env[BUILDERS_ROOT_ENV]?.trim();
|
|
2183
|
-
return root ? root : null;
|
|
2184
|
-
}
|
|
2185
|
-
function swiftCacheDir() {
|
|
2186
|
-
const root = buildersRootEnv();
|
|
2187
|
-
return root ? import_node_path.default.join(root, "peach-cache") : cacheDir();
|
|
2188
|
-
}
|
|
2189
|
-
function swiftPackageCacheOptions() {
|
|
2190
|
-
const root = import_node_path.default.join(swiftCacheDir(), "swiftpm");
|
|
2191
|
-
return [
|
|
2192
|
-
...["cache", "config", "security"].flatMap((name2) => [
|
|
2193
|
-
`--${name2}-path`,
|
|
2194
|
-
import_node_path.default.join(root, name2)
|
|
2195
|
-
]),
|
|
2196
|
-
"--disable-keychain"
|
|
2197
|
-
];
|
|
2198
|
-
}
|
|
2199
|
-
var DAEMON_LOCKFILE_MAX_BYTES = 16 * 1024;
|
|
2200
|
-
|
|
2201
2165
|
// src/process-group.ts
|
|
2202
2166
|
var import_node_child_process3 = require("node:child_process");
|
|
2203
2167
|
var import_node_fs2 = require("node:fs");
|
|
2204
|
-
var
|
|
2205
|
-
var
|
|
2168
|
+
var import_node_os2 = require("node:os");
|
|
2169
|
+
var import_node_path = require("node:path");
|
|
2206
2170
|
var import_node_stream = require("node:stream");
|
|
2207
2171
|
var import_promises = require("node:timers/promises");
|
|
2208
2172
|
|
|
2209
2173
|
// src/process-table.ts
|
|
2210
2174
|
var import_node_child_process2 = require("node:child_process");
|
|
2211
2175
|
var import_node_fs = require("node:fs");
|
|
2212
|
-
var
|
|
2176
|
+
var import_node_os = require("node:os");
|
|
2213
2177
|
function linuxClockTicks() {
|
|
2214
2178
|
const auxv = (0, import_node_fs.readFileSync)("/proc/self/auxv");
|
|
2215
|
-
const word = (offset) => (0,
|
|
2179
|
+
const word = (offset) => (0, import_node_os.endianness)() === "LE" ? auxv.readBigUInt64LE(offset) : auxv.readBigUInt64BE(offset);
|
|
2216
2180
|
for (let offset = 0; offset + 16 <= auxv.length; offset += 16) {
|
|
2217
2181
|
if (word(offset) !== 17n) continue;
|
|
2218
2182
|
const ticks = Number(word(offset + 8));
|
|
@@ -2355,8 +2319,8 @@ function signalProcessGroup(child, signal) {
|
|
|
2355
2319
|
}
|
|
2356
2320
|
}
|
|
2357
2321
|
async function protectProcessFreeze(rootPid) {
|
|
2358
|
-
const directory = (0, import_node_fs2.mkdtempSync)((0,
|
|
2359
|
-
const journal = (0,
|
|
2322
|
+
const directory = (0, import_node_fs2.mkdtempSync)((0, import_node_path.join)((0, import_node_os2.tmpdir)(), "peach-process-freeze-"));
|
|
2323
|
+
const journal = (0, import_node_path.join)(directory, "targets");
|
|
2360
2324
|
(0, import_node_fs2.writeFileSync)(journal, `group ${rootPid}
|
|
2361
2325
|
pid ${rootPid}
|
|
2362
2326
|
`, { mode: 384 });
|
|
@@ -2609,7 +2573,7 @@ async function terminateProcessGroup(child, signal = "SIGTERM", gracefulTimeoutM
|
|
|
2609
2573
|
var import_node_crypto = require("node:crypto");
|
|
2610
2574
|
var import_node_fs4 = require("node:fs");
|
|
2611
2575
|
var import_promises2 = require("node:fs/promises");
|
|
2612
|
-
var
|
|
2576
|
+
var import_node_path2 = __toESM(require("node:path"), 1);
|
|
2613
2577
|
|
|
2614
2578
|
// src/process-liveness.ts
|
|
2615
2579
|
var import_node_fs3 = require("node:fs");
|
|
@@ -2642,8 +2606,8 @@ function removeRetiredDirectory(directory) {
|
|
|
2642
2606
|
function reapRetiredCacheDirectory(parent, name2) {
|
|
2643
2607
|
const owner = /^\.retired-(\d+)-/.exec(name2);
|
|
2644
2608
|
if (!owner || isProcessRunning(Number(owner[1]))) return;
|
|
2645
|
-
const directory =
|
|
2646
|
-
const claimed =
|
|
2609
|
+
const directory = import_node_path2.default.join(parent, name2);
|
|
2610
|
+
const claimed = import_node_path2.default.join(parent, `.retired-${process.pid}-${(0, import_node_crypto.randomUUID)()}`);
|
|
2647
2611
|
try {
|
|
2648
2612
|
(0, import_node_fs4.renameSync)(directory, claimed);
|
|
2649
2613
|
} catch (error) {
|
|
@@ -2655,12 +2619,12 @@ function reapRetiredCacheDirectory(parent, name2) {
|
|
|
2655
2619
|
|
|
2656
2620
|
// src/swift-objc-sdk-tree.ts
|
|
2657
2621
|
var import_node_fs5 = require("node:fs");
|
|
2658
|
-
var
|
|
2622
|
+
var import_node_path3 = __toESM(require("node:path"), 1);
|
|
2659
2623
|
function readIosSdkTree(root) {
|
|
2660
2624
|
return (0, import_node_fs5.readdirSync)(root, { recursive: true, withFileTypes: true }).filter((entry) => entry.isFile()).map((entry) => {
|
|
2661
|
-
const file =
|
|
2625
|
+
const file = import_node_path3.default.join(entry.parentPath, entry.name);
|
|
2662
2626
|
return [
|
|
2663
|
-
|
|
2627
|
+
import_node_path3.default.relative(root, file).split(import_node_path3.default.sep).join("/"),
|
|
2664
2628
|
(0, import_node_fs5.readFileSync)(file, "utf8")
|
|
2665
2629
|
];
|
|
2666
2630
|
}).sort(([a], [b]) => a < b ? -1 : 1);
|
|
@@ -2669,38 +2633,38 @@ function readIosSdkTree(root) {
|
|
|
2669
2633
|
// src/swift-darwin-records.ts
|
|
2670
2634
|
var import_node_child_process7 = require("node:child_process");
|
|
2671
2635
|
var import_node_fs8 = require("node:fs");
|
|
2672
|
-
var
|
|
2673
|
-
var
|
|
2636
|
+
var import_node_os4 = require("node:os");
|
|
2637
|
+
var import_node_path9 = __toESM(require("node:path"), 1);
|
|
2674
2638
|
|
|
2675
2639
|
// src/swift-objc-platform.ts
|
|
2676
2640
|
var import_node_child_process5 = require("node:child_process");
|
|
2677
|
-
var
|
|
2641
|
+
var import_node_path5 = __toESM(require("node:path"), 1);
|
|
2678
2642
|
|
|
2679
2643
|
// src/swift-toolchain.ts
|
|
2680
2644
|
var import_node_child_process4 = require("node:child_process");
|
|
2681
2645
|
var import_node_crypto2 = require("node:crypto");
|
|
2682
2646
|
var import_node_fs6 = __toESM(require("node:fs"), 1);
|
|
2683
|
-
var
|
|
2684
|
-
var
|
|
2647
|
+
var import_node_os3 = __toESM(require("node:os"), 1);
|
|
2648
|
+
var import_node_path4 = __toESM(require("node:path"), 1);
|
|
2685
2649
|
function peachsimPackageRoot() {
|
|
2686
2650
|
let dir = __sootsim_import_meta_dirname;
|
|
2687
|
-
while (!import_node_fs6.default.existsSync(
|
|
2688
|
-
dir =
|
|
2651
|
+
while (!import_node_fs6.default.existsSync(import_node_path4.default.join(dir, "package.json")) && dir !== import_node_path4.default.dirname(dir))
|
|
2652
|
+
dir = import_node_path4.default.dirname(dir);
|
|
2689
2653
|
return dir;
|
|
2690
2654
|
}
|
|
2691
2655
|
function sourceSwiftCheckout() {
|
|
2692
|
-
return
|
|
2656
|
+
return import_node_path4.default.resolve(peachsimPackageRoot(), "../sootsim-swift");
|
|
2693
2657
|
}
|
|
2694
2658
|
function swiftSdkOptions() {
|
|
2695
2659
|
const directory = process.env.PEACH_SWIFT_SDKS_PATH;
|
|
2696
|
-
if (directory) return ["--swift-sdks-path",
|
|
2660
|
+
if (directory) return ["--swift-sdks-path", import_node_path4.default.resolve(directory)];
|
|
2697
2661
|
if (scratch && process.platform === "linux") {
|
|
2698
2662
|
const config = process.env.XDG_CONFIG_HOME;
|
|
2699
|
-
if (config !== void 0 && !
|
|
2663
|
+
if (config !== void 0 && !import_node_path4.default.isAbsolute(config))
|
|
2700
2664
|
throw new Error("XDG_CONFIG_HOME must be an absolute path");
|
|
2701
2665
|
return [
|
|
2702
2666
|
"--swift-sdks-path",
|
|
2703
|
-
config === void 0 ?
|
|
2667
|
+
config === void 0 ? import_node_path4.default.join(import_node_os3.default.userInfo().homedir, ".swiftpm", "swift-sdks") : import_node_path4.default.join(config, "swiftpm", "swift-sdks")
|
|
2704
2668
|
];
|
|
2705
2669
|
}
|
|
2706
2670
|
return [];
|
|
@@ -2865,13 +2829,13 @@ var compilerArchives = {
|
|
|
2865
2829
|
var SWIFT_PRIVATE_DISTRIBUTION_ENV = "PEACH_SWIFT_PRIVATE_DISTRIBUTION";
|
|
2866
2830
|
function privateSwiftDistributionRoot() {
|
|
2867
2831
|
const root = process.env[SWIFT_PRIVATE_DISTRIBUTION_ENV]?.trim();
|
|
2868
|
-
return root ?
|
|
2832
|
+
return root ? import_node_path4.default.resolve(root) : null;
|
|
2869
2833
|
}
|
|
2870
2834
|
function privateSwiftRelease() {
|
|
2871
2835
|
const root = privateSwiftDistributionRoot();
|
|
2872
2836
|
if (!root) return null;
|
|
2873
2837
|
const manifest = JSON.parse(
|
|
2874
|
-
import_node_fs6.default.readFileSync(
|
|
2838
|
+
import_node_fs6.default.readFileSync(import_node_path4.default.join(root, "distribution.json"), "utf8")
|
|
2875
2839
|
);
|
|
2876
2840
|
const release = manifest && typeof manifest === "object" && Reflect.get(manifest, "release");
|
|
2877
2841
|
if (typeof release !== "string")
|
|
@@ -2900,23 +2864,23 @@ function swiftCompilerRelease(release) {
|
|
|
2900
2864
|
}
|
|
2901
2865
|
function swiftToolchainBin(release) {
|
|
2902
2866
|
if (process.platform === "darwin") {
|
|
2903
|
-
const dirs = [
|
|
2904
|
-
(base) =>
|
|
2867
|
+
const dirs = [import_node_os3.default.homedir(), "/"].map(
|
|
2868
|
+
(base) => import_node_path4.default.join(base, `Library/Developer/Toolchains/${release}.xctoolchain/usr/bin`)
|
|
2905
2869
|
);
|
|
2906
|
-
return dirs.find((dir) => import_node_fs6.default.existsSync(
|
|
2870
|
+
return dirs.find((dir) => import_node_fs6.default.existsSync(import_node_path4.default.join(dir, "swift"))) ?? dirs[0];
|
|
2907
2871
|
}
|
|
2908
2872
|
if (process.env.CONTRAST_SWIFT_TOOLCHAINS) {
|
|
2909
|
-
return
|
|
2873
|
+
return import_node_path4.default.join(process.env.CONTRAST_SWIFT_TOOLCHAINS, release, "usr/bin");
|
|
2910
2874
|
}
|
|
2911
|
-
const image =
|
|
2912
|
-
if (import_node_fs6.default.existsSync(
|
|
2875
|
+
const image = import_node_path4.default.join("/opt/swift", release, "usr/bin");
|
|
2876
|
+
if (import_node_fs6.default.existsSync(import_node_path4.default.join(image, "swift"))) return image;
|
|
2913
2877
|
if (release.includes("-custom-"))
|
|
2914
|
-
return
|
|
2915
|
-
return (process.env.PATH ?? "").split(
|
|
2878
|
+
return import_node_path4.default.join(peachHome(), "swift", "toolchains", release, "usr/bin");
|
|
2879
|
+
return (process.env.PATH ?? "").split(import_node_path4.default.delimiter).find((dir) => dir && import_node_fs6.default.existsSync(import_node_path4.default.join(dir, "swift"))) ?? image;
|
|
2916
2880
|
}
|
|
2917
2881
|
var SWIFT_AUTOLINK_LINKER = ".peach-wasm-ld";
|
|
2918
2882
|
function writeSwiftAutolinkLinker(directory, toolchainBin) {
|
|
2919
|
-
const linker =
|
|
2883
|
+
const linker = import_node_path4.default.join(directory, SWIFT_AUTOLINK_LINKER);
|
|
2920
2884
|
const script = `#!/bin/sh
|
|
2921
2885
|
set -eu
|
|
2922
2886
|
for arg in "$@"; do
|
|
@@ -2926,7 +2890,7 @@ for arg in "$@"; do
|
|
|
2926
2890
|
awk 'BEGIN { RS = " "; ORS = " " } /^"-l/ { if (seen[$0]++) next } { print }' "$rsp" > "$rsp.dedup"
|
|
2927
2891
|
mv "$rsp.dedup" "$rsp"
|
|
2928
2892
|
if [ "\${PEACH_DEFER_WASM_LINK:-}" = "1" ] && grep -q '"--start-lib"' "$rsp"; then
|
|
2929
|
-
cp "$rsp" ${JSON.stringify(
|
|
2893
|
+
cp "$rsp" ${JSON.stringify(import_node_path4.default.join(directory, ".peach-link.rsp"))}
|
|
2930
2894
|
out=$(awk 'BEGIN { RS = " " } prev == "\\"'-o'\\"" { gsub(/^"|"[[:space:]]*$/, ""); print; exit } { prev = $0 }' "$rsp")
|
|
2931
2895
|
if [ -n "$out" ]; then
|
|
2932
2896
|
printf '\\000asm\\001\\000\\000\\000' > "$out"
|
|
@@ -2936,7 +2900,7 @@ for arg in "$@"; do
|
|
|
2936
2900
|
;;
|
|
2937
2901
|
esac
|
|
2938
2902
|
done
|
|
2939
|
-
exec ${JSON.stringify(
|
|
2903
|
+
exec ${JSON.stringify(import_node_path4.default.join(toolchainBin, "wasm-ld"))} "$@"
|
|
2940
2904
|
`;
|
|
2941
2905
|
if (import_node_fs6.default.existsSync(linker) && import_node_fs6.default.readFileSync(linker, "utf8") === script) return linker;
|
|
2942
2906
|
import_node_fs6.default.mkdirSync(directory, { recursive: true });
|
|
@@ -2947,7 +2911,26 @@ exec ${JSON.stringify(import_node_path5.default.join(toolchainBin, "wasm-ld"))}
|
|
|
2947
2911
|
}
|
|
2948
2912
|
function peachHome() {
|
|
2949
2913
|
const override = process.env.PEACH_HOME;
|
|
2950
|
-
return override ?
|
|
2914
|
+
return override ? import_node_path4.default.resolve(override) : import_node_path4.default.join(import_node_os3.default.homedir(), ".peach");
|
|
2915
|
+
}
|
|
2916
|
+
var BUILDERS_ROOT_ENV = "CONTRAST_BUILDERS_ROOT";
|
|
2917
|
+
function buildersRootEnv() {
|
|
2918
|
+
const root = process.env[BUILDERS_ROOT_ENV]?.trim();
|
|
2919
|
+
return root ? root : null;
|
|
2920
|
+
}
|
|
2921
|
+
function swiftCacheDir() {
|
|
2922
|
+
const root = buildersRootEnv();
|
|
2923
|
+
return root ? import_node_path4.default.join(root, "peach-cache") : import_node_path4.default.join(peachHome(), "cache");
|
|
2924
|
+
}
|
|
2925
|
+
function swiftPackageCacheOptions() {
|
|
2926
|
+
const root = import_node_path4.default.join(swiftCacheDir(), "swiftpm");
|
|
2927
|
+
return [
|
|
2928
|
+
...["cache", "config", "security"].flatMap((name2) => [
|
|
2929
|
+
`--${name2}-path`,
|
|
2930
|
+
import_node_path4.default.join(root, name2)
|
|
2931
|
+
]),
|
|
2932
|
+
"--disable-keychain"
|
|
2933
|
+
];
|
|
2951
2934
|
}
|
|
2952
2935
|
var scratch;
|
|
2953
2936
|
var linuxLibraryPath;
|
|
@@ -2961,16 +2944,16 @@ function swiftEnvironment(base = process.env) {
|
|
|
2961
2944
|
} : {},
|
|
2962
2945
|
...scratch ? {
|
|
2963
2946
|
TMPDIR: scratch.directory,
|
|
2964
|
-
XDG_CONFIG_HOME:
|
|
2965
|
-
XDG_CACHE_HOME:
|
|
2966
|
-
XDG_DATA_HOME:
|
|
2947
|
+
XDG_CONFIG_HOME: import_node_path4.default.join(scratch.home, ".config"),
|
|
2948
|
+
XDG_CACHE_HOME: import_node_path4.default.join(scratch.home, ".cache"),
|
|
2949
|
+
XDG_DATA_HOME: import_node_path4.default.join(scratch.home, ".local", "share"),
|
|
2967
2950
|
...process.platform === "linux" ? { HOME: scratch.home } : {}
|
|
2968
2951
|
} : {}
|
|
2969
2952
|
};
|
|
2970
2953
|
}
|
|
2971
2954
|
function swiftSourceSdk(root) {
|
|
2972
2955
|
const pin = JSON.parse(
|
|
2973
|
-
import_node_fs6.default.readFileSync(
|
|
2956
|
+
import_node_fs6.default.readFileSync(import_node_path4.default.join(root, "toolchain.json"), "utf8")
|
|
2974
2957
|
);
|
|
2975
2958
|
if (!pin || typeof pin !== "object" || typeof Reflect.get(pin, "wasmSdkId") !== "string" || typeof Reflect.get(pin, "wasmSdkUrl") !== "string" || typeof Reflect.get(pin, "wasmSdkChecksum") !== "string")
|
|
2976
2959
|
throw new Error(`${root} pins no wasm SDK id, url and checksum`);
|
|
@@ -2992,7 +2975,7 @@ function swiftToolchain(release, sdk) {
|
|
|
2992
2975
|
${swiftInstallSteps(release, sdk)}`
|
|
2993
2976
|
);
|
|
2994
2977
|
}
|
|
2995
|
-
const swift =
|
|
2978
|
+
const swift = import_node_path4.default.join(bin, "swift");
|
|
2996
2979
|
const sdks = (0, import_node_child_process4.execFileSync)(swift, ["sdk", "list", ...swiftSdkOptions()], {
|
|
2997
2980
|
encoding: "utf8",
|
|
2998
2981
|
env: swiftEnvironment(),
|
|
@@ -3024,11 +3007,11 @@ function swiftSdkBundle(swift, id, options) {
|
|
|
3024
3007
|
{ encoding: "utf8", env: swiftEnvironment(), stdio: ["ignore", "pipe", "pipe"] }
|
|
3025
3008
|
);
|
|
3026
3009
|
const sysroot = /^sdkRootPath: (.+)$/m.exec(configuration)?.[1]?.trim();
|
|
3027
|
-
if (!sysroot || !
|
|
3010
|
+
if (!sysroot || !import_node_path4.default.isAbsolute(sysroot))
|
|
3028
3011
|
throw new Error(`Swift SDK ${id} reports no absolute sdkRootPath`);
|
|
3029
3012
|
let bundle = sysroot;
|
|
3030
3013
|
while (!bundle.endsWith(".artifactbundle")) {
|
|
3031
|
-
const parent =
|
|
3014
|
+
const parent = import_node_path4.default.dirname(bundle);
|
|
3032
3015
|
if (parent === bundle)
|
|
3033
3016
|
throw new Error(`Swift SDK ${id} is outside an artifact bundle`);
|
|
3034
3017
|
bundle = parent;
|
|
@@ -3039,16 +3022,16 @@ var sdkFileHashes = /* @__PURE__ */ new Map();
|
|
|
3039
3022
|
function swiftSdkPayloadChecksum(bundle) {
|
|
3040
3023
|
const hash = (0, import_node_crypto2.createHash)("sha256");
|
|
3041
3024
|
function visit(relative) {
|
|
3042
|
-
const file =
|
|
3025
|
+
const file = import_node_path4.default.join(bundle, relative);
|
|
3043
3026
|
const stat = import_node_fs6.default.lstatSync(file, { bigint: true });
|
|
3044
3027
|
if (stat.isSymbolicLink()) {
|
|
3045
|
-
const resolved =
|
|
3046
|
-
if (resolved === ".." || resolved.startsWith(`..${
|
|
3028
|
+
const resolved = import_node_path4.default.relative(bundle, import_node_fs6.default.realpathSync(file));
|
|
3029
|
+
if (resolved === ".." || resolved.startsWith(`..${import_node_path4.default.sep}`) || import_node_path4.default.isAbsolute(resolved))
|
|
3047
3030
|
throw new Error(`Swift SDK symlink escapes its bundle: ${relative}`);
|
|
3048
3031
|
hash.update(JSON.stringify([relative, "link", import_node_fs6.default.readlinkSync(file)]) + "\n");
|
|
3049
3032
|
} else if (stat.isDirectory()) {
|
|
3050
3033
|
hash.update(JSON.stringify([relative, "directory"]) + "\n");
|
|
3051
|
-
for (const name2 of import_node_fs6.default.readdirSync(file).sort()) visit(
|
|
3034
|
+
for (const name2 of import_node_fs6.default.readdirSync(file).sort()) visit(import_node_path4.default.join(relative, name2));
|
|
3052
3035
|
} else if (stat.isFile()) {
|
|
3053
3036
|
const stamp = [stat.dev, stat.ino, stat.size, stat.mtimeNs, stat.ctimeNs].join(":");
|
|
3054
3037
|
let cached = sdkFileHashes.get(file);
|
|
@@ -3065,8 +3048,8 @@ function swiftSdkPayloadChecksum(bundle) {
|
|
|
3065
3048
|
return hash.digest("hex");
|
|
3066
3049
|
}
|
|
3067
3050
|
function swiftSdkVerificationFile(bundle, sdk) {
|
|
3068
|
-
return
|
|
3069
|
-
|
|
3051
|
+
return import_node_path4.default.join(
|
|
3052
|
+
import_node_path4.default.dirname(bundle),
|
|
3070
3053
|
".peach-sdk-checksums",
|
|
3071
3054
|
`${sdk.wasmSdkId}-${sdk.wasmSdkChecksum}.json`
|
|
3072
3055
|
);
|
|
@@ -3100,7 +3083,7 @@ function swiftFileChecksum(file) {
|
|
|
3100
3083
|
return hash.digest("hex");
|
|
3101
3084
|
}
|
|
3102
3085
|
function swiftHostCompilerFiles(release, root) {
|
|
3103
|
-
const file =
|
|
3086
|
+
const file = import_node_path4.default.join(root, "compiler.json");
|
|
3104
3087
|
const pin = release === privateSwiftRelease() ? {
|
|
3105
3088
|
identity: release.replace(/^.*-custom-/, ""),
|
|
3106
3089
|
manifest: swiftFileChecksum(file)
|
|
@@ -3121,7 +3104,7 @@ function swiftHostCompilerFiles(release, root) {
|
|
|
3121
3104
|
}
|
|
3122
3105
|
function verifySwiftHostCompiler(release, root) {
|
|
3123
3106
|
for (const [relative, checksum] of swiftHostCompilerFiles(release, root)) {
|
|
3124
|
-
if (swiftFileChecksum(
|
|
3107
|
+
if (swiftFileChecksum(import_node_path4.default.join(root, relative)) !== checksum)
|
|
3125
3108
|
throw new Error(`Swift compiler binary mismatch: ${relative}`);
|
|
3126
3109
|
}
|
|
3127
3110
|
}
|
|
@@ -3131,8 +3114,8 @@ function swiftCompiler(release) {
|
|
|
3131
3114
|
if (cached) return cached;
|
|
3132
3115
|
const bin = swiftToolchainBin(release);
|
|
3133
3116
|
if (release.includes("-custom-"))
|
|
3134
|
-
verifySwiftHostCompiler(release,
|
|
3135
|
-
const version = (0, import_node_child_process4.execFileSync)(
|
|
3117
|
+
verifySwiftHostCompiler(release, import_node_path4.default.resolve(bin, "../.."));
|
|
3118
|
+
const version = (0, import_node_child_process4.execFileSync)(import_node_path4.default.join(bin, "swift"), ["--version"], {
|
|
3136
3119
|
encoding: "utf8",
|
|
3137
3120
|
env: swiftEnvironment(),
|
|
3138
3121
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -3150,7 +3133,7 @@ function swiftSdkInstallCommand(release, wasmSdk) {
|
|
|
3150
3133
|
const { wasmSdkId, wasmSdkUrl, wasmSdkChecksum } = wasmSdk;
|
|
3151
3134
|
const program = `import { installSwiftWasmSdk } from "peachsim/swift-toolchain"; installSwiftWasmSdk(${JSON.stringify(release)}, ${JSON.stringify({ wasmSdkId, wasmSdkUrl, wasmSdkChecksum })})`;
|
|
3152
3135
|
const directory = process.env.PEACH_SWIFT_SDKS_PATH;
|
|
3153
|
-
const environment = directory ? `PEACH_SWIFT_SDKS_PATH='${
|
|
3136
|
+
const environment = directory ? `PEACH_SWIFT_SDKS_PATH='${import_node_path4.default.resolve(directory).replaceAll("'", "'\\''")}' ` : "";
|
|
3154
3137
|
return `${environment}node --input-type=module -e '${program.replaceAll("'", "'\\''")}'`;
|
|
3155
3138
|
}
|
|
3156
3139
|
function swiftInstallSteps(release, wasmSdk) {
|
|
@@ -3165,7 +3148,7 @@ function swiftCompilerInstall(release) {
|
|
|
3165
3148
|
return { note: " (private: its builder installs it)", commands: [] };
|
|
3166
3149
|
if (release.includes("-custom-")) {
|
|
3167
3150
|
const archive = swiftHostCompilerArchive(release);
|
|
3168
|
-
const directory =
|
|
3151
|
+
const directory = import_node_path4.default.resolve(swiftToolchainBin(release), "../..");
|
|
3169
3152
|
return {
|
|
3170
3153
|
note: "",
|
|
3171
3154
|
commands: [
|
|
@@ -3210,7 +3193,7 @@ function swiftObjCPlatformFlags(toolchainBin, minimum) {
|
|
|
3210
3193
|
minimum % 100
|
|
3211
3194
|
].join(".");
|
|
3212
3195
|
const result = (0, import_node_child_process5.spawnSync)(
|
|
3213
|
-
|
|
3196
|
+
import_node_path5.default.join(toolchainBin, "clang"),
|
|
3214
3197
|
[
|
|
3215
3198
|
"-target",
|
|
3216
3199
|
`arm64-apple-ios${version}-simulator`,
|
|
@@ -3253,13 +3236,18 @@ var swiftObjCRuntimeFlags = [
|
|
|
3253
3236
|
|
|
3254
3237
|
// src/swift-objc-standin.ts
|
|
3255
3238
|
var import_node_crypto3 = require("node:crypto");
|
|
3256
|
-
var
|
|
3239
|
+
var import_node_path7 = __toESM(require("node:path"), 1);
|
|
3240
|
+
|
|
3241
|
+
// src/is-record.ts
|
|
3242
|
+
function isRecord(value) {
|
|
3243
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3244
|
+
}
|
|
3257
3245
|
|
|
3258
3246
|
// src/swift-objc-sdk.ts
|
|
3259
|
-
var
|
|
3247
|
+
var import_node_path6 = __toESM(require("node:path"), 1);
|
|
3260
3248
|
var IOS_SDK_TARGET = "arm64-apple-ios16.0-simulator";
|
|
3261
3249
|
var OVERLAY_PATH = /^usr\/lib\/swift\/([^/]+)\.swiftmodule\/arm64-apple-ios-simulator\.swiftinterface$/;
|
|
3262
|
-
var tree = typeof __PEACH_BUNDLED_IOS_SDK__ === "undefined" ? readIosSdkTree(
|
|
3250
|
+
var tree = typeof __PEACH_BUNDLED_IOS_SDK__ === "undefined" ? readIosSdkTree(import_node_path6.default.join(peachsimPackageRoot(), "sdk", "ios")) : Object.entries(__PEACH_BUNDLED_IOS_SDK__).sort(([a], [b]) => a < b ? -1 : 1);
|
|
3263
3251
|
var IOS_SDK_HEADERS = {};
|
|
3264
3252
|
var IOS_SDK_OVERLAYS = {};
|
|
3265
3253
|
for (const [file, text2] of tree) {
|
|
@@ -3409,10 +3397,14 @@ var SWIFT_NATIVE_SOURCE_EXTENSIONS = [
|
|
|
3409
3397
|
".def",
|
|
3410
3398
|
".modulemap"
|
|
3411
3399
|
];
|
|
3412
|
-
function clangImportNames(text2) {
|
|
3400
|
+
function clangImportNames(text2, isLocalHeader) {
|
|
3413
3401
|
return [
|
|
3414
|
-
...text2.matchAll(
|
|
3415
|
-
|
|
3402
|
+
...text2.matchAll(
|
|
3403
|
+
/^\s*(?:#\s*(?:import|include)\s*<((\w+)\/[^>]+)>|@import\s+(\w+))/gm
|
|
3404
|
+
)
|
|
3405
|
+
].flatMap(
|
|
3406
|
+
(match) => match[1] && isLocalHeader?.(match[1]) ? [] : [match[2] ?? match[3]]
|
|
3407
|
+
);
|
|
3416
3408
|
}
|
|
3417
3409
|
function moduleMapTokens(text2) {
|
|
3418
3410
|
return (text2.match(/\/\*[\s\S]*?\*\/|\/\/[^\n]*|"[^"]*"|[\w.*]+|[{}\[\]]/g) ?? []).filter((token) => !token.startsWith("/"));
|
|
@@ -3824,15 +3816,15 @@ function objcSdkIntakeFlags(headers, toolchainBin, minimum) {
|
|
|
3824
3816
|
"-fblocks",
|
|
3825
3817
|
...WASI_EMULATION_FLAGS,
|
|
3826
3818
|
"-iframework",
|
|
3827
|
-
|
|
3819
|
+
import_node_path7.default.join(headers, "System/Library/Frameworks"),
|
|
3828
3820
|
"-isystem",
|
|
3829
|
-
|
|
3821
|
+
import_node_path7.default.join(headers, "wasm/include"),
|
|
3830
3822
|
// libxml2 headers sit one level deeper, as in the iOS sdk: a unit
|
|
3831
3823
|
// includes <libxml/parser.h> through usr/include/libxml2, never the parent.
|
|
3832
3824
|
"-I",
|
|
3833
|
-
|
|
3825
|
+
import_node_path7.default.join(headers, "usr/include/libxml2"),
|
|
3834
3826
|
"-idirafter",
|
|
3835
|
-
|
|
3827
|
+
import_node_path7.default.join(headers, "usr/include")
|
|
3836
3828
|
];
|
|
3837
3829
|
}
|
|
3838
3830
|
function iosDeploymentMinimum(version) {
|
|
@@ -3845,26 +3837,26 @@ function iosDeploymentMinimum(version) {
|
|
|
3845
3837
|
var import_node_child_process6 = require("node:child_process");
|
|
3846
3838
|
var import_node_crypto4 = require("node:crypto");
|
|
3847
3839
|
var import_node_fs7 = __toESM(require("node:fs"), 1);
|
|
3848
|
-
var
|
|
3840
|
+
var import_node_path8 = __toESM(require("node:path"), 1);
|
|
3849
3841
|
var distributionHeaderRoots = /* @__PURE__ */ new Map();
|
|
3850
3842
|
function swiftSharedSdkRoot(moduleRoot, distribution) {
|
|
3851
|
-
const root =
|
|
3843
|
+
const root = import_node_path8.default.resolve(moduleRoot, distribution ? "sdk/ios" : "../peachsim/sdk/ios");
|
|
3852
3844
|
if (!distribution) return root;
|
|
3853
3845
|
let headers = distributionHeaderRoots.get(root);
|
|
3854
3846
|
if (!headers || !import_node_fs7.default.existsSync(headers)) {
|
|
3855
|
-
const files = (0, import_node_fs7.readdirSync)(root, { recursive: true, withFileTypes: true }).filter((entry) => entry.isFile()).map((entry) =>
|
|
3847
|
+
const files = (0, import_node_fs7.readdirSync)(root, { recursive: true, withFileTypes: true }).filter((entry) => entry.isFile()).map((entry) => import_node_path8.default.relative(root, import_node_path8.default.join(entry.parentPath, entry.name))).sort();
|
|
3856
3848
|
const hash = (0, import_node_crypto4.createHash)("sha256");
|
|
3857
3849
|
for (const file of files) {
|
|
3858
|
-
const bytes = (0, import_node_fs7.readFileSync)(
|
|
3850
|
+
const bytes = (0, import_node_fs7.readFileSync)(import_node_path8.default.join(root, file));
|
|
3859
3851
|
hash.update(JSON.stringify([file, bytes.length])).update(bytes);
|
|
3860
3852
|
}
|
|
3861
|
-
headers =
|
|
3853
|
+
headers = import_node_path8.default.join(
|
|
3862
3854
|
swiftCacheDir(),
|
|
3863
3855
|
"swift-sdk-views",
|
|
3864
3856
|
`headers-${hash.digest("hex")}`
|
|
3865
3857
|
);
|
|
3866
3858
|
if (!import_node_fs7.default.existsSync(headers)) {
|
|
3867
|
-
import_node_fs7.default.mkdirSync(
|
|
3859
|
+
import_node_fs7.default.mkdirSync(import_node_path8.default.dirname(headers), { recursive: true });
|
|
3868
3860
|
const staging = import_node_fs7.default.mkdtempSync(`${headers}-`);
|
|
3869
3861
|
import_node_fs7.default.cpSync(root, staging, { recursive: true, preserveTimestamps: true });
|
|
3870
3862
|
try {
|
|
@@ -3884,9 +3876,9 @@ function swiftSharedSdkFlags(moduleRoot, distribution) {
|
|
|
3884
3876
|
const root = swiftSharedSdkRoot(moduleRoot, distribution);
|
|
3885
3877
|
return [
|
|
3886
3878
|
"-isystem",
|
|
3887
|
-
|
|
3879
|
+
import_node_path8.default.join(root, "wasm/storage-include"),
|
|
3888
3880
|
"-idirafter",
|
|
3889
|
-
|
|
3881
|
+
import_node_path8.default.join(root, "usr/include")
|
|
3890
3882
|
];
|
|
3891
3883
|
}
|
|
3892
3884
|
function readULEB(b, o) {
|
|
@@ -4011,8 +4003,8 @@ function weakenBundleInArchive(arBuf) {
|
|
|
4011
4003
|
function mirrorTree(real, mirror, overrides) {
|
|
4012
4004
|
import_node_fs7.default.mkdirSync(mirror);
|
|
4013
4005
|
for (const entry of import_node_fs7.default.readdirSync(real, { withFileTypes: true })) {
|
|
4014
|
-
const from =
|
|
4015
|
-
const to =
|
|
4006
|
+
const from = import_node_path8.default.join(real, entry.name);
|
|
4007
|
+
const to = import_node_path8.default.join(mirror, entry.name);
|
|
4016
4008
|
const override = overrides.get(from);
|
|
4017
4009
|
if (override) import_node_fs7.default.symlinkSync(override, to);
|
|
4018
4010
|
else if (import_node_fs7.default.statSync(from).isDirectory()) mirrorTree(from, to, overrides);
|
|
@@ -4020,20 +4012,20 @@ function mirrorTree(real, mirror, overrides) {
|
|
|
4020
4012
|
}
|
|
4021
4013
|
}
|
|
4022
4014
|
function stageOverlaySlot(realRoot, stagingRoot, relPath) {
|
|
4023
|
-
const segments = relPath.split(
|
|
4015
|
+
const segments = relPath.split(import_node_path8.default.sep);
|
|
4024
4016
|
let real = realRoot;
|
|
4025
4017
|
let mirror = stagingRoot;
|
|
4026
4018
|
for (let i = 0; i < segments.length; i++) {
|
|
4027
4019
|
const segment = segments[i];
|
|
4028
4020
|
for (const entry of (0, import_node_fs7.readdirSync)(real)) {
|
|
4029
4021
|
if (entry === segment) continue;
|
|
4030
|
-
const dest =
|
|
4022
|
+
const dest = import_node_path8.default.join(mirror, entry);
|
|
4031
4023
|
if (!import_node_fs7.default.lstatSync(dest, { throwIfNoEntry: false })) {
|
|
4032
|
-
import_node_fs7.default.symlinkSync(
|
|
4024
|
+
import_node_fs7.default.symlinkSync(import_node_path8.default.join(real, entry), dest);
|
|
4033
4025
|
}
|
|
4034
4026
|
}
|
|
4035
|
-
real =
|
|
4036
|
-
mirror =
|
|
4027
|
+
real = import_node_path8.default.join(real, segment);
|
|
4028
|
+
mirror = import_node_path8.default.join(mirror, segment);
|
|
4037
4029
|
if (i < segments.length - 1) {
|
|
4038
4030
|
if (import_node_fs7.default.lstatSync(mirror, { throwIfNoEntry: false })?.isSymbolicLink()) {
|
|
4039
4031
|
import_node_fs7.default.unlinkSync(mirror);
|
|
@@ -4048,14 +4040,14 @@ function stageOverlaySlot(realRoot, stagingRoot, relPath) {
|
|
|
4048
4040
|
}
|
|
4049
4041
|
var sdkViews = /* @__PURE__ */ new Map();
|
|
4050
4042
|
function swiftSharedSdkViewOptions(moduleRoot, distribution, toolchainBin, sdk) {
|
|
4051
|
-
const frameworks =
|
|
4043
|
+
const frameworks = import_node_path8.default.join(
|
|
4052
4044
|
swiftSharedSdkRoot(moduleRoot, distribution),
|
|
4053
4045
|
"System/Library/Frameworks"
|
|
4054
4046
|
);
|
|
4055
|
-
const overlay =
|
|
4056
|
-
const overlayFiles = (0, import_node_fs7.readdirSync)(overlay, { recursive: true, withFileTypes: true }).filter((entry) => entry.isFile()).map((entry) =>
|
|
4047
|
+
const overlay = import_node_path8.default.join(swiftSharedSdkRoot(moduleRoot, distribution), "wasm/include");
|
|
4048
|
+
const overlayFiles = (0, import_node_fs7.readdirSync)(overlay, { recursive: true, withFileTypes: true }).filter((entry) => entry.isFile()).map((entry) => import_node_path8.default.join(entry.parentPath, entry.name)).sort();
|
|
4057
4049
|
const key = JSON.stringify([
|
|
4058
|
-
"
|
|
4050
|
+
"v11",
|
|
4059
4051
|
toolchainBin,
|
|
4060
4052
|
sdk,
|
|
4061
4053
|
frameworks,
|
|
@@ -4065,7 +4057,7 @@ function swiftSharedSdkViewOptions(moduleRoot, distribution, toolchainBin, sdk)
|
|
|
4065
4057
|
const cached = sdkViews.get(key);
|
|
4066
4058
|
if (cached && import_node_fs7.default.existsSync(cached.manifest)) return touchSdkView(cached.options);
|
|
4067
4059
|
const configuration = (0, import_node_child_process6.execFileSync)(
|
|
4068
|
-
|
|
4060
|
+
import_node_path8.default.join(toolchainBin, "swift"),
|
|
4069
4061
|
[
|
|
4070
4062
|
"sdk",
|
|
4071
4063
|
"configure",
|
|
@@ -4077,57 +4069,57 @@ function swiftSharedSdkViewOptions(moduleRoot, distribution, toolchainBin, sdk)
|
|
|
4077
4069
|
{ encoding: "utf8", env: swiftEnvironment(), stdio: ["ignore", "pipe", "pipe"] }
|
|
4078
4070
|
);
|
|
4079
4071
|
const sysroot = /^sdkRootPath: (.+)$/m.exec(configuration)?.[1]?.trim();
|
|
4080
|
-
if (!sysroot || !
|
|
4072
|
+
if (!sysroot || !import_node_path8.default.isAbsolute(sysroot))
|
|
4081
4073
|
throw new Error(`swift sdk ${sdk} reports no absolute sdkRootPath`);
|
|
4082
4074
|
let bundle = sysroot;
|
|
4083
4075
|
while (!bundle.endsWith(".artifactbundle")) {
|
|
4084
|
-
if (
|
|
4076
|
+
if (import_node_path8.default.dirname(bundle) === bundle)
|
|
4085
4077
|
throw new Error(`swift sdk ${sdk} is outside an artifact bundle`);
|
|
4086
|
-
bundle =
|
|
4078
|
+
bundle = import_node_path8.default.dirname(bundle);
|
|
4087
4079
|
}
|
|
4088
|
-
const view =
|
|
4080
|
+
const view = import_node_path8.default.join(
|
|
4089
4081
|
swiftCacheDir(),
|
|
4090
4082
|
"swift-sdk-views",
|
|
4091
4083
|
(0, import_node_crypto4.createHash)("sha256").update(key).digest("hex").slice(0, 16)
|
|
4092
4084
|
);
|
|
4093
|
-
const manifest =
|
|
4085
|
+
const manifest = import_node_path8.default.join(view, import_node_path8.default.basename(bundle), "info.json");
|
|
4094
4086
|
if (!import_node_fs7.default.existsSync(manifest)) {
|
|
4095
|
-
import_node_fs7.default.mkdirSync(
|
|
4087
|
+
import_node_fs7.default.mkdirSync(import_node_path8.default.dirname(view), { recursive: true });
|
|
4096
4088
|
const staging = import_node_fs7.default.mkdtempSync(`${view}-`);
|
|
4097
|
-
const realRoot =
|
|
4098
|
-
const overrides =
|
|
4099
|
-
[
|
|
4100
|
-
[
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
]
|
|
4089
|
+
const realRoot = import_node_path8.default.dirname(bundle);
|
|
4090
|
+
const overrides = new Map([
|
|
4091
|
+
[import_node_path8.default.join(sysroot, "darwin/System/Library/Frameworks"), frameworks],
|
|
4092
|
+
...["MacTypes.h", "net/if.h"].map((header) => [
|
|
4093
|
+
import_node_path8.default.join(sysroot, "darwin/usr/include", header),
|
|
4094
|
+
import_node_path8.default.join(swiftSharedSdkRoot(moduleRoot, distribution), "usr/include", header)
|
|
4095
|
+
])
|
|
4104
4096
|
]);
|
|
4105
4097
|
for (const file of overlayFiles) {
|
|
4106
4098
|
overrides.set(
|
|
4107
|
-
|
|
4099
|
+
import_node_path8.default.join(sysroot, "darwin/wasm/include", import_node_path8.default.relative(overlay, file)),
|
|
4108
4100
|
file
|
|
4109
4101
|
);
|
|
4110
4102
|
}
|
|
4111
4103
|
mirrorTree(
|
|
4112
4104
|
sysroot,
|
|
4113
|
-
stageOverlaySlot(realRoot, staging,
|
|
4105
|
+
stageOverlaySlot(realRoot, staging, import_node_path8.default.relative(realRoot, sysroot)),
|
|
4114
4106
|
overrides
|
|
4115
4107
|
);
|
|
4116
4108
|
for (const [file, shared] of overrides) {
|
|
4117
|
-
const destination =
|
|
4109
|
+
const destination = import_node_path8.default.join(staging, import_node_path8.default.relative(realRoot, file));
|
|
4118
4110
|
if (import_node_fs7.default.lstatSync(destination, { throwIfNoEntry: false })) continue;
|
|
4119
|
-
import_node_fs7.default.mkdirSync(
|
|
4111
|
+
import_node_fs7.default.mkdirSync(import_node_path8.default.dirname(destination), { recursive: true });
|
|
4120
4112
|
import_node_fs7.default.symlinkSync(shared, destination);
|
|
4121
4113
|
}
|
|
4122
|
-
const foundationArchive =
|
|
4123
|
-
|
|
4114
|
+
const foundationArchive = import_node_path8.default.join(
|
|
4115
|
+
import_node_path8.default.dirname(sysroot),
|
|
4124
4116
|
"swift.xctoolchain/usr/lib/swift_static/wasi/libFoundation.a"
|
|
4125
4117
|
);
|
|
4126
4118
|
if (import_node_fs7.default.existsSync(foundationArchive)) {
|
|
4127
4119
|
const foundationSlot = stageOverlaySlot(
|
|
4128
4120
|
realRoot,
|
|
4129
4121
|
staging,
|
|
4130
|
-
|
|
4122
|
+
import_node_path8.default.relative(realRoot, foundationArchive)
|
|
4131
4123
|
);
|
|
4132
4124
|
const arBuf = new Uint8Array(import_node_fs7.default.readFileSync(foundationArchive));
|
|
4133
4125
|
weakenBundleInArchive(arBuf);
|
|
@@ -4151,23 +4143,23 @@ function touchSdkView(options) {
|
|
|
4151
4143
|
}
|
|
4152
4144
|
function swiftSharedSdkInputFiles(moduleRoot) {
|
|
4153
4145
|
const root = swiftSharedSdkRoot(moduleRoot, false);
|
|
4154
|
-
return (0, import_node_fs7.readdirSync)(root, { recursive: true, withFileTypes: true }).filter((entry) => entry.isFile()).map((entry) =>
|
|
4146
|
+
return (0, import_node_fs7.readdirSync)(root, { recursive: true, withFileTypes: true }).filter((entry) => entry.isFile()).map((entry) => import_node_path8.default.relative(moduleRoot, import_node_path8.default.join(entry.parentPath, entry.name))).sort();
|
|
4155
4147
|
}
|
|
4156
4148
|
|
|
4157
4149
|
// src/swift-darwin-records.ts
|
|
4158
4150
|
var DARWIN_RECORDS_PREFIX = "DarwinRecords-";
|
|
4159
4151
|
var darwinRecordsMinimum = () => iosDeploymentMinimum(NATIVE_GRAPH_SDK_VERSION) ?? 0;
|
|
4160
4152
|
function compileDarwinRecords(args) {
|
|
4161
|
-
const records =
|
|
4162
|
-
const runtime = (0, import_node_fs8.mkdtempSync)(
|
|
4163
|
-
(0, import_node_fs8.symlinkSync)(
|
|
4153
|
+
const records = import_node_path9.default.join(args.packageRoot, "Sources/DarwinRecords");
|
|
4154
|
+
const runtime = (0, import_node_fs8.mkdtempSync)(import_node_path9.default.join((0, import_node_os4.tmpdir)(), "peach-objc-runtime-"));
|
|
4155
|
+
(0, import_node_fs8.symlinkSync)(import_node_path9.default.join(args.darwin, "usr/include/objc"), import_node_path9.default.join(runtime, "objc"));
|
|
4164
4156
|
const objects = (0, import_node_fs8.readdirSync)(records).filter((file) => file.endsWith(".c") || file.endsWith(".m")).sort((a, b) => a < b ? -1 : a > b ? 1 : 0).map((file) => {
|
|
4165
|
-
const object =
|
|
4157
|
+
const object = import_node_path9.default.join(
|
|
4166
4158
|
args.out,
|
|
4167
4159
|
`${DARWIN_RECORDS_PREFIX}${file.replace(/\.[cm]$/, ".o")}`
|
|
4168
4160
|
);
|
|
4169
4161
|
(0, import_node_child_process7.execFileSync)(
|
|
4170
|
-
|
|
4162
|
+
import_node_path9.default.join(args.bin, "clang"),
|
|
4171
4163
|
[
|
|
4172
4164
|
"--target=wasm32-unknown-wasip1",
|
|
4173
4165
|
`--sysroot=${args.sysroot}`,
|
|
@@ -4177,7 +4169,7 @@ function compileDarwinRecords(args) {
|
|
|
4177
4169
|
// __BLOCKS__, as ios builds libmalloc
|
|
4178
4170
|
...file.endsWith(".m") ? [...swiftObjCRuntimeFlags, "-fwasm-exceptions"] : ["-fblocks"],
|
|
4179
4171
|
// assert() keeps __FILE__, which would carry the builder's checkout
|
|
4180
|
-
`-ffile-prefix-map=${records}${
|
|
4172
|
+
`-ffile-prefix-map=${records}${import_node_path9.default.sep}=DarwinRecords/`,
|
|
4181
4173
|
// apple's headers select on the ios identity original units compile
|
|
4182
4174
|
// with, and TargetConditionals.h refuses a compiler without it
|
|
4183
4175
|
...file.endsWith(".m") ? objcSdkIntakeFlags(args.darwin, args.bin, args.minimum) : [
|
|
@@ -4190,7 +4182,7 @@ function compileDarwinRecords(args) {
|
|
|
4190
4182
|
...swiftSharedSdkFlags(args.packageRoot, false)
|
|
4191
4183
|
],
|
|
4192
4184
|
"-c",
|
|
4193
|
-
|
|
4185
|
+
import_node_path9.default.join(records, file),
|
|
4194
4186
|
"-o",
|
|
4195
4187
|
object
|
|
4196
4188
|
],
|
|
@@ -4426,7 +4418,18 @@ function designTimeSites(source) {
|
|
|
4426
4418
|
while (t < to && tokens[t].kind !== "newline") t++;
|
|
4427
4419
|
continue;
|
|
4428
4420
|
}
|
|
4429
|
-
|
|
4421
|
+
const availability = word === "#available" || word === "#unavailable";
|
|
4422
|
+
t++;
|
|
4423
|
+
if (!availability && text(source, tokens[t]) === "<" && tokens[t].start === token.end) {
|
|
4424
|
+
let depth = 0;
|
|
4425
|
+
do {
|
|
4426
|
+
const p = text(source, tokens[t++]);
|
|
4427
|
+
if (p === "<") depth++;
|
|
4428
|
+
else if (p === ">") depth--;
|
|
4429
|
+
} while (t < to && depth > 0);
|
|
4430
|
+
}
|
|
4431
|
+
if (text(source, tokens[t]) === "(") t = skipGroup(t);
|
|
4432
|
+
if (!availability && text(source, tokens[t]) === "{") t = skipGroup(t);
|
|
4430
4433
|
continue;
|
|
4431
4434
|
}
|
|
4432
4435
|
if (token.kind === "at") {
|
|
@@ -4593,11 +4596,6 @@ function designTimeDiagnostic(output, files) {
|
|
|
4593
4596
|
}).join("\n");
|
|
4594
4597
|
}
|
|
4595
4598
|
|
|
4596
|
-
// src/is-record.ts
|
|
4597
|
-
function isRecord(value) {
|
|
4598
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4599
|
-
}
|
|
4600
|
-
|
|
4601
4599
|
// src/swift-distribution-contract.ts
|
|
4602
4600
|
var SWIFT_DISTRIBUTION_MANIFEST = "distribution.json";
|
|
4603
4601
|
var SWIFT_DISTRIBUTION_HOSTS = [
|
|
@@ -4644,8 +4642,8 @@ var import_node_child_process8 = require("node:child_process");
|
|
|
4644
4642
|
var import_node_crypto5 = require("node:crypto");
|
|
4645
4643
|
var import_node_fs9 = require("node:fs");
|
|
4646
4644
|
var import_promises3 = require("node:fs/promises");
|
|
4647
|
-
var
|
|
4648
|
-
var
|
|
4645
|
+
var import_node_os5 = __toESM(require("node:os"), 1);
|
|
4646
|
+
var import_node_path10 = __toESM(require("node:path"), 1);
|
|
4649
4647
|
var import_node_util = require("node:util");
|
|
4650
4648
|
var import_node_zlib = require("node:zlib");
|
|
4651
4649
|
var run = (0, import_node_util.promisify)(import_node_child_process8.execFile);
|
|
@@ -4662,8 +4660,8 @@ function cachedBrotli(bytes, quality, cacheKey) {
|
|
|
4662
4660
|
const cacheId = `${quality}:${key}`;
|
|
4663
4661
|
const cached = brotliMemoryCache.get(cacheId);
|
|
4664
4662
|
if (cached) return cached;
|
|
4665
|
-
const dir =
|
|
4666
|
-
const file =
|
|
4663
|
+
const dir = import_node_path10.default.join(import_node_os5.default.homedir(), ".peach", "cache", "swift-brotli");
|
|
4664
|
+
const file = import_node_path10.default.join(dir, `${key}${quality === 11 ? "" : "-q4"}.br`);
|
|
4667
4665
|
const pending = (async () => {
|
|
4668
4666
|
try {
|
|
4669
4667
|
return await (0, import_promises3.readFile)(file);
|
|
@@ -4727,7 +4725,7 @@ function swiftIcuAsset(toolchainBin, sdk) {
|
|
|
4727
4725
|
);
|
|
4728
4726
|
}
|
|
4729
4727
|
async function load(toolchainBin, sdk) {
|
|
4730
|
-
const swift =
|
|
4728
|
+
const swift = import_node_path10.default.join(toolchainBin, "swift");
|
|
4731
4729
|
if (!(0, import_node_fs9.existsSync)(swift))
|
|
4732
4730
|
throw new Error(`swift-icu: no swift at ${swift} for the ${sdk} SDK's icu data`);
|
|
4733
4731
|
const { stdout: listed } = await run(swift, ["sdk", "list", ...swiftSdkOptions()], {
|
|
@@ -4750,7 +4748,7 @@ async function load(toolchainBin, sdk) {
|
|
|
4750
4748
|
const resources = /^swiftStaticResourcesPath: (.+)$/m.exec(stdout)?.[1]?.trim();
|
|
4751
4749
|
if (!resources) throw new Error(`swift-icu: ${sdk} names no static resources`);
|
|
4752
4750
|
return Buffer.from(
|
|
4753
|
-
icuSegment(archiveMember((0, import_node_fs9.readFileSync)(
|
|
4751
|
+
icuSegment(archiveMember((0, import_node_fs9.readFileSync)(import_node_path10.default.join(resources, ARCHIVE)), MEMBER))
|
|
4754
4752
|
);
|
|
4755
4753
|
}
|
|
4756
4754
|
function archiveMember(archive, name2) {
|
|
@@ -4807,7 +4805,7 @@ function icuSegment(object) {
|
|
|
4807
4805
|
|
|
4808
4806
|
// src/swift-link-roots.ts
|
|
4809
4807
|
var import_node_fs10 = __toESM(require("node:fs"), 1);
|
|
4810
|
-
var
|
|
4808
|
+
var import_node_path11 = __toESM(require("node:path"), 1);
|
|
4811
4809
|
var OBJC_SEGMENTS = ["__objc_cats", "__objc_class_aliases"];
|
|
4812
4810
|
var leb = (bytes, at) => {
|
|
4813
4811
|
let value = 0;
|
|
@@ -4906,7 +4904,7 @@ function swiftObjcRootObjects(id, root, objects) {
|
|
|
4906
4904
|
const cached = rootsByDistribution.get(id);
|
|
4907
4905
|
if (cached) return cached;
|
|
4908
4906
|
const measured = objects.map(
|
|
4909
|
-
(object) => [object, objcSegmentSizes(import_node_fs10.default.readFileSync(
|
|
4907
|
+
(object) => [object, objcSegmentSizes(import_node_fs10.default.readFileSync(import_node_path11.default.join(root, object)))]
|
|
4910
4908
|
);
|
|
4911
4909
|
const empty = /* @__PURE__ */ new Map();
|
|
4912
4910
|
for (const [, sizes] of measured)
|
|
@@ -4952,14 +4950,14 @@ function swiftObjCModuleMap(module2, headers) {
|
|
|
4952
4950
|
// src/swift-project-user.ts
|
|
4953
4951
|
var import_node_child_process9 = require("node:child_process");
|
|
4954
4952
|
var import_node_fs11 = require("node:fs");
|
|
4955
|
-
var
|
|
4953
|
+
var import_node_path12 = __toESM(require("node:path"), 1);
|
|
4956
4954
|
function prepareSwiftProjectProcess(root, user) {
|
|
4957
4955
|
const home = `${root}.project-home`;
|
|
4958
4956
|
(0, import_node_fs11.rmSync)(home, { recursive: true, force: true });
|
|
4959
|
-
const tmp =
|
|
4960
|
-
const swiftpm =
|
|
4957
|
+
const tmp = import_node_path12.default.join(home, "tmp");
|
|
4958
|
+
const swiftpm = import_node_path12.default.join(home, "swiftpm");
|
|
4961
4959
|
(0, import_node_fs11.mkdirSync)(tmp, { recursive: true });
|
|
4962
|
-
const caches = ["cache", "config", "security"].map((name2) =>
|
|
4960
|
+
const caches = ["cache", "config", "security"].map((name2) => import_node_path12.default.join(swiftpm, name2));
|
|
4963
4961
|
for (const directory of caches) (0, import_node_fs11.mkdirSync)(directory, { recursive: true });
|
|
4964
4962
|
(0, import_node_child_process9.execFileSync)("chown", ["-R", "-P", `${user.uid}:${user.gid}`, root, home]);
|
|
4965
4963
|
(0, import_node_fs11.chmodSync)(root, 448);
|
|
@@ -4970,14 +4968,14 @@ function prepareSwiftProjectProcess(root, user) {
|
|
|
4970
4968
|
env: {
|
|
4971
4969
|
HOME: home,
|
|
4972
4970
|
TMPDIR: tmp,
|
|
4973
|
-
XDG_CONFIG_HOME:
|
|
4974
|
-
XDG_CACHE_HOME:
|
|
4975
|
-
XDG_DATA_HOME:
|
|
4971
|
+
XDG_CONFIG_HOME: import_node_path12.default.join(home, ".config"),
|
|
4972
|
+
XDG_CACHE_HOME: import_node_path12.default.join(home, ".cache"),
|
|
4973
|
+
XDG_DATA_HOME: import_node_path12.default.join(home, ".local", "share")
|
|
4976
4974
|
},
|
|
4977
4975
|
cacheOptions: [
|
|
4978
4976
|
...["cache", "config", "security"].flatMap((name2) => [
|
|
4979
4977
|
`--${name2}-path`,
|
|
4980
|
-
|
|
4978
|
+
import_node_path12.default.join(swiftpm, name2)
|
|
4981
4979
|
]),
|
|
4982
4980
|
"--disable-keychain"
|
|
4983
4981
|
]
|
|
@@ -4993,7 +4991,7 @@ function projectOutputFile(root, file, user) {
|
|
|
4993
4991
|
const real = (0, import_node_fs11.realpathSync)(file);
|
|
4994
4992
|
const base = (0, import_node_fs11.realpathSync)(root);
|
|
4995
4993
|
const stat = (0, import_node_fs11.statSync)(real);
|
|
4996
|
-
if (!real.startsWith(base +
|
|
4994
|
+
if (!real.startsWith(base + import_node_path12.default.sep) || !stat.isFile() || stat.uid !== user.uid) {
|
|
4997
4995
|
throw new Error(`swift-compile: project output ${file} is not a file of its build`);
|
|
4998
4996
|
}
|
|
4999
4997
|
return real;
|
|
@@ -5002,7 +5000,7 @@ function removeProjectLinks(root) {
|
|
|
5002
5000
|
const pending = [root];
|
|
5003
5001
|
for (let directory = pending.pop(); directory; directory = pending.pop()) {
|
|
5004
5002
|
for (const entry of (0, import_node_fs11.readdirSync)(directory, { withFileTypes: true })) {
|
|
5005
|
-
const full =
|
|
5003
|
+
const full = import_node_path12.default.join(directory, entry.name);
|
|
5006
5004
|
if (directory === root && entry.name === ".build") continue;
|
|
5007
5005
|
if (directory === root && entry.name.startsWith(".peach-modules-")) {
|
|
5008
5006
|
(0, import_node_fs11.rmSync)(full, { recursive: true, force: true });
|
|
@@ -5014,9 +5012,9 @@ function removeProjectLinks(root) {
|
|
|
5014
5012
|
|
|
5015
5013
|
// src/swift-reproducible.ts
|
|
5016
5014
|
var import_node_fs12 = require("node:fs");
|
|
5017
|
-
var
|
|
5015
|
+
var import_node_os6 = __toESM(require("node:os"), 1);
|
|
5018
5016
|
function swiftReproducibleBuildFlags(roots) {
|
|
5019
|
-
return [[
|
|
5017
|
+
return [[import_node_os6.default.homedir(), "home"], ...roots].flatMap(
|
|
5020
5018
|
([root, name2]) => [.../* @__PURE__ */ new Set([root, (0, import_node_fs12.realpathSync)(root)])].map((from) => `${from}=/peach/${name2}`)
|
|
5021
5019
|
).flatMap((map) => [
|
|
5022
5020
|
"-Xswiftc",
|
|
@@ -5035,6 +5033,22 @@ var import_node_child_process10 = require("node:child_process");
|
|
|
5035
5033
|
var import_node_crypto6 = require("node:crypto");
|
|
5036
5034
|
var import_node_fs13 = require("node:fs");
|
|
5037
5035
|
var import_node_path14 = __toESM(require("node:path"), 1);
|
|
5036
|
+
|
|
5037
|
+
// src/home-paths.ts
|
|
5038
|
+
var import_node_os7 = require("node:os");
|
|
5039
|
+
var import_node_path13 = __toESM(require("node:path"), 1);
|
|
5040
|
+
var PEACH_HOME_ENV = "PEACH_HOME";
|
|
5041
|
+
function ambientHomeDir() {
|
|
5042
|
+
return import_node_path13.default.join((0, import_node_os7.homedir)(), ".peach");
|
|
5043
|
+
}
|
|
5044
|
+
function rnxHomeDir() {
|
|
5045
|
+
const override = process.env[PEACH_HOME_ENV];
|
|
5046
|
+
if (override && override.length > 0) return import_node_path13.default.resolve(override);
|
|
5047
|
+
return ambientHomeDir();
|
|
5048
|
+
}
|
|
5049
|
+
var DAEMON_LOCKFILE_MAX_BYTES = 16 * 1024;
|
|
5050
|
+
|
|
5051
|
+
// src/swift-root-lock.ts
|
|
5038
5052
|
var POLL_MS = 250;
|
|
5039
5053
|
var START_TOLERANCE_MS = 2e3;
|
|
5040
5054
|
function errorCode(error) {
|
|
@@ -5807,11 +5821,9 @@ function parseWasmObjectBytes(file, buf, isDist) {
|
|
|
5807
5821
|
}
|
|
5808
5822
|
}
|
|
5809
5823
|
const typePrefixesInObj = /* @__PURE__ */ new Set();
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
typePrefixesInObj.add(symNames[i].slice(0, -2));
|
|
5814
|
-
}
|
|
5824
|
+
for (let i = 0; i < symKind.length; i++) {
|
|
5825
|
+
if ((symFlags[i] & 16) === 0 && symNames[i].startsWith("$s") && symNames[i].endsWith("Mn")) {
|
|
5826
|
+
typePrefixesInObj.add(symNames[i].slice(0, -2));
|
|
5815
5827
|
}
|
|
5816
5828
|
}
|
|
5817
5829
|
const objcRegisterFuncToTypePrefix = /* @__PURE__ */ new Map();
|
|
@@ -6093,15 +6105,16 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
|
|
|
6093
6105
|
set.add(symIdx);
|
|
6094
6106
|
workQueue.push({ kind: "datasym", obj, symIdx });
|
|
6095
6107
|
};
|
|
6096
|
-
const
|
|
6108
|
+
const knownTypes = /* @__PURE__ */ new Set();
|
|
6097
6109
|
for (const o of distObjs.values())
|
|
6098
|
-
for (const t of o.typePrefixesInObj)
|
|
6110
|
+
for (const t of o.typePrefixesInObj) knownTypes.add(t);
|
|
6099
6111
|
const globalLiveTypes = /* @__PURE__ */ new Set();
|
|
6100
6112
|
const pendingConformances = /* @__PURE__ */ new Map();
|
|
6113
|
+
const eagerConformanceObjects = /* @__PURE__ */ new Set();
|
|
6101
6114
|
const conformingType = (name2) => {
|
|
6102
6115
|
for (let n = name2.length - 1; n > 2; n--) {
|
|
6103
6116
|
const prefix = name2.slice(0, n);
|
|
6104
|
-
if (
|
|
6117
|
+
if (knownTypes.has(prefix)) return prefix;
|
|
6105
6118
|
}
|
|
6106
6119
|
return void 0;
|
|
6107
6120
|
};
|
|
@@ -6113,7 +6126,11 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
|
|
|
6113
6126
|
const waiting = pendingConformances.get(pref);
|
|
6114
6127
|
if (waiting) {
|
|
6115
6128
|
pendingConformances.delete(pref);
|
|
6116
|
-
for (const w of waiting)
|
|
6129
|
+
for (const w of waiting) {
|
|
6130
|
+
eagerConformanceObjects.add(w.obj);
|
|
6131
|
+
extractObject(w.obj);
|
|
6132
|
+
activateSymbolInObj(w.obj, w.symIdx);
|
|
6133
|
+
}
|
|
6117
6134
|
}
|
|
6118
6135
|
const mnName = `${pref}Mn`;
|
|
6119
6136
|
for (let i = 0; i < obj.symNames.length; i++) {
|
|
@@ -6140,7 +6157,7 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
|
|
|
6140
6157
|
}
|
|
6141
6158
|
};
|
|
6142
6159
|
const checkTypeTrigger = (obj, rawSymName) => {
|
|
6143
|
-
if (!
|
|
6160
|
+
if (!rawSymName) return;
|
|
6144
6161
|
const sName = rawSymName.startsWith(".Lgot.") ? rawSymName.slice(6) : rawSymName;
|
|
6145
6162
|
const objcPref = obj.objcClassSymToTypePrefix.get(sName);
|
|
6146
6163
|
if (objcPref) {
|
|
@@ -6231,6 +6248,13 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
|
|
|
6231
6248
|
}
|
|
6232
6249
|
for (const fIdx of obj.rootFuncs) markFuncLive(obj, fIdx);
|
|
6233
6250
|
for (const sIdx of obj.rootSegs) markSegLive(obj, sIdx);
|
|
6251
|
+
for (const name2 of obj.symNames) {
|
|
6252
|
+
const loaded = name2?.match(/^_c_(\w+)__load$/)?.[1];
|
|
6253
|
+
if (!loaded) continue;
|
|
6254
|
+
const classSym = obj.symNames.indexOf(`._OBJC_CLASS_${loaded}`);
|
|
6255
|
+
if (classSym !== -1 && (obj.symFlags[classSym] & 16) === 0)
|
|
6256
|
+
activateSymbolInObj(obj, classSym);
|
|
6257
|
+
}
|
|
6234
6258
|
if (obj.file.endsWith("libswiftCore__Swift.o")) {
|
|
6235
6259
|
for (const pref of obj.typePrefixesInObj) {
|
|
6236
6260
|
if (!pref.startsWith("$ss")) {
|
|
@@ -6255,11 +6279,6 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
|
|
|
6255
6279
|
const type = conformingType(mcName);
|
|
6256
6280
|
if (type === void 0 || globalLiveTypes.has(type))
|
|
6257
6281
|
activateSymbolInObj(obj, r.rs);
|
|
6258
|
-
else {
|
|
6259
|
-
let list = pendingConformances.get(type);
|
|
6260
|
-
if (!list) pendingConformances.set(type, list = []);
|
|
6261
|
-
list.push({ obj, symIdx: r.rs });
|
|
6262
|
-
}
|
|
6263
6282
|
}
|
|
6264
6283
|
}
|
|
6265
6284
|
}
|
|
@@ -6267,6 +6286,17 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
|
|
|
6267
6286
|
}
|
|
6268
6287
|
}
|
|
6269
6288
|
};
|
|
6289
|
+
for (const obj of distObjs.values()) {
|
|
6290
|
+
if (!obj.isDist) continue;
|
|
6291
|
+
for (const r of obj.dataRelocList) {
|
|
6292
|
+
if (obj.segNames[r.segIdx] !== "swift5_protocol_conformances") continue;
|
|
6293
|
+
const type = conformingType(obj.symNames[r.rs]);
|
|
6294
|
+
if (type === void 0 || obj.typePrefixesInObj.has(type)) continue;
|
|
6295
|
+
let list = pendingConformances.get(type);
|
|
6296
|
+
if (!list) pendingConformances.set(type, list = []);
|
|
6297
|
+
list.push({ obj, symIdx: r.rs });
|
|
6298
|
+
}
|
|
6299
|
+
}
|
|
6270
6300
|
let hasClangObjCEager = false;
|
|
6271
6301
|
const eagerBuildPrunable = [];
|
|
6272
6302
|
for (const f of eagerFiles) {
|
|
@@ -6685,6 +6715,12 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
|
|
|
6685
6715
|
emittedPruned.add(ef);
|
|
6686
6716
|
}
|
|
6687
6717
|
}
|
|
6718
|
+
for (const obj of eagerConformanceObjects) {
|
|
6719
|
+
if (!emittedPruned.has(obj.file) && prunedMap.has(obj.file)) {
|
|
6720
|
+
outTokens.push(prunedMap.get(obj.file));
|
|
6721
|
+
emittedPruned.add(obj.file);
|
|
6722
|
+
}
|
|
6723
|
+
}
|
|
6688
6724
|
outTokens.push("--start-lib");
|
|
6689
6725
|
for (const rf of prunableCandidates) {
|
|
6690
6726
|
if (emittedPruned.has(rf)) continue;
|
|
@@ -6860,6 +6896,7 @@ function isSwiftResourceBundles(value) {
|
|
|
6860
6896
|
}
|
|
6861
6897
|
|
|
6862
6898
|
// src/wasm-optimize.ts
|
|
6899
|
+
var import_node_child_process13 = require("node:child_process");
|
|
6863
6900
|
var import_wasm_opt = require("wasm-opt");
|
|
6864
6901
|
var FEATURES = [
|
|
6865
6902
|
"threads",
|
|
@@ -6874,7 +6911,7 @@ var FEATURES = [
|
|
|
6874
6911
|
"sign-ext"
|
|
6875
6912
|
];
|
|
6876
6913
|
var WASM_OPTIMIZE_IDENTITY = `wasm-opt ${import_wasm_opt.BINARYEN_VERSION} -Oz ${FEATURES.join(",")}`;
|
|
6877
|
-
async function
|
|
6914
|
+
async function runWasmOpt(file, output) {
|
|
6878
6915
|
const result = await (0, import_wasm_opt.wasmOpt)([
|
|
6879
6916
|
"-Oz",
|
|
6880
6917
|
...FEATURES.map((feature) => `--enable-${feature}`),
|
|
@@ -6885,6 +6922,29 @@ async function optimizeWasm(file, output) {
|
|
|
6885
6922
|
if (result.status !== 0)
|
|
6886
6923
|
throw new Error(`wasm-opt exited ${result.status}: ${result.stderr}`);
|
|
6887
6924
|
}
|
|
6925
|
+
function installWasmOpt() {
|
|
6926
|
+
try {
|
|
6927
|
+
(0, import_node_child_process13.execFileSync)("npx", ["-y", "wasm-opt", "--wasm-opt-install"], {
|
|
6928
|
+
timeout: 6e5,
|
|
6929
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
6930
|
+
env: { ...process.env, WASM_OPT_VERSION: import_wasm_opt.BINARYEN_VERSION }
|
|
6931
|
+
});
|
|
6932
|
+
} catch (error) {
|
|
6933
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
6934
|
+
throw new Error(`wasm-opt binary missing and on-demand install failed: ${detail}`, {
|
|
6935
|
+
cause: error
|
|
6936
|
+
});
|
|
6937
|
+
}
|
|
6938
|
+
}
|
|
6939
|
+
async function optimizeWasm(file, output) {
|
|
6940
|
+
try {
|
|
6941
|
+
await runWasmOpt(file, output);
|
|
6942
|
+
} catch (error) {
|
|
6943
|
+
if (!(error instanceof import_wasm_opt.BinaryNotFoundError)) throw error;
|
|
6944
|
+
installWasmOpt();
|
|
6945
|
+
await runWasmOpt(file, output);
|
|
6946
|
+
}
|
|
6947
|
+
}
|
|
6888
6948
|
|
|
6889
6949
|
// src/write-build-file.ts
|
|
6890
6950
|
var import_node_fs15 = require("node:fs");
|
|
@@ -7006,7 +7066,7 @@ async function runCompiler(command, args, options, stream = false, quiet) {
|
|
|
7006
7066
|
detached: true,
|
|
7007
7067
|
stdio: ["ignore", "pipe", "pipe"]
|
|
7008
7068
|
};
|
|
7009
|
-
const child = options.lease ? options.lease.spawn(command, args, launch, options.frameworkLease) : (0,
|
|
7069
|
+
const child = options.lease ? options.lease.spawn(command, args, launch, options.frameworkLease) : (0, import_node_child_process14.spawn)(command, args, launch);
|
|
7010
7070
|
let stopping;
|
|
7011
7071
|
try {
|
|
7012
7072
|
return await new Promise((resolve, reject) => {
|
|
@@ -7111,21 +7171,20 @@ function swiftModuleInterface(moduleRoot, name2, interfaceRoot) {
|
|
|
7111
7171
|
return { declared: swiftInterfaceDeclarations(header), header };
|
|
7112
7172
|
}
|
|
7113
7173
|
const sources = import_node_path19.default.join(moduleRoot, "Sources", name2);
|
|
7114
|
-
|
|
7174
|
+
const built = import_node_path19.default.join(moduleRoot, ".build/host", `${name2}-Swift.h`);
|
|
7175
|
+
if (!(0, import_node_fs17.existsSync)(sources) || !(0, import_node_fs17.existsSync)(built)) return null;
|
|
7115
7176
|
const declared = /* @__PURE__ */ new Set();
|
|
7116
7177
|
for (const file of (0, import_node_fs17.readdirSync)(sources, { recursive: true, encoding: "utf8" }))
|
|
7117
7178
|
if (file.endsWith(".swift"))
|
|
7118
|
-
for (const [, objc] of (0, import_node_fs17.readFileSync)(
|
|
7119
|
-
|
|
7179
|
+
for (const [, objc, subclass] of (0, import_node_fs17.readFileSync)(
|
|
7180
|
+
import_node_path19.default.join(sources, file),
|
|
7181
|
+
"utf8"
|
|
7182
|
+
).matchAll(
|
|
7183
|
+
/@objc\((\w+)\)\s+(?:\w+\s+)*?(?:protocol|class)\s|^(?:public|open)\s+(?:final\s+)?class\s+(\w+)\s*:\s*NSObject\b/gm
|
|
7120
7184
|
))
|
|
7121
|
-
declared.add(objc);
|
|
7185
|
+
declared.add(objc ?? subclass);
|
|
7122
7186
|
if (declared.size === 0) return null;
|
|
7123
|
-
|
|
7124
|
-
return {
|
|
7125
|
-
declared,
|
|
7126
|
-
header: (0, import_node_fs17.existsSync)(built) ? clangInterfaceHeader((0, import_node_fs17.readFileSync)(built, "utf8")) : `// ${name2}-Swift.h is generated when ${name2} builds
|
|
7127
|
-
`
|
|
7128
|
-
};
|
|
7187
|
+
return { declared, header: clangInterfaceHeader((0, import_node_fs17.readFileSync)(built, "utf8")) };
|
|
7129
7188
|
}
|
|
7130
7189
|
var clangInterfaceHeader = (header) => header.replace(/^@import (?:UIKitCore|UIKitText);$/gm, "@import UIKit;").replace(/^@import CoreFoundation;$/gm, "@import Foundation;").replace(/\b_TtC10Foundation\d+(NS\w+)\b/g, "$1");
|
|
7131
7190
|
var swiftInterfaceDeclarations = (header) => /* @__PURE__ */ new Set([
|
|
@@ -7341,9 +7400,10 @@ function swiftProjectBuildKey(moduleRoot, release) {
|
|
|
7341
7400
|
var SYSTEM_MODULE_LIBRARIES = {
|
|
7342
7401
|
"sqlite3.h": "sqlite3",
|
|
7343
7402
|
"sqlite3ext.h": "sqlite3",
|
|
7403
|
+
"bzlib.h": "bz2",
|
|
7344
7404
|
SQLite3: "sqlite3"
|
|
7345
7405
|
};
|
|
7346
|
-
var SYSTEM_MODULE_IMPORT = /^\s*(?:#\s*(?:import|include)\s*<(sqlite3(?:ext)?\.h)>|@import\s+(SQLite3)\b)/gm;
|
|
7406
|
+
var SYSTEM_MODULE_IMPORT = /^\s*(?:#\s*(?:import|include)\s*<(sqlite3(?:ext)?\.h|bzlib\.h)>|@import\s+(SQLite3)\b)/gm;
|
|
7347
7407
|
function compileTargets(input) {
|
|
7348
7408
|
const manifest = input.files["Package.swift"];
|
|
7349
7409
|
if (manifest === void 0) return [];
|
|
@@ -7539,7 +7599,7 @@ function swiftSdkPaths(moduleRoot, toolchainBin) {
|
|
|
7539
7599
|
const key = JSON.stringify([toolchainBin, sdk, options]);
|
|
7540
7600
|
const cached = sdkPaths.get(key);
|
|
7541
7601
|
if (cached) return cached;
|
|
7542
|
-
const configuration = (0,
|
|
7602
|
+
const configuration = (0, import_node_child_process14.execFileSync)(
|
|
7543
7603
|
import_node_path19.default.join(toolchainBin, "swift"),
|
|
7544
7604
|
[
|
|
7545
7605
|
"sdk",
|
|
@@ -7709,6 +7769,11 @@ function swiftTargetDependencies(files, targets) {
|
|
|
7709
7769
|
const siblings = /* @__PURE__ */ new Map();
|
|
7710
7770
|
for (const target of targets) {
|
|
7711
7771
|
const prefix = target.path === "." ? "" : `${target.path}/`;
|
|
7772
|
+
const ownsHeader = (header) => [`${prefix}${header}`, `${prefix}include/${header}`].some(
|
|
7773
|
+
(file) => Object.hasOwn(files, file) && !targets.some(
|
|
7774
|
+
(candidate) => candidate.name !== target.name && candidate.path !== "." && file.startsWith(`${candidate.path}/`)
|
|
7775
|
+
)
|
|
7776
|
+
);
|
|
7712
7777
|
const deps = new Set(
|
|
7713
7778
|
(target.dependencies ?? []).flatMap(
|
|
7714
7779
|
(dependency) => dependency.kind === "target" && dependency.name !== target.name && names.has(dependency.name) ? [dependency.name] : []
|
|
@@ -7720,7 +7785,7 @@ function swiftTargetDependencies(files, targets) {
|
|
|
7720
7785
|
(candidate) => candidate.name !== target.name && candidate.path !== "." && candidate.path.startsWith(prefix) && file.startsWith(`${candidate.path}/`)
|
|
7721
7786
|
))
|
|
7722
7787
|
continue;
|
|
7723
|
-
const imports = file.endsWith(".swift") ? swiftImportNames(contents) : SWIFT_NATIVE_SOURCE_EXTENSIONS.some((extension) => file.endsWith(extension)) ? clangImportNames(contents) : [];
|
|
7788
|
+
const imports = file.endsWith(".swift") ? swiftImportNames(contents) : SWIFT_NATIVE_SOURCE_EXTENSIONS.some((extension) => file.endsWith(extension)) ? clangImportNames(contents, ownsHeader) : [];
|
|
7724
7789
|
for (const name2 of imports) {
|
|
7725
7790
|
if (names.has(name2) && name2 !== target.name) deps.add(name2);
|
|
7726
7791
|
}
|
|
@@ -7756,9 +7821,9 @@ var executableLinkFlags = (root) => ` "-Xclang-linker", "-O0",
|
|
|
7756
7821
|
`;
|
|
7757
7822
|
var darwinRecordsRegion = (quoted) => quoted.length ? ["-Wl,--start-lib", ...quoted, "-Wl,--end-lib"] : [];
|
|
7758
7823
|
var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
|
|
7759
|
-
var MULTI_MANIFEST_VERSION =
|
|
7824
|
+
var MULTI_MANIFEST_VERSION = 65;
|
|
7760
7825
|
var SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
|
|
7761
|
-
var compilerSourceDigest = true ? "
|
|
7826
|
+
var compilerSourceDigest = true ? "5bed84d1d29562932f8ef8e54d9dae7b5b378ffb937861030ae5b732eda8dafd" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
|
|
7762
7827
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
7763
7828
|
const hash = (0, import_node_crypto8.createHash)("sha256");
|
|
7764
7829
|
hash.update(`swift-compile
|
|
@@ -9860,20 +9925,34 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
|
|
|
9860
9925
|
moduleInterfaces.set(name2, value);
|
|
9861
9926
|
return value;
|
|
9862
9927
|
};
|
|
9928
|
+
const podHeaders = /* @__PURE__ */ new Map();
|
|
9929
|
+
for (const settings of input.nativeTargets ?? [])
|
|
9930
|
+
for (const file of settings.headers) {
|
|
9931
|
+
const owner = /\/Headers\/(?:Public|Private)\/([\w+-]+)\/(?:\1\/)?[^/]+\.h$/.exec(
|
|
9932
|
+
file
|
|
9933
|
+
)?.[1];
|
|
9934
|
+
if (owner)
|
|
9935
|
+
podHeaders.set(import_node_path19.default.basename(file), [
|
|
9936
|
+
...podHeaders.get(import_node_path19.default.basename(file)) ?? [],
|
|
9937
|
+
{ owner, content: input.files[file] }
|
|
9938
|
+
]);
|
|
9939
|
+
}
|
|
9940
|
+
const podHeaderOwner = (file, content) => /\/Headers\/(?:Public|Private)\/([\w+-]+)\//.exec(file)?.[1] ?? podHeaders.get(import_node_path19.default.basename(file))?.find((header) => header.content === content)?.owner;
|
|
9863
9941
|
for (const settings of input.nativeTargets ?? []) {
|
|
9864
9942
|
for (const file of settings.headers) {
|
|
9865
9943
|
const destination = import_node_path19.default.join(layout.root, file);
|
|
9866
9944
|
if (files.has(destination)) continue;
|
|
9867
9945
|
const interfaceModule = /(?:^|\/)(\w+)-Swift\.h$/.exec(file)?.[1];
|
|
9868
9946
|
const frameworkHeader = !interfaceModule && /(?:^|\/)(\w+)\.framework\/Headers\/[\w+.-]+\.h$/.exec(file)?.[1];
|
|
9869
|
-
const
|
|
9947
|
+
const interfaceOwner = frameworkHeader || (interfaceModule ? void 0 : podHeaderOwner(file, input.files[file]));
|
|
9948
|
+
const frameworkInterface = interfaceOwner ? moduleInterface(interfaceOwner) : null;
|
|
9870
9949
|
const rawContents = interfaceModule && moduleInterface(interfaceModule)?.header || input.files[file];
|
|
9871
9950
|
if (rawContents === void 0)
|
|
9872
9951
|
throw new Error(`missing original Objective-C header ${file}`);
|
|
9873
9952
|
const contents = frameworkInterface && typeof rawContents === "string" ? withoutSwiftDeclarations(
|
|
9874
9953
|
rawContents,
|
|
9875
9954
|
frameworkInterface.declared,
|
|
9876
|
-
`#import <${
|
|
9955
|
+
`#import <${interfaceOwner}/${interfaceOwner}-Swift.h>`
|
|
9877
9956
|
) : rawContents;
|
|
9878
9957
|
writeBuildFile(destination, contents);
|
|
9879
9958
|
files.set(destination, contents);
|