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
package/dist-lib/vite-swift.cjs
CHANGED
|
@@ -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;
|
|
@@ -1180,7 +1180,7 @@ __export(vite_plugin_swift_exports, {
|
|
|
1180
1180
|
});
|
|
1181
1181
|
module.exports = __toCommonJS(vite_plugin_swift_exports);
|
|
1182
1182
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
1183
|
-
var
|
|
1183
|
+
var import_node_fs54 = __toESM(require("node:fs"), 1);
|
|
1184
1184
|
var import_node_path55 = __toESM(require("node:path"), 1);
|
|
1185
1185
|
|
|
1186
1186
|
// ../sootsim-swift/src/bundleAssets.ts
|
|
@@ -1787,7 +1787,7 @@ function swiftEntryModuleEsm(args) {
|
|
|
1787
1787
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
1788
1788
|
var import_node_child_process19 = require("node:child_process");
|
|
1789
1789
|
var import_node_crypto13 = require("node:crypto");
|
|
1790
|
-
var
|
|
1790
|
+
var import_node_fs27 = require("node:fs");
|
|
1791
1791
|
var import_node_os10 = __toESM(require("node:os"), 1);
|
|
1792
1792
|
var import_node_path27 = __toESM(require("node:path"), 1);
|
|
1793
1793
|
var v5 = __toESM(require("valibot"), 1);
|
|
@@ -9261,7 +9261,7 @@ var foundationCategoryObjects = [
|
|
|
9261
9261
|
// src/swift-guest-compile.ts
|
|
9262
9262
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
9263
9263
|
var import_node_child_process14 = require("node:child_process");
|
|
9264
|
-
var
|
|
9264
|
+
var import_node_fs19 = require("node:fs");
|
|
9265
9265
|
var import_node_path19 = __toESM(require("node:path"), 1);
|
|
9266
9266
|
|
|
9267
9267
|
// src/swift-guest-archive.ts
|
|
@@ -14424,6 +14424,7 @@ function logicalGuestLinkOptions(args, identities, roots) {
|
|
|
14424
14424
|
|
|
14425
14425
|
// src/wasm-optimize.ts
|
|
14426
14426
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
14427
|
+
var import_node_fs18 = require("node:fs");
|
|
14427
14428
|
var import_node_path18 = require("node:path");
|
|
14428
14429
|
|
|
14429
14430
|
// ../contrast-runtime-delivery/src/index.ts
|
|
@@ -14735,7 +14736,7 @@ async function runWasmOpt(file, output2, skipPasses, binary) {
|
|
|
14735
14736
|
"-o",
|
|
14736
14737
|
output2
|
|
14737
14738
|
],
|
|
14738
|
-
|
|
14739
|
+
{ env: { ...process.env, WASM_OPT_PATH: binary } }
|
|
14739
14740
|
);
|
|
14740
14741
|
if (result.status !== 0)
|
|
14741
14742
|
throw new Error(`wasm-opt exited ${result.status}: ${result.stderr}`);
|
|
@@ -14747,23 +14748,20 @@ async function installWasmOpt() {
|
|
|
14747
14748
|
const release = BINARYEN_RELEASES.get(platform);
|
|
14748
14749
|
if (!release) throw new Error(`no pinned Binaryen release for ${platform}`);
|
|
14749
14750
|
const destDir = (0, import_node_path18.join)(rnxHomeDir(), "tools", "binaryen", import_wasm_opt.BINARYEN_VERSION, platform);
|
|
14750
|
-
|
|
14751
|
-
|
|
14752
|
-
|
|
14753
|
-
|
|
14754
|
-
|
|
14755
|
-
|
|
14756
|
-
|
|
14757
|
-
|
|
14758
|
-
|
|
14751
|
+
const binary = (0, import_node_path18.join)(destDir, "bin", "wasm-opt");
|
|
14752
|
+
if (!(0, import_node_fs18.existsSync)(binary))
|
|
14753
|
+
await installVerifiedTarball({
|
|
14754
|
+
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`,
|
|
14755
|
+
digest: { algorithm: "sha256", encoding: "hex", value: release.sha256 },
|
|
14756
|
+
destDir,
|
|
14757
|
+
installedMarker: "bin/wasm-opt",
|
|
14758
|
+
stripComponents: 1,
|
|
14759
|
+
label: `Binaryen ${import_wasm_opt.BINARYEN_VERSION}`
|
|
14760
|
+
});
|
|
14761
|
+
return binary;
|
|
14759
14762
|
}
|
|
14760
14763
|
async function optimizeWasm(file, output2, skipPasses = []) {
|
|
14761
|
-
|
|
14762
|
-
await runWasmOpt(file, output2, skipPasses);
|
|
14763
|
-
} catch (error) {
|
|
14764
|
-
if (!(error instanceof import_wasm_opt.BinaryNotFoundError)) throw error;
|
|
14765
|
-
await runWasmOpt(file, output2, skipPasses, await installWasmOpt());
|
|
14766
|
-
}
|
|
14764
|
+
await runWasmOpt(file, output2, skipPasses, await installWasmOpt());
|
|
14767
14765
|
}
|
|
14768
14766
|
|
|
14769
14767
|
// src/swift-guest-compile.ts
|
|
@@ -14778,7 +14776,7 @@ function version(value) {
|
|
|
14778
14776
|
}
|
|
14779
14777
|
async function compileGuestLink(options) {
|
|
14780
14778
|
const directory = import_node_path19.default.join(options.buildDirectory, ".peach-guest-link");
|
|
14781
|
-
(0,
|
|
14779
|
+
(0, import_node_fs19.mkdirSync)(directory, { recursive: true });
|
|
14782
14780
|
const sdkRoot = import_node_path19.default.dirname(options.sysroot);
|
|
14783
14781
|
const catalogs = readGuestRuntimeCatalogs(sdkRoot, options.moduleRoot);
|
|
14784
14782
|
const sourceImages = guestSourceImages(options.graph);
|
|
@@ -14803,7 +14801,7 @@ async function compileGuestLink(options) {
|
|
|
14803
14801
|
];
|
|
14804
14802
|
const stubSource = import_node_path19.default.join(directory, "preselection-projection.c");
|
|
14805
14803
|
const stub = import_node_path19.default.join(directory, "preselection-projection.o");
|
|
14806
|
-
(0,
|
|
14804
|
+
(0, import_node_fs19.writeFileSync)(
|
|
14807
14805
|
stubSource,
|
|
14808
14806
|
'#include "guest-image-projection.h"\nconst struct peach_guest_image __peach_guest_images[] = {{0}};\nconst uint32_t __peach_guest_image_count = 0;\n'
|
|
14809
14807
|
);
|
|
@@ -15107,25 +15105,25 @@ async function compileGuestLink(options) {
|
|
|
15107
15105
|
await optimizeWasm(options.output, options.optimized, [
|
|
15108
15106
|
"duplicate-function-elimination"
|
|
15109
15107
|
]);
|
|
15110
|
-
const map = (0,
|
|
15108
|
+
const map = (0, import_node_fs19.readFileSync)(result.mapPath, "utf8");
|
|
15111
15109
|
if (!/ __peach_guest_images$/m.test(map)) return;
|
|
15112
15110
|
const finalized = finalizeGuestProjectionStorage({
|
|
15113
15111
|
map,
|
|
15114
|
-
linked: (0,
|
|
15115
|
-
optimized: (0,
|
|
15112
|
+
linked: (0, import_node_fs19.readFileSync)(options.output),
|
|
15113
|
+
optimized: (0, import_node_fs19.readFileSync)(options.optimized),
|
|
15116
15114
|
owners: result.owners,
|
|
15117
15115
|
sectionOwners: result.generatedSectionOwners,
|
|
15118
15116
|
projectionObject,
|
|
15119
15117
|
reserved
|
|
15120
15118
|
});
|
|
15121
|
-
(0,
|
|
15119
|
+
(0, import_node_fs19.writeFileSync)(options.optimized, finalized.wasm);
|
|
15122
15120
|
}
|
|
15123
15121
|
|
|
15124
15122
|
// src/swift-icu.ts
|
|
15125
15123
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
15126
15124
|
var import_node_child_process15 = require("node:child_process");
|
|
15127
15125
|
var import_node_crypto11 = require("node:crypto");
|
|
15128
|
-
var
|
|
15126
|
+
var import_node_fs20 = require("node:fs");
|
|
15129
15127
|
var import_promises4 = require("node:fs/promises");
|
|
15130
15128
|
var import_node_os8 = __toESM(require("node:os"), 1);
|
|
15131
15129
|
var import_node_path20 = __toESM(require("node:path"), 1);
|
|
@@ -15259,7 +15257,7 @@ function swiftIcuAsset(toolchainBin, sdk) {
|
|
|
15259
15257
|
}
|
|
15260
15258
|
async function load(toolchainBin, sdk) {
|
|
15261
15259
|
const swift = import_node_path20.default.join(toolchainBin, "swift");
|
|
15262
|
-
if (!(0,
|
|
15260
|
+
if (!(0, import_node_fs20.existsSync)(swift))
|
|
15263
15261
|
throw new Error(`swift-icu: no swift at ${swift} for the ${sdk} SDK's icu data`);
|
|
15264
15262
|
const { stdout: listed } = await run(swift, ["sdk", "list", ...swiftSdkOptions()], {
|
|
15265
15263
|
env: swiftEnvironment()
|
|
@@ -15281,7 +15279,7 @@ async function load(toolchainBin, sdk) {
|
|
|
15281
15279
|
const resources = /^swiftStaticResourcesPath: (.+)$/m.exec(stdout)?.[1]?.trim();
|
|
15282
15280
|
if (!resources) throw new Error(`swift-icu: ${sdk} names no static resources`);
|
|
15283
15281
|
return Buffer.from(
|
|
15284
|
-
icuSegment(archiveMember((0,
|
|
15282
|
+
icuSegment(archiveMember((0, import_node_fs20.readFileSync)(import_node_path20.default.join(resources, ARCHIVE)), MEMBER))
|
|
15285
15283
|
);
|
|
15286
15284
|
}
|
|
15287
15285
|
function archiveMember(archive, name3) {
|
|
@@ -15348,7 +15346,7 @@ function swiftIcuPacked(icu) {
|
|
|
15348
15346
|
"swift-brotli",
|
|
15349
15347
|
swiftIcuAddress(icu)
|
|
15350
15348
|
);
|
|
15351
|
-
if ((0,
|
|
15349
|
+
if ((0, import_node_fs20.existsSync)(file)) return (0, import_promises4.readFile)(file);
|
|
15352
15350
|
const packed = Buffer.from(
|
|
15353
15351
|
swiftIcuPack(
|
|
15354
15352
|
await inflateGzip(icu.gzip),
|
|
@@ -15365,7 +15363,7 @@ function swiftIcuPacked(icu) {
|
|
|
15365
15363
|
|
|
15366
15364
|
// src/swift-link-roots.ts
|
|
15367
15365
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
15368
|
-
var
|
|
15366
|
+
var import_node_fs21 = __toESM(require("node:fs"), 1);
|
|
15369
15367
|
var import_node_path21 = __toESM(require("node:path"), 1);
|
|
15370
15368
|
var OBJC_SENTINELS = /* @__PURE__ */ new Map([
|
|
15371
15369
|
["__objc_cats", ".objc_null_category"],
|
|
@@ -15460,7 +15458,7 @@ function swiftObjcRootObjects(id, root, objects) {
|
|
|
15460
15458
|
const cached = rootsByDistribution.get(id);
|
|
15461
15459
|
if (cached) return cached;
|
|
15462
15460
|
const measured = objects.map(
|
|
15463
|
-
(object4) => [object4, objcRootInfo(
|
|
15461
|
+
(object4) => [object4, objcRootInfo(import_node_fs21.default.readFileSync(import_node_path21.default.join(root, object4)))]
|
|
15464
15462
|
);
|
|
15465
15463
|
const roots = new Set(
|
|
15466
15464
|
measured.filter(
|
|
@@ -15503,19 +15501,19 @@ function swiftObjCModuleMap(module2, headers) {
|
|
|
15503
15501
|
// src/swift-project-user.ts
|
|
15504
15502
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
15505
15503
|
var import_node_child_process16 = require("node:child_process");
|
|
15506
|
-
var
|
|
15504
|
+
var import_node_fs22 = require("node:fs");
|
|
15507
15505
|
var import_node_path22 = __toESM(require("node:path"), 1);
|
|
15508
15506
|
function prepareSwiftProjectProcess(root, user) {
|
|
15509
15507
|
const home = `${root}.project-home`;
|
|
15510
|
-
(0,
|
|
15508
|
+
(0, import_node_fs22.rmSync)(home, { recursive: true, force: true });
|
|
15511
15509
|
const tmp = import_node_path22.default.join(home, "tmp");
|
|
15512
15510
|
const swiftpm = import_node_path22.default.join(home, "swiftpm");
|
|
15513
|
-
(0,
|
|
15511
|
+
(0, import_node_fs22.mkdirSync)(tmp, { recursive: true });
|
|
15514
15512
|
const caches = ["cache", "config", "security"].map((name3) => import_node_path22.default.join(swiftpm, name3));
|
|
15515
|
-
for (const directory of caches) (0,
|
|
15513
|
+
for (const directory of caches) (0, import_node_fs22.mkdirSync)(directory, { recursive: true });
|
|
15516
15514
|
(0, import_node_child_process16.execFileSync)("chown", ["-R", "-P", `${user.uid}:${user.gid}`, root, home]);
|
|
15517
|
-
(0,
|
|
15518
|
-
(0,
|
|
15515
|
+
(0, import_node_fs22.chmodSync)(root, 448);
|
|
15516
|
+
(0, import_node_fs22.chmodSync)(home, 448);
|
|
15519
15517
|
return {
|
|
15520
15518
|
uid: user.uid,
|
|
15521
15519
|
gid: user.gid,
|
|
@@ -15542,9 +15540,9 @@ function endSwiftProjectProcesses(user) {
|
|
|
15542
15540
|
});
|
|
15543
15541
|
}
|
|
15544
15542
|
function projectOutputFile(root, file, user) {
|
|
15545
|
-
const real = (0,
|
|
15546
|
-
const base = (0,
|
|
15547
|
-
const stat = (0,
|
|
15543
|
+
const real = (0, import_node_fs22.realpathSync)(file);
|
|
15544
|
+
const base = (0, import_node_fs22.realpathSync)(root);
|
|
15545
|
+
const stat = (0, import_node_fs22.statSync)(real);
|
|
15548
15546
|
if (!real.startsWith(base + import_node_path22.default.sep) || !stat.isFile() || stat.uid !== user.uid) {
|
|
15549
15547
|
throw new Error(`swift-compile: project output ${file} is not a file of its build`);
|
|
15550
15548
|
}
|
|
@@ -15553,12 +15551,12 @@ function projectOutputFile(root, file, user) {
|
|
|
15553
15551
|
function removeProjectLinks(root) {
|
|
15554
15552
|
const pending = [root];
|
|
15555
15553
|
for (let directory = pending.pop(); directory; directory = pending.pop()) {
|
|
15556
|
-
for (const entry of (0,
|
|
15554
|
+
for (const entry of (0, import_node_fs22.readdirSync)(directory, { withFileTypes: true })) {
|
|
15557
15555
|
const full = import_node_path22.default.join(directory, entry.name);
|
|
15558
15556
|
if (directory === root && entry.name === ".build") continue;
|
|
15559
15557
|
if (directory === root && entry.name.startsWith(".peach-modules-")) {
|
|
15560
|
-
(0,
|
|
15561
|
-
} else if (entry.isSymbolicLink()) (0,
|
|
15558
|
+
(0, import_node_fs22.rmSync)(full, { recursive: true, force: true });
|
|
15559
|
+
} else if (entry.isSymbolicLink()) (0, import_node_fs22.rmSync)(full);
|
|
15562
15560
|
else if (entry.isDirectory()) pending.push(full);
|
|
15563
15561
|
}
|
|
15564
15562
|
}
|
|
@@ -15566,11 +15564,11 @@ function removeProjectLinks(root) {
|
|
|
15566
15564
|
|
|
15567
15565
|
// src/swift-reproducible.ts
|
|
15568
15566
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
15569
|
-
var
|
|
15567
|
+
var import_node_fs23 = require("node:fs");
|
|
15570
15568
|
var import_node_os9 = __toESM(require("node:os"), 1);
|
|
15571
15569
|
function swiftReproducibleBuildFlags(roots) {
|
|
15572
15570
|
return [[import_node_os9.default.homedir(), "home"], ...roots].flatMap(
|
|
15573
|
-
([root, name3]) => [.../* @__PURE__ */ new Set([root, (0,
|
|
15571
|
+
([root, name3]) => [.../* @__PURE__ */ new Set([root, (0, import_node_fs23.realpathSync)(root)])].map((from) => `${from}=/peach/${name3}`)
|
|
15574
15572
|
).flatMap((map) => [
|
|
15575
15573
|
"-Xswiftc",
|
|
15576
15574
|
"-file-prefix-map",
|
|
@@ -15587,7 +15585,7 @@ function swiftReproducibleBuildFlags(roots) {
|
|
|
15587
15585
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
15588
15586
|
var import_node_child_process17 = require("node:child_process");
|
|
15589
15587
|
var import_node_crypto12 = require("node:crypto");
|
|
15590
|
-
var
|
|
15588
|
+
var import_node_fs24 = require("node:fs");
|
|
15591
15589
|
var import_node_path23 = __toESM(require("node:path"), 1);
|
|
15592
15590
|
var POLL_MS = 250;
|
|
15593
15591
|
var START_TOLERANCE_MS = 2e3;
|
|
@@ -15633,7 +15631,7 @@ function pause(ms, signal) {
|
|
|
15633
15631
|
var name = (number3, suffix) => `${String(number3).padStart(12, "0")}.${suffix}`;
|
|
15634
15632
|
function generationNumbers(directory) {
|
|
15635
15633
|
const numbers = /* @__PURE__ */ new Set();
|
|
15636
|
-
for (const entry of (0,
|
|
15634
|
+
for (const entry of (0, import_node_fs24.readdirSync)(directory)) {
|
|
15637
15635
|
const match = /^(\d{12})\./.exec(entry);
|
|
15638
15636
|
if (match) numbers.add(Number(match[1]));
|
|
15639
15637
|
}
|
|
@@ -15642,7 +15640,7 @@ function generationNumbers(directory) {
|
|
|
15642
15640
|
function readGeneration(directory, number3) {
|
|
15643
15641
|
let owner;
|
|
15644
15642
|
try {
|
|
15645
|
-
owner = (0,
|
|
15643
|
+
owner = (0, import_node_fs24.readFileSync)(import_node_path23.default.join(directory, name(number3, "owner")), "utf8");
|
|
15646
15644
|
} catch (error) {
|
|
15647
15645
|
if (errorCode(error) === "ENOENT") return null;
|
|
15648
15646
|
throw error;
|
|
@@ -15650,12 +15648,12 @@ function readGeneration(directory, number3) {
|
|
|
15650
15648
|
return {
|
|
15651
15649
|
number: number3,
|
|
15652
15650
|
holder: parseIdentity(owner),
|
|
15653
|
-
released: (0,
|
|
15651
|
+
released: (0, import_node_fs24.readdirSync)(directory).includes(name(number3, "released"))
|
|
15654
15652
|
};
|
|
15655
15653
|
}
|
|
15656
15654
|
function readChildren(directory, number3) {
|
|
15657
15655
|
const prefix = name(number3, "child.");
|
|
15658
|
-
return (0,
|
|
15656
|
+
return (0, import_node_fs24.readdirSync)(directory).filter((entry) => entry.startsWith(prefix)).map((entry) => parseIdentity((0, import_node_fs24.readFileSync)(import_node_path23.default.join(directory, entry), "utf8")));
|
|
15659
15657
|
}
|
|
15660
15658
|
function groupAlive(table, leader) {
|
|
15661
15659
|
const row = table.find((candidate) => candidate.pid === leader.pid);
|
|
@@ -15669,7 +15667,7 @@ async function withSwiftRootLock(root, work, signal, wait = true) {
|
|
|
15669
15667
|
"swift-root-locks",
|
|
15670
15668
|
(0, import_node_crypto12.createHash)("sha256").update(root).digest("hex").slice(0, 32)
|
|
15671
15669
|
);
|
|
15672
|
-
(0,
|
|
15670
|
+
(0, import_node_fs24.mkdirSync)(directory, { recursive: true });
|
|
15673
15671
|
const token = (0, import_node_crypto12.randomUUID)();
|
|
15674
15672
|
const owner = JSON.stringify(ownIdentity(process.pid));
|
|
15675
15673
|
const pending = import_node_path23.default.join(directory, `pending.${token}`);
|
|
@@ -15696,26 +15694,26 @@ async function withSwiftRootLock(root, work, signal, wait = true) {
|
|
|
15696
15694
|
}
|
|
15697
15695
|
}
|
|
15698
15696
|
}
|
|
15699
|
-
(0,
|
|
15697
|
+
(0, import_node_fs24.writeFileSync)(pending, owner);
|
|
15700
15698
|
try {
|
|
15701
|
-
(0,
|
|
15699
|
+
(0, import_node_fs24.linkSync)(pending, import_node_path23.default.join(directory, name(newest + 1, "owner")));
|
|
15702
15700
|
} catch (error) {
|
|
15703
15701
|
if (errorCode(error) === "EEXIST") continue;
|
|
15704
15702
|
throw error;
|
|
15705
15703
|
} finally {
|
|
15706
|
-
(0,
|
|
15704
|
+
(0, import_node_fs24.rmSync)(pending, { force: true });
|
|
15707
15705
|
}
|
|
15708
15706
|
const numbers = generationNumbers(directory);
|
|
15709
15707
|
if (numbers.at(-1) !== newest + 1) {
|
|
15710
|
-
(0,
|
|
15708
|
+
(0, import_node_fs24.rmSync)(import_node_path23.default.join(directory, name(newest + 1, "owner")), { force: true });
|
|
15711
15709
|
continue;
|
|
15712
15710
|
}
|
|
15713
15711
|
held = newest + 1;
|
|
15714
15712
|
for (const number3 of numbers)
|
|
15715
15713
|
if (number3 < held) {
|
|
15716
|
-
for (const entry of (0,
|
|
15714
|
+
for (const entry of (0, import_node_fs24.readdirSync)(directory))
|
|
15717
15715
|
if (entry.startsWith(name(number3, "")))
|
|
15718
|
-
(0,
|
|
15716
|
+
(0, import_node_fs24.rmSync)(import_node_path23.default.join(directory, entry), { force: true });
|
|
15719
15717
|
}
|
|
15720
15718
|
break;
|
|
15721
15719
|
}
|
|
@@ -15726,10 +15724,10 @@ async function withSwiftRootLock(root, work, signal, wait = true) {
|
|
|
15726
15724
|
if (child.pid === void 0) throw new Error("could not register compiler process");
|
|
15727
15725
|
const childPending = `${pending}.child.${index}`;
|
|
15728
15726
|
try {
|
|
15729
|
-
(0,
|
|
15730
|
-
(0,
|
|
15727
|
+
(0, import_node_fs24.writeFileSync)(childPending, JSON.stringify(ownIdentity(child.pid)));
|
|
15728
|
+
(0, import_node_fs24.linkSync)(childPending, import_node_path23.default.join(directory, name(held, `child.${index}`)));
|
|
15731
15729
|
} finally {
|
|
15732
|
-
(0,
|
|
15730
|
+
(0, import_node_fs24.rmSync)(childPending, { force: true });
|
|
15733
15731
|
}
|
|
15734
15732
|
},
|
|
15735
15733
|
spawn(command, args, options, companion) {
|
|
@@ -15760,7 +15758,7 @@ async function withSwiftRootLock(root, work, signal, wait = true) {
|
|
|
15760
15758
|
return await work(lease);
|
|
15761
15759
|
} finally {
|
|
15762
15760
|
await Promise.all(children.map((child) => terminateProcessGroup(child, "SIGKILL", 0)));
|
|
15763
|
-
(0,
|
|
15761
|
+
(0, import_node_fs24.writeFileSync)(import_node_path23.default.join(directory, name(held, "released")), "");
|
|
15764
15762
|
}
|
|
15765
15763
|
}
|
|
15766
15764
|
|
|
@@ -15795,18 +15793,18 @@ function compileUniformTypeConstants(args) {
|
|
|
15795
15793
|
|
|
15796
15794
|
// src/write-build-file.ts
|
|
15797
15795
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
15798
|
-
var
|
|
15796
|
+
var import_node_fs25 = require("node:fs");
|
|
15799
15797
|
var import_node_path25 = __toESM(require("node:path"), 1);
|
|
15800
15798
|
function writeBuildFile(file, contents) {
|
|
15801
|
-
if ((0,
|
|
15799
|
+
if ((0, import_node_fs25.existsSync)(file) && (typeof contents === "string" ? (0, import_node_fs25.readFileSync)(file, "utf8") === contents : (0, import_node_fs25.readFileSync)(file).equals(contents)))
|
|
15802
15800
|
return;
|
|
15803
|
-
(0,
|
|
15804
|
-
(0,
|
|
15801
|
+
(0, import_node_fs25.mkdirSync)(import_node_path25.default.dirname(file), { recursive: true });
|
|
15802
|
+
(0, import_node_fs25.writeFileSync)(file, contents);
|
|
15805
15803
|
}
|
|
15806
15804
|
|
|
15807
15805
|
// src/xcode-header-search.ts
|
|
15808
15806
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
15809
|
-
var
|
|
15807
|
+
var import_node_fs26 = __toESM(require("node:fs"), 1);
|
|
15810
15808
|
var import_node_path26 = __toESM(require("node:path"), 1);
|
|
15811
15809
|
function headerMap(entries) {
|
|
15812
15810
|
const unique = /* @__PURE__ */ new Map();
|
|
@@ -15850,7 +15848,7 @@ function headerMap(entries) {
|
|
|
15850
15848
|
return Buffer.concat([table, ...strings]);
|
|
15851
15849
|
}
|
|
15852
15850
|
function writeXcodeHeaderSearch(directory, targets, headerAliases = {}) {
|
|
15853
|
-
|
|
15851
|
+
import_node_fs26.default.mkdirSync(directory, { recursive: true });
|
|
15854
15852
|
const productDirectories = /* @__PURE__ */ new Map();
|
|
15855
15853
|
for (const [product, original] of new Map([
|
|
15856
15854
|
...Object.entries(headerAliases),
|
|
@@ -16006,8 +16004,8 @@ function swiftBuilderHopTimeoutMs(compileTimeoutMs) {
|
|
|
16006
16004
|
}
|
|
16007
16005
|
function swiftDistributionAt(root) {
|
|
16008
16006
|
const file = import_node_path27.default.join(root, SWIFT_DISTRIBUTION_MANIFEST);
|
|
16009
|
-
if (!(0,
|
|
16010
|
-
return parseSwiftDistributionManifest(JSON.parse((0,
|
|
16007
|
+
if (!(0, import_node_fs27.existsSync)(file)) return null;
|
|
16008
|
+
return parseSwiftDistributionManifest(JSON.parse((0, import_node_fs27.readFileSync)(file, "utf8")));
|
|
16011
16009
|
}
|
|
16012
16010
|
function swiftModuleInterface(moduleRoot, name3, interfaceRoot) {
|
|
16013
16011
|
if (swiftDistributionAt(moduleRoot)) {
|
|
@@ -16015,17 +16013,17 @@ function swiftModuleInterface(moduleRoot, name3, interfaceRoot) {
|
|
|
16015
16013
|
interfaceRoot ?? import_node_path27.default.join(moduleRoot, "modules"),
|
|
16016
16014
|
`${name3}-Swift.h`
|
|
16017
16015
|
);
|
|
16018
|
-
if (!(0,
|
|
16019
|
-
const header = clangInterfaceHeader((0,
|
|
16016
|
+
if (!(0, import_node_fs27.existsSync)(file)) return null;
|
|
16017
|
+
const header = clangInterfaceHeader((0, import_node_fs27.readFileSync)(file, "utf8"));
|
|
16020
16018
|
return { declared: swiftInterfaceDeclarations(header), header };
|
|
16021
16019
|
}
|
|
16022
16020
|
const sources = import_node_path27.default.join(moduleRoot, "Sources", name3);
|
|
16023
16021
|
const built2 = import_node_path27.default.join(moduleRoot, ".build/host", `${name3}-Swift.h`);
|
|
16024
|
-
if (!(0,
|
|
16022
|
+
if (!(0, import_node_fs27.existsSync)(sources) || !(0, import_node_fs27.existsSync)(built2)) return null;
|
|
16025
16023
|
const declared = /* @__PURE__ */ new Set();
|
|
16026
|
-
for (const file of (0,
|
|
16024
|
+
for (const file of (0, import_node_fs27.readdirSync)(sources, { recursive: true, encoding: "utf8" }))
|
|
16027
16025
|
if (file.endsWith(".swift"))
|
|
16028
|
-
for (const [, objc, subclass] of (0,
|
|
16026
|
+
for (const [, objc, subclass] of (0, import_node_fs27.readFileSync)(
|
|
16029
16027
|
import_node_path27.default.join(sources, file),
|
|
16030
16028
|
"utf8"
|
|
16031
16029
|
).matchAll(
|
|
@@ -16033,7 +16031,7 @@ function swiftModuleInterface(moduleRoot, name3, interfaceRoot) {
|
|
|
16033
16031
|
))
|
|
16034
16032
|
declared.add(objc ?? subclass);
|
|
16035
16033
|
if (declared.size === 0) return null;
|
|
16036
|
-
return { declared, header: clangInterfaceHeader((0,
|
|
16034
|
+
return { declared, header: clangInterfaceHeader((0, import_node_fs27.readFileSync)(built2, "utf8")) };
|
|
16037
16035
|
}
|
|
16038
16036
|
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, "");
|
|
16039
16037
|
var swiftInterfaceDeclarations = (header) => /* @__PURE__ */ new Set([
|
|
@@ -16100,7 +16098,7 @@ function swiftObjCSelectorOptions(moduleRoot) {
|
|
|
16100
16098
|
for (const framework of ["UIKitCore", "WebKit"])
|
|
16101
16099
|
for (const [name3, members2] of Object.entries(
|
|
16102
16100
|
JSON.parse(
|
|
16103
|
-
(0,
|
|
16101
|
+
(0, import_node_fs27.readFileSync)(
|
|
16104
16102
|
import_node_path27.default.join(moduleRoot, "Sources", framework, "ObjCSelectors.json"),
|
|
16105
16103
|
"utf8"
|
|
16106
16104
|
)
|
|
@@ -16108,11 +16106,11 @@ function swiftObjCSelectorOptions(moduleRoot) {
|
|
|
16108
16106
|
))
|
|
16109
16107
|
classes[name3] = [...classes[name3] ?? [], ...members2];
|
|
16110
16108
|
map = import_node_path27.default.join(moduleRoot, ".build", SWIFT_DISTRIBUTION_OBJC_SELECTORS);
|
|
16111
|
-
(0,
|
|
16109
|
+
(0, import_node_fs27.mkdirSync)(import_node_path27.default.dirname(map), { recursive: true });
|
|
16112
16110
|
const partial = `${map}.${(0, import_node_crypto13.randomUUID)()}`;
|
|
16113
|
-
(0,
|
|
16111
|
+
(0, import_node_fs27.writeFileSync)(partial, `${JSON.stringify({ classes }, null, 2)}
|
|
16114
16112
|
`);
|
|
16115
|
-
(0,
|
|
16113
|
+
(0, import_node_fs27.renameSync)(partial, map);
|
|
16116
16114
|
}
|
|
16117
16115
|
return ["-Xswiftc", "-Xllvm", "-Xswiftc", `-peach-objc-selector-map=${map}`];
|
|
16118
16116
|
}
|
|
@@ -16146,7 +16144,7 @@ function swiftModuleInputFiles(root) {
|
|
|
16146
16144
|
"toolchain.json"
|
|
16147
16145
|
];
|
|
16148
16146
|
const walk3 = (dir) => {
|
|
16149
|
-
for (const entry of (0,
|
|
16147
|
+
for (const entry of (0, import_node_fs27.readdirSync)(import_node_path27.default.join(root, dir), {
|
|
16150
16148
|
withFileTypes: true
|
|
16151
16149
|
})) {
|
|
16152
16150
|
const relative2 = `${dir}/${entry.name}`;
|
|
@@ -16169,7 +16167,7 @@ function swiftMacroPlugins(moduleRoot, dir = import_node_path27.default.join(mod
|
|
|
16169
16167
|
stale: false
|
|
16170
16168
|
};
|
|
16171
16169
|
const release = JSON.parse(
|
|
16172
|
-
(0,
|
|
16170
|
+
(0, import_node_fs27.readFileSync)(import_node_path27.default.join(moduleRoot, "toolchain.json"), "utf8")
|
|
16173
16171
|
).release;
|
|
16174
16172
|
const compilerStamp = import_node_path27.default.join(dir, "compiler-release");
|
|
16175
16173
|
const pluginScript = import_node_path27.default.join(moduleRoot, "scripts/build-preview-plugin.sh");
|
|
@@ -16198,8 +16196,8 @@ function swiftMacroPlugins(moduleRoot, dir = import_node_path27.default.join(mod
|
|
|
16198
16196
|
return {
|
|
16199
16197
|
libraries: plugins.map(({ library }) => library),
|
|
16200
16198
|
executables: [expoPlugin],
|
|
16201
|
-
stale: !(0,
|
|
16202
|
-
({ library, sources }) => !(0,
|
|
16199
|
+
stale: !(0, import_node_fs27.existsSync)(compilerStamp) || !(0, import_node_fs27.existsSync)(expoPlugin) || (0, import_node_fs27.statSync)(pluginScript).mtimeMs > (0, import_node_fs27.statSync)(expoPlugin).mtimeMs || (0, import_node_fs27.readFileSync)(compilerStamp, "utf8").trim() !== release || plugins.some(
|
|
16200
|
+
({ library, sources }) => !(0, import_node_fs27.existsSync)(library) || sources.some((source) => (0, import_node_fs27.statSync)(source).mtimeMs > (0, import_node_fs27.statSync)(library).mtimeMs)
|
|
16203
16201
|
)
|
|
16204
16202
|
};
|
|
16205
16203
|
}
|
|
@@ -16215,7 +16213,7 @@ async function ensureMacroPlugins(moduleRoot, toolchainBin, release, signal, lea
|
|
|
16215
16213
|
],
|
|
16216
16214
|
{ signal, lease }
|
|
16217
16215
|
);
|
|
16218
|
-
(0,
|
|
16216
|
+
(0, import_node_fs27.writeFileSync)(
|
|
16219
16217
|
import_node_path27.default.join(import_node_path27.default.dirname(libraries[0]), "compiler-release"),
|
|
16220
16218
|
`${release}
|
|
16221
16219
|
`
|
|
@@ -16228,7 +16226,7 @@ function swiftModuleDigest(root) {
|
|
|
16228
16226
|
const files2 = swiftModuleInputFiles(root);
|
|
16229
16227
|
const stampHash = (0, import_node_crypto13.createHash)("sha256");
|
|
16230
16228
|
for (const file of files2) {
|
|
16231
|
-
const stat = (0,
|
|
16229
|
+
const stat = (0, import_node_fs27.statSync)(import_node_path27.default.join(root, file), { bigint: true });
|
|
16232
16230
|
stampHash.update(file);
|
|
16233
16231
|
stampHash.update(
|
|
16234
16232
|
`${stat.dev}:${stat.ino}:${stat.size}:${stat.mtimeNs}:${stat.ctimeNs}
|
|
@@ -16243,8 +16241,8 @@ function swiftModuleDigest(root) {
|
|
|
16243
16241
|
"swift-module-digests",
|
|
16244
16242
|
`${(0, import_node_crypto13.createHash)("sha256").update(root).digest("hex")}.json`
|
|
16245
16243
|
);
|
|
16246
|
-
if ((0,
|
|
16247
|
-
const saved = JSON.parse((0,
|
|
16244
|
+
if ((0, import_node_fs27.existsSync)(record2)) {
|
|
16245
|
+
const saved = JSON.parse((0, import_node_fs27.readFileSync)(record2, "utf8"));
|
|
16248
16246
|
if (saved && typeof saved === "object" && Reflect.get(saved, "stamp") === stamp && typeof Reflect.get(saved, "digest") === "string") {
|
|
16249
16247
|
const digest2 = Buffer.from(String(Reflect.get(saved, "digest")), "hex");
|
|
16250
16248
|
linkedModuleDigests.set(root, { stamp, digest: digest2 });
|
|
@@ -16255,15 +16253,15 @@ function swiftModuleDigest(root) {
|
|
|
16255
16253
|
for (const file of files2) {
|
|
16256
16254
|
hash.update((0, import_node_crypto13.createHash)("sha256").update(file).digest());
|
|
16257
16255
|
hash.update(
|
|
16258
|
-
(0, import_node_crypto13.createHash)("sha256").update((0,
|
|
16256
|
+
(0, import_node_crypto13.createHash)("sha256").update((0, import_node_fs27.readFileSync)(import_node_path27.default.join(root, file))).digest()
|
|
16259
16257
|
);
|
|
16260
16258
|
}
|
|
16261
16259
|
const digest = hash.digest();
|
|
16262
16260
|
linkedModuleDigests.set(root, { stamp, digest });
|
|
16263
|
-
(0,
|
|
16261
|
+
(0, import_node_fs27.mkdirSync)(import_node_path27.default.dirname(record2), { recursive: true });
|
|
16264
16262
|
const partial = `${record2}.${process.pid}.${(0, import_node_crypto13.randomUUID)()}`;
|
|
16265
|
-
(0,
|
|
16266
|
-
(0,
|
|
16263
|
+
(0, import_node_fs27.writeFileSync)(partial, JSON.stringify({ stamp, digest: digest.toString("hex") }));
|
|
16264
|
+
(0, import_node_fs27.renameSync)(partial, record2);
|
|
16267
16265
|
return digest;
|
|
16268
16266
|
}
|
|
16269
16267
|
function swiftProjectBuildKey(moduleRoot, release) {
|
|
@@ -16467,7 +16465,7 @@ function swiftImportNames(contents, available) {
|
|
|
16467
16465
|
function swiftPeachModules(moduleRoot) {
|
|
16468
16466
|
const distribution = swiftDistributionAt(moduleRoot);
|
|
16469
16467
|
return distribution ? distribution.modules : swiftManifestDeclarations(
|
|
16470
|
-
(0,
|
|
16468
|
+
(0, import_node_fs27.readFileSync)(import_node_path27.default.join(moduleRoot, "Package.swift"), "utf8")
|
|
16471
16469
|
).filter((target) => !target.executable && !target.path.startsWith("fixtures/")).map((target) => target.name);
|
|
16472
16470
|
}
|
|
16473
16471
|
var sdkPaths = /* @__PURE__ */ new Map();
|
|
@@ -16503,7 +16501,7 @@ function swiftSdkPaths(moduleRoot, toolchainBin) {
|
|
|
16503
16501
|
if (!Array.isArray(toolsets) || !toolsets.every((value) => typeof value === "string"))
|
|
16504
16502
|
throw new Error(`swift sdk ${sdk} reports invalid toolset paths`);
|
|
16505
16503
|
for (const toolset of toolsets) {
|
|
16506
|
-
const config = JSON.parse((0,
|
|
16504
|
+
const config = JSON.parse((0, import_node_fs27.readFileSync)(toolset, "utf8"));
|
|
16507
16505
|
if (!config || typeof config !== "object" || !("swiftCompiler" in config)) continue;
|
|
16508
16506
|
const compiler = config.swiftCompiler;
|
|
16509
16507
|
if (!compiler || typeof compiler !== "object" || !("extraCLIOptions" in compiler))
|
|
@@ -16565,23 +16563,23 @@ function swiftOverlayFrameworks(moduleRoot, toolchainBin) {
|
|
|
16565
16563
|
const swiftModules = new Set(swiftPeachModules(moduleRoot));
|
|
16566
16564
|
const result = /* @__PURE__ */ new Set();
|
|
16567
16565
|
const include = import_node_path27.default.join(darwin, "usr/include");
|
|
16568
|
-
for (const entry of (0,
|
|
16566
|
+
for (const entry of (0, import_node_fs27.readdirSync)(include))
|
|
16569
16567
|
if (entry.endsWith(".modulemap"))
|
|
16570
16568
|
addSwiftOverlayFrameworks(
|
|
16571
|
-
(0,
|
|
16569
|
+
(0, import_node_fs27.readFileSync)(import_node_path27.default.join(include, entry), "utf8"),
|
|
16572
16570
|
swiftModules,
|
|
16573
16571
|
result
|
|
16574
16572
|
);
|
|
16575
|
-
for (const entry of (0,
|
|
16573
|
+
for (const entry of (0, import_node_fs27.readdirSync)(resources)) {
|
|
16576
16574
|
const map = import_node_path27.default.join(resources, entry, "module.modulemap");
|
|
16577
|
-
if ((0,
|
|
16578
|
-
addSwiftOverlayFrameworks((0,
|
|
16575
|
+
if ((0, import_node_fs27.existsSync)(map))
|
|
16576
|
+
addSwiftOverlayFrameworks((0, import_node_fs27.readFileSync)(map, "utf8"), swiftModules, result);
|
|
16579
16577
|
}
|
|
16580
16578
|
for (const directory of frameworks)
|
|
16581
|
-
for (const entry of (0,
|
|
16579
|
+
for (const entry of (0, import_node_fs27.readdirSync)(directory)) {
|
|
16582
16580
|
const map = import_node_path27.default.join(directory, entry, "Modules/module.modulemap");
|
|
16583
|
-
if ((0,
|
|
16584
|
-
addSwiftOverlayFrameworks((0,
|
|
16581
|
+
if ((0, import_node_fs27.existsSync)(map))
|
|
16582
|
+
addSwiftOverlayFrameworks((0, import_node_fs27.readFileSync)(map, "utf8"), swiftModules, result);
|
|
16585
16583
|
}
|
|
16586
16584
|
sdkOverlayFrameworks.set(key2, result);
|
|
16587
16585
|
return result;
|
|
@@ -16604,8 +16602,8 @@ function swiftAvailableModules(moduleRoot, toolchainBin) {
|
|
|
16604
16602
|
})
|
|
16605
16603
|
]);
|
|
16606
16604
|
for (const map of maps) {
|
|
16607
|
-
if (!(0,
|
|
16608
|
-
const contents = (0,
|
|
16605
|
+
if (!(0, import_node_fs27.existsSync)(map)) continue;
|
|
16606
|
+
const contents = (0, import_node_fs27.readFileSync)(map, "utf8");
|
|
16609
16607
|
for (const match of contents.matchAll(
|
|
16610
16608
|
/^(?:explicit\s+)?(?:framework\s+)?module\s+([A-Za-z_]\w*)/gm
|
|
16611
16609
|
))
|
|
@@ -16613,14 +16611,14 @@ function swiftAvailableModules(moduleRoot, toolchainBin) {
|
|
|
16613
16611
|
for (const match of contents.matchAll(/^\s*extern\s+module\s+\w+\s+"([^"]+)"/gm))
|
|
16614
16612
|
maps.add(import_node_path27.default.resolve(import_node_path27.default.dirname(map), match[1]));
|
|
16615
16613
|
}
|
|
16616
|
-
for (const entry of (0,
|
|
16614
|
+
for (const entry of (0, import_node_fs27.readdirSync)(import_node_path27.default.join(resources, "wasi"))) {
|
|
16617
16615
|
if (entry.endsWith(".swiftmodule"))
|
|
16618
16616
|
modules.add(entry.slice(0, -".swiftmodule".length));
|
|
16619
16617
|
}
|
|
16620
|
-
for (const entry of (0,
|
|
16618
|
+
for (const entry of (0, import_node_fs27.readdirSync)(resources)) {
|
|
16621
16619
|
const map = import_node_path27.default.join(resources, entry, "module.modulemap");
|
|
16622
|
-
if (!(0,
|
|
16623
|
-
for (const match of (0,
|
|
16620
|
+
if (!(0, import_node_fs27.existsSync)(map)) continue;
|
|
16621
|
+
for (const match of (0, import_node_fs27.readFileSync)(map, "utf8").matchAll(/^module\s+([A-Za-z_]\w*)/gm))
|
|
16624
16622
|
modules.add(match[1]);
|
|
16625
16623
|
}
|
|
16626
16624
|
for (const libc of [
|
|
@@ -16630,18 +16628,18 @@ function swiftAvailableModules(moduleRoot, toolchainBin) {
|
|
|
16630
16628
|
"usr/include"
|
|
16631
16629
|
)
|
|
16632
16630
|
])
|
|
16633
|
-
for (const entry of (0,
|
|
16631
|
+
for (const entry of (0, import_node_fs27.readdirSync)(libc)) {
|
|
16634
16632
|
if (!entry.endsWith(".modulemap")) continue;
|
|
16635
|
-
for (const match of (0,
|
|
16633
|
+
for (const match of (0, import_node_fs27.readFileSync)(import_node_path27.default.join(libc, entry), "utf8").matchAll(
|
|
16636
16634
|
/^module\s+([A-Za-z_]\w*)/gm
|
|
16637
16635
|
))
|
|
16638
16636
|
modules.add(match[1]);
|
|
16639
16637
|
}
|
|
16640
16638
|
for (const directory of frameworks) {
|
|
16641
|
-
for (const entry of (0,
|
|
16639
|
+
for (const entry of (0, import_node_fs27.readdirSync)(directory)) {
|
|
16642
16640
|
const map = import_node_path27.default.join(directory, entry, "Modules/module.modulemap");
|
|
16643
|
-
if (!(0,
|
|
16644
|
-
for (const match of (0,
|
|
16641
|
+
if (!(0, import_node_fs27.existsSync)(map)) continue;
|
|
16642
|
+
for (const match of (0, import_node_fs27.readFileSync)(map, "utf8").matchAll(
|
|
16645
16643
|
/^framework\s+module\s+([A-Za-z_]\w*)/gm
|
|
16646
16644
|
))
|
|
16647
16645
|
modules.add(match[1]);
|
|
@@ -16693,18 +16691,18 @@ function swiftSystemLibraryExclusions(files2, targets, distributionModules) {
|
|
|
16693
16691
|
}
|
|
16694
16692
|
function providedModulesPath(root, modules, excluded) {
|
|
16695
16693
|
if (!excluded || excluded.size === 0) return modules;
|
|
16696
|
-
const entries = (0,
|
|
16694
|
+
const entries = (0, import_node_fs27.readdirSync)(modules).filter((entry) => !excluded.has(entry.replace(/\..*$/, ""))).sort();
|
|
16697
16695
|
const key2 = (0, import_node_crypto13.createHash)("sha256").update(JSON.stringify([modules, entries])).update([...excluded].sort().join("\0")).digest("hex").slice(0, 16);
|
|
16698
16696
|
const directory = import_node_path27.default.join(root, `.peach-modules-${key2}`);
|
|
16699
16697
|
const complete = import_node_path27.default.join(directory, ".complete");
|
|
16700
|
-
if (!(0,
|
|
16701
|
-
(0,
|
|
16702
|
-
for (const entry of (0,
|
|
16703
|
-
(0,
|
|
16698
|
+
if (!(0, import_node_fs27.existsSync)(complete)) {
|
|
16699
|
+
(0, import_node_fs27.mkdirSync)(directory, { recursive: true });
|
|
16700
|
+
for (const entry of (0, import_node_fs27.readdirSync)(directory))
|
|
16701
|
+
(0, import_node_fs27.rmSync)(import_node_path27.default.join(directory, entry), { recursive: true, force: true });
|
|
16704
16702
|
for (const entry of entries) {
|
|
16705
|
-
(0,
|
|
16703
|
+
(0, import_node_fs27.symlinkSync)(import_node_path27.default.join(modules, entry), import_node_path27.default.join(directory, entry));
|
|
16706
16704
|
}
|
|
16707
|
-
(0,
|
|
16705
|
+
(0, import_node_fs27.writeFileSync)(complete, "");
|
|
16708
16706
|
}
|
|
16709
16707
|
return directory;
|
|
16710
16708
|
}
|
|
@@ -16877,7 +16875,7 @@ function swiftCrossImportFlags(moduleRoot, distribution) {
|
|
|
16877
16875
|
moduleRoot,
|
|
16878
16876
|
distribution ? "modules" : "cross-import-overlays"
|
|
16879
16877
|
);
|
|
16880
|
-
return (0,
|
|
16878
|
+
return (0, import_node_fs27.readdirSync)(overlayRoot, { encoding: "utf8", recursive: true }).filter((file) => file.endsWith(".swiftoverlay")).sort((left, right) => left.localeCompare(right)).flatMap((file) => [
|
|
16881
16879
|
"-Xfrontend",
|
|
16882
16880
|
"-swift-module-cross-import",
|
|
16883
16881
|
"-Xfrontend",
|
|
@@ -17223,14 +17221,14 @@ function emitSwiftPackageManifest(args) {
|
|
|
17223
17221
|
].join("\n");
|
|
17224
17222
|
}
|
|
17225
17223
|
function syncSwiftTree(base, files2) {
|
|
17226
|
-
(0,
|
|
17224
|
+
(0, import_node_fs27.mkdirSync)(base, { recursive: true });
|
|
17227
17225
|
const walk3 = (dir) => {
|
|
17228
|
-
for (const entry of (0,
|
|
17226
|
+
for (const entry of (0, import_node_fs27.readdirSync)(dir, { withFileTypes: true })) {
|
|
17229
17227
|
const full = import_node_path27.default.join(dir, entry.name);
|
|
17230
17228
|
if (dir === base && (entry.name === ".build" || entry.name.startsWith(".peach-modules-") || entry.name === SWIFT_LINK_STAMP))
|
|
17231
17229
|
continue;
|
|
17232
17230
|
if (entry.isDirectory()) walk3(full);
|
|
17233
|
-
else if (!files2.has(full)) (0,
|
|
17231
|
+
else if (!files2.has(full)) (0, import_node_fs27.rmSync)(full, { force: true });
|
|
17234
17232
|
}
|
|
17235
17233
|
};
|
|
17236
17234
|
walk3(base);
|
|
@@ -18671,14 +18669,14 @@ function clangImportModuleMapFlags(settings, layoutRoot, written, generated) {
|
|
|
18671
18669
|
const directory = import_node_path27.default.join(layoutRoot, ".build", "peach-clang-modulemaps");
|
|
18672
18670
|
return (settings.moduleMaps ?? []).flatMap((map) => {
|
|
18673
18671
|
const headers = import_node_path27.default.join(layoutRoot, map.headers);
|
|
18674
|
-
if (!(0,
|
|
18672
|
+
if (!(0, import_node_fs27.existsSync)(headers)) return [];
|
|
18675
18673
|
const published = import_node_path27.default.join(headers, "module.modulemap");
|
|
18676
|
-
if (searched.has(map.headers) && (0,
|
|
18677
|
-
if (!searched.has(map.headers) && (0,
|
|
18674
|
+
if (searched.has(map.headers) && (0, import_node_fs27.existsSync)(published)) return [];
|
|
18675
|
+
if (!searched.has(map.headers) && (0, import_node_fs27.existsSync)(published))
|
|
18678
18676
|
return [`-fmodule-map-file=${published}`];
|
|
18679
18677
|
const cached = written.get(headers);
|
|
18680
18678
|
if (cached) return [cached];
|
|
18681
|
-
(0,
|
|
18679
|
+
(0, import_node_fs27.mkdirSync)(directory, { recursive: true });
|
|
18682
18680
|
const output2 = import_node_path27.default.join(directory, `module-${written.size}.modulemap`);
|
|
18683
18681
|
writeBuildFile(
|
|
18684
18682
|
output2,
|
|
@@ -18752,7 +18750,7 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
|
|
|
18752
18750
|
}
|
|
18753
18751
|
] : compileTargets(input);
|
|
18754
18752
|
const generatedOwners = new Map(targets.map((target) => [target.name, target.name]));
|
|
18755
|
-
const providedModules = distribution?.modules ?? (prebuilt ? (0,
|
|
18753
|
+
const providedModules = distribution?.modules ?? (prebuilt ? (0, import_node_fs27.readdirSync)(prebuilt.modules).filter((entry) => entry.endsWith(".swiftmodule")).map((entry) => entry.slice(0, -".swiftmodule".length)) : []);
|
|
18756
18754
|
const moduleExcludes = distribution || prebuilt ? /* @__PURE__ */ new Set([
|
|
18757
18755
|
...swiftSystemLibraryExclusions(input.files, targets, providedModules),
|
|
18758
18756
|
...providedModules.filter(
|
|
@@ -18792,15 +18790,15 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
|
|
|
18792
18790
|
}
|
|
18793
18791
|
const headerDirectory = import_node_path27.default.join(layout2.root, ".build", "peach-cxx-headers");
|
|
18794
18792
|
const flattenedHeaders = /* @__PURE__ */ new Set();
|
|
18795
|
-
if ((0,
|
|
18796
|
-
for (const entry of (0,
|
|
18793
|
+
if ((0, import_node_fs27.existsSync)(headerDirectory)) {
|
|
18794
|
+
for (const entry of (0, import_node_fs27.readdirSync)(headerDirectory, { withFileTypes: true }))
|
|
18797
18795
|
if (entry.isDirectory() && !targets.some((target) => target.name === entry.name))
|
|
18798
|
-
(0,
|
|
18796
|
+
(0, import_node_fs27.rmSync)(import_node_path27.default.join(headerDirectory, entry.name), { recursive: true, force: true });
|
|
18799
18797
|
}
|
|
18800
18798
|
let checkedToolchain;
|
|
18801
18799
|
const nativeToolchain = () => {
|
|
18802
18800
|
if (checkedToolchain) return checkedToolchain;
|
|
18803
|
-
const pin2 = distribution ?? JSON.parse((0,
|
|
18801
|
+
const pin2 = distribution ?? JSON.parse((0, import_node_fs27.readFileSync)(import_node_path27.default.join(moduleRoot, "toolchain.json"), "utf8"));
|
|
18804
18802
|
checkedToolchain = swiftToolchain(pin2.release, swiftModuleSdk(moduleRoot));
|
|
18805
18803
|
return checkedToolchain;
|
|
18806
18804
|
};
|
|
@@ -19216,7 +19214,7 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
|
|
|
19216
19214
|
const origin = settings?.sourceDirectories[file];
|
|
19217
19215
|
if (origin) {
|
|
19218
19216
|
const original = import_node_path27.default.join(layout2.root, origin, import_node_path27.default.posix.basename(file));
|
|
19219
|
-
(0,
|
|
19217
|
+
(0, import_node_fs27.mkdirSync)(import_node_path27.default.dirname(original), { recursive: true });
|
|
19220
19218
|
stageTargetFile(target.name, original, contents, { allowExisting: true });
|
|
19221
19219
|
}
|
|
19222
19220
|
const source = unitSource(file);
|
|
@@ -19446,7 +19444,7 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
|
|
|
19446
19444
|
`extern module ${map.module} ${JSON.stringify(map.published)}
|
|
19447
19445
|
`
|
|
19448
19446
|
);
|
|
19449
|
-
if (native.size > 0) (0,
|
|
19447
|
+
if (native.size > 0) (0, import_node_fs27.mkdirSync)(headerDirectory, { recursive: true });
|
|
19450
19448
|
const headerAliasFlags = Object.keys(input.headerAliases ?? {}).length > 0 ? ["-ivfsoverlay", headerSearch.files[0]] : [];
|
|
19451
19449
|
const nativeHeaderFlags = [...headerAliasFlags];
|
|
19452
19450
|
const originalMaps = /* @__PURE__ */ new Map();
|
|
@@ -19504,7 +19502,7 @@ module ${moduleName}.Swift {
|
|
|
19504
19502
|
swiftModuleInputFiles(moduleRoot).join("\n")
|
|
19505
19503
|
);
|
|
19506
19504
|
if (!distribution) {
|
|
19507
|
-
modulePlan.update((0,
|
|
19505
|
+
modulePlan.update((0, import_node_fs27.readFileSync)(import_node_path27.default.join(moduleRoot, "Package.swift")));
|
|
19508
19506
|
}
|
|
19509
19507
|
const resourcePlan = (0, import_node_crypto13.createHash)("sha256").update(
|
|
19510
19508
|
JSON.stringify(
|
|
@@ -19692,7 +19690,7 @@ module ${moduleName}.Swift {
|
|
|
19692
19690
|
if (file === "Package.swift") continue;
|
|
19693
19691
|
files2.set(import_node_path27.default.join(layout2.sources, file), compiled.get(file) ?? contents);
|
|
19694
19692
|
}
|
|
19695
|
-
let manifest = (0,
|
|
19693
|
+
let manifest = (0, import_node_fs27.readFileSync)(
|
|
19696
19694
|
import_node_path27.default.join(moduleRoot, "scripts/contrast-app-Package.swift"),
|
|
19697
19695
|
"utf8"
|
|
19698
19696
|
).replaceAll("__SOOTSIM_SWIFT_PACKAGE__", moduleRoot);
|
|
@@ -19777,7 +19775,7 @@ module ${moduleName}.Swift {
|
|
|
19777
19775
|
const reachesFrameworks = !distribution || swiftImportedModules.has("Foundation") || Object.entries(input.files).some(
|
|
19778
19776
|
([file, source]) => file.endsWith(".swift") && file !== input.entry && file !== "Package.swift" || /\.mm?$/.test(file) || source.includes("dispatch_")
|
|
19779
19777
|
) || [...importedModules].some(
|
|
19780
|
-
(name3) => distribution.modules.includes(name3) && !targets.some((target) => target.name === name3) && !(clangImportedModules.has(name3) && !swiftImportedModules.has(name3) && (0,
|
|
19778
|
+
(name3) => distribution.modules.includes(name3) && !targets.some((target) => target.name === name3) && !(clangImportedModules.has(name3) && !swiftImportedModules.has(name3) && (0, import_node_fs27.existsSync)(
|
|
19781
19779
|
import_node_path27.default.join(swiftSharedSdkRoot(moduleRoot, true), "usr/include", name3)
|
|
19782
19780
|
))
|
|
19783
19781
|
);
|
|
@@ -19959,7 +19957,7 @@ module ${moduleName}.Swift {
|
|
|
19959
19957
|
syncSwiftTree(layout2.root, files2);
|
|
19960
19958
|
const dependencies = new Map(
|
|
19961
19959
|
swiftManifestTargets(
|
|
19962
|
-
(0,
|
|
19960
|
+
(0, import_node_fs27.readFileSync)(import_node_path27.default.join(layout2.root, "Package.swift"), "utf8")
|
|
19963
19961
|
).map((target) => [
|
|
19964
19962
|
target.name,
|
|
19965
19963
|
(target.dependencies ?? []).flatMap(
|
|
@@ -20014,7 +20012,7 @@ function outputOf(error) {
|
|
|
20014
20012
|
}
|
|
20015
20013
|
function builtArtifact(layout2) {
|
|
20016
20014
|
const binDir = import_node_path27.default.join(layout2.root, ".build", WASM_TRIPLE, "release");
|
|
20017
|
-
const manifest = (0,
|
|
20015
|
+
const manifest = (0, import_node_fs27.readFileSync)(import_node_path27.default.join(layout2.root, "Package.swift"), "utf8");
|
|
20018
20016
|
const executable = swiftManifestTargets(manifest).find((target) => target.executable);
|
|
20019
20017
|
if (executable === void 0) {
|
|
20020
20018
|
throw new Error("swift-compile: the written manifest names no executable target");
|
|
@@ -20059,12 +20057,12 @@ function serialize(root, work, signal) {
|
|
|
20059
20057
|
function readCompiledArtifact(directory, hash) {
|
|
20060
20058
|
try {
|
|
20061
20059
|
const receipt = JSON.parse(
|
|
20062
|
-
(0,
|
|
20060
|
+
(0, import_node_fs27.readFileSync)(import_node_path27.default.join(directory, "artifact.json"), "utf8")
|
|
20063
20061
|
);
|
|
20064
20062
|
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")
|
|
20065
20063
|
return null;
|
|
20066
|
-
const bytes = (0,
|
|
20067
|
-
const gzip2 = (0,
|
|
20064
|
+
const bytes = (0, import_node_fs27.readFileSync)(import_node_path27.default.join(directory, "app.wasm"));
|
|
20065
|
+
const gzip2 = (0, import_node_fs27.readFileSync)(import_node_path27.default.join(directory, "icu.gz"));
|
|
20068
20066
|
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)
|
|
20069
20067
|
return null;
|
|
20070
20068
|
return { hash, bytes, icu: { sha256: receipt.icu, gzip: gzip2 } };
|
|
@@ -20076,12 +20074,12 @@ function readCompiledArtifact(directory, hash) {
|
|
|
20076
20074
|
}
|
|
20077
20075
|
function saveCompiledArtifact(root, artifact) {
|
|
20078
20076
|
const directory = import_node_path27.default.join(root, "artifact");
|
|
20079
|
-
(0,
|
|
20080
|
-
const pending = (0,
|
|
20077
|
+
(0, import_node_fs27.mkdirSync)(directory, { recursive: true });
|
|
20078
|
+
const pending = (0, import_node_fs27.mkdtempSync)(import_node_path27.default.join(root, ".artifact-"));
|
|
20081
20079
|
try {
|
|
20082
|
-
(0,
|
|
20083
|
-
(0,
|
|
20084
|
-
(0,
|
|
20080
|
+
(0, import_node_fs27.writeFileSync)(import_node_path27.default.join(pending, "app.wasm"), artifact.bytes);
|
|
20081
|
+
(0, import_node_fs27.writeFileSync)(import_node_path27.default.join(pending, "icu.gz"), artifact.icu.gzip);
|
|
20082
|
+
(0, import_node_fs27.writeFileSync)(
|
|
20085
20083
|
import_node_path27.default.join(pending, "artifact.json"),
|
|
20086
20084
|
JSON.stringify({
|
|
20087
20085
|
hash: artifact.hash,
|
|
@@ -20090,10 +20088,10 @@ function saveCompiledArtifact(root, artifact) {
|
|
|
20090
20088
|
})
|
|
20091
20089
|
);
|
|
20092
20090
|
for (const file of ["app.wasm", "icu.gz", "artifact.json"]) {
|
|
20093
|
-
(0,
|
|
20091
|
+
(0, import_node_fs27.renameSync)(import_node_path27.default.join(pending, file), import_node_path27.default.join(directory, file));
|
|
20094
20092
|
}
|
|
20095
20093
|
} finally {
|
|
20096
|
-
(0,
|
|
20094
|
+
(0, import_node_fs27.rmSync)(pending, { recursive: true, force: true });
|
|
20097
20095
|
}
|
|
20098
20096
|
}
|
|
20099
20097
|
var SHARED_ARTIFACT_BUDGET_BYTES = 4 * 1024 ** 3;
|
|
@@ -20104,14 +20102,14 @@ function vanished(error) {
|
|
|
20104
20102
|
}
|
|
20105
20103
|
function renewSharedArtifact(sharedRoot) {
|
|
20106
20104
|
try {
|
|
20107
|
-
(0,
|
|
20105
|
+
(0, import_node_fs27.utimesSync)(sharedRoot, /* @__PURE__ */ new Date(), /* @__PURE__ */ new Date());
|
|
20108
20106
|
} catch (error) {
|
|
20109
20107
|
if (!vanished(error)) throw error;
|
|
20110
20108
|
}
|
|
20111
20109
|
}
|
|
20112
20110
|
function pruneSharedArtifacts(parent, keep) {
|
|
20113
20111
|
const entries = [];
|
|
20114
|
-
for (const name3 of (0,
|
|
20112
|
+
for (const name3 of (0, import_node_fs27.readdirSync)(parent)) {
|
|
20115
20113
|
const directory = import_node_path27.default.join(parent, name3);
|
|
20116
20114
|
if (name3.startsWith(RETIRED_PREFIX)) {
|
|
20117
20115
|
reapRetiredCacheDirectory(parent, name3);
|
|
@@ -20119,14 +20117,14 @@ function pruneSharedArtifacts(parent, keep) {
|
|
|
20119
20117
|
}
|
|
20120
20118
|
try {
|
|
20121
20119
|
let bytes = 0;
|
|
20122
|
-
for (const file of (0,
|
|
20120
|
+
for (const file of (0, import_node_fs27.readdirSync)(import_node_path27.default.join(directory, "artifact"))) {
|
|
20123
20121
|
try {
|
|
20124
|
-
bytes += (0,
|
|
20122
|
+
bytes += (0, import_node_fs27.statSync)(import_node_path27.default.join(directory, "artifact", file)).size;
|
|
20125
20123
|
} catch (error) {
|
|
20126
20124
|
if (!vanished(error)) throw error;
|
|
20127
20125
|
}
|
|
20128
20126
|
}
|
|
20129
|
-
entries.push({ directory, used: (0,
|
|
20127
|
+
entries.push({ directory, used: (0, import_node_fs27.statSync)(directory).mtimeMs, bytes });
|
|
20130
20128
|
} catch (error) {
|
|
20131
20129
|
if (!vanished(error)) throw error;
|
|
20132
20130
|
}
|
|
@@ -20141,8 +20139,8 @@ function pruneSharedArtifacts(parent, keep) {
|
|
|
20141
20139
|
`${RETIRED_PREFIX}${process.pid}-${import_node_path27.default.basename(entry.directory)}`
|
|
20142
20140
|
);
|
|
20143
20141
|
try {
|
|
20144
|
-
if ((0,
|
|
20145
|
-
(0,
|
|
20142
|
+
if ((0, import_node_fs27.statSync)(entry.directory).mtimeMs !== entry.used) continue;
|
|
20143
|
+
(0, import_node_fs27.renameSync)(entry.directory, retired);
|
|
20146
20144
|
} catch (error) {
|
|
20147
20145
|
if (vanished(error)) continue;
|
|
20148
20146
|
throw error;
|
|
@@ -20182,7 +20180,7 @@ function frameworkLibraryTargets(manifest) {
|
|
|
20182
20180
|
}
|
|
20183
20181
|
function linkedFrameworkTargets(moduleRoot, input) {
|
|
20184
20182
|
const libraries = frameworkLibraryTargets(
|
|
20185
|
-
(0,
|
|
20183
|
+
(0, import_node_fs27.readFileSync)(import_node_path27.default.join(moduleRoot, "Package.swift"), "utf8")
|
|
20186
20184
|
);
|
|
20187
20185
|
const targets = compileTargets(input);
|
|
20188
20186
|
const planning = targets.length > 0 ? targets : [{ name: "App", path: "." }];
|
|
@@ -20199,7 +20197,7 @@ function linkedFrameworkTargets(moduleRoot, input) {
|
|
|
20199
20197
|
for (const name3 of [...siblings.values()].flat())
|
|
20200
20198
|
if (libraries.has(name3) && !planning.some((target) => target.name === name3))
|
|
20201
20199
|
reach(name3);
|
|
20202
|
-
const manifest = (0,
|
|
20200
|
+
const manifest = (0, import_node_fs27.readFileSync)(import_node_path27.default.join(moduleRoot, "Package.swift"), "utf8");
|
|
20203
20201
|
const targetDependencies = /* @__PURE__ */ new Map();
|
|
20204
20202
|
for (const match of manifest.matchAll(
|
|
20205
20203
|
/\.target\(\s*name:\s*"([^"]+)"\s*,\s*dependencies:\s*\[([^\]]*)\]/g
|
|
@@ -20217,11 +20215,11 @@ function linkedFrameworkTargets(moduleRoot, input) {
|
|
|
20217
20215
|
for (const name3 of reached)
|
|
20218
20216
|
for (const member of libraries.get(name3) ?? []) build(member);
|
|
20219
20217
|
const overlays = import_node_path27.default.join(moduleRoot, "cross-import-overlays");
|
|
20220
|
-
for (const directory of (0,
|
|
20218
|
+
for (const directory of (0, import_node_fs27.readdirSync)(overlays)) {
|
|
20221
20219
|
const companion = import_node_path27.default.basename(directory, ".swiftcrossimport");
|
|
20222
20220
|
if (!built2.has(companion)) continue;
|
|
20223
20221
|
const declaration = import_node_path27.default.join(overlays, directory, "SwiftUI.swiftoverlay");
|
|
20224
|
-
for (const match of (0,
|
|
20222
|
+
for (const match of (0, import_node_fs27.readFileSync)(declaration, "utf8").matchAll(
|
|
20225
20223
|
/^\s*- name: ([A-Za-z_]\w*)\s*$/gm
|
|
20226
20224
|
))
|
|
20227
20225
|
reach(match[1]);
|
|
@@ -20275,12 +20273,12 @@ ${dependencies}
|
|
|
20275
20273
|
)
|
|
20276
20274
|
`;
|
|
20277
20275
|
const sourceDir = import_node_path27.default.join(linkRoot, "Sources", FRAMEWORK_LINK_TARGET);
|
|
20278
|
-
(0,
|
|
20276
|
+
(0, import_node_fs27.mkdirSync)(sourceDir, { recursive: true });
|
|
20279
20277
|
const manifestPath = import_node_path27.default.join(linkRoot, "Package.swift");
|
|
20280
|
-
if (!(0,
|
|
20281
|
-
(0,
|
|
20278
|
+
if (!(0, import_node_fs27.existsSync)(manifestPath) || (0, import_node_fs27.readFileSync)(manifestPath, "utf8") !== manifest)
|
|
20279
|
+
(0, import_node_fs27.writeFileSync)(manifestPath, manifest);
|
|
20282
20280
|
const source = import_node_path27.default.join(sourceDir, "Link.swift");
|
|
20283
|
-
if (!(0,
|
|
20281
|
+
if (!(0, import_node_fs27.existsSync)(source)) (0, import_node_fs27.writeFileSync)(source, "");
|
|
20284
20282
|
}
|
|
20285
20283
|
function frameworkLinkClosure(scratch2, roots) {
|
|
20286
20284
|
const suffix = `${WASM_TRIPLE}-release`;
|
|
@@ -20291,7 +20289,7 @@ function frameworkLinkClosure(scratch2, roots) {
|
|
|
20291
20289
|
const moduleMaps = /* @__PURE__ */ new Map();
|
|
20292
20290
|
let pending = null;
|
|
20293
20291
|
let compiling = null;
|
|
20294
|
-
for (const line of (0,
|
|
20292
|
+
for (const line of (0, import_node_fs27.readFileSync)(import_node_path27.default.join(scratch2, "release.yaml"), "utf8").split(
|
|
20295
20293
|
"\n"
|
|
20296
20294
|
)) {
|
|
20297
20295
|
const phony = phonyHeader.exec(line);
|
|
@@ -20355,7 +20353,7 @@ function frameworkLinkClosure(scratch2, roots) {
|
|
|
20355
20353
|
owners.set(file, name3);
|
|
20356
20354
|
if (seen.has(file)) continue;
|
|
20357
20355
|
seen.add(file);
|
|
20358
|
-
if (!(0,
|
|
20356
|
+
if (!(0, import_node_fs27.existsSync)(file))
|
|
20359
20357
|
throw new Error(`swift-compile: framework object ${file} was not built`);
|
|
20360
20358
|
files2.push(file);
|
|
20361
20359
|
}
|
|
@@ -20365,14 +20363,14 @@ function frameworkLinkClosure(scratch2, roots) {
|
|
|
20365
20363
|
return { objects: files2, owners, modules, moduleMaps: [...maps].sort() };
|
|
20366
20364
|
}
|
|
20367
20365
|
function removeCaseCollidingModuleArtifacts(modulesDir, keep) {
|
|
20368
|
-
if (!(0,
|
|
20366
|
+
if (!(0, import_node_fs27.existsSync)(modulesDir)) return;
|
|
20369
20367
|
const folded = new Set([...keep].map((name3) => name3.toLowerCase()));
|
|
20370
|
-
for (const name3 of (0,
|
|
20368
|
+
for (const name3 of (0, import_node_fs27.readdirSync)(modulesDir)) {
|
|
20371
20369
|
const dot = name3.indexOf(".");
|
|
20372
20370
|
if (dot <= 0) continue;
|
|
20373
20371
|
const module2 = name3.slice(0, dot);
|
|
20374
20372
|
if (keep.has(module2) || !folded.has(module2.toLowerCase())) continue;
|
|
20375
|
-
(0,
|
|
20373
|
+
(0, import_node_fs27.rmSync)(import_node_path27.default.join(modulesDir, name3), { recursive: true, force: true });
|
|
20376
20374
|
}
|
|
20377
20375
|
}
|
|
20378
20376
|
async function buildFrameworkProducts(scratch2, args) {
|
|
@@ -20437,7 +20435,7 @@ async function buildFrameworkProducts(scratch2, args) {
|
|
|
20437
20435
|
const objects = linked.objects;
|
|
20438
20436
|
if (linked.modules.has("UniformTypeIdentifiers")) {
|
|
20439
20437
|
const object4 = import_node_path27.default.join(scratch2, "UniformTypeIdentifiers-NativeConstants.o");
|
|
20440
|
-
if (!(0,
|
|
20438
|
+
if (!(0, import_node_fs27.existsSync)(object4)) {
|
|
20441
20439
|
const sdkPaths2 = swiftSdkPaths(args.moduleRoot, args.toolchainBin);
|
|
20442
20440
|
compileUniformTypeConstants({
|
|
20443
20441
|
bin: args.toolchainBin,
|
|
@@ -20453,13 +20451,13 @@ async function buildFrameworkProducts(scratch2, args) {
|
|
|
20453
20451
|
}
|
|
20454
20452
|
removeCaseCollidingModuleArtifacts(import_node_path27.default.join(release, "Modules"), linked.modules);
|
|
20455
20453
|
const response = import_node_path27.default.join(scratch2, "autolink-objects.rsp");
|
|
20456
|
-
(0,
|
|
20454
|
+
(0, import_node_fs27.writeFileSync)(response, objects.map((file) => JSON.stringify(file)).join("\n") + "\n");
|
|
20457
20455
|
const extracted = await runCompiler(
|
|
20458
20456
|
import_node_path27.default.join(args.toolchainBin, "swift-autolink-extract"),
|
|
20459
20457
|
[`@${response}`, "-o", "-"],
|
|
20460
20458
|
args.buildOptions
|
|
20461
20459
|
);
|
|
20462
|
-
(0,
|
|
20460
|
+
(0, import_node_fs27.rmSync)(response, { force: true });
|
|
20463
20461
|
const link = extracted.split("\n").map((line) => line.trim()).filter((flag, index, all) => flag.length > 0 && all.indexOf(flag) === index);
|
|
20464
20462
|
if (link.includes("-lFoundation"))
|
|
20465
20463
|
for (const name3 of foundationCategoryObjects) {
|
|
@@ -20472,9 +20470,9 @@ async function buildFrameworkProducts(scratch2, args) {
|
|
|
20472
20470
|
}
|
|
20473
20471
|
const providerDir = import_node_path27.default.join(scratch2, "darwin-records");
|
|
20474
20472
|
const providerStamp = import_node_path27.default.join(providerDir, ".complete");
|
|
20475
|
-
if (!(0,
|
|
20476
|
-
(0,
|
|
20477
|
-
(0,
|
|
20473
|
+
if (!(0, import_node_fs27.existsSync)(providerStamp) || (0, import_node_fs27.readFileSync)(providerStamp, "utf8") !== args.frameworkKey) {
|
|
20474
|
+
(0, import_node_fs27.rmSync)(providerDir, { recursive: true, force: true });
|
|
20475
|
+
(0, import_node_fs27.mkdirSync)(providerDir);
|
|
20478
20476
|
const sdkPaths2 = swiftSdkPaths(args.moduleRoot, args.toolchainBin);
|
|
20479
20477
|
compileDarwinRecords({
|
|
20480
20478
|
bin: args.toolchainBin,
|
|
@@ -20484,9 +20482,9 @@ async function buildFrameworkProducts(scratch2, args) {
|
|
|
20484
20482
|
minimum: darwinRecordsMinimum(),
|
|
20485
20483
|
out: providerDir
|
|
20486
20484
|
});
|
|
20487
|
-
(0,
|
|
20485
|
+
(0, import_node_fs27.writeFileSync)(providerStamp, args.frameworkKey);
|
|
20488
20486
|
}
|
|
20489
|
-
const providers = (0,
|
|
20487
|
+
const providers = (0, import_node_fs27.readdirSync)(providerDir).filter((file) => file.endsWith(".o")).sort().map((file) => import_node_path27.default.join(providerDir, file));
|
|
20490
20488
|
for (const provider of providers) linked.owners.set(provider, "DarwinRecords");
|
|
20491
20489
|
return {
|
|
20492
20490
|
modules: import_node_path27.default.join(release, "Modules"),
|
|
@@ -20509,7 +20507,7 @@ function swiftFrameworkScratch(frameworkKey) {
|
|
|
20509
20507
|
}
|
|
20510
20508
|
function swiftFrameworkSlotRecord(slot, record2) {
|
|
20511
20509
|
try {
|
|
20512
|
-
return (0,
|
|
20510
|
+
return (0, import_node_fs27.readFileSync)(import_node_path27.default.join(slot, record2), "utf8").trim();
|
|
20513
20511
|
} catch (error) {
|
|
20514
20512
|
if (!vanished(error)) throw error;
|
|
20515
20513
|
return null;
|
|
@@ -20521,17 +20519,17 @@ function swiftFrameworkSlotKey(slot) {
|
|
|
20521
20519
|
async function withSwiftFrameworkSlot(frameworkKey, moduleRoot, signal, work) {
|
|
20522
20520
|
const slots = Array.from({ length: SWIFT_FRAMEWORK_SLOTS }, (_, index) => {
|
|
20523
20521
|
const slot = import_node_path27.default.join(swiftFrameworksDir(), `slot-${index}`);
|
|
20524
|
-
(0,
|
|
20522
|
+
(0, import_node_fs27.mkdirSync)(slot, { recursive: true });
|
|
20525
20523
|
return slot;
|
|
20526
20524
|
});
|
|
20527
20525
|
const run5 = (slot) => (lease) => {
|
|
20528
20526
|
const now = /* @__PURE__ */ new Date();
|
|
20529
|
-
(0,
|
|
20527
|
+
(0, import_node_fs27.utimesSync)(slot, now, now);
|
|
20530
20528
|
return work(slot, lease);
|
|
20531
20529
|
};
|
|
20532
20530
|
const staged = slots.find((slot) => swiftFrameworkSlotKey(slot) === frameworkKey);
|
|
20533
20531
|
if (staged) return withSwiftRootLock(staged, run5(staged), signal);
|
|
20534
|
-
const built2 = new Map(slots.map((slot) => [slot, (0,
|
|
20532
|
+
const built2 = new Map(slots.map((slot) => [slot, (0, import_node_fs27.statSync)(slot).mtimeMs]));
|
|
20535
20533
|
const own = (slot) => swiftFrameworkSlotRecord(slot, SWIFT_FRAMEWORK_SLOT_ORIGIN) === moduleRoot;
|
|
20536
20534
|
const oldest = slots.sort(
|
|
20537
20535
|
(left, right) => (built2.get(left) ?? 0) - (built2.get(right) ?? 0)
|
|
@@ -20551,48 +20549,48 @@ async function withSwiftFrameworkSlot(frameworkKey, moduleRoot, signal, work) {
|
|
|
20551
20549
|
return withSwiftRootLock(oldest[0], run5(oldest[0]), signal);
|
|
20552
20550
|
}
|
|
20553
20551
|
function mirrorTree2(source, target, skip) {
|
|
20554
|
-
(0,
|
|
20552
|
+
(0, import_node_fs27.mkdirSync)(target, { recursive: true });
|
|
20555
20553
|
const wanted = /* @__PURE__ */ new Set();
|
|
20556
|
-
for (const entry of (0,
|
|
20554
|
+
for (const entry of (0, import_node_fs27.readdirSync)(source, { withFileTypes: true })) {
|
|
20557
20555
|
if (entry.name === skip) continue;
|
|
20558
20556
|
wanted.add(entry.name);
|
|
20559
20557
|
const from = import_node_path27.default.join(source, entry.name);
|
|
20560
20558
|
const to = import_node_path27.default.join(target, entry.name);
|
|
20561
20559
|
let existing = null;
|
|
20562
20560
|
try {
|
|
20563
|
-
existing = (0,
|
|
20561
|
+
existing = (0, import_node_fs27.lstatSync)(to);
|
|
20564
20562
|
} catch (error) {
|
|
20565
20563
|
if (!vanished(error)) throw error;
|
|
20566
20564
|
}
|
|
20567
20565
|
if (entry.isDirectory()) {
|
|
20568
|
-
if (existing && !existing.isDirectory()) (0,
|
|
20566
|
+
if (existing && !existing.isDirectory()) (0, import_node_fs27.rmSync)(to, { force: true });
|
|
20569
20567
|
mirrorTree2(from, to);
|
|
20570
20568
|
} else if (entry.isSymbolicLink()) {
|
|
20571
|
-
const link = (0,
|
|
20572
|
-
if (existing?.isSymbolicLink() && (0,
|
|
20573
|
-
if (existing) (0,
|
|
20574
|
-
(0,
|
|
20569
|
+
const link = (0, import_node_fs27.readlinkSync)(from);
|
|
20570
|
+
if (existing?.isSymbolicLink() && (0, import_node_fs27.readlinkSync)(to) === link) continue;
|
|
20571
|
+
if (existing) (0, import_node_fs27.rmSync)(to, { recursive: true, force: true });
|
|
20572
|
+
(0, import_node_fs27.symlinkSync)(link, to);
|
|
20575
20573
|
} else {
|
|
20576
|
-
const stat = (0,
|
|
20577
|
-
if (existing?.isFile() && existing.size === stat.size && (existing.mtimeMs === stat.mtimeMs || (0,
|
|
20574
|
+
const stat = (0, import_node_fs27.statSync)(from);
|
|
20575
|
+
if (existing?.isFile() && existing.size === stat.size && (existing.mtimeMs === stat.mtimeMs || (0, import_node_fs27.readFileSync)(from).equals((0, import_node_fs27.readFileSync)(to))))
|
|
20578
20576
|
continue;
|
|
20579
|
-
if (existing) (0,
|
|
20577
|
+
if (existing) (0, import_node_fs27.rmSync)(to, { recursive: true, force: true });
|
|
20580
20578
|
const partial = `${to}.${(0, import_node_crypto13.randomUUID)()}`;
|
|
20581
|
-
(0,
|
|
20582
|
-
(0,
|
|
20583
|
-
(0,
|
|
20579
|
+
(0, import_node_fs27.copyFileSync)(from, partial);
|
|
20580
|
+
(0, import_node_fs27.utimesSync)(partial, stat.atime, stat.mtime);
|
|
20581
|
+
(0, import_node_fs27.renameSync)(partial, to);
|
|
20584
20582
|
}
|
|
20585
20583
|
}
|
|
20586
|
-
for (const name3 of (0,
|
|
20584
|
+
for (const name3 of (0, import_node_fs27.readdirSync)(target))
|
|
20587
20585
|
if (!wanted.has(name3) && name3 !== skip)
|
|
20588
|
-
(0,
|
|
20586
|
+
(0, import_node_fs27.rmSync)(import_node_path27.default.join(target, name3), { recursive: true, force: true });
|
|
20589
20587
|
}
|
|
20590
20588
|
function stageFrameworkSource(moduleRoot, slot, frameworkKey, release) {
|
|
20591
20589
|
if (!slot) return moduleRoot;
|
|
20592
20590
|
const staged = import_node_path27.default.join(slot, "source");
|
|
20593
20591
|
const stagedModule = import_node_path27.default.join(staged, "packages", import_node_path27.default.basename(moduleRoot));
|
|
20594
20592
|
if (swiftFrameworkSlotKey(slot) !== frameworkKey) {
|
|
20595
|
-
(0,
|
|
20593
|
+
(0, import_node_fs27.rmSync)(import_node_path27.default.join(slot, SWIFT_FRAMEWORK_SLOT_KEY), { force: true });
|
|
20596
20594
|
mirrorTree2(moduleRoot, stagedModule, ".build");
|
|
20597
20595
|
mirrorTree2(
|
|
20598
20596
|
swiftSharedSdkRoot(moduleRoot, false),
|
|
@@ -20602,20 +20600,20 @@ function stageFrameworkSource(moduleRoot, slot, frameworkKey, release) {
|
|
|
20602
20600
|
if (!file.startsWith("../")) continue;
|
|
20603
20601
|
const from = import_node_path27.default.resolve(moduleRoot, file);
|
|
20604
20602
|
const to = import_node_path27.default.resolve(stagedModule, file);
|
|
20605
|
-
if ((0,
|
|
20606
|
-
(0,
|
|
20607
|
-
(0,
|
|
20603
|
+
if ((0, import_node_fs27.existsSync)(to) && (0, import_node_fs27.readFileSync)(from).equals((0, import_node_fs27.readFileSync)(to))) continue;
|
|
20604
|
+
(0, import_node_fs27.mkdirSync)(import_node_path27.default.dirname(to), { recursive: true });
|
|
20605
|
+
(0, import_node_fs27.copyFileSync)(from, to);
|
|
20608
20606
|
}
|
|
20609
20607
|
if (swiftProjectBuildKey(stagedModule, release) !== frameworkKey)
|
|
20610
20608
|
throw new Error("Swift staged framework source differs from the caller");
|
|
20611
20609
|
const modules = import_node_path27.default.join(staged, "node_modules");
|
|
20612
|
-
const target = (0,
|
|
20613
|
-
if (!(0,
|
|
20614
|
-
(0,
|
|
20615
|
-
(0,
|
|
20610
|
+
const target = (0, import_node_fs27.realpathSync)(import_node_path27.default.join(moduleRoot, "../../node_modules"));
|
|
20611
|
+
if (!(0, import_node_fs27.existsSync)(modules) || (0, import_node_fs27.readlinkSync)(modules) !== target) {
|
|
20612
|
+
(0, import_node_fs27.rmSync)(modules, { recursive: true, force: true });
|
|
20613
|
+
(0, import_node_fs27.symlinkSync)(target, modules);
|
|
20616
20614
|
}
|
|
20617
|
-
(0,
|
|
20618
|
-
(0,
|
|
20615
|
+
(0, import_node_fs27.writeFileSync)(import_node_path27.default.join(slot, SWIFT_FRAMEWORK_SLOT_KEY), frameworkKey);
|
|
20616
|
+
(0, import_node_fs27.writeFileSync)(import_node_path27.default.join(slot, SWIFT_FRAMEWORK_SLOT_ORIGIN), moduleRoot);
|
|
20619
20617
|
}
|
|
20620
20618
|
return stagedModule;
|
|
20621
20619
|
}
|
|
@@ -20626,7 +20624,7 @@ ${args.frameworkKey}
|
|
|
20626
20624
|
`);
|
|
20627
20625
|
if (!args.prebuilt) return hash.digest("hex");
|
|
20628
20626
|
const statOf = (file) => {
|
|
20629
|
-
const stat = (0,
|
|
20627
|
+
const stat = (0, import_node_fs27.statSync)(file, { bigint: true });
|
|
20630
20628
|
return `${stat.size}:${stat.mtimeNs}`;
|
|
20631
20629
|
};
|
|
20632
20630
|
for (const object4 of args.prebuilt.objects)
|
|
@@ -20647,7 +20645,7 @@ ${args.prebuilt.link.join("\n")}
|
|
|
20647
20645
|
hash.update(`modules
|
|
20648
20646
|
${args.prebuilt.modules}
|
|
20649
20647
|
`);
|
|
20650
|
-
for (const entry of (0,
|
|
20648
|
+
for (const entry of (0, import_node_fs27.readdirSync)(args.prebuilt.modules).sort())
|
|
20651
20649
|
hash.update(`${entry}
|
|
20652
20650
|
${statOf(import_node_path27.default.join(args.prebuilt.modules, entry))}`);
|
|
20653
20651
|
return hash.digest("hex");
|
|
@@ -20656,15 +20654,15 @@ function retireStaleSwiftLink(root, stamp) {
|
|
|
20656
20654
|
const receipt = import_node_path27.default.join(root, SWIFT_LINK_STAMP);
|
|
20657
20655
|
let previous = null;
|
|
20658
20656
|
try {
|
|
20659
|
-
previous = (0,
|
|
20657
|
+
previous = (0, import_node_fs27.readFileSync)(receipt, "utf8").trim();
|
|
20660
20658
|
} catch (error) {
|
|
20661
20659
|
if (!vanished(error)) throw error;
|
|
20662
20660
|
}
|
|
20663
|
-
(0,
|
|
20661
|
+
(0, import_node_fs27.writeFileSync)(receipt, `${stamp}
|
|
20664
20662
|
`);
|
|
20665
20663
|
const retired = import_node_path27.default.join(root, ".build");
|
|
20666
|
-
if (previous === stamp || !(0,
|
|
20667
|
-
(0,
|
|
20664
|
+
if (previous === stamp || !(0, import_node_fs27.existsSync)(retired)) return false;
|
|
20665
|
+
(0, import_node_fs27.rmSync)(retired, { recursive: true, force: true });
|
|
20668
20666
|
return true;
|
|
20669
20667
|
}
|
|
20670
20668
|
async function compileSwiftProjectUnit(input, options) {
|
|
@@ -20679,8 +20677,8 @@ async function compileSwiftProjectUnit(input, options) {
|
|
|
20679
20677
|
}
|
|
20680
20678
|
function compileSwiftProjectOnce(input, options) {
|
|
20681
20679
|
options.signal?.throwIfAborted();
|
|
20682
|
-
(0,
|
|
20683
|
-
const root = (0,
|
|
20680
|
+
(0, import_node_fs27.mkdirSync)(options.buildRoot, { recursive: true });
|
|
20681
|
+
const root = (0, import_node_fs27.realpathSync)(options.buildRoot);
|
|
20684
20682
|
const moduleRoot = import_node_path27.default.resolve(options.moduleRoot);
|
|
20685
20683
|
const distribution = swiftDistributionAt(moduleRoot);
|
|
20686
20684
|
const guestGraph = distribution ? input.sourceLinkGraph : void 0;
|
|
@@ -20715,10 +20713,10 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
20715
20713
|
return retain(root, previous);
|
|
20716
20714
|
}
|
|
20717
20715
|
if (process.platform === "darwin" && process.env.TM_SESSION && !windowAdmission() && process.env.CI !== "true" && moduleRoot === sourceSwiftCheckout() && !swiftDistributionAt(moduleRoot)) {
|
|
20718
|
-
const requestRoot = (0,
|
|
20716
|
+
const requestRoot = (0, import_node_fs27.mkdtempSync)(`${root}.builder-request-`);
|
|
20719
20717
|
const output2 = import_node_path27.default.join(requestRoot, "output");
|
|
20720
20718
|
const request = import_node_path27.default.join(requestRoot, "request.json");
|
|
20721
|
-
(0,
|
|
20719
|
+
(0, import_node_fs27.writeFileSync)(
|
|
20722
20720
|
request,
|
|
20723
20721
|
JSON.stringify({
|
|
20724
20722
|
input,
|
|
@@ -20764,7 +20762,7 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
20764
20762
|
report("builder artifact verified");
|
|
20765
20763
|
return retain(root, artifact);
|
|
20766
20764
|
} finally {
|
|
20767
|
-
(0,
|
|
20765
|
+
(0, import_node_fs27.rmSync)(requestRoot, { recursive: true, force: true });
|
|
20768
20766
|
}
|
|
20769
20767
|
}
|
|
20770
20768
|
return withSwiftRootLock(
|
|
@@ -20776,7 +20774,7 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
20776
20774
|
return retain(root, built2);
|
|
20777
20775
|
}
|
|
20778
20776
|
const swift = import_node_path27.default.join(options.toolchainBin, "swift");
|
|
20779
|
-
if (!(0,
|
|
20777
|
+
if (!(0, import_node_fs27.existsSync)(swift)) {
|
|
20780
20778
|
throw new Error(
|
|
20781
20779
|
`swift-compile: no swift.org toolchain at ${options.toolchainBin}; install ${options.release} and its matching wasm sdk`
|
|
20782
20780
|
);
|
|
@@ -20851,10 +20849,10 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
20851
20849
|
writeSwiftAutolinkLinker(
|
|
20852
20850
|
root,
|
|
20853
20851
|
options.toolchainBin,
|
|
20854
|
-
(0,
|
|
20852
|
+
(0, import_node_fs27.existsSync)(productFile) ? [
|
|
20855
20853
|
v5.parse(
|
|
20856
20854
|
swiftFrameworkProductSchema,
|
|
20857
|
-
JSON.parse((0,
|
|
20855
|
+
JSON.parse((0, import_node_fs27.readFileSync)(productFile, "utf8"))
|
|
20858
20856
|
).product.name
|
|
20859
20857
|
] : []
|
|
20860
20858
|
);
|
|
@@ -20924,9 +20922,9 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
20924
20922
|
];
|
|
20925
20923
|
const linked = builtArtifact(layout2);
|
|
20926
20924
|
if (input.optimize) {
|
|
20927
|
-
(0,
|
|
20928
|
-
if ((0,
|
|
20929
|
-
(0,
|
|
20925
|
+
(0, import_node_fs27.rmSync)(import_node_path27.default.join(root, ".peach-link.rsp"), { force: true });
|
|
20926
|
+
if ((0, import_node_fs27.existsSync)(linked) && (0, import_node_fs27.statSync)(linked).size <= 8)
|
|
20927
|
+
(0, import_node_fs27.rmSync)(linked, { force: true });
|
|
20930
20928
|
}
|
|
20931
20929
|
report("compiling and linking Swift modules");
|
|
20932
20930
|
try {
|
|
@@ -20952,11 +20950,11 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
20952
20950
|
`${producer}-Swift.h`
|
|
20953
20951
|
);
|
|
20954
20952
|
const original = preparation.nativeHeaderDeclarations[producer] ? emitted.replace(/-Swift\.h$/, "-Swift.original.h") : emitted;
|
|
20955
|
-
if ((0,
|
|
20953
|
+
if ((0, import_node_fs27.existsSync)(original))
|
|
20956
20954
|
writeBuildFile(
|
|
20957
20955
|
emitted,
|
|
20958
20956
|
withoutSwiftDeclarations(
|
|
20959
|
-
clangInterfaceHeader((0,
|
|
20957
|
+
clangInterfaceHeader((0, import_node_fs27.readFileSync)(original, "utf8")),
|
|
20960
20958
|
new Set(preparation.nativeHeaderDeclarations[producer]),
|
|
20961
20959
|
`#import <${producer}/${producer}.h>`
|
|
20962
20960
|
)
|
|
@@ -20967,9 +20965,9 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
20967
20965
|
root,
|
|
20968
20966
|
".build",
|
|
20969
20967
|
"peach-native-targets",
|
|
20970
|
-
(0, import_node_crypto13.createHash)("sha256").update((0,
|
|
20968
|
+
(0, import_node_crypto13.createHash)("sha256").update((0, import_node_fs27.readFileSync)(import_node_path27.default.join(root, "Package.swift"))).digest("hex")
|
|
20971
20969
|
);
|
|
20972
|
-
(0,
|
|
20970
|
+
(0, import_node_fs27.mkdirSync)(checkpoints, { recursive: true });
|
|
20973
20971
|
for (const target of /* @__PURE__ */ new Set([
|
|
20974
20972
|
...input.staticClangTargets ?? [],
|
|
20975
20973
|
...preparation.nativeBuildTargets
|
|
@@ -20978,7 +20976,7 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
20978
20976
|
checkpoints,
|
|
20979
20977
|
(0, import_node_crypto13.createHash)("sha256").update(target).digest("hex")
|
|
20980
20978
|
);
|
|
20981
|
-
if ((0,
|
|
20979
|
+
if ((0, import_node_fs27.existsSync)(checkpoint)) continue;
|
|
20982
20980
|
await runCompiler(
|
|
20983
20981
|
swift,
|
|
20984
20982
|
[...buildArgs, "--target", target],
|
|
@@ -20986,7 +20984,7 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
20986
20984
|
SWIFTPM_PROGRESS,
|
|
20987
20985
|
SWIFTPM_NOISE
|
|
20988
20986
|
);
|
|
20989
|
-
(0,
|
|
20987
|
+
(0, import_node_fs27.writeFileSync)(checkpoint, "");
|
|
20990
20988
|
}
|
|
20991
20989
|
await runCompiler(
|
|
20992
20990
|
swift,
|
|
@@ -21004,8 +21002,8 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
21004
21002
|
"release",
|
|
21005
21003
|
"ModuleCache"
|
|
21006
21004
|
);
|
|
21007
|
-
if (output3.includes("was compiled with module cache path") && (0,
|
|
21008
|
-
(0,
|
|
21005
|
+
if (output3.includes("was compiled with module cache path") && (0, import_node_fs27.existsSync)(moduleCache)) {
|
|
21006
|
+
(0, import_node_fs27.rmSync)(moduleCache, { recursive: true, force: true });
|
|
21009
21007
|
try {
|
|
21010
21008
|
await runCompiler(
|
|
21011
21009
|
swift,
|
|
@@ -21035,9 +21033,9 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
21035
21033
|
if (options.project) endSwiftProjectProcesses(options.project);
|
|
21036
21034
|
}
|
|
21037
21035
|
if (unprepared.length) throw new Error(unprepared.join("\n"));
|
|
21038
|
-
if (!(0,
|
|
21036
|
+
if (!(0, import_node_fs27.existsSync)(linked)) {
|
|
21039
21037
|
const binDir = import_node_path27.default.dirname(linked);
|
|
21040
|
-
const found = (0,
|
|
21038
|
+
const found = (0, import_node_fs27.existsSync)(binDir) ? (0, import_node_fs27.readdirSync)(binDir).filter((name3) => name3.endsWith(".wasm")).sort() : [];
|
|
21041
21039
|
throw new Error(
|
|
21042
21040
|
`swift-compile: the build produced no ${import_node_path27.default.basename(linked)} (found: ${found.join(", ") || "none"})`
|
|
21043
21041
|
);
|
|
@@ -21070,7 +21068,7 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
21070
21068
|
else if (input.optimize) await optimizeWasm(output2, optimized);
|
|
21071
21069
|
const artifact = {
|
|
21072
21070
|
hash,
|
|
21073
|
-
bytes: (0,
|
|
21071
|
+
bytes: (0, import_node_fs27.readFileSync)(input.optimize ? optimized : output2),
|
|
21074
21072
|
icu: await icu
|
|
21075
21073
|
};
|
|
21076
21074
|
if (!options.project) saveCompiledArtifact(root, artifact);
|
|
@@ -21091,7 +21089,7 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
21091
21089
|
var import_node_async_hooks = require("node:async_hooks");
|
|
21092
21090
|
var import_node_child_process32 = require("node:child_process");
|
|
21093
21091
|
var import_node_crypto28 = require("node:crypto");
|
|
21094
|
-
var
|
|
21092
|
+
var import_node_fs51 = __toESM(require("node:fs"), 1);
|
|
21095
21093
|
var import_node_os13 = __toESM(require("node:os"), 1);
|
|
21096
21094
|
var import_node_path52 = __toESM(require("node:path"), 1);
|
|
21097
21095
|
|
|
@@ -22715,14 +22713,14 @@ function parsePlistSource(source) {
|
|
|
22715
22713
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
22716
22714
|
var import_node_child_process22 = require("node:child_process");
|
|
22717
22715
|
var import_node_crypto19 = require("node:crypto");
|
|
22718
|
-
var
|
|
22716
|
+
var import_node_fs37 = __toESM(require("node:fs"), 1);
|
|
22719
22717
|
var import_node_path38 = __toESM(require("node:path"), 1);
|
|
22720
22718
|
var import_plist2 = __toESM(require("plist"), 1);
|
|
22721
22719
|
|
|
22722
22720
|
// src/prepared-xcode-phases.ts
|
|
22723
22721
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
22724
22722
|
var import_node_crypto14 = require("node:crypto");
|
|
22725
|
-
var
|
|
22723
|
+
var import_node_fs28 = __toESM(require("node:fs"), 1);
|
|
22726
22724
|
var import_node_path28 = __toESM(require("node:path"), 1);
|
|
22727
22725
|
var workspaces = /* @__PURE__ */ new Map();
|
|
22728
22726
|
var recording;
|
|
@@ -22734,11 +22732,11 @@ function relativeFile(root, file) {
|
|
|
22734
22732
|
}
|
|
22735
22733
|
function output(root, file) {
|
|
22736
22734
|
const relative2 = relativeFile(root, file);
|
|
22737
|
-
const stat =
|
|
22735
|
+
const stat = import_node_fs28.default.statSync(file, { throwIfNoEntry: false });
|
|
22738
22736
|
if (!stat) return { path: relative2, sha256: null };
|
|
22739
22737
|
if (!stat.isFile()) throw new Error(`prepared Xcode output is not a file: ${file}`);
|
|
22740
|
-
relativeFile(root,
|
|
22741
|
-
const bytes =
|
|
22738
|
+
relativeFile(root, import_node_fs28.default.realpathSync(file));
|
|
22739
|
+
const bytes = import_node_fs28.default.readFileSync(file);
|
|
22742
22740
|
const prefix = Buffer.from(root);
|
|
22743
22741
|
const hash = (0, import_node_crypto14.createHash)("sha256");
|
|
22744
22742
|
let offset = 0;
|
|
@@ -22800,7 +22798,7 @@ function preparedXcodePhase(project, target, phase, configuration, outputs, reco
|
|
|
22800
22798
|
// src/swift-binary-modules.ts
|
|
22801
22799
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
22802
22800
|
var import_node_crypto15 = require("node:crypto");
|
|
22803
|
-
var
|
|
22801
|
+
var import_node_fs29 = __toESM(require("node:fs"), 1);
|
|
22804
22802
|
var import_node_path29 = __toESM(require("node:path"), 1);
|
|
22805
22803
|
var cacheDir2 = import_node_path29.default.join(cacheDir(), "swift-binary-modules");
|
|
22806
22804
|
function frameworkModules(paths) {
|
|
@@ -22857,21 +22855,21 @@ async function zipEntries(url) {
|
|
|
22857
22855
|
return names;
|
|
22858
22856
|
}
|
|
22859
22857
|
function localSwiftBinaryModules(dir) {
|
|
22860
|
-
if (!
|
|
22861
|
-
const slices =
|
|
22858
|
+
if (!import_node_fs29.default.existsSync(dir)) return [];
|
|
22859
|
+
const slices = import_node_fs29.default.readdirSync(dir, { withFileTypes: true }).filter((slice) => slice.isDirectory());
|
|
22862
22860
|
const frameworks = frameworkModules(
|
|
22863
22861
|
slices.flatMap(
|
|
22864
|
-
(slice) =>
|
|
22862
|
+
(slice) => import_node_fs29.default.readdirSync(import_node_path29.default.join(dir, slice.name)).map((entry) => `${slice.name}/${entry}`)
|
|
22865
22863
|
)
|
|
22866
22864
|
);
|
|
22867
22865
|
if (frameworks.length > 0) return frameworks;
|
|
22868
22866
|
const modules = /* @__PURE__ */ new Set();
|
|
22869
22867
|
for (const slice of slices) {
|
|
22870
22868
|
const headers = import_node_path29.default.join(dir, slice.name, "Headers");
|
|
22871
|
-
if (!
|
|
22872
|
-
for (const file of
|
|
22869
|
+
if (!import_node_fs29.default.existsSync(headers)) continue;
|
|
22870
|
+
for (const file of import_node_fs29.default.readdirSync(headers, { recursive: true, encoding: "utf8" })) {
|
|
22873
22871
|
if (import_node_path29.default.basename(file) !== "module.modulemap") continue;
|
|
22874
|
-
const module2 = moduleMapName(
|
|
22872
|
+
const module2 = moduleMapName(import_node_fs29.default.readFileSync(import_node_path29.default.join(headers, file), "utf8"));
|
|
22875
22873
|
if (module2) modules.add(module2);
|
|
22876
22874
|
}
|
|
22877
22875
|
}
|
|
@@ -22883,27 +22881,27 @@ async function swiftBinaryModules(binary) {
|
|
|
22883
22881
|
cacheDir2,
|
|
22884
22882
|
`${(0, import_node_crypto15.createHash)("sha256").update(`${binary.url}\0${binary.checksum ?? ""}`).digest("hex").slice(0, 32)}.json`
|
|
22885
22883
|
);
|
|
22886
|
-
if (
|
|
22887
|
-
const value = JSON.parse(
|
|
22884
|
+
if (import_node_fs29.default.existsSync(cached)) {
|
|
22885
|
+
const value = JSON.parse(import_node_fs29.default.readFileSync(cached, "utf8"));
|
|
22888
22886
|
if (Array.isArray(value) && value.every((name3) => typeof name3 === "string"))
|
|
22889
22887
|
return value;
|
|
22890
22888
|
}
|
|
22891
22889
|
const modules = frameworkModules(await zipEntries(binary.url));
|
|
22892
|
-
|
|
22893
|
-
|
|
22890
|
+
import_node_fs29.default.mkdirSync(cacheDir2, { recursive: true });
|
|
22891
|
+
import_node_fs29.default.writeFileSync(cached, JSON.stringify(modules));
|
|
22894
22892
|
return modules;
|
|
22895
22893
|
}
|
|
22896
22894
|
|
|
22897
22895
|
// src/swift-coverage/xcode-assets.ts
|
|
22898
22896
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
22899
22897
|
var import_node_crypto17 = require("node:crypto");
|
|
22900
|
-
var
|
|
22898
|
+
var import_node_fs32 = require("node:fs");
|
|
22901
22899
|
var import_node_path32 = require("node:path");
|
|
22902
22900
|
|
|
22903
22901
|
// src/swift-coverage/provenance.ts
|
|
22904
22902
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
22905
22903
|
var import_node_crypto16 = require("node:crypto");
|
|
22906
|
-
var
|
|
22904
|
+
var import_node_fs30 = require("node:fs");
|
|
22907
22905
|
var import_node_path30 = require("node:path");
|
|
22908
22906
|
var SWIFT_COVERAGE_DIGEST_SOURCES = [
|
|
22909
22907
|
"swift-coverage/indexdump.ts",
|
|
@@ -22934,7 +22932,7 @@ function swiftCoverageSourceDigests(srcDir) {
|
|
|
22934
22932
|
return Object.fromEntries(
|
|
22935
22933
|
SWIFT_COVERAGE_DIGEST_SOURCES.map((file) => [
|
|
22936
22934
|
file,
|
|
22937
|
-
(0, import_node_crypto16.createHash)("sha256").update((0,
|
|
22935
|
+
(0, import_node_crypto16.createHash)("sha256").update((0, import_node_fs30.readFileSync)((0, import_node_path30.join)(srcDir, file))).digest("hex")
|
|
22938
22936
|
])
|
|
22939
22937
|
);
|
|
22940
22938
|
}
|
|
@@ -22942,7 +22940,7 @@ var swiftCoverageProvenance = typeof define_SWIFT_COVERAGE_SOURCE_DIGESTS_defaul
|
|
|
22942
22940
|
|
|
22943
22941
|
// src/swift-coverage/xcode-asset-symbols.ts
|
|
22944
22942
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
22945
|
-
var
|
|
22943
|
+
var import_node_fs31 = require("node:fs");
|
|
22946
22944
|
var import_node_path31 = require("node:path");
|
|
22947
22945
|
var Refusal = class extends Error {
|
|
22948
22946
|
};
|
|
@@ -23118,10 +23116,10 @@ var observedSubtypes = /* @__PURE__ */ new Set([
|
|
|
23118
23116
|
"mac-catalyst"
|
|
23119
23117
|
]);
|
|
23120
23118
|
var readContents = (file) => {
|
|
23121
|
-
if (!(0,
|
|
23119
|
+
if (!(0, import_node_fs31.existsSync)(file)) return null;
|
|
23122
23120
|
let json;
|
|
23123
23121
|
try {
|
|
23124
|
-
json = JSON.parse((0,
|
|
23122
|
+
json = JSON.parse((0, import_node_fs31.readFileSync)(file, "utf8"));
|
|
23125
23123
|
} catch {
|
|
23126
23124
|
return refuse(file, "it is not valid JSON");
|
|
23127
23125
|
}
|
|
@@ -23175,7 +23173,7 @@ function assetState(dir, type, devices) {
|
|
|
23175
23173
|
const entries = json[list2] ?? [];
|
|
23176
23174
|
if (!Array.isArray(entries)) return refuse(file, `${list2} is not a list`);
|
|
23177
23175
|
const files2 = new Set(
|
|
23178
|
-
(0,
|
|
23176
|
+
(0, import_node_fs31.readdirSync)(dir, { withFileTypes: true }).filter((entry) => entry.isFile()).map((entry) => entry.name)
|
|
23179
23177
|
);
|
|
23180
23178
|
const covered = /* @__PURE__ */ new Set();
|
|
23181
23179
|
let included = false;
|
|
@@ -23233,7 +23231,7 @@ function addAsset(into, asset) {
|
|
|
23233
23231
|
refuse(asset.source, `${known.source} has the same name and differs`);
|
|
23234
23232
|
}
|
|
23235
23233
|
function checkStack(dir, type, devices) {
|
|
23236
|
-
const sets = (parent, allowed) => (0,
|
|
23234
|
+
const sets = (parent, allowed) => (0, import_node_fs31.readdirSync)(parent, { withFileTypes: true }).flatMap((entry) => {
|
|
23237
23235
|
if (entry.name.startsWith(".") || entry.isFile()) return [];
|
|
23238
23236
|
const path49 = (0, import_node_path31.join)(parent, entry.name);
|
|
23239
23237
|
const extension = (0, import_node_path31.extname)(entry.name);
|
|
@@ -23252,7 +23250,7 @@ function checkStack(dir, type, devices) {
|
|
|
23252
23250
|
}
|
|
23253
23251
|
}
|
|
23254
23252
|
function walk(dir, into, devices, extensions) {
|
|
23255
|
-
for (const entry of (0,
|
|
23253
|
+
for (const entry of (0, import_node_fs31.readdirSync)(dir, { withFileTypes: true })) {
|
|
23256
23254
|
if (entry.name.startsWith(".") || entry.isFile()) continue;
|
|
23257
23255
|
const path49 = (0, import_node_path31.join)(dir, entry.name);
|
|
23258
23256
|
if (!entry.isDirectory()) return refuse(path49, "it is neither a file nor a directory");
|
|
@@ -23940,13 +23938,13 @@ var provenOtherAssetFlags = /* @__PURE__ */ new Set([
|
|
|
23940
23938
|
function catalogDigest(directory) {
|
|
23941
23939
|
const hashes = [];
|
|
23942
23940
|
const walk3 = (dir) => {
|
|
23943
|
-
for (const entry of (0,
|
|
23941
|
+
for (const entry of (0, import_node_fs32.readdirSync)(dir, { withFileTypes: true }).sort(
|
|
23944
23942
|
(a, b) => a.name.localeCompare(b.name)
|
|
23945
23943
|
)) {
|
|
23946
23944
|
const path49 = (0, import_node_path32.join)(dir, entry.name);
|
|
23947
23945
|
if (entry.isDirectory()) walk3(path49);
|
|
23948
|
-
else if (entry.isFile() && (0,
|
|
23949
|
-
hashes.push([(0, import_node_path32.relative)(directory, path49), sha256((0,
|
|
23946
|
+
else if (entry.isFile() && (0, import_node_fs32.statSync)(path49).size <= 64 * 1024 * 1024)
|
|
23947
|
+
hashes.push([(0, import_node_path32.relative)(directory, path49), sha256((0, import_node_fs32.readFileSync)(path49))]);
|
|
23950
23948
|
else throw new Error(`Unsupported asset catalog entry: ${path49}`);
|
|
23951
23949
|
}
|
|
23952
23950
|
};
|
|
@@ -24053,20 +24051,20 @@ function assetSymbolText(plan, root) {
|
|
|
24053
24051
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
24054
24052
|
var import_node_child_process21 = require("node:child_process");
|
|
24055
24053
|
var import_node_crypto18 = require("node:crypto");
|
|
24056
|
-
var
|
|
24054
|
+
var import_node_fs36 = __toESM(require("node:fs"), 1);
|
|
24057
24055
|
var import_node_path36 = __toESM(require("node:path"), 1);
|
|
24058
24056
|
var import_node_util3 = require("node:util");
|
|
24059
24057
|
|
|
24060
24058
|
// src/swift-distribution.ts
|
|
24061
24059
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
24062
|
-
var
|
|
24060
|
+
var import_node_fs35 = __toESM(require("node:fs"), 1);
|
|
24063
24061
|
var import_node_os11 = __toESM(require("node:os"), 1);
|
|
24064
24062
|
var import_node_path35 = __toESM(require("node:path"), 1);
|
|
24065
24063
|
|
|
24066
24064
|
// cli/drivers/linux-browser-libs.ts
|
|
24067
24065
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
24068
24066
|
var import_node_child_process20 = require("node:child_process");
|
|
24069
|
-
var
|
|
24067
|
+
var import_node_fs33 = require("node:fs");
|
|
24070
24068
|
var import_node_path33 = require("node:path");
|
|
24071
24069
|
|
|
24072
24070
|
// cli/cli-update.ts
|
|
@@ -25556,7 +25554,7 @@ async function ensureLinuxBrowserLibraries(executablePath, browser) {
|
|
|
25556
25554
|
}
|
|
25557
25555
|
const lock = parseLinuxBrowserLibsLock(linux_browser_libs_lock_default);
|
|
25558
25556
|
const dir = (0, import_node_path33.join)(rnxHomeDir(), "linux-libs", `${lock.id}-${arch}`);
|
|
25559
|
-
if (!(0,
|
|
25557
|
+
if (!(0, import_node_fs33.existsSync)((0, import_node_path33.join)(dir, LINUX_BROWSER_LIBS_MARKER))) {
|
|
25560
25558
|
const url = `${DEFAULT_CLI_RELEASE_ORIGIN}/${linuxBrowserLibsKey(lock.id, arch)}`;
|
|
25561
25559
|
process.stderr.write(
|
|
25562
25560
|
`peach: this system lacks ${missing.length} shared libraries ${browser} links; downloading them\u2026
|
|
@@ -25600,7 +25598,7 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
25600
25598
|
|
|
25601
25599
|
// src/answeredNativePackages.ts
|
|
25602
25600
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
25603
|
-
var
|
|
25601
|
+
var import_node_fs34 = require("node:fs");
|
|
25604
25602
|
var import_node_path34 = require("node:path");
|
|
25605
25603
|
|
|
25606
25604
|
// src/runtime-assets.ts
|
|
@@ -25654,7 +25652,7 @@ function peachRuntimeRoot() {
|
|
|
25654
25652
|
}
|
|
25655
25653
|
function readPeachRuntimeJson(relative2) {
|
|
25656
25654
|
try {
|
|
25657
|
-
return JSON.parse((0,
|
|
25655
|
+
return JSON.parse((0, import_node_fs34.readFileSync)((0, import_node_path34.join)(peachRuntimeRoot(), relative2), "utf8"));
|
|
25658
25656
|
} catch (error) {
|
|
25659
25657
|
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
25660
25658
|
throw new Error(
|
|
@@ -25805,10 +25803,10 @@ function warnStalePrivateDistribution(root) {
|
|
|
25805
25803
|
if (staleWarned) return;
|
|
25806
25804
|
staleWarned = true;
|
|
25807
25805
|
const sources = import_node_path35.default.join(sourceSwiftCheckout(), "Sources");
|
|
25808
|
-
if (!
|
|
25809
|
-
const built2 =
|
|
25810
|
-
const newer =
|
|
25811
|
-
(name3) => name3.endsWith(".swift") &&
|
|
25806
|
+
if (!import_node_fs35.default.existsSync(sources)) return;
|
|
25807
|
+
const built2 = import_node_fs35.default.statSync(import_node_path35.default.join(root, SWIFT_DISTRIBUTION_MANIFEST)).mtimeMs;
|
|
25808
|
+
const newer = import_node_fs35.default.readdirSync(sources, { recursive: true, encoding: "utf8" }).find(
|
|
25809
|
+
(name3) => name3.endsWith(".swift") && import_node_fs35.default.statSync(import_node_path35.default.join(sources, name3)).mtimeMs > built2
|
|
25812
25810
|
);
|
|
25813
25811
|
if (newer)
|
|
25814
25812
|
process.stderr.write(
|
|
@@ -25843,7 +25841,7 @@ async function swiftDistributionRoot(signal) {
|
|
|
25843
25841
|
if (!pending) {
|
|
25844
25842
|
const controller = new AbortController();
|
|
25845
25843
|
const promise = (async () => {
|
|
25846
|
-
if (!
|
|
25844
|
+
if (!import_node_fs35.default.existsSync(import_node_path35.default.join(dir, SWIFT_DISTRIBUTION_MANIFEST))) {
|
|
25847
25845
|
process.stderr.write(
|
|
25848
25846
|
`peach: downloading Swift distribution ${lock.id} (${host2})\u2026
|
|
25849
25847
|
`
|
|
@@ -25909,7 +25907,7 @@ async function installSwiftToolchain(release, sdk, signal, compilerOnly = false)
|
|
|
25909
25907
|
process.env.PEACH_SWIFT_SDKS_PATH ??= import_node_path35.default.join(rnxHomeDir(), "swift", "sdks");
|
|
25910
25908
|
const root = import_node_path35.default.resolve(swiftToolchainBin(release), "../..");
|
|
25911
25909
|
const owned = process.platform === "darwin" ? import_node_path35.default.join(import_node_os11.default.homedir(), "Library/Developer/Toolchains", `${release}.xctoolchain`) : import_node_path35.default.join(rnxHomeDir(), "swift", "toolchains", release);
|
|
25912
|
-
const selectedCompiler = process.platform === "darwin" &&
|
|
25910
|
+
const selectedCompiler = process.platform === "darwin" && import_node_fs35.default.existsSync(import_node_path35.default.join(root, "usr/bin/swift"));
|
|
25913
25911
|
if (release.includes("-custom-") && root === owned && !selectedCompiler && !swiftCompilerReady(release)) {
|
|
25914
25912
|
const archive = swiftHostCompilerArchive(release);
|
|
25915
25913
|
process.stderr.write(`peach: installing Swift compiler ${release} to ${root}\u2026
|
|
@@ -25981,7 +25979,7 @@ function swiftToolchainReady(release, sdk) {
|
|
|
25981
25979
|
}
|
|
25982
25980
|
}
|
|
25983
25981
|
function swiftModuleCompiler(root) {
|
|
25984
|
-
const pin2 = swiftDistributionAt(root) ?? JSON.parse(
|
|
25982
|
+
const pin2 = swiftDistributionAt(root) ?? JSON.parse(import_node_fs35.default.readFileSync(import_node_path35.default.join(root, "toolchain.json"), "utf8"));
|
|
25985
25983
|
return {
|
|
25986
25984
|
release: pin2.release,
|
|
25987
25985
|
toolchainBin: swiftCompiler(pin2.release)
|
|
@@ -26049,10 +26047,10 @@ var evaluated = /* @__PURE__ */ new Map();
|
|
|
26049
26047
|
var execFileAsync = (0, import_node_util3.promisify)(import_node_child_process21.execFile);
|
|
26050
26048
|
var cachedToolchain;
|
|
26051
26049
|
function toolchainFingerprint(command) {
|
|
26052
|
-
const stat =
|
|
26050
|
+
const stat = import_node_fs36.default.statSync(command);
|
|
26053
26051
|
return JSON.stringify([
|
|
26054
26052
|
command,
|
|
26055
|
-
|
|
26053
|
+
import_node_fs36.default.realpathSync(command),
|
|
26056
26054
|
stat.size,
|
|
26057
26055
|
stat.mtimeMs,
|
|
26058
26056
|
stat.ctimeMs
|
|
@@ -26070,8 +26068,8 @@ async function prepareSwiftManifestToolchain() {
|
|
|
26070
26068
|
fingerprint,
|
|
26071
26069
|
value: {
|
|
26072
26070
|
path: command,
|
|
26073
|
-
realpath:
|
|
26074
|
-
sha256: (0, import_node_crypto18.createHash)("sha256").update(
|
|
26071
|
+
realpath: import_node_fs36.default.realpathSync(command),
|
|
26072
|
+
sha256: (0, import_node_crypto18.createHash)("sha256").update(import_node_fs36.default.readFileSync(command)).digest("hex"),
|
|
26075
26073
|
version: stdout.trim()
|
|
26076
26074
|
}
|
|
26077
26075
|
};
|
|
@@ -26083,13 +26081,13 @@ var SwiftManifestPreparationRequired = class extends Error {
|
|
|
26083
26081
|
}
|
|
26084
26082
|
};
|
|
26085
26083
|
function dumpInputs(dir) {
|
|
26086
|
-
const manifests =
|
|
26084
|
+
const manifests = import_node_fs36.default.readdirSync(dir).filter((name3) => /^Package(@swift-[\d.]+)?\.swift$/.test(name3)).sort();
|
|
26087
26085
|
const command = swiftCommand();
|
|
26088
26086
|
const fingerprint = toolchainFingerprint(command);
|
|
26089
26087
|
const toolchain = cachedToolchain?.fingerprint === fingerprint ? cachedToolchain.value : {
|
|
26090
26088
|
path: command,
|
|
26091
|
-
realpath:
|
|
26092
|
-
sha256: (0, import_node_crypto18.createHash)("sha256").update(
|
|
26089
|
+
realpath: import_node_fs36.default.realpathSync(command),
|
|
26090
|
+
sha256: (0, import_node_crypto18.createHash)("sha256").update(import_node_fs36.default.readFileSync(command)).digest("hex"),
|
|
26093
26091
|
version: (0, import_node_child_process21.execFileSync)(command, ["--version"], {
|
|
26094
26092
|
encoding: "utf8",
|
|
26095
26093
|
env: swiftEnvironment(),
|
|
@@ -26098,7 +26096,7 @@ function dumpInputs(dir) {
|
|
|
26098
26096
|
};
|
|
26099
26097
|
cachedToolchain = { fingerprint, value: toolchain };
|
|
26100
26098
|
const key2 = (0, import_node_crypto18.createHash)("sha256").update(JSON.stringify([toolchain, import_node_path36.default.resolve(dir)])).update(
|
|
26101
|
-
manifests.map((name3) => `${name3}\0${
|
|
26099
|
+
manifests.map((name3) => `${name3}\0${import_node_fs36.default.readFileSync(import_node_path36.default.join(dir, name3), "utf8")}`).join("\0")
|
|
26102
26100
|
).digest("hex").slice(0, 32);
|
|
26103
26101
|
return { command, key: key2, toolchain, cached: import_node_path36.default.join(cacheDir3, `${key2}.json`) };
|
|
26104
26102
|
}
|
|
@@ -26106,12 +26104,12 @@ var manifestPreparations = /* @__PURE__ */ new Map();
|
|
|
26106
26104
|
async function prepareSwiftPackageManifest(dir) {
|
|
26107
26105
|
await prepareSwiftManifestToolchain();
|
|
26108
26106
|
const { command, key: key2, cached } = dumpInputs(dir);
|
|
26109
|
-
if (
|
|
26107
|
+
if (import_node_fs36.default.existsSync(cached)) return;
|
|
26110
26108
|
const pending = manifestPreparations.get(key2);
|
|
26111
26109
|
if (pending) return pending;
|
|
26112
26110
|
const work = (async () => {
|
|
26113
|
-
|
|
26114
|
-
const scratch2 =
|
|
26111
|
+
import_node_fs36.default.mkdirSync(cacheDir3, { recursive: true });
|
|
26112
|
+
const scratch2 = import_node_fs36.default.mkdtempSync(import_node_path36.default.join(cacheDir3, `${key2}-`));
|
|
26115
26113
|
try {
|
|
26116
26114
|
const { stdout } = await execFileAsync(
|
|
26117
26115
|
command,
|
|
@@ -26127,15 +26125,15 @@ async function prepareSwiftPackageManifest(dir) {
|
|
|
26127
26125
|
{ encoding: "utf8", env: swiftEnvironment(), maxBuffer: 64 * 1024 * 1024 }
|
|
26128
26126
|
);
|
|
26129
26127
|
const output2 = import_node_path36.default.join(scratch2, "manifest.json");
|
|
26130
|
-
await
|
|
26131
|
-
await
|
|
26128
|
+
await import_node_fs36.default.promises.writeFile(output2, stdout);
|
|
26129
|
+
await import_node_fs36.default.promises.rename(output2, cached);
|
|
26132
26130
|
} catch (error) {
|
|
26133
26131
|
throw new Error(
|
|
26134
26132
|
`swiftpm could not evaluate ${import_node_path36.default.join(dir, "Package.swift")}: ${swiftPackageFailure(error)}`,
|
|
26135
26133
|
{ cause: error }
|
|
26136
26134
|
);
|
|
26137
26135
|
} finally {
|
|
26138
|
-
await
|
|
26136
|
+
await import_node_fs36.default.promises.rm(scratch2, { recursive: true, force: true });
|
|
26139
26137
|
}
|
|
26140
26138
|
})();
|
|
26141
26139
|
manifestPreparations.set(key2, work);
|
|
@@ -26149,8 +26147,8 @@ function dump(dir, requirePrepared = false) {
|
|
|
26149
26147
|
if (requirePrepared && cachedToolchain?.fingerprint !== toolchainFingerprint(swiftCommand()))
|
|
26150
26148
|
throw new SwiftManifestPreparationRequired(dir);
|
|
26151
26149
|
const { command, key: key2, toolchain, cached } = dumpInputs(dir);
|
|
26152
|
-
if (
|
|
26153
|
-
return { key: key2, toolchain, raw: record(JSON.parse(
|
|
26150
|
+
if (import_node_fs36.default.existsSync(cached))
|
|
26151
|
+
return { key: key2, toolchain, raw: record(JSON.parse(import_node_fs36.default.readFileSync(cached, "utf8"))) };
|
|
26154
26152
|
if (requirePrepared) throw new SwiftManifestPreparationRequired(dir);
|
|
26155
26153
|
let output2;
|
|
26156
26154
|
try {
|
|
@@ -26179,8 +26177,8 @@ function dump(dir, requirePrepared = false) {
|
|
|
26179
26177
|
{ cause: error }
|
|
26180
26178
|
);
|
|
26181
26179
|
}
|
|
26182
|
-
|
|
26183
|
-
|
|
26180
|
+
import_node_fs36.default.mkdirSync(cacheDir3, { recursive: true });
|
|
26181
|
+
import_node_fs36.default.writeFileSync(cached, output2);
|
|
26184
26182
|
return { key: key2, toolchain, raw: record(JSON.parse(output2)) };
|
|
26185
26183
|
}
|
|
26186
26184
|
function defaultTraits(manifest) {
|
|
@@ -26210,7 +26208,7 @@ function linksOnPlatform(condition, traits, platforms2) {
|
|
|
26210
26208
|
}
|
|
26211
26209
|
var GUEST_PLATFORMS = ["ios", "wasi"];
|
|
26212
26210
|
function swiftPackageManifest(dir, platform = GUEST_PLATFORMS, requirePrepared = false) {
|
|
26213
|
-
dir =
|
|
26211
|
+
dir = import_node_fs36.default.realpathSync(dir);
|
|
26214
26212
|
const { key: key2, raw: raw2, toolchain } = dump(dir, requirePrepared);
|
|
26215
26213
|
const platforms2 = typeof platform === "string" ? [platform] : platform;
|
|
26216
26214
|
const evaluatedKey = `${key2}:${[...platforms2].sort().join(",")}`;
|
|
@@ -26266,7 +26264,7 @@ function swiftPackageManifest(dir, platform = GUEST_PLATFORMS, requirePrepared =
|
|
|
26266
26264
|
if (!name4 || !isTargetType(kind)) continue;
|
|
26267
26265
|
const declared = string3(target.path);
|
|
26268
26266
|
const roots = kind === "test" ? ["Tests"] : ["Sources", "Source", "src", "srcs"];
|
|
26269
|
-
const targetDir = declared ? import_node_path36.default.resolve(dir, declared) : roots.map((root) => import_node_path36.default.join(dir, root, name4)).find((candidate) =>
|
|
26267
|
+
const targetDir = declared ? import_node_path36.default.resolve(dir, declared) : roots.map((root) => import_node_path36.default.join(dir, root, name4)).find((candidate) => import_node_fs36.default.existsSync(candidate)) ?? import_node_path36.default.join(dir, roots[0], name4);
|
|
26270
26268
|
const dependencies = [];
|
|
26271
26269
|
for (const dependency of array3(target.dependencies)) {
|
|
26272
26270
|
const { target: local, product, byName } = record(dependency);
|
|
@@ -26447,17 +26445,17 @@ function swiftPackageManifest(dir, platform = GUEST_PLATFORMS, requirePrepared =
|
|
|
26447
26445
|
}
|
|
26448
26446
|
var within = (file, roots) => roots.some((root) => file === root || file.startsWith(`${root}${import_node_path36.default.sep}`));
|
|
26449
26447
|
function walk2(dir, boundary, ancestors = /* @__PURE__ */ new Set(), resources = false) {
|
|
26450
|
-
if (!
|
|
26451
|
-
const real =
|
|
26448
|
+
if (!import_node_fs36.default.existsSync(dir)) return [];
|
|
26449
|
+
const real = import_node_fs36.default.realpathSync(dir);
|
|
26452
26450
|
const relative2 = import_node_path36.default.relative(boundary, real);
|
|
26453
26451
|
if (relative2 === ".." || relative2.startsWith(`..${import_node_path36.default.sep}`) || import_node_path36.default.isAbsolute(relative2))
|
|
26454
26452
|
throw new Error(`swift package input escapes ${boundary}: ${dir}`);
|
|
26455
|
-
if (
|
|
26453
|
+
if (import_node_fs36.default.statSync(dir).isFile()) return [dir];
|
|
26456
26454
|
if (ancestors.has(real))
|
|
26457
26455
|
throw new Error(`swift package input has a directory cycle: ${dir}`);
|
|
26458
26456
|
const parents = /* @__PURE__ */ new Set([...ancestors, real]);
|
|
26459
26457
|
const out = [];
|
|
26460
|
-
for (const entry of
|
|
26458
|
+
for (const entry of import_node_fs36.default.readdirSync(dir, { withFileTypes: true })) {
|
|
26461
26459
|
if (!resources && entry.name.startsWith(".")) continue;
|
|
26462
26460
|
if (!resources && entry.isDirectory() && entry.name.endsWith(".docc")) continue;
|
|
26463
26461
|
const full = import_node_path36.default.join(dir, entry.name);
|
|
@@ -26933,9 +26931,9 @@ var CONDITIONS = {
|
|
|
26933
26931
|
variant: "normal"
|
|
26934
26932
|
};
|
|
26935
26933
|
function walkFiles(dir) {
|
|
26936
|
-
if (!
|
|
26934
|
+
if (!import_node_fs37.default.existsSync(dir)) return [];
|
|
26937
26935
|
const out = [];
|
|
26938
|
-
for (const entry of
|
|
26936
|
+
for (const entry of import_node_fs37.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
|
|
26939
26937
|
if (entry.name.startsWith(".")) continue;
|
|
26940
26938
|
const full = import_node_path38.default.join(dir, entry.name);
|
|
26941
26939
|
if (entry.isDirectory()) out.push(...walkFiles(full));
|
|
@@ -26943,12 +26941,12 @@ function walkFiles(dir) {
|
|
|
26943
26941
|
}
|
|
26944
26942
|
return out;
|
|
26945
26943
|
}
|
|
26946
|
-
var isDirectory = (dir) =>
|
|
26944
|
+
var isDirectory = (dir) => import_node_fs37.default.existsSync(dir) && import_node_fs37.default.statSync(dir).isDirectory();
|
|
26947
26945
|
function readXcconfig(file, read) {
|
|
26948
|
-
if (read.includes(file) || !
|
|
26946
|
+
if (read.includes(file) || !import_node_fs37.default.existsSync(file)) return {};
|
|
26949
26947
|
read.push(file);
|
|
26950
26948
|
const settings = {};
|
|
26951
|
-
for (const raw2 of
|
|
26949
|
+
for (const raw2 of import_node_fs37.default.readFileSync(file, "utf8").split("\n")) {
|
|
26952
26950
|
const line = raw2.replace(/\/\/.*$/, "").trim();
|
|
26953
26951
|
const include = /^#include\??\s+"([^"]+)"/.exec(line);
|
|
26954
26952
|
if (include) {
|
|
@@ -27005,7 +27003,7 @@ function decodeXml(text5) {
|
|
|
27005
27003
|
}
|
|
27006
27004
|
function workspaceReferences(workspace) {
|
|
27007
27005
|
const data = import_node_path38.default.join(workspace, "contents.xcworkspacedata");
|
|
27008
|
-
if (!
|
|
27006
|
+
if (!import_node_fs37.default.existsSync(data))
|
|
27009
27007
|
throw new Error(`${workspace} has no contents.xcworkspacedata`);
|
|
27010
27008
|
const container = import_node_path38.default.dirname(workspace);
|
|
27011
27009
|
const locate = (location, base) => {
|
|
@@ -27019,7 +27017,7 @@ function workspaceReferences(workspace) {
|
|
|
27019
27017
|
};
|
|
27020
27018
|
const groups = [container];
|
|
27021
27019
|
const references = [];
|
|
27022
|
-
for (const [, closing, tag, attributes, selfClosing] of
|
|
27020
|
+
for (const [, closing, tag, attributes, selfClosing] of import_node_fs37.default.readFileSync(data, "utf8").matchAll(/<(\/?)(Group|FileRef)\b([^>]*?)(\/?)>/g)) {
|
|
27023
27021
|
if (closing) {
|
|
27024
27022
|
if (tag === "Group") groups.pop();
|
|
27025
27023
|
continue;
|
|
@@ -27033,18 +27031,18 @@ function workspaceReferences(workspace) {
|
|
|
27033
27031
|
return references;
|
|
27034
27032
|
}
|
|
27035
27033
|
function enclosingXcodeWorkspace(xcodeproj) {
|
|
27036
|
-
const project =
|
|
27034
|
+
const project = import_node_fs37.default.realpathSync.native(xcodeproj);
|
|
27037
27035
|
for (let dir = import_node_path38.default.dirname(project); ; dir = import_node_path38.default.dirname(dir)) {
|
|
27038
|
-
for (const name3 of
|
|
27036
|
+
for (const name3 of import_node_fs37.default.readdirSync(dir).sort()) {
|
|
27039
27037
|
if (!name3.endsWith(".xcworkspace")) continue;
|
|
27040
27038
|
const workspace = import_node_path38.default.join(dir, name3);
|
|
27041
|
-
if (!
|
|
27039
|
+
if (!import_node_fs37.default.existsSync(import_node_path38.default.join(workspace, "contents.xcworkspacedata"))) continue;
|
|
27042
27040
|
if (workspaceReferences(workspace).some(
|
|
27043
|
-
(reference) =>
|
|
27041
|
+
(reference) => import_node_fs37.default.existsSync(reference) && import_node_fs37.default.realpathSync.native(reference) === project
|
|
27044
27042
|
))
|
|
27045
27043
|
return workspace;
|
|
27046
27044
|
}
|
|
27047
|
-
if (
|
|
27045
|
+
if (import_node_fs37.default.existsSync(import_node_path38.default.join(dir, ".git")) || import_node_path38.default.dirname(dir) === dir) return null;
|
|
27048
27046
|
}
|
|
27049
27047
|
}
|
|
27050
27048
|
function versionRequirement(url, requirement) {
|
|
@@ -27086,7 +27084,7 @@ var loaded = /* @__PURE__ */ new Map();
|
|
|
27086
27084
|
function xcodeProjectFile(xcodeproj) {
|
|
27087
27085
|
for (const name3 of ["project.pbxproj", "project.xcproj"]) {
|
|
27088
27086
|
const file = import_node_path38.default.join(xcodeproj, name3);
|
|
27089
|
-
if (
|
|
27087
|
+
if (import_node_fs37.default.existsSync(file)) return file;
|
|
27090
27088
|
}
|
|
27091
27089
|
return null;
|
|
27092
27090
|
}
|
|
@@ -27094,7 +27092,7 @@ function loadProject(xcodeproj) {
|
|
|
27094
27092
|
const projectFile = xcodeProjectFile(xcodeproj);
|
|
27095
27093
|
if (!projectFile)
|
|
27096
27094
|
throw new Error(`${xcodeproj} has no project.pbxproj or project.xcproj`);
|
|
27097
|
-
const source =
|
|
27095
|
+
const source = import_node_fs37.default.readFileSync(projectFile, "utf8");
|
|
27098
27096
|
const digest = (0, import_node_crypto19.createHash)("sha256").update(source).digest("hex");
|
|
27099
27097
|
const cached = loaded.get(projectFile);
|
|
27100
27098
|
if (cached?.digest === digest) return cached.project;
|
|
@@ -27111,7 +27109,7 @@ function loadProject(xcodeproj) {
|
|
|
27111
27109
|
if (!project || project.isa !== "PBXProject") {
|
|
27112
27110
|
throw new Error(`${projectFile} has no PBXProject root`);
|
|
27113
27111
|
}
|
|
27114
|
-
const projectDir =
|
|
27112
|
+
const projectDir = import_node_fs37.default.realpathSync.native(
|
|
27115
27113
|
import_node_path38.default.resolve(import_node_path38.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
|
|
27116
27114
|
);
|
|
27117
27115
|
const resolvePath = xcodePathResolver(objects, projectDir, import_node_path38.default.join);
|
|
@@ -27152,7 +27150,7 @@ function targetSettings(ref, configuration, builtins, options = {}, overrides =
|
|
|
27152
27150
|
const own = isDict(config.buildSettings) ? config.buildSettings : {};
|
|
27153
27151
|
const directory = anchor ? project.resolvePath(anchor) : null;
|
|
27154
27152
|
const baseFile = base ? project.resolvePath(base) : directory && relative2 ? import_node_path38.default.resolve(directory, relative2) : null;
|
|
27155
|
-
if (options.requireSources !== false && (base || anchor || relative2) && (!baseFile || !
|
|
27153
|
+
if (options.requireSources !== false && (base || anchor || relative2) && (!baseFile || !import_node_fs37.default.existsSync(baseFile)))
|
|
27156
27154
|
throw new Error(
|
|
27157
27155
|
`Unable to open base configuration reference file '${baseFile ?? base ?? relative2 ?? anchor}'`
|
|
27158
27156
|
);
|
|
@@ -27258,14 +27256,14 @@ function expandSearchPath(directory, rules2) {
|
|
|
27258
27256
|
const current = queue[at];
|
|
27259
27257
|
let real;
|
|
27260
27258
|
try {
|
|
27261
|
-
real =
|
|
27259
|
+
real = import_node_fs37.default.realpathSync.native(current);
|
|
27262
27260
|
} catch {
|
|
27263
27261
|
continue;
|
|
27264
27262
|
}
|
|
27265
|
-
if (!
|
|
27263
|
+
if (!import_node_fs37.default.statSync(real).isDirectory() || seen.has(real)) continue;
|
|
27266
27264
|
seen.add(real);
|
|
27267
27265
|
expanded.push(current);
|
|
27268
|
-
for (const entry of
|
|
27266
|
+
for (const entry of import_node_fs37.default.readdirSync(real, { withFileTypes: true }).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0)) {
|
|
27269
27267
|
if (entry.isSymbolicLink() ? !rules2.followLinks : !entry.isDirectory()) continue;
|
|
27270
27268
|
if (rules2.excluded.some((pattern) => pattern.test(entry.name)) && !rules2.included.some((pattern) => pattern.test(entry.name)))
|
|
27271
27269
|
continue;
|
|
@@ -27392,7 +27390,7 @@ function shellCopies(script, settings, projectDir) {
|
|
|
27392
27390
|
return copies;
|
|
27393
27391
|
}
|
|
27394
27392
|
function fileListEntries(file, absolute) {
|
|
27395
|
-
return
|
|
27393
|
+
return import_node_fs37.default.readFileSync(file, "utf8").split(/\r?\n/).map((line) => line.trim()).filter((line) => line !== "" && !line.startsWith("#")).map(absolute);
|
|
27396
27394
|
}
|
|
27397
27395
|
function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
27398
27396
|
const { project, target, id: targetId } = ref;
|
|
@@ -27429,7 +27427,7 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
|
27429
27427
|
kind === "INPUT" ? phase.inputFileListPaths : phase.outputFileListPaths
|
|
27430
27428
|
).map((raw2) => {
|
|
27431
27429
|
const file = absolute(raw2);
|
|
27432
|
-
if (!
|
|
27430
|
+
if (!import_node_fs37.default.existsSync(file)) {
|
|
27433
27431
|
return { file, entries: [] };
|
|
27434
27432
|
}
|
|
27435
27433
|
return { file, entries: fileListEntries(file, absolute) };
|
|
@@ -27450,7 +27448,7 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
|
27450
27448
|
...fileLists.get("OUTPUT").map((item) => item.file)
|
|
27451
27449
|
];
|
|
27452
27450
|
if (allOutputs.some((file) => file.endsWith(".swift") || file === infoPlistOutput)) {
|
|
27453
|
-
for (const file of inputFiles) if (
|
|
27451
|
+
for (const file of inputFiles) if (import_node_fs37.default.existsSync(file)) projectInputs.add(file);
|
|
27454
27452
|
}
|
|
27455
27453
|
if (options.prepareGeneratedSources === true && allOutputs.some(isPreparedOutput)) {
|
|
27456
27454
|
const configuration = settings("CONFIGURATION");
|
|
@@ -27466,7 +27464,7 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
|
27466
27464
|
const phaseDir = import_node_path38.default.join(settings("TARGET_TEMP_DIR"), `Script-${phaseId}`);
|
|
27467
27465
|
for (const lists of fileLists.values())
|
|
27468
27466
|
for (const { file } of lists)
|
|
27469
|
-
if (!
|
|
27467
|
+
if (!import_node_fs37.default.existsSync(file))
|
|
27470
27468
|
throw new Error(
|
|
27471
27469
|
`${targetName}: Run Script "${script}" missing file list ${file}`
|
|
27472
27470
|
);
|
|
@@ -27496,14 +27494,14 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
|
27496
27494
|
);
|
|
27497
27495
|
for (const file of inputFiles) {
|
|
27498
27496
|
signature.update(file);
|
|
27499
|
-
if (
|
|
27500
|
-
const stat =
|
|
27497
|
+
if (import_node_fs37.default.existsSync(file)) {
|
|
27498
|
+
const stat = import_node_fs37.default.statSync(file);
|
|
27501
27499
|
signature.update(`${stat.mtimeMs}:${stat.ctimeMs}:${stat.size}`);
|
|
27502
27500
|
} else signature.update("missing");
|
|
27503
27501
|
}
|
|
27504
27502
|
const stamp = signature.digest("hex");
|
|
27505
27503
|
const key2 = `${project.projectFile}:${targetId}:${phaseId}:${settings("CONFIGURATION")}`;
|
|
27506
|
-
if (preparedSourcePhases.get(key2) === stamp && allOutputs.every((file) =>
|
|
27504
|
+
if (preparedSourcePhases.get(key2) === stamp && allOutputs.every((file) => import_node_fs37.default.existsSync(file))) {
|
|
27507
27505
|
preparedXcodePhase(
|
|
27508
27506
|
project.projectFile,
|
|
27509
27507
|
targetId,
|
|
@@ -27514,14 +27512,14 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
|
27514
27512
|
);
|
|
27515
27513
|
continue;
|
|
27516
27514
|
}
|
|
27517
|
-
|
|
27518
|
-
|
|
27519
|
-
|
|
27515
|
+
import_node_fs37.default.mkdirSync(phaseDir, { recursive: true });
|
|
27516
|
+
import_node_fs37.default.mkdirSync(settings("BUILT_PRODUCTS_DIR"), { recursive: true });
|
|
27517
|
+
import_node_fs37.default.mkdirSync(settings("DERIVED_FILE_DIR"), { recursive: true });
|
|
27520
27518
|
for (const output2 of allOutputs)
|
|
27521
|
-
|
|
27519
|
+
import_node_fs37.default.mkdirSync(import_node_path38.default.dirname(output2), { recursive: true });
|
|
27522
27520
|
for (const [kind, lists] of fileLists)
|
|
27523
27521
|
lists.forEach((item, index) => {
|
|
27524
|
-
|
|
27522
|
+
import_node_fs37.default.writeFileSync(
|
|
27525
27523
|
env[`SCRIPT_${kind}_FILE_LIST_${index}`],
|
|
27526
27524
|
`${item.entries.join("\n")}
|
|
27527
27525
|
`
|
|
@@ -27548,7 +27546,7 @@ ${output2}`
|
|
|
27548
27546
|
);
|
|
27549
27547
|
}
|
|
27550
27548
|
const missing = allOutputs.filter(
|
|
27551
|
-
(file) => file === infoPlistOutput && !
|
|
27549
|
+
(file) => file === infoPlistOutput && !import_node_fs37.default.existsSync(file)
|
|
27552
27550
|
);
|
|
27553
27551
|
if (missing.length > 0)
|
|
27554
27552
|
throw new Error(
|
|
@@ -27568,7 +27566,7 @@ ${output2}`
|
|
|
27568
27566
|
project.visitMembers(
|
|
27569
27567
|
targetId,
|
|
27570
27568
|
project.resolvePath,
|
|
27571
|
-
(file) => isDirectory(file) ? walkFiles(file) :
|
|
27569
|
+
(file) => isDirectory(file) ? walkFiles(file) : import_node_fs37.default.existsSync(file) ? [file] : [],
|
|
27572
27570
|
import_node_path38.default.join,
|
|
27573
27571
|
(file, kind) => {
|
|
27574
27572
|
if (kind === "header") {
|
|
@@ -27579,7 +27577,7 @@ ${output2}`
|
|
|
27579
27577
|
resources.add(file);
|
|
27580
27578
|
return;
|
|
27581
27579
|
}
|
|
27582
|
-
if (!
|
|
27580
|
+
if (!import_node_fs37.default.existsSync(file)) {
|
|
27583
27581
|
if (options.requireSources === false) return;
|
|
27584
27582
|
const script = scriptForOutput.get(import_node_path38.default.normalize(file));
|
|
27585
27583
|
throw new Error(
|
|
@@ -27611,16 +27609,16 @@ var isPodsProject = (xcodeproj) => import_node_path38.default.basename(xcodeproj
|
|
|
27611
27609
|
function installedPodsSandbox(pods) {
|
|
27612
27610
|
const podfileLock = import_node_path38.default.join(import_node_path38.default.dirname(pods), "Podfile.lock");
|
|
27613
27611
|
const manifestLock = import_node_path38.default.join(pods, "Manifest.lock");
|
|
27614
|
-
if (!
|
|
27612
|
+
if (!import_node_fs37.default.existsSync(podfileLock))
|
|
27615
27613
|
throw new Error(
|
|
27616
27614
|
`${pods} has no ${podfileLock}: run \`pod install\` in ${import_node_path38.default.dirname(pods)}`
|
|
27617
27615
|
);
|
|
27618
|
-
if (!
|
|
27616
|
+
if (!import_node_fs37.default.existsSync(manifestLock) || !import_node_fs37.default.readFileSync(manifestLock).equals(import_node_fs37.default.readFileSync(podfileLock)))
|
|
27619
27617
|
throw new Error(
|
|
27620
27618
|
`The sandbox is not in sync with the Podfile.lock: ${manifestLock} differs from ${podfileLock}. Run \`pod install\` in ${import_node_path38.default.dirname(pods)}`
|
|
27621
27619
|
);
|
|
27622
27620
|
const specChecksums = {};
|
|
27623
|
-
const lines =
|
|
27621
|
+
const lines = import_node_fs37.default.readFileSync(manifestLock, "utf8").split("\n");
|
|
27624
27622
|
const start = lines.indexOf("SPEC CHECKSUMS:");
|
|
27625
27623
|
for (const line of start === -1 ? [] : lines.slice(start + 1)) {
|
|
27626
27624
|
const entry = /^ {2}"?([^":]+)"?: ([0-9a-f]+)$/.exec(line);
|
|
@@ -27632,7 +27630,7 @@ function installedPodsSandbox(pods) {
|
|
|
27632
27630
|
podfileLock,
|
|
27633
27631
|
manifestLock,
|
|
27634
27632
|
specChecksums,
|
|
27635
|
-
localPodspecs: isDirectory(specs) ?
|
|
27633
|
+
localPodspecs: isDirectory(specs) ? import_node_fs37.default.readdirSync(specs).filter((name3) => name3.endsWith(".podspec.json")).sort().map((name3) => import_node_path38.default.join(specs, name3)) : []
|
|
27636
27634
|
};
|
|
27637
27635
|
}
|
|
27638
27636
|
function workspaceProjects(xcodeprojOrWorkspace, installedPods = false) {
|
|
@@ -27648,7 +27646,7 @@ function workspaceProjects(xcodeprojOrWorkspace, installedPods = false) {
|
|
|
27648
27646
|
);
|
|
27649
27647
|
return;
|
|
27650
27648
|
}
|
|
27651
|
-
const key2 =
|
|
27649
|
+
const key2 = import_node_fs37.default.realpathSync.native(xcodeproj);
|
|
27652
27650
|
if (projectAt.has(key2) || !installedPods && key2.split(import_node_path38.default.sep).includes("Pods"))
|
|
27653
27651
|
return;
|
|
27654
27652
|
if (isPodsProject(key2)) cocoapods = installedPodsSandbox(import_node_path38.default.dirname(key2));
|
|
@@ -27670,7 +27668,7 @@ function workspaceProjects(xcodeprojOrWorkspace, installedPods = false) {
|
|
|
27670
27668
|
throw new Error(`${import_node_path38.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
|
|
27671
27669
|
}
|
|
27672
27670
|
const podfile = import_node_path38.default.join(import_node_path38.default.dirname(xcodeprojOrWorkspace), "Podfile");
|
|
27673
|
-
if (installedPods && !cocoapods &&
|
|
27671
|
+
if (installedPods && !cocoapods && import_node_fs37.default.existsSync(podfile))
|
|
27674
27672
|
throw new Error(
|
|
27675
27673
|
`${podfile} is not installed into ${import_node_path38.default.basename(xcodeprojOrWorkspace)}: run \`pod install\` in ${import_node_path38.default.dirname(podfile)} and open the workspace it writes`
|
|
27676
27674
|
);
|
|
@@ -27720,7 +27718,7 @@ var SwiftPackageResolutionRequired = class extends Error {
|
|
|
27720
27718
|
}
|
|
27721
27719
|
};
|
|
27722
27720
|
function readXcodeAppTarget(input, targetName, configurationName, options = {}) {
|
|
27723
|
-
const xcodeprojOrWorkspace =
|
|
27721
|
+
const xcodeprojOrWorkspace = import_node_fs37.default.realpathSync.native(input);
|
|
27724
27722
|
const workspace = xcodeprojOrWorkspace.endsWith(".xcworkspace") ? xcodeprojOrWorkspace : null;
|
|
27725
27723
|
const { listed, projects: projects2, projectAt, cocoapods } = workspaceProjects(
|
|
27726
27724
|
xcodeprojOrWorkspace,
|
|
@@ -27758,7 +27756,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
27758
27756
|
if (proxy?.isa !== "PBXContainerItemProxy") return void 0;
|
|
27759
27757
|
const portal = str(proxy.containerPortal);
|
|
27760
27758
|
const portalPath = project.resolvePath(portal ?? "");
|
|
27761
|
-
const owner = project.object(portal)?.isa === "PBXProject" ? project : portalPath &&
|
|
27759
|
+
const owner = project.object(portal)?.isa === "PBXProject" ? project : portalPath && import_node_fs37.default.existsSync(portalPath) ? projectAt.get(import_node_fs37.default.realpathSync.native(portalPath)) : void 0;
|
|
27762
27760
|
const remote = str(proxy.remoteGlobalIDString);
|
|
27763
27761
|
if (!owner || !remote) return void 0;
|
|
27764
27762
|
return projectTargets(owner).find(
|
|
@@ -27859,7 +27857,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
27859
27857
|
ref.project.visitMembers(
|
|
27860
27858
|
ref.id,
|
|
27861
27859
|
ref.project.resolvePath,
|
|
27862
|
-
(file) => isDirectory(file) ? walkFiles(file) :
|
|
27860
|
+
(file) => isDirectory(file) ? walkFiles(file) : import_node_fs37.default.existsSync(file) ? [file] : [],
|
|
27863
27861
|
import_node_path38.default.join,
|
|
27864
27862
|
(file, kind) => {
|
|
27865
27863
|
if (kind === "header") found.push(file);
|
|
@@ -28032,9 +28030,9 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
28032
28030
|
` const double ${symbol2}VersionNumber __attribute__ ((used)) = (double)${number3};`,
|
|
28033
28031
|
""
|
|
28034
28032
|
].join("\n");
|
|
28035
|
-
if (!
|
|
28036
|
-
|
|
28037
|
-
|
|
28033
|
+
if (!import_node_fs37.default.existsSync(versioning) || import_node_fs37.default.readFileSync(versioning, "utf8") !== unit2) {
|
|
28034
|
+
import_node_fs37.default.mkdirSync(import_node_path38.default.dirname(versioning), { recursive: true });
|
|
28035
|
+
import_node_fs37.default.writeFileSync(versioning, unit2);
|
|
28038
28036
|
}
|
|
28039
28037
|
allSources.push(versioning);
|
|
28040
28038
|
}
|
|
@@ -28080,7 +28078,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
28080
28078
|
const wrapper = import_node_path38.default.join(settings2("BUILT_PRODUCTS_DIR"), `${product}.framework`);
|
|
28081
28079
|
const moduleMap = (settings2("DEFINES_MODULE") === "YES" || !framework) && settings2("MODULEMAP_FILE") ? absolute(settings2("MODULEMAP_FILE")) : null;
|
|
28082
28080
|
const frameworkUmbrella = !compatibility && framework && members2.sources.length > 0 && moduleMap ? import_node_path38.default.join(import_node_path38.default.dirname(moduleMap), `${moduleName}-umbrella.h`) : null;
|
|
28083
|
-
const frameworkCompatibility = frameworkUmbrella && moduleMap &&
|
|
28081
|
+
const frameworkCompatibility = frameworkUmbrella && moduleMap && import_node_fs37.default.existsSync(moduleMap) && import_node_fs37.default.existsSync(frameworkUmbrella) ? {
|
|
28084
28082
|
framework: true,
|
|
28085
28083
|
moduleMap,
|
|
28086
28084
|
umbrella: frameworkUmbrella,
|
|
@@ -28104,10 +28102,10 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
28104
28102
|
outputUmbrella: compatibility.outputUmbrella,
|
|
28105
28103
|
outputHeader: compatibility.outputHeader
|
|
28106
28104
|
} : frameworkCompatibility;
|
|
28107
|
-
const podHeaders = !framework && isPodsProject(ref.project.xcodeproj) && moduleMap && import_node_path38.default.relative(import_node_path38.default.join(ref.project.projectDir, "Headers", "Public"), moduleMap).split(import_node_path38.default.sep)[0] !== ".." &&
|
|
28105
|
+
const podHeaders = !framework && isPodsProject(ref.project.xcodeproj) && moduleMap && import_node_path38.default.relative(import_node_path38.default.join(ref.project.projectDir, "Headers", "Public"), moduleMap).split(import_node_path38.default.sep)[0] !== ".." && import_node_fs37.default.existsSync(moduleMap) ? import_node_fs37.default.readdirSync(import_node_path38.default.dirname(moduleMap)).flatMap((entry) => {
|
|
28108
28106
|
if (!/\.(h|hh|hpp|hxx|modulemap)$/.test(entry)) return [];
|
|
28109
28107
|
const file = import_node_path38.default.join(import_node_path38.default.dirname(moduleMap), entry);
|
|
28110
|
-
return
|
|
28108
|
+
return import_node_fs37.default.existsSync(file) ? [file] : [];
|
|
28111
28109
|
}) : [];
|
|
28112
28110
|
const fileFlags = {};
|
|
28113
28111
|
for (const phaseId of list(ref.target.buildPhases)) {
|
|
@@ -28307,7 +28305,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
28307
28305
|
const frameworkTargets = selectedTargets.filter((target) => target !== builtTargets.at(-1)).filter(({ ref }) => MODULE_PRODUCTS.has(str(ref.target.productType) ?? "")).map(({ ref, module: module3 }) => ({ ref, framework: module3 }));
|
|
28308
28306
|
const frameworks = frameworkTargets.map(({ framework }) => framework);
|
|
28309
28307
|
const podSourceDirs = builtTargets.slice(0, -1).flatMap(
|
|
28310
|
-
({ ref, module: module3 }) => isPodsProject(ref.project.xcodeproj) ? [...module3.allSources, ...module3.objc?.headers ?? []].map((file) => import_node_path38.default.dirname(file)).filter((dir) =>
|
|
28308
|
+
({ ref, module: module3 }) => isPodsProject(ref.project.xcodeproj) ? [...module3.allSources, ...module3.objc?.headers ?? []].map((file) => import_node_path38.default.dirname(file)).filter((dir) => import_node_fs37.default.existsSync(dir)) : []
|
|
28311
28309
|
);
|
|
28312
28310
|
const expandValue = (value, settings2) => {
|
|
28313
28311
|
if (typeof value === "string") return expand(value, settings2);
|
|
@@ -28381,12 +28379,12 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
28381
28379
|
resources: product.module.resources,
|
|
28382
28380
|
infoPlist: import_plist2.default.build(
|
|
28383
28381
|
expandValue(
|
|
28384
|
-
import_plist2.default.parse(
|
|
28382
|
+
import_plist2.default.parse(import_node_fs37.default.readFileSync(infoFile, "utf8")),
|
|
28385
28383
|
product.settings
|
|
28386
28384
|
)
|
|
28387
28385
|
)
|
|
28388
28386
|
} : {
|
|
28389
|
-
resources:
|
|
28387
|
+
resources: import_node_fs37.default.readdirSync(input2, { recursive: true, withFileTypes: true }).filter((entry) => entry.isFile()).map((entry) => import_node_path38.default.join(entry.parentPath, entry.name)).sort(),
|
|
28390
28388
|
sourceRoot: input2
|
|
28391
28389
|
}
|
|
28392
28390
|
});
|
|
@@ -28396,7 +28394,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
28396
28394
|
const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path38.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
|
|
28397
28395
|
const entitlementsFile = settings("CODE_SIGN_ENTITLEMENTS") ? import_node_path38.default.resolve(app.project.projectDir, settings("CODE_SIGN_ENTITLEMENTS")) : null;
|
|
28398
28396
|
const keychainAccessGroups = entitlementsFile ? readKeychainAccessGroups(
|
|
28399
|
-
import_plist2.default.parse(
|
|
28397
|
+
import_plist2.default.parse(import_node_fs37.default.readFileSync(entitlementsFile, "utf8")),
|
|
28400
28398
|
(value) => expand(value, (key2) => {
|
|
28401
28399
|
const resolved = settings(key2);
|
|
28402
28400
|
if (!resolved) throw new Error(`missing signing build setting ${key2}`);
|
|
@@ -28404,7 +28402,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
28404
28402
|
})
|
|
28405
28403
|
) : void 0;
|
|
28406
28404
|
const infoPlistPending = module2.generatedInfoPlist && !options.prepareGeneratedSources;
|
|
28407
|
-
const sourceInfo = infoPlistFile && !infoPlistPending ? import_plist2.default.parse(
|
|
28405
|
+
const sourceInfo = infoPlistFile && !infoPlistPending ? import_plist2.default.parse(import_node_fs37.default.readFileSync(infoPlistFile, "utf8")) : {};
|
|
28408
28406
|
if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
|
|
28409
28407
|
throw new Error(`${module2.name} Info.plist must contain a dictionary`);
|
|
28410
28408
|
}
|
|
@@ -28450,7 +28448,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
28450
28448
|
};
|
|
28451
28449
|
}
|
|
28452
28450
|
const localPackageDirs = [
|
|
28453
|
-
...listed.filter((reference) =>
|
|
28451
|
+
...listed.filter((reference) => import_node_fs37.default.existsSync(import_node_path38.default.join(reference, "Package.swift"))),
|
|
28454
28452
|
...projects2.flatMap(
|
|
28455
28453
|
(project) => Object.entries(project.objects).flatMap(([id, entry]) => {
|
|
28456
28454
|
if (!isDict(entry)) return [];
|
|
@@ -28460,19 +28458,19 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
28460
28458
|
const packages = [];
|
|
28461
28459
|
while (pending.length > 0) {
|
|
28462
28460
|
const dir = pending.pop();
|
|
28463
|
-
if (
|
|
28461
|
+
if (import_node_fs37.default.existsSync(import_node_path38.default.join(dir, "Package.swift"))) {
|
|
28464
28462
|
packages.push(dir);
|
|
28465
28463
|
continue;
|
|
28466
28464
|
}
|
|
28467
28465
|
if (!isDirectory(dir)) continue;
|
|
28468
|
-
for (const child of
|
|
28466
|
+
for (const child of import_node_fs37.default.readdirSync(dir, { withFileTypes: true }))
|
|
28469
28467
|
if (child.isDirectory() && !child.name.startsWith("."))
|
|
28470
28468
|
pending.push(import_node_path38.default.join(dir, child.name));
|
|
28471
28469
|
}
|
|
28472
28470
|
return packages;
|
|
28473
28471
|
}
|
|
28474
28472
|
const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path38.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
|
|
28475
|
-
return candidate &&
|
|
28473
|
+
return candidate && import_node_fs37.default.existsSync(import_node_path38.default.join(candidate, "Package.swift")) ? [candidate] : [];
|
|
28476
28474
|
})
|
|
28477
28475
|
)
|
|
28478
28476
|
];
|
|
@@ -28514,14 +28512,14 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
28514
28512
|
for (const directory of expandSearchPath(absolute(raw2), searchRules)) {
|
|
28515
28513
|
if (frameworkSearchDirectories.has(directory)) continue;
|
|
28516
28514
|
frameworkSearchDirectories.add(directory);
|
|
28517
|
-
if (!
|
|
28515
|
+
if (!import_node_fs37.default.statSync(directory, { throwIfNoEntry: false })?.isDirectory() || /\.sdk\/(?:System|Developer)\/Library\/Frameworks\/?$/.test(directory))
|
|
28518
28516
|
continue;
|
|
28519
|
-
for (const entry of
|
|
28517
|
+
for (const entry of import_node_fs37.default.readdirSync(directory, { withFileTypes: true })) {
|
|
28520
28518
|
const name3 = /^(.+)\.framework$/.exec(entry.name)?.[1];
|
|
28521
28519
|
if (!name3 || byProduct.has(entry.name) || searchedFrameworks.has(name3))
|
|
28522
28520
|
continue;
|
|
28523
28521
|
const file = import_node_path38.default.join(directory, entry.name);
|
|
28524
|
-
if (
|
|
28522
|
+
if (import_node_fs37.default.statSync(file, { throwIfNoEntry: false })?.isDirectory())
|
|
28525
28523
|
searchedFrameworks.set(name3, file);
|
|
28526
28524
|
}
|
|
28527
28525
|
}
|
|
@@ -28530,8 +28528,8 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
28530
28528
|
for (const raw2 of settingList(settings2("SWIFT_INCLUDE_PATHS"))) {
|
|
28531
28529
|
const dir = absolute(raw2);
|
|
28532
28530
|
const modulemap = import_node_path38.default.join(dir, "module.modulemap");
|
|
28533
|
-
if (!
|
|
28534
|
-
const name3 = moduleMapName(
|
|
28531
|
+
if (!import_node_fs37.default.existsSync(modulemap)) continue;
|
|
28532
|
+
const name3 = moduleMapName(import_node_fs37.default.readFileSync(modulemap, "utf8"));
|
|
28535
28533
|
if (name3 && !binaryFrameworks.has(name3)) includeBinary(name3, dir);
|
|
28536
28534
|
}
|
|
28537
28535
|
for (const phaseId of list(ref.target.buildPhases)) {
|
|
@@ -28540,7 +28538,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
28540
28538
|
const inputs = list(phase.inputPaths).map(absolute);
|
|
28541
28539
|
for (const raw2 of list(phase.inputFileListPaths)) {
|
|
28542
28540
|
const file = absolute(raw2);
|
|
28543
|
-
if (!
|
|
28541
|
+
if (!import_node_fs37.default.existsSync(file)) continue;
|
|
28544
28542
|
xcconfigs.add(file);
|
|
28545
28543
|
inputs.push(...fileListEntries(file, absolute));
|
|
28546
28544
|
}
|
|
@@ -28642,7 +28640,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
28642
28640
|
byProduct.has(import_node_path38.default.basename(rawPath)))
|
|
28643
28641
|
continue;
|
|
28644
28642
|
const resolved = fileId ? project.resolvePath(fileId) : null;
|
|
28645
|
-
if (fileId && resolved !== null && !
|
|
28643
|
+
if (fileId && resolved !== null && !import_node_fs37.default.existsSync(resolved))
|
|
28646
28644
|
throw new Error(
|
|
28647
28645
|
`${str(target.name) ?? "target"}: linked framework ${name3} (${fileId}) points at missing ${resolved} in ${project.projectFile}`
|
|
28648
28646
|
);
|
|
@@ -28665,7 +28663,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
28665
28663
|
({ product }) => !options.nativeModules || nativeTargets.has(built2.ref) || options.nativeModules.includes(product)
|
|
28666
28664
|
);
|
|
28667
28665
|
const resolvedFile = workspaceResolvedFile(xcodeprojOrWorkspace);
|
|
28668
|
-
let packageResolved =
|
|
28666
|
+
let packageResolved = import_node_fs37.default.existsSync(resolvedFile) ? [import_node_fs37.default.realpathSync.native(resolvedFile)] : [...new Set(localPackageDirs.map((dir) => import_node_path38.default.join(dir, "Package.resolved")))].filter((file) => import_node_fs37.default.existsSync(file)).map((file) => import_node_fs37.default.realpathSync.native(file)).sort();
|
|
28669
28667
|
if (packageResolved.length === 0) {
|
|
28670
28668
|
const requirements = remotePackageRequirements(projects2);
|
|
28671
28669
|
if (requirements.length > 0) {
|
|
@@ -28720,10 +28718,10 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
28720
28718
|
...used.map((project) => project.projectDir),
|
|
28721
28719
|
...localPackageDirs,
|
|
28722
28720
|
...linkedProducts.flatMap(
|
|
28723
|
-
({ source }) => source.kind === "local" &&
|
|
28721
|
+
({ source }) => source.kind === "local" && import_node_fs37.default.existsSync(source.dir) ? [source.dir] : []
|
|
28724
28722
|
),
|
|
28725
28723
|
...new Set(podSourceDirs)
|
|
28726
|
-
].map((dir) =>
|
|
28724
|
+
].map((dir) => import_node_fs37.default.realpathSync.native(dir))
|
|
28727
28725
|
),
|
|
28728
28726
|
projectFiles: [
|
|
28729
28727
|
.../* @__PURE__ */ new Set([
|
|
@@ -28744,7 +28742,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
28744
28742
|
resourceProducts,
|
|
28745
28743
|
linkedProducts,
|
|
28746
28744
|
localPackageDirs: [
|
|
28747
|
-
...new Set(localPackageDirs.map((dir) =>
|
|
28745
|
+
...new Set(localPackageDirs.map((dir) => import_node_fs37.default.realpathSync.native(dir)))
|
|
28748
28746
|
].sort(),
|
|
28749
28747
|
binaryFrameworks: [...binaryFrameworks].map(([name3, file]) => ({ name: name3, path: file })).sort((left, right) => left.name.localeCompare(right.name)),
|
|
28750
28748
|
sdkFrameworks: [...sdkFrameworks].filter(
|
|
@@ -28762,7 +28760,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
28762
28760
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
28763
28761
|
var import_node_child_process30 = require("node:child_process");
|
|
28764
28762
|
var import_node_crypto26 = require("node:crypto");
|
|
28765
|
-
var
|
|
28763
|
+
var import_node_fs48 = __toESM(require("node:fs"), 1);
|
|
28766
28764
|
var import_node_path49 = __toESM(require("node:path"), 1);
|
|
28767
28765
|
|
|
28768
28766
|
// src/swift-cxx-deps.ts
|
|
@@ -28813,7 +28811,7 @@ function cxxContextFlags(args) {
|
|
|
28813
28811
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
28814
28812
|
var import_node_child_process29 = require("node:child_process");
|
|
28815
28813
|
var import_node_crypto25 = require("node:crypto");
|
|
28816
|
-
var
|
|
28814
|
+
var import_node_fs47 = __toESM(require("node:fs"), 1);
|
|
28817
28815
|
var import_node_path48 = __toESM(require("node:path"), 1);
|
|
28818
28816
|
|
|
28819
28817
|
// ../../src/helpers/mapLimit.ts
|
|
@@ -28851,25 +28849,25 @@ var run2 = (0, import_node_util4.promisify)(import_node_child_process23.execFile
|
|
|
28851
28849
|
|
|
28852
28850
|
// src/swift-source-file.ts
|
|
28853
28851
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
28854
|
-
var
|
|
28852
|
+
var import_node_fs38 = __toESM(require("node:fs"), 1);
|
|
28855
28853
|
var import_node_path39 = __toESM(require("node:path"), 1);
|
|
28856
28854
|
function relativeInside(root, file) {
|
|
28857
28855
|
const relative2 = import_node_path39.default.relative(root, file);
|
|
28858
28856
|
return relative2 === ".." || relative2.startsWith(`..${import_node_path39.default.sep}`) || import_node_path39.default.isAbsolute(relative2) ? null : relative2;
|
|
28859
28857
|
}
|
|
28860
28858
|
function packageInputPath(canonicalRoot, file) {
|
|
28861
|
-
const canonicalFile =
|
|
28859
|
+
const canonicalFile = import_node_fs38.default.realpathSync(file);
|
|
28862
28860
|
if (relativeInside(canonicalRoot, canonicalFile) === null) {
|
|
28863
28861
|
throw new Error(`swift input escapes the selected package: ${file}`);
|
|
28864
28862
|
}
|
|
28865
28863
|
return canonicalFile;
|
|
28866
28864
|
}
|
|
28867
28865
|
function readPackageFile(root, file, maxBytes) {
|
|
28868
|
-
const canonicalFile = packageInputPath(
|
|
28869
|
-
const expected =
|
|
28870
|
-
const fd =
|
|
28866
|
+
const canonicalFile = packageInputPath(import_node_fs38.default.realpathSync(root), file);
|
|
28867
|
+
const expected = import_node_fs38.default.statSync(canonicalFile);
|
|
28868
|
+
const fd = import_node_fs38.default.openSync(canonicalFile, import_node_fs38.default.constants.O_RDONLY | import_node_fs38.default.constants.O_NOFOLLOW);
|
|
28871
28869
|
try {
|
|
28872
|
-
const stat =
|
|
28870
|
+
const stat = import_node_fs38.default.fstatSync(fd);
|
|
28873
28871
|
if (stat.dev !== expected.dev || stat.ino !== expected.ino) {
|
|
28874
28872
|
throw new Error(`swift input changed while opening: ${file}`);
|
|
28875
28873
|
}
|
|
@@ -28879,16 +28877,16 @@ function readPackageFile(root, file, maxBytes) {
|
|
|
28879
28877
|
const bytes = Buffer.alloc(stat.size + 1);
|
|
28880
28878
|
let offset = 0;
|
|
28881
28879
|
while (offset < bytes.length) {
|
|
28882
|
-
const count =
|
|
28880
|
+
const count = import_node_fs38.default.readSync(fd, bytes, offset, bytes.length - offset, null);
|
|
28883
28881
|
if (count === 0) break;
|
|
28884
28882
|
offset += count;
|
|
28885
28883
|
}
|
|
28886
|
-
if (offset !== stat.size ||
|
|
28884
|
+
if (offset !== stat.size || import_node_fs38.default.fstatSync(fd).size !== stat.size) {
|
|
28887
28885
|
throw new Error(`swift input changed while reading: ${file}`);
|
|
28888
28886
|
}
|
|
28889
28887
|
return bytes.subarray(0, offset);
|
|
28890
28888
|
} finally {
|
|
28891
|
-
|
|
28889
|
+
import_node_fs38.default.closeSync(fd);
|
|
28892
28890
|
}
|
|
28893
28891
|
}
|
|
28894
28892
|
|
|
@@ -29144,7 +29142,7 @@ var RN_FMT_12_DEPENDENCIES = [
|
|
|
29144
29142
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
29145
29143
|
var import_node_child_process25 = require("node:child_process");
|
|
29146
29144
|
var import_node_crypto20 = require("node:crypto");
|
|
29147
|
-
var
|
|
29145
|
+
var import_node_fs39 = __toESM(require("node:fs"), 1);
|
|
29148
29146
|
var import_node_path40 = __toESM(require("node:path"), 1);
|
|
29149
29147
|
var import_node_util6 = require("node:util");
|
|
29150
29148
|
|
|
@@ -29152,15 +29150,15 @@ var import_node_util6 = require("node:util");
|
|
|
29152
29150
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
29153
29151
|
|
|
29154
29152
|
// src/swift-packages.ts
|
|
29155
|
-
var swiftBinaryOnDisk = (binary) => binary.url !== null ||
|
|
29153
|
+
var swiftBinaryOnDisk = (binary) => binary.url !== null || import_node_fs39.default.existsSync(binary.dir);
|
|
29156
29154
|
var SWIFT_PLACEHOLDER_PACKAGES = /* @__PURE__ */ new Map();
|
|
29157
29155
|
var placeholderPackage = (pkg) => SWIFT_PLACEHOLDER_PACKAGES.get(swiftPackageIdentity(pkg.manifest.dir));
|
|
29158
29156
|
function remoteSwiftCheckouts(root) {
|
|
29159
29157
|
const prepared = preparedSwiftCheckouts(root);
|
|
29160
29158
|
if (prepared) return prepared;
|
|
29161
|
-
const key2 = (0, import_node_crypto20.createHash)("sha256").update(
|
|
29162
|
-
|
|
29163
|
-
return import_node_path40.default.join(
|
|
29159
|
+
const key2 = (0, import_node_crypto20.createHash)("sha256").update(import_node_fs39.default.realpathSync(root)).digest("hex").slice(0, 32);
|
|
29160
|
+
import_node_fs39.default.mkdirSync(cacheDir(), { recursive: true });
|
|
29161
|
+
return import_node_path40.default.join(import_node_fs39.default.realpathSync(cacheDir()), "swift-packages", key2, "checkouts");
|
|
29164
29162
|
}
|
|
29165
29163
|
var UNSUPPORTED_NATIVE = /\.(s|S)$/;
|
|
29166
29164
|
function assemblySources(files2, target) {
|
|
@@ -29199,7 +29197,7 @@ function readPins(resolved) {
|
|
|
29199
29197
|
const out = /* @__PURE__ */ new Map();
|
|
29200
29198
|
const owners = /* @__PURE__ */ new Map();
|
|
29201
29199
|
for (const file of resolved) {
|
|
29202
|
-
const data = JSON.parse(
|
|
29200
|
+
const data = JSON.parse(import_node_fs39.default.readFileSync(file, "utf8"));
|
|
29203
29201
|
const pins = resolvedPins(data);
|
|
29204
29202
|
if (!pins) throw new Error(`${file} has no pins; resolve packages in a current Xcode`);
|
|
29205
29203
|
for (const { identity: identity2, location, revision } of pins) {
|
|
@@ -29221,7 +29219,7 @@ var checkoutKey = (dir, pin2) => `${dir}\0${pin2.revision}`;
|
|
|
29221
29219
|
function fetchedCheckout(checkouts, identity2, pin2) {
|
|
29222
29220
|
const dir = import_node_path40.default.join(checkouts, identity2);
|
|
29223
29221
|
const head = import_node_path40.default.join(dir, ".git", "HEAD");
|
|
29224
|
-
if (!verified.has(checkoutKey(dir, pin2)) || !
|
|
29222
|
+
if (!verified.has(checkoutKey(dir, pin2)) || !import_node_fs39.default.existsSync(head) || import_node_fs39.default.readFileSync(head, "utf8").trim() !== pin2.revision)
|
|
29225
29223
|
throw new Error(
|
|
29226
29224
|
`${identity2} at ${pin2.revision} was not fetched; await prefetchSwiftCheckouts first`
|
|
29227
29225
|
);
|
|
@@ -29271,7 +29269,7 @@ function resolveSwiftPackages(options) {
|
|
|
29271
29269
|
if (!pin2) {
|
|
29272
29270
|
loaded2 = pins ? `package ${identity2} is not pinned in Package.resolved` : "no Package.resolved pins it; resolve packages in Xcode once";
|
|
29273
29271
|
} else {
|
|
29274
|
-
|
|
29272
|
+
import_node_fs39.default.mkdirSync(checkouts, { recursive: true });
|
|
29275
29273
|
loaded2 = {
|
|
29276
29274
|
source: source.url,
|
|
29277
29275
|
remote: true,
|
|
@@ -29413,7 +29411,7 @@ function resolveSwiftPackages(options) {
|
|
|
29413
29411
|
if (!target || target.type !== "regular" || placeholderPackage(pkg)) return false;
|
|
29414
29412
|
const files2 = swiftTargetFiles(pkg.manifest, target);
|
|
29415
29413
|
if (files2.every(
|
|
29416
|
-
(file) => file.endsWith(".swift") &&
|
|
29414
|
+
(file) => file.endsWith(".swift") && import_node_fs39.default.readFileSync(file, "utf8").trim() === ""
|
|
29417
29415
|
))
|
|
29418
29416
|
return false;
|
|
29419
29417
|
claimed.add(key2);
|
|
@@ -29568,7 +29566,7 @@ function resolveSwiftPackages(options) {
|
|
|
29568
29566
|
visit(nested, root);
|
|
29569
29567
|
}
|
|
29570
29568
|
}
|
|
29571
|
-
if (name3 !== binary.target &&
|
|
29569
|
+
if (name3 !== binary.target && import_node_fs39.default.existsSync(dir))
|
|
29572
29570
|
headers.set(name3, import_node_path40.default.relative(binary.dir, dir));
|
|
29573
29571
|
};
|
|
29574
29572
|
visit(pkg, binary.target);
|
|
@@ -29708,7 +29706,7 @@ function resolveSwiftPackages(options) {
|
|
|
29708
29706
|
// src/swift-standin-digest.ts
|
|
29709
29707
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
29710
29708
|
var import_node_crypto21 = require("node:crypto");
|
|
29711
|
-
var
|
|
29709
|
+
var import_node_fs40 = require("node:fs");
|
|
29712
29710
|
var import_node_path41 = __toESM(require("node:path"), 1);
|
|
29713
29711
|
var STANDIN_DIGEST_ENTRYPOINTS = ["swift-standins.ts", "swift-objc-compile.ts"];
|
|
29714
29712
|
var SPECIFIER = /from\s*['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
@@ -29721,12 +29719,12 @@ function resolveImport(fromDir, specifier) {
|
|
|
29721
29719
|
`${absolute}.tsx`,
|
|
29722
29720
|
import_node_path41.default.join(absolute, "index.ts")
|
|
29723
29721
|
])
|
|
29724
|
-
if ((0,
|
|
29722
|
+
if ((0, import_node_fs40.existsSync)(candidate)) return candidate;
|
|
29725
29723
|
return null;
|
|
29726
29724
|
}
|
|
29727
29725
|
function sourceClosureFiles(srcDir, entrypoints) {
|
|
29728
29726
|
for (const entry of entrypoints)
|
|
29729
|
-
if (!(0,
|
|
29727
|
+
if (!(0, import_node_fs40.existsSync)(import_node_path41.default.join(srcDir, entry)))
|
|
29730
29728
|
throw new Error(`digest entrypoint is missing: ${entry}`);
|
|
29731
29729
|
const files2 = [];
|
|
29732
29730
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -29736,7 +29734,7 @@ function sourceClosureFiles(srcDir, entrypoints) {
|
|
|
29736
29734
|
if (seen.has(file)) continue;
|
|
29737
29735
|
seen.add(file);
|
|
29738
29736
|
files2.push(file);
|
|
29739
|
-
for (const match of (0,
|
|
29737
|
+
for (const match of (0, import_node_fs40.readFileSync)(file, "utf8").matchAll(SPECIFIER)) {
|
|
29740
29738
|
const specifier = match[1] ?? match[2];
|
|
29741
29739
|
if (!specifier.startsWith(".")) continue;
|
|
29742
29740
|
const hit = resolveImport(import_node_path41.default.dirname(file), specifier);
|
|
@@ -29749,26 +29747,26 @@ function sourceClosureDigest(srcDir, entrypoints) {
|
|
|
29749
29747
|
const hash = (0, import_node_crypto21.createHash)("sha256");
|
|
29750
29748
|
for (const file of sourceClosureFiles(srcDir, entrypoints)) {
|
|
29751
29749
|
const key2 = import_node_path41.default.relative(srcDir, file);
|
|
29752
|
-
const bytes = (0,
|
|
29750
|
+
const bytes = (0, import_node_fs40.readFileSync)(file);
|
|
29753
29751
|
hash.update(`${Buffer.byteLength(key2)}:${key2}${bytes.length}:`).update(bytes);
|
|
29754
29752
|
}
|
|
29755
29753
|
return hash.digest("hex");
|
|
29756
29754
|
}
|
|
29757
29755
|
var standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
|
|
29758
|
-
var STANDIN_SOURCE_DIGEST = true ? "
|
|
29756
|
+
var STANDIN_SOURCE_DIGEST = true ? "54d5cda2634afbc5ff0e2199f90025e07d2cf86367c736799de3d121d026cf1a" : standinSourceDigest();
|
|
29759
29757
|
|
|
29760
29758
|
// src/swift-standins.ts
|
|
29761
29759
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
29762
29760
|
var import_node_child_process28 = require("node:child_process");
|
|
29763
29761
|
var import_node_crypto24 = require("node:crypto");
|
|
29764
|
-
var
|
|
29762
|
+
var import_node_fs46 = __toESM(require("node:fs"), 1);
|
|
29765
29763
|
var import_node_path47 = __toESM(require("node:path"), 1);
|
|
29766
29764
|
|
|
29767
29765
|
// src/native-prebuilt.ts
|
|
29768
29766
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
29769
29767
|
var import_node_child_process26 = require("node:child_process");
|
|
29770
29768
|
var import_node_crypto22 = require("node:crypto");
|
|
29771
|
-
var
|
|
29769
|
+
var import_node_fs41 = __toESM(require("node:fs"), 1);
|
|
29772
29770
|
var import_node_path42 = __toESM(require("node:path"), 1);
|
|
29773
29771
|
var NATIVE_PREBUILT_ORIGIN = "https://r2.rnxsim.com";
|
|
29774
29772
|
function nativeEntryKey(inputs) {
|
|
@@ -29784,11 +29782,11 @@ function download(url, to) {
|
|
|
29784
29782
|
});
|
|
29785
29783
|
return true;
|
|
29786
29784
|
} catch {
|
|
29787
|
-
|
|
29785
|
+
import_node_fs41.default.rmSync(to, { force: true });
|
|
29788
29786
|
return false;
|
|
29789
29787
|
}
|
|
29790
29788
|
}
|
|
29791
|
-
var sha2562 = (file) => (0, import_node_crypto22.createHash)("sha256").update(
|
|
29789
|
+
var sha2562 = (file) => (0, import_node_crypto22.createHash)("sha256").update(import_node_fs41.default.readFileSync(file)).digest("hex");
|
|
29792
29790
|
function isEntryFile(file) {
|
|
29793
29791
|
return isRecord(file) && typeof file.path === "string" && !file.path.includes("/") && typeof file.sha256 === "string" && typeof file.size === "number";
|
|
29794
29792
|
}
|
|
@@ -29801,16 +29799,16 @@ function parseFiles(text5, kind, name3, key2) {
|
|
|
29801
29799
|
function fetchNativeEntry(kind, name3, key2) {
|
|
29802
29800
|
const dir = entryCache(kind, name3, key2);
|
|
29803
29801
|
const descriptorFile = import_node_path42.default.join(dir, "descriptor.json");
|
|
29804
|
-
if (
|
|
29802
|
+
if (import_node_fs41.default.existsSync(descriptorFile)) return dir;
|
|
29805
29803
|
const base = `${NATIVE_PREBUILT_ORIGIN}/${nativeEntryPrefix(kind, name3, key2)}`;
|
|
29806
29804
|
const staging = `${dir}.${process.pid}.partial`;
|
|
29807
|
-
|
|
29808
|
-
|
|
29805
|
+
import_node_fs41.default.rmSync(staging, { recursive: true, force: true });
|
|
29806
|
+
import_node_fs41.default.mkdirSync(staging, { recursive: true });
|
|
29809
29807
|
try {
|
|
29810
29808
|
if (!download(`${base}/descriptor.json`, import_node_path42.default.join(staging, "descriptor.json")))
|
|
29811
29809
|
return null;
|
|
29812
29810
|
const files2 = parseFiles(
|
|
29813
|
-
|
|
29811
|
+
import_node_fs41.default.readFileSync(import_node_path42.default.join(staging, "descriptor.json"), "utf8"),
|
|
29814
29812
|
kind,
|
|
29815
29813
|
name3,
|
|
29816
29814
|
key2
|
|
@@ -29818,17 +29816,17 @@ function fetchNativeEntry(kind, name3, key2) {
|
|
|
29818
29816
|
for (const file of files2) {
|
|
29819
29817
|
const target = import_node_path42.default.join(staging, file.path);
|
|
29820
29818
|
if (!download(`${base}/${file.path}`, target)) return null;
|
|
29821
|
-
if (
|
|
29819
|
+
if (import_node_fs41.default.statSync(target).size !== file.size || sha2562(target) !== file.sha256)
|
|
29822
29820
|
throw new Error(
|
|
29823
29821
|
`native prebuilt ${kind}/${name3}/${key2}: ${file.path} does not match its descriptor`
|
|
29824
29822
|
);
|
|
29825
29823
|
}
|
|
29826
|
-
|
|
29827
|
-
|
|
29828
|
-
|
|
29824
|
+
import_node_fs41.default.mkdirSync(import_node_path42.default.dirname(dir), { recursive: true });
|
|
29825
|
+
import_node_fs41.default.rmSync(dir, { recursive: true, force: true });
|
|
29826
|
+
import_node_fs41.default.renameSync(staging, dir);
|
|
29829
29827
|
return dir;
|
|
29830
29828
|
} finally {
|
|
29831
|
-
|
|
29829
|
+
import_node_fs41.default.rmSync(staging, { recursive: true, force: true });
|
|
29832
29830
|
}
|
|
29833
29831
|
}
|
|
29834
29832
|
|
|
@@ -29869,7 +29867,7 @@ var import_node_path44 = __toESM(require("node:path"), 1);
|
|
|
29869
29867
|
|
|
29870
29868
|
// src/swift-xcframework.ts
|
|
29871
29869
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
29872
|
-
var
|
|
29870
|
+
var import_node_fs42 = __toESM(require("node:fs"), 1);
|
|
29873
29871
|
var import_node_path43 = __toESM(require("node:path"), 1);
|
|
29874
29872
|
|
|
29875
29873
|
// src/plist-bytes.ts
|
|
@@ -29883,7 +29881,7 @@ function parsePlistBytes(source) {
|
|
|
29883
29881
|
// src/swift-xcframework.ts
|
|
29884
29882
|
function simulatorNativeLibrary(dir) {
|
|
29885
29883
|
if (!dir.endsWith(".xcframework")) return null;
|
|
29886
|
-
const info = parsePlistBytes(
|
|
29884
|
+
const info = parsePlistBytes(import_node_fs42.default.readFileSync(import_node_path43.default.join(dir, "Info.plist")));
|
|
29887
29885
|
if (!isRecord(info) || !Array.isArray(info.AvailableLibraries))
|
|
29888
29886
|
throw new Error(`${dir}: invalid XCFramework library declarations`);
|
|
29889
29887
|
const matches = [];
|
|
@@ -30116,7 +30114,7 @@ function nativeStaticLibrary(file, recipe, moduleRoot) {
|
|
|
30116
30114
|
|
|
30117
30115
|
// src/output-lock-stdio.ts
|
|
30118
30116
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
30119
|
-
var
|
|
30117
|
+
var import_node_fs43 = require("node:fs");
|
|
30120
30118
|
function outputLockStdio(standard, env = process.env) {
|
|
30121
30119
|
const stdio = [...standard];
|
|
30122
30120
|
for (const [key2, value] of Object.entries(process.env)) {
|
|
@@ -30129,7 +30127,7 @@ function outputLockStdio(standard, env = process.env) {
|
|
|
30129
30127
|
if (!/^REMOTE_OUTPUT_LOCK_[a-f0-9]{64}$/.test(key2) || !value || !/^\d+$/.test(value) || !Number.isSafeInteger(fd) || fd < 3)
|
|
30130
30128
|
throw new Error(`invalid inherited output lock descriptor for ${key2}`);
|
|
30131
30129
|
try {
|
|
30132
|
-
(0,
|
|
30130
|
+
(0, import_node_fs43.fstatSync)(fd);
|
|
30133
30131
|
} catch (cause) {
|
|
30134
30132
|
throw new Error(`inherited output lock descriptor ${fd} unavailable for ${key2}`, {
|
|
30135
30133
|
cause
|
|
@@ -30144,12 +30142,12 @@ function outputLockStdio(standard, env = process.env) {
|
|
|
30144
30142
|
// src/swift-cxx-standin.ts
|
|
30145
30143
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
30146
30144
|
var import_node_child_process27 = require("node:child_process");
|
|
30147
|
-
var
|
|
30145
|
+
var import_node_fs45 = __toESM(require("node:fs"), 1);
|
|
30148
30146
|
var import_node_path46 = __toESM(require("node:path"), 1);
|
|
30149
30147
|
|
|
30150
30148
|
// src/swift-cxx-declarations.ts
|
|
30151
30149
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
30152
|
-
var
|
|
30150
|
+
var import_node_fs44 = __toESM(require("node:fs"), 1);
|
|
30153
30151
|
var import_node_path45 = __toESM(require("node:path"), 1);
|
|
30154
30152
|
var import_promises5 = require("node:stream/promises");
|
|
30155
30153
|
var import_stream_json = __toESM(require("stream-json"), 1);
|
|
@@ -30166,7 +30164,7 @@ async function cxxDeclarations(astFile, headers) {
|
|
|
30166
30164
|
const result = [];
|
|
30167
30165
|
let lastFile = "";
|
|
30168
30166
|
let rootComplete = false;
|
|
30169
|
-
await (0, import_promises5.pipeline)(
|
|
30167
|
+
await (0, import_promises5.pipeline)(import_node_fs44.default.createReadStream(astFile), (0, import_stream_json.default)(), async (tokens2) => {
|
|
30170
30168
|
for await (const value of tokens2) {
|
|
30171
30169
|
if (!value || typeof value !== "object" || !("name" in value) || typeof value.name !== "string")
|
|
30172
30170
|
throw new Error("invalid clang AST token");
|
|
@@ -30318,8 +30316,8 @@ async function emitCxxStandin(input) {
|
|
|
30318
30316
|
const ast = import_node_path46.default.join(input.work, "cxx-ast.json");
|
|
30319
30317
|
const probe = import_node_path46.default.join(input.work, "cxx-probe.cpp");
|
|
30320
30318
|
const sourceFile = import_node_path46.default.join(input.work, "cxx-traps.cpp");
|
|
30321
|
-
|
|
30322
|
-
|
|
30319
|
+
import_node_fs45.default.mkdirSync(input.work, { recursive: true });
|
|
30320
|
+
import_node_fs45.default.writeFileSync(
|
|
30323
30321
|
probe,
|
|
30324
30322
|
input.roots.map((root) => `#include ${JSON.stringify(root)}
|
|
30325
30323
|
`).join("")
|
|
@@ -30351,7 +30349,7 @@ async function emitCxxStandin(input) {
|
|
|
30351
30349
|
const relative2 = relativeInside(input.headers, absolute);
|
|
30352
30350
|
if (relative2) reached.add(absolute);
|
|
30353
30351
|
}
|
|
30354
|
-
const output2 =
|
|
30352
|
+
const output2 = import_node_fs45.default.openSync(ast, "w");
|
|
30355
30353
|
let parsed;
|
|
30356
30354
|
try {
|
|
30357
30355
|
parsed = (0, import_node_child_process27.spawnSync)(
|
|
@@ -30360,7 +30358,7 @@ async function emitCxxStandin(input) {
|
|
|
30360
30358
|
{ stdio: ["ignore", output2, "pipe"], encoding: "utf8", env: swiftEnvironment() }
|
|
30361
30359
|
);
|
|
30362
30360
|
} finally {
|
|
30363
|
-
|
|
30361
|
+
import_node_fs45.default.closeSync(output2);
|
|
30364
30362
|
}
|
|
30365
30363
|
if (parsed.error || parsed.status !== 0)
|
|
30366
30364
|
throw new Error(
|
|
@@ -30370,7 +30368,7 @@ async function emitCxxStandin(input) {
|
|
|
30370
30368
|
try {
|
|
30371
30369
|
declarations = await cxxDeclarations(ast, reached);
|
|
30372
30370
|
} finally {
|
|
30373
|
-
|
|
30371
|
+
import_node_fs45.default.rmSync(ast, { force: true });
|
|
30374
30372
|
}
|
|
30375
30373
|
const excluded = {};
|
|
30376
30374
|
const symbols = /* @__PURE__ */ new Map();
|
|
@@ -30408,7 +30406,7 @@ async function emitCxxStandin(input) {
|
|
|
30408
30406
|
];
|
|
30409
30407
|
let live = definitions;
|
|
30410
30408
|
for (; ; ) {
|
|
30411
|
-
|
|
30409
|
+
import_node_fs45.default.writeFileSync(
|
|
30412
30410
|
sourceFile,
|
|
30413
30411
|
[...prelude, ...live.map((item) => item.text)].join("\n") + "\n"
|
|
30414
30412
|
);
|
|
@@ -30471,12 +30469,12 @@ function treeDigest(root) {
|
|
|
30471
30469
|
const names = [];
|
|
30472
30470
|
const ancestors = /* @__PURE__ */ new Set();
|
|
30473
30471
|
const walk3 = (dir) => {
|
|
30474
|
-
const resolved =
|
|
30472
|
+
const resolved = import_node_fs46.default.realpathSync(dir);
|
|
30475
30473
|
if (ancestors.has(resolved)) throw new Error(`cyclic header directory: ${dir}`);
|
|
30476
30474
|
ancestors.add(resolved);
|
|
30477
|
-
for (const entry of
|
|
30475
|
+
for (const entry of import_node_fs46.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name < right.name ? -1 : 1)) {
|
|
30478
30476
|
const full = import_node_path47.default.join(dir, entry.name);
|
|
30479
|
-
const stat = entry.isSymbolicLink() ?
|
|
30477
|
+
const stat = entry.isSymbolicLink() ? import_node_fs46.default.statSync(full) : entry;
|
|
30480
30478
|
if (stat.isDirectory()) walk3(full);
|
|
30481
30479
|
else if (stat.isFile()) names.push(import_node_path47.default.relative(root, full));
|
|
30482
30480
|
}
|
|
@@ -30484,7 +30482,7 @@ function treeDigest(root) {
|
|
|
30484
30482
|
};
|
|
30485
30483
|
walk3(root);
|
|
30486
30484
|
const stamp = names.map((name3) => {
|
|
30487
|
-
const stat =
|
|
30485
|
+
const stat = import_node_fs46.default.statSync(import_node_path47.default.join(root, name3));
|
|
30488
30486
|
return `${name3}\0${stat.size}:${stat.mtimeMs}`;
|
|
30489
30487
|
}).join("\n");
|
|
30490
30488
|
const memo2 = digests.get(`tree\0${root}`);
|
|
@@ -30492,7 +30490,7 @@ function treeDigest(root) {
|
|
|
30492
30490
|
const hash = (0, import_node_crypto24.createHash)("sha256");
|
|
30493
30491
|
for (const name3 of names) {
|
|
30494
30492
|
hash.update(`${name3}\0`);
|
|
30495
|
-
hash.update(
|
|
30493
|
+
hash.update(import_node_fs46.default.readFileSync(import_node_path47.default.join(root, name3)));
|
|
30496
30494
|
hash.update("\0");
|
|
30497
30495
|
}
|
|
30498
30496
|
const digest = hash.digest("hex");
|
|
@@ -30501,7 +30499,7 @@ function treeDigest(root) {
|
|
|
30501
30499
|
}
|
|
30502
30500
|
function locateXcframework(tree2) {
|
|
30503
30501
|
const find = (root, depth) => {
|
|
30504
|
-
for (const entry of
|
|
30502
|
+
for (const entry of import_node_fs46.default.readdirSync(root, { withFileTypes: true })) {
|
|
30505
30503
|
if (!entry.isDirectory() || entry.name === "__MACOSX") continue;
|
|
30506
30504
|
const full = import_node_path47.default.join(root, entry.name);
|
|
30507
30505
|
if (entry.name.endsWith(".xcframework")) return full;
|
|
@@ -30523,47 +30521,47 @@ function xcframework(binary) {
|
|
|
30523
30521
|
const fingerprint = import_node_path47.default.join(dir, ".fingerprint");
|
|
30524
30522
|
const stored = (() => {
|
|
30525
30523
|
try {
|
|
30526
|
-
const parsed = JSON.parse(
|
|
30524
|
+
const parsed = JSON.parse(import_node_fs46.default.readFileSync(fingerprint, "utf8"));
|
|
30527
30525
|
return parsed && typeof parsed === "object" && "sha" in parsed ? parsed : null;
|
|
30528
30526
|
} catch {
|
|
30529
30527
|
return null;
|
|
30530
30528
|
}
|
|
30531
30529
|
})();
|
|
30532
30530
|
if (!binary.url) {
|
|
30533
|
-
const stat =
|
|
30531
|
+
const stat = import_node_fs46.default.statSync(binary.dir);
|
|
30534
30532
|
const stamp = `${stat.size}:${stat.mtimeMs}`;
|
|
30535
30533
|
if (stored?.stamp === stamp) {
|
|
30536
30534
|
const found3 = locateXcframework(import_node_path47.default.join(dir, "tree"));
|
|
30537
30535
|
if (found3) return { dir: found3, digest: stored.sha };
|
|
30538
30536
|
}
|
|
30539
|
-
const sha2 = (0, import_node_crypto24.createHash)("sha256").update(
|
|
30537
|
+
const sha2 = (0, import_node_crypto24.createHash)("sha256").update(import_node_fs46.default.readFileSync(binary.dir)).digest("hex");
|
|
30540
30538
|
if (sha2 !== stored?.sha || !locateXcframework(import_node_path47.default.join(dir, "tree"))) {
|
|
30541
|
-
|
|
30542
|
-
|
|
30539
|
+
import_node_fs46.default.rmSync(dir, { recursive: true, force: true });
|
|
30540
|
+
import_node_fs46.default.mkdirSync(import_node_path47.default.join(dir, "tree"), { recursive: true });
|
|
30543
30541
|
exec("unzip", ["-q", binary.dir, "-d", import_node_path47.default.join(dir, "tree")]);
|
|
30544
30542
|
}
|
|
30545
|
-
|
|
30543
|
+
import_node_fs46.default.writeFileSync(fingerprint, JSON.stringify({ stamp, sha: sha2 }));
|
|
30546
30544
|
const found2 = locateXcframework(import_node_path47.default.join(dir, "tree"));
|
|
30547
30545
|
if (!found2) throw new Error("its archive holds no .xcframework");
|
|
30548
30546
|
return { dir: found2, digest: sha2 };
|
|
30549
30547
|
}
|
|
30550
|
-
if (stored &&
|
|
30551
|
-
const sha2 = (0, import_node_crypto24.createHash)("sha256").update(
|
|
30548
|
+
if (stored && import_node_fs46.default.existsSync(archive)) {
|
|
30549
|
+
const sha2 = (0, import_node_crypto24.createHash)("sha256").update(import_node_fs46.default.readFileSync(archive)).digest("hex");
|
|
30552
30550
|
if (sha2 !== expected)
|
|
30553
30551
|
throw new Error(`archive checksum ${sha2} is not the declared checksum ${expected}`);
|
|
30554
30552
|
const found2 = locateXcframework(import_node_path47.default.join(dir, "tree"));
|
|
30555
30553
|
if (found2) return { dir: found2, digest: sha2 };
|
|
30556
30554
|
}
|
|
30557
|
-
|
|
30558
|
-
|
|
30555
|
+
import_node_fs46.default.rmSync(dir, { recursive: true, force: true });
|
|
30556
|
+
import_node_fs46.default.mkdirSync(import_node_path47.default.join(dir, "tree"), { recursive: true });
|
|
30559
30557
|
exec("curl", ["-fsSL", "--retry", "2", "-o", archive, binary.url]);
|
|
30560
|
-
const sha = (0, import_node_crypto24.createHash)("sha256").update(
|
|
30558
|
+
const sha = (0, import_node_crypto24.createHash)("sha256").update(import_node_fs46.default.readFileSync(archive)).digest("hex");
|
|
30561
30559
|
if (sha !== expected) {
|
|
30562
|
-
|
|
30560
|
+
import_node_fs46.default.rmSync(dir, { recursive: true, force: true });
|
|
30563
30561
|
throw new Error(`archive checksum ${sha} is not the declared checksum ${expected}`);
|
|
30564
30562
|
}
|
|
30565
30563
|
exec("unzip", ["-q", archive, "-d", import_node_path47.default.join(dir, "tree")]);
|
|
30566
|
-
|
|
30564
|
+
import_node_fs46.default.writeFileSync(fingerprint, JSON.stringify({ sha }));
|
|
30567
30565
|
const found = locateXcframework(import_node_path47.default.join(dir, "tree"));
|
|
30568
30566
|
if (!found) throw new Error("its archive holds no .xcframework");
|
|
30569
30567
|
return { dir: found, digest: sha };
|
|
@@ -30574,7 +30572,7 @@ var OBJC_IMPORT = /#\s*(?:import|include)\s*[<"](?:[\w+-]+\/)?([\w+.-]+\.h)[>"]/
|
|
|
30574
30572
|
function stageDeclaredFramework(framework, declared, imports2, sdkHeader, destination) {
|
|
30575
30573
|
const name3 = import_node_path47.default.basename(framework, ".framework");
|
|
30576
30574
|
const own = `${name3}-Swift.h`;
|
|
30577
|
-
const declaration =
|
|
30575
|
+
const declaration = import_node_fs46.default.readFileSync(
|
|
30578
30576
|
import_node_path47.default.join(framework, "Modules/module.modulemap"),
|
|
30579
30577
|
"utf8"
|
|
30580
30578
|
);
|
|
@@ -30584,19 +30582,19 @@ function stageDeclaredFramework(framework, declared, imports2, sdkHeader, destin
|
|
|
30584
30582
|
}
|
|
30585
30583
|
`;
|
|
30586
30584
|
const umbrella = /umbrella header "([^"]+)"/.exec(modulemap)?.[1];
|
|
30587
|
-
if (!umbrella || !
|
|
30585
|
+
if (!umbrella || !import_node_fs46.default.existsSync(import_node_path47.default.join(framework, "Headers", umbrella)))
|
|
30588
30586
|
throw new Error(`${name3} module map names no umbrella header`);
|
|
30589
30587
|
const headers = new Map(
|
|
30590
|
-
|
|
30588
|
+
import_node_fs46.default.readdirSync(import_node_path47.default.join(framework, "Headers")).filter(
|
|
30591
30589
|
(file) => file.endsWith(".h") && file !== umbrella && file !== own && file !== `${name3}.h`
|
|
30592
30590
|
).map((file) => [
|
|
30593
30591
|
file,
|
|
30594
|
-
|
|
30592
|
+
import_node_fs46.default.readFileSync(import_node_path47.default.join(framework, "Headers", file), "utf8")
|
|
30595
30593
|
])
|
|
30596
30594
|
);
|
|
30597
30595
|
const modularHeaders = new Set(
|
|
30598
30596
|
[
|
|
30599
|
-
...
|
|
30597
|
+
...import_node_fs46.default.readFileSync(import_node_path47.default.join(framework, "Headers", umbrella), "utf8").matchAll(OBJC_IMPORT)
|
|
30600
30598
|
].map((match) => match[1])
|
|
30601
30599
|
);
|
|
30602
30600
|
const reached = /* @__PURE__ */ new Set();
|
|
@@ -30608,14 +30606,14 @@ function stageDeclaredFramework(framework, declared, imports2, sdkHeader, destin
|
|
|
30608
30606
|
};
|
|
30609
30607
|
for (const file of imports2) reach(file);
|
|
30610
30608
|
const target = import_node_path47.default.join(destination, "frameworks", import_node_path47.default.basename(framework));
|
|
30611
|
-
|
|
30612
|
-
|
|
30609
|
+
import_node_fs46.default.mkdirSync(import_node_path47.default.join(target, "Headers"), { recursive: true });
|
|
30610
|
+
import_node_fs46.default.mkdirSync(import_node_path47.default.join(target, "Modules"));
|
|
30613
30611
|
if (sdkHeader !== null && reached.size === 0)
|
|
30614
|
-
|
|
30612
|
+
import_node_fs46.default.writeFileSync(import_node_path47.default.join(target, "Headers", `${name3}-SDK.h`), sdkHeader);
|
|
30615
30613
|
for (const [file, source] of headers) {
|
|
30616
30614
|
const body = declared ? withoutSwiftDeclarations(source, declared, `#import <${name3}/${own}>`) : source;
|
|
30617
30615
|
const uikit = /\bUI[A-Z]\w+/.test(body) && !body.includes("UIKit/UIKit.h") ? "#import <UIKit/UIKit.h>\n" : "";
|
|
30618
|
-
|
|
30616
|
+
import_node_fs46.default.writeFileSync(
|
|
30619
30617
|
import_node_path47.default.join(target, "Headers", file),
|
|
30620
30618
|
`#import <Foundation/Foundation.h>
|
|
30621
30619
|
${uikit}${body}`
|
|
@@ -30630,7 +30628,7 @@ ${uikit}${body}`
|
|
|
30630
30628
|
(file) => ` module ${import_node_path47.default.basename(file, ".h").replace(/\W/g, "_")} { header "${file}" export * }`
|
|
30631
30629
|
)
|
|
30632
30630
|
];
|
|
30633
|
-
|
|
30631
|
+
import_node_fs46.default.writeFileSync(
|
|
30634
30632
|
import_node_path47.default.join(target, "Modules/module.modulemap"),
|
|
30635
30633
|
modulemap.replace(/^\s*umbrella header "[^"]*"\s*\n/m, `${submodules.join("\n")}
|
|
30636
30634
|
`).replace(/^\s*module \*\s*\{[^}]*\}\s*\n/m, "")
|
|
@@ -30647,9 +30645,9 @@ function binaryHeaderSearchPaths(binary, root, declaredFrameworks) {
|
|
|
30647
30645
|
)
|
|
30648
30646
|
)
|
|
30649
30647
|
];
|
|
30650
|
-
const standalone =
|
|
30648
|
+
const standalone = import_node_fs46.default.existsSync(import_node_path47.default.join(artifact.dir, "module.modulemap"));
|
|
30651
30649
|
const libraryHeaders = standalone ? artifact.dir : slice ? import_node_path47.default.join(slice, "Headers") : null;
|
|
30652
|
-
const headers = libraryHeaders &&
|
|
30650
|
+
const headers = libraryHeaders && import_node_fs46.default.existsSync(libraryHeaders) ? [libraryHeaders] : [];
|
|
30653
30651
|
if (headers.length === 0 && frameworks.length === 0)
|
|
30654
30652
|
return { frameworks: [], headers: [] };
|
|
30655
30653
|
const declared = /* @__PURE__ */ new Map();
|
|
@@ -30673,7 +30671,7 @@ function binaryHeaderSearchPaths(binary, root, declaredFrameworks) {
|
|
|
30673
30671
|
declared: null,
|
|
30674
30672
|
header: null,
|
|
30675
30673
|
imports: compiled,
|
|
30676
|
-
sdkHeader:
|
|
30674
|
+
sdkHeader: import_node_fs46.default.readFileSync(sdkHeader, "utf8")
|
|
30677
30675
|
});
|
|
30678
30676
|
}
|
|
30679
30677
|
}
|
|
@@ -30688,7 +30686,7 @@ function binaryHeaderSearchPaths(binary, root, declaredFrameworks) {
|
|
|
30688
30686
|
const revision = import_node_path47.default.join(staging, "revisions", STANDIN_SOURCE_DIGEST.slice(0, 32));
|
|
30689
30687
|
const stageTree = () => {
|
|
30690
30688
|
const pending = import_node_path47.default.join(staging, `pending.${process.pid}`);
|
|
30691
|
-
|
|
30689
|
+
import_node_fs46.default.rmSync(pending, { recursive: true, force: true });
|
|
30692
30690
|
for (const framework of frameworks) {
|
|
30693
30691
|
const swift = declared.get(framework);
|
|
30694
30692
|
if (swift) {
|
|
@@ -30702,8 +30700,8 @@ function binaryHeaderSearchPaths(binary, root, declaredFrameworks) {
|
|
|
30702
30700
|
continue;
|
|
30703
30701
|
}
|
|
30704
30702
|
for (const part of ["Headers", "Modules"])
|
|
30705
|
-
if (
|
|
30706
|
-
|
|
30703
|
+
if (import_node_fs46.default.existsSync(import_node_path47.default.join(framework, part)))
|
|
30704
|
+
import_node_fs46.default.cpSync(
|
|
30707
30705
|
import_node_path47.default.join(framework, part),
|
|
30708
30706
|
import_node_path47.default.join(pending, "frameworks", import_node_path47.default.basename(framework), part),
|
|
30709
30707
|
{ recursive: true, dereference: true }
|
|
@@ -30718,49 +30716,49 @@ function binaryHeaderSearchPaths(binary, root, declaredFrameworks) {
|
|
|
30718
30716
|
import_node_path47.default.basename(framework),
|
|
30719
30717
|
"Modules"
|
|
30720
30718
|
);
|
|
30721
|
-
|
|
30722
|
-
|
|
30719
|
+
import_node_fs46.default.mkdirSync(modules, { recursive: true });
|
|
30720
|
+
import_node_fs46.default.copyFileSync(surface.modulemap, import_node_path47.default.join(modules, "module.modulemap"));
|
|
30723
30721
|
}
|
|
30724
30722
|
}
|
|
30725
30723
|
for (const [index, directory] of headers.entries()) {
|
|
30726
|
-
|
|
30724
|
+
import_node_fs46.default.cpSync(directory, import_node_path47.default.join(pending, "headers", String(index)), {
|
|
30727
30725
|
recursive: true,
|
|
30728
30726
|
dereference: true,
|
|
30729
30727
|
...standalone ? {
|
|
30730
|
-
filter: (source) =>
|
|
30728
|
+
filter: (source) => import_node_fs46.default.statSync(source).isDirectory() ? import_node_path47.default.dirname(source) !== directory || !import_node_path47.default.basename(source).startsWith("ios-") : !isBinaryLibraryFile(source)
|
|
30731
30729
|
} : {}
|
|
30732
30730
|
});
|
|
30733
30731
|
const surface = found.find(
|
|
30734
30732
|
(item) => "headers" in item && item.headers === directory
|
|
30735
30733
|
);
|
|
30736
30734
|
if (surface && "modulemap" in surface)
|
|
30737
|
-
|
|
30735
|
+
import_node_fs46.default.copyFileSync(
|
|
30738
30736
|
surface.modulemap,
|
|
30739
30737
|
import_node_path47.default.join(pending, "headers", String(index), "module.modulemap")
|
|
30740
30738
|
);
|
|
30741
30739
|
}
|
|
30742
30740
|
const contents = (0, import_node_crypto24.createHash)("sha256");
|
|
30743
|
-
for (const relative2 of
|
|
30741
|
+
for (const relative2 of import_node_fs46.default.readdirSync(pending, { recursive: true, encoding: "utf8" }).sort()) {
|
|
30744
30742
|
const file = import_node_path47.default.join(pending, relative2);
|
|
30745
30743
|
contents.update(`${relative2}\0`);
|
|
30746
|
-
if (
|
|
30744
|
+
if (import_node_fs46.default.statSync(file).isFile()) contents.update(import_node_fs46.default.readFileSync(file));
|
|
30747
30745
|
}
|
|
30748
30746
|
const name3 = contents.digest("hex").slice(0, 32);
|
|
30749
30747
|
try {
|
|
30750
|
-
|
|
30748
|
+
import_node_fs46.default.renameSync(pending, import_node_path47.default.join(staging, name3));
|
|
30751
30749
|
} catch (error) {
|
|
30752
|
-
|
|
30753
|
-
if (!
|
|
30750
|
+
import_node_fs46.default.rmSync(pending, { recursive: true, force: true });
|
|
30751
|
+
if (!import_node_fs46.default.existsSync(import_node_path47.default.join(staging, name3))) throw error;
|
|
30754
30752
|
}
|
|
30755
|
-
|
|
30753
|
+
import_node_fs46.default.mkdirSync(import_node_path47.default.dirname(revision), { recursive: true });
|
|
30756
30754
|
const record2 = `${revision}.${process.pid}`;
|
|
30757
|
-
|
|
30758
|
-
|
|
30755
|
+
import_node_fs46.default.writeFileSync(record2, name3);
|
|
30756
|
+
import_node_fs46.default.renameSync(record2, revision);
|
|
30759
30757
|
return name3;
|
|
30760
30758
|
};
|
|
30761
30759
|
const search = import_node_path47.default.join(
|
|
30762
30760
|
staging,
|
|
30763
|
-
|
|
30761
|
+
import_node_fs46.default.existsSync(revision) ? import_node_fs46.default.readFileSync(revision, "utf8") : stageTree()
|
|
30764
30762
|
);
|
|
30765
30763
|
for (const [framework, { header }] of declared) {
|
|
30766
30764
|
if (header === null) continue;
|
|
@@ -30772,9 +30770,9 @@ function binaryHeaderSearchPaths(binary, root, declaredFrameworks) {
|
|
|
30772
30770
|
"Headers",
|
|
30773
30771
|
`${name3}-Swift.h`
|
|
30774
30772
|
);
|
|
30775
|
-
if (!
|
|
30776
|
-
|
|
30777
|
-
|
|
30773
|
+
if (!import_node_fs46.default.existsSync(staged) || import_node_fs46.default.readFileSync(staged, "utf8") !== header) {
|
|
30774
|
+
import_node_fs46.default.writeFileSync(`${staged}.${process.pid}`, header);
|
|
30775
|
+
import_node_fs46.default.renameSync(`${staged}.${process.pid}`, staged);
|
|
30778
30776
|
}
|
|
30779
30777
|
}
|
|
30780
30778
|
return {
|
|
@@ -30782,22 +30780,22 @@ function binaryHeaderSearchPaths(binary, root, declaredFrameworks) {
|
|
|
30782
30780
|
headers: headers.map((_, index) => import_node_path47.default.join(search, "headers", String(index)))
|
|
30783
30781
|
};
|
|
30784
30782
|
}
|
|
30785
|
-
var files = (dir, test) =>
|
|
30783
|
+
var files = (dir, test) => import_node_fs46.default.existsSync(dir) ? import_node_fs46.default.readdirSync(dir, { recursive: true, encoding: "utf8" }).filter((file) => test(import_node_path47.default.basename(file))).sort() : [];
|
|
30786
30784
|
var OBJC = /^\s*(?:@interface|@protocol|@class|@import|#import)\b/m;
|
|
30787
30785
|
function headerSurface(module2, modulemap, headers) {
|
|
30788
30786
|
const objc = files(headers, (name3) => name3.endsWith(".h")).some(
|
|
30789
|
-
(file) => OBJC.test(
|
|
30787
|
+
(file) => OBJC.test(import_node_fs46.default.readFileSync(import_node_path47.default.join(headers, file), "utf8"))
|
|
30790
30788
|
);
|
|
30791
30789
|
return objc ? { kind: "objc", module: module2, modulemap, headers } : { kind: "c", module: module2, modulemap, headers };
|
|
30792
30790
|
}
|
|
30793
30791
|
function simulatorSlice(xcframeworkDir) {
|
|
30794
|
-
const slice =
|
|
30792
|
+
const slice = import_node_fs46.default.readdirSync(xcframeworkDir).filter((name3) => /^ios-.+-simulator$/.test(name3)).sort()[0];
|
|
30795
30793
|
return slice ? import_node_path47.default.join(xcframeworkDir, slice) : null;
|
|
30796
30794
|
}
|
|
30797
30795
|
function surfaces(xcframeworkDir, target, slice = simulatorSlice(xcframeworkDir)) {
|
|
30798
30796
|
const standaloneMap = import_node_path47.default.join(xcframeworkDir, "module.modulemap");
|
|
30799
|
-
if (
|
|
30800
|
-
const module2 = moduleMapName(
|
|
30797
|
+
if (import_node_fs46.default.existsSync(standaloneMap)) {
|
|
30798
|
+
const module2 = moduleMapName(import_node_fs46.default.readFileSync(standaloneMap, "utf8"));
|
|
30801
30799
|
if (!module2) throw new Error("its module map declares no module");
|
|
30802
30800
|
return [headerSurface(module2, standaloneMap, xcframeworkDir)];
|
|
30803
30801
|
}
|
|
@@ -30805,7 +30803,7 @@ function surfaces(xcframeworkDir, target, slice = simulatorSlice(xcframeworkDir)
|
|
|
30805
30803
|
if (!slice && !plain) throw new Error("it has no iOS simulator slice");
|
|
30806
30804
|
const root = plain ? import_node_path47.default.dirname(xcframeworkDir) : slice;
|
|
30807
30805
|
const found = [];
|
|
30808
|
-
for (const entry of plain ? [import_node_path47.default.basename(xcframeworkDir)] :
|
|
30806
|
+
for (const entry of plain ? [import_node_path47.default.basename(xcframeworkDir)] : import_node_fs46.default.readdirSync(root).sort()) {
|
|
30809
30807
|
if (!entry.endsWith(".framework")) continue;
|
|
30810
30808
|
const module2 = entry.slice(0, -".framework".length);
|
|
30811
30809
|
const framework = import_node_path47.default.join(root, entry);
|
|
@@ -30817,8 +30815,8 @@ function surfaces(xcframeworkDir, target, slice = simulatorSlice(xcframeworkDir)
|
|
|
30817
30815
|
const chosen = interfaces.find((name3) => name3.startsWith("arm64-")) ?? interfaces[0] ?? null;
|
|
30818
30816
|
let modulemap = import_node_path47.default.join(framework, "Modules", "module.modulemap");
|
|
30819
30817
|
const headers2 = import_node_path47.default.join(framework, "Headers");
|
|
30820
|
-
if (!
|
|
30821
|
-
const umbrella =
|
|
30818
|
+
if (!import_node_fs46.default.existsSync(modulemap) && files(headers2, (name3) => name3.endsWith(".h")).length) {
|
|
30819
|
+
const umbrella = import_node_fs46.default.existsSync(import_node_path47.default.join(headers2, `${module2}.h`)) ? `umbrella header "${module2}.h"` : 'umbrella "Headers"';
|
|
30822
30820
|
modulemap = generatedModuleMap(
|
|
30823
30821
|
`framework module ${module2} { ${umbrella} export * module * { export * } }
|
|
30824
30822
|
`,
|
|
@@ -30830,12 +30828,12 @@ function surfaces(xcframeworkDir, target, slice = simulatorSlice(xcframeworkDir)
|
|
|
30830
30828
|
swiftmodule,
|
|
30831
30829
|
chosen.replace(/\.swiftinterface$/, ".private.swiftinterface")
|
|
30832
30830
|
);
|
|
30833
|
-
const file =
|
|
30831
|
+
const file = import_node_fs46.default.existsSync(privateInterface) ? privateInterface : import_node_path47.default.join(swiftmodule, chosen);
|
|
30834
30832
|
const underlying = [
|
|
30835
|
-
...
|
|
30833
|
+
...import_node_fs46.default.readFileSync(file, "utf8").matchAll(/^(?:@_exported[ \t]+)?import[ \t]+(\w+)[ \t]*$/gm)
|
|
30836
30834
|
].some((match) => match[1] === module2);
|
|
30837
30835
|
if (underlying) {
|
|
30838
|
-
if (!
|
|
30836
|
+
if (!import_node_fs46.default.existsSync(modulemap))
|
|
30839
30837
|
throw new Error(`${module2} imports its underlying module without a modulemap`);
|
|
30840
30838
|
found.push({
|
|
30841
30839
|
kind: "mixed",
|
|
@@ -30847,13 +30845,13 @@ function surfaces(xcframeworkDir, target, slice = simulatorSlice(xcframeworkDir)
|
|
|
30847
30845
|
} else found.push({ kind: "swift", module: module2, interface: file });
|
|
30848
30846
|
continue;
|
|
30849
30847
|
}
|
|
30850
|
-
if (
|
|
30848
|
+
if (import_node_fs46.default.existsSync(modulemap))
|
|
30851
30849
|
found.push(headerSurface(module2, modulemap, import_node_path47.default.join(framework, "Headers")));
|
|
30852
30850
|
}
|
|
30853
30851
|
const headers = import_node_path47.default.join(root, "Headers");
|
|
30854
30852
|
for (const map of files(headers, (name3) => name3 === "module.modulemap")) {
|
|
30855
30853
|
const modulemap = import_node_path47.default.join(headers, map);
|
|
30856
|
-
const module2 = moduleMapName(
|
|
30854
|
+
const module2 = moduleMapName(import_node_fs46.default.readFileSync(modulemap, "utf8"));
|
|
30857
30855
|
if (module2) found.push(headerSurface(module2, modulemap, import_node_path47.default.dirname(modulemap)));
|
|
30858
30856
|
}
|
|
30859
30857
|
if (found.length === 0 && files(headers, (name3) => name3.endsWith(".h")).length) {
|
|
@@ -30874,12 +30872,12 @@ function generatedModuleMap(text5, framework) {
|
|
|
30874
30872
|
key(text5),
|
|
30875
30873
|
framework ? "Modules" : "Headers"
|
|
30876
30874
|
);
|
|
30877
|
-
|
|
30875
|
+
import_node_fs46.default.mkdirSync(dir, { recursive: true });
|
|
30878
30876
|
const file = import_node_path47.default.join(dir, "module.modulemap");
|
|
30879
|
-
if (!
|
|
30877
|
+
if (!import_node_fs46.default.existsSync(file)) {
|
|
30880
30878
|
const pending = `${file}.${process.pid}.tmp`;
|
|
30881
|
-
|
|
30882
|
-
|
|
30879
|
+
import_node_fs46.default.writeFileSync(pending, text5);
|
|
30880
|
+
import_node_fs46.default.renameSync(pending, file);
|
|
30883
30881
|
}
|
|
30884
30882
|
return file;
|
|
30885
30883
|
}
|
|
@@ -30897,7 +30895,7 @@ function peachModuleDirs(toolchain, imports2, sdkIncludes) {
|
|
|
30897
30895
|
toolchainBin,
|
|
30898
30896
|
plugins.libraries[0]
|
|
30899
30897
|
]);
|
|
30900
|
-
|
|
30898
|
+
import_node_fs46.default.writeFileSync(
|
|
30901
30899
|
import_node_path47.default.join(import_node_path47.default.dirname(plugins.libraries[0]), "compiler-release"),
|
|
30902
30900
|
`${toolchain.release}
|
|
30903
30901
|
`
|
|
@@ -30939,13 +30937,13 @@ function peachModuleDirs(toolchain, imports2, sdkIncludes) {
|
|
|
30939
30937
|
);
|
|
30940
30938
|
const release = import_node_path47.default.join(moduleRoot, ".build", TRIPLE, "release");
|
|
30941
30939
|
const declarations = swiftManifestDeclarations(
|
|
30942
|
-
|
|
30940
|
+
import_node_fs46.default.readFileSync(import_node_path47.default.join(moduleRoot, "Package.swift"), "utf8")
|
|
30943
30941
|
);
|
|
30944
30942
|
const supplied = new Set(
|
|
30945
30943
|
declarations.filter(
|
|
30946
30944
|
(target) => sdkIncludes.some(
|
|
30947
|
-
(dir) =>
|
|
30948
|
-
) ||
|
|
30945
|
+
(dir) => import_node_fs46.default.existsSync(import_node_path47.default.join(dir, target.name, "module.modulemap"))
|
|
30946
|
+
) || import_node_fs46.default.existsSync(
|
|
30949
30947
|
import_node_path47.default.join(
|
|
30950
30948
|
moduleRoot,
|
|
30951
30949
|
target.path,
|
|
@@ -30959,7 +30957,7 @@ function peachModuleDirs(toolchain, imports2, sdkIncludes) {
|
|
|
30959
30957
|
import_node_path47.default.join(release, "Modules"),
|
|
30960
30958
|
...declarations.filter(
|
|
30961
30959
|
(target) => !sdkIncludes.some(
|
|
30962
|
-
(dir) =>
|
|
30960
|
+
(dir) => import_node_fs46.default.existsSync(import_node_path47.default.join(dir, target.name, "module.modulemap"))
|
|
30963
30961
|
)
|
|
30964
30962
|
).map(
|
|
30965
30963
|
(target) => import_node_path47.default.join(
|
|
@@ -30967,9 +30965,9 @@ function peachModuleDirs(toolchain, imports2, sdkIncludes) {
|
|
|
30967
30965
|
target.path,
|
|
30968
30966
|
target.kind === "systemLibrary" ? "" : "include"
|
|
30969
30967
|
)
|
|
30970
|
-
).filter((dir) =>
|
|
30971
|
-
...
|
|
30972
|
-
(name3) => name3.endsWith(".build") && !supplied.has(name3.slice(0, -".build".length)) &&
|
|
30968
|
+
).filter((dir) => import_node_fs46.default.existsSync(import_node_path47.default.join(dir, "module.modulemap"))),
|
|
30969
|
+
...import_node_fs46.default.readdirSync(release).filter(
|
|
30970
|
+
(name3) => name3.endsWith(".build") && !supplied.has(name3.slice(0, -".build".length)) && import_node_fs46.default.existsSync(import_node_path47.default.join(release, name3, "module.modulemap"))
|
|
30973
30971
|
).sort().map((name3) => import_node_path47.default.join(release, name3))
|
|
30974
30972
|
];
|
|
30975
30973
|
}
|
|
@@ -31001,17 +30999,17 @@ function swiftInterfaceForWasm(text5, cFlags) {
|
|
|
31001
30999
|
}
|
|
31002
31000
|
function swiftStandin(surface, binary, toolchain, work, behavior, siblings) {
|
|
31003
31001
|
const text5 = swiftInterfaceForWasm(
|
|
31004
|
-
|
|
31002
|
+
import_node_fs46.default.readFileSync(surface.interface, "utf8"),
|
|
31005
31003
|
swiftSdkPaths(toolchain.moduleRoot, toolchain.toolchainBin).cFlags
|
|
31006
31004
|
);
|
|
31007
31005
|
const search = import_node_path47.default.join(work, "interfaces");
|
|
31008
31006
|
const moduleDir = import_node_path47.default.join(search, `${surface.module}.swiftmodule`);
|
|
31009
|
-
|
|
31010
|
-
|
|
31007
|
+
import_node_fs46.default.mkdirSync(moduleDir, { recursive: true });
|
|
31008
|
+
import_node_fs46.default.writeFileSync(import_node_path47.default.join(moduleDir, `${TRIPLE}.swiftinterface`), text5);
|
|
31011
31009
|
const imports2 = swiftImportNames(text5);
|
|
31012
31010
|
const wasm = wasmFlags(toolchain, imports2);
|
|
31013
31011
|
const out = import_node_path47.default.join(work, "graphs");
|
|
31014
|
-
|
|
31012
|
+
import_node_fs46.default.mkdirSync(out, { recursive: true });
|
|
31015
31013
|
const symbolgraphWasm = ["-enable-objc-interop"];
|
|
31016
31014
|
for (let index = 0; index < wasm.length; index++) {
|
|
31017
31015
|
if (wasm[index] === "-Xfrontend" && wasm[index + 1] === "-enable-objc-interop") {
|
|
@@ -31043,7 +31041,7 @@ function swiftStandin(surface, binary, toolchain, work, behavior, siblings) {
|
|
|
31043
31041
|
out
|
|
31044
31042
|
])
|
|
31045
31043
|
);
|
|
31046
|
-
const graphs =
|
|
31044
|
+
const graphs = import_node_fs46.default.readdirSync(out).filter((name3) => name3.endsWith(".symbols.json")).sort().map((name3) => JSON.parse(import_node_fs46.default.readFileSync(import_node_path47.default.join(out, name3), "utf8")));
|
|
31047
31045
|
const supplemented = synthesizedInterfaceEnums(text5, surface.module, graphs);
|
|
31048
31046
|
restoreSwiftInterfaceSPI(text5, surface.module, graphs);
|
|
31049
31047
|
return graphStandin(
|
|
@@ -31067,7 +31065,7 @@ function swiftStandin(surface, binary, toolchain, work, behavior, siblings) {
|
|
|
31067
31065
|
);
|
|
31068
31066
|
}
|
|
31069
31067
|
function placeholderStandin(surface, binary, toolchain, work, behavior, siblings) {
|
|
31070
|
-
const texts = surface.sources.map((file) =>
|
|
31068
|
+
const texts = surface.sources.map((file) => import_node_fs46.default.readFileSync(file, "utf8"));
|
|
31071
31069
|
const imports2 = [...new Set(texts.flatMap((text5) => swiftImportNames(text5)))];
|
|
31072
31070
|
const wasm = [
|
|
31073
31071
|
...wasmFlags(toolchain, [...FOUNDATION_IMPLICIT_MODULES, ...imports2]),
|
|
@@ -31079,8 +31077,8 @@ function placeholderStandin(surface, binary, toolchain, work, behavior, siblings
|
|
|
31079
31077
|
])
|
|
31080
31078
|
];
|
|
31081
31079
|
const out = import_node_path47.default.join(work, "graphs");
|
|
31082
|
-
|
|
31083
|
-
|
|
31080
|
+
import_node_fs46.default.mkdirSync(import_node_path47.default.join(work, "interface"), { recursive: true });
|
|
31081
|
+
import_node_fs46.default.mkdirSync(out, { recursive: true });
|
|
31084
31082
|
const extracted = (0, import_node_child_process28.spawnSync)(
|
|
31085
31083
|
import_node_path47.default.join(toolchain.toolchainBin, "swiftc"),
|
|
31086
31084
|
[
|
|
@@ -31113,7 +31111,7 @@ function placeholderStandin(surface, binary, toolchain, work, behavior, siblings
|
|
|
31113
31111
|
],
|
|
31114
31112
|
{ encoding: "utf8", env: swiftEnvironment(), maxBuffer: 256 * 1024 * 1024 }
|
|
31115
31113
|
);
|
|
31116
|
-
const graphs =
|
|
31114
|
+
const graphs = import_node_fs46.default.readdirSync(out).filter((name3) => name3.endsWith(".symbols.json")).sort().map((name3) => JSON.parse(import_node_fs46.default.readFileSync(import_node_path47.default.join(out, name3), "utf8")));
|
|
31117
31115
|
if (!graphs.some((graph) => graph.module.name === surface.module))
|
|
31118
31116
|
throw new Error(
|
|
31119
31117
|
`its public interface did not extract: ${extracted.error?.message ?? extracted.stderr.trim().slice(-2e3)}`
|
|
@@ -31224,7 +31222,7 @@ function mixedStandin(surface, binary, toolchain, work, behavior, frameworkDirs,
|
|
|
31224
31222
|
void 0,
|
|
31225
31223
|
frameworkDirs
|
|
31226
31224
|
);
|
|
31227
|
-
const interfaceText =
|
|
31225
|
+
const interfaceText = import_node_fs46.default.readFileSync(surface.interface, "utf8");
|
|
31228
31226
|
restoreSwiftInterfaceSPI(interfaceText, surface.module, view.graphs);
|
|
31229
31227
|
const values = new Map([
|
|
31230
31228
|
...view.values,
|
|
@@ -31341,7 +31339,7 @@ function objcStandin(surface, binary, toolchain, work, behavior, frameworks, sib
|
|
|
31341
31339
|
import_node_path47.default.join(work, "dependencies", module2),
|
|
31342
31340
|
void 0,
|
|
31343
31341
|
frameworks.dirs.filter(
|
|
31344
|
-
(dir) => !
|
|
31342
|
+
(dir) => !import_node_fs46.default.existsSync(import_node_path47.default.join(dir, `${module2}.framework`))
|
|
31345
31343
|
)
|
|
31346
31344
|
).graphs;
|
|
31347
31345
|
});
|
|
@@ -31441,7 +31439,7 @@ function graphStandin(module2, graphs, values, wasm, binary, toolchain, work, be
|
|
|
31441
31439
|
`Configured Swift behavior ${module2}.${entry.path} was not emitted: ${entry.reason}`
|
|
31442
31440
|
);
|
|
31443
31441
|
}
|
|
31444
|
-
|
|
31442
|
+
import_node_fs46.default.writeFileSync(file, source);
|
|
31445
31443
|
const check2 = (0, import_node_child_process28.spawnSync)(
|
|
31446
31444
|
import_node_path47.default.join(toolchain.toolchainBin, "swiftc"),
|
|
31447
31445
|
// emitting the module runs the diagnostics a typecheck skips, such as
|
|
@@ -31623,13 +31621,13 @@ function cStandin(surface, binary, toolchain, work) {
|
|
|
31623
31621
|
const texts = new Map(
|
|
31624
31622
|
headers.map((file) => [
|
|
31625
31623
|
import_node_path47.default.posix.join(headerDirectory, file),
|
|
31626
|
-
|
|
31624
|
+
import_node_fs46.default.readFileSync(import_node_path47.default.join(surface.headers, file), "utf8")
|
|
31627
31625
|
])
|
|
31628
31626
|
);
|
|
31629
31627
|
const include = import_node_path47.default.join(work, "include");
|
|
31630
31628
|
for (const [file, text5] of texts) {
|
|
31631
|
-
|
|
31632
|
-
|
|
31629
|
+
import_node_fs46.default.mkdirSync(import_node_path47.default.dirname(import_node_path47.default.join(include, file)), { recursive: true });
|
|
31630
|
+
import_node_fs46.default.writeFileSync(import_node_path47.default.join(include, file), text5);
|
|
31633
31631
|
}
|
|
31634
31632
|
const roots = moduleMapHeaders(surface.modulemap, headers).map(
|
|
31635
31633
|
(file) => import_node_path47.default.posix.join(headerDirectory, file)
|
|
@@ -31641,7 +31639,7 @@ ${roots.map((file) => ` header "${file}"
|
|
|
31641
31639
|
}
|
|
31642
31640
|
`;
|
|
31643
31641
|
const probe = import_node_path47.default.join(work, "declarations.c");
|
|
31644
|
-
|
|
31642
|
+
import_node_fs46.default.writeFileSync(probe, roots.map((file) => `#include "${file}"
|
|
31645
31643
|
`).join(""));
|
|
31646
31644
|
const { sysroot } = swiftSdkPaths(toolchain.moduleRoot, toolchain.toolchainBin);
|
|
31647
31645
|
const ast = JSON.parse(
|
|
@@ -31720,7 +31718,7 @@ ${roots.map((file) => ` header "${file}"
|
|
|
31720
31718
|
]);
|
|
31721
31719
|
const updated = buffer.toString("utf8");
|
|
31722
31720
|
texts.set(file, updated);
|
|
31723
|
-
|
|
31721
|
+
import_node_fs46.default.writeFileSync(import_node_path47.default.join(include, file), updated);
|
|
31724
31722
|
}
|
|
31725
31723
|
const sdk = JSON.stringify(`${binary.target} (${binary.source})`);
|
|
31726
31724
|
const source = [
|
|
@@ -31738,7 +31736,7 @@ ${roots.map((file) => ` header "${file}"
|
|
|
31738
31736
|
...definitions
|
|
31739
31737
|
].join("\n");
|
|
31740
31738
|
const out = import_node_path47.default.join(work, `${surface.module}.c`);
|
|
31741
|
-
|
|
31739
|
+
import_node_fs46.default.writeFileSync(out, source);
|
|
31742
31740
|
try {
|
|
31743
31741
|
exec(import_node_path47.default.join(toolchain.toolchainBin, "clang"), [
|
|
31744
31742
|
"-target",
|
|
@@ -31762,7 +31760,7 @@ ${roots.map((file) => ` header "${file}"
|
|
|
31762
31760
|
...Object.fromEntries(
|
|
31763
31761
|
[...texts].map(([file, text5]) => [`include/${file}`, text5])
|
|
31764
31762
|
),
|
|
31765
|
-
...framework ? { [`include/${frameworkMap}`]:
|
|
31763
|
+
...framework ? { [`include/${frameworkMap}`]: import_node_fs46.default.readFileSync(surface.modulemap, "utf8") } : { "include/module.modulemap": modulemap },
|
|
31766
31764
|
[`${surface.module}.c`]: source
|
|
31767
31765
|
}
|
|
31768
31766
|
};
|
|
@@ -31770,13 +31768,13 @@ ${roots.map((file) => ` header "${file}"
|
|
|
31770
31768
|
async function cxxStandin(surface, binary, toolchain, work) {
|
|
31771
31769
|
if (!binary.cxxHeaders) throw new Error("C++ header inputs are missing");
|
|
31772
31770
|
const headers = surface.headers;
|
|
31773
|
-
const names =
|
|
31771
|
+
const names = import_node_fs46.default.readdirSync(headers, { recursive: true, encoding: "utf8" }).filter((file) => import_node_fs46.default.statSync(import_node_path47.default.join(headers, file)).isFile()).sort();
|
|
31774
31772
|
const moduleRoots = moduleMapHeaders(surface.modulemap, names);
|
|
31775
31773
|
const roots = [.../* @__PURE__ */ new Set([...binary.cxxHeaders.roots, ...moduleRoots])].sort();
|
|
31776
31774
|
const { sysroot } = swiftSdkPaths(toolchain.moduleRoot, toolchain.toolchainBin);
|
|
31777
|
-
|
|
31775
|
+
import_node_fs46.default.mkdirSync(work, { recursive: true });
|
|
31778
31776
|
const languageProbe = import_node_path47.default.join(work, "language-probe.c");
|
|
31779
|
-
|
|
31777
|
+
import_node_fs46.default.writeFileSync(
|
|
31780
31778
|
languageProbe,
|
|
31781
31779
|
roots.map((root) => `#include ${JSON.stringify(root)}
|
|
31782
31780
|
`).join("")
|
|
@@ -31809,14 +31807,14 @@ async function cxxStandin(surface, binary, toolchain, work) {
|
|
|
31809
31807
|
if (headers !== import_node_path47.default.join(slice, "Headers") || import_node_path47.default.dirname(surface.modulemap) !== headers)
|
|
31810
31808
|
throw new Error("C++ stand-ins require a module map at the library header root");
|
|
31811
31809
|
const texts = names.map((file) => {
|
|
31812
|
-
const bytes =
|
|
31810
|
+
const bytes = import_node_fs46.default.readFileSync(import_node_path47.default.join(headers, file));
|
|
31813
31811
|
const text5 = bytes.toString("utf8");
|
|
31814
31812
|
if (!Buffer.from(text5, "utf8").equals(bytes) || text5.includes("\0"))
|
|
31815
31813
|
throw new Error(`C++ public header ${file} is not text`);
|
|
31816
31814
|
return [file, text5];
|
|
31817
31815
|
});
|
|
31818
31816
|
for (const file of /* @__PURE__ */ new Set([...binary.cxxHeaders.reached, ...moduleRoots])) {
|
|
31819
|
-
const text5 =
|
|
31817
|
+
const text5 = import_node_fs46.default.readFileSync(import_node_path47.default.join(headers, file), "utf8");
|
|
31820
31818
|
if (/\b__OBJC__\b/.test(text5))
|
|
31821
31819
|
throw new Error(`C++ public header ${file} changes under Objective-C++`);
|
|
31822
31820
|
}
|
|
@@ -31853,8 +31851,8 @@ var UNSEARCHED = /* @__PURE__ */ new Set([
|
|
|
31853
31851
|
function crateFor(root, name3) {
|
|
31854
31852
|
const walk3 = (dir, depth) => {
|
|
31855
31853
|
const manifest = import_node_path47.default.join(dir, "Cargo.toml");
|
|
31856
|
-
if (
|
|
31857
|
-
const text5 =
|
|
31854
|
+
if (import_node_fs46.default.existsSync(manifest)) {
|
|
31855
|
+
const text5 = import_node_fs46.default.readFileSync(manifest, "utf8");
|
|
31858
31856
|
const section = (title) => new RegExp(`^\\[${title}\\]\\s*$([\\s\\S]*?)(?=^\\[|(?![\\s\\S]))`, "m").exec(
|
|
31859
31857
|
text5
|
|
31860
31858
|
)?.[1] ?? "";
|
|
@@ -31870,7 +31868,7 @@ function crateFor(root, name3) {
|
|
|
31870
31868
|
}
|
|
31871
31869
|
}
|
|
31872
31870
|
if (depth === 0) return null;
|
|
31873
|
-
for (const entry of
|
|
31871
|
+
for (const entry of import_node_fs46.default.readdirSync(dir, { withFileTypes: true })) {
|
|
31874
31872
|
if (!entry.isDirectory() || UNSEARCHED.has(entry.name) || entry.name.endsWith(".xcframework"))
|
|
31875
31873
|
continue;
|
|
31876
31874
|
const found = walk3(import_node_path47.default.join(dir, entry.name), depth - 1);
|
|
@@ -31883,7 +31881,7 @@ function crateFor(root, name3) {
|
|
|
31883
31881
|
var RUST_TOOLCHAIN = "1.94.0";
|
|
31884
31882
|
function crateSourceRoots(manifest) {
|
|
31885
31883
|
let workspace = import_node_path47.default.dirname(manifest);
|
|
31886
|
-
while (!
|
|
31884
|
+
while (!import_node_fs46.default.existsSync(import_node_path47.default.join(workspace, "Cargo.lock"))) {
|
|
31887
31885
|
const parent = import_node_path47.default.dirname(workspace);
|
|
31888
31886
|
if (parent === workspace)
|
|
31889
31887
|
throw new Error(`${manifest} has no Cargo.lock; the build runs --locked`);
|
|
@@ -31891,12 +31889,12 @@ function crateSourceRoots(manifest) {
|
|
|
31891
31889
|
}
|
|
31892
31890
|
const roots = [workspace];
|
|
31893
31891
|
const inside = (dir) => roots.some((root) => !import_node_path47.default.relative(root, dir).startsWith(".."));
|
|
31894
|
-
const manifests = (dir) =>
|
|
31892
|
+
const manifests = (dir) => import_node_fs46.default.readdirSync(dir, { withFileTypes: true }).flatMap(
|
|
31895
31893
|
(entry) => entry.isDirectory() && !UNSEARCHED.has(entry.name) ? manifests(import_node_path47.default.join(dir, entry.name)) : entry.name === "Cargo.toml" ? [import_node_path47.default.join(dir, entry.name)] : []
|
|
31896
31894
|
);
|
|
31897
31895
|
for (let scanned = 0; scanned < roots.length; scanned++)
|
|
31898
31896
|
for (const file of manifests(roots[scanned])) {
|
|
31899
|
-
const text5 =
|
|
31897
|
+
const text5 = import_node_fs46.default.readFileSync(file, "utf8");
|
|
31900
31898
|
for (const match of text5.matchAll(/\bpath\s*=\s*"([^"]+)"/g)) {
|
|
31901
31899
|
const dir = import_node_path47.default.resolve(import_node_path47.default.dirname(file), match[1]);
|
|
31902
31900
|
if (!inside(dir)) roots.push(dir);
|
|
@@ -31907,13 +31905,13 @@ function crateSourceRoots(manifest) {
|
|
|
31907
31905
|
function crateSourceDigest(manifest) {
|
|
31908
31906
|
const hash = (0, import_node_crypto24.createHash)("sha256");
|
|
31909
31907
|
const walk3 = (dir, root) => {
|
|
31910
|
-
for (const entry of
|
|
31908
|
+
for (const entry of import_node_fs46.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name < right.name ? -1 : 1)) {
|
|
31911
31909
|
const full = import_node_path47.default.join(dir, entry.name);
|
|
31912
31910
|
if (entry.isDirectory()) {
|
|
31913
31911
|
if (!UNSEARCHED.has(entry.name)) walk3(full, root);
|
|
31914
31912
|
} else if (entry.isFile()) {
|
|
31915
31913
|
hash.update(`${import_node_path47.default.relative(root, full)}\0`);
|
|
31916
|
-
hash.update(
|
|
31914
|
+
hash.update(import_node_fs46.default.readFileSync(full));
|
|
31917
31915
|
hash.update("\0");
|
|
31918
31916
|
}
|
|
31919
31917
|
}
|
|
@@ -31941,8 +31939,8 @@ function standinLibrary(binary, searchRoot, toolchain) {
|
|
|
31941
31939
|
const native = simulatorNativeLibrary(dir);
|
|
31942
31940
|
const library = native?.kind === "archive" ? native.name : null;
|
|
31943
31941
|
const supplied = import_node_path47.default.join(dir, RUST_TARGET);
|
|
31944
|
-
if (
|
|
31945
|
-
const found =
|
|
31942
|
+
if (import_node_fs46.default.existsSync(supplied)) {
|
|
31943
|
+
const found = import_node_fs46.default.readdirSync(supplied).filter((name3) => name3.endsWith(".a"));
|
|
31946
31944
|
const chosen = library && found.includes(library) ? library : found.length === 1 ? found[0] : null;
|
|
31947
31945
|
if (!chosen)
|
|
31948
31946
|
throw new Error(
|
|
@@ -31950,15 +31948,15 @@ function standinLibrary(binary, searchRoot, toolchain) {
|
|
|
31950
31948
|
);
|
|
31951
31949
|
return import_node_path47.default.join(supplied, chosen);
|
|
31952
31950
|
}
|
|
31953
|
-
if (native && toolchain &&
|
|
31954
|
-
const recipe = nativeStaticLibraryRecipe(
|
|
31951
|
+
if (native && toolchain && import_node_fs46.default.existsSync(native.file)) {
|
|
31952
|
+
const recipe = nativeStaticLibraryRecipe(import_node_fs46.default.readFileSync(native.file));
|
|
31955
31953
|
if (recipe) return nativeStaticLibrary(native.file, recipe, toolchain.moduleRoot);
|
|
31956
31954
|
}
|
|
31957
31955
|
if (!library) return null;
|
|
31958
31956
|
for (const [name3, recipe] of Object.entries(NATIVE_SLICE_RECIPES)) {
|
|
31959
31957
|
if (name3 !== import_node_path47.default.basename(dir, ".xcframework") || !toolchain) continue;
|
|
31960
31958
|
const pin2 = import_node_path47.default.join(import_node_path47.default.dirname(dir), recipe.pinFile);
|
|
31961
|
-
if (
|
|
31959
|
+
if (import_node_fs46.default.existsSync(pin2) && import_node_fs46.default.readFileSync(pin2, "utf8").trim() === recipe.upstream) {
|
|
31962
31960
|
const entry2 = nativeSliceEntry(
|
|
31963
31961
|
recipe,
|
|
31964
31962
|
toolchain.release,
|
|
@@ -32049,7 +32047,7 @@ function buildRustCrate(manifest, library, searchRoot) {
|
|
|
32049
32047
|
}
|
|
32050
32048
|
async function sourceStandins(binaries, toolchain, provided, behavior) {
|
|
32051
32049
|
const repo = import_node_path47.default.resolve(toolchain.moduleRoot, "../..");
|
|
32052
|
-
|
|
32050
|
+
import_node_fs46.default.mkdirSync(cacheDir4, { recursive: true });
|
|
32053
32051
|
const generation = standinGenerationInputs(binaries, toolchain, behavior);
|
|
32054
32052
|
const cached = import_node_path47.default.join(
|
|
32055
32053
|
cacheDir4,
|
|
@@ -32057,16 +32055,16 @@ async function sourceStandins(binaries, toolchain, provided, behavior) {
|
|
|
32057
32055
|
`${key(generation, JSON.stringify([...provided].sort()))}.json`
|
|
32058
32056
|
);
|
|
32059
32057
|
const targets = new Set(binaries.map((binary) => binary.target));
|
|
32060
|
-
if (
|
|
32058
|
+
if (import_node_fs46.default.existsSync(cached))
|
|
32061
32059
|
return readStandinResults(
|
|
32062
|
-
JSON.parse(
|
|
32060
|
+
JSON.parse(import_node_fs46.default.readFileSync(cached, "utf8")),
|
|
32063
32061
|
generation,
|
|
32064
32062
|
targets
|
|
32065
32063
|
);
|
|
32066
|
-
const work =
|
|
32064
|
+
const work = import_node_fs46.default.mkdtempSync(import_node_path47.default.join(cacheDir4, "request-"));
|
|
32067
32065
|
try {
|
|
32068
32066
|
const artifact = import_node_path47.default.join(work, "artifacts");
|
|
32069
|
-
|
|
32067
|
+
import_node_fs46.default.mkdirSync(artifact);
|
|
32070
32068
|
const local = [];
|
|
32071
32069
|
const gaps = /* @__PURE__ */ new Map();
|
|
32072
32070
|
const headers = /* @__PURE__ */ new Map();
|
|
@@ -32075,17 +32073,17 @@ async function sourceStandins(binaries, toolchain, provided, behavior) {
|
|
|
32075
32073
|
if (binary.placeholder !== void 0) {
|
|
32076
32074
|
const dir = import_node_path47.default.join(artifact, "placeholders", String(index));
|
|
32077
32075
|
for (const source of binary.placeholder.sources) {
|
|
32078
|
-
|
|
32079
|
-
|
|
32076
|
+
import_node_fs46.default.mkdirSync(import_node_path47.default.dirname(import_node_path47.default.join(dir, source)), { recursive: true });
|
|
32077
|
+
import_node_fs46.default.copyFileSync(import_node_path47.default.join(binary.dir, source), import_node_path47.default.join(dir, source));
|
|
32080
32078
|
}
|
|
32081
32079
|
local.push({ ...binary, dir, url: null, checksum: null });
|
|
32082
32080
|
} else if (binary.publicHeaders !== void 0) {
|
|
32083
32081
|
const copyHeader = (relative2) => {
|
|
32084
|
-
const source =
|
|
32082
|
+
const source = import_node_fs46.default.realpathSync(import_node_path47.default.join(binary.dir, relative2));
|
|
32085
32083
|
let destination = headers.get(source);
|
|
32086
32084
|
if (destination === void 0) {
|
|
32087
32085
|
destination = `headers/${headers.size}`;
|
|
32088
|
-
|
|
32086
|
+
import_node_fs46.default.cpSync(source, import_node_path47.default.join(artifact, destination), {
|
|
32089
32087
|
recursive: true,
|
|
32090
32088
|
dereference: true
|
|
32091
32089
|
});
|
|
@@ -32112,7 +32110,7 @@ async function sourceStandins(binaries, toolchain, provided, behavior) {
|
|
|
32112
32110
|
}
|
|
32113
32111
|
const resolved = xcframework(binary);
|
|
32114
32112
|
const dir = import_node_path47.default.join(artifact, String(index), import_node_path47.default.basename(resolved.dir));
|
|
32115
|
-
|
|
32113
|
+
import_node_fs46.default.cpSync(resolved.dir, dir, { recursive: true, dereference: true });
|
|
32116
32114
|
local.push({ ...binary, dir, url: null, checksum: null });
|
|
32117
32115
|
}
|
|
32118
32116
|
} catch (error) {
|
|
@@ -32125,7 +32123,7 @@ async function sourceStandins(binaries, toolchain, provided, behavior) {
|
|
|
32125
32123
|
throw new Error("Swift stand-in inputs changed during preparation");
|
|
32126
32124
|
const request = import_node_path47.default.join(work, "request.json");
|
|
32127
32125
|
const delivery = import_node_path47.default.join(work, "delivery");
|
|
32128
|
-
|
|
32126
|
+
import_node_fs46.default.writeFileSync(
|
|
32129
32127
|
request,
|
|
32130
32128
|
JSON.stringify({
|
|
32131
32129
|
binaries: local.map((binary) => ({
|
|
@@ -32169,9 +32167,9 @@ async function sourceStandins(binaries, toolchain, provided, behavior) {
|
|
|
32169
32167
|
`source stand-in build for ${local.map((binary) => binary.target).join(", ")} failed (${build.error?.message ?? build.signal ?? `exit ${build.status}`}): ${build.stderr.trim().slice(-4e3) || build.stdout.trim().slice(-4e3) || "builder returned no diagnostic"}`
|
|
32170
32168
|
);
|
|
32171
32169
|
const output2 = import_node_path47.default.join(delivery, "standins.json");
|
|
32172
|
-
if (!
|
|
32170
|
+
if (!import_node_fs46.default.existsSync(output2))
|
|
32173
32171
|
throw new Error("source stand-in builder returned no standins.json");
|
|
32174
|
-
const receipt = JSON.parse(
|
|
32172
|
+
const receipt = JSON.parse(import_node_fs46.default.readFileSync(output2, "utf8"));
|
|
32175
32173
|
const result = readStandinResults(
|
|
32176
32174
|
receipt,
|
|
32177
32175
|
preparedGeneration,
|
|
@@ -32181,14 +32179,14 @@ async function sourceStandins(binaries, toolchain, provided, behavior) {
|
|
|
32181
32179
|
throw new Error("Swift stand-in inputs changed during generation");
|
|
32182
32180
|
for (const [target, reason] of gaps) result.gaps.set(target, reason);
|
|
32183
32181
|
if (result.gaps.size === 0 && isRecord(receipt)) {
|
|
32184
|
-
|
|
32182
|
+
import_node_fs46.default.mkdirSync(import_node_path47.default.dirname(cached), { recursive: true });
|
|
32185
32183
|
const pending = `${cached}.${process.pid}.tmp`;
|
|
32186
|
-
|
|
32187
|
-
|
|
32184
|
+
import_node_fs46.default.writeFileSync(pending, JSON.stringify({ ...receipt, generation }));
|
|
32185
|
+
import_node_fs46.default.renameSync(pending, cached);
|
|
32188
32186
|
}
|
|
32189
32187
|
return result;
|
|
32190
32188
|
} finally {
|
|
32191
|
-
|
|
32189
|
+
import_node_fs46.default.rmSync(work, { recursive: true, force: true });
|
|
32192
32190
|
}
|
|
32193
32191
|
}
|
|
32194
32192
|
function readStandinResults(receipt, generation, targets) {
|
|
@@ -32273,7 +32271,7 @@ function standinGenerationInputs(binaries, toolchain, behavior = {}, sourceDir)
|
|
|
32273
32271
|
...binary.placeholder.flags,
|
|
32274
32272
|
...binary.placeholder.sources.flatMap((source) => [
|
|
32275
32273
|
source,
|
|
32276
|
-
(0, import_node_crypto24.createHash)("sha256").update(
|
|
32274
|
+
(0, import_node_crypto24.createHash)("sha256").update(import_node_fs46.default.readFileSync(import_node_path47.default.join(binary.dir, source))).digest("hex")
|
|
32277
32275
|
])
|
|
32278
32276
|
);
|
|
32279
32277
|
continue;
|
|
@@ -32319,8 +32317,8 @@ async function binaryStandins(binary, toolchain, provided, behavior, frameworks,
|
|
|
32319
32317
|
if (provided.has(binary.target)) return [];
|
|
32320
32318
|
const absent = missingArtifactGap(binary);
|
|
32321
32319
|
if (absent !== null) return absent;
|
|
32322
|
-
|
|
32323
|
-
const work =
|
|
32320
|
+
import_node_fs46.default.mkdirSync(cacheDir4, { recursive: true });
|
|
32321
|
+
const work = import_node_fs46.default.mkdtempSync(import_node_path47.default.join(cacheDir4, "work-"));
|
|
32324
32322
|
let all;
|
|
32325
32323
|
let digest;
|
|
32326
32324
|
try {
|
|
@@ -32344,9 +32342,9 @@ async function binaryStandins(binary, toolchain, provided, behavior, frameworks,
|
|
|
32344
32342
|
const roots = files(headers, (name3) => name3.endsWith(".h"));
|
|
32345
32343
|
if (roots.length === 0)
|
|
32346
32344
|
throw new Error("its public header directory has no headers");
|
|
32347
|
-
|
|
32345
|
+
import_node_fs46.default.writeFileSync(
|
|
32348
32346
|
modulemap,
|
|
32349
|
-
|
|
32347
|
+
import_node_fs46.default.existsSync(supplied) ? import_node_fs46.default.readFileSync(supplied, "utf8") : `module ${module2} {
|
|
32350
32348
|
${roots.map((file) => ` header "${file}"`).join("\n")}
|
|
32351
32349
|
export *
|
|
32352
32350
|
}
|
|
@@ -32374,12 +32372,12 @@ ${roots.map((file) => ` header "${file}"`).join("\n")}
|
|
|
32374
32372
|
digest = artifact.digest;
|
|
32375
32373
|
}
|
|
32376
32374
|
} catch (error) {
|
|
32377
|
-
|
|
32375
|
+
import_node_fs46.default.rmSync(work, { recursive: true, force: true });
|
|
32378
32376
|
return error instanceof Error ? error.message : String(error);
|
|
32379
32377
|
}
|
|
32380
32378
|
const found = all.filter((surface) => !provided.has(surface.module));
|
|
32381
32379
|
if (found.length === 0) {
|
|
32382
|
-
|
|
32380
|
+
import_node_fs46.default.rmSync(work, { recursive: true, force: true });
|
|
32383
32381
|
if (all.length > 0) return [];
|
|
32384
32382
|
return "its iOS simulator slice has no Swift interface or C modulemap";
|
|
32385
32383
|
}
|
|
@@ -32400,7 +32398,7 @@ ${roots.map((file) => ` header "${file}"`).join("\n")}
|
|
|
32400
32398
|
(file2) => import_node_path47.default.join(surface.headers, file2)
|
|
32401
32399
|
)
|
|
32402
32400
|
])
|
|
32403
|
-
hash.update(
|
|
32401
|
+
hash.update(import_node_fs46.default.readFileSync(file));
|
|
32404
32402
|
}
|
|
32405
32403
|
const id = hash.digest("hex").slice(0, 32);
|
|
32406
32404
|
const settle = (value) => {
|
|
@@ -32412,21 +32410,21 @@ ${roots.map((file) => ` header "${file}"`).join("\n")}
|
|
|
32412
32410
|
};
|
|
32413
32411
|
const memo2 = built.get(id);
|
|
32414
32412
|
if (memo2) {
|
|
32415
|
-
|
|
32413
|
+
import_node_fs46.default.rmSync(work, { recursive: true, force: true });
|
|
32416
32414
|
return settle(memo2);
|
|
32417
32415
|
}
|
|
32418
32416
|
const cached = import_node_path47.default.join(cacheDir4, "standins", `${id}.json`);
|
|
32419
|
-
if (
|
|
32420
|
-
const value = JSON.parse(
|
|
32417
|
+
if (import_node_fs46.default.existsSync(cached)) {
|
|
32418
|
+
const value = JSON.parse(import_node_fs46.default.readFileSync(cached, "utf8"));
|
|
32421
32419
|
built.set(id, value);
|
|
32422
|
-
|
|
32420
|
+
import_node_fs46.default.rmSync(work, { recursive: true, force: true });
|
|
32423
32421
|
return settle(value);
|
|
32424
32422
|
}
|
|
32425
32423
|
const publish = (value) => {
|
|
32426
|
-
|
|
32424
|
+
import_node_fs46.default.mkdirSync(import_node_path47.default.dirname(cached), { recursive: true });
|
|
32427
32425
|
const pending = `${cached}.${process.pid}.tmp`;
|
|
32428
|
-
|
|
32429
|
-
|
|
32426
|
+
import_node_fs46.default.writeFileSync(pending, JSON.stringify(value));
|
|
32427
|
+
import_node_fs46.default.renameSync(pending, cached);
|
|
32430
32428
|
built.set(id, value);
|
|
32431
32429
|
};
|
|
32432
32430
|
let result;
|
|
@@ -32487,7 +32485,7 @@ ${roots.map((file) => ` header "${file}"`).join("\n")}
|
|
|
32487
32485
|
cause = cause.cause;
|
|
32488
32486
|
if (!(cause instanceof Error)) publish(result);
|
|
32489
32487
|
} finally {
|
|
32490
|
-
|
|
32488
|
+
import_node_fs46.default.rmSync(work, { recursive: true, force: true });
|
|
32491
32489
|
}
|
|
32492
32490
|
return settle(result);
|
|
32493
32491
|
}
|
|
@@ -32511,8 +32509,8 @@ async function buildStandins(binaries, toolchain, provided, behavior) {
|
|
|
32511
32509
|
return sourceStandins(requested, toolchain, provided, behavior);
|
|
32512
32510
|
const standins = [];
|
|
32513
32511
|
const gaps = /* @__PURE__ */ new Map();
|
|
32514
|
-
|
|
32515
|
-
const modules =
|
|
32512
|
+
import_node_fs46.default.mkdirSync(cacheDir4, { recursive: true });
|
|
32513
|
+
const modules = import_node_fs46.default.mkdtempSync(import_node_path47.default.join(cacheDir4, "modules-"));
|
|
32516
32514
|
const frameworkDirs = /* @__PURE__ */ new Set();
|
|
32517
32515
|
const frameworkSurfaces = /* @__PURE__ */ new Map();
|
|
32518
32516
|
const frameworkInputs = [];
|
|
@@ -32526,7 +32524,7 @@ async function buildStandins(binaries, toolchain, provided, behavior) {
|
|
|
32526
32524
|
binary,
|
|
32527
32525
|
new Set(
|
|
32528
32526
|
binary.placeholder.sources.flatMap(
|
|
32529
|
-
(source) => swiftImportNames(
|
|
32527
|
+
(source) => swiftImportNames(import_node_fs46.default.readFileSync(import_node_path47.default.join(binary.dir, source), "utf8"))
|
|
32530
32528
|
)
|
|
32531
32529
|
)
|
|
32532
32530
|
);
|
|
@@ -32542,13 +32540,13 @@ async function buildStandins(binaries, toolchain, provided, behavior) {
|
|
|
32542
32540
|
byModule.set(surface.module, binary);
|
|
32543
32541
|
if (surface.kind === "swift" || surface.kind === "mixed")
|
|
32544
32542
|
for (const module2 of swiftImportNames(
|
|
32545
|
-
|
|
32543
|
+
import_node_fs46.default.readFileSync(surface.interface, "utf8")
|
|
32546
32544
|
))
|
|
32547
32545
|
imports2.add(module2);
|
|
32548
32546
|
if (surface.kind === "objc" || surface.kind === "mixed")
|
|
32549
32547
|
for (const file of files(surface.headers, (name3) => name3.endsWith(".h")))
|
|
32550
32548
|
for (const module2 of clangImportNames(
|
|
32551
|
-
|
|
32549
|
+
import_node_fs46.default.readFileSync(import_node_path47.default.join(surface.headers, file), "utf8")
|
|
32552
32550
|
))
|
|
32553
32551
|
imports2.add(module2);
|
|
32554
32552
|
if (surface.kind === "c") continue;
|
|
@@ -32622,7 +32620,7 @@ async function buildStandins(binaries, toolchain, provided, behavior) {
|
|
|
32622
32620
|
const source = standin.files[`${standin.module}.swift`];
|
|
32623
32621
|
if (source !== void 0) {
|
|
32624
32622
|
const file = import_node_path47.default.join(modules, `${standin.module}.swift`);
|
|
32625
|
-
|
|
32623
|
+
import_node_fs46.default.writeFileSync(file, source);
|
|
32626
32624
|
try {
|
|
32627
32625
|
exec(import_node_path47.default.join(toolchain.toolchainBin, "swiftc"), [
|
|
32628
32626
|
"-emit-module",
|
|
@@ -32650,7 +32648,7 @@ async function buildStandins(binaries, toolchain, provided, behavior) {
|
|
|
32650
32648
|
for (const binary of binaries) await visit(binary);
|
|
32651
32649
|
return { standins, gaps };
|
|
32652
32650
|
} finally {
|
|
32653
|
-
|
|
32651
|
+
import_node_fs46.default.rmSync(modules, { recursive: true, force: true });
|
|
32654
32652
|
}
|
|
32655
32653
|
}
|
|
32656
32654
|
|
|
@@ -32664,7 +32662,7 @@ var SwiftObjCCompilationError = class extends Error {
|
|
|
32664
32662
|
var isDirectory2 = (file) => linkedStat(file)?.isDirectory() ?? false;
|
|
32665
32663
|
function linkedStat(file) {
|
|
32666
32664
|
try {
|
|
32667
|
-
return
|
|
32665
|
+
return import_node_fs47.default.statSync(file);
|
|
32668
32666
|
} catch (error) {
|
|
32669
32667
|
if (error instanceof Error && "code" in error && error.code === "ENOENT") return null;
|
|
32670
32668
|
throw error;
|
|
@@ -32713,20 +32711,20 @@ function xcodeStagedPath(file, root, checkouts, work, sysroot, label, externalFr
|
|
|
32713
32711
|
function writeXcodeSnapshot(sources, links, staged) {
|
|
32714
32712
|
for (const [file, bytes] of sources) {
|
|
32715
32713
|
const output2 = staged(file);
|
|
32716
|
-
|
|
32714
|
+
import_node_fs47.default.mkdirSync(import_node_path48.default.dirname(output2), { recursive: true });
|
|
32717
32715
|
const target = links[file];
|
|
32718
32716
|
if (target === void 0) {
|
|
32719
|
-
|
|
32717
|
+
import_node_fs47.default.writeFileSync(output2, bytes);
|
|
32720
32718
|
continue;
|
|
32721
32719
|
}
|
|
32722
32720
|
const real = staged(target);
|
|
32723
|
-
|
|
32724
|
-
|
|
32725
|
-
const alias =
|
|
32726
|
-
const canonical =
|
|
32721
|
+
import_node_fs47.default.mkdirSync(import_node_path48.default.dirname(real), { recursive: true });
|
|
32722
|
+
import_node_fs47.default.writeFileSync(real, bytes);
|
|
32723
|
+
const alias = import_node_fs47.default.statSync(output2, { throwIfNoEntry: false });
|
|
32724
|
+
const canonical = import_node_fs47.default.statSync(real);
|
|
32727
32725
|
if (alias?.dev === canonical.dev && alias.ino === canonical.ino) continue;
|
|
32728
|
-
|
|
32729
|
-
|
|
32726
|
+
import_node_fs47.default.rmSync(output2, { force: true });
|
|
32727
|
+
import_node_fs47.default.symlinkSync(import_node_path48.default.relative(import_node_path48.default.dirname(output2), real), output2);
|
|
32730
32728
|
}
|
|
32731
32729
|
}
|
|
32732
32730
|
var FRAMEWORK_IMPORT = /#\s*(?:import|include)\s*<([\w+-]+)\/([\w+.-]+\.h)>/g;
|
|
@@ -32739,8 +32737,8 @@ function frameworkImports(app) {
|
|
|
32739
32737
|
...target.objc.headers,
|
|
32740
32738
|
...target.allSources.filter(isSwiftNativeTranslationUnit)
|
|
32741
32739
|
]) {
|
|
32742
|
-
if (file.endsWith(".swift") || !
|
|
32743
|
-
for (const [, framework, header] of
|
|
32740
|
+
if (file.endsWith(".swift") || !import_node_fs47.default.existsSync(file)) continue;
|
|
32741
|
+
for (const [, framework, header] of import_node_fs47.default.readFileSync(file, "utf8").matchAll(FRAMEWORK_IMPORT)) {
|
|
32744
32742
|
const headers = imports2.get(framework) ?? /* @__PURE__ */ new Set();
|
|
32745
32743
|
headers.add(header);
|
|
32746
32744
|
imports2.set(framework, headers);
|
|
@@ -32758,9 +32756,9 @@ function compiledFrameworkImports(app, products) {
|
|
|
32758
32756
|
);
|
|
32759
32757
|
const seen = /* @__PURE__ */ new Set();
|
|
32760
32758
|
const visit = (file) => {
|
|
32761
|
-
if (seen.has(file) || !
|
|
32759
|
+
if (seen.has(file) || !import_node_fs47.default.existsSync(file)) return;
|
|
32762
32760
|
seen.add(file);
|
|
32763
|
-
const source =
|
|
32761
|
+
const source = import_node_fs47.default.readFileSync(file, "utf8");
|
|
32764
32762
|
for (const [, framework, header] of source.matchAll(FRAMEWORK_IMPORT)) {
|
|
32765
32763
|
const headers = imports2.get(framework) ?? /* @__PURE__ */ new Set();
|
|
32766
32764
|
headers.add(header);
|
|
@@ -32795,13 +32793,13 @@ function installedPackageDirs(root) {
|
|
|
32795
32793
|
const dirs = [];
|
|
32796
32794
|
for (let dir = root; ; dir = import_node_path48.default.dirname(dir)) {
|
|
32797
32795
|
const modules = import_node_path48.default.join(dir, "node_modules");
|
|
32798
|
-
if (
|
|
32799
|
-
dirs.push(
|
|
32796
|
+
if (import_node_fs47.default.existsSync(modules)) {
|
|
32797
|
+
dirs.push(import_node_fs47.default.realpathSync.native(modules));
|
|
32800
32798
|
if (dir === root)
|
|
32801
|
-
for (const entry of
|
|
32799
|
+
for (const entry of import_node_fs47.default.readdirSync(modules, { withFileTypes: true })) {
|
|
32802
32800
|
const target = import_node_path48.default.join(modules, entry.name);
|
|
32803
|
-
if (entry.isSymbolicLink() &&
|
|
32804
|
-
dirs.push(
|
|
32801
|
+
if (entry.isSymbolicLink() && import_node_fs47.default.existsSync(target))
|
|
32802
|
+
dirs.push(import_node_fs47.default.realpathSync.native(target));
|
|
32805
32803
|
}
|
|
32806
32804
|
}
|
|
32807
32805
|
if (dir === import_node_path48.default.dirname(dir)) break;
|
|
@@ -32817,7 +32815,7 @@ function* xcodeObjCInputSteps(app, binaries, moduleRoot, products, sourceRoot =
|
|
|
32817
32815
|
const checkouts = remoteSwiftCheckouts(app.rootDir);
|
|
32818
32816
|
const externalFrameworkDirs = [
|
|
32819
32817
|
...new Set(
|
|
32820
|
-
[...app.frameworks, app].flatMap((target) => target.objc?.frameworkSearchPaths ?? []).filter((directory) => import_node_path48.default.isAbsolute(directory) &&
|
|
32818
|
+
[...app.frameworks, app].flatMap((target) => target.objc?.frameworkSearchPaths ?? []).filter((directory) => import_node_path48.default.isAbsolute(directory) && import_node_fs47.default.existsSync(directory)).map((directory) => import_node_fs47.default.realpathSync.native(directory))
|
|
32821
32819
|
)
|
|
32822
32820
|
].filter((directory) => relativeInside(sourceRoot, directory) === null);
|
|
32823
32821
|
const installedDirs = installedPackageDirs(sourceRoot);
|
|
@@ -32837,12 +32835,12 @@ function* xcodeObjCInputSteps(app, binaries, moduleRoot, products, sourceRoot =
|
|
|
32837
32835
|
const add = (file, header = false) => {
|
|
32838
32836
|
const generatedFile = generated.get(file);
|
|
32839
32837
|
if (generatedFile) {
|
|
32840
|
-
sources.set(file,
|
|
32838
|
+
sources.set(file, import_node_fs47.default.readFileSync(generatedFile));
|
|
32841
32839
|
return;
|
|
32842
32840
|
}
|
|
32843
32841
|
if (pending.has(file)) return;
|
|
32844
32842
|
if (sources.has(file)) return;
|
|
32845
|
-
const resolved = header ?
|
|
32843
|
+
const resolved = header ? import_node_fs47.default.realpathSync.native(file) : file;
|
|
32846
32844
|
if (resolved !== file) links[file] = resolved;
|
|
32847
32845
|
const external = [...externalFrameworkDirs, ...installedDirs].find(
|
|
32848
32846
|
(directory) => relativeInside(directory, resolved) !== null
|
|
@@ -32873,11 +32871,11 @@ function* xcodeObjCInputSteps(app, binaries, moduleRoot, products, sourceRoot =
|
|
|
32873
32871
|
const ancestors = /* @__PURE__ */ new Set();
|
|
32874
32872
|
const addHeaders = function* (directory, binaryHeaders2 = false) {
|
|
32875
32873
|
if (walked.has(directory) && (!binaryHeaders2 || walked.get(directory))) return;
|
|
32876
|
-
const real =
|
|
32874
|
+
const real = import_node_fs47.default.realpathSync.native(directory);
|
|
32877
32875
|
if (ancestors.has(real)) return;
|
|
32878
32876
|
walked.set(directory, binaryHeaders2);
|
|
32879
32877
|
ancestors.add(real);
|
|
32880
|
-
for (const entry of
|
|
32878
|
+
for (const entry of import_node_fs47.default.readdirSync(directory, { withFileTypes: true })) {
|
|
32881
32879
|
if (++workCount % 64 === 0) yield;
|
|
32882
32880
|
if (!binaryHeaders2 && entry.name.startsWith(".") && !entry.isFile()) continue;
|
|
32883
32881
|
const file = import_node_path48.default.join(directory, entry.name);
|
|
@@ -32938,7 +32936,7 @@ function* xcodeObjCInputSteps(app, binaries, moduleRoot, products, sourceRoot =
|
|
|
32938
32936
|
) ? flag : /^-I(.+)$/.exec(flag)?.[1];
|
|
32939
32937
|
if (directory) {
|
|
32940
32938
|
const include = import_node_path48.default.resolve(target.dir, directory);
|
|
32941
|
-
if (
|
|
32939
|
+
if (import_node_fs47.default.existsSync(include)) yield* addHeaders(include);
|
|
32942
32940
|
}
|
|
32943
32941
|
}
|
|
32944
32942
|
targets.push({
|
|
@@ -33035,7 +33033,7 @@ function* xcodeObjCInputSteps(app, binaries, moduleRoot, products, sourceRoot =
|
|
|
33035
33033
|
if (moduleMap) {
|
|
33036
33034
|
const requested = import_node_path48.default.resolve(app.rootDir, moduleMap);
|
|
33037
33035
|
const file = products ? requested : app.moduleMapSources?.[requested] ?? requested;
|
|
33038
|
-
if (generated.has(file) || !pending.has(file) &&
|
|
33036
|
+
if (generated.has(file) || !pending.has(file) && import_node_fs47.default.existsSync(file))
|
|
33039
33037
|
queue.push({ file });
|
|
33040
33038
|
}
|
|
33041
33039
|
const directory = ["-I", "-F", "-iquote", "-isystem", "-iframework"].includes(
|
|
@@ -33245,20 +33243,20 @@ function prepareXcodeSwiftProducts(app, binaries, moduleRoot) {
|
|
|
33245
33243
|
targets: native,
|
|
33246
33244
|
externalFrameworkDirs
|
|
33247
33245
|
} = xcodeObjCInputs(app, binaries, moduleRoot);
|
|
33248
|
-
for (const file of app.projectFiles) sources.set(file,
|
|
33246
|
+
for (const file of app.projectFiles) sources.set(file, import_node_fs47.default.readFileSync(file));
|
|
33249
33247
|
const digest = (bytes) => (0, import_node_crypto25.createHash)("sha256").update(bytes).digest("hex");
|
|
33250
33248
|
const providers = /* @__PURE__ */ new Map();
|
|
33251
33249
|
for (const target of targets) {
|
|
33252
33250
|
if (!supplied.has(target.moduleName)) continue;
|
|
33253
33251
|
const file = import_node_path48.default.join(modules, `${target.moduleName}.swiftmodule`);
|
|
33254
|
-
if (!
|
|
33252
|
+
if (!import_node_fs47.default.existsSync(file) || !import_node_fs47.default.statSync(file).isFile())
|
|
33255
33253
|
throw new Error(
|
|
33256
33254
|
`${target.moduleName}: Swift compatibility header requires its canonical compiled SDK module at ${file}`
|
|
33257
33255
|
);
|
|
33258
33256
|
providers.set(target.moduleName, file);
|
|
33259
33257
|
}
|
|
33260
33258
|
const toolsetFile = import_node_path48.default.join(import_node_path48.default.dirname(sdk.sysroot), "toolset.json");
|
|
33261
|
-
const toolset = JSON.parse(
|
|
33259
|
+
const toolset = JSON.parse(import_node_fs47.default.readFileSync(toolsetFile, "utf8"));
|
|
33262
33260
|
if (!isRecord(toolset) || !isRecord(toolset.swiftCompiler) || !Array.isArray(toolset.swiftCompiler.extraCLIOptions) || !toolset.swiftCompiler.extraCLIOptions.every(
|
|
33263
33261
|
(flag) => typeof flag === "string"
|
|
33264
33262
|
))
|
|
@@ -33278,8 +33276,8 @@ function prepareXcodeSwiftProducts(app, binaries, moduleRoot) {
|
|
|
33278
33276
|
version: 4,
|
|
33279
33277
|
sdk: swiftModuleSdk(moduleRoot),
|
|
33280
33278
|
distribution: swiftModuleDigest(moduleRoot).toString("hex"),
|
|
33281
|
-
compiler: digest(
|
|
33282
|
-
toolset: digest(
|
|
33279
|
+
compiler: digest(import_node_fs47.default.readFileSync(frontend)),
|
|
33280
|
+
toolset: digest(import_node_fs47.default.readFileSync(toolsetFile)),
|
|
33283
33281
|
targets,
|
|
33284
33282
|
externalFrameworkDirs,
|
|
33285
33283
|
inputs: Object.fromEntries(
|
|
@@ -33287,14 +33285,14 @@ function prepareXcodeSwiftProducts(app, binaries, moduleRoot) {
|
|
|
33287
33285
|
),
|
|
33288
33286
|
links,
|
|
33289
33287
|
providers: Object.fromEntries(
|
|
33290
|
-
[...providers].map(([name3, file]) => [name3, digest(
|
|
33288
|
+
[...providers].map(([name3, file]) => [name3, digest(import_node_fs47.default.readFileSync(file))])
|
|
33291
33289
|
)
|
|
33292
33290
|
};
|
|
33293
33291
|
const parent = import_node_path48.default.join(cacheDir(), "swift-xcode-products");
|
|
33294
|
-
|
|
33292
|
+
import_node_fs47.default.mkdirSync(parent, { recursive: true });
|
|
33295
33293
|
const key2 = digest(JSON.stringify(identity2));
|
|
33296
33294
|
const work = import_node_path48.default.join(parent, key2);
|
|
33297
|
-
const descriptor =
|
|
33295
|
+
const descriptor = import_node_fs47.default.openSync(`${work}.lock`, "a");
|
|
33298
33296
|
const checkouts = remoteSwiftCheckouts(app.rootDir);
|
|
33299
33297
|
const local = (file) => xcodeStagedPath(
|
|
33300
33298
|
file,
|
|
@@ -33340,8 +33338,8 @@ function prepareXcodeSwiftProducts(app, binaries, moduleRoot) {
|
|
|
33340
33338
|
`Could not lock Swift products: ${lock.error?.message ?? lock.stderr}`
|
|
33341
33339
|
);
|
|
33342
33340
|
const completed = import_node_path48.default.join(work, "completed.json");
|
|
33343
|
-
if (
|
|
33344
|
-
const retained = JSON.parse(
|
|
33341
|
+
if (import_node_fs47.default.existsSync(completed)) {
|
|
33342
|
+
const retained = JSON.parse(import_node_fs47.default.readFileSync(completed, "utf8"));
|
|
33345
33343
|
const required = [
|
|
33346
33344
|
...productFiles.map(({ file }) => file),
|
|
33347
33345
|
...objects.map(({ file }) => file),
|
|
@@ -33353,13 +33351,13 @@ function prepareXcodeSwiftProducts(app, binaries, moduleRoot) {
|
|
|
33353
33351
|
if (isRecord(retained) && retained.key === key2 && isRecord(retained.files) && required.every(
|
|
33354
33352
|
(file) => isRecord(retained.files) && import_node_path48.default.relative(work, file) in retained.files
|
|
33355
33353
|
) && Object.entries(retained.files).every(
|
|
33356
|
-
([file, hash]) => typeof hash === "string" &&
|
|
33354
|
+
([file, hash]) => typeof hash === "string" && import_node_fs47.default.existsSync(import_node_path48.default.join(work, file)) && digest(import_node_fs47.default.readFileSync(import_node_path48.default.join(work, file))) === hash
|
|
33357
33355
|
))
|
|
33358
33356
|
return preparation;
|
|
33359
33357
|
}
|
|
33360
|
-
|
|
33361
|
-
|
|
33362
|
-
|
|
33358
|
+
import_node_fs47.default.rmSync(work, { recursive: true, force: true });
|
|
33359
|
+
import_node_fs47.default.mkdirSync(preparation.modules, { recursive: true });
|
|
33360
|
+
import_node_fs47.default.writeFileSync(
|
|
33363
33361
|
preparation.receipt,
|
|
33364
33362
|
JSON.stringify({ ...identity2, commands: [] }, null, 2)
|
|
33365
33363
|
);
|
|
@@ -33402,10 +33400,10 @@ function prepareXcodeSwiftProducts(app, binaries, moduleRoot) {
|
|
|
33402
33400
|
preparation.modules,
|
|
33403
33401
|
`${target.moduleName}.swiftmodule`
|
|
33404
33402
|
);
|
|
33405
|
-
|
|
33406
|
-
|
|
33407
|
-
|
|
33408
|
-
|
|
33403
|
+
import_node_fs47.default.mkdirSync(import_node_path48.default.dirname(outputMap), { recursive: true });
|
|
33404
|
+
import_node_fs47.default.mkdirSync(import_node_path48.default.dirname(outputHeader), { recursive: true });
|
|
33405
|
+
import_node_fs47.default.copyFileSync(local(compatibility.moduleMap), outputMap);
|
|
33406
|
+
import_node_fs47.default.copyFileSync(local(compatibility.umbrella), local(compatibility.outputUmbrella));
|
|
33409
33407
|
const provider = providers.get(target.moduleName);
|
|
33410
33408
|
if (compatibility.framework && !provider) {
|
|
33411
33409
|
const viewModules = import_node_path48.default.join(
|
|
@@ -33422,10 +33420,10 @@ function prepareXcodeSwiftProducts(app, binaries, moduleRoot) {
|
|
|
33422
33420
|
"Headers",
|
|
33423
33421
|
import_node_path48.default.basename(compatibility.umbrella)
|
|
33424
33422
|
);
|
|
33425
|
-
|
|
33426
|
-
|
|
33427
|
-
|
|
33428
|
-
|
|
33423
|
+
import_node_fs47.default.mkdirSync(import_node_path48.default.dirname(viewModules), { recursive: true });
|
|
33424
|
+
import_node_fs47.default.mkdirSync(import_node_path48.default.dirname(viewHeaders), { recursive: true });
|
|
33425
|
+
import_node_fs47.default.copyFileSync(ownMap, viewModules);
|
|
33426
|
+
import_node_fs47.default.copyFileSync(local(compatibility.umbrella), viewHeaders);
|
|
33429
33427
|
generated.push(viewModules, viewHeaders);
|
|
33430
33428
|
ownMap = viewModules;
|
|
33431
33429
|
}
|
|
@@ -33458,7 +33456,7 @@ function prepareXcodeSwiftProducts(app, binaries, moduleRoot) {
|
|
|
33458
33456
|
);
|
|
33459
33457
|
}
|
|
33460
33458
|
const carriesOwnMap = provider !== void 0 || target.swift.flags.some(
|
|
33461
|
-
(flag) => flag.startsWith("-fmodule-map-file=") &&
|
|
33459
|
+
(flag) => flag.startsWith("-fmodule-map-file=") && import_node_fs47.default.existsSync(flag.slice("-fmodule-map-file=".length)) && import_node_fs47.default.realpathSync.native(flag.slice("-fmodule-map-file=".length)) === import_node_fs47.default.realpathSync.native(compatibility.moduleMap)
|
|
33462
33460
|
);
|
|
33463
33461
|
const args = [
|
|
33464
33462
|
...provider ? ["-merge-modules", "-emit-module"] : ["-emit-object", "-whole-module-optimization", "-parse-as-library"],
|
|
@@ -33510,7 +33508,7 @@ function prepareXcodeSwiftProducts(app, binaries, moduleRoot) {
|
|
|
33510
33508
|
maxBuffer: 32 * 1024 * 1024
|
|
33511
33509
|
});
|
|
33512
33510
|
const log = import_node_path48.default.join(work, `${target.moduleName}.log`);
|
|
33513
|
-
|
|
33511
|
+
import_node_fs47.default.writeFileSync(
|
|
33514
33512
|
log,
|
|
33515
33513
|
`${result.stdout ?? ""}${result.stderr ?? ""}${result.error ? `
|
|
33516
33514
|
${result.error.message}` : ""}`
|
|
@@ -33521,17 +33519,17 @@ ${result.error.message}` : ""}`
|
|
|
33521
33519
|
status: result.status,
|
|
33522
33520
|
signal: result.signal
|
|
33523
33521
|
});
|
|
33524
|
-
|
|
33522
|
+
import_node_fs47.default.writeFileSync(
|
|
33525
33523
|
preparation.receipt,
|
|
33526
33524
|
JSON.stringify({ ...identity2, commands }, null, 2)
|
|
33527
33525
|
);
|
|
33528
33526
|
if (result.error || result.signal || result.status !== 0)
|
|
33529
33527
|
throw new Error(
|
|
33530
|
-
`${target.moduleName}: Swift compatibility product compilation failed. ${
|
|
33528
|
+
`${target.moduleName}: Swift compatibility product compilation failed. ${import_node_fs47.default.readFileSync(log, "utf8")}
|
|
33531
33529
|
Inputs: ${preparation.receipt}`
|
|
33532
33530
|
);
|
|
33533
33531
|
const relativeHeader = import_node_path48.default.relative(import_node_path48.default.dirname(outputMap), outputHeader);
|
|
33534
|
-
|
|
33532
|
+
import_node_fs47.default.appendFileSync(
|
|
33535
33533
|
outputMap,
|
|
33536
33534
|
compatibility.framework ? `
|
|
33537
33535
|
|
|
@@ -33561,7 +33559,7 @@ module ${target.moduleName}.Swift {
|
|
|
33561
33559
|
preparation.receipt,
|
|
33562
33560
|
...objects.map(({ file }) => file)
|
|
33563
33561
|
];
|
|
33564
|
-
|
|
33562
|
+
import_node_fs47.default.writeFileSync(
|
|
33565
33563
|
completed,
|
|
33566
33564
|
JSON.stringify(
|
|
33567
33565
|
{
|
|
@@ -33569,7 +33567,7 @@ module ${target.moduleName}.Swift {
|
|
|
33569
33567
|
files: Object.fromEntries(
|
|
33570
33568
|
outputs.map((file) => [
|
|
33571
33569
|
import_node_path48.default.relative(work, file),
|
|
33572
|
-
digest(
|
|
33570
|
+
digest(import_node_fs47.default.readFileSync(file))
|
|
33573
33571
|
])
|
|
33574
33572
|
)
|
|
33575
33573
|
},
|
|
@@ -33579,7 +33577,7 @@ module ${target.moduleName}.Swift {
|
|
|
33579
33577
|
);
|
|
33580
33578
|
return preparation;
|
|
33581
33579
|
} finally {
|
|
33582
|
-
|
|
33580
|
+
import_node_fs47.default.closeSync(descriptor);
|
|
33583
33581
|
}
|
|
33584
33582
|
}
|
|
33585
33583
|
async function prepareXcodeObjCImplementations(app, binaries, moduleRoot) {
|
|
@@ -33606,7 +33604,7 @@ async function prepareXcodeObjCImplementations(app, binaries, moduleRoot) {
|
|
|
33606
33604
|
return minimum === void 0 ? [`invalid-minimum:${target.deploymentTarget}`] : objcSdkIntakeFlags(headers, toolchain.toolchainBin, minimum);
|
|
33607
33605
|
}),
|
|
33608
33606
|
release: toolchain.release,
|
|
33609
|
-
compiler: digest(
|
|
33607
|
+
compiler: digest(import_node_fs47.default.readFileSync(import_node_path48.default.join(toolchain.toolchainBin, "clang"))),
|
|
33610
33608
|
sdk: swiftModuleSdk(moduleRoot),
|
|
33611
33609
|
targets,
|
|
33612
33610
|
externalFrameworkDirs,
|
|
@@ -33616,10 +33614,10 @@ async function prepareXcodeObjCImplementations(app, binaries, moduleRoot) {
|
|
|
33616
33614
|
swiftProducts: products?.receipt
|
|
33617
33615
|
};
|
|
33618
33616
|
const parent = import_node_path48.default.join(cacheDir(), "swift-objc-implementations");
|
|
33619
|
-
|
|
33617
|
+
import_node_fs47.default.mkdirSync(parent, { recursive: true });
|
|
33620
33618
|
const key2 = digest(JSON.stringify(identity2));
|
|
33621
33619
|
const work = import_node_path48.default.join(parent, key2);
|
|
33622
|
-
const descriptor =
|
|
33620
|
+
const descriptor = import_node_fs47.default.openSync(`${work}.lock`, "a");
|
|
33623
33621
|
try {
|
|
33624
33622
|
const locked = (0, import_node_child_process29.spawnSync)(
|
|
33625
33623
|
"perl",
|
|
@@ -33645,7 +33643,7 @@ async function prepareXcodeObjCImplementations(app, binaries, moduleRoot) {
|
|
|
33645
33643
|
]
|
|
33646
33644
|
});
|
|
33647
33645
|
const record2 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
33648
|
-
if (
|
|
33646
|
+
if (import_node_fs47.default.existsSync(work)) {
|
|
33649
33647
|
let message;
|
|
33650
33648
|
let interrupted2 = false;
|
|
33651
33649
|
let prepared = false;
|
|
@@ -33667,19 +33665,19 @@ async function prepareXcodeObjCImplementations(app, binaries, moduleRoot) {
|
|
|
33667
33665
|
} else if (result.reusable) message = result.message;
|
|
33668
33666
|
else interrupted2 = true;
|
|
33669
33667
|
} catch {
|
|
33670
|
-
|
|
33668
|
+
import_node_fs47.default.rmSync(work, { recursive: true });
|
|
33671
33669
|
}
|
|
33672
33670
|
if (prepared) return preparation();
|
|
33673
33671
|
if (message !== void 0)
|
|
33674
33672
|
throw new SwiftObjCCompilationError(message, import_node_path48.default.join(work, "receipt.json"));
|
|
33675
33673
|
if (interrupted2) {
|
|
33676
33674
|
const first = `${work}-interrupted-first`;
|
|
33677
|
-
const destination =
|
|
33678
|
-
|
|
33679
|
-
|
|
33675
|
+
const destination = import_node_fs47.default.existsSync(first) ? `${work}-interrupted-latest` : first;
|
|
33676
|
+
import_node_fs47.default.rmSync(destination, { recursive: true, force: true });
|
|
33677
|
+
import_node_fs47.default.renameSync(work, destination);
|
|
33680
33678
|
}
|
|
33681
33679
|
}
|
|
33682
|
-
|
|
33680
|
+
import_node_fs47.default.mkdirSync(work);
|
|
33683
33681
|
const staged = (file) => xcodeStagedPath(
|
|
33684
33682
|
file,
|
|
33685
33683
|
app.rootDir,
|
|
@@ -33718,7 +33716,7 @@ async function prepareXcodeObjCImplementations(app, binaries, moduleRoot) {
|
|
|
33718
33716
|
if (sources.has(custom)) flag = `-fmodule-map-file=${staged(custom)}`;
|
|
33719
33717
|
else {
|
|
33720
33718
|
const output2 = import_node_path48.default.join(work, `module-${moduleMapFlags.size}.modulemap`);
|
|
33721
|
-
|
|
33719
|
+
import_node_fs47.default.writeFileSync(
|
|
33722
33720
|
output2,
|
|
33723
33721
|
`module ${swiftTargetModuleName(module2)} {
|
|
33724
33722
|
umbrella ${JSON.stringify(staged(headers2))}
|
|
@@ -33737,7 +33735,7 @@ async function prepareXcodeObjCImplementations(app, binaries, moduleRoot) {
|
|
|
33737
33735
|
);
|
|
33738
33736
|
const commands = [];
|
|
33739
33737
|
const receipt = import_node_path48.default.join(work, "receipt.json");
|
|
33740
|
-
const save = (status) =>
|
|
33738
|
+
const save = (status) => import_node_fs47.default.writeFileSync(
|
|
33741
33739
|
receipt,
|
|
33742
33740
|
JSON.stringify({ ...identity2, work, status, commands }, null, 2)
|
|
33743
33741
|
);
|
|
@@ -33763,11 +33761,11 @@ async function prepareXcodeObjCImplementations(app, binaries, moduleRoot) {
|
|
|
33763
33761
|
reusable,
|
|
33764
33762
|
prepared: status === "prepared",
|
|
33765
33763
|
files: Object.fromEntries(
|
|
33766
|
-
files2.map((file) => [import_node_path48.default.relative(work, file), digest(
|
|
33764
|
+
files2.map((file) => [import_node_path48.default.relative(work, file), digest(import_node_fs47.default.readFileSync(file))])
|
|
33767
33765
|
)
|
|
33768
33766
|
};
|
|
33769
|
-
|
|
33770
|
-
|
|
33767
|
+
import_node_fs47.default.writeFileSync(`${resultFile}.pending`, JSON.stringify(result, null, 2));
|
|
33768
|
+
import_node_fs47.default.renameSync(`${resultFile}.pending`, resultFile);
|
|
33771
33769
|
};
|
|
33772
33770
|
const finish = (status, message, reusable = true) => {
|
|
33773
33771
|
complete(status, message, reusable);
|
|
@@ -33899,7 +33897,7 @@ async function prepareXcodeObjCImplementations(app, binaries, moduleRoot) {
|
|
|
33899
33897
|
const diagnostics = `${result.stdout}${result.stderr}${result.error ? `
|
|
33900
33898
|
${result.error.message}` : ""}${result.signal ? `
|
|
33901
33899
|
Clang terminated by ${result.signal}` : ""}`;
|
|
33902
|
-
|
|
33900
|
+
import_node_fs47.default.writeFileSync(log, diagnostics);
|
|
33903
33901
|
completed[position] = {
|
|
33904
33902
|
target: target.name,
|
|
33905
33903
|
source: file,
|
|
@@ -33907,9 +33905,9 @@ Clang terminated by ${result.signal}` : ""}`;
|
|
|
33907
33905
|
status: result.status,
|
|
33908
33906
|
signal: result.signal,
|
|
33909
33907
|
log,
|
|
33910
|
-
...dependencies &&
|
|
33908
|
+
...dependencies && import_node_fs47.default.existsSync(dependencies) ? { dependencies } : {},
|
|
33911
33909
|
...result.error ? { error: result.error.message } : {},
|
|
33912
|
-
...!result.error && !result.signal && result.status === 0 ? { object: digest(
|
|
33910
|
+
...!result.error && !result.signal && result.status === 0 ? { object: digest(import_node_fs47.default.readFileSync(output2)) } : {}
|
|
33913
33911
|
};
|
|
33914
33912
|
commands.splice(0, commands.length, ...completed.filter(Boolean));
|
|
33915
33913
|
if (result.error || result.signal || result.status !== 0) {
|
|
@@ -33947,7 +33945,7 @@ ${reported.trimEnd() || `Clang exited with status ${result.status}`}`;
|
|
|
33947
33945
|
);
|
|
33948
33946
|
return preparation();
|
|
33949
33947
|
} finally {
|
|
33950
|
-
|
|
33948
|
+
import_node_fs47.default.closeSync(descriptor);
|
|
33951
33949
|
}
|
|
33952
33950
|
}
|
|
33953
33951
|
|
|
@@ -33989,7 +33987,7 @@ async function xcodeCxxReachable(app, binaries, moduleRoot, clang) {
|
|
|
33989
33987
|
);
|
|
33990
33988
|
for (const [file, bytes] of inputs.sources)
|
|
33991
33989
|
hash.update(file).update("\0").update(bytes).update("\0");
|
|
33992
|
-
const compiler =
|
|
33990
|
+
const compiler = import_node_fs48.default.statSync(clang);
|
|
33993
33991
|
hash.update(`${compiler.size}:${compiler.mtimeMs}`);
|
|
33994
33992
|
const key2 = hash.digest("hex");
|
|
33995
33993
|
const cached = cachedInputs.get(key2);
|
|
@@ -34004,7 +34002,7 @@ async function xcodeCxxReachable(app, binaries, moduleRoot, clang) {
|
|
|
34004
34002
|
if (!(error instanceof SwiftObjCCompilationError)) throw error;
|
|
34005
34003
|
receipt = error.receipt;
|
|
34006
34004
|
}
|
|
34007
|
-
const data = JSON.parse(
|
|
34005
|
+
const data = JSON.parse(import_node_fs48.default.readFileSync(receipt, "utf8"));
|
|
34008
34006
|
if (!isRecord(data) || typeof data.work !== "string" || !Array.isArray(data.commands) || !["prepared", "compile-failed"].includes(String(data.status)))
|
|
34009
34007
|
throw new Error("C++ header discovery requires completed original compiler inputs");
|
|
34010
34008
|
const work = data.work;
|
|
@@ -34112,12 +34110,12 @@ async function xcodeCxxReachable(app, binaries, moduleRoot, clang) {
|
|
|
34112
34110
|
for (const item of used) item.errors.add(`${label}: ${cxxDiagnostic(stderr)}`);
|
|
34113
34111
|
};
|
|
34114
34112
|
const firstPass = (command) => {
|
|
34115
|
-
if (!command.log || !
|
|
34116
|
-
const stderr =
|
|
34117
|
-
if (command.status === 0 && command.dependencies &&
|
|
34113
|
+
if (!command.log || !import_node_fs48.default.existsSync(command.log)) return void 0;
|
|
34114
|
+
const stderr = import_node_fs48.default.readFileSync(command.log, "utf8");
|
|
34115
|
+
if (command.status === 0 && command.dependencies && import_node_fs48.default.existsSync(command.dependencies)) {
|
|
34118
34116
|
try {
|
|
34119
34117
|
return {
|
|
34120
|
-
reached: cxxDependencies(
|
|
34118
|
+
reached: cxxDependencies(import_node_fs48.default.readFileSync(command.dependencies, "utf8")),
|
|
34121
34119
|
stderr,
|
|
34122
34120
|
failed: false
|
|
34123
34121
|
};
|
|
@@ -34151,7 +34149,7 @@ async function xcodeCxxReachable(app, binaries, moduleRoot, clang) {
|
|
|
34151
34149
|
if (!original) throw new Error("original C++ compiler command has no source");
|
|
34152
34150
|
const staged2 = import_node_path49.default.join(work, "project", import_node_path49.default.relative(app.rootDir, bridge));
|
|
34153
34151
|
const probe = import_node_path49.default.join(work, `peach-cxx-bridge-${target.moduleName}.mm`);
|
|
34154
|
-
|
|
34152
|
+
import_node_fs48.default.writeFileSync(probe, `#include ${JSON.stringify(staged2)}
|
|
34155
34153
|
`);
|
|
34156
34154
|
try {
|
|
34157
34155
|
compile2(
|
|
@@ -34159,7 +34157,7 @@ async function xcodeCxxReachable(app, binaries, moduleRoot, clang) {
|
|
|
34159
34157
|
`${target.moduleName}: bridging header ${bridge}`
|
|
34160
34158
|
);
|
|
34161
34159
|
} finally {
|
|
34162
|
-
|
|
34160
|
+
import_node_fs48.default.rmSync(probe, { force: true });
|
|
34163
34161
|
}
|
|
34164
34162
|
}
|
|
34165
34163
|
const result = binaries.map((binary, index) => {
|
|
@@ -34187,7 +34185,7 @@ async function xcodeCxxReachable(app, binaries, moduleRoot, clang) {
|
|
|
34187
34185
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
34188
34186
|
var import_node_child_process31 = require("node:child_process");
|
|
34189
34187
|
var import_node_crypto27 = require("node:crypto");
|
|
34190
|
-
var
|
|
34188
|
+
var import_node_fs50 = __toESM(require("node:fs"), 1);
|
|
34191
34189
|
var import_node_os12 = __toESM(require("node:os"), 1);
|
|
34192
34190
|
var import_node_path51 = __toESM(require("node:path"), 1);
|
|
34193
34191
|
|
|
@@ -34204,7 +34202,7 @@ var RNX_INTERNAL_CHILDREN = {
|
|
|
34204
34202
|
|
|
34205
34203
|
// cli/self-invocation.ts
|
|
34206
34204
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
34207
|
-
var
|
|
34205
|
+
var import_node_fs49 = require("node:fs");
|
|
34208
34206
|
var import_node_path50 = require("node:path");
|
|
34209
34207
|
var import_node_url2 = require("node:url");
|
|
34210
34208
|
|
|
@@ -34216,7 +34214,7 @@ var IS_STANDALONE = typeof __SOOTSIM_STANDALONE__ !== "undefined" && __SOOTSIM_S
|
|
|
34216
34214
|
function sourceEntryPath() {
|
|
34217
34215
|
try {
|
|
34218
34216
|
const candidate = (0, import_node_path50.join)((0, import_node_path50.dirname)((0, import_node_url2.fileURLToPath)(__sootsim_import_meta_url)), "bin.ts");
|
|
34219
|
-
return (0,
|
|
34217
|
+
return (0, import_node_fs49.existsSync)(candidate) ? candidate : null;
|
|
34220
34218
|
} catch {
|
|
34221
34219
|
return null;
|
|
34222
34220
|
}
|
|
@@ -34270,23 +34268,23 @@ function rasterBinary() {
|
|
|
34270
34268
|
const tag = (0, import_node_crypto27.createHash)("sha256").update(RASTER_SWIFT).digest("hex").slice(0, 16);
|
|
34271
34269
|
const binary = import_node_path51.default.join(cacheDir(), `swift-pdf-raster-${tag}`);
|
|
34272
34270
|
try {
|
|
34273
|
-
|
|
34271
|
+
import_node_fs50.default.accessSync(binary, import_node_fs50.default.constants.X_OK);
|
|
34274
34272
|
return binary;
|
|
34275
34273
|
} catch {
|
|
34276
34274
|
}
|
|
34277
34275
|
try {
|
|
34278
|
-
|
|
34276
|
+
import_node_fs50.default.mkdirSync(cacheDir(), { recursive: true });
|
|
34279
34277
|
const source = import_node_path51.default.join(
|
|
34280
|
-
|
|
34278
|
+
import_node_fs50.default.mkdtempSync(import_node_path51.default.join(import_node_os12.default.tmpdir(), "swift-pdf-raster-")),
|
|
34281
34279
|
"raster.swift"
|
|
34282
34280
|
);
|
|
34283
|
-
|
|
34281
|
+
import_node_fs50.default.writeFileSync(source, RASTER_SWIFT);
|
|
34284
34282
|
try {
|
|
34285
34283
|
(0, import_node_child_process31.execFileSync)("xcrun", ["swiftc", "-o", binary, source], { stdio: "pipe" });
|
|
34286
34284
|
} finally {
|
|
34287
|
-
|
|
34285
|
+
import_node_fs50.default.rmSync(import_node_path51.default.dirname(source), { recursive: true, force: true });
|
|
34288
34286
|
}
|
|
34289
|
-
|
|
34287
|
+
import_node_fs50.default.accessSync(binary, import_node_fs50.default.constants.X_OK);
|
|
34290
34288
|
return binary;
|
|
34291
34289
|
} catch (error) {
|
|
34292
34290
|
throw new Error(
|
|
@@ -34298,11 +34296,11 @@ function rasterizePdfFile(diskPath, pdfSha256) {
|
|
|
34298
34296
|
const renderer = process.platform === "darwin" ? (0, import_node_crypto27.createHash)("sha256").update(RASTER_SWIFT).digest("hex").slice(0, 16) : "pdfium-1";
|
|
34299
34297
|
const cached = import_node_path51.default.join(cacheDir(), `swift-pdf-png-${renderer}-${pdfSha256}.png`);
|
|
34300
34298
|
try {
|
|
34301
|
-
return { bytes:
|
|
34299
|
+
return { bytes: import_node_fs50.default.readFileSync(cached) };
|
|
34302
34300
|
} catch {
|
|
34303
34301
|
}
|
|
34304
34302
|
const out = import_node_path51.default.join(
|
|
34305
|
-
|
|
34303
|
+
import_node_fs50.default.mkdtempSync(import_node_path51.default.join(import_node_os12.default.tmpdir(), "swift-pdf-png-")),
|
|
34306
34304
|
"out.png"
|
|
34307
34305
|
);
|
|
34308
34306
|
try {
|
|
@@ -34323,10 +34321,10 @@ function rasterizePdfFile(diskPath, pdfSha256) {
|
|
|
34323
34321
|
{ stdio: "pipe" }
|
|
34324
34322
|
);
|
|
34325
34323
|
}
|
|
34326
|
-
const bytes =
|
|
34324
|
+
const bytes = import_node_fs50.default.readFileSync(out);
|
|
34327
34325
|
try {
|
|
34328
|
-
|
|
34329
|
-
|
|
34326
|
+
import_node_fs50.default.mkdirSync(cacheDir(), { recursive: true });
|
|
34327
|
+
import_node_fs50.default.copyFileSync(out, cached);
|
|
34330
34328
|
} catch {
|
|
34331
34329
|
}
|
|
34332
34330
|
return { bytes: Buffer.from(bytes) };
|
|
@@ -34335,7 +34333,7 @@ function rasterizePdfFile(diskPath, pdfSha256) {
|
|
|
34335
34333
|
`swift pdf asset ${diskPath} did not rasterize (corrupt or oversize pdf, like actool distill failure): ${error instanceof Error ? error.message : String(error)}`
|
|
34336
34334
|
);
|
|
34337
34335
|
} finally {
|
|
34338
|
-
|
|
34336
|
+
import_node_fs50.default.rmSync(import_node_path51.default.dirname(out), { recursive: true, force: true });
|
|
34339
34337
|
}
|
|
34340
34338
|
}
|
|
34341
34339
|
|
|
@@ -34355,15 +34353,15 @@ function swiftPackageId(packagePath) {
|
|
|
34355
34353
|
return import_node_path52.default.basename(packagePath).replace(/[^A-Za-z0-9_]/g, "_").replace(/^(\d)/, "_$1");
|
|
34356
34354
|
}
|
|
34357
34355
|
function nativeSourceDescriptor(packagePath) {
|
|
34358
|
-
packagePath =
|
|
34356
|
+
packagePath = import_node_fs51.default.realpathSync(packagePath);
|
|
34359
34357
|
if (sourceEntries().has(packagePath)) return null;
|
|
34360
34358
|
const file = import_node_path52.default.join(packagePath, NATIVE_DESCRIPTOR);
|
|
34361
|
-
if (!
|
|
34359
|
+
if (!import_node_fs51.default.existsSync(file)) return null;
|
|
34362
34360
|
const value = JSON.parse(
|
|
34363
34361
|
readPackageFile2(packagePath, file, MAX_SWIFT_COMPILE_SOURCE_BYTES).toString("utf8")
|
|
34364
34362
|
);
|
|
34365
34363
|
const invalid = () => new Error(`${file}: invalid One native source descriptor; run one typegen`);
|
|
34366
|
-
if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !
|
|
34364
|
+
if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !import_node_fs51.default.existsSync(import_node_path52.default.join(packagePath, NATIVE_GLUE))) {
|
|
34367
34365
|
throw invalid();
|
|
34368
34366
|
}
|
|
34369
34367
|
if (!isSwiftNativeModules(value) || value.packageId !== swiftPackageId(packagePath)) {
|
|
@@ -34372,9 +34370,9 @@ function nativeSourceDescriptor(packagePath) {
|
|
|
34372
34370
|
return value;
|
|
34373
34371
|
}
|
|
34374
34372
|
function nativeSourceFiles(packagePath) {
|
|
34375
|
-
packagePath =
|
|
34373
|
+
packagePath = import_node_fs51.default.realpathSync(packagePath);
|
|
34376
34374
|
if (sourceEntries().has(packagePath)) return [];
|
|
34377
|
-
return [NATIVE_DESCRIPTOR, NATIVE_GLUE].map((name3) => import_node_path52.default.join(packagePath, name3)).filter((file) =>
|
|
34375
|
+
return [NATIVE_DESCRIPTOR, NATIVE_GLUE].map((name3) => import_node_path52.default.join(packagePath, name3)).filter((file) => import_node_fs51.default.existsSync(file));
|
|
34378
34376
|
}
|
|
34379
34377
|
var SwiftMissingModulesError = class extends Error {
|
|
34380
34378
|
};
|
|
@@ -34384,7 +34382,7 @@ var projects = () => projectScope.getStore()?.projects ?? sharedProjects;
|
|
|
34384
34382
|
var sharedSourceEntries = /* @__PURE__ */ new Map();
|
|
34385
34383
|
var sourceEntries = () => projectScope.getStore()?.sourceEntries ?? sharedSourceEntries;
|
|
34386
34384
|
function projectFor(packagePath, hosted, signal) {
|
|
34387
|
-
packagePath =
|
|
34385
|
+
packagePath = import_node_fs51.default.realpathSync(packagePath);
|
|
34388
34386
|
const existing = projects().get(packagePath);
|
|
34389
34387
|
if (existing) {
|
|
34390
34388
|
if (signal && existing.signal !== signal) {
|
|
@@ -34429,22 +34427,22 @@ function readXcodeAppTargetPrepared(input, target, configuration, options) {
|
|
|
34429
34427
|
const checkouts = remoteSwiftCheckouts(probe.rootDir);
|
|
34430
34428
|
for (const projectDir of probe.projectDirs) {
|
|
34431
34429
|
const packages = import_node_path52.default.join(projectDir, ".build", "peach-xcode", "SourcePackages");
|
|
34432
|
-
|
|
34430
|
+
import_node_fs51.default.mkdirSync(packages, { recursive: true });
|
|
34433
34431
|
const link = import_node_path52.default.join(packages, "checkouts");
|
|
34434
34432
|
let linked = null;
|
|
34435
34433
|
try {
|
|
34436
|
-
linked =
|
|
34434
|
+
linked = import_node_fs51.default.lstatSync(link).isSymbolicLink() ? import_node_fs51.default.readlinkSync(link) : null;
|
|
34437
34435
|
} catch {
|
|
34438
34436
|
linked = null;
|
|
34439
34437
|
}
|
|
34440
34438
|
if (linked !== null) {
|
|
34441
34439
|
if (import_node_path52.default.resolve(packages, linked) === checkouts) continue;
|
|
34442
|
-
|
|
34443
|
-
} else if (
|
|
34440
|
+
import_node_fs51.default.unlinkSync(link);
|
|
34441
|
+
} else if (import_node_fs51.default.existsSync(link)) continue;
|
|
34444
34442
|
try {
|
|
34445
|
-
|
|
34443
|
+
import_node_fs51.default.symlinkSync(checkouts, link);
|
|
34446
34444
|
} catch (error) {
|
|
34447
|
-
if (!(error instanceof Error && "code" in error && error.code === "EEXIST") || import_node_path52.default.resolve(packages,
|
|
34445
|
+
if (!(error instanceof Error && "code" in error && error.code === "EEXIST") || import_node_path52.default.resolve(packages, import_node_fs51.default.readlinkSync(link)) !== checkouts)
|
|
34448
34446
|
throw error;
|
|
34449
34447
|
}
|
|
34450
34448
|
}
|
|
@@ -34456,7 +34454,7 @@ function readXcodeAppTargetPrepared(input, target, configuration, options) {
|
|
|
34456
34454
|
});
|
|
34457
34455
|
}
|
|
34458
34456
|
async function swiftPackages(entry, app) {
|
|
34459
|
-
const stamp = (file) =>
|
|
34457
|
+
const stamp = (file) => import_node_fs51.default.existsSync(file) ? (0, import_node_crypto28.createHash)("sha256").update(import_node_fs51.default.readFileSync(file)).digest("hex") : null;
|
|
34460
34458
|
const owners = [...app.frameworks, app].map((target) => ({
|
|
34461
34459
|
module: target.moduleName,
|
|
34462
34460
|
products: target.packageProducts ?? []
|
|
@@ -34767,7 +34765,7 @@ async function buildXcodeLayout(root) {
|
|
|
34767
34765
|
import_node_path52.default.relative(localPackageRoot, manifest.dir).split(import_node_path52.default.sep).join("/")
|
|
34768
34766
|
);
|
|
34769
34767
|
packagePaths.set(manifest.dir, directory);
|
|
34770
|
-
const manifests =
|
|
34768
|
+
const manifests = import_node_fs51.default.readdirSync(manifest.dir).filter((name3) => /^Package(@swift-[\d.]+)?\.swift$/.test(name3)).map((name3) => import_node_path52.default.join(manifest.dir, name3));
|
|
34771
34769
|
for (const file of /* @__PURE__ */ new Set([
|
|
34772
34770
|
...manifests,
|
|
34773
34771
|
...[...manifest.targets.values()].flatMap((target) => [
|
|
@@ -35204,7 +35202,7 @@ function xcodeManifest(layout2) {
|
|
|
35204
35202
|
].join("\n");
|
|
35205
35203
|
}
|
|
35206
35204
|
function packageFiles(root, includeBuildInputs = true) {
|
|
35207
|
-
const canonicalRoot =
|
|
35205
|
+
const canonicalRoot = import_node_fs51.default.realpathSync(root);
|
|
35208
35206
|
const source = sourceEntries().get(canonicalRoot);
|
|
35209
35207
|
if (source) return [source];
|
|
35210
35208
|
const xcode = xcodeLayout(canonicalRoot);
|
|
@@ -35235,7 +35233,7 @@ function sourceTreeFiles(dir, canonicalRoot) {
|
|
|
35235
35233
|
if (ancestors.has(realDirectory))
|
|
35236
35234
|
throw new Error(`swift input directory cycle: ${dir2}`);
|
|
35237
35235
|
ancestors.add(realDirectory);
|
|
35238
|
-
for (const entry of
|
|
35236
|
+
for (const entry of import_node_fs51.default.readdirSync(dir2, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
|
|
35239
35237
|
if (entry.name.startsWith(".") && entry.name !== NATIVE_DESCRIPTOR && entry.name !== NATIVE_GLUE || entry.name === "node_modules" || // platform project wrappers are excluded only at the package root;
|
|
35240
35238
|
// native target sources can contain upstream ios/android directories.
|
|
35241
35239
|
dir2 === canonicalRoot && SKIP_ROOT_DIRS.has(entry.name))
|
|
@@ -35249,9 +35247,9 @@ function sourceTreeFiles(dir, canonicalRoot) {
|
|
|
35249
35247
|
continue;
|
|
35250
35248
|
throw error;
|
|
35251
35249
|
}
|
|
35252
|
-
const stat =
|
|
35250
|
+
const stat = import_node_fs51.default.statSync(real);
|
|
35253
35251
|
if (stat.isDirectory()) {
|
|
35254
|
-
if (
|
|
35252
|
+
if (import_node_fs51.default.existsSync(import_node_path52.default.join(full, "Package.swift"))) continue;
|
|
35255
35253
|
walk3(full);
|
|
35256
35254
|
} else if (stat.isFile()) {
|
|
35257
35255
|
found.push(full);
|
|
@@ -35259,7 +35257,7 @@ function sourceTreeFiles(dir, canonicalRoot) {
|
|
|
35259
35257
|
}
|
|
35260
35258
|
ancestors.delete(realDirectory);
|
|
35261
35259
|
};
|
|
35262
|
-
if (
|
|
35260
|
+
if (import_node_fs51.default.existsSync(dir)) walk3(packageInputPath(canonicalRoot, dir));
|
|
35263
35261
|
return found;
|
|
35264
35262
|
}
|
|
35265
35263
|
function isPackageSource(file) {
|
|
@@ -35410,7 +35408,7 @@ function buildSwiftResourceTable(project, baseUrl, inputs) {
|
|
|
35410
35408
|
ext = ".png";
|
|
35411
35409
|
uploadName = `${import_node_path52.default.posix.basename(file, import_node_path52.default.posix.extname(file))}.png`;
|
|
35412
35410
|
} else {
|
|
35413
|
-
if (imageBytes +
|
|
35411
|
+
if (imageBytes + import_node_fs51.default.statSync(disk).size > limits.imageTotalBytes) {
|
|
35414
35412
|
throw new Error("swift image pack exceeds the compile service caps");
|
|
35415
35413
|
}
|
|
35416
35414
|
bytes = readPackageFile2(project.packagePath, disk, limits.imageBytes);
|
|
@@ -35465,7 +35463,7 @@ function declaredAppFonts(infoPlist) {
|
|
|
35465
35463
|
return Array.isArray(declared) ? declared.filter((name3) => typeof name3 === "string") : [];
|
|
35466
35464
|
}
|
|
35467
35465
|
function buildSwiftBundleFiles(packagePath, hosted, inputs, resourceBundles) {
|
|
35468
|
-
packagePath =
|
|
35466
|
+
packagePath = import_node_fs51.default.realpathSync(packagePath);
|
|
35469
35467
|
const limits = inputLimits(hosted);
|
|
35470
35468
|
const relative2 = resourceCandidateFiles(packagePath).map(
|
|
35471
35469
|
(file) => import_node_path52.default.relative(packagePath, file).split(import_node_path52.default.sep).join(import_node_path52.default.posix.sep)
|
|
@@ -35569,14 +35567,14 @@ function buildSwiftBundleFiles(packagePath, hosted, inputs, resourceBundles) {
|
|
|
35569
35567
|
}
|
|
35570
35568
|
}
|
|
35571
35569
|
if (xcode?.app.postBundleScripts.length) {
|
|
35572
|
-
const dir =
|
|
35570
|
+
const dir = import_node_fs51.default.mkdtempSync(import_node_path52.default.join(import_node_os13.default.tmpdir(), "peach-xcode-bundle-"));
|
|
35573
35571
|
const wrapper = import_node_path52.default.basename(xcode.app.settings("UNLOCALIZED_RESOURCES_FOLDER_PATH")) || `${xcode.app.name}.app`;
|
|
35574
35572
|
const bundle = import_node_path52.default.join(dir, wrapper);
|
|
35575
35573
|
try {
|
|
35576
35574
|
for (const [name3, encoded] of Object.entries(files2)) {
|
|
35577
35575
|
const destination = import_node_path52.default.join(bundle, name3);
|
|
35578
|
-
|
|
35579
|
-
|
|
35576
|
+
import_node_fs51.default.mkdirSync(import_node_path52.default.dirname(destination), { recursive: true });
|
|
35577
|
+
import_node_fs51.default.writeFileSync(destination, Buffer.from(encoded, "base64"));
|
|
35580
35578
|
}
|
|
35581
35579
|
for (const phase of xcode.app.postBundleScripts) {
|
|
35582
35580
|
const env = {
|
|
@@ -35611,21 +35609,21 @@ function buildSwiftBundleFiles(packagePath, hosted, inputs, resourceBundles) {
|
|
|
35611
35609
|
}
|
|
35612
35610
|
for (const key2 of Object.keys(files2)) delete files2[key2];
|
|
35613
35611
|
total = 0;
|
|
35614
|
-
for (const entry of
|
|
35612
|
+
for (const entry of import_node_fs51.default.readdirSync(bundle, {
|
|
35615
35613
|
recursive: true,
|
|
35616
35614
|
withFileTypes: true
|
|
35617
35615
|
})) {
|
|
35618
35616
|
if (!entry.isFile()) continue;
|
|
35619
35617
|
const file = import_node_path52.default.join(entry.parentPath, entry.name);
|
|
35620
35618
|
const name3 = import_node_path52.default.relative(bundle, file).split(import_node_path52.default.sep).join("/");
|
|
35621
|
-
if (
|
|
35619
|
+
if (import_node_fs51.default.statSync(file).size > limits.resourceBytes)
|
|
35622
35620
|
throw new Error(
|
|
35623
35621
|
`swift bundle resource ${name3} exceeds ${limits.resourceBytes} bytes`
|
|
35624
35622
|
);
|
|
35625
|
-
addFile(name3,
|
|
35623
|
+
addFile(name3, import_node_fs51.default.readFileSync(file));
|
|
35626
35624
|
}
|
|
35627
35625
|
} finally {
|
|
35628
|
-
|
|
35626
|
+
import_node_fs51.default.rmSync(dir, { recursive: true, force: true });
|
|
35629
35627
|
}
|
|
35630
35628
|
}
|
|
35631
35629
|
return { files: files2, bundles, watched };
|
|
@@ -35635,7 +35633,7 @@ function serveSwiftResource(project, key2) {
|
|
|
35635
35633
|
}
|
|
35636
35634
|
function linkedModuleRoots(packagePath) {
|
|
35637
35635
|
if (privateSwiftDistributionRoot()) return [];
|
|
35638
|
-
packagePath =
|
|
35636
|
+
packagePath = import_node_fs51.default.realpathSync(packagePath);
|
|
35639
35637
|
let manifest;
|
|
35640
35638
|
try {
|
|
35641
35639
|
manifest = readPackageFile2(
|
|
@@ -35650,7 +35648,7 @@ function linkedModuleRoots(packagePath) {
|
|
|
35650
35648
|
const dependency = /\.package\(\s*path:\s*"([^"]+)"\s*\)/g;
|
|
35651
35649
|
for (const match of manifest.replace(/^\s*\/\/.*$/gm, "").matchAll(dependency)) {
|
|
35652
35650
|
const root = import_node_path52.default.resolve(packagePath, match[1]);
|
|
35653
|
-
if (
|
|
35651
|
+
if (import_node_fs51.default.existsSync(import_node_path52.default.join(root, "Package.swift"))) roots.add(root);
|
|
35654
35652
|
}
|
|
35655
35653
|
return [...roots].sort();
|
|
35656
35654
|
}
|
|
@@ -35671,7 +35669,7 @@ function sourceStamp(packagePath, moduleRootOverride, hosted = false) {
|
|
|
35671
35669
|
const projectInputs = new Set(packageFiles(packagePath));
|
|
35672
35670
|
for (const file of [...projectInputs].sort()) {
|
|
35673
35671
|
hash.update(import_node_path52.default.relative(packagePath, file));
|
|
35674
|
-
const stat =
|
|
35672
|
+
const stat = import_node_fs51.default.statSync(file);
|
|
35675
35673
|
hash.update(`${stat.mtimeMs}/${stat.ctimeMs}/${stat.size}`);
|
|
35676
35674
|
}
|
|
35677
35675
|
hash.update(moduleStamp(packagePath, moduleRootOverride, hosted));
|
|
@@ -35679,14 +35677,14 @@ function sourceStamp(packagePath, moduleRootOverride, hosted = false) {
|
|
|
35679
35677
|
}
|
|
35680
35678
|
function moduleStamp(packagePath, moduleRootOverride, hosted) {
|
|
35681
35679
|
const moduleRoot = hosted ? void 0 : moduleRootOverride ?? linkedModuleRoots(packagePath).find(
|
|
35682
|
-
(root) =>
|
|
35680
|
+
(root) => import_node_fs51.default.existsSync(import_node_path52.default.join(root, "toolchain.json"))
|
|
35683
35681
|
);
|
|
35684
35682
|
if (!moduleRoot) return "";
|
|
35685
35683
|
const hash = (0, import_node_crypto28.createHash)("sha256");
|
|
35686
35684
|
hash.update(moduleRoot);
|
|
35687
35685
|
for (const relative2 of swiftModuleInputFiles(moduleRoot)) {
|
|
35688
35686
|
hash.update(relative2);
|
|
35689
|
-
hash.update(String(
|
|
35687
|
+
hash.update(String(import_node_fs51.default.statSync(import_node_path52.default.join(moduleRoot, relative2)).mtimeMs));
|
|
35690
35688
|
}
|
|
35691
35689
|
return hash.digest("hex");
|
|
35692
35690
|
}
|
|
@@ -35746,7 +35744,7 @@ function packageSources(packagePath, hosted = false, linked = /* @__PURE__ */ ne
|
|
|
35746
35744
|
}
|
|
35747
35745
|
function packageSnapshot(project, entry, moduleRoot) {
|
|
35748
35746
|
const layout2 = xcodeLayout(project.packagePath);
|
|
35749
|
-
const pin2 = moduleRoot ? swiftDistributionAt(moduleRoot) ?? JSON.parse(
|
|
35747
|
+
const pin2 = moduleRoot ? swiftDistributionAt(moduleRoot) ?? JSON.parse(import_node_fs51.default.readFileSync(import_node_path52.default.join(moduleRoot, "toolchain.json"), "utf8")) : null;
|
|
35750
35748
|
const linked = layout2 ? standinLibraries(
|
|
35751
35749
|
layout2.binaries,
|
|
35752
35750
|
layout2.standins,
|
|
@@ -35768,10 +35766,10 @@ function packageSnapshot(project, entry, moduleRoot) {
|
|
|
35768
35766
|
};
|
|
35769
35767
|
const packageReals = /* @__PURE__ */ new Map();
|
|
35770
35768
|
for (const [file, relative2] of layout2?.packageFiles ?? [])
|
|
35771
|
-
if (!
|
|
35772
|
-
packageReals.set(
|
|
35769
|
+
if (!import_node_fs51.default.lstatSync(file).isSymbolicLink())
|
|
35770
|
+
packageReals.set(import_node_fs51.default.realpathSync(file), relative2);
|
|
35773
35771
|
for (const [file, relative2] of layout2?.packageFiles ?? []) {
|
|
35774
|
-
const real =
|
|
35772
|
+
const real = import_node_fs51.default.realpathSync(file);
|
|
35775
35773
|
const target = packageReals.get(real);
|
|
35776
35774
|
if (target !== void 0 && target !== relative2 && /\.(?:h|hh|hpp|hxx)$/.test(file))
|
|
35777
35775
|
headerAliases[relative2] = target;
|
|
@@ -35790,8 +35788,8 @@ function packageSnapshot(project, entry, moduleRoot) {
|
|
|
35790
35788
|
if (swiftProjectFileProblem(relative2) !== void 0) continue;
|
|
35791
35789
|
const key2 = xcodeInputKey(layout2, file, relative2);
|
|
35792
35790
|
if (files2[key2] !== void 0) continue;
|
|
35793
|
-
const absolute =
|
|
35794
|
-
if (!
|
|
35791
|
+
const absolute = import_node_fs51.default.realpathSync(file);
|
|
35792
|
+
if (!import_node_fs51.default.statSync(absolute).isFile()) continue;
|
|
35795
35793
|
projectFiles[relative2] = readPackageFile2(
|
|
35796
35794
|
project.packagePath,
|
|
35797
35795
|
absolute,
|
|
@@ -35814,7 +35812,7 @@ function packageSnapshot(project, entry, moduleRoot) {
|
|
|
35814
35812
|
(layout2?.packages.nativePackages ?? []).flatMap(
|
|
35815
35813
|
({ manifest, guestTargets: targets }) => targets.filter((target) => target.type === "regular").flatMap(
|
|
35816
35814
|
(target) => swiftTargetFiles(manifest, target).filter((file) => file.endsWith(".swift")).flatMap(
|
|
35817
|
-
(file) => swiftImportNames(
|
|
35815
|
+
(file) => swiftImportNames(import_node_fs51.default.readFileSync(file, "utf8"))
|
|
35818
35816
|
)
|
|
35819
35817
|
)
|
|
35820
35818
|
)
|
|
@@ -35849,7 +35847,7 @@ function packageSnapshot(project, entry, moduleRoot) {
|
|
|
35849
35847
|
...Object.fromEntries(
|
|
35850
35848
|
[...linked].map(([library, [first]]) => [
|
|
35851
35849
|
first.module,
|
|
35852
|
-
|
|
35850
|
+
import_node_fs51.default.readFileSync(library).toString("base64")
|
|
35853
35851
|
])
|
|
35854
35852
|
)
|
|
35855
35853
|
}
|
|
@@ -35915,7 +35913,7 @@ async function compile(packagePath, stamp, moduleRootOverride, hosted, snapshot,
|
|
|
35915
35913
|
package: content
|
|
35916
35914
|
};
|
|
35917
35915
|
const moduleRoot = moduleRootOverride ?? linkedModuleRoots(packagePath).find(
|
|
35918
|
-
(root) =>
|
|
35916
|
+
(root) => import_node_fs51.default.existsSync(import_node_path52.default.join(root, "toolchain.json"))
|
|
35919
35917
|
) ?? await swiftDistributionRoot(signal);
|
|
35920
35918
|
const toolchain = swiftModuleToolchain(moduleRoot);
|
|
35921
35919
|
const input = snapshotCompileInput(snapshot);
|
|
@@ -36214,7 +36212,7 @@ function scopedArtifact(project, entry, moduleRoot, signal) {
|
|
|
36214
36212
|
});
|
|
36215
36213
|
}
|
|
36216
36214
|
const snapshotRoot = moduleRoot ?? xcodeProjects().get(project.packagePath)?.moduleRoot ?? linkedModuleRoots(project.packagePath).find(
|
|
36217
|
-
(root) =>
|
|
36215
|
+
(root) => import_node_fs51.default.existsSync(import_node_path52.default.join(root, "toolchain.json"))
|
|
36218
36216
|
);
|
|
36219
36217
|
const snapshot = packageSnapshot(project, entry, snapshotRoot);
|
|
36220
36218
|
const compiled = project.artifact?.compiled;
|
|
@@ -36255,7 +36253,7 @@ function scopedArtifact(project, entry, moduleRoot, signal) {
|
|
|
36255
36253
|
return fresh;
|
|
36256
36254
|
}
|
|
36257
36255
|
async function swiftPackageWatchFiles(packagePath, moduleRoot) {
|
|
36258
|
-
packagePath =
|
|
36256
|
+
packagePath = import_node_fs51.default.realpathSync(packagePath);
|
|
36259
36257
|
return withXcodeLayout(packagePath, () => [
|
|
36260
36258
|
...xcodeProjects().has(packagePath) || sourceEntries().has(packagePath) ? [] : [import_node_path52.default.join(packagePath, "Package.swift")],
|
|
36261
36259
|
...packageFiles(packagePath),
|
|
@@ -36264,7 +36262,7 @@ async function swiftPackageWatchFiles(packagePath, moduleRoot) {
|
|
|
36264
36262
|
]);
|
|
36265
36263
|
}
|
|
36266
36264
|
async function swiftPackageMetadata(packagePath, packageName, moduleRoot, origin, hosted, signal) {
|
|
36267
|
-
packagePath =
|
|
36265
|
+
packagePath = import_node_fs51.default.realpathSync(packagePath);
|
|
36268
36266
|
const project = projectFor(packagePath, hosted, signal);
|
|
36269
36267
|
const limits = inputLimits(Boolean(project.hosted));
|
|
36270
36268
|
const registered = xcodeProjects().get(packagePath);
|
|
@@ -36427,7 +36425,7 @@ async function serveSwiftPackageAsset(pathname, res) {
|
|
|
36427
36425
|
return true;
|
|
36428
36426
|
}
|
|
36429
36427
|
function disposeSwiftProject(packagePath, signal) {
|
|
36430
|
-
packagePath =
|
|
36428
|
+
packagePath = import_node_fs51.default.realpathSync(packagePath);
|
|
36431
36429
|
const project = projects().get(packagePath);
|
|
36432
36430
|
if (signal && project && project.signal !== signal) return;
|
|
36433
36431
|
projects().delete(packagePath);
|
|
@@ -36470,7 +36468,7 @@ function swiftViteLifetime(server) {
|
|
|
36470
36468
|
// src/one-widget-package.ts
|
|
36471
36469
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
36472
36470
|
var import_node_crypto30 = require("node:crypto");
|
|
36473
|
-
var
|
|
36471
|
+
var import_node_fs53 = __toESM(require("node:fs"), 1);
|
|
36474
36472
|
var import_node_os14 = __toESM(require("node:os"), 1);
|
|
36475
36473
|
var import_node_path54 = __toESM(require("node:path"), 1);
|
|
36476
36474
|
|
|
@@ -36478,7 +36476,7 @@ var import_node_path54 = __toESM(require("node:path"), 1);
|
|
|
36478
36476
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
36479
36477
|
var import_node_child_process33 = require("node:child_process");
|
|
36480
36478
|
var import_node_crypto29 = require("node:crypto");
|
|
36481
|
-
var
|
|
36479
|
+
var import_node_fs52 = __toESM(require("node:fs"), 1);
|
|
36482
36480
|
var import_node_module = require("node:module");
|
|
36483
36481
|
var import_node_path53 = __toESM(require("node:path"), 1);
|
|
36484
36482
|
var import_node_util7 = require("node:util");
|
|
@@ -36530,8 +36528,8 @@ fs.writeFileSync(process.argv[2], JSON.stringify({
|
|
|
36530
36528
|
function configStamp(files2) {
|
|
36531
36529
|
return JSON.stringify(
|
|
36532
36530
|
files2.map((file) => {
|
|
36533
|
-
if (!
|
|
36534
|
-
const stat =
|
|
36531
|
+
if (!import_node_fs52.default.existsSync(file)) return [file, null];
|
|
36532
|
+
const stat = import_node_fs52.default.statSync(file);
|
|
36535
36533
|
return [file, stat.mtimeMs, stat.ctimeMs, stat.size];
|
|
36536
36534
|
})
|
|
36537
36535
|
);
|
|
@@ -36544,11 +36542,11 @@ async function readConfig(root) {
|
|
|
36544
36542
|
const promise = (async () => {
|
|
36545
36543
|
(0, import_node_module.createRequire)(import_node_path53.default.join(root, "package.json")).resolve("one/vite");
|
|
36546
36544
|
const cache = import_node_path53.default.join(root, "node_modules/.cache/peach-widget-config");
|
|
36547
|
-
|
|
36548
|
-
const directory =
|
|
36545
|
+
import_node_fs52.default.mkdirSync(cache, { recursive: true });
|
|
36546
|
+
const directory = import_node_fs52.default.mkdtempSync(import_node_path53.default.join(cache, "read-"));
|
|
36549
36547
|
const script = import_node_path53.default.join(directory, "read.mjs");
|
|
36550
36548
|
const result = import_node_path53.default.join(directory, "result.json");
|
|
36551
|
-
|
|
36549
|
+
import_node_fs52.default.writeFileSync(script, CONFIG_CHILD);
|
|
36552
36550
|
try {
|
|
36553
36551
|
await run4(process.execPath, [script, result], {
|
|
36554
36552
|
cwd: root,
|
|
@@ -36556,7 +36554,7 @@ async function readConfig(root) {
|
|
|
36556
36554
|
timeout: 3e4,
|
|
36557
36555
|
maxBuffer: 1024 * 1024
|
|
36558
36556
|
});
|
|
36559
|
-
const value = JSON.parse(
|
|
36557
|
+
const value = JSON.parse(import_node_fs52.default.readFileSync(result, "utf8"));
|
|
36560
36558
|
if (!isRecord(value) || !Array.isArray(value.watched) || !value.watched.every((file) => typeof file === "string"))
|
|
36561
36559
|
throw new Error("One config loader returned invalid dependencies");
|
|
36562
36560
|
if (!Array.isArray(value.urlSchemes) || !value.urlSchemes.every(
|
|
@@ -36592,7 +36590,7 @@ async function readConfig(root) {
|
|
|
36592
36590
|
configs.set(root, loaded2);
|
|
36593
36591
|
return loaded2;
|
|
36594
36592
|
} finally {
|
|
36595
|
-
|
|
36593
|
+
import_node_fs52.default.rmSync(directory, { recursive: true, force: true });
|
|
36596
36594
|
}
|
|
36597
36595
|
})();
|
|
36598
36596
|
reads.set(root, promise);
|
|
@@ -36613,7 +36611,7 @@ function declaredFamilies(source) {
|
|
|
36613
36611
|
return home;
|
|
36614
36612
|
}
|
|
36615
36613
|
async function readOneWidgetSources(appRoot) {
|
|
36616
|
-
const root =
|
|
36614
|
+
const root = import_node_fs52.default.realpathSync(appRoot);
|
|
36617
36615
|
const config = await readConfig(root);
|
|
36618
36616
|
if (!config.widget) return null;
|
|
36619
36617
|
const widget = config.widget;
|
|
@@ -36629,7 +36627,7 @@ async function readOneWidgetSources(appRoot) {
|
|
|
36629
36627
|
const files2 = /* @__PURE__ */ new Map();
|
|
36630
36628
|
const sources = {};
|
|
36631
36629
|
for (const [name3, file] of Object.entries(sourceFiles2)) {
|
|
36632
|
-
if (!
|
|
36630
|
+
if (!import_node_fs52.default.existsSync(file))
|
|
36633
36631
|
throw new Error(`missing One widget prebuild source ${file}; run one prebuild`);
|
|
36634
36632
|
const bytes = readPackageFile(root, file, MAX_SWIFT_COMPILE_SOURCE_BYTES);
|
|
36635
36633
|
const text5 = bytes.toString("utf8");
|
|
@@ -36679,7 +36677,7 @@ async function oneWidgetPackage(appRoot) {
|
|
|
36679
36677
|
(0, import_node_crypto30.createHash)("sha256").update(root).digest("hex"),
|
|
36680
36678
|
ONE_WIDGET_PACKAGE
|
|
36681
36679
|
);
|
|
36682
|
-
|
|
36680
|
+
import_node_fs53.default.mkdirSync(packagePath, { recursive: true });
|
|
36683
36681
|
syncSwiftTree(
|
|
36684
36682
|
packagePath,
|
|
36685
36683
|
new Map([...files2].map(([file, text5]) => [import_node_path54.default.join(packagePath, file), text5]))
|
|
@@ -36708,7 +36706,7 @@ function packageFor(file) {
|
|
|
36708
36706
|
let dir = import_node_path55.default.dirname(file);
|
|
36709
36707
|
const stop = devServer?.config.root;
|
|
36710
36708
|
for (; ; ) {
|
|
36711
|
-
if (
|
|
36709
|
+
if (import_node_fs54.default.existsSync(import_node_path55.default.join(dir, "Package.swift"))) return dir;
|
|
36712
36710
|
if (stop !== void 0 && dir === stop || import_node_path55.default.dirname(dir) === dir) break;
|
|
36713
36711
|
dir = import_node_path55.default.dirname(dir);
|
|
36714
36712
|
}
|
|
@@ -36734,7 +36732,7 @@ function swiftPlugin(options = {}) {
|
|
|
36734
36732
|
if (importer && (source.startsWith("./") || source.startsWith("../"))) {
|
|
36735
36733
|
const raw2 = import_node_path55.default.resolve(import_node_path55.default.dirname(importer.split("?")[0] ?? importer), source);
|
|
36736
36734
|
try {
|
|
36737
|
-
if (
|
|
36735
|
+
if (import_node_fs54.default.realpathSync(raw2) === import_node_fs54.default.realpathSync(resolved.id)) id = raw2;
|
|
36738
36736
|
} catch {
|
|
36739
36737
|
}
|
|
36740
36738
|
}
|
|
@@ -36745,7 +36743,7 @@ function swiftPlugin(options = {}) {
|
|
|
36745
36743
|
const owner = lifetime;
|
|
36746
36744
|
owner?.signal.throwIfAborted();
|
|
36747
36745
|
const file = id.slice(VIRTUAL_PREFIX.length);
|
|
36748
|
-
if (!
|
|
36746
|
+
if (!import_node_fs54.default.existsSync(file)) throw new Error(`swift source ${file} no longer exists`);
|
|
36749
36747
|
const packagePath = options.packagePath ?? packageFor(file);
|
|
36750
36748
|
const project = projectFor(packagePath, void 0, owner?.signal);
|
|
36751
36749
|
owner?.projects.add(project.packagePath);
|
|
@@ -36757,7 +36755,7 @@ function swiftPlugin(options = {}) {
|
|
|
36757
36755
|
this.addWatchFile(source);
|
|
36758
36756
|
this.addWatchFile(import_node_path55.default.join(packagePath, "Package.swift"));
|
|
36759
36757
|
const moduleRoot = linkedModuleRoots(packagePath).find(
|
|
36760
|
-
(root) =>
|
|
36758
|
+
(root) => import_node_fs54.default.existsSync(import_node_path55.default.join(root, "toolchain.json"))
|
|
36761
36759
|
);
|
|
36762
36760
|
if (moduleRoot)
|
|
36763
36761
|
for (const relative2 of swiftModuleInputFiles(moduleRoot))
|