peachsim 0.1.1990 → 0.1.1991
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/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 +1261 -1263
- 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 +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +935 -937
- 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 +1362 -1364
- package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +1 -1
- 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 +1 -1
- package/dist-lib/native-app-identity-project.cjs +1 -1
- package/dist-lib/native-app-identity-project.mjs +7 -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/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 +24 -24
- package/dist-lib/public-origins-lib.json +53 -53
- 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 +1617 -1619
- package/dist-lib/swift-compile.cjs +242 -244
- package/dist-lib/swift-compile.mjs +58 -60
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +734 -736
- package/dist-lib/vite.cjs +1 -1
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/package.json +1 -1
- package/src/nitro-adapter.lock.json +242 -242
- package/src/nitro-superset.lock.json +4 -4
- package/src/swift-distribution.lock.json +23 -60
- package/src/turbo-runtime.lock.json +18 -18
- package/src/wasm-optimize.ts +17 -21
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1991 | (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;
|
|
@@ -93,7 +93,7 @@ __export(swift_compile_exports, {
|
|
|
93
93
|
module.exports = __toCommonJS(swift_compile_exports);
|
|
94
94
|
var import_node_child_process18 = require("node:child_process");
|
|
95
95
|
var import_node_crypto13 = require("node:crypto");
|
|
96
|
-
var
|
|
96
|
+
var import_node_fs25 = require("node:fs");
|
|
97
97
|
var import_node_os10 = __toESM(require("node:os"), 1);
|
|
98
98
|
var import_node_path27 = __toESM(require("node:path"), 1);
|
|
99
99
|
var v5 = __toESM(require("valibot"), 1);
|
|
@@ -4747,7 +4747,7 @@ var foundationCategoryObjects = [
|
|
|
4747
4747
|
|
|
4748
4748
|
// src/swift-guest-compile.ts
|
|
4749
4749
|
var import_node_child_process13 = require("node:child_process");
|
|
4750
|
-
var
|
|
4750
|
+
var import_node_fs17 = require("node:fs");
|
|
4751
4751
|
var import_node_path19 = __toESM(require("node:path"), 1);
|
|
4752
4752
|
|
|
4753
4753
|
// src/swift-guest-archive.ts
|
|
@@ -9890,6 +9890,7 @@ function logicalGuestLinkOptions(args, identities, roots) {
|
|
|
9890
9890
|
}
|
|
9891
9891
|
|
|
9892
9892
|
// src/wasm-optimize.ts
|
|
9893
|
+
var import_node_fs16 = require("node:fs");
|
|
9893
9894
|
var import_node_path18 = require("node:path");
|
|
9894
9895
|
|
|
9895
9896
|
// ../contrast-runtime-delivery/src/index.ts
|
|
@@ -10169,7 +10170,7 @@ async function runWasmOpt(file, output, skipPasses, binary) {
|
|
|
10169
10170
|
"-o",
|
|
10170
10171
|
output
|
|
10171
10172
|
],
|
|
10172
|
-
|
|
10173
|
+
{ env: { ...process.env, WASM_OPT_PATH: binary } }
|
|
10173
10174
|
);
|
|
10174
10175
|
if (result.status !== 0)
|
|
10175
10176
|
throw new Error(`wasm-opt exited ${result.status}: ${result.stderr}`);
|
|
@@ -10181,23 +10182,20 @@ async function installWasmOpt() {
|
|
|
10181
10182
|
const release = BINARYEN_RELEASES.get(platform);
|
|
10182
10183
|
if (!release) throw new Error(`no pinned Binaryen release for ${platform}`);
|
|
10183
10184
|
const destDir = (0, import_node_path18.join)(rnxHomeDir(), "tools", "binaryen", import_wasm_opt.BINARYEN_VERSION, platform);
|
|
10184
|
-
|
|
10185
|
-
|
|
10186
|
-
|
|
10187
|
-
|
|
10188
|
-
|
|
10189
|
-
|
|
10190
|
-
|
|
10191
|
-
|
|
10192
|
-
|
|
10185
|
+
const binary = (0, import_node_path18.join)(destDir, "bin", "wasm-opt");
|
|
10186
|
+
if (!(0, import_node_fs16.existsSync)(binary))
|
|
10187
|
+
await installVerifiedTarball({
|
|
10188
|
+
url: `https://github.com/WebAssembly/binaryen/releases/download/version_${import_wasm_opt.BINARYEN_VERSION}/binaryen-version_${import_wasm_opt.BINARYEN_VERSION}-${release.asset}.tar.gz`,
|
|
10189
|
+
digest: { algorithm: "sha256", encoding: "hex", value: release.sha256 },
|
|
10190
|
+
destDir,
|
|
10191
|
+
installedMarker: "bin/wasm-opt",
|
|
10192
|
+
stripComponents: 1,
|
|
10193
|
+
label: `Binaryen ${import_wasm_opt.BINARYEN_VERSION}`
|
|
10194
|
+
});
|
|
10195
|
+
return binary;
|
|
10193
10196
|
}
|
|
10194
10197
|
async function optimizeWasm(file, output, skipPasses = []) {
|
|
10195
|
-
|
|
10196
|
-
await runWasmOpt(file, output, skipPasses);
|
|
10197
|
-
} catch (error) {
|
|
10198
|
-
if (!(error instanceof import_wasm_opt.BinaryNotFoundError)) throw error;
|
|
10199
|
-
await runWasmOpt(file, output, skipPasses, await installWasmOpt());
|
|
10200
|
-
}
|
|
10198
|
+
await runWasmOpt(file, output, skipPasses, await installWasmOpt());
|
|
10201
10199
|
}
|
|
10202
10200
|
|
|
10203
10201
|
// src/swift-guest-compile.ts
|
|
@@ -10212,7 +10210,7 @@ function version(value) {
|
|
|
10212
10210
|
}
|
|
10213
10211
|
async function compileGuestLink(options) {
|
|
10214
10212
|
const directory = import_node_path19.default.join(options.buildDirectory, ".peach-guest-link");
|
|
10215
|
-
(0,
|
|
10213
|
+
(0, import_node_fs17.mkdirSync)(directory, { recursive: true });
|
|
10216
10214
|
const sdkRoot = import_node_path19.default.dirname(options.sysroot);
|
|
10217
10215
|
const catalogs = readGuestRuntimeCatalogs(sdkRoot, options.moduleRoot);
|
|
10218
10216
|
const sourceImages = guestSourceImages(options.graph);
|
|
@@ -10237,7 +10235,7 @@ async function compileGuestLink(options) {
|
|
|
10237
10235
|
];
|
|
10238
10236
|
const stubSource = import_node_path19.default.join(directory, "preselection-projection.c");
|
|
10239
10237
|
const stub = import_node_path19.default.join(directory, "preselection-projection.o");
|
|
10240
|
-
(0,
|
|
10238
|
+
(0, import_node_fs17.writeFileSync)(
|
|
10241
10239
|
stubSource,
|
|
10242
10240
|
'#include "guest-image-projection.h"\nconst struct peach_guest_image __peach_guest_images[] = {{0}};\nconst uint32_t __peach_guest_image_count = 0;\n'
|
|
10243
10241
|
);
|
|
@@ -10541,24 +10539,24 @@ async function compileGuestLink(options) {
|
|
|
10541
10539
|
await optimizeWasm(options.output, options.optimized, [
|
|
10542
10540
|
"duplicate-function-elimination"
|
|
10543
10541
|
]);
|
|
10544
|
-
const map = (0,
|
|
10542
|
+
const map = (0, import_node_fs17.readFileSync)(result.mapPath, "utf8");
|
|
10545
10543
|
if (!/ __peach_guest_images$/m.test(map)) return;
|
|
10546
10544
|
const finalized = finalizeGuestProjectionStorage({
|
|
10547
10545
|
map,
|
|
10548
|
-
linked: (0,
|
|
10549
|
-
optimized: (0,
|
|
10546
|
+
linked: (0, import_node_fs17.readFileSync)(options.output),
|
|
10547
|
+
optimized: (0, import_node_fs17.readFileSync)(options.optimized),
|
|
10550
10548
|
owners: result.owners,
|
|
10551
10549
|
sectionOwners: result.generatedSectionOwners,
|
|
10552
10550
|
projectionObject,
|
|
10553
10551
|
reserved
|
|
10554
10552
|
});
|
|
10555
|
-
(0,
|
|
10553
|
+
(0, import_node_fs17.writeFileSync)(options.optimized, finalized.wasm);
|
|
10556
10554
|
}
|
|
10557
10555
|
|
|
10558
10556
|
// src/swift-icu.ts
|
|
10559
10557
|
var import_node_child_process14 = require("node:child_process");
|
|
10560
10558
|
var import_node_crypto11 = require("node:crypto");
|
|
10561
|
-
var
|
|
10559
|
+
var import_node_fs18 = require("node:fs");
|
|
10562
10560
|
var import_promises4 = require("node:fs/promises");
|
|
10563
10561
|
var import_node_os8 = __toESM(require("node:os"), 1);
|
|
10564
10562
|
var import_node_path20 = __toESM(require("node:path"), 1);
|
|
@@ -10689,7 +10687,7 @@ function swiftIcuAsset(toolchainBin, sdk) {
|
|
|
10689
10687
|
}
|
|
10690
10688
|
async function load(toolchainBin, sdk) {
|
|
10691
10689
|
const swift = import_node_path20.default.join(toolchainBin, "swift");
|
|
10692
|
-
if (!(0,
|
|
10690
|
+
if (!(0, import_node_fs18.existsSync)(swift))
|
|
10693
10691
|
throw new Error(`swift-icu: no swift at ${swift} for the ${sdk} SDK's icu data`);
|
|
10694
10692
|
const { stdout: listed } = await run(swift, ["sdk", "list", ...swiftSdkOptions()], {
|
|
10695
10693
|
env: swiftEnvironment()
|
|
@@ -10711,7 +10709,7 @@ async function load(toolchainBin, sdk) {
|
|
|
10711
10709
|
const resources = /^swiftStaticResourcesPath: (.+)$/m.exec(stdout)?.[1]?.trim();
|
|
10712
10710
|
if (!resources) throw new Error(`swift-icu: ${sdk} names no static resources`);
|
|
10713
10711
|
return Buffer.from(
|
|
10714
|
-
icuSegment(archiveMember((0,
|
|
10712
|
+
icuSegment(archiveMember((0, import_node_fs18.readFileSync)(import_node_path20.default.join(resources, ARCHIVE)), MEMBER))
|
|
10715
10713
|
);
|
|
10716
10714
|
}
|
|
10717
10715
|
function archiveMember(archive, name2) {
|
|
@@ -10778,7 +10776,7 @@ function swiftIcuPacked(icu) {
|
|
|
10778
10776
|
"swift-brotli",
|
|
10779
10777
|
swiftIcuAddress(icu)
|
|
10780
10778
|
);
|
|
10781
|
-
if ((0,
|
|
10779
|
+
if ((0, import_node_fs18.existsSync)(file)) return (0, import_promises4.readFile)(file);
|
|
10782
10780
|
const packed = Buffer.from(
|
|
10783
10781
|
swiftIcuPack(
|
|
10784
10782
|
await inflateGzip(icu.gzip),
|
|
@@ -10801,7 +10799,7 @@ async function swiftIcuBundleAsset(icu) {
|
|
|
10801
10799
|
}
|
|
10802
10800
|
|
|
10803
10801
|
// src/swift-link-roots.ts
|
|
10804
|
-
var
|
|
10802
|
+
var import_node_fs19 = __toESM(require("node:fs"), 1);
|
|
10805
10803
|
var import_node_path21 = __toESM(require("node:path"), 1);
|
|
10806
10804
|
var OBJC_SENTINELS = /* @__PURE__ */ new Map([
|
|
10807
10805
|
["__objc_cats", ".objc_null_category"],
|
|
@@ -10896,7 +10894,7 @@ function swiftObjcRootObjects(id, root, objects) {
|
|
|
10896
10894
|
const cached = rootsByDistribution.get(id);
|
|
10897
10895
|
if (cached) return cached;
|
|
10898
10896
|
const measured = objects.map(
|
|
10899
|
-
(object3) => [object3, objcRootInfo(
|
|
10897
|
+
(object3) => [object3, objcRootInfo(import_node_fs19.default.readFileSync(import_node_path21.default.join(root, object3)))]
|
|
10900
10898
|
);
|
|
10901
10899
|
const roots = new Set(
|
|
10902
10900
|
measured.filter(
|
|
@@ -10937,19 +10935,19 @@ function swiftObjCModuleMap(module2, headers) {
|
|
|
10937
10935
|
|
|
10938
10936
|
// src/swift-project-user.ts
|
|
10939
10937
|
var import_node_child_process15 = require("node:child_process");
|
|
10940
|
-
var
|
|
10938
|
+
var import_node_fs20 = require("node:fs");
|
|
10941
10939
|
var import_node_path22 = __toESM(require("node:path"), 1);
|
|
10942
10940
|
function prepareSwiftProjectProcess(root, user) {
|
|
10943
10941
|
const home = `${root}.project-home`;
|
|
10944
|
-
(0,
|
|
10942
|
+
(0, import_node_fs20.rmSync)(home, { recursive: true, force: true });
|
|
10945
10943
|
const tmp = import_node_path22.default.join(home, "tmp");
|
|
10946
10944
|
const swiftpm = import_node_path22.default.join(home, "swiftpm");
|
|
10947
|
-
(0,
|
|
10945
|
+
(0, import_node_fs20.mkdirSync)(tmp, { recursive: true });
|
|
10948
10946
|
const caches = ["cache", "config", "security"].map((name2) => import_node_path22.default.join(swiftpm, name2));
|
|
10949
|
-
for (const directory of caches) (0,
|
|
10947
|
+
for (const directory of caches) (0, import_node_fs20.mkdirSync)(directory, { recursive: true });
|
|
10950
10948
|
(0, import_node_child_process15.execFileSync)("chown", ["-R", "-P", `${user.uid}:${user.gid}`, root, home]);
|
|
10951
|
-
(0,
|
|
10952
|
-
(0,
|
|
10949
|
+
(0, import_node_fs20.chmodSync)(root, 448);
|
|
10950
|
+
(0, import_node_fs20.chmodSync)(home, 448);
|
|
10953
10951
|
return {
|
|
10954
10952
|
uid: user.uid,
|
|
10955
10953
|
gid: user.gid,
|
|
@@ -10976,9 +10974,9 @@ function endSwiftProjectProcesses(user) {
|
|
|
10976
10974
|
});
|
|
10977
10975
|
}
|
|
10978
10976
|
function projectOutputFile(root, file, user) {
|
|
10979
|
-
const real = (0,
|
|
10980
|
-
const base = (0,
|
|
10981
|
-
const stat = (0,
|
|
10977
|
+
const real = (0, import_node_fs20.realpathSync)(file);
|
|
10978
|
+
const base = (0, import_node_fs20.realpathSync)(root);
|
|
10979
|
+
const stat = (0, import_node_fs20.statSync)(real);
|
|
10982
10980
|
if (!real.startsWith(base + import_node_path22.default.sep) || !stat.isFile() || stat.uid !== user.uid) {
|
|
10983
10981
|
throw new Error(`swift-compile: project output ${file} is not a file of its build`);
|
|
10984
10982
|
}
|
|
@@ -10987,23 +10985,23 @@ function projectOutputFile(root, file, user) {
|
|
|
10987
10985
|
function removeProjectLinks(root) {
|
|
10988
10986
|
const pending = [root];
|
|
10989
10987
|
for (let directory = pending.pop(); directory; directory = pending.pop()) {
|
|
10990
|
-
for (const entry of (0,
|
|
10988
|
+
for (const entry of (0, import_node_fs20.readdirSync)(directory, { withFileTypes: true })) {
|
|
10991
10989
|
const full = import_node_path22.default.join(directory, entry.name);
|
|
10992
10990
|
if (directory === root && entry.name === ".build") continue;
|
|
10993
10991
|
if (directory === root && entry.name.startsWith(".peach-modules-")) {
|
|
10994
|
-
(0,
|
|
10995
|
-
} else if (entry.isSymbolicLink()) (0,
|
|
10992
|
+
(0, import_node_fs20.rmSync)(full, { recursive: true, force: true });
|
|
10993
|
+
} else if (entry.isSymbolicLink()) (0, import_node_fs20.rmSync)(full);
|
|
10996
10994
|
else if (entry.isDirectory()) pending.push(full);
|
|
10997
10995
|
}
|
|
10998
10996
|
}
|
|
10999
10997
|
}
|
|
11000
10998
|
|
|
11001
10999
|
// src/swift-reproducible.ts
|
|
11002
|
-
var
|
|
11000
|
+
var import_node_fs21 = require("node:fs");
|
|
11003
11001
|
var import_node_os9 = __toESM(require("node:os"), 1);
|
|
11004
11002
|
function swiftReproducibleBuildFlags(roots) {
|
|
11005
11003
|
return [[import_node_os9.default.homedir(), "home"], ...roots].flatMap(
|
|
11006
|
-
([root, name2]) => [.../* @__PURE__ */ new Set([root, (0,
|
|
11004
|
+
([root, name2]) => [.../* @__PURE__ */ new Set([root, (0, import_node_fs21.realpathSync)(root)])].map((from) => `${from}=/peach/${name2}`)
|
|
11007
11005
|
).flatMap((map) => [
|
|
11008
11006
|
"-Xswiftc",
|
|
11009
11007
|
"-file-prefix-map",
|
|
@@ -11019,7 +11017,7 @@ function swiftReproducibleBuildFlags(roots) {
|
|
|
11019
11017
|
// src/swift-root-lock.ts
|
|
11020
11018
|
var import_node_child_process16 = require("node:child_process");
|
|
11021
11019
|
var import_node_crypto12 = require("node:crypto");
|
|
11022
|
-
var
|
|
11020
|
+
var import_node_fs22 = require("node:fs");
|
|
11023
11021
|
var import_node_path23 = __toESM(require("node:path"), 1);
|
|
11024
11022
|
var POLL_MS = 250;
|
|
11025
11023
|
var START_TOLERANCE_MS = 2e3;
|
|
@@ -11065,7 +11063,7 @@ function pause(ms, signal) {
|
|
|
11065
11063
|
var name = (number3, suffix) => `${String(number3).padStart(12, "0")}.${suffix}`;
|
|
11066
11064
|
function generationNumbers(directory) {
|
|
11067
11065
|
const numbers = /* @__PURE__ */ new Set();
|
|
11068
|
-
for (const entry of (0,
|
|
11066
|
+
for (const entry of (0, import_node_fs22.readdirSync)(directory)) {
|
|
11069
11067
|
const match = /^(\d{12})\./.exec(entry);
|
|
11070
11068
|
if (match) numbers.add(Number(match[1]));
|
|
11071
11069
|
}
|
|
@@ -11074,7 +11072,7 @@ function generationNumbers(directory) {
|
|
|
11074
11072
|
function readGeneration(directory, number3) {
|
|
11075
11073
|
let owner;
|
|
11076
11074
|
try {
|
|
11077
|
-
owner = (0,
|
|
11075
|
+
owner = (0, import_node_fs22.readFileSync)(import_node_path23.default.join(directory, name(number3, "owner")), "utf8");
|
|
11078
11076
|
} catch (error) {
|
|
11079
11077
|
if (errorCode(error) === "ENOENT") return null;
|
|
11080
11078
|
throw error;
|
|
@@ -11082,12 +11080,12 @@ function readGeneration(directory, number3) {
|
|
|
11082
11080
|
return {
|
|
11083
11081
|
number: number3,
|
|
11084
11082
|
holder: parseIdentity(owner),
|
|
11085
|
-
released: (0,
|
|
11083
|
+
released: (0, import_node_fs22.readdirSync)(directory).includes(name(number3, "released"))
|
|
11086
11084
|
};
|
|
11087
11085
|
}
|
|
11088
11086
|
function readChildren(directory, number3) {
|
|
11089
11087
|
const prefix = name(number3, "child.");
|
|
11090
|
-
return (0,
|
|
11088
|
+
return (0, import_node_fs22.readdirSync)(directory).filter((entry) => entry.startsWith(prefix)).map((entry) => parseIdentity((0, import_node_fs22.readFileSync)(import_node_path23.default.join(directory, entry), "utf8")));
|
|
11091
11089
|
}
|
|
11092
11090
|
function groupAlive(table, leader) {
|
|
11093
11091
|
const row = table.find((candidate) => candidate.pid === leader.pid);
|
|
@@ -11101,7 +11099,7 @@ async function withSwiftRootLock(root, work, signal, wait = true) {
|
|
|
11101
11099
|
"swift-root-locks",
|
|
11102
11100
|
(0, import_node_crypto12.createHash)("sha256").update(root).digest("hex").slice(0, 32)
|
|
11103
11101
|
);
|
|
11104
|
-
(0,
|
|
11102
|
+
(0, import_node_fs22.mkdirSync)(directory, { recursive: true });
|
|
11105
11103
|
const token = (0, import_node_crypto12.randomUUID)();
|
|
11106
11104
|
const owner = JSON.stringify(ownIdentity(process.pid));
|
|
11107
11105
|
const pending = import_node_path23.default.join(directory, `pending.${token}`);
|
|
@@ -11128,26 +11126,26 @@ async function withSwiftRootLock(root, work, signal, wait = true) {
|
|
|
11128
11126
|
}
|
|
11129
11127
|
}
|
|
11130
11128
|
}
|
|
11131
|
-
(0,
|
|
11129
|
+
(0, import_node_fs22.writeFileSync)(pending, owner);
|
|
11132
11130
|
try {
|
|
11133
|
-
(0,
|
|
11131
|
+
(0, import_node_fs22.linkSync)(pending, import_node_path23.default.join(directory, name(newest + 1, "owner")));
|
|
11134
11132
|
} catch (error) {
|
|
11135
11133
|
if (errorCode(error) === "EEXIST") continue;
|
|
11136
11134
|
throw error;
|
|
11137
11135
|
} finally {
|
|
11138
|
-
(0,
|
|
11136
|
+
(0, import_node_fs22.rmSync)(pending, { force: true });
|
|
11139
11137
|
}
|
|
11140
11138
|
const numbers = generationNumbers(directory);
|
|
11141
11139
|
if (numbers.at(-1) !== newest + 1) {
|
|
11142
|
-
(0,
|
|
11140
|
+
(0, import_node_fs22.rmSync)(import_node_path23.default.join(directory, name(newest + 1, "owner")), { force: true });
|
|
11143
11141
|
continue;
|
|
11144
11142
|
}
|
|
11145
11143
|
held = newest + 1;
|
|
11146
11144
|
for (const number3 of numbers)
|
|
11147
11145
|
if (number3 < held) {
|
|
11148
|
-
for (const entry of (0,
|
|
11146
|
+
for (const entry of (0, import_node_fs22.readdirSync)(directory))
|
|
11149
11147
|
if (entry.startsWith(name(number3, "")))
|
|
11150
|
-
(0,
|
|
11148
|
+
(0, import_node_fs22.rmSync)(import_node_path23.default.join(directory, entry), { force: true });
|
|
11151
11149
|
}
|
|
11152
11150
|
break;
|
|
11153
11151
|
}
|
|
@@ -11158,10 +11156,10 @@ async function withSwiftRootLock(root, work, signal, wait = true) {
|
|
|
11158
11156
|
if (child.pid === void 0) throw new Error("could not register compiler process");
|
|
11159
11157
|
const childPending = `${pending}.child.${index}`;
|
|
11160
11158
|
try {
|
|
11161
|
-
(0,
|
|
11162
|
-
(0,
|
|
11159
|
+
(0, import_node_fs22.writeFileSync)(childPending, JSON.stringify(ownIdentity(child.pid)));
|
|
11160
|
+
(0, import_node_fs22.linkSync)(childPending, import_node_path23.default.join(directory, name(held, `child.${index}`)));
|
|
11163
11161
|
} finally {
|
|
11164
|
-
(0,
|
|
11162
|
+
(0, import_node_fs22.rmSync)(childPending, { force: true });
|
|
11165
11163
|
}
|
|
11166
11164
|
},
|
|
11167
11165
|
spawn(command, args, options, companion) {
|
|
@@ -11192,7 +11190,7 @@ async function withSwiftRootLock(root, work, signal, wait = true) {
|
|
|
11192
11190
|
return await work(lease);
|
|
11193
11191
|
} finally {
|
|
11194
11192
|
await Promise.all(children.map((child) => terminateProcessGroup(child, "SIGKILL", 0)));
|
|
11195
|
-
(0,
|
|
11193
|
+
(0, import_node_fs22.writeFileSync)(import_node_path23.default.join(directory, name(held, "released")), "");
|
|
11196
11194
|
}
|
|
11197
11195
|
}
|
|
11198
11196
|
|
|
@@ -11385,17 +11383,17 @@ function isSwiftResourceBundles(value) {
|
|
|
11385
11383
|
}
|
|
11386
11384
|
|
|
11387
11385
|
// src/write-build-file.ts
|
|
11388
|
-
var
|
|
11386
|
+
var import_node_fs23 = require("node:fs");
|
|
11389
11387
|
var import_node_path25 = __toESM(require("node:path"), 1);
|
|
11390
11388
|
function writeBuildFile(file, contents) {
|
|
11391
|
-
if ((0,
|
|
11389
|
+
if ((0, import_node_fs23.existsSync)(file) && (typeof contents === "string" ? (0, import_node_fs23.readFileSync)(file, "utf8") === contents : (0, import_node_fs23.readFileSync)(file).equals(contents)))
|
|
11392
11390
|
return;
|
|
11393
|
-
(0,
|
|
11394
|
-
(0,
|
|
11391
|
+
(0, import_node_fs23.mkdirSync)(import_node_path25.default.dirname(file), { recursive: true });
|
|
11392
|
+
(0, import_node_fs23.writeFileSync)(file, contents);
|
|
11395
11393
|
}
|
|
11396
11394
|
|
|
11397
11395
|
// src/xcode-header-search.ts
|
|
11398
|
-
var
|
|
11396
|
+
var import_node_fs24 = __toESM(require("node:fs"), 1);
|
|
11399
11397
|
var import_node_path26 = __toESM(require("node:path"), 1);
|
|
11400
11398
|
function headerMap(entries) {
|
|
11401
11399
|
const unique = /* @__PURE__ */ new Map();
|
|
@@ -11439,7 +11437,7 @@ function headerMap(entries) {
|
|
|
11439
11437
|
return Buffer.concat([table, ...strings]);
|
|
11440
11438
|
}
|
|
11441
11439
|
function writeXcodeHeaderSearch(directory, targets, headerAliases = {}) {
|
|
11442
|
-
|
|
11440
|
+
import_node_fs24.default.mkdirSync(directory, { recursive: true });
|
|
11443
11441
|
const productDirectories = /* @__PURE__ */ new Map();
|
|
11444
11442
|
for (const [product, original] of new Map([
|
|
11445
11443
|
...Object.entries(headerAliases),
|
|
@@ -11595,8 +11593,8 @@ function swiftBuilderHopTimeoutMs(compileTimeoutMs) {
|
|
|
11595
11593
|
}
|
|
11596
11594
|
function swiftDistributionAt(root) {
|
|
11597
11595
|
const file = import_node_path27.default.join(root, SWIFT_DISTRIBUTION_MANIFEST);
|
|
11598
|
-
if (!(0,
|
|
11599
|
-
return parseSwiftDistributionManifest(JSON.parse((0,
|
|
11596
|
+
if (!(0, import_node_fs25.existsSync)(file)) return null;
|
|
11597
|
+
return parseSwiftDistributionManifest(JSON.parse((0, import_node_fs25.readFileSync)(file, "utf8")));
|
|
11600
11598
|
}
|
|
11601
11599
|
function swiftModuleInterface(moduleRoot, name2, interfaceRoot) {
|
|
11602
11600
|
if (swiftDistributionAt(moduleRoot)) {
|
|
@@ -11604,17 +11602,17 @@ function swiftModuleInterface(moduleRoot, name2, interfaceRoot) {
|
|
|
11604
11602
|
interfaceRoot ?? import_node_path27.default.join(moduleRoot, "modules"),
|
|
11605
11603
|
`${name2}-Swift.h`
|
|
11606
11604
|
);
|
|
11607
|
-
if (!(0,
|
|
11608
|
-
const header = clangInterfaceHeader((0,
|
|
11605
|
+
if (!(0, import_node_fs25.existsSync)(file)) return null;
|
|
11606
|
+
const header = clangInterfaceHeader((0, import_node_fs25.readFileSync)(file, "utf8"));
|
|
11609
11607
|
return { declared: swiftInterfaceDeclarations(header), header };
|
|
11610
11608
|
}
|
|
11611
11609
|
const sources = import_node_path27.default.join(moduleRoot, "Sources", name2);
|
|
11612
11610
|
const built = import_node_path27.default.join(moduleRoot, ".build/host", `${name2}-Swift.h`);
|
|
11613
|
-
if (!(0,
|
|
11611
|
+
if (!(0, import_node_fs25.existsSync)(sources) || !(0, import_node_fs25.existsSync)(built)) return null;
|
|
11614
11612
|
const declared = /* @__PURE__ */ new Set();
|
|
11615
|
-
for (const file of (0,
|
|
11613
|
+
for (const file of (0, import_node_fs25.readdirSync)(sources, { recursive: true, encoding: "utf8" }))
|
|
11616
11614
|
if (file.endsWith(".swift"))
|
|
11617
|
-
for (const [, objc, subclass] of (0,
|
|
11615
|
+
for (const [, objc, subclass] of (0, import_node_fs25.readFileSync)(
|
|
11618
11616
|
import_node_path27.default.join(sources, file),
|
|
11619
11617
|
"utf8"
|
|
11620
11618
|
).matchAll(
|
|
@@ -11622,7 +11620,7 @@ function swiftModuleInterface(moduleRoot, name2, interfaceRoot) {
|
|
|
11622
11620
|
))
|
|
11623
11621
|
declared.add(objc ?? subclass);
|
|
11624
11622
|
if (declared.size === 0) return null;
|
|
11625
|
-
return { declared, header: clangInterfaceHeader((0,
|
|
11623
|
+
return { declared, header: clangInterfaceHeader((0, import_node_fs25.readFileSync)(built, "utf8")) };
|
|
11626
11624
|
}
|
|
11627
11625
|
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").replace(/\b__attribute__\(\(objc_subclassing_restricted\)\)\s*/g, "");
|
|
11628
11626
|
var swiftInterfaceDeclarations = (header) => /* @__PURE__ */ new Set([
|
|
@@ -11689,7 +11687,7 @@ function swiftObjCSelectorOptions(moduleRoot) {
|
|
|
11689
11687
|
for (const framework of ["UIKitCore", "WebKit"])
|
|
11690
11688
|
for (const [name2, members] of Object.entries(
|
|
11691
11689
|
JSON.parse(
|
|
11692
|
-
(0,
|
|
11690
|
+
(0, import_node_fs25.readFileSync)(
|
|
11693
11691
|
import_node_path27.default.join(moduleRoot, "Sources", framework, "ObjCSelectors.json"),
|
|
11694
11692
|
"utf8"
|
|
11695
11693
|
)
|
|
@@ -11697,11 +11695,11 @@ function swiftObjCSelectorOptions(moduleRoot) {
|
|
|
11697
11695
|
))
|
|
11698
11696
|
classes[name2] = [...classes[name2] ?? [], ...members];
|
|
11699
11697
|
map = import_node_path27.default.join(moduleRoot, ".build", SWIFT_DISTRIBUTION_OBJC_SELECTORS);
|
|
11700
|
-
(0,
|
|
11698
|
+
(0, import_node_fs25.mkdirSync)(import_node_path27.default.dirname(map), { recursive: true });
|
|
11701
11699
|
const partial = `${map}.${(0, import_node_crypto13.randomUUID)()}`;
|
|
11702
|
-
(0,
|
|
11700
|
+
(0, import_node_fs25.writeFileSync)(partial, `${JSON.stringify({ classes }, null, 2)}
|
|
11703
11701
|
`);
|
|
11704
|
-
(0,
|
|
11702
|
+
(0, import_node_fs25.renameSync)(partial, map);
|
|
11705
11703
|
}
|
|
11706
11704
|
return ["-Xswiftc", "-Xllvm", "-Xswiftc", `-peach-objc-selector-map=${map}`];
|
|
11707
11705
|
}
|
|
@@ -11735,7 +11733,7 @@ function swiftModuleInputFiles(root) {
|
|
|
11735
11733
|
"toolchain.json"
|
|
11736
11734
|
];
|
|
11737
11735
|
const walk = (dir) => {
|
|
11738
|
-
for (const entry of (0,
|
|
11736
|
+
for (const entry of (0, import_node_fs25.readdirSync)(import_node_path27.default.join(root, dir), {
|
|
11739
11737
|
withFileTypes: true
|
|
11740
11738
|
})) {
|
|
11741
11739
|
const relative = `${dir}/${entry.name}`;
|
|
@@ -11758,7 +11756,7 @@ function swiftMacroPlugins(moduleRoot, dir = import_node_path27.default.join(mod
|
|
|
11758
11756
|
stale: false
|
|
11759
11757
|
};
|
|
11760
11758
|
const release = JSON.parse(
|
|
11761
|
-
(0,
|
|
11759
|
+
(0, import_node_fs25.readFileSync)(import_node_path27.default.join(moduleRoot, "toolchain.json"), "utf8")
|
|
11762
11760
|
).release;
|
|
11763
11761
|
const compilerStamp = import_node_path27.default.join(dir, "compiler-release");
|
|
11764
11762
|
const pluginScript = import_node_path27.default.join(moduleRoot, "scripts/build-preview-plugin.sh");
|
|
@@ -11787,8 +11785,8 @@ function swiftMacroPlugins(moduleRoot, dir = import_node_path27.default.join(mod
|
|
|
11787
11785
|
return {
|
|
11788
11786
|
libraries: plugins.map(({ library }) => library),
|
|
11789
11787
|
executables: [expoPlugin],
|
|
11790
|
-
stale: !(0,
|
|
11791
|
-
({ library, sources }) => !(0,
|
|
11788
|
+
stale: !(0, import_node_fs25.existsSync)(compilerStamp) || !(0, import_node_fs25.existsSync)(expoPlugin) || (0, import_node_fs25.statSync)(pluginScript).mtimeMs > (0, import_node_fs25.statSync)(expoPlugin).mtimeMs || (0, import_node_fs25.readFileSync)(compilerStamp, "utf8").trim() !== release || plugins.some(
|
|
11789
|
+
({ library, sources }) => !(0, import_node_fs25.existsSync)(library) || sources.some((source) => (0, import_node_fs25.statSync)(source).mtimeMs > (0, import_node_fs25.statSync)(library).mtimeMs)
|
|
11792
11790
|
)
|
|
11793
11791
|
};
|
|
11794
11792
|
}
|
|
@@ -11804,7 +11802,7 @@ async function ensureMacroPlugins(moduleRoot, toolchainBin, release, signal, lea
|
|
|
11804
11802
|
],
|
|
11805
11803
|
{ signal, lease }
|
|
11806
11804
|
);
|
|
11807
|
-
(0,
|
|
11805
|
+
(0, import_node_fs25.writeFileSync)(
|
|
11808
11806
|
import_node_path27.default.join(import_node_path27.default.dirname(libraries[0]), "compiler-release"),
|
|
11809
11807
|
`${release}
|
|
11810
11808
|
`
|
|
@@ -11821,7 +11819,7 @@ function swiftModuleDigest(root) {
|
|
|
11821
11819
|
const files = swiftModuleInputFiles(root);
|
|
11822
11820
|
const stampHash = (0, import_node_crypto13.createHash)("sha256");
|
|
11823
11821
|
for (const file of files) {
|
|
11824
|
-
const stat = (0,
|
|
11822
|
+
const stat = (0, import_node_fs25.statSync)(import_node_path27.default.join(root, file), { bigint: true });
|
|
11825
11823
|
stampHash.update(file);
|
|
11826
11824
|
stampHash.update(
|
|
11827
11825
|
`${stat.dev}:${stat.ino}:${stat.size}:${stat.mtimeNs}:${stat.ctimeNs}
|
|
@@ -11836,8 +11834,8 @@ function swiftModuleDigest(root) {
|
|
|
11836
11834
|
"swift-module-digests",
|
|
11837
11835
|
`${(0, import_node_crypto13.createHash)("sha256").update(root).digest("hex")}.json`
|
|
11838
11836
|
);
|
|
11839
|
-
if ((0,
|
|
11840
|
-
const saved = JSON.parse((0,
|
|
11837
|
+
if ((0, import_node_fs25.existsSync)(record)) {
|
|
11838
|
+
const saved = JSON.parse((0, import_node_fs25.readFileSync)(record, "utf8"));
|
|
11841
11839
|
if (saved && typeof saved === "object" && Reflect.get(saved, "stamp") === stamp && typeof Reflect.get(saved, "digest") === "string") {
|
|
11842
11840
|
const digest2 = Buffer.from(String(Reflect.get(saved, "digest")), "hex");
|
|
11843
11841
|
linkedModuleDigests.set(root, { stamp, digest: digest2 });
|
|
@@ -11848,15 +11846,15 @@ function swiftModuleDigest(root) {
|
|
|
11848
11846
|
for (const file of files) {
|
|
11849
11847
|
hash.update((0, import_node_crypto13.createHash)("sha256").update(file).digest());
|
|
11850
11848
|
hash.update(
|
|
11851
|
-
(0, import_node_crypto13.createHash)("sha256").update((0,
|
|
11849
|
+
(0, import_node_crypto13.createHash)("sha256").update((0, import_node_fs25.readFileSync)(import_node_path27.default.join(root, file))).digest()
|
|
11852
11850
|
);
|
|
11853
11851
|
}
|
|
11854
11852
|
const digest = hash.digest();
|
|
11855
11853
|
linkedModuleDigests.set(root, { stamp, digest });
|
|
11856
|
-
(0,
|
|
11854
|
+
(0, import_node_fs25.mkdirSync)(import_node_path27.default.dirname(record), { recursive: true });
|
|
11857
11855
|
const partial = `${record}.${process.pid}.${(0, import_node_crypto13.randomUUID)()}`;
|
|
11858
|
-
(0,
|
|
11859
|
-
(0,
|
|
11856
|
+
(0, import_node_fs25.writeFileSync)(partial, JSON.stringify({ stamp, digest: digest.toString("hex") }));
|
|
11857
|
+
(0, import_node_fs25.renameSync)(partial, record);
|
|
11860
11858
|
return digest;
|
|
11861
11859
|
}
|
|
11862
11860
|
function swiftProjectBuildKey(moduleRoot, release) {
|
|
@@ -12060,7 +12058,7 @@ function swiftImportNames(contents, available) {
|
|
|
12060
12058
|
function swiftPeachModules(moduleRoot) {
|
|
12061
12059
|
const distribution = swiftDistributionAt(moduleRoot);
|
|
12062
12060
|
return distribution ? distribution.modules : swiftManifestDeclarations(
|
|
12063
|
-
(0,
|
|
12061
|
+
(0, import_node_fs25.readFileSync)(import_node_path27.default.join(moduleRoot, "Package.swift"), "utf8")
|
|
12064
12062
|
).filter((target) => !target.executable && !target.path.startsWith("fixtures/")).map((target) => target.name);
|
|
12065
12063
|
}
|
|
12066
12064
|
var sdkPaths = /* @__PURE__ */ new Map();
|
|
@@ -12096,7 +12094,7 @@ function swiftSdkPaths(moduleRoot, toolchainBin) {
|
|
|
12096
12094
|
if (!Array.isArray(toolsets) || !toolsets.every((value) => typeof value === "string"))
|
|
12097
12095
|
throw new Error(`swift sdk ${sdk} reports invalid toolset paths`);
|
|
12098
12096
|
for (const toolset of toolsets) {
|
|
12099
|
-
const config = JSON.parse((0,
|
|
12097
|
+
const config = JSON.parse((0, import_node_fs25.readFileSync)(toolset, "utf8"));
|
|
12100
12098
|
if (!config || typeof config !== "object" || !("swiftCompiler" in config)) continue;
|
|
12101
12099
|
const compiler = config.swiftCompiler;
|
|
12102
12100
|
if (!compiler || typeof compiler !== "object" || !("extraCLIOptions" in compiler))
|
|
@@ -12158,23 +12156,23 @@ function swiftOverlayFrameworks(moduleRoot, toolchainBin) {
|
|
|
12158
12156
|
const swiftModules = new Set(swiftPeachModules(moduleRoot));
|
|
12159
12157
|
const result = /* @__PURE__ */ new Set();
|
|
12160
12158
|
const include = import_node_path27.default.join(darwin, "usr/include");
|
|
12161
|
-
for (const entry of (0,
|
|
12159
|
+
for (const entry of (0, import_node_fs25.readdirSync)(include))
|
|
12162
12160
|
if (entry.endsWith(".modulemap"))
|
|
12163
12161
|
addSwiftOverlayFrameworks(
|
|
12164
|
-
(0,
|
|
12162
|
+
(0, import_node_fs25.readFileSync)(import_node_path27.default.join(include, entry), "utf8"),
|
|
12165
12163
|
swiftModules,
|
|
12166
12164
|
result
|
|
12167
12165
|
);
|
|
12168
|
-
for (const entry of (0,
|
|
12166
|
+
for (const entry of (0, import_node_fs25.readdirSync)(resources)) {
|
|
12169
12167
|
const map = import_node_path27.default.join(resources, entry, "module.modulemap");
|
|
12170
|
-
if ((0,
|
|
12171
|
-
addSwiftOverlayFrameworks((0,
|
|
12168
|
+
if ((0, import_node_fs25.existsSync)(map))
|
|
12169
|
+
addSwiftOverlayFrameworks((0, import_node_fs25.readFileSync)(map, "utf8"), swiftModules, result);
|
|
12172
12170
|
}
|
|
12173
12171
|
for (const directory of frameworks)
|
|
12174
|
-
for (const entry of (0,
|
|
12172
|
+
for (const entry of (0, import_node_fs25.readdirSync)(directory)) {
|
|
12175
12173
|
const map = import_node_path27.default.join(directory, entry, "Modules/module.modulemap");
|
|
12176
|
-
if ((0,
|
|
12177
|
-
addSwiftOverlayFrameworks((0,
|
|
12174
|
+
if ((0, import_node_fs25.existsSync)(map))
|
|
12175
|
+
addSwiftOverlayFrameworks((0, import_node_fs25.readFileSync)(map, "utf8"), swiftModules, result);
|
|
12178
12176
|
}
|
|
12179
12177
|
sdkOverlayFrameworks.set(key, result);
|
|
12180
12178
|
return result;
|
|
@@ -12197,8 +12195,8 @@ function swiftAvailableModules(moduleRoot, toolchainBin) {
|
|
|
12197
12195
|
})
|
|
12198
12196
|
]);
|
|
12199
12197
|
for (const map of maps) {
|
|
12200
|
-
if (!(0,
|
|
12201
|
-
const contents = (0,
|
|
12198
|
+
if (!(0, import_node_fs25.existsSync)(map)) continue;
|
|
12199
|
+
const contents = (0, import_node_fs25.readFileSync)(map, "utf8");
|
|
12202
12200
|
for (const match of contents.matchAll(
|
|
12203
12201
|
/^(?:explicit\s+)?(?:framework\s+)?module\s+([A-Za-z_]\w*)/gm
|
|
12204
12202
|
))
|
|
@@ -12206,14 +12204,14 @@ function swiftAvailableModules(moduleRoot, toolchainBin) {
|
|
|
12206
12204
|
for (const match of contents.matchAll(/^\s*extern\s+module\s+\w+\s+"([^"]+)"/gm))
|
|
12207
12205
|
maps.add(import_node_path27.default.resolve(import_node_path27.default.dirname(map), match[1]));
|
|
12208
12206
|
}
|
|
12209
|
-
for (const entry of (0,
|
|
12207
|
+
for (const entry of (0, import_node_fs25.readdirSync)(import_node_path27.default.join(resources, "wasi"))) {
|
|
12210
12208
|
if (entry.endsWith(".swiftmodule"))
|
|
12211
12209
|
modules.add(entry.slice(0, -".swiftmodule".length));
|
|
12212
12210
|
}
|
|
12213
|
-
for (const entry of (0,
|
|
12211
|
+
for (const entry of (0, import_node_fs25.readdirSync)(resources)) {
|
|
12214
12212
|
const map = import_node_path27.default.join(resources, entry, "module.modulemap");
|
|
12215
|
-
if (!(0,
|
|
12216
|
-
for (const match of (0,
|
|
12213
|
+
if (!(0, import_node_fs25.existsSync)(map)) continue;
|
|
12214
|
+
for (const match of (0, import_node_fs25.readFileSync)(map, "utf8").matchAll(/^module\s+([A-Za-z_]\w*)/gm))
|
|
12217
12215
|
modules.add(match[1]);
|
|
12218
12216
|
}
|
|
12219
12217
|
for (const libc of [
|
|
@@ -12223,18 +12221,18 @@ function swiftAvailableModules(moduleRoot, toolchainBin) {
|
|
|
12223
12221
|
"usr/include"
|
|
12224
12222
|
)
|
|
12225
12223
|
])
|
|
12226
|
-
for (const entry of (0,
|
|
12224
|
+
for (const entry of (0, import_node_fs25.readdirSync)(libc)) {
|
|
12227
12225
|
if (!entry.endsWith(".modulemap")) continue;
|
|
12228
|
-
for (const match of (0,
|
|
12226
|
+
for (const match of (0, import_node_fs25.readFileSync)(import_node_path27.default.join(libc, entry), "utf8").matchAll(
|
|
12229
12227
|
/^module\s+([A-Za-z_]\w*)/gm
|
|
12230
12228
|
))
|
|
12231
12229
|
modules.add(match[1]);
|
|
12232
12230
|
}
|
|
12233
12231
|
for (const directory of frameworks) {
|
|
12234
|
-
for (const entry of (0,
|
|
12232
|
+
for (const entry of (0, import_node_fs25.readdirSync)(directory)) {
|
|
12235
12233
|
const map = import_node_path27.default.join(directory, entry, "Modules/module.modulemap");
|
|
12236
|
-
if (!(0,
|
|
12237
|
-
for (const match of (0,
|
|
12234
|
+
if (!(0, import_node_fs25.existsSync)(map)) continue;
|
|
12235
|
+
for (const match of (0, import_node_fs25.readFileSync)(map, "utf8").matchAll(
|
|
12238
12236
|
/^framework\s+module\s+([A-Za-z_]\w*)/gm
|
|
12239
12237
|
))
|
|
12240
12238
|
modules.add(match[1]);
|
|
@@ -12286,18 +12284,18 @@ function swiftSystemLibraryExclusions(files, targets, distributionModules) {
|
|
|
12286
12284
|
}
|
|
12287
12285
|
function providedModulesPath(root, modules, excluded) {
|
|
12288
12286
|
if (!excluded || excluded.size === 0) return modules;
|
|
12289
|
-
const entries = (0,
|
|
12287
|
+
const entries = (0, import_node_fs25.readdirSync)(modules).filter((entry) => !excluded.has(entry.replace(/\..*$/, ""))).sort();
|
|
12290
12288
|
const key = (0, import_node_crypto13.createHash)("sha256").update(JSON.stringify([modules, entries])).update([...excluded].sort().join("\0")).digest("hex").slice(0, 16);
|
|
12291
12289
|
const directory = import_node_path27.default.join(root, `.peach-modules-${key}`);
|
|
12292
12290
|
const complete = import_node_path27.default.join(directory, ".complete");
|
|
12293
|
-
if (!(0,
|
|
12294
|
-
(0,
|
|
12295
|
-
for (const entry of (0,
|
|
12296
|
-
(0,
|
|
12291
|
+
if (!(0, import_node_fs25.existsSync)(complete)) {
|
|
12292
|
+
(0, import_node_fs25.mkdirSync)(directory, { recursive: true });
|
|
12293
|
+
for (const entry of (0, import_node_fs25.readdirSync)(directory))
|
|
12294
|
+
(0, import_node_fs25.rmSync)(import_node_path27.default.join(directory, entry), { recursive: true, force: true });
|
|
12297
12295
|
for (const entry of entries) {
|
|
12298
|
-
(0,
|
|
12296
|
+
(0, import_node_fs25.symlinkSync)(import_node_path27.default.join(modules, entry), import_node_path27.default.join(directory, entry));
|
|
12299
12297
|
}
|
|
12300
|
-
(0,
|
|
12298
|
+
(0, import_node_fs25.writeFileSync)(complete, "");
|
|
12301
12299
|
}
|
|
12302
12300
|
return directory;
|
|
12303
12301
|
}
|
|
@@ -12470,7 +12468,7 @@ function swiftCrossImportFlags(moduleRoot, distribution) {
|
|
|
12470
12468
|
moduleRoot,
|
|
12471
12469
|
distribution ? "modules" : "cross-import-overlays"
|
|
12472
12470
|
);
|
|
12473
|
-
return (0,
|
|
12471
|
+
return (0, import_node_fs25.readdirSync)(overlayRoot, { encoding: "utf8", recursive: true }).filter((file) => file.endsWith(".swiftoverlay")).sort((left, right) => left.localeCompare(right)).flatMap((file) => [
|
|
12474
12472
|
"-Xfrontend",
|
|
12475
12473
|
"-swift-module-cross-import",
|
|
12476
12474
|
"-Xfrontend",
|
|
@@ -12816,14 +12814,14 @@ function emitSwiftPackageManifest(args) {
|
|
|
12816
12814
|
].join("\n");
|
|
12817
12815
|
}
|
|
12818
12816
|
function syncSwiftTree(base, files) {
|
|
12819
|
-
(0,
|
|
12817
|
+
(0, import_node_fs25.mkdirSync)(base, { recursive: true });
|
|
12820
12818
|
const walk = (dir) => {
|
|
12821
|
-
for (const entry of (0,
|
|
12819
|
+
for (const entry of (0, import_node_fs25.readdirSync)(dir, { withFileTypes: true })) {
|
|
12822
12820
|
const full = import_node_path27.default.join(dir, entry.name);
|
|
12823
12821
|
if (dir === base && (entry.name === ".build" || entry.name.startsWith(".peach-modules-") || entry.name === SWIFT_LINK_STAMP))
|
|
12824
12822
|
continue;
|
|
12825
12823
|
if (entry.isDirectory()) walk(full);
|
|
12826
|
-
else if (!files.has(full)) (0,
|
|
12824
|
+
else if (!files.has(full)) (0, import_node_fs25.rmSync)(full, { force: true });
|
|
12827
12825
|
}
|
|
12828
12826
|
};
|
|
12829
12827
|
walk(base);
|
|
@@ -14289,24 +14287,24 @@ function swiftCodeScan(source) {
|
|
|
14289
14287
|
return { lineStarts: starts, tokens };
|
|
14290
14288
|
}
|
|
14291
14289
|
function prepareSwiftDependency(source, destination, overlayFrameworks) {
|
|
14292
|
-
(0,
|
|
14290
|
+
(0, import_node_fs25.rmSync)(destination, { recursive: true, force: true });
|
|
14293
14291
|
const origins = {};
|
|
14294
14292
|
const moduleMaps = [];
|
|
14295
14293
|
const gather = (from) => {
|
|
14296
|
-
for (const entry of (0,
|
|
14294
|
+
for (const entry of (0, import_node_fs25.readdirSync)(from, { withFileTypes: true })) {
|
|
14297
14295
|
if (entry.name === ".git" || entry.name === ".build" || entry.name === ".swiftpm")
|
|
14298
14296
|
continue;
|
|
14299
14297
|
const file = import_node_path27.default.join(from, entry.name);
|
|
14300
14298
|
if (entry.isDirectory()) gather(file);
|
|
14301
14299
|
else if (entry.isFile() && entry.name.endsWith(".swift"))
|
|
14302
|
-
origins[import_node_path27.default.relative(source, file)] = (0,
|
|
14300
|
+
origins[import_node_path27.default.relative(source, file)] = (0, import_node_fs25.readFileSync)(file, "utf8");
|
|
14303
14301
|
else if (entry.isFile() && entry.name.endsWith(".modulemap"))
|
|
14304
|
-
moduleMaps.push((0,
|
|
14302
|
+
moduleMaps.push((0, import_node_fs25.readFileSync)(file, "utf8"));
|
|
14305
14303
|
}
|
|
14306
14304
|
};
|
|
14307
14305
|
gather(source);
|
|
14308
14306
|
const manifest = import_node_path27.default.join(source, "Package.swift");
|
|
14309
|
-
const targets = (0,
|
|
14307
|
+
const targets = (0, import_node_fs25.existsSync)(manifest) ? swiftManifestTargets((0, import_node_fs25.readFileSync)(manifest, "utf8")) : [];
|
|
14310
14308
|
let dependencyOverlays;
|
|
14311
14309
|
const compiled = compiledSwiftSources(origins, targets, () => {
|
|
14312
14310
|
if (dependencyOverlays) return dependencyOverlays;
|
|
@@ -14324,16 +14322,16 @@ function prepareSwiftDependency(source, destination, overlayFrameworks) {
|
|
|
14324
14322
|
return dependencyOverlays;
|
|
14325
14323
|
});
|
|
14326
14324
|
const copy = (from, to) => {
|
|
14327
|
-
(0,
|
|
14328
|
-
for (const entry of (0,
|
|
14325
|
+
(0, import_node_fs25.mkdirSync)(to, { recursive: true });
|
|
14326
|
+
for (const entry of (0, import_node_fs25.readdirSync)(from, { withFileTypes: true })) {
|
|
14329
14327
|
if (entry.name === ".git" || entry.name === ".build" || entry.name === ".swiftpm")
|
|
14330
14328
|
continue;
|
|
14331
14329
|
const file = import_node_path27.default.join(from, entry.name);
|
|
14332
14330
|
const target = import_node_path27.default.join(to, entry.name);
|
|
14333
14331
|
if (entry.isDirectory()) copy(file, target);
|
|
14334
14332
|
else if (entry.isFile() && entry.name.endsWith(".swift"))
|
|
14335
|
-
(0,
|
|
14336
|
-
else (0,
|
|
14333
|
+
(0, import_node_fs25.writeFileSync)(target, compiled.get(import_node_path27.default.relative(source, file)));
|
|
14334
|
+
else (0, import_node_fs25.cpSync)(file, target, { verbatimSymlinks: true });
|
|
14337
14335
|
}
|
|
14338
14336
|
};
|
|
14339
14337
|
copy(source, destination);
|
|
@@ -14357,14 +14355,14 @@ function clangImportModuleMapFlags(settings, layoutRoot, written, generated) {
|
|
|
14357
14355
|
const directory = import_node_path27.default.join(layoutRoot, ".build", "peach-clang-modulemaps");
|
|
14358
14356
|
return (settings.moduleMaps ?? []).flatMap((map) => {
|
|
14359
14357
|
const headers = import_node_path27.default.join(layoutRoot, map.headers);
|
|
14360
|
-
if (!(0,
|
|
14358
|
+
if (!(0, import_node_fs25.existsSync)(headers)) return [];
|
|
14361
14359
|
const published = import_node_path27.default.join(headers, "module.modulemap");
|
|
14362
|
-
if (searched.has(map.headers) && (0,
|
|
14363
|
-
if (!searched.has(map.headers) && (0,
|
|
14360
|
+
if (searched.has(map.headers) && (0, import_node_fs25.existsSync)(published)) return [];
|
|
14361
|
+
if (!searched.has(map.headers) && (0, import_node_fs25.existsSync)(published))
|
|
14364
14362
|
return [`-fmodule-map-file=${published}`];
|
|
14365
14363
|
const cached = written.get(headers);
|
|
14366
14364
|
if (cached) return [cached];
|
|
14367
|
-
(0,
|
|
14365
|
+
(0, import_node_fs25.mkdirSync)(directory, { recursive: true });
|
|
14368
14366
|
const output = import_node_path27.default.join(directory, `module-${written.size}.modulemap`);
|
|
14369
14367
|
writeBuildFile(
|
|
14370
14368
|
output,
|
|
@@ -14438,7 +14436,7 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
|
|
|
14438
14436
|
}
|
|
14439
14437
|
] : compileTargets(input);
|
|
14440
14438
|
const generatedOwners = new Map(targets.map((target) => [target.name, target.name]));
|
|
14441
|
-
const providedModules = distribution?.modules ?? (prebuilt ? (0,
|
|
14439
|
+
const providedModules = distribution?.modules ?? (prebuilt ? (0, import_node_fs25.readdirSync)(prebuilt.modules).filter((entry) => entry.endsWith(".swiftmodule")).map((entry) => entry.slice(0, -".swiftmodule".length)) : []);
|
|
14442
14440
|
const moduleExcludes = distribution || prebuilt ? /* @__PURE__ */ new Set([
|
|
14443
14441
|
...swiftSystemLibraryExclusions(input.files, targets, providedModules),
|
|
14444
14442
|
...providedModules.filter(
|
|
@@ -14478,15 +14476,15 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
|
|
|
14478
14476
|
}
|
|
14479
14477
|
const headerDirectory = import_node_path27.default.join(layout2.root, ".build", "peach-cxx-headers");
|
|
14480
14478
|
const flattenedHeaders = /* @__PURE__ */ new Set();
|
|
14481
|
-
if ((0,
|
|
14482
|
-
for (const entry of (0,
|
|
14479
|
+
if ((0, import_node_fs25.existsSync)(headerDirectory)) {
|
|
14480
|
+
for (const entry of (0, import_node_fs25.readdirSync)(headerDirectory, { withFileTypes: true }))
|
|
14483
14481
|
if (entry.isDirectory() && !targets.some((target) => target.name === entry.name))
|
|
14484
|
-
(0,
|
|
14482
|
+
(0, import_node_fs25.rmSync)(import_node_path27.default.join(headerDirectory, entry.name), { recursive: true, force: true });
|
|
14485
14483
|
}
|
|
14486
14484
|
let checkedToolchain;
|
|
14487
14485
|
const nativeToolchain = () => {
|
|
14488
14486
|
if (checkedToolchain) return checkedToolchain;
|
|
14489
|
-
const pin = distribution ?? JSON.parse((0,
|
|
14487
|
+
const pin = distribution ?? JSON.parse((0, import_node_fs25.readFileSync)(import_node_path27.default.join(moduleRoot, "toolchain.json"), "utf8"));
|
|
14490
14488
|
checkedToolchain = swiftToolchain(pin.release, swiftModuleSdk(moduleRoot));
|
|
14491
14489
|
return checkedToolchain;
|
|
14492
14490
|
};
|
|
@@ -14902,7 +14900,7 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
|
|
|
14902
14900
|
const origin = settings?.sourceDirectories[file];
|
|
14903
14901
|
if (origin) {
|
|
14904
14902
|
const original = import_node_path27.default.join(layout2.root, origin, import_node_path27.default.posix.basename(file));
|
|
14905
|
-
(0,
|
|
14903
|
+
(0, import_node_fs25.mkdirSync)(import_node_path27.default.dirname(original), { recursive: true });
|
|
14906
14904
|
stageTargetFile(target.name, original, contents, { allowExisting: true });
|
|
14907
14905
|
}
|
|
14908
14906
|
const source = unitSource(file);
|
|
@@ -15132,7 +15130,7 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
|
|
|
15132
15130
|
`extern module ${map.module} ${JSON.stringify(map.published)}
|
|
15133
15131
|
`
|
|
15134
15132
|
);
|
|
15135
|
-
if (native.size > 0) (0,
|
|
15133
|
+
if (native.size > 0) (0, import_node_fs25.mkdirSync)(headerDirectory, { recursive: true });
|
|
15136
15134
|
const headerAliasFlags = Object.keys(input.headerAliases ?? {}).length > 0 ? ["-ivfsoverlay", headerSearch.files[0]] : [];
|
|
15137
15135
|
const nativeHeaderFlags = [...headerAliasFlags];
|
|
15138
15136
|
const originalMaps = /* @__PURE__ */ new Map();
|
|
@@ -15190,7 +15188,7 @@ module ${moduleName}.Swift {
|
|
|
15190
15188
|
swiftModuleInputFiles(moduleRoot).join("\n")
|
|
15191
15189
|
);
|
|
15192
15190
|
if (!distribution) {
|
|
15193
|
-
modulePlan.update((0,
|
|
15191
|
+
modulePlan.update((0, import_node_fs25.readFileSync)(import_node_path27.default.join(moduleRoot, "Package.swift")));
|
|
15194
15192
|
}
|
|
15195
15193
|
const resourcePlan = (0, import_node_crypto13.createHash)("sha256").update(
|
|
15196
15194
|
JSON.stringify(
|
|
@@ -15378,7 +15376,7 @@ module ${moduleName}.Swift {
|
|
|
15378
15376
|
if (file === "Package.swift") continue;
|
|
15379
15377
|
files.set(import_node_path27.default.join(layout2.sources, file), compiled.get(file) ?? contents);
|
|
15380
15378
|
}
|
|
15381
|
-
let manifest = (0,
|
|
15379
|
+
let manifest = (0, import_node_fs25.readFileSync)(
|
|
15382
15380
|
import_node_path27.default.join(moduleRoot, "scripts/contrast-app-Package.swift"),
|
|
15383
15381
|
"utf8"
|
|
15384
15382
|
).replaceAll("__SOOTSIM_SWIFT_PACKAGE__", moduleRoot);
|
|
@@ -15463,7 +15461,7 @@ module ${moduleName}.Swift {
|
|
|
15463
15461
|
const reachesFrameworks = !distribution || swiftImportedModules.has("Foundation") || Object.entries(input.files).some(
|
|
15464
15462
|
([file, source]) => file.endsWith(".swift") && file !== input.entry && file !== "Package.swift" || /\.mm?$/.test(file) || source.includes("dispatch_")
|
|
15465
15463
|
) || [...importedModules].some(
|
|
15466
|
-
(name2) => distribution.modules.includes(name2) && !targets.some((target) => target.name === name2) && !(clangImportedModules.has(name2) && !swiftImportedModules.has(name2) && (0,
|
|
15464
|
+
(name2) => distribution.modules.includes(name2) && !targets.some((target) => target.name === name2) && !(clangImportedModules.has(name2) && !swiftImportedModules.has(name2) && (0, import_node_fs25.existsSync)(
|
|
15467
15465
|
import_node_path27.default.join(swiftSharedSdkRoot(moduleRoot, true), "usr/include", name2)
|
|
15468
15466
|
))
|
|
15469
15467
|
);
|
|
@@ -15645,7 +15643,7 @@ module ${moduleName}.Swift {
|
|
|
15645
15643
|
syncSwiftTree(layout2.root, files);
|
|
15646
15644
|
const dependencies = new Map(
|
|
15647
15645
|
swiftManifestTargets(
|
|
15648
|
-
(0,
|
|
15646
|
+
(0, import_node_fs25.readFileSync)(import_node_path27.default.join(layout2.root, "Package.swift"), "utf8")
|
|
15649
15647
|
).map((target) => [
|
|
15650
15648
|
target.name,
|
|
15651
15649
|
(target.dependencies ?? []).flatMap(
|
|
@@ -15700,7 +15698,7 @@ function outputOf(error) {
|
|
|
15700
15698
|
}
|
|
15701
15699
|
function builtArtifact(layout2) {
|
|
15702
15700
|
const binDir = import_node_path27.default.join(layout2.root, ".build", WASM_TRIPLE, "release");
|
|
15703
|
-
const manifest = (0,
|
|
15701
|
+
const manifest = (0, import_node_fs25.readFileSync)(import_node_path27.default.join(layout2.root, "Package.swift"), "utf8");
|
|
15704
15702
|
const executable = swiftManifestTargets(manifest).find((target) => target.executable);
|
|
15705
15703
|
if (executable === void 0) {
|
|
15706
15704
|
throw new Error("swift-compile: the written manifest names no executable target");
|
|
@@ -15745,12 +15743,12 @@ function serialize(root, work, signal) {
|
|
|
15745
15743
|
function readCompiledArtifact(directory, hash) {
|
|
15746
15744
|
try {
|
|
15747
15745
|
const receipt = JSON.parse(
|
|
15748
|
-
(0,
|
|
15746
|
+
(0, import_node_fs25.readFileSync)(import_node_path27.default.join(directory, "artifact.json"), "utf8")
|
|
15749
15747
|
);
|
|
15750
15748
|
if (!receipt || typeof receipt !== "object" || !("hash" in receipt) || receipt.hash !== hash || !("icu" in receipt) || typeof receipt.icu !== "string" || !("wasm" in receipt) || typeof receipt.wasm !== "string")
|
|
15751
15749
|
return null;
|
|
15752
|
-
const bytes = (0,
|
|
15753
|
-
const gzip2 = (0,
|
|
15750
|
+
const bytes = (0, import_node_fs25.readFileSync)(import_node_path27.default.join(directory, "app.wasm"));
|
|
15751
|
+
const gzip2 = (0, import_node_fs25.readFileSync)(import_node_path27.default.join(directory, "icu.gz"));
|
|
15754
15752
|
if ((0, import_node_crypto13.createHash)("sha256").update(bytes).digest("hex") !== receipt.wasm || (0, import_node_crypto13.createHash)("sha256").update(gzip2).digest("hex") !== receipt.icu || bytes.length < 8 || bytes.readUInt32LE(0) !== 1836278016 || bytes.readUInt32LE(4) !== 1)
|
|
15755
15753
|
return null;
|
|
15756
15754
|
return { hash, bytes, icu: { sha256: receipt.icu, gzip: gzip2 } };
|
|
@@ -15762,12 +15760,12 @@ function readCompiledArtifact(directory, hash) {
|
|
|
15762
15760
|
}
|
|
15763
15761
|
function saveCompiledArtifact(root, artifact) {
|
|
15764
15762
|
const directory = import_node_path27.default.join(root, "artifact");
|
|
15765
|
-
(0,
|
|
15766
|
-
const pending = (0,
|
|
15763
|
+
(0, import_node_fs25.mkdirSync)(directory, { recursive: true });
|
|
15764
|
+
const pending = (0, import_node_fs25.mkdtempSync)(import_node_path27.default.join(root, ".artifact-"));
|
|
15767
15765
|
try {
|
|
15768
|
-
(0,
|
|
15769
|
-
(0,
|
|
15770
|
-
(0,
|
|
15766
|
+
(0, import_node_fs25.writeFileSync)(import_node_path27.default.join(pending, "app.wasm"), artifact.bytes);
|
|
15767
|
+
(0, import_node_fs25.writeFileSync)(import_node_path27.default.join(pending, "icu.gz"), artifact.icu.gzip);
|
|
15768
|
+
(0, import_node_fs25.writeFileSync)(
|
|
15771
15769
|
import_node_path27.default.join(pending, "artifact.json"),
|
|
15772
15770
|
JSON.stringify({
|
|
15773
15771
|
hash: artifact.hash,
|
|
@@ -15776,10 +15774,10 @@ function saveCompiledArtifact(root, artifact) {
|
|
|
15776
15774
|
})
|
|
15777
15775
|
);
|
|
15778
15776
|
for (const file of ["app.wasm", "icu.gz", "artifact.json"]) {
|
|
15779
|
-
(0,
|
|
15777
|
+
(0, import_node_fs25.renameSync)(import_node_path27.default.join(pending, file), import_node_path27.default.join(directory, file));
|
|
15780
15778
|
}
|
|
15781
15779
|
} finally {
|
|
15782
|
-
(0,
|
|
15780
|
+
(0, import_node_fs25.rmSync)(pending, { recursive: true, force: true });
|
|
15783
15781
|
}
|
|
15784
15782
|
}
|
|
15785
15783
|
var SHARED_ARTIFACT_BUDGET_BYTES = 4 * 1024 ** 3;
|
|
@@ -15790,14 +15788,14 @@ function vanished(error) {
|
|
|
15790
15788
|
}
|
|
15791
15789
|
function renewSharedArtifact(sharedRoot) {
|
|
15792
15790
|
try {
|
|
15793
|
-
(0,
|
|
15791
|
+
(0, import_node_fs25.utimesSync)(sharedRoot, /* @__PURE__ */ new Date(), /* @__PURE__ */ new Date());
|
|
15794
15792
|
} catch (error) {
|
|
15795
15793
|
if (!vanished(error)) throw error;
|
|
15796
15794
|
}
|
|
15797
15795
|
}
|
|
15798
15796
|
function pruneSharedArtifacts(parent, keep) {
|
|
15799
15797
|
const entries = [];
|
|
15800
|
-
for (const name2 of (0,
|
|
15798
|
+
for (const name2 of (0, import_node_fs25.readdirSync)(parent)) {
|
|
15801
15799
|
const directory = import_node_path27.default.join(parent, name2);
|
|
15802
15800
|
if (name2.startsWith(RETIRED_PREFIX)) {
|
|
15803
15801
|
reapRetiredCacheDirectory(parent, name2);
|
|
@@ -15805,14 +15803,14 @@ function pruneSharedArtifacts(parent, keep) {
|
|
|
15805
15803
|
}
|
|
15806
15804
|
try {
|
|
15807
15805
|
let bytes = 0;
|
|
15808
|
-
for (const file of (0,
|
|
15806
|
+
for (const file of (0, import_node_fs25.readdirSync)(import_node_path27.default.join(directory, "artifact"))) {
|
|
15809
15807
|
try {
|
|
15810
|
-
bytes += (0,
|
|
15808
|
+
bytes += (0, import_node_fs25.statSync)(import_node_path27.default.join(directory, "artifact", file)).size;
|
|
15811
15809
|
} catch (error) {
|
|
15812
15810
|
if (!vanished(error)) throw error;
|
|
15813
15811
|
}
|
|
15814
15812
|
}
|
|
15815
|
-
entries.push({ directory, used: (0,
|
|
15813
|
+
entries.push({ directory, used: (0, import_node_fs25.statSync)(directory).mtimeMs, bytes });
|
|
15816
15814
|
} catch (error) {
|
|
15817
15815
|
if (!vanished(error)) throw error;
|
|
15818
15816
|
}
|
|
@@ -15827,8 +15825,8 @@ function pruneSharedArtifacts(parent, keep) {
|
|
|
15827
15825
|
`${RETIRED_PREFIX}${process.pid}-${import_node_path27.default.basename(entry.directory)}`
|
|
15828
15826
|
);
|
|
15829
15827
|
try {
|
|
15830
|
-
if ((0,
|
|
15831
|
-
(0,
|
|
15828
|
+
if ((0, import_node_fs25.statSync)(entry.directory).mtimeMs !== entry.used) continue;
|
|
15829
|
+
(0, import_node_fs25.renameSync)(entry.directory, retired);
|
|
15832
15830
|
} catch (error) {
|
|
15833
15831
|
if (vanished(error)) continue;
|
|
15834
15832
|
throw error;
|
|
@@ -15868,7 +15866,7 @@ function frameworkLibraryTargets(manifest) {
|
|
|
15868
15866
|
}
|
|
15869
15867
|
function linkedFrameworkTargets(moduleRoot, input) {
|
|
15870
15868
|
const libraries = frameworkLibraryTargets(
|
|
15871
|
-
(0,
|
|
15869
|
+
(0, import_node_fs25.readFileSync)(import_node_path27.default.join(moduleRoot, "Package.swift"), "utf8")
|
|
15872
15870
|
);
|
|
15873
15871
|
const targets = compileTargets(input);
|
|
15874
15872
|
const planning = targets.length > 0 ? targets : [{ name: "App", path: "." }];
|
|
@@ -15885,7 +15883,7 @@ function linkedFrameworkTargets(moduleRoot, input) {
|
|
|
15885
15883
|
for (const name2 of [...siblings.values()].flat())
|
|
15886
15884
|
if (libraries.has(name2) && !planning.some((target) => target.name === name2))
|
|
15887
15885
|
reach(name2);
|
|
15888
|
-
const manifest = (0,
|
|
15886
|
+
const manifest = (0, import_node_fs25.readFileSync)(import_node_path27.default.join(moduleRoot, "Package.swift"), "utf8");
|
|
15889
15887
|
const targetDependencies = /* @__PURE__ */ new Map();
|
|
15890
15888
|
for (const match of manifest.matchAll(
|
|
15891
15889
|
/\.target\(\s*name:\s*"([^"]+)"\s*,\s*dependencies:\s*\[([^\]]*)\]/g
|
|
@@ -15903,11 +15901,11 @@ function linkedFrameworkTargets(moduleRoot, input) {
|
|
|
15903
15901
|
for (const name2 of reached)
|
|
15904
15902
|
for (const member of libraries.get(name2) ?? []) build(member);
|
|
15905
15903
|
const overlays = import_node_path27.default.join(moduleRoot, "cross-import-overlays");
|
|
15906
|
-
for (const directory of (0,
|
|
15904
|
+
for (const directory of (0, import_node_fs25.readdirSync)(overlays)) {
|
|
15907
15905
|
const companion = import_node_path27.default.basename(directory, ".swiftcrossimport");
|
|
15908
15906
|
if (!built.has(companion)) continue;
|
|
15909
15907
|
const declaration = import_node_path27.default.join(overlays, directory, "SwiftUI.swiftoverlay");
|
|
15910
|
-
for (const match of (0,
|
|
15908
|
+
for (const match of (0, import_node_fs25.readFileSync)(declaration, "utf8").matchAll(
|
|
15911
15909
|
/^\s*- name: ([A-Za-z_]\w*)\s*$/gm
|
|
15912
15910
|
))
|
|
15913
15911
|
reach(match[1]);
|
|
@@ -15961,12 +15959,12 @@ ${dependencies}
|
|
|
15961
15959
|
)
|
|
15962
15960
|
`;
|
|
15963
15961
|
const sourceDir = import_node_path27.default.join(linkRoot, "Sources", FRAMEWORK_LINK_TARGET);
|
|
15964
|
-
(0,
|
|
15962
|
+
(0, import_node_fs25.mkdirSync)(sourceDir, { recursive: true });
|
|
15965
15963
|
const manifestPath = import_node_path27.default.join(linkRoot, "Package.swift");
|
|
15966
|
-
if (!(0,
|
|
15967
|
-
(0,
|
|
15964
|
+
if (!(0, import_node_fs25.existsSync)(manifestPath) || (0, import_node_fs25.readFileSync)(manifestPath, "utf8") !== manifest)
|
|
15965
|
+
(0, import_node_fs25.writeFileSync)(manifestPath, manifest);
|
|
15968
15966
|
const source = import_node_path27.default.join(sourceDir, "Link.swift");
|
|
15969
|
-
if (!(0,
|
|
15967
|
+
if (!(0, import_node_fs25.existsSync)(source)) (0, import_node_fs25.writeFileSync)(source, "");
|
|
15970
15968
|
}
|
|
15971
15969
|
function frameworkLinkClosure(scratch2, roots) {
|
|
15972
15970
|
const suffix = `${WASM_TRIPLE}-release`;
|
|
@@ -15977,7 +15975,7 @@ function frameworkLinkClosure(scratch2, roots) {
|
|
|
15977
15975
|
const moduleMaps = /* @__PURE__ */ new Map();
|
|
15978
15976
|
let pending = null;
|
|
15979
15977
|
let compiling = null;
|
|
15980
|
-
for (const line of (0,
|
|
15978
|
+
for (const line of (0, import_node_fs25.readFileSync)(import_node_path27.default.join(scratch2, "release.yaml"), "utf8").split(
|
|
15981
15979
|
"\n"
|
|
15982
15980
|
)) {
|
|
15983
15981
|
const phony = phonyHeader.exec(line);
|
|
@@ -16041,7 +16039,7 @@ function frameworkLinkClosure(scratch2, roots) {
|
|
|
16041
16039
|
owners.set(file, name2);
|
|
16042
16040
|
if (seen.has(file)) continue;
|
|
16043
16041
|
seen.add(file);
|
|
16044
|
-
if (!(0,
|
|
16042
|
+
if (!(0, import_node_fs25.existsSync)(file))
|
|
16045
16043
|
throw new Error(`swift-compile: framework object ${file} was not built`);
|
|
16046
16044
|
files.push(file);
|
|
16047
16045
|
}
|
|
@@ -16051,14 +16049,14 @@ function frameworkLinkClosure(scratch2, roots) {
|
|
|
16051
16049
|
return { objects: files, owners, modules, moduleMaps: [...maps].sort() };
|
|
16052
16050
|
}
|
|
16053
16051
|
function removeCaseCollidingModuleArtifacts(modulesDir, keep) {
|
|
16054
|
-
if (!(0,
|
|
16052
|
+
if (!(0, import_node_fs25.existsSync)(modulesDir)) return;
|
|
16055
16053
|
const folded = new Set([...keep].map((name2) => name2.toLowerCase()));
|
|
16056
|
-
for (const name2 of (0,
|
|
16054
|
+
for (const name2 of (0, import_node_fs25.readdirSync)(modulesDir)) {
|
|
16057
16055
|
const dot = name2.indexOf(".");
|
|
16058
16056
|
if (dot <= 0) continue;
|
|
16059
16057
|
const module2 = name2.slice(0, dot);
|
|
16060
16058
|
if (keep.has(module2) || !folded.has(module2.toLowerCase())) continue;
|
|
16061
|
-
(0,
|
|
16059
|
+
(0, import_node_fs25.rmSync)(import_node_path27.default.join(modulesDir, name2), { recursive: true, force: true });
|
|
16062
16060
|
}
|
|
16063
16061
|
}
|
|
16064
16062
|
async function buildFrameworkProducts(scratch2, args) {
|
|
@@ -16123,7 +16121,7 @@ async function buildFrameworkProducts(scratch2, args) {
|
|
|
16123
16121
|
const objects = linked.objects;
|
|
16124
16122
|
if (linked.modules.has("UniformTypeIdentifiers")) {
|
|
16125
16123
|
const object3 = import_node_path27.default.join(scratch2, "UniformTypeIdentifiers-NativeConstants.o");
|
|
16126
|
-
if (!(0,
|
|
16124
|
+
if (!(0, import_node_fs25.existsSync)(object3)) {
|
|
16127
16125
|
const sdkPaths2 = swiftSdkPaths(args.moduleRoot, args.toolchainBin);
|
|
16128
16126
|
compileUniformTypeConstants({
|
|
16129
16127
|
bin: args.toolchainBin,
|
|
@@ -16139,13 +16137,13 @@ async function buildFrameworkProducts(scratch2, args) {
|
|
|
16139
16137
|
}
|
|
16140
16138
|
removeCaseCollidingModuleArtifacts(import_node_path27.default.join(release, "Modules"), linked.modules);
|
|
16141
16139
|
const response = import_node_path27.default.join(scratch2, "autolink-objects.rsp");
|
|
16142
|
-
(0,
|
|
16140
|
+
(0, import_node_fs25.writeFileSync)(response, objects.map((file) => JSON.stringify(file)).join("\n") + "\n");
|
|
16143
16141
|
const extracted = await runCompiler(
|
|
16144
16142
|
import_node_path27.default.join(args.toolchainBin, "swift-autolink-extract"),
|
|
16145
16143
|
[`@${response}`, "-o", "-"],
|
|
16146
16144
|
args.buildOptions
|
|
16147
16145
|
);
|
|
16148
|
-
(0,
|
|
16146
|
+
(0, import_node_fs25.rmSync)(response, { force: true });
|
|
16149
16147
|
const link = extracted.split("\n").map((line) => line.trim()).filter((flag, index, all) => flag.length > 0 && all.indexOf(flag) === index);
|
|
16150
16148
|
if (link.includes("-lFoundation"))
|
|
16151
16149
|
for (const name2 of foundationCategoryObjects) {
|
|
@@ -16158,9 +16156,9 @@ async function buildFrameworkProducts(scratch2, args) {
|
|
|
16158
16156
|
}
|
|
16159
16157
|
const providerDir = import_node_path27.default.join(scratch2, "darwin-records");
|
|
16160
16158
|
const providerStamp = import_node_path27.default.join(providerDir, ".complete");
|
|
16161
|
-
if (!(0,
|
|
16162
|
-
(0,
|
|
16163
|
-
(0,
|
|
16159
|
+
if (!(0, import_node_fs25.existsSync)(providerStamp) || (0, import_node_fs25.readFileSync)(providerStamp, "utf8") !== args.frameworkKey) {
|
|
16160
|
+
(0, import_node_fs25.rmSync)(providerDir, { recursive: true, force: true });
|
|
16161
|
+
(0, import_node_fs25.mkdirSync)(providerDir);
|
|
16164
16162
|
const sdkPaths2 = swiftSdkPaths(args.moduleRoot, args.toolchainBin);
|
|
16165
16163
|
compileDarwinRecords({
|
|
16166
16164
|
bin: args.toolchainBin,
|
|
@@ -16170,9 +16168,9 @@ async function buildFrameworkProducts(scratch2, args) {
|
|
|
16170
16168
|
minimum: darwinRecordsMinimum(),
|
|
16171
16169
|
out: providerDir
|
|
16172
16170
|
});
|
|
16173
|
-
(0,
|
|
16171
|
+
(0, import_node_fs25.writeFileSync)(providerStamp, args.frameworkKey);
|
|
16174
16172
|
}
|
|
16175
|
-
const providers = (0,
|
|
16173
|
+
const providers = (0, import_node_fs25.readdirSync)(providerDir).filter((file) => file.endsWith(".o")).sort().map((file) => import_node_path27.default.join(providerDir, file));
|
|
16176
16174
|
for (const provider of providers) linked.owners.set(provider, "DarwinRecords");
|
|
16177
16175
|
return {
|
|
16178
16176
|
modules: import_node_path27.default.join(release, "Modules"),
|
|
@@ -16195,7 +16193,7 @@ function swiftFrameworkScratch(frameworkKey) {
|
|
|
16195
16193
|
}
|
|
16196
16194
|
function swiftFrameworkSlotRecord(slot, record) {
|
|
16197
16195
|
try {
|
|
16198
|
-
return (0,
|
|
16196
|
+
return (0, import_node_fs25.readFileSync)(import_node_path27.default.join(slot, record), "utf8").trim();
|
|
16199
16197
|
} catch (error) {
|
|
16200
16198
|
if (!vanished(error)) throw error;
|
|
16201
16199
|
return null;
|
|
@@ -16207,17 +16205,17 @@ function swiftFrameworkSlotKey(slot) {
|
|
|
16207
16205
|
async function withSwiftFrameworkSlot(frameworkKey, moduleRoot, signal, work) {
|
|
16208
16206
|
const slots = Array.from({ length: SWIFT_FRAMEWORK_SLOTS }, (_, index) => {
|
|
16209
16207
|
const slot = import_node_path27.default.join(swiftFrameworksDir(), `slot-${index}`);
|
|
16210
|
-
(0,
|
|
16208
|
+
(0, import_node_fs25.mkdirSync)(slot, { recursive: true });
|
|
16211
16209
|
return slot;
|
|
16212
16210
|
});
|
|
16213
16211
|
const run2 = (slot) => (lease) => {
|
|
16214
16212
|
const now = /* @__PURE__ */ new Date();
|
|
16215
|
-
(0,
|
|
16213
|
+
(0, import_node_fs25.utimesSync)(slot, now, now);
|
|
16216
16214
|
return work(slot, lease);
|
|
16217
16215
|
};
|
|
16218
16216
|
const staged = slots.find((slot) => swiftFrameworkSlotKey(slot) === frameworkKey);
|
|
16219
16217
|
if (staged) return withSwiftRootLock(staged, run2(staged), signal);
|
|
16220
|
-
const built = new Map(slots.map((slot) => [slot, (0,
|
|
16218
|
+
const built = new Map(slots.map((slot) => [slot, (0, import_node_fs25.statSync)(slot).mtimeMs]));
|
|
16221
16219
|
const own = (slot) => swiftFrameworkSlotRecord(slot, SWIFT_FRAMEWORK_SLOT_ORIGIN) === moduleRoot;
|
|
16222
16220
|
const oldest = slots.sort(
|
|
16223
16221
|
(left, right) => (built.get(left) ?? 0) - (built.get(right) ?? 0)
|
|
@@ -16237,48 +16235,48 @@ async function withSwiftFrameworkSlot(frameworkKey, moduleRoot, signal, work) {
|
|
|
16237
16235
|
return withSwiftRootLock(oldest[0], run2(oldest[0]), signal);
|
|
16238
16236
|
}
|
|
16239
16237
|
function mirrorTree2(source, target, skip) {
|
|
16240
|
-
(0,
|
|
16238
|
+
(0, import_node_fs25.mkdirSync)(target, { recursive: true });
|
|
16241
16239
|
const wanted = /* @__PURE__ */ new Set();
|
|
16242
|
-
for (const entry of (0,
|
|
16240
|
+
for (const entry of (0, import_node_fs25.readdirSync)(source, { withFileTypes: true })) {
|
|
16243
16241
|
if (entry.name === skip) continue;
|
|
16244
16242
|
wanted.add(entry.name);
|
|
16245
16243
|
const from = import_node_path27.default.join(source, entry.name);
|
|
16246
16244
|
const to = import_node_path27.default.join(target, entry.name);
|
|
16247
16245
|
let existing = null;
|
|
16248
16246
|
try {
|
|
16249
|
-
existing = (0,
|
|
16247
|
+
existing = (0, import_node_fs25.lstatSync)(to);
|
|
16250
16248
|
} catch (error) {
|
|
16251
16249
|
if (!vanished(error)) throw error;
|
|
16252
16250
|
}
|
|
16253
16251
|
if (entry.isDirectory()) {
|
|
16254
|
-
if (existing && !existing.isDirectory()) (0,
|
|
16252
|
+
if (existing && !existing.isDirectory()) (0, import_node_fs25.rmSync)(to, { force: true });
|
|
16255
16253
|
mirrorTree2(from, to);
|
|
16256
16254
|
} else if (entry.isSymbolicLink()) {
|
|
16257
|
-
const link = (0,
|
|
16258
|
-
if (existing?.isSymbolicLink() && (0,
|
|
16259
|
-
if (existing) (0,
|
|
16260
|
-
(0,
|
|
16255
|
+
const link = (0, import_node_fs25.readlinkSync)(from);
|
|
16256
|
+
if (existing?.isSymbolicLink() && (0, import_node_fs25.readlinkSync)(to) === link) continue;
|
|
16257
|
+
if (existing) (0, import_node_fs25.rmSync)(to, { recursive: true, force: true });
|
|
16258
|
+
(0, import_node_fs25.symlinkSync)(link, to);
|
|
16261
16259
|
} else {
|
|
16262
|
-
const stat = (0,
|
|
16263
|
-
if (existing?.isFile() && existing.size === stat.size && (existing.mtimeMs === stat.mtimeMs || (0,
|
|
16260
|
+
const stat = (0, import_node_fs25.statSync)(from);
|
|
16261
|
+
if (existing?.isFile() && existing.size === stat.size && (existing.mtimeMs === stat.mtimeMs || (0, import_node_fs25.readFileSync)(from).equals((0, import_node_fs25.readFileSync)(to))))
|
|
16264
16262
|
continue;
|
|
16265
|
-
if (existing) (0,
|
|
16263
|
+
if (existing) (0, import_node_fs25.rmSync)(to, { recursive: true, force: true });
|
|
16266
16264
|
const partial = `${to}.${(0, import_node_crypto13.randomUUID)()}`;
|
|
16267
|
-
(0,
|
|
16268
|
-
(0,
|
|
16269
|
-
(0,
|
|
16265
|
+
(0, import_node_fs25.copyFileSync)(from, partial);
|
|
16266
|
+
(0, import_node_fs25.utimesSync)(partial, stat.atime, stat.mtime);
|
|
16267
|
+
(0, import_node_fs25.renameSync)(partial, to);
|
|
16270
16268
|
}
|
|
16271
16269
|
}
|
|
16272
|
-
for (const name2 of (0,
|
|
16270
|
+
for (const name2 of (0, import_node_fs25.readdirSync)(target))
|
|
16273
16271
|
if (!wanted.has(name2) && name2 !== skip)
|
|
16274
|
-
(0,
|
|
16272
|
+
(0, import_node_fs25.rmSync)(import_node_path27.default.join(target, name2), { recursive: true, force: true });
|
|
16275
16273
|
}
|
|
16276
16274
|
function stageFrameworkSource(moduleRoot, slot, frameworkKey, release) {
|
|
16277
16275
|
if (!slot) return moduleRoot;
|
|
16278
16276
|
const staged = import_node_path27.default.join(slot, "source");
|
|
16279
16277
|
const stagedModule = import_node_path27.default.join(staged, "packages", import_node_path27.default.basename(moduleRoot));
|
|
16280
16278
|
if (swiftFrameworkSlotKey(slot) !== frameworkKey) {
|
|
16281
|
-
(0,
|
|
16279
|
+
(0, import_node_fs25.rmSync)(import_node_path27.default.join(slot, SWIFT_FRAMEWORK_SLOT_KEY), { force: true });
|
|
16282
16280
|
mirrorTree2(moduleRoot, stagedModule, ".build");
|
|
16283
16281
|
mirrorTree2(
|
|
16284
16282
|
swiftSharedSdkRoot(moduleRoot, false),
|
|
@@ -16288,20 +16286,20 @@ function stageFrameworkSource(moduleRoot, slot, frameworkKey, release) {
|
|
|
16288
16286
|
if (!file.startsWith("../")) continue;
|
|
16289
16287
|
const from = import_node_path27.default.resolve(moduleRoot, file);
|
|
16290
16288
|
const to = import_node_path27.default.resolve(stagedModule, file);
|
|
16291
|
-
if ((0,
|
|
16292
|
-
(0,
|
|
16293
|
-
(0,
|
|
16289
|
+
if ((0, import_node_fs25.existsSync)(to) && (0, import_node_fs25.readFileSync)(from).equals((0, import_node_fs25.readFileSync)(to))) continue;
|
|
16290
|
+
(0, import_node_fs25.mkdirSync)(import_node_path27.default.dirname(to), { recursive: true });
|
|
16291
|
+
(0, import_node_fs25.copyFileSync)(from, to);
|
|
16294
16292
|
}
|
|
16295
16293
|
if (swiftProjectBuildKey(stagedModule, release) !== frameworkKey)
|
|
16296
16294
|
throw new Error("Swift staged framework source differs from the caller");
|
|
16297
16295
|
const modules = import_node_path27.default.join(staged, "node_modules");
|
|
16298
|
-
const target = (0,
|
|
16299
|
-
if (!(0,
|
|
16300
|
-
(0,
|
|
16301
|
-
(0,
|
|
16296
|
+
const target = (0, import_node_fs25.realpathSync)(import_node_path27.default.join(moduleRoot, "../../node_modules"));
|
|
16297
|
+
if (!(0, import_node_fs25.existsSync)(modules) || (0, import_node_fs25.readlinkSync)(modules) !== target) {
|
|
16298
|
+
(0, import_node_fs25.rmSync)(modules, { recursive: true, force: true });
|
|
16299
|
+
(0, import_node_fs25.symlinkSync)(target, modules);
|
|
16302
16300
|
}
|
|
16303
|
-
(0,
|
|
16304
|
-
(0,
|
|
16301
|
+
(0, import_node_fs25.writeFileSync)(import_node_path27.default.join(slot, SWIFT_FRAMEWORK_SLOT_KEY), frameworkKey);
|
|
16302
|
+
(0, import_node_fs25.writeFileSync)(import_node_path27.default.join(slot, SWIFT_FRAMEWORK_SLOT_ORIGIN), moduleRoot);
|
|
16305
16303
|
}
|
|
16306
16304
|
return stagedModule;
|
|
16307
16305
|
}
|
|
@@ -16312,7 +16310,7 @@ ${args.frameworkKey}
|
|
|
16312
16310
|
`);
|
|
16313
16311
|
if (!args.prebuilt) return hash.digest("hex");
|
|
16314
16312
|
const statOf = (file) => {
|
|
16315
|
-
const stat = (0,
|
|
16313
|
+
const stat = (0, import_node_fs25.statSync)(file, { bigint: true });
|
|
16316
16314
|
return `${stat.size}:${stat.mtimeNs}`;
|
|
16317
16315
|
};
|
|
16318
16316
|
for (const object3 of args.prebuilt.objects)
|
|
@@ -16333,7 +16331,7 @@ ${args.prebuilt.link.join("\n")}
|
|
|
16333
16331
|
hash.update(`modules
|
|
16334
16332
|
${args.prebuilt.modules}
|
|
16335
16333
|
`);
|
|
16336
|
-
for (const entry of (0,
|
|
16334
|
+
for (const entry of (0, import_node_fs25.readdirSync)(args.prebuilt.modules).sort())
|
|
16337
16335
|
hash.update(`${entry}
|
|
16338
16336
|
${statOf(import_node_path27.default.join(args.prebuilt.modules, entry))}`);
|
|
16339
16337
|
return hash.digest("hex");
|
|
@@ -16342,15 +16340,15 @@ function retireStaleSwiftLink(root, stamp) {
|
|
|
16342
16340
|
const receipt = import_node_path27.default.join(root, SWIFT_LINK_STAMP);
|
|
16343
16341
|
let previous = null;
|
|
16344
16342
|
try {
|
|
16345
|
-
previous = (0,
|
|
16343
|
+
previous = (0, import_node_fs25.readFileSync)(receipt, "utf8").trim();
|
|
16346
16344
|
} catch (error) {
|
|
16347
16345
|
if (!vanished(error)) throw error;
|
|
16348
16346
|
}
|
|
16349
|
-
(0,
|
|
16347
|
+
(0, import_node_fs25.writeFileSync)(receipt, `${stamp}
|
|
16350
16348
|
`);
|
|
16351
16349
|
const retired = import_node_path27.default.join(root, ".build");
|
|
16352
|
-
if (previous === stamp || !(0,
|
|
16353
|
-
(0,
|
|
16350
|
+
if (previous === stamp || !(0, import_node_fs25.existsSync)(retired)) return false;
|
|
16351
|
+
(0, import_node_fs25.rmSync)(retired, { recursive: true, force: true });
|
|
16354
16352
|
return true;
|
|
16355
16353
|
}
|
|
16356
16354
|
async function compileSwiftProjectUnit(input, options) {
|
|
@@ -16365,8 +16363,8 @@ async function compileSwiftProjectUnit(input, options) {
|
|
|
16365
16363
|
}
|
|
16366
16364
|
function compileSwiftProjectOnce(input, options) {
|
|
16367
16365
|
options.signal?.throwIfAborted();
|
|
16368
|
-
(0,
|
|
16369
|
-
const root = (0,
|
|
16366
|
+
(0, import_node_fs25.mkdirSync)(options.buildRoot, { recursive: true });
|
|
16367
|
+
const root = (0, import_node_fs25.realpathSync)(options.buildRoot);
|
|
16370
16368
|
const moduleRoot = import_node_path27.default.resolve(options.moduleRoot);
|
|
16371
16369
|
const distribution = swiftDistributionAt(moduleRoot);
|
|
16372
16370
|
const guestGraph = distribution ? input.sourceLinkGraph : void 0;
|
|
@@ -16401,10 +16399,10 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
16401
16399
|
return retain(root, previous);
|
|
16402
16400
|
}
|
|
16403
16401
|
if (process.platform === "darwin" && process.env.TM_SESSION && !windowAdmission() && process.env.CI !== "true" && moduleRoot === sourceSwiftCheckout() && !swiftDistributionAt(moduleRoot)) {
|
|
16404
|
-
const requestRoot = (0,
|
|
16402
|
+
const requestRoot = (0, import_node_fs25.mkdtempSync)(`${root}.builder-request-`);
|
|
16405
16403
|
const output = import_node_path27.default.join(requestRoot, "output");
|
|
16406
16404
|
const request = import_node_path27.default.join(requestRoot, "request.json");
|
|
16407
|
-
(0,
|
|
16405
|
+
(0, import_node_fs25.writeFileSync)(
|
|
16408
16406
|
request,
|
|
16409
16407
|
JSON.stringify({
|
|
16410
16408
|
input,
|
|
@@ -16450,7 +16448,7 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
16450
16448
|
report("builder artifact verified");
|
|
16451
16449
|
return retain(root, artifact);
|
|
16452
16450
|
} finally {
|
|
16453
|
-
(0,
|
|
16451
|
+
(0, import_node_fs25.rmSync)(requestRoot, { recursive: true, force: true });
|
|
16454
16452
|
}
|
|
16455
16453
|
}
|
|
16456
16454
|
return withSwiftRootLock(
|
|
@@ -16462,7 +16460,7 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
16462
16460
|
return retain(root, built);
|
|
16463
16461
|
}
|
|
16464
16462
|
const swift = import_node_path27.default.join(options.toolchainBin, "swift");
|
|
16465
|
-
if (!(0,
|
|
16463
|
+
if (!(0, import_node_fs25.existsSync)(swift)) {
|
|
16466
16464
|
throw new Error(
|
|
16467
16465
|
`swift-compile: no swift.org toolchain at ${options.toolchainBin}; install ${options.release} and its matching wasm sdk`
|
|
16468
16466
|
);
|
|
@@ -16537,10 +16535,10 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
16537
16535
|
writeSwiftAutolinkLinker(
|
|
16538
16536
|
root,
|
|
16539
16537
|
options.toolchainBin,
|
|
16540
|
-
(0,
|
|
16538
|
+
(0, import_node_fs25.existsSync)(productFile) ? [
|
|
16541
16539
|
v5.parse(
|
|
16542
16540
|
swiftFrameworkProductSchema,
|
|
16543
|
-
JSON.parse((0,
|
|
16541
|
+
JSON.parse((0, import_node_fs25.readFileSync)(productFile, "utf8"))
|
|
16544
16542
|
).product.name
|
|
16545
16543
|
] : []
|
|
16546
16544
|
);
|
|
@@ -16610,9 +16608,9 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
16610
16608
|
];
|
|
16611
16609
|
const linked = builtArtifact(layout2);
|
|
16612
16610
|
if (input.optimize) {
|
|
16613
|
-
(0,
|
|
16614
|
-
if ((0,
|
|
16615
|
-
(0,
|
|
16611
|
+
(0, import_node_fs25.rmSync)(import_node_path27.default.join(root, ".peach-link.rsp"), { force: true });
|
|
16612
|
+
if ((0, import_node_fs25.existsSync)(linked) && (0, import_node_fs25.statSync)(linked).size <= 8)
|
|
16613
|
+
(0, import_node_fs25.rmSync)(linked, { force: true });
|
|
16616
16614
|
}
|
|
16617
16615
|
report("compiling and linking Swift modules");
|
|
16618
16616
|
try {
|
|
@@ -16638,11 +16636,11 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
16638
16636
|
`${producer}-Swift.h`
|
|
16639
16637
|
);
|
|
16640
16638
|
const original = preparation.nativeHeaderDeclarations[producer] ? emitted.replace(/-Swift\.h$/, "-Swift.original.h") : emitted;
|
|
16641
|
-
if ((0,
|
|
16639
|
+
if ((0, import_node_fs25.existsSync)(original))
|
|
16642
16640
|
writeBuildFile(
|
|
16643
16641
|
emitted,
|
|
16644
16642
|
withoutSwiftDeclarations(
|
|
16645
|
-
clangInterfaceHeader((0,
|
|
16643
|
+
clangInterfaceHeader((0, import_node_fs25.readFileSync)(original, "utf8")),
|
|
16646
16644
|
new Set(preparation.nativeHeaderDeclarations[producer]),
|
|
16647
16645
|
`#import <${producer}/${producer}.h>`
|
|
16648
16646
|
)
|
|
@@ -16653,9 +16651,9 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
16653
16651
|
root,
|
|
16654
16652
|
".build",
|
|
16655
16653
|
"peach-native-targets",
|
|
16656
|
-
(0, import_node_crypto13.createHash)("sha256").update((0,
|
|
16654
|
+
(0, import_node_crypto13.createHash)("sha256").update((0, import_node_fs25.readFileSync)(import_node_path27.default.join(root, "Package.swift"))).digest("hex")
|
|
16657
16655
|
);
|
|
16658
|
-
(0,
|
|
16656
|
+
(0, import_node_fs25.mkdirSync)(checkpoints, { recursive: true });
|
|
16659
16657
|
for (const target of /* @__PURE__ */ new Set([
|
|
16660
16658
|
...input.staticClangTargets ?? [],
|
|
16661
16659
|
...preparation.nativeBuildTargets
|
|
@@ -16664,7 +16662,7 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
16664
16662
|
checkpoints,
|
|
16665
16663
|
(0, import_node_crypto13.createHash)("sha256").update(target).digest("hex")
|
|
16666
16664
|
);
|
|
16667
|
-
if ((0,
|
|
16665
|
+
if ((0, import_node_fs25.existsSync)(checkpoint)) continue;
|
|
16668
16666
|
await runCompiler(
|
|
16669
16667
|
swift,
|
|
16670
16668
|
[...buildArgs, "--target", target],
|
|
@@ -16672,7 +16670,7 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
16672
16670
|
SWIFTPM_PROGRESS,
|
|
16673
16671
|
SWIFTPM_NOISE
|
|
16674
16672
|
);
|
|
16675
|
-
(0,
|
|
16673
|
+
(0, import_node_fs25.writeFileSync)(checkpoint, "");
|
|
16676
16674
|
}
|
|
16677
16675
|
await runCompiler(
|
|
16678
16676
|
swift,
|
|
@@ -16690,8 +16688,8 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
16690
16688
|
"release",
|
|
16691
16689
|
"ModuleCache"
|
|
16692
16690
|
);
|
|
16693
|
-
if (output2.includes("was compiled with module cache path") && (0,
|
|
16694
|
-
(0,
|
|
16691
|
+
if (output2.includes("was compiled with module cache path") && (0, import_node_fs25.existsSync)(moduleCache)) {
|
|
16692
|
+
(0, import_node_fs25.rmSync)(moduleCache, { recursive: true, force: true });
|
|
16695
16693
|
try {
|
|
16696
16694
|
await runCompiler(
|
|
16697
16695
|
swift,
|
|
@@ -16721,9 +16719,9 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
16721
16719
|
if (options.project) endSwiftProjectProcesses(options.project);
|
|
16722
16720
|
}
|
|
16723
16721
|
if (unprepared.length) throw new Error(unprepared.join("\n"));
|
|
16724
|
-
if (!(0,
|
|
16722
|
+
if (!(0, import_node_fs25.existsSync)(linked)) {
|
|
16725
16723
|
const binDir = import_node_path27.default.dirname(linked);
|
|
16726
|
-
const found = (0,
|
|
16724
|
+
const found = (0, import_node_fs25.existsSync)(binDir) ? (0, import_node_fs25.readdirSync)(binDir).filter((name2) => name2.endsWith(".wasm")).sort() : [];
|
|
16727
16725
|
throw new Error(
|
|
16728
16726
|
`swift-compile: the build produced no ${import_node_path27.default.basename(linked)} (found: ${found.join(", ") || "none"})`
|
|
16729
16727
|
);
|
|
@@ -16756,7 +16754,7 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
16756
16754
|
else if (input.optimize) await optimizeWasm(output, optimized);
|
|
16757
16755
|
const artifact = {
|
|
16758
16756
|
hash,
|
|
16759
|
-
bytes: (0,
|
|
16757
|
+
bytes: (0, import_node_fs25.readFileSync)(input.optimize ? optimized : output),
|
|
16760
16758
|
icu: await icu
|
|
16761
16759
|
};
|
|
16762
16760
|
if (!options.project) saveCompiledArtifact(root, artifact);
|