peachsim 0.1.2242 → 0.1.2244
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/binary-sidecar.ts +89 -0
- package/cli/bridge-flow-runner.ts +2 -2
- package/cli/cloud-client.ts +2 -0
- package/cli/commands/control.ts +16 -0
- package/cli/commands/device.ts +1 -1
- package/cli/commands/flow.ts +6 -2
- package/cli/commands/inspect/core.ts +0 -20
- package/cli/commands/inspect/settling.ts +15 -2
- package/cli/commands/inspect.ts +5 -5
- package/cli/commands/preview.ts +12 -5
- package/cli/commands/shell-boolean-mode.ts +1 -1
- package/cli/commands/slides.ts +1 -1
- 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 +94 -15
- 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 +16 -5
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +93 -14
- 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 +121 -28
- package/dist-lib/host/fetch-proxy-handler.cjs +3 -3
- 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 +18 -7
- 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 +11 -2
- package/dist-lib/menu.mjs +11 -2
- 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 +3 -3
- package/dist-lib/native-app-identity-project.cjs +2 -2
- package/dist-lib/native-app-identity-project.mjs +2 -2
- 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 +55 -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 +16 -24
- package/dist-lib/sdk.mjs +16 -22
- package/dist-lib/skills.cjs +973 -755
- package/dist-lib/swift-compile.cjs +4 -3
- package/dist-lib/swift-compile.mjs +4 -3
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +2 -2
- package/dist-lib/swift-submit.mjs +2 -2
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +485 -405
- package/dist-lib/vite.cjs +3 -3
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/liquid-glass.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/native-layout.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/scene-table.d.ts +1 -0
- package/dist-types/packages/peach-kit/src/capabilities.d.ts +1 -1
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +1 -1
- package/src/binarySidecarContract.ts +45 -0
- package/src/host/bridge-host.ts +12 -13
- package/src/menu.ts +14 -0
- package/src/native-static-libraries.ts +82 -1
- package/src/swift-host.ts +6 -7
- package/src/swift-standins.ts +11 -4
- package/src/swift-submit.ts +3 -1
- package/src/swift-wasm-prune.ts +23 -0
package/dist-lib/vite-swift.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2244 | (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_fs58 = __toESM(require("node:fs"), 1);
|
|
1184
1184
|
var import_node_path58 = __toESM(require("node:path"), 1);
|
|
1185
1185
|
|
|
1186
1186
|
// ../sootsim-swift/src/bundleAssets.ts
|
|
@@ -10158,7 +10158,7 @@ function patchSwiftrtObject(src) {
|
|
|
10158
10158
|
}
|
|
10159
10159
|
return buf;
|
|
10160
10160
|
}
|
|
10161
|
-
function parseWasmObjectBytes(file, buf, isDist) {
|
|
10161
|
+
function parseWasmObjectBytes(file, buf, isDist, symbolFlagOffsets) {
|
|
10162
10162
|
let pos = 8;
|
|
10163
10163
|
let numImportFuncs = 0;
|
|
10164
10164
|
const importFuncNames = [];
|
|
@@ -10314,6 +10314,7 @@ function parseWasmObjectBytes(file, buf, isDist) {
|
|
|
10314
10314
|
let cur = p2;
|
|
10315
10315
|
for (let i = 0; i < cnt; i++) {
|
|
10316
10316
|
const kind = buf[cur++];
|
|
10317
|
+
if (symbolFlagOffsets) symbolFlagOffsets[i] = cur;
|
|
10317
10318
|
const [fl, c2] = readULEB2(buf, cur);
|
|
10318
10319
|
cur = c2;
|
|
10319
10320
|
symKind[i] = kind;
|
|
@@ -10571,6 +10572,23 @@ function parseWasmObjectCached(file, isDist, useCache) {
|
|
|
10571
10572
|
if (useCache) parsedObjectCache.set(key2, parsed);
|
|
10572
10573
|
return parsed;
|
|
10573
10574
|
}
|
|
10575
|
+
function localizeDefinedWasmSymbols(bytes, names) {
|
|
10576
|
+
const offsets = [];
|
|
10577
|
+
const object4 = parseWasmObjectBytes("", bytes, false, offsets);
|
|
10578
|
+
const output2 = Uint8Array.from(bytes);
|
|
10579
|
+
let changed = 0;
|
|
10580
|
+
for (let index = 0; index < object4.symNames.length; index++) {
|
|
10581
|
+
if (!names.has(object4.symNames[index])) continue;
|
|
10582
|
+
if ((object4.symFlags[index] & 3) === 2) continue;
|
|
10583
|
+
if (object4.symFlags[index] & 16)
|
|
10584
|
+
throw new Error("cannot localize an undefined symbol");
|
|
10585
|
+
const offset = offsets[index];
|
|
10586
|
+
output2[offset] = output2[offset] & ~35 | 2;
|
|
10587
|
+
changed++;
|
|
10588
|
+
}
|
|
10589
|
+
if (changed !== names.size) throw new Error("Wasm symbols to localize were not defined");
|
|
10590
|
+
return output2;
|
|
10591
|
+
}
|
|
10574
10592
|
function guestWasmSymbols(bytes) {
|
|
10575
10593
|
const object4 = parseWasmObjectBytes("", bytes, false);
|
|
10576
10594
|
return {
|
|
@@ -17838,7 +17856,7 @@ var darwinRecordsRegion = (quoted2) => quoted2.length ? ["-Wl,--start-lib", ...q
|
|
|
17838
17856
|
var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
|
|
17839
17857
|
var MULTI_MANIFEST_VERSION = 68;
|
|
17840
17858
|
var SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
|
|
17841
|
-
var compilerSourceDigest = true ? "
|
|
17859
|
+
var compilerSourceDigest = true ? "b60df189803fef5c8b8fd902ae0a694ffbefe056af8f5fc06f707750dc97f09b" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
|
|
17842
17860
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
17843
17861
|
const hash = (0, import_node_crypto13.createHash)("sha256");
|
|
17844
17862
|
hash.update(`swift-compile
|
|
@@ -22273,9 +22291,9 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
22273
22291
|
// src/swift-host.ts
|
|
22274
22292
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
22275
22293
|
var import_node_async_hooks = require("node:async_hooks");
|
|
22276
|
-
var
|
|
22294
|
+
var import_node_child_process35 = require("node:child_process");
|
|
22277
22295
|
var import_node_crypto30 = require("node:crypto");
|
|
22278
|
-
var
|
|
22296
|
+
var import_node_fs55 = __toESM(require("node:fs"), 1);
|
|
22279
22297
|
var import_node_os14 = __toESM(require("node:os"), 1);
|
|
22280
22298
|
var import_node_path55 = __toESM(require("node:path"), 1);
|
|
22281
22299
|
|
|
@@ -30329,9 +30347,9 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
30329
30347
|
|
|
30330
30348
|
// src/swift-cxx-reachable.ts
|
|
30331
30349
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
30332
|
-
var
|
|
30350
|
+
var import_node_child_process33 = require("node:child_process");
|
|
30333
30351
|
var import_node_crypto28 = require("node:crypto");
|
|
30334
|
-
var
|
|
30352
|
+
var import_node_fs52 = __toESM(require("node:fs"), 1);
|
|
30335
30353
|
var import_node_path52 = __toESM(require("node:path"), 1);
|
|
30336
30354
|
|
|
30337
30355
|
// src/swift-cxx-deps.ts
|
|
@@ -30380,9 +30398,9 @@ function cxxContextFlags(args) {
|
|
|
30380
30398
|
|
|
30381
30399
|
// src/swift-objc-compile.ts
|
|
30382
30400
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
30383
|
-
var
|
|
30401
|
+
var import_node_child_process32 = require("node:child_process");
|
|
30384
30402
|
var import_node_crypto27 = require("node:crypto");
|
|
30385
|
-
var
|
|
30403
|
+
var import_node_fs51 = __toESM(require("node:fs"), 1);
|
|
30386
30404
|
var import_node_path51 = __toESM(require("node:path"), 1);
|
|
30387
30405
|
|
|
30388
30406
|
// ../../src/helpers/mapLimit.ts
|
|
@@ -30477,7 +30495,7 @@ var MAX_SWIFT_COMPILE_METAL_TOTAL_BYTES = 8 * 1024 * 1024;
|
|
|
30477
30495
|
var MAX_SWIFT_COMPILE_IMAGES = 256;
|
|
30478
30496
|
var MAX_SWIFT_COMPILE_IMAGE_BYTES = 4 * 1024 * 1024;
|
|
30479
30497
|
var MAX_SWIFT_COMPILE_IMAGE_TOTAL_BYTES = 16 * 1024 * 1024;
|
|
30480
|
-
var SWIFT_HOST_ABI =
|
|
30498
|
+
var SWIFT_HOST_ABI = 72;
|
|
30481
30499
|
var POLL_INTERVAL_MS = 1500;
|
|
30482
30500
|
function swiftNativeEntry(native, file) {
|
|
30483
30501
|
return {
|
|
@@ -31453,13 +31471,13 @@ function sourceClosureDigest(srcDir, entrypoints) {
|
|
|
31453
31471
|
return hash.digest("hex");
|
|
31454
31472
|
}
|
|
31455
31473
|
var standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
|
|
31456
|
-
var STANDIN_SOURCE_DIGEST = true ? "
|
|
31474
|
+
var STANDIN_SOURCE_DIGEST = true ? "9d24428078636d005cc1401363f5f50704e049f52802b0493da7eea674470942" : standinSourceDigest();
|
|
31457
31475
|
|
|
31458
31476
|
// src/swift-standins.ts
|
|
31459
31477
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
31460
|
-
var
|
|
31478
|
+
var import_node_child_process31 = require("node:child_process");
|
|
31461
31479
|
var import_node_crypto26 = require("node:crypto");
|
|
31462
|
-
var
|
|
31480
|
+
var import_node_fs50 = __toESM(require("node:fs"), 1);
|
|
31463
31481
|
var import_node_path50 = __toESM(require("node:path"), 1);
|
|
31464
31482
|
|
|
31465
31483
|
// src/forked-script-contract.ts
|
|
@@ -31590,7 +31608,9 @@ function nativeSliceEntry(recipe, release, sdk) {
|
|
|
31590
31608
|
|
|
31591
31609
|
// src/native-static-libraries.ts
|
|
31592
31610
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
31611
|
+
var import_node_child_process28 = require("node:child_process");
|
|
31593
31612
|
var import_node_crypto24 = require("node:crypto");
|
|
31613
|
+
var import_node_fs45 = __toESM(require("node:fs"), 1);
|
|
31594
31614
|
var import_node_path46 = __toESM(require("node:path"), 1);
|
|
31595
31615
|
|
|
31596
31616
|
// src/swift-xcframework.ts
|
|
@@ -31674,6 +31694,7 @@ var NATIVE_STATIC_LIBRARY_RECIPES = [
|
|
|
31674
31694
|
},
|
|
31675
31695
|
{
|
|
31676
31696
|
name: "anydoc_mobile",
|
|
31697
|
+
runtime: "rust",
|
|
31677
31698
|
nativeSha256: "03b721dd9e98ec2767f7952aa65cde57d0c33d7ec80c9aaf7ab5ba77e055a25c",
|
|
31678
31699
|
upstream: "e41ad6375fd80b64c4183d1a3f901d1f640a7953",
|
|
31679
31700
|
recipe: "c180538533a79fe1c8babda204170806abe80dd4a546689dcc34c109c9fbfcfc",
|
|
@@ -31681,6 +31702,7 @@ var NATIVE_STATIC_LIBRARY_RECIPES = [
|
|
|
31681
31702
|
},
|
|
31682
31703
|
{
|
|
31683
31704
|
name: "ratex_ffi",
|
|
31705
|
+
runtime: "rust",
|
|
31684
31706
|
nativeSha256: "8c41abcd8dd4e562e65cf5b88467a3493089c359d0863360dc65a5b88149e837",
|
|
31685
31707
|
upstream: "a4296fa21cd40a56543602511bcf417014f4fee7cf5e1eaab58e0ac9610e3f63",
|
|
31686
31708
|
// the unchanged source build, pinned Rust release and committed Cargo.lock.
|
|
@@ -31689,6 +31711,7 @@ var NATIVE_STATIC_LIBRARY_RECIPES = [
|
|
|
31689
31711
|
},
|
|
31690
31712
|
{
|
|
31691
31713
|
name: "ratex_ffi_0_1_14",
|
|
31714
|
+
runtime: "rust",
|
|
31692
31715
|
nativeSha256: "bdd2bf679fcc981d98d36733b3bd083225a7397bb82bbd462c89088c6e0580a8",
|
|
31693
31716
|
upstream: "2da907eb5dfcb464c7eef3b4c657fbdee144e3c6633e81efb1e56dcf1c76e01b",
|
|
31694
31717
|
recipe: "537054295b8230548b3959b38459af2606cae69b226e37f6a2e0c227a8ad3cb1",
|
|
@@ -31848,14 +31871,70 @@ function nativeStaticLibrary(file, recipe, moduleRoot) {
|
|
|
31848
31871
|
throw new Error(
|
|
31849
31872
|
`${file}: native WebAssembly archive ${entry.name}/${entry.key} is not built for this compiler and SDK`
|
|
31850
31873
|
);
|
|
31851
|
-
|
|
31874
|
+
const archive = import_node_path46.default.join(dir, recipe.archive);
|
|
31875
|
+
return "runtime" in recipe ? rustStaticLibrary(archive, moduleRoot) : archive;
|
|
31876
|
+
}
|
|
31877
|
+
function isRustSymbol(name3, demangled) {
|
|
31878
|
+
return (name3.startsWith("_R") || /^_ZN.*17h[0-9a-f]{16}E$/.test(name3)) && demangled !== name3 || name3 === "rust_eh_personality" || name3 === "__getrandom_v03_custom";
|
|
31879
|
+
}
|
|
31880
|
+
function rustStaticLibrary(file, moduleRoot) {
|
|
31881
|
+
const toolchain = swiftModuleToolchain(moduleRoot);
|
|
31882
|
+
const key2 = (0, import_node_crypto24.createHash)("sha256").update("rust-c-abi-v2\0").update(toolchain.release).update("\0").update(import_node_fs45.default.readFileSync(file)).digest("hex");
|
|
31883
|
+
const directory = import_node_path46.default.join(cacheDir(), "native-archives", key2);
|
|
31884
|
+
const archive = import_node_path46.default.join(directory, "library.a");
|
|
31885
|
+
if (import_node_fs45.default.existsSync(archive)) return archive;
|
|
31886
|
+
const flags = ["--no-sort", "--extern-only", "--defined-only", "--format=just-symbols"];
|
|
31887
|
+
const options = { encoding: "utf8", maxBuffer: 64 * 1024 * 1024 };
|
|
31888
|
+
const symbols = (input) => {
|
|
31889
|
+
const raw2 = (0, import_node_child_process28.execFileSync)(
|
|
31890
|
+
import_node_path46.default.join(toolchain.toolchainBin, "llvm-nm"),
|
|
31891
|
+
[...flags, input],
|
|
31892
|
+
options
|
|
31893
|
+
).trim().split("\n");
|
|
31894
|
+
const demangled = (0, import_node_child_process28.execFileSync)(
|
|
31895
|
+
import_node_path46.default.join(toolchain.toolchainBin, "llvm-nm"),
|
|
31896
|
+
[...flags, "--demangle", input],
|
|
31897
|
+
options
|
|
31898
|
+
).trim().split("\n");
|
|
31899
|
+
if (raw2.length !== demangled.length)
|
|
31900
|
+
throw new Error(`${file}: Rust symbol table changed during intake`);
|
|
31901
|
+
return raw2.map((name3, index) => ({ name: name3, demangled: demangled[index] }));
|
|
31902
|
+
};
|
|
31903
|
+
if (!symbols(file).some(({ name: name3, demangled }) => isRustSymbol(name3, demangled)))
|
|
31904
|
+
return file;
|
|
31905
|
+
import_node_fs45.default.mkdirSync(directory, { recursive: true });
|
|
31906
|
+
const stage = import_node_fs45.default.mkdtempSync(import_node_path46.default.join(directory, "build-"));
|
|
31907
|
+
try {
|
|
31908
|
+
const object4 = import_node_path46.default.join(stage, "library.o");
|
|
31909
|
+
(0, import_node_child_process28.execFileSync)(import_node_path46.default.join(toolchain.toolchainBin, "wasm-ld"), [
|
|
31910
|
+
"-mwasm64",
|
|
31911
|
+
"-r",
|
|
31912
|
+
"--whole-archive",
|
|
31913
|
+
file,
|
|
31914
|
+
"--no-whole-archive",
|
|
31915
|
+
"-o",
|
|
31916
|
+
object4
|
|
31917
|
+
]);
|
|
31918
|
+
const names = new Set(
|
|
31919
|
+
symbols(object4).filter(
|
|
31920
|
+
({ name: name3, demangled }) => isRustSymbol(name3, demangled) || name3.startsWith("anon.")
|
|
31921
|
+
).map(({ name: name3 }) => name3)
|
|
31922
|
+
);
|
|
31923
|
+
import_node_fs45.default.writeFileSync(object4, localizeDefinedWasmSymbols(import_node_fs45.default.readFileSync(object4), names));
|
|
31924
|
+
const output2 = import_node_path46.default.join(stage, "library.a");
|
|
31925
|
+
(0, import_node_child_process28.execFileSync)(import_node_path46.default.join(toolchain.toolchainBin, "llvm-ar"), ["rcsD", output2, object4]);
|
|
31926
|
+
import_node_fs45.default.renameSync(output2, archive);
|
|
31927
|
+
} finally {
|
|
31928
|
+
import_node_fs45.default.rmSync(stage, { recursive: true, force: true });
|
|
31929
|
+
}
|
|
31930
|
+
return archive;
|
|
31852
31931
|
}
|
|
31853
31932
|
|
|
31854
31933
|
// src/native-swift-slices.ts
|
|
31855
31934
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
31856
|
-
var
|
|
31935
|
+
var import_node_child_process29 = require("node:child_process");
|
|
31857
31936
|
var import_node_crypto25 = require("node:crypto");
|
|
31858
|
-
var
|
|
31937
|
+
var import_node_fs46 = __toESM(require("node:fs"), 1);
|
|
31859
31938
|
var import_node_os12 = __toESM(require("node:os"), 1);
|
|
31860
31939
|
var import_node_path47 = __toESM(require("node:path"), 1);
|
|
31861
31940
|
var SENTRY_SWIFT_SLICE = {
|
|
@@ -31884,17 +31963,17 @@ function nativeSwiftSliceEntry(distribution, generator) {
|
|
|
31884
31963
|
}
|
|
31885
31964
|
function privateSentrySlice(entry, moduleRoot) {
|
|
31886
31965
|
const privateRoot = privateSwiftDistributionRoot();
|
|
31887
|
-
if (!privateRoot ||
|
|
31966
|
+
if (!privateRoot || import_node_fs46.default.realpathSync(privateRoot) !== import_node_fs46.default.realpathSync(moduleRoot))
|
|
31888
31967
|
return null;
|
|
31889
31968
|
const script = import_node_path47.default.join(sourceSwiftCheckout(), "scripts/build-sentry-wasi.ts");
|
|
31890
|
-
if (!
|
|
31969
|
+
if (!import_node_fs46.default.existsSync(script))
|
|
31891
31970
|
throw new Error(
|
|
31892
31971
|
"the Sentry slice for a private Swift distribution builds from a Contrast source checkout"
|
|
31893
31972
|
);
|
|
31894
|
-
const staging =
|
|
31973
|
+
const staging = import_node_fs46.default.mkdtempSync(import_node_path47.default.join(import_node_fs46.default.realpathSync(import_node_os12.default.tmpdir()), "sentry-slice-"));
|
|
31895
31974
|
try {
|
|
31896
31975
|
process.stderr.write("peach: building the Sentry slice for a private distribution\u2026\n");
|
|
31897
|
-
(0,
|
|
31976
|
+
(0, import_node_child_process29.execFileSync)("bun", [script, "--output", staging, "--module-root", moduleRoot], {
|
|
31898
31977
|
cwd: import_node_path47.default.resolve(sourceSwiftCheckout(), "../.."),
|
|
31899
31978
|
stdio: ["ignore", 2, 2]
|
|
31900
31979
|
});
|
|
@@ -31905,13 +31984,13 @@ function privateSentrySlice(entry, moduleRoot) {
|
|
|
31905
31984
|
import_node_path47.default.join(staging, nativeEntryPrefix("slice", entry.name, entry.key))
|
|
31906
31985
|
);
|
|
31907
31986
|
} finally {
|
|
31908
|
-
|
|
31987
|
+
import_node_fs46.default.rmSync(staging, { recursive: true, force: true });
|
|
31909
31988
|
}
|
|
31910
31989
|
}
|
|
31911
31990
|
function nativeSwiftSlice(standin, moduleRoot, generator, configured, artifact) {
|
|
31912
31991
|
if (standin.module !== SENTRY_SWIFT_SLICE.name) return standin;
|
|
31913
31992
|
const native = simulatorNativeLibrary(artifact());
|
|
31914
|
-
if (!native || (0, import_node_crypto25.createHash)("sha256").update(
|
|
31993
|
+
if (!native || (0, import_node_crypto25.createHash)("sha256").update(import_node_fs46.default.readFileSync(native.file)).digest("hex") !== SENTRY_SWIFT_SLICE.nativeSha256)
|
|
31915
31994
|
return standin;
|
|
31916
31995
|
if (configured)
|
|
31917
31996
|
throw new Error(
|
|
@@ -31925,16 +32004,16 @@ function nativeSwiftSlice(standin, moduleRoot, generator, configured, artifact)
|
|
|
31925
32004
|
throw new Error(
|
|
31926
32005
|
`native Swift slice ${entry.name}/${entry.key} is not built for this compiler and SDK`
|
|
31927
32006
|
);
|
|
31928
|
-
const header =
|
|
32007
|
+
const header = import_node_fs46.default.readFileSync(
|
|
31929
32008
|
import_node_path47.default.join(directory, `${standin.module}-Swift.h`),
|
|
31930
32009
|
"utf8"
|
|
31931
32010
|
);
|
|
31932
32011
|
const declared = swiftInterfaceDeclarations(header);
|
|
31933
32012
|
const headers = import_node_path47.default.join(import_node_path47.default.dirname(native.file), "Headers");
|
|
31934
|
-
const originals =
|
|
32013
|
+
const originals = import_node_fs46.default.readdirSync(headers).filter((file) => file.endsWith(".h") && file !== `${standin.module}-Swift.h`);
|
|
31935
32014
|
const enums = /* @__PURE__ */ new Map();
|
|
31936
32015
|
for (const file of originals)
|
|
31937
|
-
for (const match of
|
|
32016
|
+
for (const match of import_node_fs46.default.readFileSync(import_node_path47.default.join(headers, file), "utf8").matchAll(/typedef\s+(?:NS_ENUM|NS_OPTIONS)\s*\(\s*\w+\s*,\s*(\w+)\s*\)\s*\{/g))
|
|
31938
32017
|
enums.set(match[1], file);
|
|
31939
32018
|
const files2 = {
|
|
31940
32019
|
[`${standin.module}.c`]: "\n",
|
|
@@ -31944,14 +32023,14 @@ function nativeSwiftSlice(standin, moduleRoot, generator, configured, artifact)
|
|
|
31944
32023
|
`#import <${standin.module}/PeachEnums.h>`
|
|
31945
32024
|
),
|
|
31946
32025
|
[`include/${standin.module}/PeachEnums.h`]: [...new Set(enums.values())].map((file) => `#import <${standin.module}/${file}>`).join("\n"),
|
|
31947
|
-
"include/module.modulemap":
|
|
32026
|
+
"include/module.modulemap": import_node_fs46.default.readFileSync(
|
|
31948
32027
|
import_node_path47.default.join(import_node_path47.default.dirname(native.file), "Modules/module.modulemap"),
|
|
31949
32028
|
"utf8"
|
|
31950
32029
|
).replace(/\bframework module\b/g, "module").replace(/module\s+\w+\.Swift\s*\{[^}]*\}/g, "").replace(/umbrella header "([^"]+)"/, `umbrella header "${standin.module}/$1"`)
|
|
31951
32030
|
};
|
|
31952
32031
|
for (const file of originals)
|
|
31953
32032
|
files2[`include/${standin.module}/${file}`] = "#import <UIKit/UIKit.h>\n" + withoutSwiftDeclarations(
|
|
31954
|
-
|
|
32033
|
+
import_node_fs46.default.readFileSync(import_node_path47.default.join(headers, file), "utf8"),
|
|
31955
32034
|
declared,
|
|
31956
32035
|
`#import <${standin.module}/${standin.module}-Swift.h>`
|
|
31957
32036
|
);
|
|
@@ -31961,15 +32040,15 @@ function nativeSwiftSlice(standin, moduleRoot, generator, configured, artifact)
|
|
|
31961
32040
|
publicHeadersPath: "include",
|
|
31962
32041
|
files: files2,
|
|
31963
32042
|
prebuilt: {
|
|
31964
|
-
module:
|
|
31965
|
-
library:
|
|
32043
|
+
module: import_node_fs46.default.readFileSync(import_node_path47.default.join(directory, `${standin.module}.swiftmodule`)).toString("base64"),
|
|
32044
|
+
library: import_node_fs46.default.readFileSync(import_node_path47.default.join(directory, `lib${standin.module}.a`)).toString("base64")
|
|
31966
32045
|
}
|
|
31967
32046
|
};
|
|
31968
32047
|
}
|
|
31969
32048
|
|
|
31970
32049
|
// src/output-lock-stdio.ts
|
|
31971
32050
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
31972
|
-
var
|
|
32051
|
+
var import_node_fs47 = require("node:fs");
|
|
31973
32052
|
function outputLockStdio(standard, env = process.env) {
|
|
31974
32053
|
const stdio = [...standard];
|
|
31975
32054
|
for (const [key2, value] of Object.entries(process.env)) {
|
|
@@ -31982,7 +32061,7 @@ function outputLockStdio(standard, env = process.env) {
|
|
|
31982
32061
|
if (!/^REMOTE_OUTPUT_LOCK_[a-f0-9]{64}$/.test(key2) || !value || !/^\d+$/.test(value) || !Number.isSafeInteger(fd) || fd < 3)
|
|
31983
32062
|
throw new Error(`invalid inherited output lock descriptor for ${key2}`);
|
|
31984
32063
|
try {
|
|
31985
|
-
(0,
|
|
32064
|
+
(0, import_node_fs47.fstatSync)(fd);
|
|
31986
32065
|
} catch (cause) {
|
|
31987
32066
|
throw new Error(`inherited output lock descriptor ${fd} unavailable for ${key2}`, {
|
|
31988
32067
|
cause
|
|
@@ -31996,13 +32075,13 @@ function outputLockStdio(standard, env = process.env) {
|
|
|
31996
32075
|
|
|
31997
32076
|
// src/swift-cxx-standin.ts
|
|
31998
32077
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
31999
|
-
var
|
|
32000
|
-
var
|
|
32078
|
+
var import_node_child_process30 = require("node:child_process");
|
|
32079
|
+
var import_node_fs49 = __toESM(require("node:fs"), 1);
|
|
32001
32080
|
var import_node_path49 = __toESM(require("node:path"), 1);
|
|
32002
32081
|
|
|
32003
32082
|
// src/swift-cxx-declarations.ts
|
|
32004
32083
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
32005
|
-
var
|
|
32084
|
+
var import_node_fs48 = __toESM(require("node:fs"), 1);
|
|
32006
32085
|
var import_node_path48 = __toESM(require("node:path"), 1);
|
|
32007
32086
|
var import_promises5 = require("node:stream/promises");
|
|
32008
32087
|
var import_stream_json = __toESM(require("stream-json"), 1);
|
|
@@ -32019,7 +32098,7 @@ async function cxxDeclarations(astFile, headers) {
|
|
|
32019
32098
|
const result = [];
|
|
32020
32099
|
let lastFile = "";
|
|
32021
32100
|
let rootComplete = false;
|
|
32022
|
-
await (0, import_promises5.pipeline)(
|
|
32101
|
+
await (0, import_promises5.pipeline)(import_node_fs48.default.createReadStream(astFile), (0, import_stream_json.default)(), async (tokens2) => {
|
|
32023
32102
|
for await (const value of tokens2) {
|
|
32024
32103
|
if (!value || typeof value !== "object" || !("name" in value) || typeof value.name !== "string")
|
|
32025
32104
|
throw new Error("invalid clang AST token");
|
|
@@ -32171,8 +32250,8 @@ async function emitCxxStandin(input) {
|
|
|
32171
32250
|
const ast = import_node_path49.default.join(input.work, "cxx-ast.json");
|
|
32172
32251
|
const probe = import_node_path49.default.join(input.work, "cxx-probe.cpp");
|
|
32173
32252
|
const sourceFile = import_node_path49.default.join(input.work, "cxx-traps.cpp");
|
|
32174
|
-
|
|
32175
|
-
|
|
32253
|
+
import_node_fs49.default.mkdirSync(input.work, { recursive: true });
|
|
32254
|
+
import_node_fs49.default.writeFileSync(
|
|
32176
32255
|
probe,
|
|
32177
32256
|
input.roots.map((root) => `#include ${JSON.stringify(root)}
|
|
32178
32257
|
`).join("")
|
|
@@ -32187,7 +32266,7 @@ async function emitCxxStandin(input) {
|
|
|
32187
32266
|
"-I",
|
|
32188
32267
|
input.headers
|
|
32189
32268
|
];
|
|
32190
|
-
const includes = (0,
|
|
32269
|
+
const includes = (0, import_node_child_process30.spawnSync)(input.clang, [...flags, "-M", "-MT", "peach", probe], {
|
|
32191
32270
|
encoding: "utf8",
|
|
32192
32271
|
env: swiftEnvironment(),
|
|
32193
32272
|
maxBuffer: 16 * 1024 * 1024
|
|
@@ -32204,16 +32283,16 @@ async function emitCxxStandin(input) {
|
|
|
32204
32283
|
const relative2 = relativeInside(input.headers, absolute);
|
|
32205
32284
|
if (relative2) reached.add(absolute);
|
|
32206
32285
|
}
|
|
32207
|
-
const output2 =
|
|
32286
|
+
const output2 = import_node_fs49.default.openSync(ast, "w");
|
|
32208
32287
|
let parsed;
|
|
32209
32288
|
try {
|
|
32210
|
-
parsed = (0,
|
|
32289
|
+
parsed = (0, import_node_child_process30.spawnSync)(
|
|
32211
32290
|
input.clang,
|
|
32212
32291
|
[...flags, "-fsyntax-only", "-Xclang", "-ast-dump=json", probe],
|
|
32213
32292
|
{ stdio: ["ignore", output2, "pipe"], encoding: "utf8", env: swiftEnvironment() }
|
|
32214
32293
|
);
|
|
32215
32294
|
} finally {
|
|
32216
|
-
|
|
32295
|
+
import_node_fs49.default.closeSync(output2);
|
|
32217
32296
|
}
|
|
32218
32297
|
if (parsed.error || parsed.status !== 0)
|
|
32219
32298
|
throw new Error(
|
|
@@ -32223,7 +32302,7 @@ async function emitCxxStandin(input) {
|
|
|
32223
32302
|
try {
|
|
32224
32303
|
declarations = await cxxDeclarations(ast, reached);
|
|
32225
32304
|
} finally {
|
|
32226
|
-
|
|
32305
|
+
import_node_fs49.default.rmSync(ast, { force: true });
|
|
32227
32306
|
}
|
|
32228
32307
|
const excluded = {};
|
|
32229
32308
|
const symbols = /* @__PURE__ */ new Map();
|
|
@@ -32261,11 +32340,11 @@ async function emitCxxStandin(input) {
|
|
|
32261
32340
|
];
|
|
32262
32341
|
let live = definitions;
|
|
32263
32342
|
for (; ; ) {
|
|
32264
|
-
|
|
32343
|
+
import_node_fs49.default.writeFileSync(
|
|
32265
32344
|
sourceFile,
|
|
32266
32345
|
[...prelude, ...live.map((item) => item.text)].join("\n") + "\n"
|
|
32267
32346
|
);
|
|
32268
|
-
const checked = (0,
|
|
32347
|
+
const checked = (0, import_node_child_process30.spawnSync)(
|
|
32269
32348
|
input.clang,
|
|
32270
32349
|
[
|
|
32271
32350
|
...flags,
|
|
@@ -32536,7 +32615,7 @@ function withBuiltinStandinBehavior(behavior) {
|
|
|
32536
32615
|
var TRIPLE = "wasm64-unknown-wasip1";
|
|
32537
32616
|
var cacheDir4 = import_node_path50.default.join(cacheDir(), "swift-standins");
|
|
32538
32617
|
function exec(file, args, cwd) {
|
|
32539
|
-
return (0,
|
|
32618
|
+
return (0, import_node_child_process31.execFileSync)(file, args, {
|
|
32540
32619
|
cwd,
|
|
32541
32620
|
encoding: "utf8",
|
|
32542
32621
|
env: swiftEnvironment(),
|
|
@@ -32556,12 +32635,12 @@ function treeDigest(root) {
|
|
|
32556
32635
|
const names = [];
|
|
32557
32636
|
const ancestors = /* @__PURE__ */ new Set();
|
|
32558
32637
|
const walk3 = (dir) => {
|
|
32559
|
-
const resolved =
|
|
32638
|
+
const resolved = import_node_fs50.default.realpathSync(dir);
|
|
32560
32639
|
if (ancestors.has(resolved)) throw new Error(`cyclic header directory: ${dir}`);
|
|
32561
32640
|
ancestors.add(resolved);
|
|
32562
|
-
for (const entry of
|
|
32641
|
+
for (const entry of import_node_fs50.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name < right.name ? -1 : 1)) {
|
|
32563
32642
|
const full = import_node_path50.default.join(dir, entry.name);
|
|
32564
|
-
const stat = entry.isSymbolicLink() ?
|
|
32643
|
+
const stat = entry.isSymbolicLink() ? import_node_fs50.default.statSync(full) : entry;
|
|
32565
32644
|
if (stat.isDirectory()) walk3(full);
|
|
32566
32645
|
else if (stat.isFile()) names.push(import_node_path50.default.relative(root, full));
|
|
32567
32646
|
}
|
|
@@ -32569,7 +32648,7 @@ function treeDigest(root) {
|
|
|
32569
32648
|
};
|
|
32570
32649
|
walk3(root);
|
|
32571
32650
|
const stamp = names.map((name3) => {
|
|
32572
|
-
const stat =
|
|
32651
|
+
const stat = import_node_fs50.default.statSync(import_node_path50.default.join(root, name3));
|
|
32573
32652
|
return `${name3}\0${stat.size}:${stat.mtimeMs}`;
|
|
32574
32653
|
}).join("\n");
|
|
32575
32654
|
const memo2 = digests.get(`tree\0${root}`);
|
|
@@ -32577,7 +32656,7 @@ function treeDigest(root) {
|
|
|
32577
32656
|
const hash = (0, import_node_crypto26.createHash)("sha256");
|
|
32578
32657
|
for (const name3 of names) {
|
|
32579
32658
|
hash.update(`${name3}\0`);
|
|
32580
|
-
hash.update(
|
|
32659
|
+
hash.update(import_node_fs50.default.readFileSync(import_node_path50.default.join(root, name3)));
|
|
32581
32660
|
hash.update("\0");
|
|
32582
32661
|
}
|
|
32583
32662
|
const digest = hash.digest("hex");
|
|
@@ -32586,7 +32665,7 @@ function treeDigest(root) {
|
|
|
32586
32665
|
}
|
|
32587
32666
|
function locateXcframework(tree2) {
|
|
32588
32667
|
const find = (root, depth) => {
|
|
32589
|
-
for (const entry of
|
|
32668
|
+
for (const entry of import_node_fs50.default.readdirSync(root, { withFileTypes: true })) {
|
|
32590
32669
|
if (!entry.isDirectory() || entry.name === "__MACOSX") continue;
|
|
32591
32670
|
const full = import_node_path50.default.join(root, entry.name);
|
|
32592
32671
|
if (entry.name.endsWith(".xcframework")) return full;
|
|
@@ -32608,47 +32687,47 @@ function swiftBinaryFramework(binary) {
|
|
|
32608
32687
|
const fingerprint = import_node_path50.default.join(dir, ".fingerprint");
|
|
32609
32688
|
const stored = (() => {
|
|
32610
32689
|
try {
|
|
32611
|
-
const parsed = JSON.parse(
|
|
32690
|
+
const parsed = JSON.parse(import_node_fs50.default.readFileSync(fingerprint, "utf8"));
|
|
32612
32691
|
return parsed && typeof parsed === "object" && "sha" in parsed ? parsed : null;
|
|
32613
32692
|
} catch {
|
|
32614
32693
|
return null;
|
|
32615
32694
|
}
|
|
32616
32695
|
})();
|
|
32617
32696
|
if (!binary.url) {
|
|
32618
|
-
const stat =
|
|
32697
|
+
const stat = import_node_fs50.default.statSync(binary.dir);
|
|
32619
32698
|
const stamp = `${stat.size}:${stat.mtimeMs}`;
|
|
32620
32699
|
if (stored?.stamp === stamp) {
|
|
32621
32700
|
const found3 = locateXcframework(import_node_path50.default.join(dir, "tree"));
|
|
32622
32701
|
if (found3) return { dir: found3, digest: stored.sha };
|
|
32623
32702
|
}
|
|
32624
|
-
const sha2 = (0, import_node_crypto26.createHash)("sha256").update(
|
|
32703
|
+
const sha2 = (0, import_node_crypto26.createHash)("sha256").update(import_node_fs50.default.readFileSync(binary.dir)).digest("hex");
|
|
32625
32704
|
if (sha2 !== stored?.sha || !locateXcframework(import_node_path50.default.join(dir, "tree"))) {
|
|
32626
|
-
|
|
32627
|
-
|
|
32705
|
+
import_node_fs50.default.rmSync(dir, { recursive: true, force: true });
|
|
32706
|
+
import_node_fs50.default.mkdirSync(import_node_path50.default.join(dir, "tree"), { recursive: true });
|
|
32628
32707
|
exec("unzip", ["-q", binary.dir, "-d", import_node_path50.default.join(dir, "tree")]);
|
|
32629
32708
|
}
|
|
32630
|
-
|
|
32709
|
+
import_node_fs50.default.writeFileSync(fingerprint, JSON.stringify({ stamp, sha: sha2 }));
|
|
32631
32710
|
const found2 = locateXcframework(import_node_path50.default.join(dir, "tree"));
|
|
32632
32711
|
if (!found2) throw new Error("its archive holds no .xcframework");
|
|
32633
32712
|
return { dir: found2, digest: sha2 };
|
|
32634
32713
|
}
|
|
32635
|
-
if (stored &&
|
|
32636
|
-
const sha2 = (0, import_node_crypto26.createHash)("sha256").update(
|
|
32714
|
+
if (stored && import_node_fs50.default.existsSync(archive)) {
|
|
32715
|
+
const sha2 = (0, import_node_crypto26.createHash)("sha256").update(import_node_fs50.default.readFileSync(archive)).digest("hex");
|
|
32637
32716
|
if (sha2 !== expected)
|
|
32638
32717
|
throw new Error(`archive checksum ${sha2} is not the declared checksum ${expected}`);
|
|
32639
32718
|
const found2 = locateXcframework(import_node_path50.default.join(dir, "tree"));
|
|
32640
32719
|
if (found2) return { dir: found2, digest: sha2 };
|
|
32641
32720
|
}
|
|
32642
|
-
|
|
32643
|
-
|
|
32721
|
+
import_node_fs50.default.rmSync(dir, { recursive: true, force: true });
|
|
32722
|
+
import_node_fs50.default.mkdirSync(import_node_path50.default.join(dir, "tree"), { recursive: true });
|
|
32644
32723
|
exec("curl", ["-fsSL", "--retry", "2", "-o", archive, binary.url]);
|
|
32645
|
-
const sha = (0, import_node_crypto26.createHash)("sha256").update(
|
|
32724
|
+
const sha = (0, import_node_crypto26.createHash)("sha256").update(import_node_fs50.default.readFileSync(archive)).digest("hex");
|
|
32646
32725
|
if (sha !== expected) {
|
|
32647
|
-
|
|
32726
|
+
import_node_fs50.default.rmSync(dir, { recursive: true, force: true });
|
|
32648
32727
|
throw new Error(`archive checksum ${sha} is not the declared checksum ${expected}`);
|
|
32649
32728
|
}
|
|
32650
32729
|
exec("unzip", ["-q", archive, "-d", import_node_path50.default.join(dir, "tree")]);
|
|
32651
|
-
|
|
32730
|
+
import_node_fs50.default.writeFileSync(fingerprint, JSON.stringify({ sha }));
|
|
32652
32731
|
const found = locateXcframework(import_node_path50.default.join(dir, "tree"));
|
|
32653
32732
|
if (!found) throw new Error("its archive holds no .xcframework");
|
|
32654
32733
|
return { dir: found, digest: sha };
|
|
@@ -32659,7 +32738,7 @@ var OBJC_IMPORT = /#\s*(?:import|include)\s*[<"](?:[\w+-]+\/)?([\w+.-]+\.h)[>"]/
|
|
|
32659
32738
|
function stageDeclaredFramework(framework, declared, imports2, sdkHeader, destination) {
|
|
32660
32739
|
const name3 = import_node_path50.default.basename(framework, ".framework");
|
|
32661
32740
|
const own = `${name3}-Swift.h`;
|
|
32662
|
-
const declaration =
|
|
32741
|
+
const declaration = import_node_fs50.default.readFileSync(
|
|
32663
32742
|
import_node_path50.default.join(framework, "Modules/module.modulemap"),
|
|
32664
32743
|
"utf8"
|
|
32665
32744
|
);
|
|
@@ -32669,19 +32748,19 @@ function stageDeclaredFramework(framework, declared, imports2, sdkHeader, destin
|
|
|
32669
32748
|
}
|
|
32670
32749
|
`;
|
|
32671
32750
|
const umbrella = /umbrella header "([^"]+)"/.exec(modulemap)?.[1];
|
|
32672
|
-
if (!umbrella || !
|
|
32751
|
+
if (!umbrella || !import_node_fs50.default.existsSync(import_node_path50.default.join(framework, "Headers", umbrella)))
|
|
32673
32752
|
throw new Error(`${name3} module map names no umbrella header`);
|
|
32674
32753
|
const headers = new Map(
|
|
32675
|
-
|
|
32754
|
+
import_node_fs50.default.readdirSync(import_node_path50.default.join(framework, "Headers")).filter(
|
|
32676
32755
|
(file) => file.endsWith(".h") && file !== umbrella && file !== own && file !== `${name3}.h`
|
|
32677
32756
|
).map((file) => [
|
|
32678
32757
|
file,
|
|
32679
|
-
|
|
32758
|
+
import_node_fs50.default.readFileSync(import_node_path50.default.join(framework, "Headers", file), "utf8")
|
|
32680
32759
|
])
|
|
32681
32760
|
);
|
|
32682
32761
|
const modularHeaders = new Set(
|
|
32683
32762
|
[
|
|
32684
|
-
...
|
|
32763
|
+
...import_node_fs50.default.readFileSync(import_node_path50.default.join(framework, "Headers", umbrella), "utf8").matchAll(OBJC_IMPORT)
|
|
32685
32764
|
].map((match) => match[1])
|
|
32686
32765
|
);
|
|
32687
32766
|
const reached = /* @__PURE__ */ new Set();
|
|
@@ -32693,14 +32772,14 @@ function stageDeclaredFramework(framework, declared, imports2, sdkHeader, destin
|
|
|
32693
32772
|
};
|
|
32694
32773
|
for (const file of imports2) reach(file);
|
|
32695
32774
|
const target = import_node_path50.default.join(destination, "frameworks", import_node_path50.default.basename(framework));
|
|
32696
|
-
|
|
32697
|
-
|
|
32775
|
+
import_node_fs50.default.mkdirSync(import_node_path50.default.join(target, "Headers"), { recursive: true });
|
|
32776
|
+
import_node_fs50.default.mkdirSync(import_node_path50.default.join(target, "Modules"));
|
|
32698
32777
|
if (sdkHeader !== null && reached.size === 0)
|
|
32699
|
-
|
|
32778
|
+
import_node_fs50.default.writeFileSync(import_node_path50.default.join(target, "Headers", `${name3}-SDK.h`), sdkHeader);
|
|
32700
32779
|
for (const [file, source] of headers) {
|
|
32701
32780
|
const body = declared ? withoutSwiftDeclarations(source, declared, `#import <${name3}/${own}>`) : source;
|
|
32702
32781
|
const uikit = /\bUI[A-Z]\w+/.test(body) && !body.includes("UIKit/UIKit.h") ? "#import <UIKit/UIKit.h>\n" : "";
|
|
32703
|
-
|
|
32782
|
+
import_node_fs50.default.writeFileSync(
|
|
32704
32783
|
import_node_path50.default.join(target, "Headers", file),
|
|
32705
32784
|
`#import <Foundation/Foundation.h>
|
|
32706
32785
|
${uikit}${body}`
|
|
@@ -32715,7 +32794,7 @@ ${uikit}${body}`
|
|
|
32715
32794
|
(file) => ` module ${import_node_path50.default.basename(file, ".h").replace(/\W/g, "_")} { header "${file}" export * }`
|
|
32716
32795
|
)
|
|
32717
32796
|
];
|
|
32718
|
-
|
|
32797
|
+
import_node_fs50.default.writeFileSync(
|
|
32719
32798
|
import_node_path50.default.join(target, "Modules/module.modulemap"),
|
|
32720
32799
|
modulemap.replace(/^\s*umbrella header "[^"]*"\s*\n/m, `${submodules.join("\n")}
|
|
32721
32800
|
`).replace(/^\s*module \*\s*\{[^}]*\}\s*\n/m, "")
|
|
@@ -32732,9 +32811,9 @@ function binaryHeaderSearchPaths(binary, root, declaredFrameworks) {
|
|
|
32732
32811
|
)
|
|
32733
32812
|
)
|
|
32734
32813
|
];
|
|
32735
|
-
const standalone =
|
|
32814
|
+
const standalone = import_node_fs50.default.existsSync(import_node_path50.default.join(artifact.dir, "module.modulemap"));
|
|
32736
32815
|
const libraryHeaders = standalone ? artifact.dir : slice ? import_node_path50.default.join(slice, "Headers") : null;
|
|
32737
|
-
const headers = libraryHeaders &&
|
|
32816
|
+
const headers = libraryHeaders && import_node_fs50.default.existsSync(libraryHeaders) ? [libraryHeaders] : [];
|
|
32738
32817
|
if (headers.length === 0 && frameworks.length === 0)
|
|
32739
32818
|
return { frameworks: [], headers: [] };
|
|
32740
32819
|
const provided = new Set(
|
|
@@ -32764,7 +32843,7 @@ function binaryHeaderSearchPaths(binary, root, declaredFrameworks) {
|
|
|
32764
32843
|
declared: null,
|
|
32765
32844
|
header: null,
|
|
32766
32845
|
imports: compiled,
|
|
32767
|
-
sdkHeader:
|
|
32846
|
+
sdkHeader: import_node_fs50.default.readFileSync(sdkHeader, "utf8")
|
|
32768
32847
|
});
|
|
32769
32848
|
}
|
|
32770
32849
|
}
|
|
@@ -32781,7 +32860,7 @@ function binaryHeaderSearchPaths(binary, root, declaredFrameworks) {
|
|
|
32781
32860
|
const revision = import_node_path50.default.join(staging, "revisions", STANDIN_SOURCE_DIGEST.slice(0, 32));
|
|
32782
32861
|
const stageTree = () => {
|
|
32783
32862
|
const pending = import_node_path50.default.join(staging, `pending.${process.pid}`);
|
|
32784
|
-
|
|
32863
|
+
import_node_fs50.default.rmSync(pending, { recursive: true, force: true });
|
|
32785
32864
|
for (const framework of frameworks) {
|
|
32786
32865
|
const swift = declared.get(framework);
|
|
32787
32866
|
if (swift) {
|
|
@@ -32795,8 +32874,8 @@ function binaryHeaderSearchPaths(binary, root, declaredFrameworks) {
|
|
|
32795
32874
|
continue;
|
|
32796
32875
|
}
|
|
32797
32876
|
for (const part of ["Headers", "Modules"])
|
|
32798
|
-
if (
|
|
32799
|
-
|
|
32877
|
+
if (import_node_fs50.default.existsSync(import_node_path50.default.join(framework, part)))
|
|
32878
|
+
import_node_fs50.default.cpSync(
|
|
32800
32879
|
import_node_path50.default.join(framework, part),
|
|
32801
32880
|
import_node_path50.default.join(pending, "frameworks", import_node_path50.default.basename(framework), part),
|
|
32802
32881
|
{
|
|
@@ -32815,18 +32894,18 @@ function binaryHeaderSearchPaths(binary, root, declaredFrameworks) {
|
|
|
32815
32894
|
import_node_path50.default.basename(framework),
|
|
32816
32895
|
"Modules"
|
|
32817
32896
|
);
|
|
32818
|
-
|
|
32897
|
+
import_node_fs50.default.mkdirSync(modules, { recursive: true });
|
|
32819
32898
|
const modulemap = import_node_path50.default.join(modules, "module.modulemap");
|
|
32820
|
-
|
|
32821
|
-
|
|
32899
|
+
import_node_fs50.default.rmSync(modulemap, { force: true });
|
|
32900
|
+
import_node_fs50.default.copyFileSync(surface.modulemap, modulemap);
|
|
32822
32901
|
}
|
|
32823
32902
|
}
|
|
32824
32903
|
for (const [index, directory] of headers.entries()) {
|
|
32825
|
-
|
|
32904
|
+
import_node_fs50.default.cpSync(directory, import_node_path50.default.join(pending, "headers", String(index)), {
|
|
32826
32905
|
recursive: true,
|
|
32827
32906
|
dereference: true,
|
|
32828
32907
|
...standalone ? {
|
|
32829
|
-
filter: (source) =>
|
|
32908
|
+
filter: (source) => import_node_fs50.default.statSync(source).isDirectory() ? import_node_path50.default.dirname(source) !== directory || !import_node_path50.default.basename(source).startsWith("ios-") : !isBinaryLibraryFile(source)
|
|
32830
32909
|
} : {}
|
|
32831
32910
|
});
|
|
32832
32911
|
const surface = found.find(
|
|
@@ -32834,8 +32913,8 @@ function binaryHeaderSearchPaths(binary, root, declaredFrameworks) {
|
|
|
32834
32913
|
);
|
|
32835
32914
|
if (surface && "modulemap" in surface) {
|
|
32836
32915
|
const modulemap = import_node_path50.default.join(pending, "headers", String(index), "module.modulemap");
|
|
32837
|
-
|
|
32838
|
-
|
|
32916
|
+
import_node_fs50.default.rmSync(modulemap, { force: true });
|
|
32917
|
+
import_node_fs50.default.copyFileSync(surface.modulemap, modulemap);
|
|
32839
32918
|
}
|
|
32840
32919
|
}
|
|
32841
32920
|
const contents = (0, import_node_crypto26.createHash)("sha256");
|
|
@@ -32847,9 +32926,9 @@ function binaryHeaderSearchPaths(binary, root, declaredFrameworks) {
|
|
|
32847
32926
|
"Modules/module.modulemap"
|
|
32848
32927
|
);
|
|
32849
32928
|
const swiftModule = `${import_node_path50.default.basename(framework, ".framework")}.Swift`;
|
|
32850
|
-
const declaration =
|
|
32851
|
-
|
|
32852
|
-
|
|
32929
|
+
const declaration = import_node_fs50.default.readFileSync(modulemap, "utf8");
|
|
32930
|
+
import_node_fs50.default.rmSync(modulemap);
|
|
32931
|
+
import_node_fs50.default.writeFileSync(
|
|
32853
32932
|
modulemap,
|
|
32854
32933
|
declaration.replace(
|
|
32855
32934
|
/\bmodule\s+([\w.]+)\s*\{[^{}]*\}/g,
|
|
@@ -32857,27 +32936,27 @@ function binaryHeaderSearchPaths(binary, root, declaredFrameworks) {
|
|
|
32857
32936
|
)
|
|
32858
32937
|
);
|
|
32859
32938
|
}
|
|
32860
|
-
for (const relative2 of
|
|
32939
|
+
for (const relative2 of import_node_fs50.default.readdirSync(pending, { recursive: true, encoding: "utf8" }).sort()) {
|
|
32861
32940
|
const file = import_node_path50.default.join(pending, relative2);
|
|
32862
32941
|
contents.update(`${relative2}\0`);
|
|
32863
|
-
if (
|
|
32942
|
+
if (import_node_fs50.default.statSync(file).isFile()) contents.update(import_node_fs50.default.readFileSync(file));
|
|
32864
32943
|
}
|
|
32865
32944
|
const name3 = contents.digest("hex").slice(0, 32);
|
|
32866
32945
|
try {
|
|
32867
|
-
|
|
32946
|
+
import_node_fs50.default.renameSync(pending, import_node_path50.default.join(staging, name3));
|
|
32868
32947
|
} catch (error) {
|
|
32869
|
-
|
|
32870
|
-
if (!
|
|
32948
|
+
import_node_fs50.default.rmSync(pending, { recursive: true, force: true });
|
|
32949
|
+
if (!import_node_fs50.default.existsSync(import_node_path50.default.join(staging, name3))) throw error;
|
|
32871
32950
|
}
|
|
32872
|
-
|
|
32951
|
+
import_node_fs50.default.mkdirSync(import_node_path50.default.dirname(revision), { recursive: true });
|
|
32873
32952
|
const record2 = `${revision}.${process.pid}`;
|
|
32874
|
-
|
|
32875
|
-
|
|
32953
|
+
import_node_fs50.default.writeFileSync(record2, name3);
|
|
32954
|
+
import_node_fs50.default.renameSync(record2, revision);
|
|
32876
32955
|
return name3;
|
|
32877
32956
|
};
|
|
32878
32957
|
const search = import_node_path50.default.join(
|
|
32879
32958
|
staging,
|
|
32880
|
-
|
|
32959
|
+
import_node_fs50.default.existsSync(revision) ? import_node_fs50.default.readFileSync(revision, "utf8") : stageTree()
|
|
32881
32960
|
);
|
|
32882
32961
|
for (const [framework, { header }] of declared) {
|
|
32883
32962
|
if (header === null) continue;
|
|
@@ -32889,9 +32968,9 @@ function binaryHeaderSearchPaths(binary, root, declaredFrameworks) {
|
|
|
32889
32968
|
"Headers",
|
|
32890
32969
|
`${name3}-Swift.h`
|
|
32891
32970
|
);
|
|
32892
|
-
if (!
|
|
32893
|
-
|
|
32894
|
-
|
|
32971
|
+
if (!import_node_fs50.default.existsSync(staged) || import_node_fs50.default.readFileSync(staged, "utf8") !== header) {
|
|
32972
|
+
import_node_fs50.default.writeFileSync(`${staged}.${process.pid}`, header);
|
|
32973
|
+
import_node_fs50.default.renameSync(`${staged}.${process.pid}`, staged);
|
|
32895
32974
|
}
|
|
32896
32975
|
}
|
|
32897
32976
|
return {
|
|
@@ -32899,11 +32978,11 @@ function binaryHeaderSearchPaths(binary, root, declaredFrameworks) {
|
|
|
32899
32978
|
headers: headers.map((_, index) => import_node_path50.default.join(search, "headers", String(index)))
|
|
32900
32979
|
};
|
|
32901
32980
|
}
|
|
32902
|
-
var files = (dir, test) =>
|
|
32981
|
+
var files = (dir, test) => import_node_fs50.default.existsSync(dir) ? import_node_fs50.default.readdirSync(dir, { recursive: true, encoding: "utf8" }).filter((file) => test(import_node_path50.default.basename(file))).sort() : [];
|
|
32903
32982
|
var OBJC = /^\s*(?:@interface|@protocol|@class|@import|#import)\b/m;
|
|
32904
32983
|
function headerSurface(module2, modulemap, headers) {
|
|
32905
32984
|
const objc = files(headers, (name3) => name3.endsWith(".h")).some(
|
|
32906
|
-
(file) => OBJC.test(
|
|
32985
|
+
(file) => OBJC.test(import_node_fs50.default.readFileSync(import_node_path50.default.join(headers, file), "utf8"))
|
|
32907
32986
|
);
|
|
32908
32987
|
return objc ? { kind: "objc", module: module2, modulemap, headers } : { kind: "c", module: module2, modulemap, headers };
|
|
32909
32988
|
}
|
|
@@ -32911,7 +32990,7 @@ function cxxOnly(surface) {
|
|
|
32911
32990
|
if (surface.kind !== "c" && surface.kind !== "objc") return false;
|
|
32912
32991
|
return files(surface.headers, (name3) => name3.endsWith(".h")).some((file) => {
|
|
32913
32992
|
const guards = [];
|
|
32914
|
-
const code =
|
|
32993
|
+
const code = import_node_fs50.default.readFileSync(import_node_path50.default.join(surface.headers, file), "utf8").replace(/\/\*[\s\S]*?\*\//g, "").replace(/\/\/.*$/gm, "");
|
|
32915
32994
|
for (const line of code.split("\n")) {
|
|
32916
32995
|
if (/^\s*#\s*if/.test(line))
|
|
32917
32996
|
guards.push(/__cplusplus/.test(line) && !/!\s*defined|ifndef/.test(line));
|
|
@@ -32923,7 +33002,7 @@ function cxxOnly(surface) {
|
|
|
32923
33002
|
});
|
|
32924
33003
|
}
|
|
32925
33004
|
function mapSurfaces(modulemap) {
|
|
32926
|
-
const text5 =
|
|
33005
|
+
const text5 = import_node_fs50.default.readFileSync(modulemap, "utf8");
|
|
32927
33006
|
const headers = import_node_path50.default.dirname(modulemap);
|
|
32928
33007
|
const modules = moduleMapModules(text5);
|
|
32929
33008
|
if (modules.length <= 1) {
|
|
@@ -32936,13 +33015,13 @@ function mapSurfaces(modulemap) {
|
|
|
32936
33015
|
);
|
|
32937
33016
|
}
|
|
32938
33017
|
function simulatorSlice(xcframeworkDir) {
|
|
32939
|
-
const slice =
|
|
33018
|
+
const slice = import_node_fs50.default.readdirSync(xcframeworkDir).filter((name3) => /^ios-.+-simulator$/.test(name3)).sort()[0];
|
|
32940
33019
|
return slice ? import_node_path50.default.join(xcframeworkDir, slice) : null;
|
|
32941
33020
|
}
|
|
32942
33021
|
function surfaces(xcframeworkDir, target, slice = simulatorSlice(xcframeworkDir)) {
|
|
32943
33022
|
const standaloneMap = import_node_path50.default.join(xcframeworkDir, "module.modulemap");
|
|
32944
|
-
if (
|
|
32945
|
-
const module2 = moduleMapName(
|
|
33023
|
+
if (import_node_fs50.default.existsSync(standaloneMap)) {
|
|
33024
|
+
const module2 = moduleMapName(import_node_fs50.default.readFileSync(standaloneMap, "utf8"));
|
|
32946
33025
|
if (!module2) throw new Error("its module map declares no module");
|
|
32947
33026
|
return [headerSurface(module2, standaloneMap, xcframeworkDir)];
|
|
32948
33027
|
}
|
|
@@ -32950,7 +33029,7 @@ function surfaces(xcframeworkDir, target, slice = simulatorSlice(xcframeworkDir)
|
|
|
32950
33029
|
if (!slice && !plain) throw new Error("it has no iOS simulator slice");
|
|
32951
33030
|
const root = plain ? import_node_path50.default.dirname(xcframeworkDir) : slice;
|
|
32952
33031
|
const found = [];
|
|
32953
|
-
for (const entry of plain ? [import_node_path50.default.basename(xcframeworkDir)] :
|
|
33032
|
+
for (const entry of plain ? [import_node_path50.default.basename(xcframeworkDir)] : import_node_fs50.default.readdirSync(root).sort()) {
|
|
32954
33033
|
if (!entry.endsWith(".framework")) continue;
|
|
32955
33034
|
const module2 = entry.slice(0, -".framework".length);
|
|
32956
33035
|
const framework = import_node_path50.default.join(root, entry);
|
|
@@ -32962,8 +33041,8 @@ function surfaces(xcframeworkDir, target, slice = simulatorSlice(xcframeworkDir)
|
|
|
32962
33041
|
const chosen = interfaces.find((name3) => name3.startsWith("arm64-")) ?? interfaces[0] ?? null;
|
|
32963
33042
|
let modulemap = import_node_path50.default.join(framework, "Modules", "module.modulemap");
|
|
32964
33043
|
const headers2 = import_node_path50.default.join(framework, "Headers");
|
|
32965
|
-
if (!
|
|
32966
|
-
const umbrella =
|
|
33044
|
+
if (!import_node_fs50.default.existsSync(modulemap) && files(headers2, (name3) => name3.endsWith(".h")).length) {
|
|
33045
|
+
const umbrella = import_node_fs50.default.existsSync(import_node_path50.default.join(headers2, `${module2}.h`)) ? `umbrella header "${module2}.h"` : 'umbrella "Headers"';
|
|
32967
33046
|
modulemap = generatedModuleMap(
|
|
32968
33047
|
`framework module ${module2} { ${umbrella} export * module * { export * } }
|
|
32969
33048
|
`,
|
|
@@ -32975,12 +33054,12 @@ function surfaces(xcframeworkDir, target, slice = simulatorSlice(xcframeworkDir)
|
|
|
32975
33054
|
swiftmodule,
|
|
32976
33055
|
chosen.replace(/\.swiftinterface$/, ".private.swiftinterface")
|
|
32977
33056
|
);
|
|
32978
|
-
const file =
|
|
33057
|
+
const file = import_node_fs50.default.existsSync(privateInterface) ? privateInterface : import_node_path50.default.join(swiftmodule, chosen);
|
|
32979
33058
|
const underlying = [
|
|
32980
|
-
...
|
|
33059
|
+
...import_node_fs50.default.readFileSync(file, "utf8").matchAll(/^(?:@_exported[ \t]+)?import[ \t]+(\w+)[ \t]*$/gm)
|
|
32981
33060
|
].some((match) => match[1] === module2);
|
|
32982
33061
|
if (underlying) {
|
|
32983
|
-
if (!
|
|
33062
|
+
if (!import_node_fs50.default.existsSync(modulemap))
|
|
32984
33063
|
throw new Error(`${module2} imports its underlying module without a modulemap`);
|
|
32985
33064
|
found.push({
|
|
32986
33065
|
kind: "mixed",
|
|
@@ -32992,7 +33071,7 @@ function surfaces(xcframeworkDir, target, slice = simulatorSlice(xcframeworkDir)
|
|
|
32992
33071
|
} else found.push({ kind: "swift", module: module2, interface: file });
|
|
32993
33072
|
continue;
|
|
32994
33073
|
}
|
|
32995
|
-
if (
|
|
33074
|
+
if (import_node_fs50.default.existsSync(modulemap))
|
|
32996
33075
|
found.push(headerSurface(module2, modulemap, import_node_path50.default.join(framework, "Headers")));
|
|
32997
33076
|
}
|
|
32998
33077
|
const headers = import_node_path50.default.join(root, "Headers");
|
|
@@ -33018,12 +33097,12 @@ function generatedModuleMap(text5, framework) {
|
|
|
33018
33097
|
key(text5),
|
|
33019
33098
|
framework ? "Modules" : "Headers"
|
|
33020
33099
|
);
|
|
33021
|
-
|
|
33100
|
+
import_node_fs50.default.mkdirSync(dir, { recursive: true });
|
|
33022
33101
|
const file = import_node_path50.default.join(dir, "module.modulemap");
|
|
33023
|
-
if (!
|
|
33102
|
+
if (!import_node_fs50.default.existsSync(file)) {
|
|
33024
33103
|
const pending = `${file}.${process.pid}.tmp`;
|
|
33025
|
-
|
|
33026
|
-
|
|
33104
|
+
import_node_fs50.default.writeFileSync(pending, text5);
|
|
33105
|
+
import_node_fs50.default.renameSync(pending, file);
|
|
33027
33106
|
}
|
|
33028
33107
|
return file;
|
|
33029
33108
|
}
|
|
@@ -33041,7 +33120,7 @@ function peachModuleDirs(toolchain, imports2, sdkIncludes) {
|
|
|
33041
33120
|
toolchainBin,
|
|
33042
33121
|
plugins.libraries[0]
|
|
33043
33122
|
]);
|
|
33044
|
-
|
|
33123
|
+
import_node_fs50.default.writeFileSync(
|
|
33045
33124
|
import_node_path50.default.join(import_node_path50.default.dirname(plugins.libraries[0]), "compiler-release"),
|
|
33046
33125
|
`${toolchain.release}
|
|
33047
33126
|
`
|
|
@@ -33083,13 +33162,13 @@ function peachModuleDirs(toolchain, imports2, sdkIncludes) {
|
|
|
33083
33162
|
);
|
|
33084
33163
|
const release = import_node_path50.default.join(moduleRoot, ".build", TRIPLE, "release");
|
|
33085
33164
|
const declarations = swiftManifestDeclarations(
|
|
33086
|
-
|
|
33165
|
+
import_node_fs50.default.readFileSync(import_node_path50.default.join(moduleRoot, "Package.swift"), "utf8")
|
|
33087
33166
|
);
|
|
33088
33167
|
const supplied = new Set(
|
|
33089
33168
|
declarations.filter(
|
|
33090
33169
|
(target) => sdkIncludes.some(
|
|
33091
|
-
(dir) =>
|
|
33092
|
-
) ||
|
|
33170
|
+
(dir) => import_node_fs50.default.existsSync(import_node_path50.default.join(dir, target.name, "module.modulemap"))
|
|
33171
|
+
) || import_node_fs50.default.existsSync(
|
|
33093
33172
|
import_node_path50.default.join(
|
|
33094
33173
|
moduleRoot,
|
|
33095
33174
|
target.path,
|
|
@@ -33103,7 +33182,7 @@ function peachModuleDirs(toolchain, imports2, sdkIncludes) {
|
|
|
33103
33182
|
import_node_path50.default.join(release, "Modules"),
|
|
33104
33183
|
...declarations.filter(
|
|
33105
33184
|
(target) => !sdkIncludes.some(
|
|
33106
|
-
(dir) =>
|
|
33185
|
+
(dir) => import_node_fs50.default.existsSync(import_node_path50.default.join(dir, target.name, "module.modulemap"))
|
|
33107
33186
|
)
|
|
33108
33187
|
).map(
|
|
33109
33188
|
(target) => import_node_path50.default.join(
|
|
@@ -33111,9 +33190,9 @@ function peachModuleDirs(toolchain, imports2, sdkIncludes) {
|
|
|
33111
33190
|
target.path,
|
|
33112
33191
|
target.kind === "systemLibrary" ? "" : "include"
|
|
33113
33192
|
)
|
|
33114
|
-
).filter((dir) =>
|
|
33115
|
-
...
|
|
33116
|
-
(name3) => name3.endsWith(".build") && !supplied.has(name3.slice(0, -".build".length)) &&
|
|
33193
|
+
).filter((dir) => import_node_fs50.default.existsSync(import_node_path50.default.join(dir, "module.modulemap"))),
|
|
33194
|
+
...import_node_fs50.default.readdirSync(release).filter(
|
|
33195
|
+
(name3) => name3.endsWith(".build") && !supplied.has(name3.slice(0, -".build".length)) && import_node_fs50.default.existsSync(import_node_path50.default.join(release, name3, "module.modulemap"))
|
|
33117
33196
|
).sort().map((name3) => import_node_path50.default.join(release, name3))
|
|
33118
33197
|
];
|
|
33119
33198
|
}
|
|
@@ -33149,17 +33228,17 @@ function swiftInterfaceForWasm(text5, cFlags) {
|
|
|
33149
33228
|
}
|
|
33150
33229
|
function swiftStandin(surface, binary, toolchain, work, behavior, siblings) {
|
|
33151
33230
|
const text5 = swiftInterfaceForWasm(
|
|
33152
|
-
|
|
33231
|
+
import_node_fs50.default.readFileSync(surface.interface, "utf8"),
|
|
33153
33232
|
swiftSdkPaths(toolchain.moduleRoot, toolchain.toolchainBin).cFlags
|
|
33154
33233
|
);
|
|
33155
33234
|
const search = import_node_path50.default.join(work, "interfaces");
|
|
33156
33235
|
const moduleDir = import_node_path50.default.join(search, `${surface.module}.swiftmodule`);
|
|
33157
|
-
|
|
33158
|
-
|
|
33236
|
+
import_node_fs50.default.mkdirSync(moduleDir, { recursive: true });
|
|
33237
|
+
import_node_fs50.default.writeFileSync(import_node_path50.default.join(moduleDir, `${TRIPLE}.swiftinterface`), text5);
|
|
33159
33238
|
const imports2 = swiftImportNames(text5);
|
|
33160
33239
|
const wasm = wasmFlags(toolchain, imports2);
|
|
33161
33240
|
const out = import_node_path50.default.join(work, "graphs");
|
|
33162
|
-
|
|
33241
|
+
import_node_fs50.default.mkdirSync(out, { recursive: true });
|
|
33163
33242
|
const symbolgraphWasm = ["-enable-objc-interop"];
|
|
33164
33243
|
for (let index = 0; index < wasm.length; index++) {
|
|
33165
33244
|
if (wasm[index] === "-Xfrontend" && wasm[index + 1] === "-enable-objc-interop") {
|
|
@@ -33191,7 +33270,7 @@ function swiftStandin(surface, binary, toolchain, work, behavior, siblings) {
|
|
|
33191
33270
|
out
|
|
33192
33271
|
])
|
|
33193
33272
|
);
|
|
33194
|
-
const graphs =
|
|
33273
|
+
const graphs = import_node_fs50.default.readdirSync(out).filter((name3) => name3.endsWith(".symbols.json")).sort().map((name3) => JSON.parse(import_node_fs50.default.readFileSync(import_node_path50.default.join(out, name3), "utf8")));
|
|
33195
33274
|
const supplemented = synthesizedInterfaceEnums(text5, surface.module, graphs);
|
|
33196
33275
|
restoreSwiftInterfaceSPI(text5, surface.module, graphs);
|
|
33197
33276
|
return graphStandin(
|
|
@@ -33216,7 +33295,7 @@ function swiftStandin(surface, binary, toolchain, work, behavior, siblings) {
|
|
|
33216
33295
|
);
|
|
33217
33296
|
}
|
|
33218
33297
|
function placeholderStandin(surface, binary, toolchain, work, behavior, siblings) {
|
|
33219
|
-
const texts = surface.sources.map((file) =>
|
|
33298
|
+
const texts = surface.sources.map((file) => import_node_fs50.default.readFileSync(file, "utf8"));
|
|
33220
33299
|
const imports2 = [...new Set(texts.flatMap((text5) => swiftImportNames(text5)))];
|
|
33221
33300
|
const wasm = [
|
|
33222
33301
|
...wasmFlags(toolchain, [...FOUNDATION_IMPLICIT_MODULES, ...imports2]),
|
|
@@ -33228,9 +33307,9 @@ function placeholderStandin(surface, binary, toolchain, work, behavior, siblings
|
|
|
33228
33307
|
])
|
|
33229
33308
|
];
|
|
33230
33309
|
const out = import_node_path50.default.join(work, "graphs");
|
|
33231
|
-
|
|
33232
|
-
|
|
33233
|
-
const extracted = (0,
|
|
33310
|
+
import_node_fs50.default.mkdirSync(import_node_path50.default.join(work, "interface"), { recursive: true });
|
|
33311
|
+
import_node_fs50.default.mkdirSync(out, { recursive: true });
|
|
33312
|
+
const extracted = (0, import_node_child_process31.spawnSync)(
|
|
33234
33313
|
import_node_path50.default.join(toolchain.toolchainBin, "swiftc"),
|
|
33235
33314
|
[
|
|
33236
33315
|
"-emit-module",
|
|
@@ -33262,7 +33341,7 @@ function placeholderStandin(surface, binary, toolchain, work, behavior, siblings
|
|
|
33262
33341
|
],
|
|
33263
33342
|
{ encoding: "utf8", env: swiftEnvironment(), maxBuffer: 256 * 1024 * 1024 }
|
|
33264
33343
|
);
|
|
33265
|
-
const graphs =
|
|
33344
|
+
const graphs = import_node_fs50.default.readdirSync(out).filter((name3) => name3.endsWith(".symbols.json")).sort().map((name3) => JSON.parse(import_node_fs50.default.readFileSync(import_node_path50.default.join(out, name3), "utf8")));
|
|
33266
33345
|
if (!graphs.some((graph) => graph.module.name === surface.module))
|
|
33267
33346
|
throw new Error(
|
|
33268
33347
|
`its public interface did not extract: ${extracted.error?.message ?? extracted.stderr.trim().slice(-2e3)}`
|
|
@@ -33374,7 +33453,7 @@ function mixedStandin(surface, binary, toolchain, work, behavior, frameworkDirs,
|
|
|
33374
33453
|
void 0,
|
|
33375
33454
|
frameworkDirs
|
|
33376
33455
|
);
|
|
33377
|
-
const interfaceText =
|
|
33456
|
+
const interfaceText = import_node_fs50.default.readFileSync(surface.interface, "utf8");
|
|
33378
33457
|
restoreSwiftInterfaceSPI(interfaceText, surface.module, view.graphs);
|
|
33379
33458
|
const values = new Map([
|
|
33380
33459
|
...view.values,
|
|
@@ -33509,7 +33588,7 @@ function objcStandin(surface, binary, toolchain, work, behavior, frameworks, sib
|
|
|
33509
33588
|
import_node_path50.default.join(work, "dependencies", module2),
|
|
33510
33589
|
void 0,
|
|
33511
33590
|
frameworks.dirs.filter(
|
|
33512
|
-
(dir) => !
|
|
33591
|
+
(dir) => !import_node_fs50.default.existsSync(import_node_path50.default.join(dir, `${module2}.framework`))
|
|
33513
33592
|
)
|
|
33514
33593
|
).graphs;
|
|
33515
33594
|
});
|
|
@@ -33633,8 +33712,8 @@ function graphStandin(module2, graphs, values, wasm, binary, toolchain, work, re
|
|
|
33633
33712
|
`Configured Swift behavior ${module2}.${entry.path} was not emitted: ${entry.reason}`
|
|
33634
33713
|
);
|
|
33635
33714
|
}
|
|
33636
|
-
|
|
33637
|
-
const check2 = (0,
|
|
33715
|
+
import_node_fs50.default.writeFileSync(file, source + trailer);
|
|
33716
|
+
const check2 = (0, import_node_child_process31.spawnSync)(
|
|
33638
33717
|
import_node_path50.default.join(toolchain.toolchainBin, "swiftc"),
|
|
33639
33718
|
// emitting the module runs the diagnostics a typecheck skips, such as
|
|
33640
33719
|
// literal overflow, which the app's build of the stand-in reaches
|
|
@@ -33835,7 +33914,7 @@ function cStandin(surface, binary, toolchain, work) {
|
|
|
33835
33914
|
const moduleRoots = moduleMapHeaders(surface.modulemap, everyHeader);
|
|
33836
33915
|
const headers = [...moduleRoots];
|
|
33837
33916
|
for (let at = 0; at < headers.length; at++)
|
|
33838
|
-
for (const [, local] of
|
|
33917
|
+
for (const [, local] of import_node_fs50.default.readFileSync(import_node_path50.default.join(surface.headers, headers[at]), "utf8").matchAll(/^\s*#\s*(?:include|import)\s*["<]([^">]+)[">]/gm)) {
|
|
33839
33918
|
const file = import_node_path50.default.posix.normalize(
|
|
33840
33919
|
import_node_path50.default.posix.join(import_node_path50.default.posix.dirname(headers[at]), local)
|
|
33841
33920
|
);
|
|
@@ -33846,14 +33925,14 @@ function cStandin(surface, binary, toolchain, work) {
|
|
|
33846
33925
|
const texts = new Map(
|
|
33847
33926
|
headers.map((file) => [
|
|
33848
33927
|
import_node_path50.default.posix.join(headerDirectory, file),
|
|
33849
|
-
|
|
33928
|
+
import_node_fs50.default.readFileSync(import_node_path50.default.join(surface.headers, file), "utf8")
|
|
33850
33929
|
])
|
|
33851
33930
|
);
|
|
33852
33931
|
const include = import_node_path50.default.join(work, "include");
|
|
33853
|
-
|
|
33932
|
+
import_node_fs50.default.mkdirSync(include, { recursive: true });
|
|
33854
33933
|
for (const [file, text5] of texts) {
|
|
33855
|
-
|
|
33856
|
-
|
|
33934
|
+
import_node_fs50.default.mkdirSync(import_node_path50.default.dirname(import_node_path50.default.join(include, file)), { recursive: true });
|
|
33935
|
+
import_node_fs50.default.writeFileSync(import_node_path50.default.join(include, file), text5);
|
|
33857
33936
|
}
|
|
33858
33937
|
const roots = moduleRoots.map((file) => import_node_path50.default.posix.join(headerDirectory, file));
|
|
33859
33938
|
const frameworkMap = `${surface.module}.framework/Modules/module.modulemap`;
|
|
@@ -33863,7 +33942,7 @@ ${roots.map((file) => ` header "${file}"
|
|
|
33863
33942
|
}
|
|
33864
33943
|
`;
|
|
33865
33944
|
const probe = import_node_path50.default.join(work, "declarations.c");
|
|
33866
|
-
|
|
33945
|
+
import_node_fs50.default.writeFileSync(probe, roots.map((file) => `#include "${file}"
|
|
33867
33946
|
`).join(""));
|
|
33868
33947
|
const { sysroot } = swiftSdkPaths(toolchain.moduleRoot, toolchain.toolchainBin);
|
|
33869
33948
|
const ast = JSON.parse(
|
|
@@ -33942,7 +34021,7 @@ ${roots.map((file) => ` header "${file}"
|
|
|
33942
34021
|
]);
|
|
33943
34022
|
const updated = buffer.toString("utf8");
|
|
33944
34023
|
texts.set(file, updated);
|
|
33945
|
-
|
|
34024
|
+
import_node_fs50.default.writeFileSync(import_node_path50.default.join(include, file), updated);
|
|
33946
34025
|
}
|
|
33947
34026
|
const sdk = JSON.stringify(`${binary.target} (${binary.source})`);
|
|
33948
34027
|
const source = [
|
|
@@ -33960,7 +34039,7 @@ ${roots.map((file) => ` header "${file}"
|
|
|
33960
34039
|
...definitions
|
|
33961
34040
|
].join("\n");
|
|
33962
34041
|
const out = import_node_path50.default.join(work, `${surface.module}.c`);
|
|
33963
|
-
|
|
34042
|
+
import_node_fs50.default.writeFileSync(out, source);
|
|
33964
34043
|
try {
|
|
33965
34044
|
exec(import_node_path50.default.join(toolchain.toolchainBin, "clang"), [
|
|
33966
34045
|
"-target",
|
|
@@ -33984,7 +34063,7 @@ ${roots.map((file) => ` header "${file}"
|
|
|
33984
34063
|
...Object.fromEntries(
|
|
33985
34064
|
[...texts].map(([file, text5]) => [`include/${file}`, text5])
|
|
33986
34065
|
),
|
|
33987
|
-
...framework ? { [`include/${frameworkMap}`]:
|
|
34066
|
+
...framework ? { [`include/${frameworkMap}`]: import_node_fs50.default.readFileSync(surface.modulemap, "utf8") } : { "include/module.modulemap": modulemap },
|
|
33988
34067
|
[`${surface.module}.c`]: source
|
|
33989
34068
|
}
|
|
33990
34069
|
};
|
|
@@ -33992,18 +34071,18 @@ ${roots.map((file) => ` header "${file}"
|
|
|
33992
34071
|
async function cxxStandin(surface, binary, toolchain, work) {
|
|
33993
34072
|
if (!binary.cxxHeaders) throw new Error("C++ header inputs are missing");
|
|
33994
34073
|
const headers = surface.headers;
|
|
33995
|
-
const names =
|
|
34074
|
+
const names = import_node_fs50.default.readdirSync(headers, { recursive: true, encoding: "utf8" }).filter((file) => import_node_fs50.default.statSync(import_node_path50.default.join(headers, file)).isFile()).sort();
|
|
33996
34075
|
const moduleRoots = moduleMapHeaders(surface.modulemap, names);
|
|
33997
34076
|
const roots = [.../* @__PURE__ */ new Set([...binary.cxxHeaders.roots, ...moduleRoots])].sort();
|
|
33998
34077
|
const { sysroot } = swiftSdkPaths(toolchain.moduleRoot, toolchain.toolchainBin);
|
|
33999
|
-
|
|
34078
|
+
import_node_fs50.default.mkdirSync(work, { recursive: true });
|
|
34000
34079
|
const languageProbe = import_node_path50.default.join(work, "language-probe.c");
|
|
34001
|
-
|
|
34080
|
+
import_node_fs50.default.writeFileSync(
|
|
34002
34081
|
languageProbe,
|
|
34003
34082
|
roots.map((root) => `#include ${JSON.stringify(root)}
|
|
34004
34083
|
`).join("")
|
|
34005
34084
|
);
|
|
34006
|
-
const language = (0,
|
|
34085
|
+
const language = (0, import_node_child_process31.spawnSync)(
|
|
34007
34086
|
import_node_path50.default.join(toolchain.toolchainBin, "clang"),
|
|
34008
34087
|
[
|
|
34009
34088
|
"-target",
|
|
@@ -34031,14 +34110,14 @@ async function cxxStandin(surface, binary, toolchain, work) {
|
|
|
34031
34110
|
if (headers !== import_node_path50.default.join(slice, "Headers") || import_node_path50.default.dirname(surface.modulemap) !== headers)
|
|
34032
34111
|
throw new Error("C++ stand-ins require a module map at the library header root");
|
|
34033
34112
|
const texts = names.map((file) => {
|
|
34034
|
-
const bytes =
|
|
34113
|
+
const bytes = import_node_fs50.default.readFileSync(import_node_path50.default.join(headers, file));
|
|
34035
34114
|
const text5 = bytes.toString("utf8");
|
|
34036
34115
|
if (!Buffer.from(text5, "utf8").equals(bytes) || text5.includes("\0"))
|
|
34037
34116
|
throw new Error(`C++ public header ${file} is not text`);
|
|
34038
34117
|
return [file, text5];
|
|
34039
34118
|
});
|
|
34040
34119
|
for (const file of /* @__PURE__ */ new Set([...binary.cxxHeaders.reached, ...moduleRoots])) {
|
|
34041
|
-
const text5 =
|
|
34120
|
+
const text5 = import_node_fs50.default.readFileSync(import_node_path50.default.join(headers, file), "utf8");
|
|
34042
34121
|
if (/\b__OBJC__\b/.test(text5))
|
|
34043
34122
|
throw new Error(`C++ public header ${file} changes under Objective-C++`);
|
|
34044
34123
|
}
|
|
@@ -34075,8 +34154,8 @@ var UNSEARCHED = /* @__PURE__ */ new Set([
|
|
|
34075
34154
|
function crateFor(root, name3) {
|
|
34076
34155
|
const walk3 = (dir, depth) => {
|
|
34077
34156
|
const manifest = import_node_path50.default.join(dir, "Cargo.toml");
|
|
34078
|
-
if (
|
|
34079
|
-
const text5 =
|
|
34157
|
+
if (import_node_fs50.default.existsSync(manifest)) {
|
|
34158
|
+
const text5 = import_node_fs50.default.readFileSync(manifest, "utf8");
|
|
34080
34159
|
const section = (title) => new RegExp(`^\\[${title}\\]\\s*$([\\s\\S]*?)(?=^\\[|(?![\\s\\S]))`, "m").exec(
|
|
34081
34160
|
text5
|
|
34082
34161
|
)?.[1] ?? "";
|
|
@@ -34092,7 +34171,7 @@ function crateFor(root, name3) {
|
|
|
34092
34171
|
}
|
|
34093
34172
|
}
|
|
34094
34173
|
if (depth === 0) return null;
|
|
34095
|
-
for (const entry of
|
|
34174
|
+
for (const entry of import_node_fs50.default.readdirSync(dir, { withFileTypes: true })) {
|
|
34096
34175
|
if (!entry.isDirectory() || UNSEARCHED.has(entry.name) || entry.name.endsWith(".xcframework"))
|
|
34097
34176
|
continue;
|
|
34098
34177
|
const found = walk3(import_node_path50.default.join(dir, entry.name), depth - 1);
|
|
@@ -34105,7 +34184,7 @@ function crateFor(root, name3) {
|
|
|
34105
34184
|
var RUST_TOOLCHAIN = "1.94.0";
|
|
34106
34185
|
function crateWorkspace(manifest) {
|
|
34107
34186
|
let workspace = import_node_path50.default.dirname(manifest);
|
|
34108
|
-
while (!
|
|
34187
|
+
while (!import_node_fs50.default.existsSync(import_node_path50.default.join(workspace, "Cargo.lock"))) {
|
|
34109
34188
|
const parent = import_node_path50.default.dirname(workspace);
|
|
34110
34189
|
if (parent === workspace)
|
|
34111
34190
|
throw new Error(`${manifest} has no Cargo.lock; the build runs --locked`);
|
|
@@ -34118,12 +34197,12 @@ function crateSourceRoots(manifest, searchRoot) {
|
|
|
34118
34197
|
const root = import_node_path50.default.resolve(searchRoot);
|
|
34119
34198
|
const roots = import_node_path50.default.relative(root, workspace).startsWith("..") ? [root, workspace] : [root];
|
|
34120
34199
|
const inside = (dir) => roots.some((root2) => !import_node_path50.default.relative(root2, dir).startsWith(".."));
|
|
34121
|
-
const manifests = (dir) =>
|
|
34200
|
+
const manifests = (dir) => import_node_fs50.default.readdirSync(dir, { withFileTypes: true }).flatMap(
|
|
34122
34201
|
(entry) => entry.isDirectory() && !UNSEARCHED.has(entry.name) ? manifests(import_node_path50.default.join(dir, entry.name)) : entry.name === "Cargo.toml" ? [import_node_path50.default.join(dir, entry.name)] : []
|
|
34123
34202
|
);
|
|
34124
34203
|
for (let scanned = 0; scanned < roots.length; scanned++)
|
|
34125
34204
|
for (const file of manifests(roots[scanned])) {
|
|
34126
|
-
const text5 =
|
|
34205
|
+
const text5 = import_node_fs50.default.readFileSync(file, "utf8");
|
|
34127
34206
|
for (const match of text5.matchAll(/\bpath\s*=\s*"([^"]+)"/g)) {
|
|
34128
34207
|
const dir = import_node_path50.default.resolve(import_node_path50.default.dirname(file), match[1]);
|
|
34129
34208
|
if (!inside(dir)) roots.push(dir);
|
|
@@ -34134,13 +34213,13 @@ function crateSourceRoots(manifest, searchRoot) {
|
|
|
34134
34213
|
function crateSourceDigest(manifest, searchRoot) {
|
|
34135
34214
|
const hash = (0, import_node_crypto26.createHash)("sha256");
|
|
34136
34215
|
const walk3 = (dir, root) => {
|
|
34137
|
-
for (const entry of
|
|
34216
|
+
for (const entry of import_node_fs50.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name < right.name ? -1 : 1)) {
|
|
34138
34217
|
const full = import_node_path50.default.join(dir, entry.name);
|
|
34139
34218
|
if (entry.isDirectory()) {
|
|
34140
34219
|
if (!UNSEARCHED.has(entry.name)) walk3(full, root);
|
|
34141
34220
|
} else if (entry.isFile()) {
|
|
34142
34221
|
hash.update(`${import_node_path50.default.relative(root, full)}\0`);
|
|
34143
|
-
hash.update(
|
|
34222
|
+
hash.update(import_node_fs50.default.readFileSync(full));
|
|
34144
34223
|
hash.update("\0");
|
|
34145
34224
|
}
|
|
34146
34225
|
}
|
|
@@ -34169,24 +34248,25 @@ function standinLibrary(binary, searchRoot, toolchain) {
|
|
|
34169
34248
|
const native = simulatorNativeLibrary(dir);
|
|
34170
34249
|
const library = native?.kind === "archive" ? native.name : null;
|
|
34171
34250
|
const supplied = import_node_path50.default.join(dir, RUST_TARGET);
|
|
34172
|
-
if (
|
|
34173
|
-
const found =
|
|
34251
|
+
if (import_node_fs50.default.existsSync(supplied)) {
|
|
34252
|
+
const found = import_node_fs50.default.readdirSync(supplied).filter((name3) => name3.endsWith(".a"));
|
|
34174
34253
|
const chosen = library && found.includes(library) ? library : found.length === 1 ? found[0] : null;
|
|
34175
34254
|
if (!chosen)
|
|
34176
34255
|
throw new Error(
|
|
34177
34256
|
`${import_node_path50.default.relative(searchRoot, supplied)} holds no single static library${library ? ` named ${library}` : ""}`
|
|
34178
34257
|
);
|
|
34179
|
-
|
|
34258
|
+
if (!toolchain) throw new Error("supplied native libraries need the Swift SDK");
|
|
34259
|
+
return rustStaticLibrary(import_node_path50.default.join(supplied, chosen), toolchain.moduleRoot);
|
|
34180
34260
|
}
|
|
34181
|
-
if (native && toolchain &&
|
|
34182
|
-
const recipe = nativeStaticLibraryRecipe(
|
|
34261
|
+
if (native && toolchain && import_node_fs50.default.existsSync(native.file)) {
|
|
34262
|
+
const recipe = nativeStaticLibraryRecipe(import_node_fs50.default.readFileSync(native.file));
|
|
34183
34263
|
if (recipe) return nativeStaticLibrary(native.file, recipe, toolchain.moduleRoot);
|
|
34184
34264
|
}
|
|
34185
34265
|
if (!library) return null;
|
|
34186
34266
|
for (const [name3, recipe] of Object.entries(NATIVE_SLICE_RECIPES)) {
|
|
34187
34267
|
if (name3 !== import_node_path50.default.basename(dir, ".xcframework") || !toolchain) continue;
|
|
34188
34268
|
const pin2 = import_node_path50.default.join(import_node_path50.default.dirname(dir), recipe.pinFile);
|
|
34189
|
-
if (
|
|
34269
|
+
if (import_node_fs50.default.existsSync(pin2) && import_node_fs50.default.readFileSync(pin2, "utf8").trim() === recipe.upstream) {
|
|
34190
34270
|
const entry2 = nativeSliceEntry(
|
|
34191
34271
|
recipe,
|
|
34192
34272
|
toolchain.release,
|
|
@@ -34201,8 +34281,8 @@ function standinLibrary(binary, searchRoot, toolchain) {
|
|
|
34201
34281
|
if (!toolchain) throw new Error("Rust native libraries need the Swift SDK");
|
|
34202
34282
|
const entry = rustCrateEntry(manifest, library, toolchain.moduleRoot, searchRoot);
|
|
34203
34283
|
const prebuilt = fetchNativeEntry("rust", entry.name, entry.key);
|
|
34204
|
-
|
|
34205
|
-
return
|
|
34284
|
+
const archive = prebuilt ? import_node_path50.default.join(prebuilt, library) : buildRustCrate(manifest, library, searchRoot, toolchain.moduleRoot, entry);
|
|
34285
|
+
return rustStaticLibrary(archive, toolchain.moduleRoot);
|
|
34206
34286
|
}
|
|
34207
34287
|
function buildRustCrate(manifest, library, searchRoot, moduleRoot, entry = rustCrateEntry(manifest, library, moduleRoot, searchRoot)) {
|
|
34208
34288
|
const compiler = swiftModuleToolchain(moduleRoot);
|
|
@@ -34221,9 +34301,9 @@ function buildRustCrate(manifest, library, searchRoot, moduleRoot, entry = rustC
|
|
|
34221
34301
|
}))
|
|
34222
34302
|
common = import_node_path50.default.dirname(common);
|
|
34223
34303
|
const source = import_node_path50.default.join(work, "source");
|
|
34224
|
-
|
|
34304
|
+
import_node_fs50.default.rmSync(source, { recursive: true, force: true });
|
|
34225
34305
|
for (const root of roots)
|
|
34226
|
-
|
|
34306
|
+
import_node_fs50.default.cpSync(root, import_node_path50.default.join(source, import_node_path50.default.relative(common, root)), {
|
|
34227
34307
|
recursive: true,
|
|
34228
34308
|
filter: (file) => !UNSEARCHED.has(import_node_path50.default.basename(file))
|
|
34229
34309
|
});
|
|
@@ -34233,7 +34313,7 @@ function buildRustCrate(manifest, library, searchRoot, moduleRoot, entry = rustC
|
|
|
34233
34313
|
import_node_path50.default.relative(common, crateWorkspace(manifest)),
|
|
34234
34314
|
"Cargo.lock"
|
|
34235
34315
|
);
|
|
34236
|
-
const result = (0,
|
|
34316
|
+
const result = (0, import_node_child_process31.spawnSync)(
|
|
34237
34317
|
process.execPath,
|
|
34238
34318
|
[
|
|
34239
34319
|
runner,
|
|
@@ -34265,7 +34345,7 @@ function buildRustCrate(manifest, library, searchRoot, moduleRoot, entry = rustC
|
|
|
34265
34345
|
if (result.error) throw result.error;
|
|
34266
34346
|
if (result.status !== 0) {
|
|
34267
34347
|
const diagnostic = import_node_path50.default.join(work, "build.log");
|
|
34268
|
-
|
|
34348
|
+
import_node_fs50.default.writeFileSync(diagnostic, `${result.stderr}
|
|
34269
34349
|
${result.stdout}`);
|
|
34270
34350
|
throw new Error(
|
|
34271
34351
|
`Rust wasm64 could not build ${import_node_path50.default.relative(searchRoot, manifest)}: ${failure(result)}
|
|
@@ -34291,7 +34371,7 @@ full diagnostic: ${diagnostic}`
|
|
|
34291
34371
|
}
|
|
34292
34372
|
async function sourceStandins(binaries, toolchain, provided, behavior) {
|
|
34293
34373
|
const repo = import_node_path50.default.resolve(toolchain.moduleRoot, "../..");
|
|
34294
|
-
|
|
34374
|
+
import_node_fs50.default.mkdirSync(cacheDir4, { recursive: true });
|
|
34295
34375
|
const generation = standinGenerationInputs(binaries, toolchain, behavior);
|
|
34296
34376
|
const cached = import_node_path50.default.join(
|
|
34297
34377
|
cacheDir4,
|
|
@@ -34299,16 +34379,16 @@ async function sourceStandins(binaries, toolchain, provided, behavior) {
|
|
|
34299
34379
|
`${key(generation, JSON.stringify([...provided].sort()))}.json`
|
|
34300
34380
|
);
|
|
34301
34381
|
const targets = new Set(binaries.map((binary) => binary.target));
|
|
34302
|
-
if (
|
|
34382
|
+
if (import_node_fs50.default.existsSync(cached))
|
|
34303
34383
|
return readStandinResults(
|
|
34304
|
-
JSON.parse(
|
|
34384
|
+
JSON.parse(import_node_fs50.default.readFileSync(cached, "utf8")),
|
|
34305
34385
|
generation,
|
|
34306
34386
|
targets
|
|
34307
34387
|
);
|
|
34308
|
-
const work =
|
|
34388
|
+
const work = import_node_fs50.default.mkdtempSync(import_node_path50.default.join(cacheDir4, "request-"));
|
|
34309
34389
|
try {
|
|
34310
34390
|
const artifact = import_node_path50.default.join(work, "artifacts");
|
|
34311
|
-
|
|
34391
|
+
import_node_fs50.default.mkdirSync(artifact);
|
|
34312
34392
|
const local = [];
|
|
34313
34393
|
const gaps = /* @__PURE__ */ new Map();
|
|
34314
34394
|
const headers = /* @__PURE__ */ new Map();
|
|
@@ -34317,17 +34397,17 @@ async function sourceStandins(binaries, toolchain, provided, behavior) {
|
|
|
34317
34397
|
if (binary.placeholder !== void 0) {
|
|
34318
34398
|
const dir = import_node_path50.default.join(artifact, "placeholders", String(index));
|
|
34319
34399
|
for (const source of binary.placeholder.sources) {
|
|
34320
|
-
|
|
34321
|
-
|
|
34400
|
+
import_node_fs50.default.mkdirSync(import_node_path50.default.dirname(import_node_path50.default.join(dir, source)), { recursive: true });
|
|
34401
|
+
import_node_fs50.default.copyFileSync(import_node_path50.default.join(binary.dir, source), import_node_path50.default.join(dir, source));
|
|
34322
34402
|
}
|
|
34323
34403
|
local.push({ ...binary, dir, url: null, checksum: null });
|
|
34324
34404
|
} else if (binary.publicHeaders !== void 0) {
|
|
34325
34405
|
const copyHeader = (relative2) => {
|
|
34326
|
-
const source =
|
|
34406
|
+
const source = import_node_fs50.default.realpathSync(import_node_path50.default.join(binary.dir, relative2));
|
|
34327
34407
|
let destination = headers.get(source);
|
|
34328
34408
|
if (destination === void 0) {
|
|
34329
34409
|
destination = `headers/${headers.size}`;
|
|
34330
|
-
|
|
34410
|
+
import_node_fs50.default.cpSync(source, import_node_path50.default.join(artifact, destination), {
|
|
34331
34411
|
recursive: true,
|
|
34332
34412
|
dereference: true
|
|
34333
34413
|
});
|
|
@@ -34354,7 +34434,7 @@ async function sourceStandins(binaries, toolchain, provided, behavior) {
|
|
|
34354
34434
|
}
|
|
34355
34435
|
const resolved = swiftBinaryFramework(binary);
|
|
34356
34436
|
const dir = import_node_path50.default.join(artifact, String(index), import_node_path50.default.basename(resolved.dir));
|
|
34357
|
-
|
|
34437
|
+
import_node_fs50.default.cpSync(resolved.dir, dir, { recursive: true, dereference: true });
|
|
34358
34438
|
local.push({ ...binary, dir, url: null, checksum: null });
|
|
34359
34439
|
}
|
|
34360
34440
|
} catch (error) {
|
|
@@ -34367,7 +34447,7 @@ async function sourceStandins(binaries, toolchain, provided, behavior) {
|
|
|
34367
34447
|
throw new Error("Swift stand-in inputs changed during preparation");
|
|
34368
34448
|
const request = import_node_path50.default.join(work, "request.json");
|
|
34369
34449
|
const delivery = import_node_path50.default.join(work, "delivery");
|
|
34370
|
-
|
|
34450
|
+
import_node_fs50.default.writeFileSync(
|
|
34371
34451
|
request,
|
|
34372
34452
|
JSON.stringify({
|
|
34373
34453
|
binaries: local.map((binary) => ({
|
|
@@ -34381,7 +34461,7 @@ async function sourceStandins(binaries, toolchain, provided, behavior) {
|
|
|
34381
34461
|
})
|
|
34382
34462
|
);
|
|
34383
34463
|
const build = await new Promise((resolve2) => {
|
|
34384
|
-
const child = (0,
|
|
34464
|
+
const child = (0, import_node_child_process31.spawn)(
|
|
34385
34465
|
"bun",
|
|
34386
34466
|
[
|
|
34387
34467
|
import_node_path50.default.join(repo, "scripts/build/swift-standins-submit.ts"),
|
|
@@ -34411,9 +34491,9 @@ async function sourceStandins(binaries, toolchain, provided, behavior) {
|
|
|
34411
34491
|
`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"}`
|
|
34412
34492
|
);
|
|
34413
34493
|
const output2 = import_node_path50.default.join(delivery, "standins.json");
|
|
34414
|
-
if (!
|
|
34494
|
+
if (!import_node_fs50.default.existsSync(output2))
|
|
34415
34495
|
throw new Error("source stand-in builder returned no standins.json");
|
|
34416
|
-
const receipt = JSON.parse(
|
|
34496
|
+
const receipt = JSON.parse(import_node_fs50.default.readFileSync(output2, "utf8"));
|
|
34417
34497
|
const result = readStandinResults(
|
|
34418
34498
|
receipt,
|
|
34419
34499
|
preparedGeneration,
|
|
@@ -34423,14 +34503,14 @@ async function sourceStandins(binaries, toolchain, provided, behavior) {
|
|
|
34423
34503
|
throw new Error("Swift stand-in inputs changed during generation");
|
|
34424
34504
|
for (const [target, reason] of gaps) result.gaps.set(target, reason);
|
|
34425
34505
|
if (result.gaps.size === 0 && isRecord(receipt)) {
|
|
34426
|
-
|
|
34506
|
+
import_node_fs50.default.mkdirSync(import_node_path50.default.dirname(cached), { recursive: true });
|
|
34427
34507
|
const pending = `${cached}.${process.pid}.tmp`;
|
|
34428
|
-
|
|
34429
|
-
|
|
34508
|
+
import_node_fs50.default.writeFileSync(pending, JSON.stringify({ ...receipt, generation }));
|
|
34509
|
+
import_node_fs50.default.renameSync(pending, cached);
|
|
34430
34510
|
}
|
|
34431
34511
|
return result;
|
|
34432
34512
|
} finally {
|
|
34433
|
-
|
|
34513
|
+
import_node_fs50.default.rmSync(work, { recursive: true, force: true });
|
|
34434
34514
|
}
|
|
34435
34515
|
}
|
|
34436
34516
|
function readStandinResults(receipt, generation, targets) {
|
|
@@ -34516,7 +34596,7 @@ function standinGenerationInputs(binaries, toolchain, configuredBehavior = {}, s
|
|
|
34516
34596
|
...binary.placeholder.flags,
|
|
34517
34597
|
...binary.placeholder.sources.flatMap((source) => [
|
|
34518
34598
|
source,
|
|
34519
|
-
(0, import_node_crypto26.createHash)("sha256").update(
|
|
34599
|
+
(0, import_node_crypto26.createHash)("sha256").update(import_node_fs50.default.readFileSync(import_node_path50.default.join(binary.dir, source))).digest("hex")
|
|
34520
34600
|
])
|
|
34521
34601
|
);
|
|
34522
34602
|
continue;
|
|
@@ -34562,8 +34642,8 @@ async function binaryStandins(binary, toolchain, provided, behavior, frameworks,
|
|
|
34562
34642
|
if (provided.has(binary.target)) return [];
|
|
34563
34643
|
const absent = missingArtifactGap(binary);
|
|
34564
34644
|
if (absent !== null) return absent;
|
|
34565
|
-
|
|
34566
|
-
const work =
|
|
34645
|
+
import_node_fs50.default.mkdirSync(cacheDir4, { recursive: true });
|
|
34646
|
+
const work = import_node_fs50.default.mkdtempSync(import_node_path50.default.join(cacheDir4, "work-"));
|
|
34567
34647
|
let all;
|
|
34568
34648
|
let digest;
|
|
34569
34649
|
try {
|
|
@@ -34587,9 +34667,9 @@ async function binaryStandins(binary, toolchain, provided, behavior, frameworks,
|
|
|
34587
34667
|
const roots = files(headers, (name3) => name3.endsWith(".h"));
|
|
34588
34668
|
if (roots.length === 0)
|
|
34589
34669
|
throw new Error("its public header directory has no headers");
|
|
34590
|
-
|
|
34670
|
+
import_node_fs50.default.writeFileSync(
|
|
34591
34671
|
modulemap,
|
|
34592
|
-
|
|
34672
|
+
import_node_fs50.default.existsSync(supplied) ? import_node_fs50.default.readFileSync(supplied, "utf8") : `module ${module2} {
|
|
34593
34673
|
${roots.map((file) => ` header "${file}"`).join("\n")}
|
|
34594
34674
|
export *
|
|
34595
34675
|
}
|
|
@@ -34617,14 +34697,14 @@ ${roots.map((file) => ` header "${file}"`).join("\n")}
|
|
|
34617
34697
|
digest = artifact.digest;
|
|
34618
34698
|
}
|
|
34619
34699
|
} catch (error) {
|
|
34620
|
-
|
|
34700
|
+
import_node_fs50.default.rmSync(work, { recursive: true, force: true });
|
|
34621
34701
|
return error instanceof Error ? error.message : String(error);
|
|
34622
34702
|
}
|
|
34623
34703
|
const found = all.filter(
|
|
34624
34704
|
(surface) => !provided.has(surface.module) && (surface.kind === "swift" || surface.kind === "mixed" || surface.kind === "source" || files(surface.headers, (name3) => name3.endsWith(".h")).length > 0) && !(binary.cxxHeaders === void 0 && cxxOnly(surface))
|
|
34625
34705
|
);
|
|
34626
34706
|
if (found.length === 0) {
|
|
34627
|
-
|
|
34707
|
+
import_node_fs50.default.rmSync(work, { recursive: true, force: true });
|
|
34628
34708
|
if (all.length > 0) return [];
|
|
34629
34709
|
return "its iOS simulator slice has no Swift interface or C modulemap";
|
|
34630
34710
|
}
|
|
@@ -34645,7 +34725,7 @@ ${roots.map((file) => ` header "${file}"`).join("\n")}
|
|
|
34645
34725
|
(file2) => import_node_path50.default.join(surface.headers, file2)
|
|
34646
34726
|
)
|
|
34647
34727
|
])
|
|
34648
|
-
hash.update(
|
|
34728
|
+
hash.update(import_node_fs50.default.readFileSync(file));
|
|
34649
34729
|
}
|
|
34650
34730
|
const id = hash.digest("hex").slice(0, 32);
|
|
34651
34731
|
const settle = (value) => {
|
|
@@ -34657,21 +34737,21 @@ ${roots.map((file) => ` header "${file}"`).join("\n")}
|
|
|
34657
34737
|
};
|
|
34658
34738
|
const memo2 = built.get(id);
|
|
34659
34739
|
if (memo2) {
|
|
34660
|
-
|
|
34740
|
+
import_node_fs50.default.rmSync(work, { recursive: true, force: true });
|
|
34661
34741
|
return settle(memo2);
|
|
34662
34742
|
}
|
|
34663
34743
|
const cached = import_node_path50.default.join(cacheDir4, "standins", `${id}.json`);
|
|
34664
|
-
if (
|
|
34665
|
-
const value = JSON.parse(
|
|
34744
|
+
if (import_node_fs50.default.existsSync(cached)) {
|
|
34745
|
+
const value = JSON.parse(import_node_fs50.default.readFileSync(cached, "utf8"));
|
|
34666
34746
|
built.set(id, value);
|
|
34667
|
-
|
|
34747
|
+
import_node_fs50.default.rmSync(work, { recursive: true, force: true });
|
|
34668
34748
|
return settle(value);
|
|
34669
34749
|
}
|
|
34670
34750
|
const publish = (value) => {
|
|
34671
|
-
|
|
34751
|
+
import_node_fs50.default.mkdirSync(import_node_path50.default.dirname(cached), { recursive: true });
|
|
34672
34752
|
const pending = `${cached}.${process.pid}.tmp`;
|
|
34673
|
-
|
|
34674
|
-
|
|
34753
|
+
import_node_fs50.default.writeFileSync(pending, JSON.stringify(value));
|
|
34754
|
+
import_node_fs50.default.renameSync(pending, cached);
|
|
34675
34755
|
built.set(id, value);
|
|
34676
34756
|
};
|
|
34677
34757
|
let result;
|
|
@@ -34732,7 +34812,7 @@ ${roots.map((file) => ` header "${file}"`).join("\n")}
|
|
|
34732
34812
|
cause = cause.cause;
|
|
34733
34813
|
if (!(cause instanceof Error)) publish(result);
|
|
34734
34814
|
} finally {
|
|
34735
|
-
|
|
34815
|
+
import_node_fs50.default.rmSync(work, { recursive: true, force: true });
|
|
34736
34816
|
}
|
|
34737
34817
|
return settle(result);
|
|
34738
34818
|
}
|
|
@@ -34770,8 +34850,8 @@ async function buildStandins(binaries, toolchain, provided, behavior) {
|
|
|
34770
34850
|
return sourceStandins(requested, toolchain, provided, behavior);
|
|
34771
34851
|
const standins = [];
|
|
34772
34852
|
const gaps = /* @__PURE__ */ new Map();
|
|
34773
|
-
|
|
34774
|
-
const modules =
|
|
34853
|
+
import_node_fs50.default.mkdirSync(cacheDir4, { recursive: true });
|
|
34854
|
+
const modules = import_node_fs50.default.mkdtempSync(import_node_path50.default.join(cacheDir4, "modules-"));
|
|
34775
34855
|
const frameworkDirs = /* @__PURE__ */ new Set();
|
|
34776
34856
|
const frameworkSurfaces = /* @__PURE__ */ new Map();
|
|
34777
34857
|
const frameworkInputs = [];
|
|
@@ -34785,7 +34865,7 @@ async function buildStandins(binaries, toolchain, provided, behavior) {
|
|
|
34785
34865
|
binary,
|
|
34786
34866
|
new Set(
|
|
34787
34867
|
binary.placeholder.sources.flatMap(
|
|
34788
|
-
(source) => swiftImportNames(
|
|
34868
|
+
(source) => swiftImportNames(import_node_fs50.default.readFileSync(import_node_path50.default.join(binary.dir, source), "utf8"))
|
|
34789
34869
|
)
|
|
34790
34870
|
)
|
|
34791
34871
|
);
|
|
@@ -34801,13 +34881,13 @@ async function buildStandins(binaries, toolchain, provided, behavior) {
|
|
|
34801
34881
|
byModule.set(surface.module, binary);
|
|
34802
34882
|
if (surface.kind === "swift" || surface.kind === "mixed")
|
|
34803
34883
|
for (const module2 of swiftImportNames(
|
|
34804
|
-
|
|
34884
|
+
import_node_fs50.default.readFileSync(surface.interface, "utf8")
|
|
34805
34885
|
))
|
|
34806
34886
|
imports2.add(module2);
|
|
34807
34887
|
if (surface.kind === "objc" || surface.kind === "mixed")
|
|
34808
34888
|
for (const file of files(surface.headers, (name3) => name3.endsWith(".h")))
|
|
34809
34889
|
for (const module2 of clangImportNames(
|
|
34810
|
-
|
|
34890
|
+
import_node_fs50.default.readFileSync(import_node_path50.default.join(surface.headers, file), "utf8")
|
|
34811
34891
|
))
|
|
34812
34892
|
imports2.add(module2);
|
|
34813
34893
|
if (surface.kind === "c") continue;
|
|
@@ -34881,7 +34961,7 @@ async function buildStandins(binaries, toolchain, provided, behavior) {
|
|
|
34881
34961
|
const source = standin.files[`${standin.module}.swift`];
|
|
34882
34962
|
if (source !== void 0) {
|
|
34883
34963
|
const file = import_node_path50.default.join(modules, `${standin.module}.swift`);
|
|
34884
|
-
|
|
34964
|
+
import_node_fs50.default.writeFileSync(file, source);
|
|
34885
34965
|
try {
|
|
34886
34966
|
exec(import_node_path50.default.join(toolchain.toolchainBin, "swiftc"), [
|
|
34887
34967
|
"-emit-module",
|
|
@@ -34909,7 +34989,7 @@ async function buildStandins(binaries, toolchain, provided, behavior) {
|
|
|
34909
34989
|
for (const binary of binaries) await visit(binary);
|
|
34910
34990
|
return { standins, gaps };
|
|
34911
34991
|
} finally {
|
|
34912
|
-
|
|
34992
|
+
import_node_fs50.default.rmSync(modules, { recursive: true, force: true });
|
|
34913
34993
|
}
|
|
34914
34994
|
}
|
|
34915
34995
|
|
|
@@ -34923,7 +35003,7 @@ var SwiftObjCCompilationError = class extends Error {
|
|
|
34923
35003
|
var isDirectory2 = (file) => linkedStat(file)?.isDirectory() ?? false;
|
|
34924
35004
|
function linkedStat(file) {
|
|
34925
35005
|
try {
|
|
34926
|
-
return
|
|
35006
|
+
return import_node_fs51.default.statSync(file);
|
|
34927
35007
|
} catch (error) {
|
|
34928
35008
|
if (error instanceof Error && "code" in error && error.code === "ENOENT") return null;
|
|
34929
35009
|
throw error;
|
|
@@ -34972,20 +35052,20 @@ function xcodeStagedPath(file, root, checkouts, work, sysroot, label, externalFr
|
|
|
34972
35052
|
function writeXcodeSnapshot(sources, links, staged) {
|
|
34973
35053
|
for (const [file, bytes] of sources) {
|
|
34974
35054
|
const output2 = staged(file);
|
|
34975
|
-
|
|
35055
|
+
import_node_fs51.default.mkdirSync(import_node_path51.default.dirname(output2), { recursive: true });
|
|
34976
35056
|
const target = links[file];
|
|
34977
35057
|
if (target === void 0) {
|
|
34978
|
-
|
|
35058
|
+
import_node_fs51.default.writeFileSync(output2, bytes);
|
|
34979
35059
|
continue;
|
|
34980
35060
|
}
|
|
34981
35061
|
const real = staged(target);
|
|
34982
|
-
|
|
34983
|
-
|
|
34984
|
-
const alias =
|
|
34985
|
-
const canonical =
|
|
35062
|
+
import_node_fs51.default.mkdirSync(import_node_path51.default.dirname(real), { recursive: true });
|
|
35063
|
+
import_node_fs51.default.writeFileSync(real, bytes);
|
|
35064
|
+
const alias = import_node_fs51.default.statSync(output2, { throwIfNoEntry: false });
|
|
35065
|
+
const canonical = import_node_fs51.default.statSync(real);
|
|
34986
35066
|
if (alias?.dev === canonical.dev && alias.ino === canonical.ino) continue;
|
|
34987
|
-
|
|
34988
|
-
|
|
35067
|
+
import_node_fs51.default.rmSync(output2, { force: true });
|
|
35068
|
+
import_node_fs51.default.symlinkSync(import_node_path51.default.relative(import_node_path51.default.dirname(output2), real), output2);
|
|
34989
35069
|
}
|
|
34990
35070
|
}
|
|
34991
35071
|
var FRAMEWORK_IMPORT = /#\s*(?:import|include)\s*<([\w+-]+)\/([\w+.-]+\.h)>/g;
|
|
@@ -34998,8 +35078,8 @@ function frameworkImports(app) {
|
|
|
34998
35078
|
...target.objc.headers,
|
|
34999
35079
|
...target.allSources.filter(isSwiftNativeTranslationUnit)
|
|
35000
35080
|
]) {
|
|
35001
|
-
if (file.endsWith(".swift") || !
|
|
35002
|
-
for (const [, framework, header] of
|
|
35081
|
+
if (file.endsWith(".swift") || !import_node_fs51.default.existsSync(file)) continue;
|
|
35082
|
+
for (const [, framework, header] of import_node_fs51.default.readFileSync(file, "utf8").matchAll(FRAMEWORK_IMPORT)) {
|
|
35003
35083
|
const headers = imports2.get(framework) ?? /* @__PURE__ */ new Set();
|
|
35004
35084
|
headers.add(header);
|
|
35005
35085
|
imports2.set(framework, headers);
|
|
@@ -35017,9 +35097,9 @@ function compiledFrameworkImports(app, products) {
|
|
|
35017
35097
|
);
|
|
35018
35098
|
const seen = /* @__PURE__ */ new Set();
|
|
35019
35099
|
const visit = (file) => {
|
|
35020
|
-
if (seen.has(file) || !
|
|
35100
|
+
if (seen.has(file) || !import_node_fs51.default.existsSync(file)) return;
|
|
35021
35101
|
seen.add(file);
|
|
35022
|
-
const source =
|
|
35102
|
+
const source = import_node_fs51.default.readFileSync(file, "utf8");
|
|
35023
35103
|
for (const [, framework, header] of source.matchAll(FRAMEWORK_IMPORT)) {
|
|
35024
35104
|
const headers = imports2.get(framework) ?? /* @__PURE__ */ new Set();
|
|
35025
35105
|
headers.add(header);
|
|
@@ -35056,13 +35136,13 @@ function installedPackageDirs(root) {
|
|
|
35056
35136
|
const dirs = [];
|
|
35057
35137
|
for (let dir = root; ; dir = import_node_path51.default.dirname(dir)) {
|
|
35058
35138
|
const modules = import_node_path51.default.join(dir, "node_modules");
|
|
35059
|
-
if (
|
|
35060
|
-
dirs.push(
|
|
35139
|
+
if (import_node_fs51.default.existsSync(modules)) {
|
|
35140
|
+
dirs.push(import_node_fs51.default.realpathSync.native(modules));
|
|
35061
35141
|
if (dir === root)
|
|
35062
|
-
for (const entry of
|
|
35142
|
+
for (const entry of import_node_fs51.default.readdirSync(modules, { withFileTypes: true })) {
|
|
35063
35143
|
const target = import_node_path51.default.join(modules, entry.name);
|
|
35064
|
-
if (entry.isSymbolicLink() &&
|
|
35065
|
-
dirs.push(
|
|
35144
|
+
if (entry.isSymbolicLink() && import_node_fs51.default.existsSync(target))
|
|
35145
|
+
dirs.push(import_node_fs51.default.realpathSync.native(target));
|
|
35066
35146
|
}
|
|
35067
35147
|
}
|
|
35068
35148
|
if (dir === import_node_path51.default.dirname(dir)) break;
|
|
@@ -35078,7 +35158,7 @@ function* xcodeObjCInputSteps(app, binaries, moduleRoot, products, sourceRoot =
|
|
|
35078
35158
|
const checkouts = remoteSwiftCheckouts(app.rootDir);
|
|
35079
35159
|
const externalFrameworkDirs = [
|
|
35080
35160
|
...new Set(
|
|
35081
|
-
[...app.frameworks, app].flatMap((target) => target.objc?.frameworkSearchPaths ?? []).filter((directory) => import_node_path51.default.isAbsolute(directory) &&
|
|
35161
|
+
[...app.frameworks, app].flatMap((target) => target.objc?.frameworkSearchPaths ?? []).filter((directory) => import_node_path51.default.isAbsolute(directory) && import_node_fs51.default.existsSync(directory)).map((directory) => import_node_fs51.default.realpathSync.native(directory))
|
|
35082
35162
|
)
|
|
35083
35163
|
].filter((directory) => relativeInside(sourceRoot, directory) === null);
|
|
35084
35164
|
const installedDirs = installedPackageDirs(sourceRoot);
|
|
@@ -35098,12 +35178,12 @@ function* xcodeObjCInputSteps(app, binaries, moduleRoot, products, sourceRoot =
|
|
|
35098
35178
|
const add = (file, header = false) => {
|
|
35099
35179
|
const generatedFile = generated.get(file);
|
|
35100
35180
|
if (generatedFile) {
|
|
35101
|
-
sources.set(file,
|
|
35181
|
+
sources.set(file, import_node_fs51.default.readFileSync(generatedFile));
|
|
35102
35182
|
return;
|
|
35103
35183
|
}
|
|
35104
35184
|
if (pending.has(file)) return;
|
|
35105
35185
|
if (sources.has(file)) return;
|
|
35106
|
-
const resolved = header ?
|
|
35186
|
+
const resolved = header ? import_node_fs51.default.realpathSync.native(file) : file;
|
|
35107
35187
|
if (resolved !== file) links[file] = resolved;
|
|
35108
35188
|
const external = [...externalFrameworkDirs, ...installedDirs].find(
|
|
35109
35189
|
(directory) => relativeInside(directory, resolved) !== null
|
|
@@ -35134,11 +35214,11 @@ function* xcodeObjCInputSteps(app, binaries, moduleRoot, products, sourceRoot =
|
|
|
35134
35214
|
const ancestors = /* @__PURE__ */ new Set();
|
|
35135
35215
|
const addHeaders = function* (directory, binaryHeaders2 = false) {
|
|
35136
35216
|
if (walked.has(directory) && (!binaryHeaders2 || walked.get(directory))) return;
|
|
35137
|
-
const real =
|
|
35217
|
+
const real = import_node_fs51.default.realpathSync.native(directory);
|
|
35138
35218
|
if (ancestors.has(real)) return;
|
|
35139
35219
|
walked.set(directory, binaryHeaders2);
|
|
35140
35220
|
ancestors.add(real);
|
|
35141
|
-
for (const entry of
|
|
35221
|
+
for (const entry of import_node_fs51.default.readdirSync(directory, { withFileTypes: true })) {
|
|
35142
35222
|
if (++workCount % 64 === 0) yield;
|
|
35143
35223
|
if (!binaryHeaders2 && entry.name.startsWith(".") && !entry.isFile()) continue;
|
|
35144
35224
|
const file = import_node_path51.default.join(directory, entry.name);
|
|
@@ -35199,7 +35279,7 @@ function* xcodeObjCInputSteps(app, binaries, moduleRoot, products, sourceRoot =
|
|
|
35199
35279
|
) ? flag : /^-I(.+)$/.exec(flag)?.[1];
|
|
35200
35280
|
if (directory) {
|
|
35201
35281
|
const include = import_node_path51.default.resolve(target.dir, directory);
|
|
35202
|
-
if (
|
|
35282
|
+
if (import_node_fs51.default.existsSync(include)) yield* addHeaders(include);
|
|
35203
35283
|
}
|
|
35204
35284
|
}
|
|
35205
35285
|
targets.push({
|
|
@@ -35296,7 +35376,7 @@ function* xcodeObjCInputSteps(app, binaries, moduleRoot, products, sourceRoot =
|
|
|
35296
35376
|
if (moduleMap) {
|
|
35297
35377
|
const requested = import_node_path51.default.resolve(app.rootDir, moduleMap);
|
|
35298
35378
|
const file = products ? requested : app.moduleMapSources?.[requested] ?? requested;
|
|
35299
|
-
if (generated.has(file) || !pending.has(file) &&
|
|
35379
|
+
if (generated.has(file) || !pending.has(file) && import_node_fs51.default.existsSync(file))
|
|
35300
35380
|
queue.push({ file });
|
|
35301
35381
|
}
|
|
35302
35382
|
const directory = ["-I", "-F", "-iquote", "-isystem", "-iframework"].includes(
|
|
@@ -35508,20 +35588,20 @@ function prepareXcodeSwiftProducts(app, binaries, moduleRoot) {
|
|
|
35508
35588
|
targets: native,
|
|
35509
35589
|
externalFrameworkDirs
|
|
35510
35590
|
} = xcodeObjCInputs(app, binaries, moduleRoot);
|
|
35511
|
-
for (const file of app.projectFiles) sources.set(file,
|
|
35591
|
+
for (const file of app.projectFiles) sources.set(file, import_node_fs51.default.readFileSync(file));
|
|
35512
35592
|
const digest = (bytes) => (0, import_node_crypto27.createHash)("sha256").update(bytes).digest("hex");
|
|
35513
35593
|
const providers = /* @__PURE__ */ new Map();
|
|
35514
35594
|
for (const target of targets) {
|
|
35515
35595
|
if (!supplied.has(target.moduleName)) continue;
|
|
35516
35596
|
const file = import_node_path51.default.join(modules, `${target.moduleName}.swiftmodule`);
|
|
35517
|
-
if (!
|
|
35597
|
+
if (!import_node_fs51.default.existsSync(file) || !import_node_fs51.default.statSync(file).isFile())
|
|
35518
35598
|
throw new Error(
|
|
35519
35599
|
`${target.moduleName}: Swift compatibility header requires its canonical compiled SDK module at ${file}`
|
|
35520
35600
|
);
|
|
35521
35601
|
providers.set(target.moduleName, file);
|
|
35522
35602
|
}
|
|
35523
35603
|
const toolsetFile = import_node_path51.default.join(import_node_path51.default.dirname(sdk.sysroot), "toolset.json");
|
|
35524
|
-
const toolset = JSON.parse(
|
|
35604
|
+
const toolset = JSON.parse(import_node_fs51.default.readFileSync(toolsetFile, "utf8"));
|
|
35525
35605
|
if (!isRecord(toolset) || !isRecord(toolset.swiftCompiler) || !Array.isArray(toolset.swiftCompiler.extraCLIOptions) || !toolset.swiftCompiler.extraCLIOptions.every(
|
|
35526
35606
|
(flag) => typeof flag === "string"
|
|
35527
35607
|
))
|
|
@@ -35541,8 +35621,8 @@ function prepareXcodeSwiftProducts(app, binaries, moduleRoot) {
|
|
|
35541
35621
|
version: 4,
|
|
35542
35622
|
sdk: swiftModuleSdk(moduleRoot),
|
|
35543
35623
|
distribution: swiftModuleDigest(moduleRoot).toString("hex"),
|
|
35544
|
-
compiler: digest(
|
|
35545
|
-
toolset: digest(
|
|
35624
|
+
compiler: digest(import_node_fs51.default.readFileSync(frontend)),
|
|
35625
|
+
toolset: digest(import_node_fs51.default.readFileSync(toolsetFile)),
|
|
35546
35626
|
targets,
|
|
35547
35627
|
externalFrameworkDirs,
|
|
35548
35628
|
inputs: Object.fromEntries(
|
|
@@ -35550,14 +35630,14 @@ function prepareXcodeSwiftProducts(app, binaries, moduleRoot) {
|
|
|
35550
35630
|
),
|
|
35551
35631
|
links,
|
|
35552
35632
|
providers: Object.fromEntries(
|
|
35553
|
-
[...providers].map(([name3, file]) => [name3, digest(
|
|
35633
|
+
[...providers].map(([name3, file]) => [name3, digest(import_node_fs51.default.readFileSync(file))])
|
|
35554
35634
|
)
|
|
35555
35635
|
};
|
|
35556
35636
|
const parent = import_node_path51.default.join(cacheDir(), "swift-xcode-products");
|
|
35557
|
-
|
|
35637
|
+
import_node_fs51.default.mkdirSync(parent, { recursive: true });
|
|
35558
35638
|
const key2 = digest(JSON.stringify(identity2));
|
|
35559
35639
|
const work = import_node_path51.default.join(parent, key2);
|
|
35560
|
-
const descriptor =
|
|
35640
|
+
const descriptor = import_node_fs51.default.openSync(`${work}.lock`, "a");
|
|
35561
35641
|
const checkouts = remoteSwiftCheckouts(app.rootDir);
|
|
35562
35642
|
const local = (file) => xcodeStagedPath(
|
|
35563
35643
|
file,
|
|
@@ -35593,7 +35673,7 @@ function prepareXcodeSwiftProducts(app, binaries, moduleRoot) {
|
|
|
35593
35673
|
provided: [...providers.keys()]
|
|
35594
35674
|
};
|
|
35595
35675
|
try {
|
|
35596
|
-
const lock = (0,
|
|
35676
|
+
const lock = (0, import_node_child_process32.spawnSync)(
|
|
35597
35677
|
"perl",
|
|
35598
35678
|
["-e", 'open(my $f, ">&=", 3) or die $!; flock($f, 2) or die $!'],
|
|
35599
35679
|
{ stdio: ["ignore", "pipe", "pipe", descriptor], encoding: "utf8" }
|
|
@@ -35603,8 +35683,8 @@ function prepareXcodeSwiftProducts(app, binaries, moduleRoot) {
|
|
|
35603
35683
|
`Could not lock Swift products: ${lock.error?.message ?? lock.stderr}`
|
|
35604
35684
|
);
|
|
35605
35685
|
const completed = import_node_path51.default.join(work, "completed.json");
|
|
35606
|
-
if (
|
|
35607
|
-
const retained = JSON.parse(
|
|
35686
|
+
if (import_node_fs51.default.existsSync(completed)) {
|
|
35687
|
+
const retained = JSON.parse(import_node_fs51.default.readFileSync(completed, "utf8"));
|
|
35608
35688
|
const required = [
|
|
35609
35689
|
...productFiles.map(({ file }) => file),
|
|
35610
35690
|
...objects.map(({ file }) => file),
|
|
@@ -35616,13 +35696,13 @@ function prepareXcodeSwiftProducts(app, binaries, moduleRoot) {
|
|
|
35616
35696
|
if (isRecord(retained) && retained.key === key2 && isRecord(retained.files) && required.every(
|
|
35617
35697
|
(file) => isRecord(retained.files) && import_node_path51.default.relative(work, file) in retained.files
|
|
35618
35698
|
) && Object.entries(retained.files).every(
|
|
35619
|
-
([file, hash]) => typeof hash === "string" &&
|
|
35699
|
+
([file, hash]) => typeof hash === "string" && import_node_fs51.default.existsSync(import_node_path51.default.join(work, file)) && digest(import_node_fs51.default.readFileSync(import_node_path51.default.join(work, file))) === hash
|
|
35620
35700
|
))
|
|
35621
35701
|
return preparation;
|
|
35622
35702
|
}
|
|
35623
|
-
|
|
35624
|
-
|
|
35625
|
-
|
|
35703
|
+
import_node_fs51.default.rmSync(work, { recursive: true, force: true });
|
|
35704
|
+
import_node_fs51.default.mkdirSync(preparation.modules, { recursive: true });
|
|
35705
|
+
import_node_fs51.default.writeFileSync(
|
|
35626
35706
|
preparation.receipt,
|
|
35627
35707
|
JSON.stringify({ ...identity2, commands: [] }, null, 2)
|
|
35628
35708
|
);
|
|
@@ -35665,10 +35745,10 @@ function prepareXcodeSwiftProducts(app, binaries, moduleRoot) {
|
|
|
35665
35745
|
preparation.modules,
|
|
35666
35746
|
`${target.moduleName}.swiftmodule`
|
|
35667
35747
|
);
|
|
35668
|
-
|
|
35669
|
-
|
|
35670
|
-
|
|
35671
|
-
|
|
35748
|
+
import_node_fs51.default.mkdirSync(import_node_path51.default.dirname(outputMap), { recursive: true });
|
|
35749
|
+
import_node_fs51.default.mkdirSync(import_node_path51.default.dirname(outputHeader), { recursive: true });
|
|
35750
|
+
import_node_fs51.default.copyFileSync(local(compatibility.moduleMap), outputMap);
|
|
35751
|
+
import_node_fs51.default.copyFileSync(local(compatibility.umbrella), local(compatibility.outputUmbrella));
|
|
35672
35752
|
const provider = providers.get(target.moduleName);
|
|
35673
35753
|
if (compatibility.framework && !provider) {
|
|
35674
35754
|
const viewModules = import_node_path51.default.join(
|
|
@@ -35685,10 +35765,10 @@ function prepareXcodeSwiftProducts(app, binaries, moduleRoot) {
|
|
|
35685
35765
|
"Headers",
|
|
35686
35766
|
import_node_path51.default.basename(compatibility.umbrella)
|
|
35687
35767
|
);
|
|
35688
|
-
|
|
35689
|
-
|
|
35690
|
-
|
|
35691
|
-
|
|
35768
|
+
import_node_fs51.default.mkdirSync(import_node_path51.default.dirname(viewModules), { recursive: true });
|
|
35769
|
+
import_node_fs51.default.mkdirSync(import_node_path51.default.dirname(viewHeaders), { recursive: true });
|
|
35770
|
+
import_node_fs51.default.copyFileSync(ownMap, viewModules);
|
|
35771
|
+
import_node_fs51.default.copyFileSync(local(compatibility.umbrella), viewHeaders);
|
|
35692
35772
|
generated.push(viewModules, viewHeaders);
|
|
35693
35773
|
ownMap = viewModules;
|
|
35694
35774
|
}
|
|
@@ -35721,7 +35801,7 @@ function prepareXcodeSwiftProducts(app, binaries, moduleRoot) {
|
|
|
35721
35801
|
);
|
|
35722
35802
|
}
|
|
35723
35803
|
const carriesOwnMap = provider !== void 0 || target.swift.flags.some(
|
|
35724
|
-
(flag) => flag.startsWith("-fmodule-map-file=") &&
|
|
35804
|
+
(flag) => flag.startsWith("-fmodule-map-file=") && import_node_fs51.default.existsSync(flag.slice("-fmodule-map-file=".length)) && import_node_fs51.default.realpathSync.native(flag.slice("-fmodule-map-file=".length)) === import_node_fs51.default.realpathSync.native(compatibility.moduleMap)
|
|
35725
35805
|
);
|
|
35726
35806
|
const args = [
|
|
35727
35807
|
...provider ? ["-merge-modules", "-emit-module"] : ["-emit-object", "-whole-module-optimization", "-parse-as-library"],
|
|
@@ -35764,7 +35844,7 @@ function prepareXcodeSwiftProducts(app, binaries, moduleRoot) {
|
|
|
35764
35844
|
import_node_path51.default.join(work, `${target.moduleName}.o`)
|
|
35765
35845
|
]
|
|
35766
35846
|
];
|
|
35767
|
-
const result = (0,
|
|
35847
|
+
const result = (0, import_node_child_process32.spawnSync)(frontend, args, {
|
|
35768
35848
|
cwd: work,
|
|
35769
35849
|
encoding: "utf8",
|
|
35770
35850
|
env: swiftEnvironment(),
|
|
@@ -35773,7 +35853,7 @@ function prepareXcodeSwiftProducts(app, binaries, moduleRoot) {
|
|
|
35773
35853
|
maxBuffer: 32 * 1024 * 1024
|
|
35774
35854
|
});
|
|
35775
35855
|
const log = import_node_path51.default.join(work, `${target.moduleName}.log`);
|
|
35776
|
-
|
|
35856
|
+
import_node_fs51.default.writeFileSync(
|
|
35777
35857
|
log,
|
|
35778
35858
|
`${result.stdout ?? ""}${result.stderr ?? ""}${result.error ? `
|
|
35779
35859
|
${result.error.message}` : ""}`
|
|
@@ -35784,17 +35864,17 @@ ${result.error.message}` : ""}`
|
|
|
35784
35864
|
status: result.status,
|
|
35785
35865
|
signal: result.signal
|
|
35786
35866
|
});
|
|
35787
|
-
|
|
35867
|
+
import_node_fs51.default.writeFileSync(
|
|
35788
35868
|
preparation.receipt,
|
|
35789
35869
|
JSON.stringify({ ...identity2, commands }, null, 2)
|
|
35790
35870
|
);
|
|
35791
35871
|
if (result.error || result.signal || result.status !== 0)
|
|
35792
35872
|
throw new Error(
|
|
35793
|
-
`${target.moduleName}: Swift compatibility product compilation failed. ${
|
|
35873
|
+
`${target.moduleName}: Swift compatibility product compilation failed. ${import_node_fs51.default.readFileSync(log, "utf8")}
|
|
35794
35874
|
Inputs: ${preparation.receipt}`
|
|
35795
35875
|
);
|
|
35796
35876
|
const relativeHeader = import_node_path51.default.relative(import_node_path51.default.dirname(outputMap), outputHeader);
|
|
35797
|
-
|
|
35877
|
+
import_node_fs51.default.appendFileSync(
|
|
35798
35878
|
outputMap,
|
|
35799
35879
|
compatibility.framework ? `
|
|
35800
35880
|
|
|
@@ -35824,7 +35904,7 @@ module ${target.moduleName}.Swift {
|
|
|
35824
35904
|
preparation.receipt,
|
|
35825
35905
|
...objects.map(({ file }) => file)
|
|
35826
35906
|
];
|
|
35827
|
-
|
|
35907
|
+
import_node_fs51.default.writeFileSync(
|
|
35828
35908
|
completed,
|
|
35829
35909
|
JSON.stringify(
|
|
35830
35910
|
{
|
|
@@ -35832,7 +35912,7 @@ module ${target.moduleName}.Swift {
|
|
|
35832
35912
|
files: Object.fromEntries(
|
|
35833
35913
|
outputs.map((file) => [
|
|
35834
35914
|
import_node_path51.default.relative(work, file),
|
|
35835
|
-
digest(
|
|
35915
|
+
digest(import_node_fs51.default.readFileSync(file))
|
|
35836
35916
|
])
|
|
35837
35917
|
)
|
|
35838
35918
|
},
|
|
@@ -35842,7 +35922,7 @@ module ${target.moduleName}.Swift {
|
|
|
35842
35922
|
);
|
|
35843
35923
|
return preparation;
|
|
35844
35924
|
} finally {
|
|
35845
|
-
|
|
35925
|
+
import_node_fs51.default.closeSync(descriptor);
|
|
35846
35926
|
}
|
|
35847
35927
|
}
|
|
35848
35928
|
async function prepareXcodeObjCImplementations(app, binaries, moduleRoot) {
|
|
@@ -35869,7 +35949,7 @@ async function prepareXcodeObjCImplementations(app, binaries, moduleRoot) {
|
|
|
35869
35949
|
return minimum === void 0 ? [`invalid-minimum:${target.deploymentTarget}`] : objcSdkIntakeFlags(headers, toolchain.toolchainBin, minimum);
|
|
35870
35950
|
}),
|
|
35871
35951
|
release: toolchain.release,
|
|
35872
|
-
compiler: digest(
|
|
35952
|
+
compiler: digest(import_node_fs51.default.readFileSync(import_node_path51.default.join(toolchain.toolchainBin, "clang"))),
|
|
35873
35953
|
sdk: swiftModuleSdk(moduleRoot),
|
|
35874
35954
|
targets,
|
|
35875
35955
|
externalFrameworkDirs,
|
|
@@ -35879,12 +35959,12 @@ async function prepareXcodeObjCImplementations(app, binaries, moduleRoot) {
|
|
|
35879
35959
|
swiftProducts: products?.receipt
|
|
35880
35960
|
};
|
|
35881
35961
|
const parent = import_node_path51.default.join(cacheDir(), "swift-objc-implementations");
|
|
35882
|
-
|
|
35962
|
+
import_node_fs51.default.mkdirSync(parent, { recursive: true });
|
|
35883
35963
|
const key2 = digest(JSON.stringify(identity2));
|
|
35884
35964
|
const work = import_node_path51.default.join(parent, key2);
|
|
35885
|
-
const descriptor =
|
|
35965
|
+
const descriptor = import_node_fs51.default.openSync(`${work}.lock`, "a");
|
|
35886
35966
|
try {
|
|
35887
|
-
const locked = (0,
|
|
35967
|
+
const locked = (0, import_node_child_process32.spawnSync)(
|
|
35888
35968
|
"perl",
|
|
35889
35969
|
["-e", 'open(my $f, ">&=", 3) or die $!; flock($f, 2) or die $!'],
|
|
35890
35970
|
{ stdio: ["ignore", "pipe", "pipe", descriptor], encoding: "utf8" }
|
|
@@ -35908,7 +35988,7 @@ async function prepareXcodeObjCImplementations(app, binaries, moduleRoot) {
|
|
|
35908
35988
|
]
|
|
35909
35989
|
});
|
|
35910
35990
|
const record2 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
35911
|
-
if (
|
|
35991
|
+
if (import_node_fs51.default.existsSync(work)) {
|
|
35912
35992
|
let message;
|
|
35913
35993
|
let interrupted2 = false;
|
|
35914
35994
|
let prepared = false;
|
|
@@ -35930,19 +36010,19 @@ async function prepareXcodeObjCImplementations(app, binaries, moduleRoot) {
|
|
|
35930
36010
|
} else if (result.reusable) message = result.message;
|
|
35931
36011
|
else interrupted2 = true;
|
|
35932
36012
|
} catch {
|
|
35933
|
-
|
|
36013
|
+
import_node_fs51.default.rmSync(work, { recursive: true });
|
|
35934
36014
|
}
|
|
35935
36015
|
if (prepared) return preparation();
|
|
35936
36016
|
if (message !== void 0)
|
|
35937
36017
|
throw new SwiftObjCCompilationError(message, import_node_path51.default.join(work, "receipt.json"));
|
|
35938
36018
|
if (interrupted2) {
|
|
35939
36019
|
const first = `${work}-interrupted-first`;
|
|
35940
|
-
const destination =
|
|
35941
|
-
|
|
35942
|
-
|
|
36020
|
+
const destination = import_node_fs51.default.existsSync(first) ? `${work}-interrupted-latest` : first;
|
|
36021
|
+
import_node_fs51.default.rmSync(destination, { recursive: true, force: true });
|
|
36022
|
+
import_node_fs51.default.renameSync(work, destination);
|
|
35943
36023
|
}
|
|
35944
36024
|
}
|
|
35945
|
-
|
|
36025
|
+
import_node_fs51.default.mkdirSync(work);
|
|
35946
36026
|
const staged = (file) => xcodeStagedPath(
|
|
35947
36027
|
file,
|
|
35948
36028
|
app.rootDir,
|
|
@@ -35981,7 +36061,7 @@ async function prepareXcodeObjCImplementations(app, binaries, moduleRoot) {
|
|
|
35981
36061
|
if (sources.has(custom)) flag = `-fmodule-map-file=${staged(custom)}`;
|
|
35982
36062
|
else {
|
|
35983
36063
|
const output2 = import_node_path51.default.join(work, `module-${moduleMapFlags.size}.modulemap`);
|
|
35984
|
-
|
|
36064
|
+
import_node_fs51.default.writeFileSync(
|
|
35985
36065
|
output2,
|
|
35986
36066
|
`module ${swiftTargetModuleName(module2)} {
|
|
35987
36067
|
umbrella ${JSON.stringify(staged(headers2))}
|
|
@@ -36000,7 +36080,7 @@ async function prepareXcodeObjCImplementations(app, binaries, moduleRoot) {
|
|
|
36000
36080
|
);
|
|
36001
36081
|
const commands = [];
|
|
36002
36082
|
const receipt = import_node_path51.default.join(work, "receipt.json");
|
|
36003
|
-
const save = (status) =>
|
|
36083
|
+
const save = (status) => import_node_fs51.default.writeFileSync(
|
|
36004
36084
|
receipt,
|
|
36005
36085
|
JSON.stringify({ ...identity2, work, status, commands }, null, 2)
|
|
36006
36086
|
);
|
|
@@ -36026,11 +36106,11 @@ async function prepareXcodeObjCImplementations(app, binaries, moduleRoot) {
|
|
|
36026
36106
|
reusable,
|
|
36027
36107
|
prepared: status === "prepared",
|
|
36028
36108
|
files: Object.fromEntries(
|
|
36029
|
-
files2.map((file) => [import_node_path51.default.relative(work, file), digest(
|
|
36109
|
+
files2.map((file) => [import_node_path51.default.relative(work, file), digest(import_node_fs51.default.readFileSync(file))])
|
|
36030
36110
|
)
|
|
36031
36111
|
};
|
|
36032
|
-
|
|
36033
|
-
|
|
36112
|
+
import_node_fs51.default.writeFileSync(`${resultFile}.pending`, JSON.stringify(result, null, 2));
|
|
36113
|
+
import_node_fs51.default.renameSync(`${resultFile}.pending`, resultFile);
|
|
36034
36114
|
};
|
|
36035
36115
|
const finish = (status, message, reusable = true) => {
|
|
36036
36116
|
complete(status, message, reusable);
|
|
@@ -36132,7 +36212,7 @@ async function prepareXcodeObjCImplementations(app, binaries, moduleRoot) {
|
|
|
36132
36212
|
...dependencies ? ["-MD", "-MF", dependencies, "-H"] : []
|
|
36133
36213
|
];
|
|
36134
36214
|
const result = await new Promise((resolve2) => {
|
|
36135
|
-
const child = (0,
|
|
36215
|
+
const child = (0, import_node_child_process32.spawn)(
|
|
36136
36216
|
import_node_path51.default.join(toolchain.toolchainBin, cxx ? "clang++" : "clang"),
|
|
36137
36217
|
args,
|
|
36138
36218
|
{
|
|
@@ -36162,7 +36242,7 @@ async function prepareXcodeObjCImplementations(app, binaries, moduleRoot) {
|
|
|
36162
36242
|
const diagnostics = `${result.stdout}${result.stderr}${result.error ? `
|
|
36163
36243
|
${result.error.message}` : ""}${result.signal ? `
|
|
36164
36244
|
Clang terminated by ${result.signal}` : ""}`;
|
|
36165
|
-
|
|
36245
|
+
import_node_fs51.default.writeFileSync(log, diagnostics);
|
|
36166
36246
|
completed[position] = {
|
|
36167
36247
|
target: target.name,
|
|
36168
36248
|
source: file,
|
|
@@ -36170,9 +36250,9 @@ Clang terminated by ${result.signal}` : ""}`;
|
|
|
36170
36250
|
status: result.status,
|
|
36171
36251
|
signal: result.signal,
|
|
36172
36252
|
log,
|
|
36173
|
-
...dependencies &&
|
|
36253
|
+
...dependencies && import_node_fs51.default.existsSync(dependencies) ? { dependencies } : {},
|
|
36174
36254
|
...result.error ? { error: result.error.message } : {},
|
|
36175
|
-
...!result.error && !result.signal && result.status === 0 ? { object: digest(
|
|
36255
|
+
...!result.error && !result.signal && result.status === 0 ? { object: digest(import_node_fs51.default.readFileSync(output2)) } : {}
|
|
36176
36256
|
};
|
|
36177
36257
|
commands.splice(0, commands.length, ...completed.filter(Boolean));
|
|
36178
36258
|
if (result.error || result.signal || result.status !== 0) {
|
|
@@ -36210,7 +36290,7 @@ ${reported.trimEnd() || `Clang exited with status ${result.status}`}`;
|
|
|
36210
36290
|
);
|
|
36211
36291
|
return preparation();
|
|
36212
36292
|
} finally {
|
|
36213
|
-
|
|
36293
|
+
import_node_fs51.default.closeSync(descriptor);
|
|
36214
36294
|
}
|
|
36215
36295
|
}
|
|
36216
36296
|
|
|
@@ -36252,7 +36332,7 @@ async function xcodeCxxReachable(app, binaries, moduleRoot, clang) {
|
|
|
36252
36332
|
);
|
|
36253
36333
|
for (const [file, bytes] of inputs.sources)
|
|
36254
36334
|
hash.update(file).update("\0").update(bytes).update("\0");
|
|
36255
|
-
const compiler =
|
|
36335
|
+
const compiler = import_node_fs52.default.statSync(clang);
|
|
36256
36336
|
hash.update(`${compiler.size}:${compiler.mtimeMs}`);
|
|
36257
36337
|
const key2 = hash.digest("hex");
|
|
36258
36338
|
const cached = cachedInputs.get(key2);
|
|
@@ -36267,7 +36347,7 @@ async function xcodeCxxReachable(app, binaries, moduleRoot, clang) {
|
|
|
36267
36347
|
if (!(error instanceof SwiftObjCCompilationError)) throw error;
|
|
36268
36348
|
receipt = error.receipt;
|
|
36269
36349
|
}
|
|
36270
|
-
const data = JSON.parse(
|
|
36350
|
+
const data = JSON.parse(import_node_fs52.default.readFileSync(receipt, "utf8"));
|
|
36271
36351
|
if (!isRecord(data) || typeof data.work !== "string" || !Array.isArray(data.commands) || !["prepared", "compile-failed"].includes(String(data.status)))
|
|
36272
36352
|
throw new Error("C++ header discovery requires completed original compiler inputs");
|
|
36273
36353
|
const work = data.work;
|
|
@@ -36322,7 +36402,7 @@ async function xcodeCxxReachable(app, binaries, moduleRoot, clang) {
|
|
|
36322
36402
|
failed = captured.failed;
|
|
36323
36403
|
reached = captured.reached;
|
|
36324
36404
|
} else {
|
|
36325
|
-
const result2 = (0,
|
|
36405
|
+
const result2 = (0, import_node_child_process33.spawnSync)(clang, [...cleaned, "-M", "-MT", "peach", "-H"], {
|
|
36326
36406
|
cwd: work,
|
|
36327
36407
|
encoding: "utf8",
|
|
36328
36408
|
env: swiftEnvironment(),
|
|
@@ -36375,12 +36455,12 @@ async function xcodeCxxReachable(app, binaries, moduleRoot, clang) {
|
|
|
36375
36455
|
for (const item of used) item.errors.add(`${label}: ${cxxDiagnostic(stderr)}`);
|
|
36376
36456
|
};
|
|
36377
36457
|
const firstPass = (command) => {
|
|
36378
|
-
if (!command.log || !
|
|
36379
|
-
const stderr =
|
|
36380
|
-
if (command.status === 0 && command.dependencies &&
|
|
36458
|
+
if (!command.log || !import_node_fs52.default.existsSync(command.log)) return void 0;
|
|
36459
|
+
const stderr = import_node_fs52.default.readFileSync(command.log, "utf8");
|
|
36460
|
+
if (command.status === 0 && command.dependencies && import_node_fs52.default.existsSync(command.dependencies)) {
|
|
36381
36461
|
try {
|
|
36382
36462
|
return {
|
|
36383
|
-
reached: cxxDependencies(
|
|
36463
|
+
reached: cxxDependencies(import_node_fs52.default.readFileSync(command.dependencies, "utf8")),
|
|
36384
36464
|
stderr,
|
|
36385
36465
|
failed: false
|
|
36386
36466
|
};
|
|
@@ -36414,7 +36494,7 @@ async function xcodeCxxReachable(app, binaries, moduleRoot, clang) {
|
|
|
36414
36494
|
if (!original) throw new Error("original C++ compiler command has no source");
|
|
36415
36495
|
const staged2 = import_node_path52.default.join(work, "project", import_node_path52.default.relative(app.rootDir, bridge));
|
|
36416
36496
|
const probe = import_node_path52.default.join(work, `peach-cxx-bridge-${target.moduleName}.mm`);
|
|
36417
|
-
|
|
36497
|
+
import_node_fs52.default.writeFileSync(probe, `#include ${JSON.stringify(staged2)}
|
|
36418
36498
|
`);
|
|
36419
36499
|
try {
|
|
36420
36500
|
compile2(
|
|
@@ -36422,7 +36502,7 @@ async function xcodeCxxReachable(app, binaries, moduleRoot, clang) {
|
|
|
36422
36502
|
`${target.moduleName}: bridging header ${bridge}`
|
|
36423
36503
|
);
|
|
36424
36504
|
} finally {
|
|
36425
|
-
|
|
36505
|
+
import_node_fs52.default.rmSync(probe, { force: true });
|
|
36426
36506
|
}
|
|
36427
36507
|
}
|
|
36428
36508
|
const result = binaries.map((binary, index) => {
|
|
@@ -36448,9 +36528,9 @@ async function xcodeCxxReachable(app, binaries, moduleRoot, clang) {
|
|
|
36448
36528
|
|
|
36449
36529
|
// src/swift-pdf-raster.ts
|
|
36450
36530
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
36451
|
-
var
|
|
36531
|
+
var import_node_child_process34 = require("node:child_process");
|
|
36452
36532
|
var import_node_crypto29 = require("node:crypto");
|
|
36453
|
-
var
|
|
36533
|
+
var import_node_fs54 = __toESM(require("node:fs"), 1);
|
|
36454
36534
|
var import_node_os13 = __toESM(require("node:os"), 1);
|
|
36455
36535
|
var import_node_path54 = __toESM(require("node:path"), 1);
|
|
36456
36536
|
|
|
@@ -36467,7 +36547,7 @@ var RNX_INTERNAL_CHILDREN = {
|
|
|
36467
36547
|
|
|
36468
36548
|
// cli/self-invocation.ts
|
|
36469
36549
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
36470
|
-
var
|
|
36550
|
+
var import_node_fs53 = require("node:fs");
|
|
36471
36551
|
var import_node_path53 = require("node:path");
|
|
36472
36552
|
var import_node_url2 = require("node:url");
|
|
36473
36553
|
|
|
@@ -36492,7 +36572,7 @@ var IS_STANDALONE = typeof __SOOTSIM_STANDALONE__ !== "undefined" && __SOOTSIM_S
|
|
|
36492
36572
|
function sourceEntryPath() {
|
|
36493
36573
|
try {
|
|
36494
36574
|
const candidate = (0, import_node_path53.join)((0, import_node_path53.dirname)((0, import_node_url2.fileURLToPath)(__sootsim_import_meta_url)), "bin.ts");
|
|
36495
|
-
return (0,
|
|
36575
|
+
return (0, import_node_fs53.existsSync)(candidate) ? candidate : null;
|
|
36496
36576
|
} catch {
|
|
36497
36577
|
return null;
|
|
36498
36578
|
}
|
|
@@ -36546,23 +36626,23 @@ function rasterBinary(swift = RASTER_SWIFT, name3 = "swift-pdf-raster") {
|
|
|
36546
36626
|
const tag = (0, import_node_crypto29.createHash)("sha256").update(swift).digest("hex").slice(0, 16);
|
|
36547
36627
|
const binary = import_node_path54.default.join(cacheDir(), `${name3}-${tag}`);
|
|
36548
36628
|
try {
|
|
36549
|
-
|
|
36629
|
+
import_node_fs54.default.accessSync(binary, import_node_fs54.default.constants.X_OK);
|
|
36550
36630
|
return binary;
|
|
36551
36631
|
} catch {
|
|
36552
36632
|
}
|
|
36553
36633
|
try {
|
|
36554
|
-
|
|
36634
|
+
import_node_fs54.default.mkdirSync(cacheDir(), { recursive: true });
|
|
36555
36635
|
const source = import_node_path54.default.join(
|
|
36556
|
-
|
|
36636
|
+
import_node_fs54.default.mkdtempSync(import_node_path54.default.join(import_node_os13.default.tmpdir(), "swift-pdf-raster-")),
|
|
36557
36637
|
"raster.swift"
|
|
36558
36638
|
);
|
|
36559
|
-
|
|
36639
|
+
import_node_fs54.default.writeFileSync(source, swift);
|
|
36560
36640
|
try {
|
|
36561
|
-
(0,
|
|
36641
|
+
(0, import_node_child_process34.execFileSync)("xcrun", ["swiftc", "-o", binary, source], { stdio: "pipe" });
|
|
36562
36642
|
} finally {
|
|
36563
|
-
|
|
36643
|
+
import_node_fs54.default.rmSync(import_node_path54.default.dirname(source), { recursive: true, force: true });
|
|
36564
36644
|
}
|
|
36565
|
-
|
|
36645
|
+
import_node_fs54.default.accessSync(binary, import_node_fs54.default.constants.X_OK);
|
|
36566
36646
|
return binary;
|
|
36567
36647
|
} catch (error) {
|
|
36568
36648
|
throw new Error(
|
|
@@ -36574,19 +36654,19 @@ function rasterizePdfFile(diskPath, pdfSha256) {
|
|
|
36574
36654
|
const renderer = process.platform === "darwin" ? (0, import_node_crypto29.createHash)("sha256").update(RASTER_SWIFT).digest("hex").slice(0, 16) : "pdfium-1";
|
|
36575
36655
|
const cached = import_node_path54.default.join(cacheDir(), `swift-pdf-png-${renderer}-${pdfSha256}.png`);
|
|
36576
36656
|
try {
|
|
36577
|
-
return { bytes:
|
|
36657
|
+
return { bytes: import_node_fs54.default.readFileSync(cached) };
|
|
36578
36658
|
} catch {
|
|
36579
36659
|
}
|
|
36580
36660
|
const out = import_node_path54.default.join(
|
|
36581
|
-
|
|
36661
|
+
import_node_fs54.default.mkdtempSync(import_node_path54.default.join(import_node_os13.default.tmpdir(), "swift-pdf-png-")),
|
|
36582
36662
|
"out.png"
|
|
36583
36663
|
);
|
|
36584
36664
|
try {
|
|
36585
36665
|
if (process.platform === "darwin") {
|
|
36586
|
-
(0,
|
|
36666
|
+
(0, import_node_child_process34.execFileSync)(rasterBinary(), [diskPath, "3", out], { stdio: "pipe" });
|
|
36587
36667
|
} else {
|
|
36588
36668
|
const { executable, prefixArgs } = rnxSelfInvocation();
|
|
36589
|
-
(0,
|
|
36669
|
+
(0, import_node_child_process34.execFileSync)(
|
|
36590
36670
|
executable,
|
|
36591
36671
|
[
|
|
36592
36672
|
...prefixArgs,
|
|
@@ -36599,10 +36679,10 @@ function rasterizePdfFile(diskPath, pdfSha256) {
|
|
|
36599
36679
|
{ stdio: "pipe" }
|
|
36600
36680
|
);
|
|
36601
36681
|
}
|
|
36602
|
-
const bytes =
|
|
36682
|
+
const bytes = import_node_fs54.default.readFileSync(out);
|
|
36603
36683
|
try {
|
|
36604
|
-
|
|
36605
|
-
|
|
36684
|
+
import_node_fs54.default.mkdirSync(cacheDir(), { recursive: true });
|
|
36685
|
+
import_node_fs54.default.copyFileSync(out, cached);
|
|
36606
36686
|
} catch {
|
|
36607
36687
|
}
|
|
36608
36688
|
return { bytes: Buffer.from(bytes) };
|
|
@@ -36611,7 +36691,7 @@ function rasterizePdfFile(diskPath, pdfSha256) {
|
|
|
36611
36691
|
`swift pdf asset ${diskPath} did not rasterize (corrupt or oversize pdf, like actool distill failure): ${error instanceof Error ? error.message : String(error)}`
|
|
36612
36692
|
);
|
|
36613
36693
|
} finally {
|
|
36614
|
-
|
|
36694
|
+
import_node_fs54.default.rmSync(import_node_path54.default.dirname(out), { recursive: true, force: true });
|
|
36615
36695
|
}
|
|
36616
36696
|
}
|
|
36617
36697
|
var RASTER_SVG_SWIFT = `import AppKit
|
|
@@ -36638,23 +36718,23 @@ function rasterizeSvgFile(diskPath, svgSha256) {
|
|
|
36638
36718
|
const binary = rasterBinary(RASTER_SVG_SWIFT, "swift-svg-raster");
|
|
36639
36719
|
const tag = (0, import_node_crypto29.createHash)("sha256").update(RASTER_SVG_SWIFT).digest("hex").slice(0, 16);
|
|
36640
36720
|
const cached = import_node_path54.default.join(cacheDir(), `swift-svg-png-${tag}-${svgSha256}.png`);
|
|
36641
|
-
if (
|
|
36721
|
+
if (import_node_fs54.default.existsSync(cached)) return { bytes: import_node_fs54.default.readFileSync(cached) };
|
|
36642
36722
|
const out = import_node_path54.default.join(
|
|
36643
|
-
|
|
36723
|
+
import_node_fs54.default.mkdtempSync(import_node_path54.default.join(import_node_os13.default.tmpdir(), "swift-svg-png-")),
|
|
36644
36724
|
"out.png"
|
|
36645
36725
|
);
|
|
36646
36726
|
try {
|
|
36647
|
-
(0,
|
|
36648
|
-
const bytes =
|
|
36649
|
-
|
|
36650
|
-
|
|
36727
|
+
(0, import_node_child_process34.execFileSync)(binary, [diskPath, "3", out], { stdio: "pipe" });
|
|
36728
|
+
const bytes = import_node_fs54.default.readFileSync(out);
|
|
36729
|
+
import_node_fs54.default.mkdirSync(cacheDir(), { recursive: true });
|
|
36730
|
+
import_node_fs54.default.copyFileSync(out, cached);
|
|
36651
36731
|
return { bytes: Buffer.from(bytes) };
|
|
36652
36732
|
} catch (error) {
|
|
36653
36733
|
throw new Error(
|
|
36654
36734
|
`swift svg asset ${diskPath} did not rasterize: ${error instanceof Error ? error.message : String(error)}`
|
|
36655
36735
|
);
|
|
36656
36736
|
} finally {
|
|
36657
|
-
|
|
36737
|
+
import_node_fs54.default.rmSync(import_node_path54.default.dirname(out), { recursive: true, force: true });
|
|
36658
36738
|
}
|
|
36659
36739
|
}
|
|
36660
36740
|
|
|
@@ -36674,15 +36754,15 @@ function swiftPackageId(packagePath) {
|
|
|
36674
36754
|
return import_node_path55.default.basename(packagePath).replace(/[^A-Za-z0-9_]/g, "_").replace(/^(\d)/, "_$1");
|
|
36675
36755
|
}
|
|
36676
36756
|
function nativeSourceDescriptor(packagePath) {
|
|
36677
|
-
packagePath =
|
|
36757
|
+
packagePath = import_node_fs55.default.realpathSync(packagePath);
|
|
36678
36758
|
if (sourceEntries().has(packagePath)) return null;
|
|
36679
36759
|
const file = import_node_path55.default.join(packagePath, NATIVE_DESCRIPTOR);
|
|
36680
|
-
if (!
|
|
36760
|
+
if (!import_node_fs55.default.existsSync(file)) return null;
|
|
36681
36761
|
const value = JSON.parse(
|
|
36682
36762
|
readPackageFile2(packagePath, file, MAX_SWIFT_COMPILE_SOURCE_BYTES).toString("utf8")
|
|
36683
36763
|
);
|
|
36684
36764
|
const invalid = () => new Error(`${file}: invalid One native source descriptor; run one typegen`);
|
|
36685
|
-
if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !
|
|
36765
|
+
if (!value || typeof value !== "object" || Reflect.get(value, "generatedBy") !== "one typegen" || !import_node_fs55.default.existsSync(import_node_path55.default.join(packagePath, NATIVE_GLUE))) {
|
|
36686
36766
|
throw invalid();
|
|
36687
36767
|
}
|
|
36688
36768
|
if (!isSwiftNativeModules(value) || value.packageId !== swiftPackageId(packagePath)) {
|
|
@@ -36691,9 +36771,9 @@ function nativeSourceDescriptor(packagePath) {
|
|
|
36691
36771
|
return value;
|
|
36692
36772
|
}
|
|
36693
36773
|
function nativeSourceFiles(packagePath) {
|
|
36694
|
-
packagePath =
|
|
36774
|
+
packagePath = import_node_fs55.default.realpathSync(packagePath);
|
|
36695
36775
|
if (sourceEntries().has(packagePath)) return [];
|
|
36696
|
-
return [NATIVE_DESCRIPTOR, NATIVE_GLUE].map((name3) => import_node_path55.default.join(packagePath, name3)).filter((file) =>
|
|
36776
|
+
return [NATIVE_DESCRIPTOR, NATIVE_GLUE].map((name3) => import_node_path55.default.join(packagePath, name3)).filter((file) => import_node_fs55.default.existsSync(file));
|
|
36697
36777
|
}
|
|
36698
36778
|
var SwiftMissingModulesError = class extends Error {
|
|
36699
36779
|
};
|
|
@@ -36703,7 +36783,7 @@ var projects = () => projectScope.getStore()?.projects ?? sharedProjects;
|
|
|
36703
36783
|
var sharedSourceEntries = /* @__PURE__ */ new Map();
|
|
36704
36784
|
var sourceEntries = () => projectScope.getStore()?.sourceEntries ?? sharedSourceEntries;
|
|
36705
36785
|
function projectFor(packagePath, hosted, signal) {
|
|
36706
|
-
packagePath =
|
|
36786
|
+
packagePath = import_node_fs55.default.realpathSync(packagePath);
|
|
36707
36787
|
const existing = projects().get(packagePath);
|
|
36708
36788
|
if (existing) {
|
|
36709
36789
|
if (signal && existing.signal !== signal) {
|
|
@@ -36748,22 +36828,22 @@ function readXcodeAppTargetPrepared(input, target, configuration, options) {
|
|
|
36748
36828
|
const checkouts = remoteSwiftCheckouts(probe.rootDir);
|
|
36749
36829
|
for (const projectDir of probe.projectDirs) {
|
|
36750
36830
|
const packages = import_node_path55.default.join(projectDir, ".build", "peach-xcode", "SourcePackages");
|
|
36751
|
-
|
|
36831
|
+
import_node_fs55.default.mkdirSync(packages, { recursive: true });
|
|
36752
36832
|
const link = import_node_path55.default.join(packages, "checkouts");
|
|
36753
36833
|
let linked = null;
|
|
36754
36834
|
try {
|
|
36755
|
-
linked =
|
|
36835
|
+
linked = import_node_fs55.default.lstatSync(link).isSymbolicLink() ? import_node_fs55.default.readlinkSync(link) : null;
|
|
36756
36836
|
} catch {
|
|
36757
36837
|
linked = null;
|
|
36758
36838
|
}
|
|
36759
36839
|
if (linked !== null) {
|
|
36760
36840
|
if (import_node_path55.default.resolve(packages, linked) === checkouts) continue;
|
|
36761
|
-
|
|
36762
|
-
} else if (
|
|
36841
|
+
import_node_fs55.default.unlinkSync(link);
|
|
36842
|
+
} else if (import_node_fs55.default.existsSync(link)) continue;
|
|
36763
36843
|
try {
|
|
36764
|
-
|
|
36844
|
+
import_node_fs55.default.symlinkSync(checkouts, link);
|
|
36765
36845
|
} catch (error) {
|
|
36766
|
-
if (!(error instanceof Error && "code" in error && error.code === "EEXIST") || import_node_path55.default.resolve(packages,
|
|
36846
|
+
if (!(error instanceof Error && "code" in error && error.code === "EEXIST") || import_node_path55.default.resolve(packages, import_node_fs55.default.readlinkSync(link)) !== checkouts)
|
|
36767
36847
|
throw error;
|
|
36768
36848
|
}
|
|
36769
36849
|
}
|
|
@@ -36792,11 +36872,11 @@ async function wasmPortableAssembly(binaries, toolchainBin, moduleRoot) {
|
|
|
36792
36872
|
binary.dir,
|
|
36793
36873
|
binary.publicHeaders
|
|
36794
36874
|
])
|
|
36795
|
-
).update(
|
|
36875
|
+
).update(import_node_fs55.default.readFileSync(source)).digest("hex");
|
|
36796
36876
|
const known = emptyWasmAssembly.get(key2);
|
|
36797
36877
|
if (known) return known;
|
|
36798
36878
|
const result = new Promise(
|
|
36799
|
-
(resolve2) => (0,
|
|
36879
|
+
(resolve2) => (0, import_node_child_process35.execFile)(
|
|
36800
36880
|
clang,
|
|
36801
36881
|
[
|
|
36802
36882
|
"-target",
|
|
@@ -36829,7 +36909,7 @@ async function wasmPortableAssembly(binaries, toolchainBin, moduleRoot) {
|
|
|
36829
36909
|
return new Set(portable.flat());
|
|
36830
36910
|
}
|
|
36831
36911
|
async function swiftPackages(entry, app) {
|
|
36832
|
-
const stamp = (file) =>
|
|
36912
|
+
const stamp = (file) => import_node_fs55.default.existsSync(file) ? (0, import_node_crypto30.createHash)("sha256").update(import_node_fs55.default.readFileSync(file)).digest("hex") : null;
|
|
36833
36913
|
const owners = [...app.frameworks, app].map((target) => ({
|
|
36834
36914
|
module: target.moduleName,
|
|
36835
36915
|
products: target.packageProducts ?? []
|
|
@@ -37162,7 +37242,7 @@ async function buildXcodeLayout(root) {
|
|
|
37162
37242
|
import_node_path55.default.relative(localPackageRoot, manifest.dir).split(import_node_path55.default.sep).join("/")
|
|
37163
37243
|
);
|
|
37164
37244
|
packagePaths.set(manifest.dir, directory);
|
|
37165
|
-
const manifests =
|
|
37245
|
+
const manifests = import_node_fs55.default.readdirSync(manifest.dir).filter((name3) => /^Package(@swift-[\d.]+)?\.swift$/.test(name3)).map((name3) => import_node_path55.default.join(manifest.dir, name3));
|
|
37166
37246
|
for (const file of /* @__PURE__ */ new Set([
|
|
37167
37247
|
...manifests,
|
|
37168
37248
|
...[...manifest.targets.values()].flatMap((target) => [
|
|
@@ -37620,7 +37700,7 @@ function xcodeManifest(layout2) {
|
|
|
37620
37700
|
].join("\n");
|
|
37621
37701
|
}
|
|
37622
37702
|
function packageFiles(root, includeBuildInputs = true) {
|
|
37623
|
-
const canonicalRoot =
|
|
37703
|
+
const canonicalRoot = import_node_fs55.default.realpathSync(root);
|
|
37624
37704
|
const source = sourceEntries().get(canonicalRoot);
|
|
37625
37705
|
if (source) return [source];
|
|
37626
37706
|
const xcode = xcodeLayout(canonicalRoot);
|
|
@@ -37651,7 +37731,7 @@ function sourceTreeFiles(dir, canonicalRoot) {
|
|
|
37651
37731
|
if (ancestors.has(realDirectory))
|
|
37652
37732
|
throw new Error(`swift input directory cycle: ${dir2}`);
|
|
37653
37733
|
ancestors.add(realDirectory);
|
|
37654
|
-
for (const entry of
|
|
37734
|
+
for (const entry of import_node_fs55.default.readdirSync(dir2, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
|
|
37655
37735
|
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;
|
|
37656
37736
|
// native target sources can contain upstream ios/android directories.
|
|
37657
37737
|
dir2 === canonicalRoot && SKIP_ROOT_DIRS.has(entry.name))
|
|
@@ -37665,9 +37745,9 @@ function sourceTreeFiles(dir, canonicalRoot) {
|
|
|
37665
37745
|
continue;
|
|
37666
37746
|
throw error;
|
|
37667
37747
|
}
|
|
37668
|
-
const stat =
|
|
37748
|
+
const stat = import_node_fs55.default.statSync(real);
|
|
37669
37749
|
if (stat.isDirectory()) {
|
|
37670
|
-
if (
|
|
37750
|
+
if (import_node_fs55.default.existsSync(import_node_path55.default.join(full, "Package.swift"))) continue;
|
|
37671
37751
|
walk3(full);
|
|
37672
37752
|
} else if (stat.isFile()) {
|
|
37673
37753
|
found.push(full);
|
|
@@ -37675,7 +37755,7 @@ function sourceTreeFiles(dir, canonicalRoot) {
|
|
|
37675
37755
|
}
|
|
37676
37756
|
ancestors.delete(realDirectory);
|
|
37677
37757
|
};
|
|
37678
|
-
if (
|
|
37758
|
+
if (import_node_fs55.default.existsSync(dir)) walk3(packageInputPath(canonicalRoot, dir));
|
|
37679
37759
|
return found;
|
|
37680
37760
|
}
|
|
37681
37761
|
function isPackageSource(file) {
|
|
@@ -37849,7 +37929,7 @@ function buildSwiftResourceTable(project, baseUrl, inputs) {
|
|
|
37849
37929
|
ext = ".png";
|
|
37850
37930
|
uploadName = `${import_node_path55.default.posix.basename(file, import_node_path55.default.posix.extname(file))}.png`;
|
|
37851
37931
|
} else {
|
|
37852
|
-
if (imageBytes +
|
|
37932
|
+
if (imageBytes + import_node_fs55.default.statSync(disk).size > limits.imageTotalBytes) {
|
|
37853
37933
|
throw new Error("swift image pack exceeds the compile service caps");
|
|
37854
37934
|
}
|
|
37855
37935
|
bytes = readPackageFile2(project.packagePath, disk, limits.imageBytes);
|
|
@@ -37910,7 +37990,7 @@ function declaredAppFonts(infoPlist) {
|
|
|
37910
37990
|
return Array.isArray(declared) ? declared.filter((name3) => typeof name3 === "string") : [];
|
|
37911
37991
|
}
|
|
37912
37992
|
function buildSwiftBundleFiles(packagePath, hosted, inputs, resourceBundles) {
|
|
37913
|
-
packagePath =
|
|
37993
|
+
packagePath = import_node_fs55.default.realpathSync(packagePath);
|
|
37914
37994
|
const limits = inputLimits(hosted);
|
|
37915
37995
|
const relative2 = resourceCandidateFiles(packagePath).map(
|
|
37916
37996
|
(file) => import_node_path55.default.relative(packagePath, file).split(import_node_path55.default.sep).join(import_node_path55.default.posix.sep)
|
|
@@ -38019,14 +38099,14 @@ function buildSwiftBundleFiles(packagePath, hosted, inputs, resourceBundles) {
|
|
|
38019
38099
|
}
|
|
38020
38100
|
}
|
|
38021
38101
|
if (xcode?.app.postBundleScripts.length) {
|
|
38022
|
-
const dir =
|
|
38102
|
+
const dir = import_node_fs55.default.mkdtempSync(import_node_path55.default.join(import_node_os14.default.tmpdir(), "peach-xcode-bundle-"));
|
|
38023
38103
|
const wrapper = import_node_path55.default.basename(xcode.app.settings("UNLOCALIZED_RESOURCES_FOLDER_PATH")) || `${xcode.app.name}.app`;
|
|
38024
38104
|
const bundle = import_node_path55.default.join(dir, wrapper);
|
|
38025
38105
|
try {
|
|
38026
38106
|
for (const [name3, encoded] of Object.entries(files2)) {
|
|
38027
38107
|
const destination = import_node_path55.default.join(bundle, name3);
|
|
38028
|
-
|
|
38029
|
-
|
|
38108
|
+
import_node_fs55.default.mkdirSync(import_node_path55.default.dirname(destination), { recursive: true });
|
|
38109
|
+
import_node_fs55.default.writeFileSync(destination, Buffer.from(encoded, "base64"));
|
|
38030
38110
|
}
|
|
38031
38111
|
for (const phase of xcode.app.postBundleScripts) {
|
|
38032
38112
|
const env = {
|
|
@@ -38049,7 +38129,7 @@ function buildSwiftBundleFiles(packagePath, hosted, inputs, resourceBundles) {
|
|
|
38049
38129
|
phase.directory,
|
|
38050
38130
|
expand(raw2, (key2) => env[key2] ?? "")
|
|
38051
38131
|
);
|
|
38052
|
-
if (!
|
|
38132
|
+
if (!import_node_fs55.default.existsSync(file))
|
|
38053
38133
|
throw new Error(
|
|
38054
38134
|
`${xcode.app.name}: Run Script "${phase.name}" missing input ${file}`
|
|
38055
38135
|
);
|
|
@@ -38064,13 +38144,13 @@ function buildSwiftBundleFiles(packagePath, hosted, inputs, resourceBundles) {
|
|
|
38064
38144
|
const source = inputPath(raw2);
|
|
38065
38145
|
const entries = fileListEntries(source, inputPath);
|
|
38066
38146
|
const expanded = import_node_path55.default.join(dir, `Input-${index}.xcfilelist`);
|
|
38067
|
-
|
|
38147
|
+
import_node_fs55.default.writeFileSync(expanded, `${entries.join("\n")}
|
|
38068
38148
|
`);
|
|
38069
38149
|
env[`SCRIPT_INPUT_FILE_LIST_${index}`] = expanded;
|
|
38070
38150
|
});
|
|
38071
38151
|
try {
|
|
38072
38152
|
const [shell, ...args] = phase.command;
|
|
38073
|
-
(0,
|
|
38153
|
+
(0, import_node_child_process35.execFileSync)(shell, args, {
|
|
38074
38154
|
cwd: phase.directory,
|
|
38075
38155
|
env,
|
|
38076
38156
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -38085,21 +38165,21 @@ function buildSwiftBundleFiles(packagePath, hosted, inputs, resourceBundles) {
|
|
|
38085
38165
|
}
|
|
38086
38166
|
for (const key2 of Object.keys(files2)) delete files2[key2];
|
|
38087
38167
|
total = 0;
|
|
38088
|
-
for (const entry of
|
|
38168
|
+
for (const entry of import_node_fs55.default.readdirSync(bundle, {
|
|
38089
38169
|
recursive: true,
|
|
38090
38170
|
withFileTypes: true
|
|
38091
38171
|
})) {
|
|
38092
38172
|
if (!entry.isFile()) continue;
|
|
38093
38173
|
const file = import_node_path55.default.join(entry.parentPath, entry.name);
|
|
38094
38174
|
const name3 = import_node_path55.default.relative(bundle, file).split(import_node_path55.default.sep).join("/");
|
|
38095
|
-
if (
|
|
38175
|
+
if (import_node_fs55.default.statSync(file).size > limits.resourceBytes)
|
|
38096
38176
|
throw new Error(
|
|
38097
38177
|
`swift bundle resource ${name3} exceeds ${limits.resourceBytes} bytes`
|
|
38098
38178
|
);
|
|
38099
|
-
addFile(name3,
|
|
38179
|
+
addFile(name3, import_node_fs55.default.readFileSync(file));
|
|
38100
38180
|
}
|
|
38101
38181
|
} finally {
|
|
38102
|
-
|
|
38182
|
+
import_node_fs55.default.rmSync(dir, { recursive: true, force: true });
|
|
38103
38183
|
}
|
|
38104
38184
|
}
|
|
38105
38185
|
return { files: files2, bundles, watched };
|
|
@@ -38109,7 +38189,7 @@ function serveSwiftResource(project, key2) {
|
|
|
38109
38189
|
}
|
|
38110
38190
|
function linkedModuleRoots(packagePath) {
|
|
38111
38191
|
if (privateSwiftDistributionRoot()) return [];
|
|
38112
|
-
packagePath =
|
|
38192
|
+
packagePath = import_node_fs55.default.realpathSync(packagePath);
|
|
38113
38193
|
let manifest;
|
|
38114
38194
|
try {
|
|
38115
38195
|
manifest = readPackageFile2(
|
|
@@ -38124,7 +38204,7 @@ function linkedModuleRoots(packagePath) {
|
|
|
38124
38204
|
const dependency = /\.package\(\s*path:\s*"([^"]+)"\s*\)/g;
|
|
38125
38205
|
for (const match of manifest.replace(/^\s*\/\/.*$/gm, "").matchAll(dependency)) {
|
|
38126
38206
|
const root = import_node_path55.default.resolve(packagePath, match[1]);
|
|
38127
|
-
if (
|
|
38207
|
+
if (import_node_fs55.default.existsSync(import_node_path55.default.join(root, "Package.swift"))) roots.add(root);
|
|
38128
38208
|
}
|
|
38129
38209
|
return [...roots].sort();
|
|
38130
38210
|
}
|
|
@@ -38146,7 +38226,7 @@ function sourceStamp(packagePath, moduleRootOverride, hosted = false) {
|
|
|
38146
38226
|
const projectInputs = new Set(packageFiles(packagePath));
|
|
38147
38227
|
for (const file of [...projectInputs].sort()) {
|
|
38148
38228
|
hash.update(import_node_path55.default.relative(packagePath, file));
|
|
38149
|
-
const stat =
|
|
38229
|
+
const stat = import_node_fs55.default.statSync(file);
|
|
38150
38230
|
hash.update(`${stat.mtimeMs}/${stat.ctimeMs}/${stat.size}`);
|
|
38151
38231
|
}
|
|
38152
38232
|
hash.update(moduleStamp(packagePath, moduleRootOverride, hosted));
|
|
@@ -38154,14 +38234,14 @@ function sourceStamp(packagePath, moduleRootOverride, hosted = false) {
|
|
|
38154
38234
|
}
|
|
38155
38235
|
function moduleStamp(packagePath, moduleRootOverride, hosted) {
|
|
38156
38236
|
const moduleRoot = hosted ? void 0 : moduleRootOverride ?? linkedModuleRoots(packagePath).find(
|
|
38157
|
-
(root) =>
|
|
38237
|
+
(root) => import_node_fs55.default.existsSync(import_node_path55.default.join(root, "toolchain.json"))
|
|
38158
38238
|
);
|
|
38159
38239
|
if (!moduleRoot) return "";
|
|
38160
38240
|
const hash = (0, import_node_crypto30.createHash)("sha256");
|
|
38161
38241
|
hash.update(moduleRoot);
|
|
38162
38242
|
for (const relative2 of swiftModuleInputFiles(moduleRoot)) {
|
|
38163
38243
|
hash.update(relative2);
|
|
38164
|
-
hash.update(String(
|
|
38244
|
+
hash.update(String(import_node_fs55.default.statSync(import_node_path55.default.join(moduleRoot, relative2)).mtimeMs));
|
|
38165
38245
|
}
|
|
38166
38246
|
return hash.digest("hex");
|
|
38167
38247
|
}
|
|
@@ -38183,9 +38263,9 @@ function standinLibraries(binaries, standins, rootDir, toolchain) {
|
|
|
38183
38263
|
const bytes = Buffer.from(standin.prebuilt.library, "base64");
|
|
38184
38264
|
const digest = (0, import_node_crypto30.createHash)("sha256").update(bytes).digest("hex");
|
|
38185
38265
|
const dir = import_node_path55.default.join(swiftCacheDir(), "native-archives", digest);
|
|
38186
|
-
|
|
38266
|
+
import_node_fs55.default.mkdirSync(dir, { recursive: true });
|
|
38187
38267
|
const library = import_node_path55.default.join(dir, `lib${standin.module}.a`);
|
|
38188
|
-
if (!
|
|
38268
|
+
if (!import_node_fs55.default.existsSync(library)) import_node_fs55.default.writeFileSync(library, bytes);
|
|
38189
38269
|
linked.set(library, [standin]);
|
|
38190
38270
|
}
|
|
38191
38271
|
for (const binary of binaries) {
|
|
@@ -38230,8 +38310,11 @@ function packageSources(packagePath, hosted = false, linked = /* @__PURE__ */ ne
|
|
|
38230
38310
|
return files2;
|
|
38231
38311
|
}
|
|
38232
38312
|
function packageSnapshot(project, entry, moduleRoot) {
|
|
38313
|
+
moduleRoot ??= xcodeProjects().get(project.packagePath)?.moduleRoot ?? linkedModuleRoots(project.packagePath).find(
|
|
38314
|
+
(root) => import_node_fs55.default.existsSync(import_node_path55.default.join(root, "toolchain.json"))
|
|
38315
|
+
);
|
|
38233
38316
|
const layout2 = xcodeLayout(project.packagePath);
|
|
38234
|
-
const pin2 = moduleRoot ? swiftDistributionAt(moduleRoot) ?? JSON.parse(
|
|
38317
|
+
const pin2 = moduleRoot ? swiftDistributionAt(moduleRoot) ?? JSON.parse(import_node_fs55.default.readFileSync(import_node_path55.default.join(moduleRoot, "toolchain.json"), "utf8")) : null;
|
|
38235
38318
|
const linked = layout2 ? standinLibraries(
|
|
38236
38319
|
layout2.binaries,
|
|
38237
38320
|
layout2.standins,
|
|
@@ -38253,10 +38336,10 @@ function packageSnapshot(project, entry, moduleRoot) {
|
|
|
38253
38336
|
};
|
|
38254
38337
|
const packageReals = /* @__PURE__ */ new Map();
|
|
38255
38338
|
for (const [file, relative2] of layout2?.packageFiles ?? [])
|
|
38256
|
-
if (!
|
|
38257
|
-
packageReals.set(
|
|
38339
|
+
if (!import_node_fs55.default.lstatSync(file).isSymbolicLink())
|
|
38340
|
+
packageReals.set(import_node_fs55.default.realpathSync(file), relative2);
|
|
38258
38341
|
for (const [file, relative2] of layout2?.packageFiles ?? []) {
|
|
38259
|
-
const real =
|
|
38342
|
+
const real = import_node_fs55.default.realpathSync(file);
|
|
38260
38343
|
const target = packageReals.get(real);
|
|
38261
38344
|
if (target !== void 0 && target !== relative2 && /\.(?:h|hh|hpp|hxx)$/.test(file))
|
|
38262
38345
|
headerAliases[relative2] = target;
|
|
@@ -38275,8 +38358,8 @@ function packageSnapshot(project, entry, moduleRoot) {
|
|
|
38275
38358
|
if (swiftProjectFileProblem(relative2) !== void 0) continue;
|
|
38276
38359
|
const key2 = xcodeInputKey(layout2, file, relative2);
|
|
38277
38360
|
if (files2[key2] !== void 0) continue;
|
|
38278
|
-
const absolute =
|
|
38279
|
-
if (!
|
|
38361
|
+
const absolute = import_node_fs55.default.realpathSync(file);
|
|
38362
|
+
if (!import_node_fs55.default.statSync(absolute).isFile()) continue;
|
|
38280
38363
|
projectFiles[relative2] = readPackageFile2(
|
|
38281
38364
|
project.packagePath,
|
|
38282
38365
|
absolute,
|
|
@@ -38307,7 +38390,7 @@ function packageSnapshot(project, entry, moduleRoot) {
|
|
|
38307
38390
|
(layout2?.packages.nativePackages ?? []).flatMap(
|
|
38308
38391
|
({ manifest, guestTargets: targets }) => targets.filter((target) => target.type === "regular").flatMap(
|
|
38309
38392
|
(target) => swiftTargetFiles(manifest, target).filter((file) => file.endsWith(".swift")).flatMap(
|
|
38310
|
-
(file) => swiftImportNames(
|
|
38393
|
+
(file) => swiftImportNames(import_node_fs55.default.readFileSync(file, "utf8"))
|
|
38311
38394
|
)
|
|
38312
38395
|
)
|
|
38313
38396
|
)
|
|
@@ -38342,7 +38425,7 @@ function packageSnapshot(project, entry, moduleRoot) {
|
|
|
38342
38425
|
...Object.fromEntries(
|
|
38343
38426
|
[...linked].map(([library, [first]]) => [
|
|
38344
38427
|
first.module,
|
|
38345
|
-
|
|
38428
|
+
import_node_fs55.default.readFileSync(library).toString("base64")
|
|
38346
38429
|
])
|
|
38347
38430
|
)
|
|
38348
38431
|
}
|
|
@@ -38424,7 +38507,7 @@ async function compile(packagePath, stamp, moduleRootOverride, hosted, snapshot,
|
|
|
38424
38507
|
package: content
|
|
38425
38508
|
};
|
|
38426
38509
|
const moduleRoot = moduleRootOverride ?? linkedModuleRoots(packagePath).find(
|
|
38427
|
-
(root) =>
|
|
38510
|
+
(root) => import_node_fs55.default.existsSync(import_node_path55.default.join(root, "toolchain.json"))
|
|
38428
38511
|
) ?? await swiftDistributionRoot(signal);
|
|
38429
38512
|
const toolchain = swiftModuleToolchain(moduleRoot);
|
|
38430
38513
|
const input = snapshotCompileInput(snapshot);
|
|
@@ -38707,10 +38790,7 @@ function scopedArtifact(project, entry, moduleRoot, signal) {
|
|
|
38707
38790
|
queued.then(resolve2, reject).finally(() => signal.removeEventListener("abort", stop));
|
|
38708
38791
|
});
|
|
38709
38792
|
}
|
|
38710
|
-
const
|
|
38711
|
-
(root) => import_node_fs54.default.existsSync(import_node_path55.default.join(root, "toolchain.json"))
|
|
38712
|
-
);
|
|
38713
|
-
const snapshot = packageSnapshot(project, entry, snapshotRoot);
|
|
38793
|
+
const snapshot = packageSnapshot(project, entry, moduleRoot);
|
|
38714
38794
|
const compiled = project.artifact?.compiled;
|
|
38715
38795
|
if (project.artifact && compiled && compiled.module === moduleStamp(project.packagePath, moduleRoot, false)) {
|
|
38716
38796
|
const input = snapshotCompileInput(snapshot);
|
|
@@ -38749,7 +38829,7 @@ function scopedArtifact(project, entry, moduleRoot, signal) {
|
|
|
38749
38829
|
return fresh;
|
|
38750
38830
|
}
|
|
38751
38831
|
async function swiftPackageWatchFiles(packagePath, moduleRoot) {
|
|
38752
|
-
packagePath =
|
|
38832
|
+
packagePath = import_node_fs55.default.realpathSync(packagePath);
|
|
38753
38833
|
return withXcodeLayout(packagePath, () => [
|
|
38754
38834
|
...xcodeProjects().has(packagePath) || sourceEntries().has(packagePath) ? [] : [import_node_path55.default.join(packagePath, "Package.swift")],
|
|
38755
38835
|
...packageFiles(packagePath),
|
|
@@ -38758,7 +38838,7 @@ async function swiftPackageWatchFiles(packagePath, moduleRoot) {
|
|
|
38758
38838
|
]);
|
|
38759
38839
|
}
|
|
38760
38840
|
async function swiftPackageMetadata(packagePath, packageName, moduleRoot, origin, hosted, signal) {
|
|
38761
|
-
packagePath =
|
|
38841
|
+
packagePath = import_node_fs55.default.realpathSync(packagePath);
|
|
38762
38842
|
const project = projectFor(packagePath, hosted, signal);
|
|
38763
38843
|
const limits = inputLimits(Boolean(project.hosted));
|
|
38764
38844
|
const registered = xcodeProjects().get(packagePath);
|
|
@@ -38921,7 +39001,7 @@ async function serveSwiftPackageAsset(pathname, res) {
|
|
|
38921
39001
|
return true;
|
|
38922
39002
|
}
|
|
38923
39003
|
function disposeSwiftProject(packagePath, signal) {
|
|
38924
|
-
packagePath =
|
|
39004
|
+
packagePath = import_node_fs55.default.realpathSync(packagePath);
|
|
38925
39005
|
const project = projects().get(packagePath);
|
|
38926
39006
|
if (signal && project && project.signal !== signal) return;
|
|
38927
39007
|
projects().delete(packagePath);
|
|
@@ -38964,15 +39044,15 @@ function swiftViteLifetime(server) {
|
|
|
38964
39044
|
// src/one-widget-package.ts
|
|
38965
39045
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
38966
39046
|
var import_node_crypto32 = require("node:crypto");
|
|
38967
|
-
var
|
|
39047
|
+
var import_node_fs57 = __toESM(require("node:fs"), 1);
|
|
38968
39048
|
var import_node_os15 = __toESM(require("node:os"), 1);
|
|
38969
39049
|
var import_node_path57 = __toESM(require("node:path"), 1);
|
|
38970
39050
|
|
|
38971
39051
|
// src/one-widget-metadata.ts
|
|
38972
39052
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
38973
|
-
var
|
|
39053
|
+
var import_node_child_process36 = require("node:child_process");
|
|
38974
39054
|
var import_node_crypto31 = require("node:crypto");
|
|
38975
|
-
var
|
|
39055
|
+
var import_node_fs56 = __toESM(require("node:fs"), 1);
|
|
38976
39056
|
var import_node_module = require("node:module");
|
|
38977
39057
|
var import_node_path56 = __toESM(require("node:path"), 1);
|
|
38978
39058
|
var import_node_util8 = require("node:util");
|
|
@@ -38999,7 +39079,7 @@ function isHomeWidgetFamily(value) {
|
|
|
38999
39079
|
}
|
|
39000
39080
|
|
|
39001
39081
|
// src/one-widget-metadata.ts
|
|
39002
|
-
var run4 = (0, import_node_util8.promisify)(
|
|
39082
|
+
var run4 = (0, import_node_util8.promisify)(import_node_child_process36.execFile);
|
|
39003
39083
|
var ONE_WIDGET_PACKAGE = "OneWidgets";
|
|
39004
39084
|
var configs = /* @__PURE__ */ new Map();
|
|
39005
39085
|
var reads = /* @__PURE__ */ new Map();
|
|
@@ -39020,8 +39100,8 @@ fs.writeFileSync(process.argv[2], JSON.stringify({
|
|
|
39020
39100
|
function configStamp(files2) {
|
|
39021
39101
|
return JSON.stringify(
|
|
39022
39102
|
files2.map((file) => {
|
|
39023
|
-
if (!
|
|
39024
|
-
const stat =
|
|
39103
|
+
if (!import_node_fs56.default.existsSync(file)) return [file, null];
|
|
39104
|
+
const stat = import_node_fs56.default.statSync(file);
|
|
39025
39105
|
return [file, stat.mtimeMs, stat.ctimeMs, stat.size];
|
|
39026
39106
|
})
|
|
39027
39107
|
);
|
|
@@ -39034,11 +39114,11 @@ async function readConfig(root) {
|
|
|
39034
39114
|
const promise = (async () => {
|
|
39035
39115
|
(0, import_node_module.createRequire)(import_node_path56.default.join(root, "package.json")).resolve("one/vite");
|
|
39036
39116
|
const cache = import_node_path56.default.join(root, "node_modules/.cache/peach-widget-config");
|
|
39037
|
-
|
|
39038
|
-
const directory =
|
|
39117
|
+
import_node_fs56.default.mkdirSync(cache, { recursive: true });
|
|
39118
|
+
const directory = import_node_fs56.default.mkdtempSync(import_node_path56.default.join(cache, "read-"));
|
|
39039
39119
|
const script = import_node_path56.default.join(directory, "read.mjs");
|
|
39040
39120
|
const result = import_node_path56.default.join(directory, "result.json");
|
|
39041
|
-
|
|
39121
|
+
import_node_fs56.default.writeFileSync(script, CONFIG_CHILD);
|
|
39042
39122
|
try {
|
|
39043
39123
|
await run4(process.execPath, [script, result], {
|
|
39044
39124
|
cwd: root,
|
|
@@ -39046,7 +39126,7 @@ async function readConfig(root) {
|
|
|
39046
39126
|
timeout: 3e4,
|
|
39047
39127
|
maxBuffer: 1024 * 1024
|
|
39048
39128
|
});
|
|
39049
|
-
const value = JSON.parse(
|
|
39129
|
+
const value = JSON.parse(import_node_fs56.default.readFileSync(result, "utf8"));
|
|
39050
39130
|
if (!isRecord(value) || !Array.isArray(value.watched) || !value.watched.every((file) => typeof file === "string"))
|
|
39051
39131
|
throw new Error("One config loader returned invalid dependencies");
|
|
39052
39132
|
if (!Array.isArray(value.urlSchemes) || !value.urlSchemes.every(
|
|
@@ -39082,7 +39162,7 @@ async function readConfig(root) {
|
|
|
39082
39162
|
configs.set(root, loaded2);
|
|
39083
39163
|
return loaded2;
|
|
39084
39164
|
} finally {
|
|
39085
|
-
|
|
39165
|
+
import_node_fs56.default.rmSync(directory, { recursive: true, force: true });
|
|
39086
39166
|
}
|
|
39087
39167
|
})();
|
|
39088
39168
|
reads.set(root, promise);
|
|
@@ -39103,7 +39183,7 @@ function declaredFamilies(source) {
|
|
|
39103
39183
|
return home;
|
|
39104
39184
|
}
|
|
39105
39185
|
async function readOneWidgetSources(appRoot) {
|
|
39106
|
-
const root =
|
|
39186
|
+
const root = import_node_fs56.default.realpathSync(appRoot);
|
|
39107
39187
|
const config = await readConfig(root);
|
|
39108
39188
|
if (!config.widget) return null;
|
|
39109
39189
|
const widget = config.widget;
|
|
@@ -39119,7 +39199,7 @@ async function readOneWidgetSources(appRoot) {
|
|
|
39119
39199
|
const files2 = /* @__PURE__ */ new Map();
|
|
39120
39200
|
const sources = {};
|
|
39121
39201
|
for (const [name3, file] of Object.entries(sourceFiles2)) {
|
|
39122
|
-
if (!
|
|
39202
|
+
if (!import_node_fs56.default.existsSync(file))
|
|
39123
39203
|
throw new Error(`missing One widget prebuild source ${file}; run one prebuild`);
|
|
39124
39204
|
const bytes = readPackageFile(root, file, MAX_SWIFT_COMPILE_SOURCE_BYTES);
|
|
39125
39205
|
const text5 = bytes.toString("utf8");
|
|
@@ -39169,7 +39249,7 @@ async function oneWidgetPackage(appRoot) {
|
|
|
39169
39249
|
(0, import_node_crypto32.createHash)("sha256").update(root).digest("hex"),
|
|
39170
39250
|
ONE_WIDGET_PACKAGE
|
|
39171
39251
|
);
|
|
39172
|
-
|
|
39252
|
+
import_node_fs57.default.mkdirSync(packagePath, { recursive: true });
|
|
39173
39253
|
syncSwiftTree(
|
|
39174
39254
|
packagePath,
|
|
39175
39255
|
new Map([...files2].map(([file, text5]) => [import_node_path57.default.join(packagePath, file), text5]))
|
|
@@ -39198,7 +39278,7 @@ function packageFor(file) {
|
|
|
39198
39278
|
let dir = import_node_path58.default.dirname(file);
|
|
39199
39279
|
const stop = devServer?.config.root;
|
|
39200
39280
|
for (; ; ) {
|
|
39201
|
-
if (
|
|
39281
|
+
if (import_node_fs58.default.existsSync(import_node_path58.default.join(dir, "Package.swift"))) return dir;
|
|
39202
39282
|
if (stop !== void 0 && dir === stop || import_node_path58.default.dirname(dir) === dir) break;
|
|
39203
39283
|
dir = import_node_path58.default.dirname(dir);
|
|
39204
39284
|
}
|
|
@@ -39224,7 +39304,7 @@ function swiftPlugin(options = {}) {
|
|
|
39224
39304
|
if (importer && (source.startsWith("./") || source.startsWith("../"))) {
|
|
39225
39305
|
const raw2 = import_node_path58.default.resolve(import_node_path58.default.dirname(importer.split("?")[0] ?? importer), source);
|
|
39226
39306
|
try {
|
|
39227
|
-
if (
|
|
39307
|
+
if (import_node_fs58.default.realpathSync(raw2) === import_node_fs58.default.realpathSync(resolved.id)) id = raw2;
|
|
39228
39308
|
} catch {
|
|
39229
39309
|
}
|
|
39230
39310
|
}
|
|
@@ -39235,7 +39315,7 @@ function swiftPlugin(options = {}) {
|
|
|
39235
39315
|
const owner = lifetime;
|
|
39236
39316
|
owner?.signal.throwIfAborted();
|
|
39237
39317
|
const file = id.slice(VIRTUAL_PREFIX.length);
|
|
39238
|
-
if (!
|
|
39318
|
+
if (!import_node_fs58.default.existsSync(file)) throw new Error(`swift source ${file} no longer exists`);
|
|
39239
39319
|
const packagePath = options.packagePath ?? packageFor(file);
|
|
39240
39320
|
const project = projectFor(packagePath, void 0, owner?.signal);
|
|
39241
39321
|
owner?.projects.add(project.packagePath);
|
|
@@ -39247,7 +39327,7 @@ function swiftPlugin(options = {}) {
|
|
|
39247
39327
|
this.addWatchFile(source);
|
|
39248
39328
|
this.addWatchFile(import_node_path58.default.join(packagePath, "Package.swift"));
|
|
39249
39329
|
const moduleRoot = linkedModuleRoots(packagePath).find(
|
|
39250
|
-
(root) =>
|
|
39330
|
+
(root) => import_node_fs58.default.existsSync(import_node_path58.default.join(root, "toolchain.json"))
|
|
39251
39331
|
);
|
|
39252
39332
|
if (moduleRoot)
|
|
39253
39333
|
for (const relative2 of swiftModuleInputFiles(moduleRoot))
|