peachsim 0.1.2595 → 0.1.2597
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +2 -2
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +5 -5
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +3 -3
- package/dist-lib/bundle-channel.cjs +982 -431
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +3 -3
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +3 -3
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +2 -2
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +7 -7
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +5 -5
- package/dist-lib/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/esm-chunks/{acorn-J5DSQG5R.mjs → acorn-55PXV665.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-D4XFTOV2.mjs → chunk-3DRJIOHV.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-NZEHZIHZ.mjs → chunk-42RIRPTB.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-CDGSSOLF.mjs → chunk-56YYEI6C.mjs} +16 -13
- package/dist-lib/esm-chunks/{chunk-MTGZYNXH.mjs → chunk-7ECUAVIA.mjs} +2 -2
- package/dist-lib/esm-chunks/{chunk-YYAPBU4L.mjs → chunk-7J65FNXI.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-FHFNRCCX.mjs → chunk-AJHFCIEU.mjs} +4 -4
- package/dist-lib/esm-chunks/{chunk-G35VGABO.mjs → chunk-CKUEWEY4.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-NCMIX32U.mjs → chunk-DCL2ZEGA.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-3Z2POHJV.mjs → chunk-GECWNEHA.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-BCLZPP3O.mjs → chunk-GRGNTIO7.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-RYCGXYYL.mjs → chunk-GZD5CTG7.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-5U76J6OF.mjs → chunk-HATXI62T.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-GCOZNVG7.mjs → chunk-INA4S3MF.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-AEI4FOZK.mjs → chunk-IPN35TGX.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-U4X644Y4.mjs → chunk-LH524OUR.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-ESKLJRT5.mjs → chunk-MMHNSEZY.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-POM7QBEW.mjs → chunk-NWLCTKBM.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-ZSJEHQ3R.mjs → chunk-O5FDNHDG.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-D6RI7LMX.mjs → chunk-ROFBHGEA.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-LLO2FLAP.mjs → chunk-V6SI2XY7.mjs} +967 -491
- package/dist-lib/esm-chunks/{chunk-JVVPCJEO.mjs → chunk-VN7BXTMG.mjs} +5 -5
- package/dist-lib/esm-chunks/{chunk-VZY2J2YJ.mjs → chunk-Y4XMEBRN.mjs} +1 -1
- package/dist-lib/esm-chunks/{metro-layout-parser-ZHPHHXG3.mjs → metro-layout-parser-5FUYCP6P.mjs} +3 -3
- package/dist-lib/esm-chunks/{swift-package-prebuilt-UXU6DFC3.mjs → swift-package-prebuilt-W3VMDYHC.mjs} +10 -10
- package/dist-lib/esm-chunks/{swift-sdk-app-module-25XPGJ4P.mjs → swift-sdk-app-module-ZHGBY6T7.mjs} +126 -56
- package/dist-lib/esm-chunks/{swift-sdk-image-7JKGAHEW.mjs → swift-sdk-image-2PC4PKHZ.mjs} +14 -14
- package/dist-lib/esm-chunks/{swift-sdk-image-producer-KG5I2NUP.mjs → swift-sdk-image-producer-WDN6BXQL.mjs} +4 -4
- package/dist-lib/expo-swift-bundle.cjs +981 -430
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +7 -7
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +1019 -434
- package/dist-lib/host/fetch-proxy-handler.cjs +36 -6
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +3 -3
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +3 -3
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +4 -4
- package/dist-lib/native-app-identity-project.cjs +34 -4
- package/dist-lib/native-app-identity-project.mjs +16 -16
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +6 -6
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +3 -3
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +2 -2
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +3 -3
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +81 -81
- package/dist-lib/public-origins-lib.json +69 -69
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +2 -2
- package/dist-lib/reap-browser.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +8 -8
- package/dist-lib/skills.cjs +1020 -435
- package/dist-lib/swift-compile.cjs +979 -428
- package/dist-lib/swift-compile.mjs +10 -10
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +3 -3
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +6 -6
- package/dist-lib/swift-svg-raster.cjs +1 -1
- package/dist-lib/swift-svg-raster.mjs +2 -2
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
- package/dist-lib/vendor/@xmldom/xmldom.cjs +1 -1
- package/dist-lib/vendor/acorn.cjs +1 -1
- package/dist-lib/vendor/bplist-parser.cjs +1 -1
- package/dist-lib/vendor/ignore.cjs +1 -1
- package/dist-lib/vendor/magic-string.cjs +1 -1
- package/dist-lib/vendor/plist.cjs +1 -1
- package/dist-lib/vendor/smol-toml.cjs +1 -1
- package/dist-lib/vendor/stream-json.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
- package/dist-lib/vendor/sucrase.cjs +1 -1
- package/dist-lib/vendor/terser.cjs +1 -1
- package/dist-lib/vendor/valibot.cjs +1 -1
- package/dist-lib/vendor/ws.cjs +1 -1
- package/dist-lib/vendor/zod.cjs +1 -1
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +3 -3
- package/dist-types/packages/peach-engine/src/render-worker/nativeAnimMirrorContract.d.ts +0 -2
- package/package.json +1 -1
- package/src/one-native-controls-package.ts +32 -1
- package/src/swift-compile.ts +421 -175
- package/src/swift-guest-compile.ts +16 -0
- package/src/swift-guest-image-ledger.ts +65 -14
- package/src/swift-guest-link.ts +25 -3
- package/src/swift-guest-manifest.ts +27 -5
- package/src/swift-guest-source-inputs.ts +119 -14
- package/src/swift-sdk-app-module.ts +128 -55
- package/src/swift-sdk-image-wasm.ts +76 -39
- package/src/swift-sdk-image.ts +13 -9
- package/src/swift-wasm-prune.ts +282 -222
- package/src/wasm-optimize.ts +1 -1
- package/src/write-build-file.ts +9 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2597 | (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;
|
|
@@ -5712,13 +5712,13 @@ var init_swift_standin_digest = __esm({
|
|
|
5712
5712
|
STANDIN_DIGEST_ENTRYPOINTS = ["swift-standins.ts", "swift-objc-compile.ts"];
|
|
5713
5713
|
SPECIFIER = /from\s*['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
5714
5714
|
standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
|
|
5715
|
-
STANDIN_SOURCE_DIGEST = true ? "
|
|
5715
|
+
STANDIN_SOURCE_DIGEST = true ? "803880cad876e27e4e621723b8eae85b3c486a882db0f0f745babaf80c070680" : standinSourceDigest();
|
|
5716
5716
|
}
|
|
5717
5717
|
});
|
|
5718
5718
|
|
|
5719
5719
|
// src/expo-native-compiler-digest.ts
|
|
5720
5720
|
function expoNativeCompilerDigestValue() {
|
|
5721
|
-
return true ? "
|
|
5721
|
+
return true ? "4e04e854647f1a1e167543007b405e6d43a936b2b02d7be227ac14a5bcb224f9" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
|
|
5722
5722
|
}
|
|
5723
5723
|
var import_node_crypto11;
|
|
5724
5724
|
var init_expo_native_compiler_digest = __esm({
|
|
@@ -12848,8 +12848,14 @@ var init_podspec_ruby_stdlib = __esm({
|
|
|
12848
12848
|
|
|
12849
12849
|
// src/write-build-file.ts
|
|
12850
12850
|
function writeBuildFile(file, contents2) {
|
|
12851
|
-
|
|
12852
|
-
|
|
12851
|
+
const stat2 = (0, import_node_fs33.statSync)(file, { throwIfNoEntry: false });
|
|
12852
|
+
if (stat2?.isFile()) {
|
|
12853
|
+
if (typeof contents2 === "string") {
|
|
12854
|
+
if ((0, import_node_fs33.readFileSync)(file, "utf8") === contents2) return;
|
|
12855
|
+
} else if (stat2.size === contents2.length && (0, import_node_fs33.readFileSync)(file).equals(contents2)) {
|
|
12856
|
+
return;
|
|
12857
|
+
}
|
|
12858
|
+
}
|
|
12853
12859
|
(0, import_node_fs33.mkdirSync)(import_node_path31.default.dirname(file), { recursive: true });
|
|
12854
12860
|
(0, import_node_fs33.writeFileSync)(file, contents2);
|
|
12855
12861
|
}
|
|
@@ -37571,7 +37577,11 @@ function relocationEdges(bytes, segmentAddress) {
|
|
|
37571
37577
|
const sections = wasmSections(bytes);
|
|
37572
37578
|
const linking = sections.find((s) => s.name === "linking");
|
|
37573
37579
|
if (!linking) throw new Error("relocation link has no linking section");
|
|
37574
|
-
|
|
37580
|
+
let symKind = new Uint8Array(0);
|
|
37581
|
+
let symFlags = new Uint32Array(0);
|
|
37582
|
+
let symSegment = new Int32Array(0);
|
|
37583
|
+
let symOffset = new Int32Array(0);
|
|
37584
|
+
let symIndex = new Int32Array(0);
|
|
37575
37585
|
const segmentNames = [];
|
|
37576
37586
|
{
|
|
37577
37587
|
const r = wasmReader(bytes, linking.start);
|
|
@@ -37579,27 +37589,31 @@ function relocationEdges(bytes, segmentAddress) {
|
|
|
37579
37589
|
while (r.at < linking.end) {
|
|
37580
37590
|
const type = r.byte();
|
|
37581
37591
|
const end = r.u() + r.at;
|
|
37582
|
-
if (type === 8)
|
|
37583
|
-
|
|
37592
|
+
if (type === 8) {
|
|
37593
|
+
const count = r.u();
|
|
37594
|
+
symKind = new Uint8Array(count);
|
|
37595
|
+
symFlags = new Uint32Array(count);
|
|
37596
|
+
symSegment = new Int32Array(count).fill(-1);
|
|
37597
|
+
symOffset = new Int32Array(count);
|
|
37598
|
+
symIndex = new Int32Array(count).fill(-1);
|
|
37599
|
+
for (let i = 0; i < count; i++) {
|
|
37584
37600
|
const kind = r.byte();
|
|
37585
37601
|
const flags = r.u();
|
|
37586
|
-
|
|
37587
|
-
|
|
37588
|
-
let index = -1;
|
|
37602
|
+
symKind[i] = kind;
|
|
37603
|
+
symFlags[i] = flags;
|
|
37589
37604
|
if (kind === 0 || kind === 2 || kind === 4 || kind === 5) {
|
|
37590
|
-
|
|
37591
|
-
if (!(flags & 16) || flags & 64) r.
|
|
37605
|
+
symIndex[i] = r.u();
|
|
37606
|
+
if (!(flags & 16) || flags & 64) r.skip(r.u());
|
|
37592
37607
|
} else if (kind === 1) {
|
|
37593
|
-
r.
|
|
37608
|
+
r.skip(r.u());
|
|
37594
37609
|
if (!(flags & 16)) {
|
|
37595
|
-
|
|
37596
|
-
|
|
37610
|
+
symSegment[i] = r.u();
|
|
37611
|
+
symOffset[i] = r.u();
|
|
37597
37612
|
r.u();
|
|
37598
37613
|
}
|
|
37599
37614
|
} else if (kind === 3) r.u();
|
|
37600
|
-
symbols.push({ kind, flags, segment: segment2, offset, index });
|
|
37601
37615
|
}
|
|
37602
|
-
else if (type === 5)
|
|
37616
|
+
} else if (type === 5)
|
|
37603
37617
|
for (let n = r.u(); n > 0; n--) {
|
|
37604
37618
|
segmentNames.push(r.name());
|
|
37605
37619
|
r.u();
|
|
@@ -37638,37 +37652,66 @@ function relocationEdges(bytes, segmentAddress) {
|
|
|
37638
37652
|
const importedFunctions = readModule(bytes).importedFuncs;
|
|
37639
37653
|
const data = [];
|
|
37640
37654
|
const dataFunctions = [];
|
|
37641
|
-
const
|
|
37642
|
-
const
|
|
37655
|
+
const bodyCount = bodyStarts.length;
|
|
37656
|
+
const code = Array.from({ length: bodyCount }, () => []);
|
|
37657
|
+
const calls = Array.from({ length: bodyCount }, () => []);
|
|
37643
37658
|
for (const s of sections) {
|
|
37644
37659
|
if (!s.name?.startsWith("reloc.")) continue;
|
|
37645
|
-
|
|
37646
|
-
const
|
|
37660
|
+
let cur = s.start;
|
|
37661
|
+
const readU = () => {
|
|
37662
|
+
const b0 = bytes[cur++];
|
|
37663
|
+
if (b0 < 128) return b0;
|
|
37664
|
+
let value = b0 & 127;
|
|
37665
|
+
let shift = 7;
|
|
37666
|
+
for (; ; ) {
|
|
37667
|
+
const byte = bytes[cur++];
|
|
37668
|
+
value += (byte & 127) * 2 ** shift;
|
|
37669
|
+
if (byte < 128) return value;
|
|
37670
|
+
shift += 7;
|
|
37671
|
+
}
|
|
37672
|
+
};
|
|
37673
|
+
const readS = () => {
|
|
37674
|
+
const b0 = bytes[cur++];
|
|
37675
|
+
if (b0 < 128) return b0 & 64 ? b0 - 128 : b0;
|
|
37676
|
+
let value = b0 & 127;
|
|
37677
|
+
let shift = 7;
|
|
37678
|
+
let byte = b0;
|
|
37679
|
+
while (byte >= 128) {
|
|
37680
|
+
byte = bytes[cur++];
|
|
37681
|
+
value += (byte & 127) * 2 ** shift;
|
|
37682
|
+
shift += 7;
|
|
37683
|
+
}
|
|
37684
|
+
if (byte & 64) value -= 2 ** shift;
|
|
37685
|
+
return value;
|
|
37686
|
+
};
|
|
37687
|
+
const target = readU();
|
|
37647
37688
|
if (target !== dataIndex && target !== codeIndex) continue;
|
|
37648
37689
|
let segment2 = 0;
|
|
37649
37690
|
let body = 0;
|
|
37650
|
-
|
|
37651
|
-
|
|
37652
|
-
const
|
|
37653
|
-
const
|
|
37654
|
-
const
|
|
37655
|
-
const
|
|
37656
|
-
const
|
|
37691
|
+
const isData = target === dataIndex;
|
|
37692
|
+
for (let n = readU(); n > 0; n--) {
|
|
37693
|
+
const type = bytes[cur++];
|
|
37694
|
+
const offset = readU();
|
|
37695
|
+
const index = readU();
|
|
37696
|
+
const bit = type < 32 ? 1 << type : 0;
|
|
37697
|
+
const addend = (ADDEND_RELOC_MASK & bit) !== 0 ? readS() : 0;
|
|
37698
|
+
const functionRelocation = (FUNCTION_RELOC_MASK & bit) !== 0;
|
|
37699
|
+
const memoryRelocation = (MEMORY_RELOC_MASK & bit) !== 0;
|
|
37657
37700
|
if (!functionRelocation && !memoryRelocation) continue;
|
|
37658
|
-
|
|
37659
|
-
const
|
|
37660
|
-
|
|
37661
|
-
if (!functionReference && (!memoryRelocation ||
|
|
37701
|
+
if (symFlags[index] & 16) continue;
|
|
37702
|
+
const kind = symKind[index];
|
|
37703
|
+
const functionReference = functionRelocation && kind === 0;
|
|
37704
|
+
if (!functionReference && (!memoryRelocation || kind !== 1 || symSegment[index] < 0))
|
|
37662
37705
|
continue;
|
|
37663
|
-
const to = functionReference ?
|
|
37664
|
-
if (functionReference && (to < 0 || to >=
|
|
37665
|
-
if (
|
|
37706
|
+
const to = functionReference ? symIndex[index] - importedFunctions : addresses[symSegment[index]] + symOffset[index] + addend;
|
|
37707
|
+
if (functionReference && (to < 0 || to >= bodyCount)) continue;
|
|
37708
|
+
if (isData) {
|
|
37666
37709
|
while (payloads[segment2].end <= offset) segment2++;
|
|
37667
37710
|
const payload = payloads[segment2];
|
|
37668
37711
|
const edges = functionReference ? dataFunctions : data;
|
|
37669
37712
|
edges.push(payload.address + offset - payload.start, to);
|
|
37670
37713
|
} else {
|
|
37671
|
-
while (body + 1 <
|
|
37714
|
+
while (body + 1 < bodyCount && bodyStarts[body + 1] <= offset) body++;
|
|
37672
37715
|
const edges = functionReference ? calls : code;
|
|
37673
37716
|
edges[body].push(to);
|
|
37674
37717
|
}
|
|
@@ -37724,7 +37767,7 @@ function unslottedFunctions(bytes) {
|
|
|
37724
37767
|
const slotted = new Set([...m.slots.keys()].filter((index) => index >= m.importedFuncs));
|
|
37725
37768
|
return m.bodies.length - slotted.size;
|
|
37726
37769
|
}
|
|
37727
|
-
var uleb, sleb, encodedName, section, PROCESS_EXPORTS, SWIFT_SDK_CONSTRUCTOR_LIMIT, FUNCTION_RELOCATIONS, MEMORY_RELOCATIONS, ADDEND_RELOCATIONS;
|
|
37770
|
+
var uleb, sleb, encodedName, section, PROCESS_EXPORTS, SWIFT_SDK_CONSTRUCTOR_LIMIT, FUNCTION_RELOCATIONS, MEMORY_RELOCATIONS, ADDEND_RELOCATIONS, FUNCTION_RELOC_MASK, MEMORY_RELOC_MASK, ADDEND_RELOC_MASK;
|
|
37728
37771
|
var init_swift_sdk_image_wasm = __esm({
|
|
37729
37772
|
"src/swift-sdk-image-wasm.ts"() {
|
|
37730
37773
|
"use strict";
|
|
@@ -37794,6 +37837,12 @@ var init_swift_sdk_image_wasm = __esm({
|
|
|
37794
37837
|
25,
|
|
37795
37838
|
27
|
|
37796
37839
|
]);
|
|
37840
|
+
FUNCTION_RELOC_MASK = 0;
|
|
37841
|
+
for (const type of FUNCTION_RELOCATIONS) FUNCTION_RELOC_MASK |= 1 << type;
|
|
37842
|
+
MEMORY_RELOC_MASK = 0;
|
|
37843
|
+
for (const type of MEMORY_RELOCATIONS) MEMORY_RELOC_MASK |= 1 << type;
|
|
37844
|
+
ADDEND_RELOC_MASK = 0;
|
|
37845
|
+
for (const type of ADDEND_RELOCATIONS) ADDEND_RELOC_MASK |= 1 << type;
|
|
37797
37846
|
}
|
|
37798
37847
|
});
|
|
37799
37848
|
|
|
@@ -37961,7 +38010,8 @@ function isRootSegName(name3) {
|
|
|
37961
38010
|
return false;
|
|
37962
38011
|
}
|
|
37963
38012
|
function decodeRelocations(buf, sections) {
|
|
37964
|
-
|
|
38013
|
+
let count = 0;
|
|
38014
|
+
for (let s = 0; s < sections.length; s++) count += sections[s].count;
|
|
37965
38015
|
const start = new Uint32Array(count);
|
|
37966
38016
|
const end = new Uint32Array(count);
|
|
37967
38017
|
const ro = new Int32Array(count);
|
|
@@ -37970,29 +38020,59 @@ function decodeRelocations(buf, sections) {
|
|
|
37970
38020
|
const spans = [];
|
|
37971
38021
|
let i = 0;
|
|
37972
38022
|
let length = 0;
|
|
37973
|
-
for (
|
|
37974
|
-
|
|
37975
|
-
|
|
37976
|
-
|
|
38023
|
+
for (let s = 0; s < sections.length; s++) {
|
|
38024
|
+
const section2 = sections[s];
|
|
38025
|
+
const baseAt = section2.at;
|
|
38026
|
+
const sectionCount = section2.count;
|
|
38027
|
+
let cur = baseAt;
|
|
38028
|
+
for (let k = 0; k < sectionCount; k++, i++) {
|
|
38029
|
+
start[i] = length + cur - baseAt;
|
|
37977
38030
|
const rType = buf[cur++];
|
|
37978
|
-
|
|
37979
|
-
|
|
37980
|
-
|
|
37981
|
-
|
|
37982
|
-
|
|
38031
|
+
let offset = buf[cur++];
|
|
38032
|
+
if (offset >= 128) {
|
|
38033
|
+
offset &= 127;
|
|
38034
|
+
let shift = 7;
|
|
38035
|
+
while (true) {
|
|
38036
|
+
const byte = buf[cur++];
|
|
38037
|
+
offset |= (byte & 127) << shift;
|
|
38038
|
+
if (byte < 128) break;
|
|
38039
|
+
shift += 7;
|
|
38040
|
+
}
|
|
38041
|
+
}
|
|
38042
|
+
let symbol2 = buf[cur++];
|
|
38043
|
+
if (symbol2 >= 128) {
|
|
38044
|
+
symbol2 &= 127;
|
|
38045
|
+
let shift = 7;
|
|
38046
|
+
while (true) {
|
|
38047
|
+
const byte = buf[cur++];
|
|
38048
|
+
symbol2 |= (byte & 127) << shift;
|
|
38049
|
+
if (byte < 128) break;
|
|
38050
|
+
shift += 7;
|
|
38051
|
+
}
|
|
38052
|
+
}
|
|
38053
|
+
if (rType < 32 && (ADDEND_RELOC_MASK2 & 1 << rType) !== 0) {
|
|
38054
|
+
let byte = buf[cur++];
|
|
38055
|
+
let value = byte & 127;
|
|
38056
|
+
let shift = 7;
|
|
38057
|
+
while (byte >= 128) {
|
|
38058
|
+
byte = buf[cur++];
|
|
38059
|
+
value |= (byte & 127) << shift;
|
|
38060
|
+
shift += 7;
|
|
38061
|
+
}
|
|
38062
|
+
if (shift < 32 && (byte & 64) !== 0) value |= ~0 << shift;
|
|
37983
38063
|
addend[i] = value;
|
|
37984
|
-
cur = c4;
|
|
37985
38064
|
}
|
|
37986
38065
|
ro[i] = offset;
|
|
37987
38066
|
rs[i] = symbol2;
|
|
37988
|
-
end[i] = length + cur -
|
|
38067
|
+
end[i] = length + cur - baseAt;
|
|
37989
38068
|
}
|
|
37990
|
-
spans.push([
|
|
37991
|
-
length += cur -
|
|
38069
|
+
spans.push([baseAt, cur]);
|
|
38070
|
+
length += cur - baseAt;
|
|
37992
38071
|
}
|
|
37993
38072
|
const bytes = new Uint8Array(length);
|
|
37994
38073
|
let at = 0;
|
|
37995
|
-
for (
|
|
38074
|
+
for (let s = 0; s < spans.length; s++) {
|
|
38075
|
+
const [from, to] = spans[s];
|
|
37996
38076
|
bytes.set(buf.subarray(from, to), at);
|
|
37997
38077
|
at += to - from;
|
|
37998
38078
|
}
|
|
@@ -38157,6 +38237,27 @@ function patchSwiftrtObject(src) {
|
|
|
38157
38237
|
function parseWasmObjectBytes(file, buf, isDist, symbolFlagOffsets) {
|
|
38158
38238
|
const rawBuf = Buffer.isBuffer(buf) ? buf : Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
38159
38239
|
let pos = 8;
|
|
38240
|
+
let cur = 8;
|
|
38241
|
+
const readU = () => {
|
|
38242
|
+
const b0 = buf[cur++];
|
|
38243
|
+
if (b0 < 128) return b0;
|
|
38244
|
+
let res = b0 & 127;
|
|
38245
|
+
let shift = 7;
|
|
38246
|
+
while (true) {
|
|
38247
|
+
const byte = buf[cur++];
|
|
38248
|
+
res |= (byte & 127) << shift;
|
|
38249
|
+
if (byte < 128) return res;
|
|
38250
|
+
shift += 7;
|
|
38251
|
+
}
|
|
38252
|
+
};
|
|
38253
|
+
const skipU = () => {
|
|
38254
|
+
while (buf[cur++] >= 128) {
|
|
38255
|
+
}
|
|
38256
|
+
};
|
|
38257
|
+
const skipS = () => {
|
|
38258
|
+
while (buf[cur++] >= 128) {
|
|
38259
|
+
}
|
|
38260
|
+
};
|
|
38160
38261
|
let numImportFuncs = 0;
|
|
38161
38262
|
let importsDlsym = false;
|
|
38162
38263
|
const importFuncNames = [];
|
|
@@ -38185,150 +38286,122 @@ function parseWasmObjectBytes(file, buf, isDist, symbolFlagOffsets) {
|
|
|
38185
38286
|
const dataRelocSections = [];
|
|
38186
38287
|
while (pos < buf.length) {
|
|
38187
38288
|
const id = buf[pos++];
|
|
38188
|
-
|
|
38289
|
+
cur = pos;
|
|
38290
|
+
const sz = readU();
|
|
38291
|
+
const p = cur;
|
|
38189
38292
|
const end = p + sz;
|
|
38190
38293
|
if (id === 2) {
|
|
38191
|
-
|
|
38294
|
+
const cnt = readU();
|
|
38192
38295
|
for (let i = 0; i < cnt; i++) {
|
|
38193
|
-
const
|
|
38194
|
-
const mName = rawBuf.toString("utf8",
|
|
38195
|
-
|
|
38196
|
-
const
|
|
38197
|
-
const fName = rawBuf.toString("utf8",
|
|
38198
|
-
|
|
38199
|
-
const kind = buf[
|
|
38296
|
+
const mLen = readU();
|
|
38297
|
+
const mName = rawBuf.toString("utf8", cur, cur + mLen);
|
|
38298
|
+
cur += mLen;
|
|
38299
|
+
const fLen = readU();
|
|
38300
|
+
const fName = rawBuf.toString("utf8", cur, cur + fLen);
|
|
38301
|
+
cur += fLen;
|
|
38302
|
+
const kind = buf[cur++];
|
|
38200
38303
|
if (kind === 0) {
|
|
38201
|
-
|
|
38202
|
-
cp = c2;
|
|
38304
|
+
skipU();
|
|
38203
38305
|
importFuncNames.push(fName);
|
|
38204
38306
|
importFuncModules.push(mName);
|
|
38205
38307
|
if (mName === "env" && fName === "dlsym") importsDlsym = true;
|
|
38206
38308
|
numImportFuncs++;
|
|
38207
38309
|
} else if (kind === 1) {
|
|
38208
|
-
|
|
38209
|
-
const
|
|
38210
|
-
|
|
38211
|
-
|
|
38212
|
-
cp = c3;
|
|
38213
|
-
if (fl & 1) {
|
|
38214
|
-
const [, c4] = readULEB2(buf, cp);
|
|
38215
|
-
cp = c4;
|
|
38216
|
-
}
|
|
38310
|
+
cur++;
|
|
38311
|
+
const fl = readU();
|
|
38312
|
+
skipU();
|
|
38313
|
+
if (fl & 1) skipU();
|
|
38217
38314
|
importTableNames.push(fName);
|
|
38218
38315
|
} else if (kind === 2) {
|
|
38219
|
-
const
|
|
38220
|
-
|
|
38221
|
-
|
|
38222
|
-
cp = c3;
|
|
38223
|
-
if (fl & 1) {
|
|
38224
|
-
const [, c4] = readULEB2(buf, cp);
|
|
38225
|
-
cp = c4;
|
|
38226
|
-
}
|
|
38316
|
+
const fl = readU();
|
|
38317
|
+
skipU();
|
|
38318
|
+
if (fl & 1) skipU();
|
|
38227
38319
|
} else if (kind === 3) {
|
|
38228
|
-
|
|
38320
|
+
cur += 2;
|
|
38229
38321
|
importGlobalNames.push(fName);
|
|
38230
38322
|
} else if (kind === 4) {
|
|
38231
|
-
|
|
38232
|
-
|
|
38233
|
-
cp = c2;
|
|
38323
|
+
cur++;
|
|
38324
|
+
skipU();
|
|
38234
38325
|
importEventNames.push(fName);
|
|
38235
38326
|
}
|
|
38236
38327
|
}
|
|
38237
38328
|
} else if (id === 10) {
|
|
38238
38329
|
codeStart = p;
|
|
38239
|
-
|
|
38330
|
+
const cnt = readU();
|
|
38240
38331
|
for (let i = 0; i < cnt; i++) {
|
|
38241
|
-
const st =
|
|
38242
|
-
const
|
|
38243
|
-
|
|
38332
|
+
const st = cur - codeStart;
|
|
38333
|
+
const bLen = readU();
|
|
38334
|
+
cur += bLen;
|
|
38244
38335
|
fStarts.push(st);
|
|
38245
|
-
fEnds.push(
|
|
38336
|
+
fEnds.push(cur - codeStart);
|
|
38246
38337
|
}
|
|
38247
38338
|
} else if (id === 11) {
|
|
38248
38339
|
dataStart = p;
|
|
38249
|
-
|
|
38340
|
+
const cnt = readU();
|
|
38250
38341
|
for (let i = 0; i < cnt; i++) {
|
|
38251
|
-
const st =
|
|
38252
|
-
const
|
|
38253
|
-
|
|
38254
|
-
if (mode === 2) {
|
|
38255
|
-
const [, m3] = readULEB2(buf, cp);
|
|
38256
|
-
cp = m3;
|
|
38257
|
-
}
|
|
38342
|
+
const st = cur - dataStart;
|
|
38343
|
+
const mode = readU();
|
|
38344
|
+
if (mode === 2) skipU();
|
|
38258
38345
|
if (mode === 0 || mode === 2) {
|
|
38259
|
-
const op = buf[
|
|
38260
|
-
if (op === 65 || op === 66)
|
|
38261
|
-
|
|
38262
|
-
|
|
38263
|
-
} else if (op === 35) {
|
|
38264
|
-
const [, m4] = readULEB2(buf, cp);
|
|
38265
|
-
cp = m4;
|
|
38266
|
-
}
|
|
38267
|
-
cp++;
|
|
38346
|
+
const op = buf[cur++];
|
|
38347
|
+
if (op === 65 || op === 66) skipS();
|
|
38348
|
+
else if (op === 35) skipU();
|
|
38349
|
+
cur++;
|
|
38268
38350
|
}
|
|
38269
|
-
const
|
|
38270
|
-
sPayloadStarts.push(
|
|
38271
|
-
|
|
38351
|
+
const dLen = readU();
|
|
38352
|
+
sPayloadStarts.push(cur - dataStart);
|
|
38353
|
+
cur += dLen;
|
|
38272
38354
|
sStarts.push(st);
|
|
38273
|
-
sEnds.push(
|
|
38355
|
+
sEnds.push(cur - dataStart);
|
|
38274
38356
|
}
|
|
38275
38357
|
} else if (id === 0) {
|
|
38276
|
-
const
|
|
38277
|
-
const name3 = rawBuf.toString("utf8",
|
|
38278
|
-
|
|
38358
|
+
const nLen = readU();
|
|
38359
|
+
const name3 = rawBuf.toString("utf8", cur, cur + nLen);
|
|
38360
|
+
cur += nLen;
|
|
38279
38361
|
if (name3 === "linking") {
|
|
38280
|
-
|
|
38281
|
-
while (
|
|
38282
|
-
const subId = buf[
|
|
38283
|
-
const
|
|
38284
|
-
const subEnd =
|
|
38362
|
+
skipU();
|
|
38363
|
+
while (cur < end) {
|
|
38364
|
+
const subId = buf[cur++];
|
|
38365
|
+
const subLen = readU();
|
|
38366
|
+
const subEnd = cur + subLen;
|
|
38285
38367
|
if (subId === 5) {
|
|
38286
|
-
const
|
|
38287
|
-
let cur = p2;
|
|
38368
|
+
const cnt = readU();
|
|
38288
38369
|
for (let i = 0; i < cnt; i++) {
|
|
38289
|
-
const
|
|
38290
|
-
segNames.push(rawBuf.toString("utf8",
|
|
38291
|
-
cur
|
|
38292
|
-
|
|
38293
|
-
|
|
38294
|
-
segFlags.push(fl);
|
|
38295
|
-
cur = s4;
|
|
38370
|
+
const sLen = readU();
|
|
38371
|
+
segNames.push(rawBuf.toString("utf8", cur, cur + sLen));
|
|
38372
|
+
cur += sLen;
|
|
38373
|
+
skipU();
|
|
38374
|
+
segFlags.push(readU());
|
|
38296
38375
|
}
|
|
38297
38376
|
} else if (subId === 6) {
|
|
38298
|
-
const
|
|
38299
|
-
let cur = p2;
|
|
38377
|
+
const cnt = readU();
|
|
38300
38378
|
for (let i = 0; i < cnt; i++) {
|
|
38301
|
-
|
|
38302
|
-
|
|
38303
|
-
initFuncs.push(symIdx);
|
|
38304
|
-
cur = s3;
|
|
38379
|
+
skipU();
|
|
38380
|
+
initFuncs.push(readU());
|
|
38305
38381
|
}
|
|
38306
38382
|
} else if (subId === 8) {
|
|
38307
|
-
const
|
|
38383
|
+
const cnt = readU();
|
|
38308
38384
|
symKind = new Uint8Array(cnt);
|
|
38309
38385
|
symFlags = new Uint32Array(cnt);
|
|
38310
38386
|
symElemIdx = new Int32Array(cnt).fill(-1);
|
|
38311
|
-
symOff = new Int32Array(cnt)
|
|
38312
|
-
symSz = new Int32Array(cnt)
|
|
38313
|
-
let cur = p2;
|
|
38387
|
+
symOff = new Int32Array(cnt);
|
|
38388
|
+
symSz = new Int32Array(cnt);
|
|
38314
38389
|
for (let i = 0; i < cnt; i++) {
|
|
38315
38390
|
const kind = buf[cur++];
|
|
38316
38391
|
if (symbolFlagOffsets) symbolFlagOffsets[i] = cur;
|
|
38317
|
-
const
|
|
38318
|
-
cur = c2;
|
|
38392
|
+
const fl = readU();
|
|
38319
38393
|
symKind[i] = kind;
|
|
38320
38394
|
symFlags[i] = fl;
|
|
38321
38395
|
const isUndef = (fl & 16) !== 0;
|
|
38322
38396
|
const isExplicitName = (fl & 64) !== 0;
|
|
38323
38397
|
if (kind === 0 || kind === 2 || kind === 4 || kind === 5) {
|
|
38324
|
-
const
|
|
38325
|
-
cur = c3;
|
|
38398
|
+
const el = readU();
|
|
38326
38399
|
if (!isUndef && kind === 0) symElemIdx[i] = el;
|
|
38327
38400
|
let sName = "";
|
|
38328
38401
|
if (!isUndef || isExplicitName) {
|
|
38329
|
-
const
|
|
38330
|
-
sName = rawBuf.toString("utf8",
|
|
38331
|
-
cur
|
|
38402
|
+
const sLen = readU();
|
|
38403
|
+
sName = rawBuf.toString("utf8", cur, cur + sLen);
|
|
38404
|
+
cur += sLen;
|
|
38332
38405
|
} else if (kind === 0) {
|
|
38333
38406
|
sName = importFuncNames[el] ?? "";
|
|
38334
38407
|
} else if (kind === 2) {
|
|
@@ -38342,33 +38415,28 @@ function parseWasmObjectBytes(file, buf, isDist, symbolFlagOffsets) {
|
|
|
38342
38415
|
hostImportNames.add(sName);
|
|
38343
38416
|
symNames.push(sName);
|
|
38344
38417
|
} else if (kind === 1) {
|
|
38345
|
-
const
|
|
38346
|
-
const sName = rawBuf.toString("utf8",
|
|
38347
|
-
cur
|
|
38418
|
+
const sLen = readU();
|
|
38419
|
+
const sName = rawBuf.toString("utf8", cur, cur + sLen);
|
|
38420
|
+
cur += sLen;
|
|
38348
38421
|
if (!isUndef) {
|
|
38349
|
-
|
|
38350
|
-
|
|
38351
|
-
|
|
38352
|
-
cur = c6;
|
|
38353
|
-
symElemIdx[i] = segIdx;
|
|
38354
|
-
symOff[i] = sOff;
|
|
38355
|
-
symSz[i] = sSz;
|
|
38422
|
+
symElemIdx[i] = readU();
|
|
38423
|
+
symOff[i] = readU();
|
|
38424
|
+
symSz[i] = readU();
|
|
38356
38425
|
}
|
|
38357
38426
|
symNames.push(sName);
|
|
38358
38427
|
} else if (kind === 3) {
|
|
38359
|
-
|
|
38360
|
-
cur = c3;
|
|
38428
|
+
skipU();
|
|
38361
38429
|
symNames.push("");
|
|
38362
38430
|
}
|
|
38363
38431
|
}
|
|
38364
38432
|
}
|
|
38365
|
-
|
|
38433
|
+
cur = subEnd;
|
|
38366
38434
|
}
|
|
38367
38435
|
} else if (name3 === "reloc.CODE" || name3 === "reloc.DATA") {
|
|
38368
|
-
|
|
38369
|
-
const
|
|
38436
|
+
skipU();
|
|
38437
|
+
const count = readU();
|
|
38370
38438
|
(name3 === "reloc.DATA" ? dataRelocSections : codeRelocSections).push({
|
|
38371
|
-
at,
|
|
38439
|
+
at: cur,
|
|
38372
38440
|
count
|
|
38373
38441
|
});
|
|
38374
38442
|
}
|
|
@@ -38421,40 +38489,63 @@ function parseWasmObjectBytes(file, buf, isDist, symbolFlagOffsets) {
|
|
|
38421
38489
|
segTopSyms.set(segIdx, dedupTop);
|
|
38422
38490
|
}
|
|
38423
38491
|
}
|
|
38424
|
-
const
|
|
38425
|
-
const
|
|
38492
|
+
const funcCount = fEnds.length;
|
|
38493
|
+
const funcRelocs = Array.from({ length: funcCount }, () => []);
|
|
38494
|
+
const rawCode = decodeRelocations(buf, funcCount > 0 ? codeRelocSections : []);
|
|
38426
38495
|
const codeRelocs = { ...rawCode, funcIdx: new Uint32Array(rawCode.count) };
|
|
38496
|
+
let fCursor = 0;
|
|
38497
|
+
let prevCodeRo = -1;
|
|
38427
38498
|
for (let i = 0; i < codeRelocs.count; i++) {
|
|
38428
38499
|
const ro = codeRelocs.ro[i];
|
|
38429
|
-
let lo
|
|
38430
|
-
|
|
38431
|
-
|
|
38432
|
-
|
|
38433
|
-
|
|
38434
|
-
|
|
38500
|
+
let lo;
|
|
38501
|
+
if (ro >= prevCodeRo) {
|
|
38502
|
+
while (fCursor < funcCount - 1 && fEnds[fCursor] <= ro) fCursor++;
|
|
38503
|
+
lo = fCursor;
|
|
38504
|
+
} else {
|
|
38505
|
+
lo = 0;
|
|
38506
|
+
let hi = funcCount - 1;
|
|
38507
|
+
while (lo < hi) {
|
|
38508
|
+
const mid = lo + hi >> 1;
|
|
38509
|
+
if (fEnds[mid] <= ro) lo = mid + 1;
|
|
38510
|
+
else hi = mid;
|
|
38511
|
+
}
|
|
38512
|
+
fCursor = lo;
|
|
38435
38513
|
}
|
|
38514
|
+
prevCodeRo = ro;
|
|
38436
38515
|
if (codeRelocs.bytes[codeRelocs.start[i]] !== 6)
|
|
38437
38516
|
funcRelocs[lo].push(codeRelocs.rs[i]);
|
|
38438
38517
|
codeRelocs.funcIdx[i] = lo;
|
|
38439
38518
|
}
|
|
38440
|
-
const
|
|
38519
|
+
const segCount = segNames.length;
|
|
38520
|
+
const segRelocs = Array.from({ length: segCount }, () => []);
|
|
38441
38521
|
const symDataRelocs = /* @__PURE__ */ new Map();
|
|
38442
38522
|
const rawData = decodeRelocations(buf, sEnds.length > 0 ? dataRelocSections : []);
|
|
38443
38523
|
const dataSegIdx = new Uint32Array(rawData.count);
|
|
38444
38524
|
const dataOffInSeg = new Int32Array(rawData.count);
|
|
38445
38525
|
const dataOwnerSymIdx = new Int32Array(rawData.count);
|
|
38446
38526
|
let kept = 0;
|
|
38527
|
+
let sCursor = 0;
|
|
38528
|
+
let prevDataRo = -1;
|
|
38529
|
+
const sEndLast = sEnds.length - 1;
|
|
38447
38530
|
for (let i = 0; i < rawData.count; i++) {
|
|
38448
38531
|
const ro = rawData.ro[i];
|
|
38449
38532
|
const rs = rawData.rs[i];
|
|
38450
|
-
let lo
|
|
38451
|
-
|
|
38452
|
-
|
|
38453
|
-
|
|
38454
|
-
|
|
38455
|
-
|
|
38533
|
+
let lo;
|
|
38534
|
+
if (ro >= prevDataRo) {
|
|
38535
|
+
while (sCursor < sEndLast && sEnds[sCursor] <= ro) sCursor++;
|
|
38536
|
+
lo = sCursor;
|
|
38537
|
+
} else {
|
|
38538
|
+
lo = 0;
|
|
38539
|
+
let hi = sEndLast;
|
|
38540
|
+
while (lo < hi) {
|
|
38541
|
+
const mid = lo + hi >> 1;
|
|
38542
|
+
if (sEnds[mid] <= ro) lo = mid + 1;
|
|
38543
|
+
else hi = mid;
|
|
38544
|
+
}
|
|
38545
|
+
sCursor = lo;
|
|
38456
38546
|
}
|
|
38457
|
-
|
|
38547
|
+
prevDataRo = ro;
|
|
38548
|
+
if (lo >= segCount) continue;
|
|
38458
38549
|
const offInSeg = ro - (sPayloadStarts[lo] ?? 0);
|
|
38459
38550
|
let ownerSymIdx = -1;
|
|
38460
38551
|
const topList = segTopSyms.get(lo);
|
|
@@ -38601,74 +38692,78 @@ function parseWasmObjectBytes(file, buf, isDist, symbolFlagOffsets) {
|
|
|
38601
38692
|
const conformanceProtocols = /* @__PURE__ */ new Map();
|
|
38602
38693
|
const objcCategoryTargets = [];
|
|
38603
38694
|
if (isDist) {
|
|
38604
|
-
const relocAt = /* @__PURE__ */ new Map();
|
|
38605
|
-
for (let i = 0; i < dataRelocs.count; i++) {
|
|
38606
|
-
relocAt.set(`${dataRelocs.segIdx[i]}:${dataRelocs.offInSeg[i]}`, {
|
|
38607
|
-
rs: dataRelocs.rs[i],
|
|
38608
|
-
addend: dataRelocs.addend[i]
|
|
38609
|
-
});
|
|
38610
|
-
}
|
|
38611
38695
|
const confSegs = /* @__PURE__ */ new Set();
|
|
38612
38696
|
let hasCatsSeg = false;
|
|
38613
38697
|
for (let i = 0; i < segNames.length; i++) {
|
|
38614
38698
|
if (segNames[i] === "swift5_protocol_conformances") confSegs.add(i);
|
|
38615
38699
|
else if (segNames[i] === "__objc_cats") hasCatsSeg = true;
|
|
38616
38700
|
}
|
|
38617
|
-
if (confSegs.size > 0) {
|
|
38618
|
-
const
|
|
38619
|
-
|
|
38620
|
-
if (symKind[i] === 1 && (symFlags[i] & 16) === 0 && symElemIdx[i] >= 0 && symNames[i].startsWith("$s") && symNames[i].endsWith("Mp")) {
|
|
38621
|
-
segOffToMpSym.set(`${symElemIdx[i]}:${symOff[i]}`, symNames[i]);
|
|
38622
|
-
}
|
|
38623
|
-
}
|
|
38624
|
-
const dv = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
38701
|
+
if (confSegs.size > 0 || hasCatsSeg) {
|
|
38702
|
+
const relocKey = (seg, off) => seg * 4294967296 + (off >>> 0);
|
|
38703
|
+
const relocAt = /* @__PURE__ */ new Map();
|
|
38625
38704
|
for (let i = 0; i < dataRelocs.count; i++) {
|
|
38626
|
-
|
|
38627
|
-
|
|
38628
|
-
|
|
38629
|
-
|
|
38705
|
+
relocAt.set(relocKey(dataRelocs.segIdx[i], dataRelocs.offInSeg[i]), i);
|
|
38706
|
+
}
|
|
38707
|
+
if (confSegs.size > 0) {
|
|
38708
|
+
const segOffToMpSym = /* @__PURE__ */ new Map();
|
|
38709
|
+
for (let i = 0; i < symKind.length; i++) {
|
|
38710
|
+
if (symKind[i] === 1 && (symFlags[i] & 16) === 0 && symElemIdx[i] >= 0 && symNames[i].startsWith("$s") && symNames[i].endsWith("Mp")) {
|
|
38711
|
+
segOffToMpSym.set(relocKey(symElemIdx[i], symOff[i]), symNames[i]);
|
|
38712
|
+
}
|
|
38630
38713
|
}
|
|
38631
|
-
const
|
|
38632
|
-
|
|
38633
|
-
|
|
38634
|
-
|
|
38635
|
-
|
|
38636
|
-
|
|
38637
|
-
const stripped2 = raw2.startsWith(".Lgot.") ? raw2.slice(6) : raw2;
|
|
38638
|
-
if (stripped2.startsWith("$s") && stripped2.endsWith("Mp")) {
|
|
38639
|
-
mp = stripped2;
|
|
38640
|
-
} else if (symKind[pr.rs] === 3 || stripped2 === "") {
|
|
38641
|
-
mp = segOffToMpSym.get(`${mcSeg}:${pr.addend}`) ?? "";
|
|
38714
|
+
const dv = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
38715
|
+
for (let i = 0; i < dataRelocs.count; i++) {
|
|
38716
|
+
if (!confSegs.has(dataRelocs.segIdx[i])) continue;
|
|
38717
|
+
const mcIdx = dataRelocs.rs[i];
|
|
38718
|
+
if (symKind[mcIdx] !== 1 || (symFlags[mcIdx] & 16) !== 0 || symElemIdx[mcIdx] < 0) {
|
|
38719
|
+
continue;
|
|
38642
38720
|
}
|
|
38643
|
-
|
|
38644
|
-
const
|
|
38645
|
-
|
|
38646
|
-
|
|
38647
|
-
|
|
38721
|
+
const mcSeg = symElemIdx[mcIdx];
|
|
38722
|
+
const mcOff = symOff[mcIdx];
|
|
38723
|
+
const prIdx = relocAt.get(relocKey(mcSeg, mcOff));
|
|
38724
|
+
let mp = "";
|
|
38725
|
+
if (prIdx !== void 0) {
|
|
38726
|
+
const prRs = dataRelocs.rs[prIdx];
|
|
38727
|
+
const raw2 = symNames[prRs];
|
|
38728
|
+
const stripped2 = raw2.startsWith(".Lgot.") ? raw2.slice(6) : raw2;
|
|
38729
|
+
if (stripped2.startsWith("$s") && stripped2.endsWith("Mp")) {
|
|
38730
|
+
mp = stripped2;
|
|
38731
|
+
} else if (symKind[prRs] === 3 || stripped2 === "") {
|
|
38732
|
+
mp = segOffToMpSym.get(relocKey(mcSeg, dataRelocs.addend[prIdx])) ?? "";
|
|
38733
|
+
}
|
|
38734
|
+
} else {
|
|
38735
|
+
const fileOff = dataStart + sPayloadStarts[mcSeg] + mcOff;
|
|
38736
|
+
if (fileOff + 4 <= buf.length) {
|
|
38737
|
+
const delta = dv.getInt32(fileOff, true);
|
|
38738
|
+
mp = segOffToMpSym.get(relocKey(mcSeg, mcOff + delta)) ?? segOffToMpSym.get(relocKey(mcSeg, mcOff + (delta & ~1))) ?? "";
|
|
38739
|
+
}
|
|
38648
38740
|
}
|
|
38741
|
+
if (mp) conformanceProtocols.set(mcIdx, mp);
|
|
38649
38742
|
}
|
|
38650
|
-
if (mp) conformanceProtocols.set(mcIdx, mp);
|
|
38651
38743
|
}
|
|
38652
|
-
|
|
38653
|
-
|
|
38654
|
-
|
|
38655
|
-
|
|
38656
|
-
|
|
38657
|
-
|
|
38658
|
-
|
|
38659
|
-
|
|
38660
|
-
|
|
38661
|
-
|
|
38662
|
-
|
|
38663
|
-
|
|
38664
|
-
|
|
38665
|
-
|
|
38666
|
-
|
|
38667
|
-
|
|
38668
|
-
|
|
38669
|
-
|
|
38670
|
-
|
|
38671
|
-
|
|
38744
|
+
if (hasCatsSeg) {
|
|
38745
|
+
const seenClasses = /* @__PURE__ */ new Set();
|
|
38746
|
+
for (let i = 0; i < symKind.length; i++) {
|
|
38747
|
+
if (symKind[i] !== 1 || (symFlags[i] & 16) !== 0 || symElemIdx[i] < 0 || segNames[symElemIdx[i]] !== "__objc_cats" || !symNames[i].startsWith(".objc_category_")) {
|
|
38748
|
+
continue;
|
|
38749
|
+
}
|
|
38750
|
+
const cSeg = symElemIdx[i];
|
|
38751
|
+
const cOff = symOff[i];
|
|
38752
|
+
const crIdx = relocAt.get(relocKey(cSeg, cOff + 8));
|
|
38753
|
+
if (crIdx !== void 0) {
|
|
38754
|
+
const crRs = dataRelocs.rs[crIdx];
|
|
38755
|
+
if (symKind[crRs] === 1 && (symFlags[crRs] & 16) === 0 && symElemIdx[crRs] >= 0) {
|
|
38756
|
+
const tSeg = symElemIdx[crRs];
|
|
38757
|
+
const strOff = dataStart + sPayloadStarts[tSeg] + symOff[crRs] + dataRelocs.addend[crIdx];
|
|
38758
|
+
let sEnd = strOff;
|
|
38759
|
+
while (sEnd < buf.length && buf[sEnd] !== 0) sEnd++;
|
|
38760
|
+
if (sEnd > strOff) {
|
|
38761
|
+
const clsName = rawBuf.toString("utf8", strOff, sEnd);
|
|
38762
|
+
if (!seenClasses.has(clsName)) {
|
|
38763
|
+
seenClasses.add(clsName);
|
|
38764
|
+
objcCategoryTargets.push(clsName);
|
|
38765
|
+
}
|
|
38766
|
+
}
|
|
38672
38767
|
}
|
|
38673
38768
|
}
|
|
38674
38769
|
}
|
|
@@ -39881,7 +39976,9 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
|
|
|
39881
39976
|
return true;
|
|
39882
39977
|
};
|
|
39883
39978
|
const writePrunedObject = (obj, outFile) => {
|
|
39884
|
-
const
|
|
39979
|
+
const cached4 = objectBytes.get(obj);
|
|
39980
|
+
const buf = cached4 ? new Uint8Array(cached4) : new Uint8Array(import_node_fs56.default.readFileSync(obj.file));
|
|
39981
|
+
const rawBuf = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
39885
39982
|
const inputSha256 = link ? (0, import_node_crypto29.createHash)("sha256").update(buf).digest("hex") : "";
|
|
39886
39983
|
const fLive = liveFuncs.get(obj);
|
|
39887
39984
|
const sLive = liveSegs.get(obj);
|
|
@@ -39973,7 +40070,7 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
|
|
|
39973
40070
|
const end = p + sz;
|
|
39974
40071
|
if (id === 0) {
|
|
39975
40072
|
const [nLen, np] = readULEB2(buf, p);
|
|
39976
|
-
const name3 =
|
|
40073
|
+
const name3 = rawBuf.toString("utf8", np, np + nLen);
|
|
39977
40074
|
const cp = np + nLen;
|
|
39978
40075
|
if (name3 === "linking") {
|
|
39979
40076
|
const [, lpStart] = readULEB2(buf, cp);
|
|
@@ -40235,7 +40332,7 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
|
|
|
40235
40332
|
);
|
|
40236
40333
|
import_node_fs56.default.rmSync(rspPath, { force: true });
|
|
40237
40334
|
}
|
|
40238
|
-
var import_node_child_process25, import_node_crypto29, import_node_fs56, import_node_path57, v3, WIDE_DATA_RELOCS, ROOT_SEG_PREFIXES, RECORD_SEGS, PARTITIONED_SEGS, PRUNED_SDK_ARCHIVES, OMIT_SDK_LIB_FLAGS, NEUTRALIZED_SWIFTRT_SECTIONS, relocationBytes, parsedObjectCache, PARSED_ROOTS, SWIFTUI_WRAPPER_HOST_PROTOCOLS, SWIFT_PRUNED_LINK_MAP, SWIFT_PRUNED_LINK_RESPONSE;
|
|
40335
|
+
var import_node_child_process25, import_node_crypto29, import_node_fs56, import_node_path57, v3, WIDE_DATA_RELOCS, ROOT_SEG_PREFIXES, RECORD_SEGS, PARTITIONED_SEGS, PRUNED_SDK_ARCHIVES, OMIT_SDK_LIB_FLAGS, NEUTRALIZED_SWIFTRT_SECTIONS, ADDEND_RELOC_MASK2, relocationBytes, parsedObjectCache, PARSED_ROOTS, SWIFTUI_WRAPPER_HOST_PROTOCOLS, SWIFT_PRUNED_LINK_MAP, SWIFT_PRUNED_LINK_RESPONSE;
|
|
40239
40336
|
var init_swift_wasm_prune = __esm({
|
|
40240
40337
|
"src/swift-wasm-prune.ts"() {
|
|
40241
40338
|
"use strict";
|
|
@@ -40315,6 +40412,8 @@ var init_swift_wasm_prune = __esm({
|
|
|
40315
40412
|
"swift5_reflstr",
|
|
40316
40413
|
"swift5_typeref"
|
|
40317
40414
|
]);
|
|
40415
|
+
ADDEND_RELOC_MASK2 = 0;
|
|
40416
|
+
for (const type of ADDEND_RELOCATIONS) ADDEND_RELOC_MASK2 |= 1 << type;
|
|
40318
40417
|
relocationBytes = (relocs, i) => relocs.bytes.subarray(relocs.start[i], relocs.end[i]);
|
|
40319
40418
|
parsedObjectCache = /* @__PURE__ */ new Map();
|
|
40320
40419
|
PARSED_ROOTS = 2;
|
|
@@ -40939,7 +41038,7 @@ function llvmType(value) {
|
|
|
40939
41038
|
function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLookups, preserveCanonical, options2 = {}) {
|
|
40940
41039
|
if (!isWasmMagic(bytes)) throw new Error("expected wasm object");
|
|
40941
41040
|
const rawBuf = Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
40942
|
-
const { sdkLookupOnly, sdkProduct } = options2;
|
|
41041
|
+
const { sdkLookupOnly, sdkProduct, collectRewrittenSymbols } = options2;
|
|
40943
41042
|
const comdatScope = sdkProduct === void 0 ? callerAlias : `${callerAlias}:${sdkProduct}`;
|
|
40944
41043
|
const rewrite = binding !== void 0;
|
|
40945
41044
|
const sections = rewrite ? [bytes.subarray(0, 8)] : void 0;
|
|
@@ -40948,6 +41047,9 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
|
|
|
40948
41047
|
const definitions = [];
|
|
40949
41048
|
const functionImports = /* @__PURE__ */ new Map();
|
|
40950
41049
|
const functionImportNames = [];
|
|
41050
|
+
const tableImportNames = [];
|
|
41051
|
+
const globalImportNames = [];
|
|
41052
|
+
const eventImportNames = [];
|
|
40951
41053
|
const functionSymbols = [];
|
|
40952
41054
|
const addressTaken = /* @__PURE__ */ new Set();
|
|
40953
41055
|
let usesDlsym = false;
|
|
@@ -41069,12 +41171,18 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
|
|
|
41069
41171
|
if (isDlsym) usesDlsym = true;
|
|
41070
41172
|
if (isDlerror) usesDlerror = true;
|
|
41071
41173
|
if (importWriter && binding) {
|
|
41174
|
+
const rewrittenName = isDlsym ? callerAlias : isDlerror ? dlerrorAlias : module2 === "env" && name3 !== "dlsym" && name3 !== "dlerror" ? binding(name3) ?? name3 : name3;
|
|
41072
41175
|
importWriter.string(module2);
|
|
41073
|
-
importWriter.string(
|
|
41074
|
-
isDlsym ? callerAlias : isDlerror ? dlerrorAlias : module2 === "env" && name3 !== "dlsym" && name3 !== "dlerror" ? binding(name3) ?? name3 : name3
|
|
41075
|
-
);
|
|
41176
|
+
importWriter.string(rewrittenName);
|
|
41076
41177
|
importWriter.byte(kind);
|
|
41077
41178
|
importWriter.bytes(bytes, typeStart, offset);
|
|
41179
|
+
if (collectRewrittenSymbols) {
|
|
41180
|
+
if (kind === 0)
|
|
41181
|
+
functionImportNames[functionImportNames.length - 1] = rewrittenName;
|
|
41182
|
+
else if (kind === 1) tableImportNames.push(rewrittenName);
|
|
41183
|
+
else if (kind === 3) globalImportNames.push(rewrittenName);
|
|
41184
|
+
else if (kind === 4) eventImportNames.push(rewrittenName);
|
|
41185
|
+
}
|
|
41078
41186
|
}
|
|
41079
41187
|
}
|
|
41080
41188
|
if (offset !== end) throw new Error("invalid wasm import section");
|
|
@@ -41157,13 +41265,17 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
|
|
|
41157
41265
|
if (!rewrite && flags & 16 && symbolKind === 1 && alias)
|
|
41158
41266
|
usedSymbols.add(name3);
|
|
41159
41267
|
if (entryWriter && binding) {
|
|
41268
|
+
let rewrittenSym = name3;
|
|
41269
|
+
let addedCanonical;
|
|
41160
41270
|
if ((name3 === "dlsym" && usesDlsym || name3 === "dlerror" && usesDlerror) && flags & 16 && flags & 64 && symbolKind === 0) {
|
|
41271
|
+
rewrittenSym = name3 === "dlsym" ? callerAlias : dlerrorAlias;
|
|
41161
41272
|
entryWriter.bytes(bytes, begin, nameStart);
|
|
41162
|
-
entryWriter.string(
|
|
41273
|
+
entryWriter.string(rewrittenSym);
|
|
41163
41274
|
entryWriter.bytes(bytes, nameEnd, offset);
|
|
41164
41275
|
} else if (flags & 16 && name3 !== "dlsym" && name3 !== "dlerror" && binding(name3) !== void 0) {
|
|
41276
|
+
rewrittenSym = binding(name3);
|
|
41165
41277
|
entryWriter.bytes(bytes, begin, nameStart);
|
|
41166
|
-
entryWriter.string(
|
|
41278
|
+
entryWriter.string(rewrittenSym);
|
|
41167
41279
|
entryWriter.bytes(bytes, nameEnd, offset);
|
|
41168
41280
|
} else if (alias && !(flags & 16) && (flags & 3) !== 2) {
|
|
41169
41281
|
if (symbolKind !== 0 && symbolKind !== 1)
|
|
@@ -41177,7 +41289,9 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
|
|
|
41177
41289
|
extraWriter.string(alias);
|
|
41178
41290
|
extraWriter.bytes(bytes, nameEnd, offset);
|
|
41179
41291
|
added++;
|
|
41292
|
+
addedCanonical = alias;
|
|
41180
41293
|
} else {
|
|
41294
|
+
rewrittenSym = alias;
|
|
41181
41295
|
entryWriter.bytes(bytes, begin, nameStart);
|
|
41182
41296
|
entryWriter.string(alias);
|
|
41183
41297
|
entryWriter.bytes(bytes, nameEnd, offset);
|
|
@@ -41185,6 +41299,16 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
|
|
|
41185
41299
|
} else {
|
|
41186
41300
|
entryWriter.bytes(bytes, begin, offset);
|
|
41187
41301
|
}
|
|
41302
|
+
if (collectRewrittenSymbols) {
|
|
41303
|
+
if (flags & 16) {
|
|
41304
|
+
const resolved = flags & 64 || symbolKind === 1 ? rewrittenSym : symbolKind === 0 ? functionImportNames[index] ?? "" : symbolKind === 2 ? globalImportNames[index] ?? "" : symbolKind === 4 ? eventImportNames[index] ?? "" : symbolKind === 5 ? tableImportNames[index] ?? "" : "";
|
|
41305
|
+
if (resolved) collectRewrittenSymbols.referenced.add(resolved);
|
|
41306
|
+
} else if ((flags & 3) !== 2) {
|
|
41307
|
+
if (rewrittenSym) collectRewrittenSymbols.defined.add(rewrittenSym);
|
|
41308
|
+
if (addedCanonical)
|
|
41309
|
+
collectRewrittenSymbols.defined.add(addedCanonical);
|
|
41310
|
+
}
|
|
41311
|
+
}
|
|
41188
41312
|
} else if (alias && !(flags & 16) && (flags & 3) !== 2) {
|
|
41189
41313
|
if (symbolKind !== 0 && symbolKind !== 1)
|
|
41190
41314
|
throw new Error(`unsupported symbol ${name3}`);
|
|
@@ -41548,6 +41672,7 @@ function createGuestImageLedger(input) {
|
|
|
41548
41672
|
sdkGlobalBindings.set(name3, first.alias);
|
|
41549
41673
|
}
|
|
41550
41674
|
}
|
|
41675
|
+
const appSymbols = input.registerAppTables ? { referenced: /* @__PURE__ */ new Set(), defined: /* @__PURE__ */ new Set() } : void 0;
|
|
41551
41676
|
const objects = units.map(({ image, object: object9, aliases, functionImports }) => {
|
|
41552
41677
|
const shared = sharedLookupByImage.get(image);
|
|
41553
41678
|
const own2 = startup.get(object9.path);
|
|
@@ -41582,7 +41707,10 @@ function createGuestImageLedger(input) {
|
|
|
41582
41707
|
binding,
|
|
41583
41708
|
object9.instrumentDynamicLookups,
|
|
41584
41709
|
preserveCanonical,
|
|
41585
|
-
{
|
|
41710
|
+
{
|
|
41711
|
+
sdkProduct: object9.sdkProduct,
|
|
41712
|
+
collectRewrittenSymbols: object9.sdkProduct === void 0 ? appSymbols : void 0
|
|
41713
|
+
}
|
|
41586
41714
|
).bytes
|
|
41587
41715
|
};
|
|
41588
41716
|
});
|
|
@@ -41703,7 +41831,9 @@ function createGuestImageLedger(input) {
|
|
|
41703
41831
|
llvmIR: render2(false, lazy),
|
|
41704
41832
|
lazyFunctions: lazy,
|
|
41705
41833
|
appLLVMIR: appLazy && render2(true, appLazy),
|
|
41706
|
-
appLazyFunctions: appLazy
|
|
41834
|
+
appLazyFunctions: appLazy,
|
|
41835
|
+
appReferencedSymbols: appSymbols?.referenced,
|
|
41836
|
+
appDefinedSymbols: appSymbols?.defined
|
|
41707
41837
|
};
|
|
41708
41838
|
}
|
|
41709
41839
|
function guestLazyFunctionRuntime(count) {
|
|
@@ -42597,6 +42727,26 @@ function selectedGuestManifestInputs(plan, selection, identities, readSelected)
|
|
|
42597
42727
|
}
|
|
42598
42728
|
return images;
|
|
42599
42729
|
}
|
|
42730
|
+
function framedLinkOptions(options2) {
|
|
42731
|
+
const cached4 = framedLinkOptionsCache.get(options2);
|
|
42732
|
+
if (cached4) return cached4;
|
|
42733
|
+
const parts2 = new Array(options2.length * 2 + 2);
|
|
42734
|
+
const count = Buffer.from(String(options2.length), "utf8");
|
|
42735
|
+
const countSize = Buffer.allocUnsafe(8);
|
|
42736
|
+
countSize.writeBigUInt64BE(BigInt(count.byteLength));
|
|
42737
|
+
parts2[0] = countSize;
|
|
42738
|
+
parts2[1] = count;
|
|
42739
|
+
for (let i = 0; i < options2.length; i++) {
|
|
42740
|
+
const encoded = Buffer.from(options2[i], "utf8");
|
|
42741
|
+
const size2 = Buffer.allocUnsafe(8);
|
|
42742
|
+
size2.writeBigUInt64BE(BigInt(encoded.byteLength));
|
|
42743
|
+
parts2[i * 2 + 2] = size2;
|
|
42744
|
+
parts2[i * 2 + 3] = encoded;
|
|
42745
|
+
}
|
|
42746
|
+
const framed = Buffer.concat(parts2);
|
|
42747
|
+
framedLinkOptionsCache.set(options2, framed);
|
|
42748
|
+
return framed;
|
|
42749
|
+
}
|
|
42600
42750
|
function createGuestImageManifest(image) {
|
|
42601
42751
|
const target = {
|
|
42602
42752
|
triple: SWIFT_WASM_TRIPLE,
|
|
@@ -42606,10 +42756,10 @@ function createGuestImageManifest(image) {
|
|
|
42606
42756
|
cpuSubtype: 0
|
|
42607
42757
|
};
|
|
42608
42758
|
const digest3 = (0, import_node_crypto33.createHash)("sha256");
|
|
42759
|
+
const sizeBuf = Buffer.allocUnsafe(8);
|
|
42609
42760
|
const add = (bytes) => {
|
|
42610
|
-
|
|
42611
|
-
|
|
42612
|
-
digest3.update(size2);
|
|
42761
|
+
sizeBuf.writeBigUInt64BE(BigInt(bytes.byteLength));
|
|
42762
|
+
digest3.update(sizeBuf);
|
|
42613
42763
|
digest3.update(bytes);
|
|
42614
42764
|
};
|
|
42615
42765
|
const text7 = (value) => add(Buffer.from(value, "utf8"));
|
|
@@ -42626,8 +42776,7 @@ function createGuestImageManifest(image) {
|
|
|
42626
42776
|
`${version2.platform}:${version2.minimum.major}:${version2.minimum.minor}:${version2.minimum.patch}`
|
|
42627
42777
|
);
|
|
42628
42778
|
text7(`${version2.sdk.major}:${version2.sdk.minor}:${version2.sdk.patch}`);
|
|
42629
|
-
|
|
42630
|
-
for (const option of image.linkOptions) text7(option);
|
|
42779
|
+
digest3.update(framedLinkOptions(image.linkOptions));
|
|
42631
42780
|
text7(String(image.inputs.length));
|
|
42632
42781
|
for (const input of image.inputs) {
|
|
42633
42782
|
text7(input.identity);
|
|
@@ -42648,7 +42797,7 @@ function createGuestImageManifest(image) {
|
|
|
42648
42797
|
regions: image.regions
|
|
42649
42798
|
};
|
|
42650
42799
|
}
|
|
42651
|
-
var import_node_crypto33, import_node_fs58;
|
|
42800
|
+
var import_node_crypto33, import_node_fs58, framedLinkOptionsCache;
|
|
42652
42801
|
var init_swift_guest_manifest = __esm({
|
|
42653
42802
|
"src/swift-guest-manifest.ts"() {
|
|
42654
42803
|
"use strict";
|
|
@@ -42657,6 +42806,7 @@ var init_swift_guest_manifest = __esm({
|
|
|
42657
42806
|
init_swift_guest_link_plan();
|
|
42658
42807
|
init_swift_wasm_prune();
|
|
42659
42808
|
init_swiftTargetContract();
|
|
42809
|
+
framedLinkOptionsCache = /* @__PURE__ */ new WeakMap();
|
|
42660
42810
|
}
|
|
42661
42811
|
});
|
|
42662
42812
|
|
|
@@ -43959,7 +44109,7 @@ var init_wasm_optimize = __esm({
|
|
|
43959
44109
|
];
|
|
43960
44110
|
BINARYEN_VERSION = binaryen_lock_default.version;
|
|
43961
44111
|
runBinaryen = (0, import_node_util5.promisify)(import_node_child_process27.execFile);
|
|
43962
|
-
WASM_LOWER_IDENTITY = `binaryen ${BINARYEN_VERSION} narrow ${LOWERING.join(" ")} ${FEATURES.join(",")} shared-stack-check-v2 native-image-v1 table-reserve-v2 ${NATIVE_TABLE_ABI} unoptimized-names`;
|
|
44112
|
+
WASM_LOWER_IDENTITY = `binaryen ${BINARYEN_VERSION} fused-pipeline-v1 narrow ${LOWERING.join(" ")} ${FEATURES.join(",")} shared-stack-check-v2 native-image-v1 table-reserve-v2 ${NATIVE_TABLE_ABI} unoptimized-names`;
|
|
43963
44113
|
BINARYEN_RELEASES = new Map(Object.entries(binaryen_lock_default.platforms));
|
|
43964
44114
|
}
|
|
43965
44115
|
});
|
|
@@ -44404,6 +44554,7 @@ function linkGuestImages(options2) {
|
|
|
44404
44554
|
const ledgerObjects = new Map(ledger.objects.map((item) => [item.path, item]));
|
|
44405
44555
|
const appObjects = /* @__PURE__ */ new Map();
|
|
44406
44556
|
const sdkObjects = /* @__PURE__ */ new Map();
|
|
44557
|
+
const finalArchives = /* @__PURE__ */ new Map();
|
|
44407
44558
|
for (const [index, artifact] of plan.artifacts.entries()) {
|
|
44408
44559
|
const prefix = `${artifact.path}(`;
|
|
44409
44560
|
if (artifact.kind === "object") {
|
|
@@ -44425,7 +44576,10 @@ function linkGuestImages(options2) {
|
|
|
44425
44576
|
}
|
|
44426
44577
|
const members2 = archives.get(artifact.path);
|
|
44427
44578
|
if (!members2) continue;
|
|
44428
|
-
const
|
|
44579
|
+
const listing = (0, import_node_child_process28.execFileSync)(llvmAr, ["t", artifact.path], {
|
|
44580
|
+
encoding: "utf8"
|
|
44581
|
+
}).trimEnd();
|
|
44582
|
+
const listed = listing ? listing.split("\n") : [];
|
|
44429
44583
|
if (listed.length !== members2.length || new Set(listed).size !== listed.length || members2.some(
|
|
44430
44584
|
(member, i) => listed[i] !== member.name || import_node_path61.default.basename(member.name) !== member.name
|
|
44431
44585
|
))
|
|
@@ -44454,6 +44608,10 @@ function linkGuestImages(options2) {
|
|
|
44454
44608
|
const response = import_node_path61.default.join(memberDir, "members.rsp");
|
|
44455
44609
|
import_node_fs61.default.writeFileSync(response, inputs2.map((input) => JSON.stringify(input)).join(" "));
|
|
44456
44610
|
(0, import_node_child_process28.execFileSync)(llvmAr, ["rcs", output, `@${response}`], { stdio: "pipe" });
|
|
44611
|
+
finalArchives.set(
|
|
44612
|
+
output,
|
|
44613
|
+
members2.map((member) => ({ name: member.name, bytes: new Uint8Array(0) }))
|
|
44614
|
+
);
|
|
44457
44615
|
replacements.set(artifact.path, output);
|
|
44458
44616
|
}
|
|
44459
44617
|
const compileLedger = (name3, source) => {
|
|
@@ -44585,7 +44743,8 @@ function linkGuestImages(options2) {
|
|
|
44585
44743
|
remapGuestLinkPlan(plan, replacements),
|
|
44586
44744
|
finalArgs,
|
|
44587
44745
|
import_node_fs61.default.readFileSync(finalWhy, "utf8"),
|
|
44588
|
-
finalTrace
|
|
44746
|
+
finalTrace,
|
|
44747
|
+
finalArchives
|
|
44589
44748
|
);
|
|
44590
44749
|
const original = new Map([...replacements].map(([before2, after2]) => [after2, before2]));
|
|
44591
44750
|
const key2 = (item) => JSON.stringify([original.get(item.artifact) ?? item.artifact, item.member]);
|
|
@@ -44618,12 +44777,25 @@ ${changed2.join("\n")}`
|
|
|
44618
44777
|
])
|
|
44619
44778
|
);
|
|
44620
44779
|
appObjects.set(appLedgerObject, options2.ledgerDataImage);
|
|
44780
|
+
let appReferencedSymbols;
|
|
44781
|
+
let appDefinedSymbols;
|
|
44782
|
+
if (ledger.appReferencedSymbols && ledger.appDefinedSymbols) {
|
|
44783
|
+
const referenced = new Set(ledger.appReferencedSymbols);
|
|
44784
|
+
const defined = new Set(ledger.appDefinedSymbols);
|
|
44785
|
+
const ledgerSyms = guestWasmSymbols(import_node_fs61.default.readFileSync(appLedgerObject));
|
|
44786
|
+
for (const name3 of ledgerSyms.undefined) referenced.add(name3);
|
|
44787
|
+
for (const name3 of ledgerSyms.defined) defined.add(name3);
|
|
44788
|
+
appReferencedSymbols = referenced;
|
|
44789
|
+
appDefinedSymbols = defined;
|
|
44790
|
+
}
|
|
44621
44791
|
options2.onSplitInputs({
|
|
44622
44792
|
appObjects,
|
|
44623
44793
|
appSections,
|
|
44624
44794
|
sdkObjects,
|
|
44625
44795
|
lazyFunctions: ledger.appLazyFunctions ?? [],
|
|
44626
|
-
dyldSymbols: ledger.dyldSymbols
|
|
44796
|
+
dyldSymbols: ledger.dyldSymbols,
|
|
44797
|
+
appReferencedSymbols,
|
|
44798
|
+
appDefinedSymbols
|
|
44627
44799
|
});
|
|
44628
44800
|
}
|
|
44629
44801
|
return selected;
|
|
@@ -45606,6 +45778,93 @@ function sourceGuestInputIdentities(graph, buildDirectory, objects) {
|
|
|
45606
45778
|
}
|
|
45607
45779
|
return identities;
|
|
45608
45780
|
}
|
|
45781
|
+
function wasmAutolinkEntries(bytes, out) {
|
|
45782
|
+
if (bytes.length < 8) return false;
|
|
45783
|
+
if (bytes[0] === 33 && bytes[1] === 60 && bytes[2] === 97 && bytes[3] === 114 && bytes[4] === 99 && bytes[5] === 104 && bytes[6] === 62 && bytes[7] === 10) {
|
|
45784
|
+
for (const member of readArMembers(bytes)) {
|
|
45785
|
+
if (!wasmAutolinkEntries(member.bytes, out)) return false;
|
|
45786
|
+
}
|
|
45787
|
+
return true;
|
|
45788
|
+
}
|
|
45789
|
+
if (bytes[0] !== 0 || bytes[1] !== 97 || bytes[2] !== 115 || bytes[3] !== 109)
|
|
45790
|
+
return false;
|
|
45791
|
+
const raw2 = Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
45792
|
+
let pos = 8;
|
|
45793
|
+
const len = bytes.length;
|
|
45794
|
+
while (pos < len) {
|
|
45795
|
+
const id = bytes[pos++];
|
|
45796
|
+
let sz = bytes[pos++];
|
|
45797
|
+
if (sz >= 128) {
|
|
45798
|
+
sz &= 127;
|
|
45799
|
+
let shift = 7;
|
|
45800
|
+
while (true) {
|
|
45801
|
+
const b = bytes[pos++];
|
|
45802
|
+
sz |= (b & 127) << shift;
|
|
45803
|
+
if (b < 128) break;
|
|
45804
|
+
shift += 7;
|
|
45805
|
+
}
|
|
45806
|
+
}
|
|
45807
|
+
const end = pos + sz;
|
|
45808
|
+
if (id === 0) {
|
|
45809
|
+
let nLen = bytes[pos++];
|
|
45810
|
+
if (nLen >= 128) {
|
|
45811
|
+
nLen &= 127;
|
|
45812
|
+
let shift = 7;
|
|
45813
|
+
while (true) {
|
|
45814
|
+
const b = bytes[pos++];
|
|
45815
|
+
nLen |= (b & 127) << shift;
|
|
45816
|
+
if (b < 128) break;
|
|
45817
|
+
shift += 7;
|
|
45818
|
+
}
|
|
45819
|
+
}
|
|
45820
|
+
if (nLen === 24 && raw2.toString("ascii", pos, pos + 24) === ".swift1_autolink_entries") {
|
|
45821
|
+
const payload = raw2.toString("utf8", pos + 24, end);
|
|
45822
|
+
for (const entry of payload.split("\0")) {
|
|
45823
|
+
const trimmed = entry.trim();
|
|
45824
|
+
if (trimmed.length > 0) out.push(trimmed);
|
|
45825
|
+
}
|
|
45826
|
+
}
|
|
45827
|
+
}
|
|
45828
|
+
pos = end;
|
|
45829
|
+
}
|
|
45830
|
+
return true;
|
|
45831
|
+
}
|
|
45832
|
+
function readAutolinkFlags(objects, toolchainBin, responsePath) {
|
|
45833
|
+
if (!objects.length) return [];
|
|
45834
|
+
const rawFlags = [];
|
|
45835
|
+
for (const file of objects) {
|
|
45836
|
+
if (!wasmAutolinkEntries((0, import_node_fs62.readFileSync)(file), rawFlags)) {
|
|
45837
|
+
(0, import_node_fs62.writeFileSync)(
|
|
45838
|
+
responsePath,
|
|
45839
|
+
objects.map((entry) => JSON.stringify(entry)).join("\n") + "\n"
|
|
45840
|
+
);
|
|
45841
|
+
return (0, import_node_child_process29.execFileSync)(
|
|
45842
|
+
import_node_path62.default.join(toolchainBin, "swift-autolink-extract"),
|
|
45843
|
+
[`@${responsePath}`, "-o", "-"],
|
|
45844
|
+
{ encoding: "utf8" }
|
|
45845
|
+
).split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
|
|
45846
|
+
}
|
|
45847
|
+
}
|
|
45848
|
+
const seen = /* @__PURE__ */ new Set();
|
|
45849
|
+
const flags = [];
|
|
45850
|
+
for (let i = 0; i < rawFlags.length; i++) {
|
|
45851
|
+
const flag = rawFlags[i];
|
|
45852
|
+
if ((flag === "-framework" || flag === "-weak_framework" || flag === "-l" || flag === "--library") && i + 1 < rawFlags.length) {
|
|
45853
|
+
const value = rawFlags[++i];
|
|
45854
|
+
const key2 = `${flag}\0${value}`;
|
|
45855
|
+
if (!seen.has(key2)) {
|
|
45856
|
+
seen.add(key2);
|
|
45857
|
+
flags.push(flag, value);
|
|
45858
|
+
}
|
|
45859
|
+
continue;
|
|
45860
|
+
}
|
|
45861
|
+
if (!seen.has(flag)) {
|
|
45862
|
+
seen.add(flag);
|
|
45863
|
+
flags.push(flag);
|
|
45864
|
+
}
|
|
45865
|
+
}
|
|
45866
|
+
return flags;
|
|
45867
|
+
}
|
|
45609
45868
|
function sourceGuestRuntimeLinks(options2) {
|
|
45610
45869
|
const aliases = /* @__PURE__ */ new Map();
|
|
45611
45870
|
const artifacts = /* @__PURE__ */ new Map();
|
|
@@ -45693,15 +45952,7 @@ function sourceGuestRuntimeLinks(options2) {
|
|
|
45693
45952
|
for (const image of options2.images) {
|
|
45694
45953
|
if (result.has(image.id)) throw new Error(`duplicate source image ${image.id}`);
|
|
45695
45954
|
const response = import_node_path62.default.join(options2.directory, `image-${image.id}-autolink.rsp`);
|
|
45696
|
-
(
|
|
45697
|
-
response,
|
|
45698
|
-
image.objects.map((file) => JSON.stringify(file)).join("\n") + "\n"
|
|
45699
|
-
);
|
|
45700
|
-
const autolink = image.objects.length ? (0, import_node_child_process29.execFileSync)(
|
|
45701
|
-
import_node_path62.default.join(options2.toolchainBin, "swift-autolink-extract"),
|
|
45702
|
-
[`@${response}`, "-o", "-"],
|
|
45703
|
-
{ encoding: "utf8" }
|
|
45704
|
-
).split("\n").map((line) => line.trim()).filter((line) => line.length > 0) : [];
|
|
45955
|
+
const autolink = readAutolinkFlags(image.objects, options2.toolchainBin, response);
|
|
45705
45956
|
const links = [];
|
|
45706
45957
|
const requests = [];
|
|
45707
45958
|
const optionGroups = [
|
|
@@ -45801,6 +46052,7 @@ var init_swift_guest_source_inputs = __esm({
|
|
|
45801
46052
|
init_forked_script_contract();
|
|
45802
46053
|
init_swift_guest_source_plan();
|
|
45803
46054
|
init_swift_runtime_products();
|
|
46055
|
+
init_swift_wasm_prune();
|
|
45804
46056
|
CLANG_TARGET_MODULE_WRAPPER = ".peach-clang";
|
|
45805
46057
|
PARALLEL_REPLAY = `
|
|
45806
46058
|
const { spawn } = require('node:child_process')
|
|
@@ -48902,24 +49154,26 @@ function setBoundedCache(cache, key2, value) {
|
|
|
48902
49154
|
return value;
|
|
48903
49155
|
}
|
|
48904
49156
|
function cached3(directory2, key2) {
|
|
48905
|
-
const sdkInterfacePath = import_node_path70.default.join(directory2, INTERFACE_FILE);
|
|
48906
|
-
const image = import_node_path70.default.join(directory2, IMAGE_FILE);
|
|
48907
49157
|
const address = import_node_path70.default.join(directory2, IMAGE_DIGEST);
|
|
48908
|
-
if (!(0, import_node_fs70.existsSync)(
|
|
49158
|
+
if (!(0, import_node_fs70.existsSync)(import_node_path70.default.join(directory2, IMAGE_FILE)) || !(0, import_node_fs70.existsSync)(address) || !(0, import_node_fs70.existsSync)(import_node_path70.default.join(directory2, INTERFACE_FILE)) || !(0, import_node_fs70.existsSync)(import_node_path70.default.join(directory2, MANIFEST_FILE)) || !(0, import_node_fs70.existsSync)(import_node_path70.default.join(directory2, MANIFEST_DATA_FILE)))
|
|
48909
49159
|
return void 0;
|
|
48910
|
-
|
|
49160
|
+
return sdkImageAt(directory2, key2, (0, import_node_fs70.readFileSync)(address, "utf8"));
|
|
49161
|
+
}
|
|
49162
|
+
function sdkImageAt(directory2, key2, sha2565) {
|
|
48911
49163
|
const cacheKey = `${directory2}\0${sha2565}`;
|
|
48912
49164
|
let loadedInterface;
|
|
48913
49165
|
return {
|
|
48914
49166
|
key: key2,
|
|
48915
49167
|
directory: directory2,
|
|
48916
|
-
image,
|
|
49168
|
+
image: import_node_path70.default.join(directory2, IMAGE_FILE),
|
|
48917
49169
|
sha256: sha2565,
|
|
48918
49170
|
get sdkInterface() {
|
|
48919
49171
|
if (loadedInterface) return loadedInterface;
|
|
48920
49172
|
const memo2 = cachedSdkInterfaces.get(cacheKey);
|
|
48921
49173
|
if (memo2) return loadedInterface = memo2;
|
|
48922
|
-
const parsed2 = JSON.parse(
|
|
49174
|
+
const parsed2 = JSON.parse(
|
|
49175
|
+
(0, import_node_fs70.readFileSync)(import_node_path70.default.join(directory2, INTERFACE_FILE), "utf8")
|
|
49176
|
+
);
|
|
48923
49177
|
return loadedInterface = setBoundedCache(cachedSdkInterfaces, cacheKey, parsed2);
|
|
48924
49178
|
}
|
|
48925
49179
|
};
|
|
@@ -48972,7 +49226,7 @@ async function buildSwiftSdkImage(moduleRoot, scopedLookups = false, frameworkIm
|
|
|
48972
49226
|
throw new Error(`invalid published Swift SDK image ${key2}`);
|
|
48973
49227
|
(0, import_node_fs70.rmSync)(directory2, { recursive: true, force: true });
|
|
48974
49228
|
(0, import_node_fs70.renameSync)(stage, directory2);
|
|
48975
|
-
return
|
|
49229
|
+
return sdkImageAt(directory2, key2, image.sha256);
|
|
48976
49230
|
} finally {
|
|
48977
49231
|
(0, import_node_fs70.rmSync)(stage, { recursive: true, force: true });
|
|
48978
49232
|
}
|
|
@@ -49325,9 +49579,10 @@ function sdkHostExports(appRoot) {
|
|
|
49325
49579
|
if (!(byte & 128)) return value;
|
|
49326
49580
|
}
|
|
49327
49581
|
};
|
|
49582
|
+
const raw2 = Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
49328
49583
|
for (let n = u(); n > 0; n--) {
|
|
49329
49584
|
const length = u();
|
|
49330
|
-
names.push(
|
|
49585
|
+
names.push(raw2.toString("utf8", at, at + length));
|
|
49331
49586
|
at += length + 1;
|
|
49332
49587
|
u();
|
|
49333
49588
|
}
|
|
@@ -49871,56 +50126,109 @@ function swiftAppModuleInputs(tokens2, buildRoot, sdkLibraries) {
|
|
|
49871
50126
|
}
|
|
49872
50127
|
return inputs2;
|
|
49873
50128
|
}
|
|
49874
|
-
|
|
50129
|
+
function llvmQuoted(value) {
|
|
50130
|
+
const bytes = Buffer.from(value, "utf8");
|
|
50131
|
+
let out = '"';
|
|
50132
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
50133
|
+
const b = bytes[i];
|
|
50134
|
+
if (b >= 32 && b <= 126 && b !== 34 && b !== 92) out += String.fromCharCode(b);
|
|
50135
|
+
else out += `\\${b.toString(16).toUpperCase().padStart(2, "0")}`;
|
|
50136
|
+
}
|
|
50137
|
+
return out + '"';
|
|
50138
|
+
}
|
|
50139
|
+
async function compileSdkForwarders(inputs2, sdk2, toolchainBin, output, project2, readInput, precomputedSymbols) {
|
|
49875
50140
|
const { signatures, tls } = sdk2.sdkInterface;
|
|
49876
|
-
|
|
49877
|
-
|
|
49878
|
-
|
|
49879
|
-
|
|
49880
|
-
|
|
49881
|
-
|
|
49882
|
-
|
|
50141
|
+
let referenced;
|
|
50142
|
+
let defined;
|
|
50143
|
+
if (precomputedSymbols) {
|
|
50144
|
+
referenced = precomputedSymbols.referenced;
|
|
50145
|
+
defined = precomputedSymbols.defined;
|
|
50146
|
+
} else {
|
|
50147
|
+
const directories = inputs2.filter((input) => input.startsWith("-L")).map((input) => input.slice(2));
|
|
50148
|
+
const refSet = /* @__PURE__ */ new Set();
|
|
50149
|
+
const defSet = /* @__PURE__ */ new Set();
|
|
50150
|
+
const scan3 = (bytes) => {
|
|
50151
|
+
const symbols = guestWasmSymbols(bytes);
|
|
50152
|
+
for (const name3 of symbols.undefined) refSet.add(name3);
|
|
50153
|
+
for (const name3 of symbols.defined) defSet.add(name3);
|
|
50154
|
+
};
|
|
50155
|
+
for (const input of inputs2) {
|
|
50156
|
+
const file = input.startsWith("-l") ? directories.map((directory2) => import_node_path71.default.join(directory2, `lib${input.slice(2)}.a`)).find((candidate) => (0, import_node_fs71.existsSync)(candidate)) : input.startsWith("-") ? void 0 : input;
|
|
50157
|
+
if (!file) continue;
|
|
50158
|
+
const bytes = readInput(file);
|
|
50159
|
+
if (file.endsWith(".a"))
|
|
50160
|
+
for (const member of readArMembers(bytes)) scan3(member.bytes);
|
|
50161
|
+
else scan3(bytes);
|
|
50162
|
+
}
|
|
50163
|
+
referenced = refSet;
|
|
50164
|
+
defined = defSet;
|
|
50165
|
+
}
|
|
50166
|
+
const irType = {
|
|
50167
|
+
i: "i32",
|
|
50168
|
+
j: "i64",
|
|
50169
|
+
f: "float",
|
|
50170
|
+
d: "double"
|
|
50171
|
+
};
|
|
50172
|
+
const type = (kinds) => {
|
|
50173
|
+
const out = new Array(kinds.length);
|
|
50174
|
+
for (let i = 0; i < kinds.length; i++) {
|
|
50175
|
+
const kind = kinds[i];
|
|
50176
|
+
const name3 = irType[kind];
|
|
50177
|
+
if (!name3) throw new Error(`sdk signature kind ${kind}`);
|
|
50178
|
+
out[i] = name3;
|
|
50179
|
+
}
|
|
50180
|
+
return out;
|
|
49883
50181
|
};
|
|
49884
|
-
|
|
49885
|
-
|
|
49886
|
-
|
|
49887
|
-
const
|
|
49888
|
-
|
|
49889
|
-
|
|
49890
|
-
|
|
49891
|
-
|
|
49892
|
-
|
|
49893
|
-
|
|
49894
|
-
|
|
49895
|
-
return name3;
|
|
49896
|
-
});
|
|
49897
|
-
const literal4 = (name3) => JSON.stringify(name3);
|
|
49898
|
-
const lines = [];
|
|
49899
|
-
if (signatures.__objc_send_load_messages === ":")
|
|
50182
|
+
const lines = [`target triple = "${SWIFT_WASM_TRIPLE}"`];
|
|
50183
|
+
const attrs = [];
|
|
50184
|
+
const addImportAttr = (name3) => {
|
|
50185
|
+
const id = attrs.length;
|
|
50186
|
+
attrs.push(
|
|
50187
|
+
`attributes #${id} = { "wasm-import-module"="env" "wasm-import-name"=${llvmQuoted(name3)} }`
|
|
50188
|
+
);
|
|
50189
|
+
return id;
|
|
50190
|
+
};
|
|
50191
|
+
if (signatures.__objc_send_load_messages === ":") {
|
|
50192
|
+
const attr = addImportAttr("__objc_send_load_messages");
|
|
49900
50193
|
lines.push(
|
|
49901
|
-
|
|
49902
|
-
|
|
50194
|
+
"@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @send_app_load_messages, ptr null }]",
|
|
50195
|
+
`declare void @sdk_send_load_messages() #${attr}`,
|
|
50196
|
+
"define internal void @send_app_load_messages() {",
|
|
50197
|
+
" tail call void @sdk_send_load_messages()",
|
|
50198
|
+
" ret void",
|
|
50199
|
+
"}"
|
|
49903
50200
|
);
|
|
50201
|
+
}
|
|
49904
50202
|
const forwarders = /* @__PURE__ */ new Set();
|
|
49905
50203
|
let index = 0;
|
|
49906
50204
|
for (const name3 of referenced) {
|
|
49907
50205
|
const signature2 = signatures[name3];
|
|
49908
50206
|
if (signature2 === void 0 || defined.has(name3)) continue;
|
|
49909
|
-
const
|
|
50207
|
+
const colon = signature2.indexOf(":");
|
|
50208
|
+
const params = colon < 0 ? signature2 : signature2.slice(0, colon);
|
|
50209
|
+
const results = colon < 0 ? "" : signature2.slice(colon + 1);
|
|
49910
50210
|
if (results.length > 1) throw new Error(`sdk function ${name3} returns several values`);
|
|
49911
50211
|
const result = results ? type(results)[0] : "void";
|
|
49912
|
-
const
|
|
49913
|
-
const
|
|
50212
|
+
const paramTypes = type(params);
|
|
50213
|
+
const declParams = paramTypes.join(", ");
|
|
50214
|
+
const defParams = paramTypes.map((kind, at) => `${kind} %a${at}`).join(", ");
|
|
50215
|
+
const callArgs = paramTypes.map((kind, at) => `${kind} %a${at}`).join(", ");
|
|
50216
|
+
const attr = addImportAttr(name3);
|
|
50217
|
+
const quoted2 = llvmQuoted(name3);
|
|
49914
50218
|
lines.push(
|
|
49915
|
-
`
|
|
49916
|
-
`
|
|
49917
|
-
|
|
50219
|
+
`declare ${result} @i${index}(${declParams}) #${attr}`,
|
|
50220
|
+
`define weak hidden ${result} @${quoted2}(${defParams}) {`,
|
|
50221
|
+
result === "void" ? ` tail call void @i${index}(${callArgs})
|
|
50222
|
+
ret void` : ` %r = tail call ${result} @i${index}(${callArgs})
|
|
50223
|
+
ret ${result} %r`,
|
|
50224
|
+
"}"
|
|
49918
50225
|
);
|
|
49919
50226
|
forwarders.add(name3);
|
|
49920
50227
|
index++;
|
|
49921
50228
|
}
|
|
49922
50229
|
const errno = tls.errno;
|
|
49923
50230
|
let declaredErrno = false;
|
|
50231
|
+
const usedHelpers = [];
|
|
49924
50232
|
for (const name3 of referenced) {
|
|
49925
50233
|
const offset = tls[name3];
|
|
49926
50234
|
if (offset === void 0 || defined.has(name3)) continue;
|
|
@@ -49928,28 +50236,44 @@ async function compileSdkForwarders(inputs2, sdk2, toolchainBin, output, project
|
|
|
49928
50236
|
throw new Error("the sdk image has no errno to find its thread block by");
|
|
49929
50237
|
if (!declaredErrno) {
|
|
49930
50238
|
declaredErrno = true;
|
|
50239
|
+
const attr = addImportAttr("__errno_location");
|
|
49931
50240
|
lines.push(
|
|
49932
|
-
`
|
|
50241
|
+
`declare ptr @__peach_errno() #${attr}`,
|
|
50242
|
+
"declare ptr @llvm.wasm.tls.base()"
|
|
49933
50243
|
);
|
|
49934
50244
|
}
|
|
50245
|
+
const helper = `@${llvmQuoted(SDK_TLS_HELPER + name3)}`;
|
|
50246
|
+
const delta = `@${llvmQuoted(SDK_TLS_DELTA + name3)}`;
|
|
50247
|
+
usedHelpers.push(`ptr ${helper}`);
|
|
49935
50248
|
lines.push(
|
|
49936
|
-
|
|
49937
|
-
|
|
49938
|
-
`
|
|
49939
|
-
|
|
50249
|
+
`@${llvmQuoted(name3)} = weak hidden thread_local global i8 0, align 1`,
|
|
50250
|
+
`${delta} = external global i8, align 1`,
|
|
50251
|
+
`define hidden i64 ${helper}() {`,
|
|
50252
|
+
" %e = tail call ptr @__peach_errno()",
|
|
50253
|
+
" %ei = ptrtoint ptr %e to i64",
|
|
50254
|
+
` %di = ptrtoint ptr ${delta} to i64`,
|
|
50255
|
+
" %s = add i64 %ei, %di",
|
|
50256
|
+
" %b = tail call ptr @llvm.wasm.tls.base()",
|
|
50257
|
+
" %bi = ptrtoint ptr %b to i64",
|
|
50258
|
+
" %r = sub i64 %s, %bi",
|
|
50259
|
+
" ret i64 %r",
|
|
50260
|
+
"}"
|
|
49940
50261
|
);
|
|
49941
50262
|
index++;
|
|
49942
50263
|
}
|
|
49943
|
-
|
|
49944
|
-
|
|
50264
|
+
if (usedHelpers.length > 0) {
|
|
50265
|
+
lines.push(
|
|
50266
|
+
`@llvm.used = appending global [${usedHelpers.length} x ptr] [${usedHelpers.join(", ")}], section "llvm.metadata"`
|
|
50267
|
+
);
|
|
50268
|
+
}
|
|
50269
|
+
const source = `${output.slice(0, -2)}.ll`;
|
|
50270
|
+
(0, import_node_fs71.writeFileSync)(source, [...lines, ...attrs].join("\n") + "\n");
|
|
49945
50271
|
await run5(
|
|
49946
50272
|
import_node_path71.default.join(toolchainBin, "clang"),
|
|
49947
50273
|
[
|
|
49948
50274
|
`--target=${SWIFT_WASM_TRIPLE}`,
|
|
49949
|
-
"-O2",
|
|
49950
50275
|
"-matomics",
|
|
49951
50276
|
"-mbulk-memory",
|
|
49952
|
-
"-ffreestanding",
|
|
49953
50277
|
"-c",
|
|
49954
50278
|
source,
|
|
49955
50279
|
"-o",
|
|
@@ -49968,7 +50292,8 @@ async function linkSwiftAppModule(options2) {
|
|
|
49968
50292
|
toolchainBin,
|
|
49969
50293
|
forwarders,
|
|
49970
50294
|
options2.project,
|
|
49971
|
-
options2.readInput ?? import_node_fs71.readFileSync
|
|
50295
|
+
options2.readInput ?? import_node_fs71.readFileSync,
|
|
50296
|
+
options2.precomputedSymbols
|
|
49972
50297
|
);
|
|
49973
50298
|
const lazy = options2.lazyFunctions ?? [];
|
|
49974
50299
|
const lazyExports = import_node_path71.default.join(work, "lazy-exports.rsp");
|
|
@@ -51712,6 +52037,15 @@ async function compileGuestLink(options2) {
|
|
|
51712
52037
|
{ stdio: "pipe" }
|
|
51713
52038
|
);
|
|
51714
52039
|
}
|
|
52040
|
+
let precomputedSymbols;
|
|
52041
|
+
if (splitInputs.appReferencedSymbols && splitInputs.appDefinedSymbols) {
|
|
52042
|
+
const referenced = new Set(splitInputs.appReferencedSymbols);
|
|
52043
|
+
const defined = new Set(splitInputs.appDefinedSymbols);
|
|
52044
|
+
const projSyms = guestWasmSymbols((0, import_node_fs72.readFileSync)(projectionObject));
|
|
52045
|
+
for (const name3 of projSyms.undefined) referenced.add(name3);
|
|
52046
|
+
for (const name3 of projSyms.defined) defined.add(name3);
|
|
52047
|
+
precomputedSymbols = { referenced, defined };
|
|
52048
|
+
}
|
|
51715
52049
|
for (; ; ) {
|
|
51716
52050
|
const link = await linkSwiftAppModule2({
|
|
51717
52051
|
objects: [...owners.keys()],
|
|
@@ -51723,6 +52057,7 @@ async function compileGuestLink(options2) {
|
|
|
51723
52057
|
optimize: options2.optimize,
|
|
51724
52058
|
layoutMap,
|
|
51725
52059
|
project: project2,
|
|
52060
|
+
precomputedSymbols,
|
|
51726
52061
|
loweringCache: project2 ? void 0 : {
|
|
51727
52062
|
file: import_node_path72.default.join(
|
|
51728
52063
|
options2.buildDirectory,
|
|
@@ -51847,6 +52182,7 @@ var init_swift_guest_compile = __esm({
|
|
|
51847
52182
|
init_swift_runtime_products();
|
|
51848
52183
|
init_swift_sdk_guest_lookups();
|
|
51849
52184
|
init_swift_toolchain();
|
|
52185
|
+
init_swift_wasm_prune();
|
|
51850
52186
|
init_swiftTargetContract();
|
|
51851
52187
|
init_wasm_optimize();
|
|
51852
52188
|
}
|
|
@@ -53298,7 +53634,25 @@ function swiftBuildJobs() {
|
|
|
53298
53634
|
return Math.min(cores, memoryJobs);
|
|
53299
53635
|
}
|
|
53300
53636
|
function swiftCompilerJobs() {
|
|
53301
|
-
return Math.min(
|
|
53637
|
+
return Math.min(32, swiftBuildJobs(), Math.max(1, Math.floor(import_node_os16.default.totalmem() / 2 ** 31)));
|
|
53638
|
+
}
|
|
53639
|
+
function swiftCompilerBaseEnv(toolchainBin, sourceEnv, includePeachHome = false) {
|
|
53640
|
+
const env = {};
|
|
53641
|
+
for (const key2 of SWIFT_COMPILER_ENV_KEYS) {
|
|
53642
|
+
const value = sourceEnv[key2];
|
|
53643
|
+
if (value !== void 0) env[key2] = value;
|
|
53644
|
+
}
|
|
53645
|
+
if (includePeachHome && sourceEnv.PEACH_HOME !== void 0)
|
|
53646
|
+
env.PEACH_HOME = sourceEnv.PEACH_HOME;
|
|
53647
|
+
if (process.platform === "linux") {
|
|
53648
|
+
env.LD_LIBRARY_PATH = [
|
|
53649
|
+
import_node_path81.default.resolve(toolchainBin, "../lib/swift/linux"),
|
|
53650
|
+
import_node_path81.default.resolve(toolchainBin, "../lib/swift/host"),
|
|
53651
|
+
sourceEnv.LD_LIBRARY_PATH
|
|
53652
|
+
].filter(Boolean).join(":");
|
|
53653
|
+
}
|
|
53654
|
+
env.PEACH_DEFER_WASM_LINK = "1";
|
|
53655
|
+
return env;
|
|
53302
53656
|
}
|
|
53303
53657
|
function assertSwiftBuildCores() {
|
|
53304
53658
|
const admitted = windowAdmission()?.cores ?? Number(process.env.TM_EXEC_CPU_CORES);
|
|
@@ -54487,10 +54841,22 @@ function emitSwiftPackageManifest(args) {
|
|
|
54487
54841
|
const available2 = distribution.objects.filter(
|
|
54488
54842
|
(object9) => !isProvider(object9) && !replacedObjects.has(object9)
|
|
54489
54843
|
);
|
|
54844
|
+
const targetNamesWithDash = targets.filter((target) => target.name.includes("-")).map((target) => `lib/${target.name}-`);
|
|
54845
|
+
const targetNameSet = new Set(targets.map((target) => target.name));
|
|
54846
|
+
const optionalSet = /* @__PURE__ */ new Set([...OPTIONAL_FRAMEWORKS, ...GAME_FAMILY, "PeachBox2D"]);
|
|
54847
|
+
const isTargetObject = (object9) => {
|
|
54848
|
+
const dash = object9.indexOf("-", 4);
|
|
54849
|
+
if (dash > 4 && targetNameSet.has(object9.slice(4, dash))) return true;
|
|
54850
|
+
return targetNamesWithDash.some((prefix) => object9.startsWith(prefix));
|
|
54851
|
+
};
|
|
54852
|
+
const isUnreachedOptional = (object9) => {
|
|
54853
|
+
const dash = object9.indexOf("-", 4);
|
|
54854
|
+
if (dash <= 4) return false;
|
|
54855
|
+
const name3 = object9.slice(4, dash);
|
|
54856
|
+
return optionalSet.has(name3) && !reachedFrameworks.has(name3);
|
|
54857
|
+
};
|
|
54490
54858
|
const objects = available2.filter(
|
|
54491
|
-
(object9) => !
|
|
54492
|
-
(name3) => !object9.startsWith(`lib/${name3}-`) || reachedFrameworks.has(name3)
|
|
54493
|
-
)
|
|
54859
|
+
(object9) => !isTargetObject(object9) && !isUnreachedOptional(object9)
|
|
54494
54860
|
);
|
|
54495
54861
|
const quoted2 = (object9) => `"${import_node_path81.default.join(moduleRoot, object9).replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;
|
|
54496
54862
|
const categoryObjects = new Set(
|
|
@@ -54571,18 +54937,53 @@ function emitSwiftPackageManifest(args) {
|
|
|
54571
54937
|
args.files.set(file, content);
|
|
54572
54938
|
return JSON.stringify([`@${file}`]);
|
|
54573
54939
|
};
|
|
54574
|
-
const
|
|
54575
|
-
|
|
54576
|
-
|
|
54577
|
-
const owner = args.targets.find((other) => other.name === dependency);
|
|
54940
|
+
const targetByName = new Map(targets.map((target) => [target.name, target]));
|
|
54941
|
+
const ownFrameworkDir = /* @__PURE__ */ new Map();
|
|
54942
|
+
for (const target of targets) {
|
|
54578
54943
|
const framework = /^(.*)\/[^/]+\.framework\/Modules$/.exec(
|
|
54579
|
-
|
|
54944
|
+
target.publicHeadersPath ?? ""
|
|
54580
54945
|
);
|
|
54581
|
-
|
|
54582
|
-
|
|
54583
|
-
|
|
54584
|
-
|
|
54585
|
-
|
|
54946
|
+
if (framework)
|
|
54947
|
+
ownFrameworkDir.set(
|
|
54948
|
+
target.name,
|
|
54949
|
+
import_node_path81.default.posix.join(args.root, target.path, framework[1])
|
|
54950
|
+
);
|
|
54951
|
+
}
|
|
54952
|
+
const frameworkDirectoriesCache = /* @__PURE__ */ new Map();
|
|
54953
|
+
const frameworkDirectories = (name3) => {
|
|
54954
|
+
if (ownFrameworkDir.size === 0) return [];
|
|
54955
|
+
const cached4 = frameworkDirectoriesCache.get(name3);
|
|
54956
|
+
if (cached4) return cached4;
|
|
54957
|
+
const dirs = [];
|
|
54958
|
+
const seen = /* @__PURE__ */ new Set();
|
|
54959
|
+
const visit3 = (current2) => {
|
|
54960
|
+
for (const dependency of siblings.get(current2) ?? []) {
|
|
54961
|
+
if (seen.has(dependency)) continue;
|
|
54962
|
+
seen.add(dependency);
|
|
54963
|
+
const dir = ownFrameworkDir.get(dependency);
|
|
54964
|
+
if (dir) dirs.push(dir);
|
|
54965
|
+
visit3(dependency);
|
|
54966
|
+
}
|
|
54967
|
+
};
|
|
54968
|
+
visit3(name3);
|
|
54969
|
+
frameworkDirectoriesCache.set(name3, dirs);
|
|
54970
|
+
return dirs;
|
|
54971
|
+
};
|
|
54972
|
+
const targetSwiftXccFlags = /* @__PURE__ */ new Map();
|
|
54973
|
+
for (const target of targets) {
|
|
54974
|
+
const flags = target.swiftFlags;
|
|
54975
|
+
if (!flags || flags.length === 0) continue;
|
|
54976
|
+
const xcc = [];
|
|
54977
|
+
for (let index = 1; index < flags.length; index++) {
|
|
54978
|
+
if (flags[index - 1] === "-Xcc")
|
|
54979
|
+
xcc.push(flags[index].replaceAll(SWIFT_NATIVE_INPUT_ROOT, args.root));
|
|
54980
|
+
}
|
|
54981
|
+
if (xcc.length > 0) targetSwiftXccFlags.set(target.name, xcc);
|
|
54982
|
+
}
|
|
54983
|
+
const binaryImports = args.binaryModules ? `, "-I", ${JSON.stringify(args.binaryModules)}` : "";
|
|
54984
|
+
const sharedImports = binaryImports + (distributionModules ? `, "-Isystem", ${JSON.stringify(
|
|
54985
|
+
providedModulesPath(args.root, distributionModules, args.moduleExcludes)
|
|
54986
|
+
)}${distributionClangModuleOptions(args.root, distributionModules).map((flag) => `, ${JSON.stringify(flag)}`).join("")}` : prebuilt ? `, "-Isystem", ${JSON.stringify(providedModulesPath(args.root, prebuilt.modules, args.moduleExcludes))}${prebuilt.moduleMaps.map((map2) => `, "-Xcc", ${JSON.stringify(`-fmodule-map-file=${map2}`)}`).join("")}` : "");
|
|
54586
54987
|
const frameworkSearchFlags = (target, tool) => frameworkDirectories(target?.name ?? "").map((directory2) => ({
|
|
54587
54988
|
tool,
|
|
54588
54989
|
flags: ["-F", directory2]
|
|
@@ -54631,10 +55032,7 @@ function emitSwiftPackageManifest(args) {
|
|
|
54631
55032
|
const upstream = (target.swiftFlags ?? []).map(
|
|
54632
55033
|
(flag) => `, ${JSON.stringify(flag.replaceAll(SWIFT_NATIVE_INPUT_ROOT, args.root))}`
|
|
54633
55034
|
).join("");
|
|
54634
|
-
const
|
|
54635
|
-
const imports2 = binaryImports + (distributionModules ? `, "-Isystem", ${JSON.stringify(
|
|
54636
|
-
providedModulesPath(args.root, distributionModules, args.moduleExcludes)
|
|
54637
|
-
)}${distributionClangModuleOptions(args.root, distributionModules).map((flag) => `, ${JSON.stringify(flag)}`).join("")}` : prebuilt ? `, "-Isystem", ${JSON.stringify(providedModulesPath(args.root, prebuilt.modules, args.moduleExcludes))}${prebuilt.moduleMaps.map((map2) => `, "-Xcc", ${JSON.stringify(`-fmodule-map-file=${map2}`)}`).join("")}` : "");
|
|
55035
|
+
const imports2 = sharedImports;
|
|
54638
55036
|
const nativeFlags = [
|
|
54639
55037
|
...args.nativeFlags?.get(target.name) ?? [],
|
|
54640
55038
|
...args.nativeHeaderFlags ?? []
|
|
@@ -54658,12 +55056,7 @@ function emitSwiftPackageManifest(args) {
|
|
|
54658
55056
|
return map2 ? ["-fmodule-map-file=" + map2] : [];
|
|
54659
55057
|
}),
|
|
54660
55058
|
...[...importContext].flatMap((name3) => args.native?.get(name3)?.importFlags ?? []),
|
|
54661
|
-
...[...importContext].flatMap((name3) =>
|
|
54662
|
-
const flags = targets.find((target2) => target2.name === name3)?.swiftFlags ?? [];
|
|
54663
|
-
return flags.flatMap(
|
|
54664
|
-
(flag, index) => flags[index - 1] === "-Xcc" ? [flag.replaceAll(SWIFT_NATIVE_INPUT_ROOT, args.root)] : []
|
|
54665
|
-
);
|
|
54666
|
-
})
|
|
55059
|
+
...[...importContext].flatMap((name3) => targetSwiftXccFlags.get(name3) ?? [])
|
|
54667
55060
|
];
|
|
54668
55061
|
const nativeImportFlags = [
|
|
54669
55062
|
...frameworkDirectories(target.name).flatMap((directory2) => ["-F", directory2]),
|
|
@@ -54678,9 +55071,7 @@ function emitSwiftPackageManifest(args) {
|
|
|
54678
55071
|
...native?.swiftFlags ?? [],
|
|
54679
55072
|
...args.objcImplementationModules?.has(target.name) ? ["-enable-experimental-feature", "ObjCImplementation"] : []
|
|
54680
55073
|
].map((flag) => `, ${JSON.stringify(flag)}`).join("");
|
|
54681
|
-
const header = args.headerDirectory && (args.nativeHeaderDeclarations?.[target.name] ||
|
|
54682
|
-
(value) => value.late?.producers.includes(target.name)
|
|
54683
|
-
)) ? `, "-emit-objc-header-path", ${JSON.stringify(import_node_path81.default.join(args.headerDirectory, `${target.name}-Swift.original.h`))}` : "";
|
|
55074
|
+
const header = args.headerDirectory && (args.nativeHeaderDeclarations?.[target.name] || lateProducers.has(target.name)) ? `, "-emit-objc-header-path", ${JSON.stringify(import_node_path81.default.join(args.headerDirectory, `${target.name}-Swift.original.h`))}` : "";
|
|
54684
55075
|
const clangMode = target.cxxInterop ? "" : ', "-Xcc", "-fno-cxx-modules"';
|
|
54685
55076
|
const deployment = `, "-Xfrontend", "-peach-ios-deployment-target", "-Xfrontend", ${JSON.stringify(target.iosDeploymentTarget ?? SWIFTPM_DEFAULT_IOS_DEPLOYMENT_TARGET)}`;
|
|
54686
55077
|
const swiftSettings = `swiftSettings: [.swiftLanguageMode(.v${target.languageMode}),${isolation}${interoperability}${defines}${features}${upcoming} .unsafeFlags(${swiftFlagArray(`["-Osize", "-Xfrontend", "-enable-cross-import-overlays"${overlayFlags}${oneModule ? ONE_IMPLICIT_FLAGS : ""}${imports2}${nativeImportFlags}${objcFlags}${header}${clangMode}${deployment}${upstream}]`)})]`;
|
|
@@ -54713,9 +55104,7 @@ function emitSwiftPackageManifest(args) {
|
|
|
54713
55104
|
(dependency) => clang && // textual native headers can include one another without imposing
|
|
54714
55105
|
// an object build order. the executable already links every native
|
|
54715
55106
|
// target; only generated Swift headers require producer ordering.
|
|
54716
|
-
(args.native?.get(dependency)?.clang || [
|
|
54717
|
-
(value) => value.late?.producers.includes(dependency)
|
|
54718
|
-
)) ? [] : OPTIONAL_FRAMEWORKS.has(dependency) && !targets.some((candidate) => candidate.name === dependency) ? linkedObjects ? [] : [`.product(name: "${dependency}", package: "sootsim-swift")`] : [`"${dependency}"`]
|
|
55107
|
+
(args.native?.get(dependency)?.clang || lateProducers.has(dependency)) ? [] : OPTIONAL_FRAMEWORKS.has(dependency) && !targetNames.has(dependency) ? linkedObjects ? [] : [`.product(name: "${dependency}", package: "sootsim-swift")`] : [`"${dependency}"`]
|
|
54719
55108
|
),
|
|
54720
55109
|
// a swift importer still needs the producers its clang dependencies
|
|
54721
55110
|
// reached upstream, whose edges the clang targets above dropped.
|
|
@@ -54802,7 +55191,7 @@ function emitSwiftPackageManifest(args) {
|
|
|
54802
55191
|
...args.nativeFlags?.get(name3) ?? [],
|
|
54803
55192
|
...args.nativeHeaderFlags ?? []
|
|
54804
55193
|
];
|
|
54805
|
-
const owner =
|
|
55194
|
+
const owner = targetByName.get(name3);
|
|
54806
55195
|
const context = /* @__PURE__ */ new Set();
|
|
54807
55196
|
const visit3 = (dependency) => {
|
|
54808
55197
|
if (context.has(dependency)) return;
|
|
@@ -54878,10 +55267,16 @@ ${declaration.replace(/,$/, "")}
|
|
|
54878
55267
|
""
|
|
54879
55268
|
].join("\n");
|
|
54880
55269
|
}
|
|
54881
|
-
function syncSwiftTree(base2, files2) {
|
|
55270
|
+
function syncSwiftTree(base2, files2, alreadySynced) {
|
|
54882
55271
|
(0, import_node_fs79.mkdirSync)(base2, { recursive: true });
|
|
54883
|
-
|
|
54884
|
-
|
|
55272
|
+
let kept;
|
|
55273
|
+
if (process.platform !== "linux") {
|
|
55274
|
+
kept = /* @__PURE__ */ new Set();
|
|
55275
|
+
for (const file of files2.keys()) {
|
|
55276
|
+
const stat2 = (0, import_node_fs79.statSync)(file, { throwIfNoEntry: false });
|
|
55277
|
+
if (stat2) kept.add(stat2.ino);
|
|
55278
|
+
}
|
|
55279
|
+
}
|
|
54885
55280
|
const walk4 = (dir) => {
|
|
54886
55281
|
for (const entry of (0, import_node_fs79.readdirSync)(dir, { withFileTypes: true })) {
|
|
54887
55282
|
const full = import_node_path81.default.join(dir, entry.name);
|
|
@@ -54890,12 +55285,13 @@ function syncSwiftTree(base2, files2) {
|
|
|
54890
55285
|
entry.name === CLANG_DISTRIBUTION_MODULES || entry.name === SWIFT_DISTRIBUTION_MIRROR || entry.name === SWIFT_LINK_STAMP))
|
|
54891
55286
|
continue;
|
|
54892
55287
|
if (entry.isDirectory()) walk4(full);
|
|
54893
|
-
else if (!files2.has(full) && !kept.has((0, import_node_fs79.lstatSync)(full).ino))
|
|
55288
|
+
else if (!files2.has(full) && (!kept || !kept.has((0, import_node_fs79.lstatSync)(full).ino)))
|
|
54894
55289
|
(0, import_node_fs79.rmSync)(full, { force: true });
|
|
54895
55290
|
}
|
|
54896
55291
|
};
|
|
54897
55292
|
walk4(base2);
|
|
54898
55293
|
for (const [full, contents2] of files2) {
|
|
55294
|
+
if (alreadySynced?.get(full) === contents2) continue;
|
|
54899
55295
|
writeBuildFile(full, contents2);
|
|
54900
55296
|
}
|
|
54901
55297
|
}
|
|
@@ -55003,25 +55399,59 @@ function swiftWasmCallGuards(source, unavailable2) {
|
|
|
55003
55399
|
out = out.slice(0, at) + replacement + out.slice(at + width);
|
|
55004
55400
|
return out;
|
|
55005
55401
|
}
|
|
55402
|
+
function matchesPathPrefixSet(file, set2) {
|
|
55403
|
+
if (set2.has(file)) return true;
|
|
55404
|
+
for (let slash = file.lastIndexOf("/"); slash !== -1; slash = file.lastIndexOf("/", slash - 1)) {
|
|
55405
|
+
if (set2.has(file.slice(0, slash))) return true;
|
|
55406
|
+
}
|
|
55407
|
+
return false;
|
|
55408
|
+
}
|
|
55409
|
+
function indexTargetsByDirectory(targets) {
|
|
55410
|
+
const byDir = /* @__PURE__ */ new Map();
|
|
55411
|
+
for (const target of targets) {
|
|
55412
|
+
const key2 = target.path === "." ? "" : target.path.replace(/\/+$/, "");
|
|
55413
|
+
let list2 = byDir.get(key2);
|
|
55414
|
+
if (!list2) byDir.set(key2, list2 = []);
|
|
55415
|
+
list2.push(target);
|
|
55416
|
+
}
|
|
55417
|
+
return byDir;
|
|
55418
|
+
}
|
|
55419
|
+
function findTargetForFile(file, byDir, predicate) {
|
|
55420
|
+
for (let slash = file.lastIndexOf("/"); slash !== -1; slash = file.lastIndexOf("/", slash - 1)) {
|
|
55421
|
+
const candidates = byDir.get(file.slice(0, slash));
|
|
55422
|
+
if (!candidates) continue;
|
|
55423
|
+
const relative6 = file.slice(slash + 1);
|
|
55424
|
+
for (const target of candidates) if (predicate(target, relative6)) return target;
|
|
55425
|
+
}
|
|
55426
|
+
const rootCandidates = byDir.get("");
|
|
55427
|
+
if (rootCandidates) {
|
|
55428
|
+
for (const target of rootCandidates) if (predicate(target, file)) return target;
|
|
55429
|
+
}
|
|
55430
|
+
return void 0;
|
|
55431
|
+
}
|
|
55006
55432
|
function compiledSwiftSources(files2, targets, overlayFrameworks, headers, nativeSourceGlue = false) {
|
|
55007
55433
|
const ordered = [...targets].sort((a, b) => b.path.length - a.path.length);
|
|
55008
|
-
const
|
|
55009
|
-
|
|
55010
|
-
|
|
55011
|
-
|
|
55012
|
-
|
|
55013
|
-
|
|
55014
|
-
|
|
55015
|
-
|
|
55016
|
-
|
|
55017
|
-
|
|
55018
|
-
return
|
|
55019
|
-
})
|
|
55020
|
-
|
|
55434
|
+
const byDir = indexTargetsByDirectory(ordered);
|
|
55435
|
+
const excludeSets = /* @__PURE__ */ new Map();
|
|
55436
|
+
for (const target of ordered) {
|
|
55437
|
+
if (target.exclude?.length) excludeSets.set(target.name, new Set(target.exclude));
|
|
55438
|
+
}
|
|
55439
|
+
const owners = /* @__PURE__ */ new Map();
|
|
55440
|
+
for (const [file, source] of Object.entries(files2)) {
|
|
55441
|
+
if (!file.endsWith(".swift")) continue;
|
|
55442
|
+
const owner = findTargetForFile(file, byDir, (target, relative6) => {
|
|
55443
|
+
const excluded = excludeSets.get(target.name);
|
|
55444
|
+
return !excluded || !matchesPathPrefixSet(relative6, excluded);
|
|
55445
|
+
});
|
|
55446
|
+
owners.set(file, { source, owner });
|
|
55447
|
+
}
|
|
55021
55448
|
const swiftSources = /* @__PURE__ */ new Map();
|
|
55022
|
-
for (const { source, owner } of owners.values())
|
|
55023
|
-
if (owner)
|
|
55024
|
-
|
|
55449
|
+
for (const { source, owner } of owners.values()) {
|
|
55450
|
+
if (!owner) continue;
|
|
55451
|
+
let list2 = swiftSources.get(owner.name);
|
|
55452
|
+
if (!list2) swiftSources.set(owner.name, list2 = []);
|
|
55453
|
+
list2.push(source);
|
|
55454
|
+
}
|
|
55025
55455
|
const { onWasm, withoutWasm } = swiftTargetArchitectures(targets, swiftSources, headers);
|
|
55026
55456
|
return new Map(
|
|
55027
55457
|
[...owners].map(([file, { source, owner }]) => {
|
|
@@ -55810,18 +56240,46 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
|
|
|
55810
56240
|
const bySourcePath = [...targets].sort(
|
|
55811
56241
|
(left, right) => right.path.length - left.path.length
|
|
55812
56242
|
);
|
|
56243
|
+
const targetsByDir = indexTargetsByDirectory(bySourcePath);
|
|
56244
|
+
const targetByName = new Map(targets.map((target) => [target.name, target]));
|
|
56245
|
+
const nativeTargets2 = input.nativeTargets ?? [];
|
|
56246
|
+
const nativeTargetByName = new Map(nativeTargets2.map((target) => [target.name, target]));
|
|
56247
|
+
const nativeTargetIndex = new Map(
|
|
56248
|
+
nativeTargets2.map((target, index) => [target.name, index])
|
|
56249
|
+
);
|
|
56250
|
+
const resourceTargetByName = new Map(
|
|
56251
|
+
resourceTargets.map((target) => [target.name, target])
|
|
56252
|
+
);
|
|
56253
|
+
const targetSourceSets = /* @__PURE__ */ new Map();
|
|
56254
|
+
const targetExcludeFullSets = /* @__PURE__ */ new Map();
|
|
56255
|
+
const targetExcludeExactSets = /* @__PURE__ */ new Map();
|
|
56256
|
+
for (const target of targets) {
|
|
56257
|
+
const prefix = target.path === "." ? "" : `${target.path}/`;
|
|
56258
|
+
if (target.sources !== void 0) {
|
|
56259
|
+
targetSourceSets.set(
|
|
56260
|
+
target.name,
|
|
56261
|
+
new Set(target.sources.map((source) => import_node_path81.default.posix.join(prefix, source)))
|
|
56262
|
+
);
|
|
56263
|
+
}
|
|
56264
|
+
if (target.exclude?.length) {
|
|
56265
|
+
targetExcludeFullSets.set(
|
|
56266
|
+
target.name,
|
|
56267
|
+
new Set(target.exclude.map((excluded) => `${prefix}${excluded}`))
|
|
56268
|
+
);
|
|
56269
|
+
targetExcludeExactSets.set(
|
|
56270
|
+
target.name,
|
|
56271
|
+
new Set(target.exclude.map((name3) => import_node_path81.default.posix.join(target.path, name3)))
|
|
56272
|
+
);
|
|
56273
|
+
}
|
|
56274
|
+
}
|
|
55813
56275
|
const swiftTargets = /* @__PURE__ */ new Set();
|
|
55814
56276
|
for (const file of Object.keys(input.files)) {
|
|
55815
56277
|
if (!file.endsWith(".swift")) continue;
|
|
55816
|
-
const target =
|
|
55817
|
-
|
|
55818
|
-
|
|
55819
|
-
|
|
55820
|
-
|
|
55821
|
-
);
|
|
55822
|
-
const excluded = target?.exclude?.some(
|
|
55823
|
-
(name3) => file === import_node_path81.default.posix.join(target.path, name3)
|
|
55824
|
-
);
|
|
56278
|
+
const target = findTargetForFile(file, targetsByDir, (candidate) => {
|
|
56279
|
+
const selected = targetSourceSets.get(candidate.name);
|
|
56280
|
+
return !selected || matchesPathPrefixSet(file, selected);
|
|
56281
|
+
});
|
|
56282
|
+
const excluded = target && targetExcludeExactSets.get(target.name)?.has(file);
|
|
55825
56283
|
if (target && !excluded) swiftTargets.add(target.name);
|
|
55826
56284
|
}
|
|
55827
56285
|
const importedModules = /* @__PURE__ */ new Set();
|
|
@@ -55859,7 +56317,7 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
|
|
|
55859
56317
|
checkedToolchain = swiftToolchain(pin2.release, swiftModuleSdk(moduleRoot));
|
|
55860
56318
|
return checkedToolchain;
|
|
55861
56319
|
};
|
|
55862
|
-
const deploymentTarget = (name3) =>
|
|
56320
|
+
const deploymentTarget = (name3) => nativeTargetByName.get(name3)?.deploymentTarget ?? targetByName.get(name3)?.iosDeploymentTarget ?? null;
|
|
55863
56321
|
const targetStagedFiles = /* @__PURE__ */ new Map();
|
|
55864
56322
|
const stageTargetFile = (target, file, contents2, options2) => {
|
|
55865
56323
|
const relative6 = import_node_path81.default.relative(layout2.root, file).split(import_node_path81.default.sep).join(import_node_path81.default.posix.sep);
|
|
@@ -55871,18 +56329,41 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
|
|
|
55871
56329
|
targetStagedFiles.set(target, staged);
|
|
55872
56330
|
files2.set(file, contents2);
|
|
55873
56331
|
};
|
|
56332
|
+
const entriesByPrefix = /* @__PURE__ */ new Map();
|
|
56333
|
+
for (const target of targets) {
|
|
56334
|
+
const prefix = target.path === "." ? "" : `${target.path}/`;
|
|
56335
|
+
if (!entriesByPrefix.has(prefix)) entriesByPrefix.set(prefix, []);
|
|
56336
|
+
}
|
|
56337
|
+
for (const entry of Object.entries(input.files)) {
|
|
56338
|
+
const [file] = entry;
|
|
56339
|
+
entriesByPrefix.get("")?.push(entry);
|
|
56340
|
+
for (let end = file.indexOf("/"); end !== -1; end = file.indexOf("/", end + 1)) {
|
|
56341
|
+
entriesByPrefix.get(file.slice(0, end + 1))?.push(entry);
|
|
56342
|
+
}
|
|
56343
|
+
}
|
|
56344
|
+
const targetEntriesCache = /* @__PURE__ */ new Map();
|
|
55874
56345
|
const targetEntries = (target) => {
|
|
56346
|
+
const cached4 = targetEntriesCache.get(target.name);
|
|
56347
|
+
if (cached4) return cached4;
|
|
55875
56348
|
const prefix = target.path === "." ? "" : `${target.path}/`;
|
|
55876
|
-
|
|
55877
|
-
|
|
55878
|
-
|
|
55879
|
-
|
|
55880
|
-
|
|
55881
|
-
(
|
|
55882
|
-
|
|
55883
|
-
|
|
55884
|
-
)
|
|
55885
|
-
|
|
56349
|
+
const selectedSources = targetSourceSets.get(target.name);
|
|
56350
|
+
const excludedPaths = targetExcludeFullSets.get(target.name);
|
|
56351
|
+
const nestedPrefixes = [];
|
|
56352
|
+
for (const candidate of targets) {
|
|
56353
|
+
if (candidate.name !== target.name && candidate.path !== "." && candidate.path.startsWith(prefix))
|
|
56354
|
+
nestedPrefixes.push(`${candidate.path}/`);
|
|
56355
|
+
}
|
|
56356
|
+
const matched = (entriesByPrefix.get(prefix) ?? []).filter(([file]) => {
|
|
56357
|
+
if (selectedSources !== void 0 && (file.endsWith(".swift") || isSwiftNativeTranslationUnit(file)) && !matchesPathPrefixSet(file, selectedSources))
|
|
56358
|
+
return false;
|
|
56359
|
+
if (excludedPaths !== void 0 && matchesPathPrefixSet(file, excludedPaths))
|
|
56360
|
+
return false;
|
|
56361
|
+
if (nestedPrefixes.length > 0 && nestedPrefixes.some((p) => file.startsWith(p)))
|
|
56362
|
+
return false;
|
|
56363
|
+
return true;
|
|
56364
|
+
});
|
|
56365
|
+
targetEntriesCache.set(target.name, matched);
|
|
56366
|
+
return matched;
|
|
55886
56367
|
};
|
|
55887
56368
|
const failTargetPreparation = (target, message) => {
|
|
55888
56369
|
const prefix = target.path === "." ? "" : `${target.path}/`;
|
|
@@ -55927,19 +56408,21 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
|
|
|
55927
56408
|
return value;
|
|
55928
56409
|
};
|
|
55929
56410
|
const podHeaders = /* @__PURE__ */ new Map();
|
|
55930
|
-
for (const settings of
|
|
56411
|
+
for (const settings of nativeTargets2)
|
|
55931
56412
|
for (const file of settings.headers) {
|
|
55932
56413
|
const owner = /\/Headers\/(?:Public|Private)\/([\w+-]+)\/(?:\1\/)?[^/]+\.h$/.exec(
|
|
55933
56414
|
file
|
|
55934
56415
|
)?.[1];
|
|
55935
|
-
if (owner)
|
|
55936
|
-
|
|
55937
|
-
|
|
55938
|
-
|
|
55939
|
-
]);
|
|
56416
|
+
if (owner) {
|
|
56417
|
+
const base2 = import_node_path81.default.basename(file);
|
|
56418
|
+
let list2 = podHeaders.get(base2);
|
|
56419
|
+
if (!list2) podHeaders.set(base2, list2 = []);
|
|
56420
|
+
list2.push({ owner, content: input.files[file] });
|
|
56421
|
+
}
|
|
55940
56422
|
}
|
|
55941
56423
|
const podHeaderOwner = (file, content) => /\/Headers\/(?:Public|Private)\/([\w+-]+)\//.exec(file)?.[1] ?? podHeaders.get(import_node_path81.default.basename(file))?.find((header) => header.content === content)?.owner;
|
|
55942
|
-
|
|
56424
|
+
const alreadySynced = /* @__PURE__ */ new Map();
|
|
56425
|
+
for (const settings of nativeTargets2) {
|
|
55943
56426
|
for (const file of settings.headers) {
|
|
55944
56427
|
const destination = import_node_path81.default.join(layout2.root, file);
|
|
55945
56428
|
if (files2.has(destination)) continue;
|
|
@@ -55956,10 +56439,10 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
|
|
|
55956
56439
|
`#import <${interfaceOwner}/${interfaceOwner}-Swift.h>`
|
|
55957
56440
|
) : rawContents;
|
|
55958
56441
|
writeBuildFile(destination, contents2);
|
|
56442
|
+
alreadySynced.set(destination, contents2);
|
|
55959
56443
|
files2.set(destination, contents2);
|
|
55960
56444
|
}
|
|
55961
56445
|
}
|
|
55962
|
-
const nativeTargets2 = input.nativeTargets ?? [];
|
|
55963
56446
|
const fromInputRoot = (file) => file.startsWith(`${SWIFT_NATIVE_INPUT_ROOT}/`) ? import_node_path81.default.join(layout2.root, file.slice(SWIFT_NATIVE_INPUT_ROOT.length + 1)) : file;
|
|
55964
56447
|
const inRoot = `${layout2.root}${import_node_path81.default.sep}`;
|
|
55965
56448
|
const binaryTree = `${import_node_path81.default.sep}${SWIFT_BINARY_TREES_DIR}${import_node_path81.default.sep}`;
|
|
@@ -56024,12 +56507,10 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
|
|
|
56024
56507
|
const prefix = target.path === "." ? "" : `${target.path}/`;
|
|
56025
56508
|
const entries2 = targetEntries(target);
|
|
56026
56509
|
const units = entries2.filter(([file]) => isSwiftNativeTranslationUnit(file));
|
|
56027
|
-
|
|
56028
|
-
|
|
56029
|
-
)))
|
|
56510
|
+
const settings = nativeTargetByName.get(target.name);
|
|
56511
|
+
if (units.length === 0 && !(entries2.some(([file]) => file.endsWith(".swift")) && settings !== void 0 && (settings.publicHeaders.length > 0 || settings.bridgingHeader !== null)))
|
|
56030
56512
|
continue;
|
|
56031
56513
|
const includes = `${prefix}include/`;
|
|
56032
|
-
const settings = input.nativeTargets?.find((value) => value.name === target.name);
|
|
56033
56514
|
const searchRoots = [
|
|
56034
56515
|
...settings?.userHeaderSearchPaths ?? [],
|
|
56035
56516
|
...settings?.headerSearchPaths ?? [],
|
|
@@ -56060,7 +56541,9 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
|
|
|
56060
56541
|
...searchRoots.map((root) => import_node_path81.default.posix.join(root, include))
|
|
56061
56542
|
].find((candidate) => input.files[candidate] !== void 0);
|
|
56062
56543
|
if (local) {
|
|
56063
|
-
|
|
56544
|
+
let parents = reverse.get(local);
|
|
56545
|
+
if (!parents) reverse.set(local, parents = []);
|
|
56546
|
+
parents.push(file);
|
|
56064
56547
|
if (xcodeTarget && !seenHeaders.has(local)) {
|
|
56065
56548
|
seenHeaders.add(local);
|
|
56066
56549
|
searchEntries.push([local, input.files[local]]);
|
|
@@ -56106,9 +56589,10 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
|
|
|
56106
56589
|
const stageFlags = (flags2, sdkInclude2) => flags2.map(
|
|
56107
56590
|
(flag) => flag.replaceAll(SWIFT_NATIVE_INPUT_ROOT, layout2.root).replaceAll(SWIFT_NATIVE_SDK_INCLUDE, sdkInclude2)
|
|
56108
56591
|
);
|
|
56592
|
+
const settingsHeaderFlags = headerSearch.flags[nativeTargetIndex.get(settings.name)];
|
|
56109
56593
|
const originalFlags = [
|
|
56110
56594
|
...settings.flags,
|
|
56111
|
-
...
|
|
56595
|
+
...settingsHeaderFlags,
|
|
56112
56596
|
...search,
|
|
56113
56597
|
...(settings?.frameworkSearchPaths ?? []).flatMap((dir) => [
|
|
56114
56598
|
"-F",
|
|
@@ -56119,7 +56603,7 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
|
|
|
56119
56603
|
];
|
|
56120
56604
|
const importOriginalFlags = settings.flattensPublicHeaders ? [
|
|
56121
56605
|
...settings.importerFlags,
|
|
56122
|
-
...
|
|
56606
|
+
...settingsHeaderFlags,
|
|
56123
56607
|
...search,
|
|
56124
56608
|
...settings.frameworkSearchPaths.flatMap((dir) => [
|
|
56125
56609
|
"-F",
|
|
@@ -56144,7 +56628,7 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
|
|
|
56144
56628
|
}
|
|
56145
56629
|
return [
|
|
56146
56630
|
...kept,
|
|
56147
|
-
...
|
|
56631
|
+
...settingsHeaderFlags,
|
|
56148
56632
|
...search,
|
|
56149
56633
|
...(settings?.frameworkSearchPaths ?? []).flatMap((dir) => [
|
|
56150
56634
|
"-F",
|
|
@@ -56173,7 +56657,7 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
|
|
|
56173
56657
|
const bundleName = entries2.some(([file]) => file.endsWith(".swift")) ? void 0 : swiftObjCResourceBundleName({
|
|
56174
56658
|
target: target.name,
|
|
56175
56659
|
path: target.path,
|
|
56176
|
-
resources:
|
|
56660
|
+
resources: resourceTargetByName.get(target.name)?.resources ?? false,
|
|
56177
56661
|
usesBundleMacro: entries2.some(
|
|
56178
56662
|
([file, contents2]) => (isSwiftNativeTranslationUnit(file) || /\.(?:h|hpp|hh|hxx)$/.test(file)) && /\bSWIFTPM_MODULE_BUNDLE\b/.test(contents2)
|
|
56179
56663
|
),
|
|
@@ -56326,10 +56810,7 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
|
|
|
56326
56810
|
.../\.mm?$/.test(file) ? ["-fobjc-exceptions"] : [],
|
|
56327
56811
|
...stageFlags(
|
|
56328
56812
|
[...objcCxx ? settings.cxxFlags : [], ...fileFlags],
|
|
56329
|
-
|
|
56330
|
-
swiftSdkPaths(moduleRoot, toolchainBin).sysroot,
|
|
56331
|
-
"darwin/usr/include"
|
|
56332
|
-
)
|
|
56813
|
+
sdkInclude
|
|
56333
56814
|
)
|
|
56334
56815
|
];
|
|
56335
56816
|
const moduleFlag = perFile.some((flag) => flag.startsWith("-fmodule-name=")) ? [] : [`-fmodule-name=${swiftTargetModuleName(target.name)}`];
|
|
@@ -56369,13 +56850,7 @@ ${swiftProjectFilesProblems(input.projectFiles).join("\n")}`
|
|
|
56369
56850
|
...flags,
|
|
56370
56851
|
...prefixHeader,
|
|
56371
56852
|
...accessorFlags,
|
|
56372
|
-
...stageFlags(
|
|
56373
|
-
cxx ? settings.cxxFlags : [],
|
|
56374
|
-
import_node_path81.default.join(
|
|
56375
|
-
swiftSdkPaths(moduleRoot, toolchainBin).sysroot,
|
|
56376
|
-
"darwin/usr/include"
|
|
56377
|
-
)
|
|
56378
|
-
),
|
|
56853
|
+
...stageFlags(cxx ? settings.cxxFlags : [], sdkInclude),
|
|
56379
56854
|
...perFile,
|
|
56380
56855
|
...moduleFlag
|
|
56381
56856
|
]
|
|
@@ -56630,7 +57105,9 @@ module ${moduleName2}.Swift {
|
|
|
56630
57105
|
}
|
|
56631
57106
|
` : swiftObjCModuleMap(
|
|
56632
57107
|
moduleName2,
|
|
56633
|
-
(
|
|
57108
|
+
(nativeTargetByName.get(name3)?.publicHeaders ?? []).map(
|
|
57109
|
+
(header) => import_node_path81.default.join(layout2.root, header)
|
|
57110
|
+
),
|
|
56634
57111
|
submoduleImports2.get(moduleName2),
|
|
56635
57112
|
import_node_path81.default.join(headerDirectory, name3 + "-Swift.h")
|
|
56636
57113
|
)
|
|
@@ -57180,6 +57657,7 @@ ${entry}`);
|
|
|
57180
57657
|
files2.set(destination, Buffer.from(bytes, "base64"));
|
|
57181
57658
|
}
|
|
57182
57659
|
const targetToolset = nativeToolset || native.size > 0;
|
|
57660
|
+
let usesObjcPrebuilt = false;
|
|
57183
57661
|
if (targetToolset) {
|
|
57184
57662
|
const nativeToolsetFlags = [
|
|
57185
57663
|
...headerAliasFlags,
|
|
@@ -57200,6 +57678,7 @@ ${entry}`);
|
|
|
57200
57678
|
[...native.keys()],
|
|
57201
57679
|
objcPrebuiltStage
|
|
57202
57680
|
) : [];
|
|
57681
|
+
usesObjcPrebuilt = prebuiltCompiler.length > 0;
|
|
57203
57682
|
files2.set(
|
|
57204
57683
|
clangWrapper2,
|
|
57205
57684
|
[
|
|
@@ -57508,17 +57987,39 @@ package.targets += [.target(name: ${JSON.stringify(name3)}, dependencies: ${JSON
|
|
|
57508
57987
|
(name3) => !nativePrerequisiteSet.has(name3)
|
|
57509
57988
|
);
|
|
57510
57989
|
const nativeTargetUnitCount = /* @__PURE__ */ new Map();
|
|
57990
|
+
const nativeTargetSources = /* @__PURE__ */ new Map();
|
|
57511
57991
|
for (const target of manifestTargets)
|
|
57512
|
-
if (target.sources?.length)
|
|
57992
|
+
if (target.sources?.length) {
|
|
57513
57993
|
nativeTargetUnitCount.set(target.name, target.sources.length);
|
|
57994
|
+
nativeTargetSources.set(target.name, target.sources);
|
|
57995
|
+
}
|
|
57514
57996
|
for (const [name3, plan] of native) {
|
|
57515
|
-
if (!plan.mixed && plan.sources.length > 0)
|
|
57516
|
-
|
|
57517
|
-
|
|
57997
|
+
if (!plan.mixed && plan.sources.length > 0) {
|
|
57998
|
+
const sources = plan.clang?.sources ?? plan.sources;
|
|
57999
|
+
nativeTargetUnitCount.set(name3, sources.length);
|
|
58000
|
+
nativeTargetSources.set(name3, sources);
|
|
58001
|
+
}
|
|
58002
|
+
for (const group of plan.groups ?? []) {
|
|
57518
58003
|
nativeTargetUnitCount.set(group.name, group.sources.length);
|
|
57519
|
-
|
|
58004
|
+
nativeTargetSources.set(group.name, group.sources);
|
|
58005
|
+
}
|
|
58006
|
+
if (plan.late && !plan.groups?.length) {
|
|
57520
58007
|
nativeTargetUnitCount.set(plan.late.name, plan.sources.length);
|
|
58008
|
+
nativeTargetSources.set(plan.late.name, plan.lateSources);
|
|
58009
|
+
}
|
|
57521
58010
|
}
|
|
58011
|
+
const nativeStageObjects = /* @__PURE__ */ new Map();
|
|
58012
|
+
const recordStageObjects = (stageTarget, members2) => {
|
|
58013
|
+
const objects = [];
|
|
58014
|
+
for (const member of members2) {
|
|
58015
|
+
const sources = nativeTargetSources.get(member);
|
|
58016
|
+
if (!sources || sources.length === 0) return stageTarget;
|
|
58017
|
+
for (const source of sources)
|
|
58018
|
+
objects.push(import_node_path81.default.join(`${member}.build`, `${source}.o`));
|
|
58019
|
+
}
|
|
58020
|
+
nativeStageObjects.set(stageTarget, objects);
|
|
58021
|
+
return stageTarget;
|
|
58022
|
+
};
|
|
57522
58023
|
const MAX_NATIVE_STAGE_UNITS = 250;
|
|
57523
58024
|
const chunkNativeStageTargets = (prefix, names) => {
|
|
57524
58025
|
if (names.length === 0) return [];
|
|
@@ -57527,7 +58028,7 @@ package.targets += [.target(name: ${JSON.stringify(name3)}, dependencies: ${JSON
|
|
|
57527
58028
|
0
|
|
57528
58029
|
);
|
|
57529
58030
|
if (names.length === 1 || total <= MAX_NATIVE_STAGE_UNITS)
|
|
57530
|
-
return [buildProduct(prefix, names)];
|
|
58031
|
+
return [recordStageObjects(buildProduct(prefix, names), names)];
|
|
57531
58032
|
const chunks = [];
|
|
57532
58033
|
let current2 = [];
|
|
57533
58034
|
let count = 0;
|
|
@@ -57542,7 +58043,9 @@ package.targets += [.target(name: ${JSON.stringify(name3)}, dependencies: ${JSON
|
|
|
57542
58043
|
count += size2;
|
|
57543
58044
|
}
|
|
57544
58045
|
if (current2.length > 0) chunks.push(current2);
|
|
57545
|
-
return chunks.map(
|
|
58046
|
+
return chunks.map(
|
|
58047
|
+
(members2, index) => recordStageObjects(buildProduct(`${prefix}${index + 1}`, members2), members2)
|
|
58048
|
+
);
|
|
57546
58049
|
};
|
|
57547
58050
|
const nativePrerequisiteStageTargets = chunkNativeStageTargets(
|
|
57548
58051
|
"PeachHeaderNativePrereqs",
|
|
@@ -57553,7 +58056,7 @@ package.targets += [.target(name: ${JSON.stringify(name3)}, dependencies: ${JSON
|
|
|
57553
58056
|
remainingNativeBuildTargets
|
|
57554
58057
|
);
|
|
57555
58058
|
files2.set(manifestPath, manifest);
|
|
57556
|
-
syncSwiftTree(layout2.root, files2);
|
|
58059
|
+
syncSwiftTree(layout2.root, files2, alreadySynced);
|
|
57557
58060
|
if (layout2.multi)
|
|
57558
58061
|
for (const target of targets)
|
|
57559
58062
|
(0, import_node_fs79.mkdirSync)(import_node_path81.default.join(layout2.root, target.path), { recursive: true });
|
|
@@ -57568,7 +58071,9 @@ package.targets += [.target(name: ${JSON.stringify(name3)}, dependencies: ${JSON
|
|
|
57568
58071
|
targetFailures,
|
|
57569
58072
|
generatedOwners,
|
|
57570
58073
|
targetToolset,
|
|
57571
|
-
headerCompiler
|
|
58074
|
+
headerCompiler,
|
|
58075
|
+
usesObjcPrebuilt,
|
|
58076
|
+
nativeStageObjects
|
|
57572
58077
|
};
|
|
57573
58078
|
}
|
|
57574
58079
|
function streamText(value) {
|
|
@@ -58654,8 +59159,8 @@ ${cap}` : "";
|
|
|
58654
59159
|
work,
|
|
58655
59160
|
unoptimized
|
|
58656
59161
|
);
|
|
58657
|
-
const baseBuildEnv = {
|
|
58658
|
-
...options2.project
|
|
59162
|
+
const baseBuildEnv = options2.project?.env ? {
|
|
59163
|
+
...options2.project.env,
|
|
58659
59164
|
// shipped host plugins resolve against the selected compiler's runtime.
|
|
58660
59165
|
...process.platform === "linux" ? {
|
|
58661
59166
|
LD_LIBRARY_PATH: [
|
|
@@ -58665,7 +59170,7 @@ ${cap}` : "";
|
|
|
58665
59170
|
].filter(Boolean).join(":")
|
|
58666
59171
|
} : {},
|
|
58667
59172
|
PEACH_DEFER_WASM_LINK: "1"
|
|
58668
|
-
};
|
|
59173
|
+
} : swiftCompilerBaseEnv(options2.toolchainBin, process.env);
|
|
58669
59174
|
const {
|
|
58670
59175
|
frameworkRoot,
|
|
58671
59176
|
compileFrameworkRoot,
|
|
@@ -58809,7 +59314,11 @@ ${cap}` : "";
|
|
|
58809
59314
|
} : {
|
|
58810
59315
|
...buildOptions,
|
|
58811
59316
|
temporaryDirectory,
|
|
58812
|
-
env: {
|
|
59317
|
+
env: {
|
|
59318
|
+
...buildOptions.env,
|
|
59319
|
+
...preparation.usesObjcPrebuilt && process.env.PEACH_HOME !== void 0 ? { PEACH_HOME: process.env.PEACH_HOME } : {},
|
|
59320
|
+
...compiler
|
|
59321
|
+
}
|
|
58813
59322
|
};
|
|
58814
59323
|
const unprepared = preparation.targetFailures.map(
|
|
58815
59324
|
(failure2) => `error: target ${failure2}`
|
|
@@ -58856,10 +59365,18 @@ ${cap}` : "";
|
|
|
58856
59365
|
// the mirror finds a changed sdk header's readers in their
|
|
58857
59366
|
// dependency files, which omit system headers by default
|
|
58858
59367
|
...mirrorDistribution ? ["-Xswiftc", "-track-system-dependencies"] : [],
|
|
58859
|
-
// the link strips debug info, so none is generated (as for the framework)
|
|
59368
|
+
// the link strips debug info, so none is generated (as for the framework).
|
|
59369
|
+
// keep -num-threads fixed across caller core caps so llbuild does not
|
|
59370
|
+
// rebuild every target when callers alternate --cores, and bound backend
|
|
59371
|
+
// fan-out under high -j.
|
|
58860
59372
|
"-Xswiftc",
|
|
58861
59373
|
"-gnone",
|
|
58862
|
-
...incrementalPreview ? [] : [
|
|
59374
|
+
...incrementalPreview ? [] : [
|
|
59375
|
+
"-Xswiftc",
|
|
59376
|
+
"-num-threads",
|
|
59377
|
+
"-Xswiftc",
|
|
59378
|
+
String(perFile ? 1 : Math.min(8, import_node_os16.default.availableParallelism()))
|
|
59379
|
+
],
|
|
58863
59380
|
...swiftReproducibleBuildFlags([
|
|
58864
59381
|
[import_node_path81.default.dirname(options2.toolchainBin), "toolchain"],
|
|
58865
59382
|
[compileFrameworkRoot, "framework"],
|
|
@@ -59034,7 +59551,18 @@ ${cap}` : "";
|
|
|
59034
59551
|
}))
|
|
59035
59552
|
];
|
|
59036
59553
|
const checkpoints = import_node_path81.default.join(root, ".build", "peach-product-checkpoints");
|
|
59554
|
+
const buildDbExists = (0, import_node_fs79.existsSync)(import_node_path81.default.join(root, ".build", "build.db"));
|
|
59555
|
+
const releaseDir = import_node_path81.default.dirname(linked);
|
|
59037
59556
|
for (const { target, producers } of stages) {
|
|
59557
|
+
if (!options2.project && producers.length === 0 && buildDbExists) {
|
|
59558
|
+
const expectedObjects = preparation.nativeStageObjects.get(target);
|
|
59559
|
+
if (expectedObjects && expectedObjects.length > 0 && expectedObjects.every(
|
|
59560
|
+
(relative6) => (0, import_node_fs79.statSync)(import_node_path81.default.join(releaseDir, relative6), {
|
|
59561
|
+
throwIfNoEntry: false
|
|
59562
|
+
})?.isFile()
|
|
59563
|
+
))
|
|
59564
|
+
continue;
|
|
59565
|
+
}
|
|
59038
59566
|
const receipt = import_node_path81.default.join(
|
|
59039
59567
|
checkpoints,
|
|
59040
59568
|
(0, import_node_crypto47.createHash)("sha256").update(target).digest("hex")
|
|
@@ -59259,7 +59787,7 @@ ${cap}` : "";
|
|
|
59259
59787
|
options2.signal
|
|
59260
59788
|
);
|
|
59261
59789
|
}
|
|
59262
|
-
var import_node_child_process40, import_node_crypto47, import_node_fs79, import_node_os16, import_node_path81, v6, WASM_TRIPLE, SWIFTPM_PROGRESS, SWIFTPM_NOISE, distributionManifests, distributionCompileViews, REACH_STAGED_FRAMEWORKS, objcEnumerations, clangDeclarationEnumCache, objcEnumForward, sdkDeclarationOwners, swiftInterfaceDeclarations, linkedModuleDigests, compileSurfaces, SYSTEM_MODULE_LIBRARIES, SYSTEM_MODULE_IMPORT, OPTIONAL_FRAMEWORK_DEPENDENCIES, OPTIONAL_FRAMEWORKS, SWIFT_IMPORT, kleeneNot, kleeneAnd, kleeneOr, NON_IOS_MODULES, sdkPaths, availableModules, sdkOverlayFrameworks, DISTRIBUTION_CLANG_MODULES, CLANG_DISTRIBUTION_MODULES, ONE_PRODUCT, GAME_FAMILY, gameProducts, gameProduct, GAME_REACH, FOUNDATION_IMPLICIT_MODULES, FRAMEWORK_COMPANION_IMPORT, ONE_IMPLICIT_FLAGS, executableLinkFlags, darwinRecordsRegion, REACTOR_FLAG, MULTI_MANIFEST_VERSION, SWIFT_HEADER_PRODUCTS_TARGET, compilerSourceDigest, nativeCxxCompilerFlags, MODULE_MAP_RESPONSE_FILE_RUN, cFlagArray, cxxFlagArray, SWIFTPM_DEFAULT_IOS_DEPLOYMENT_TARGET, OS_IOS, ARCH_ARM64, NOT_ON_IOS, DELEGATE_CLASS, ARM64_MACRO, WASM_MACRO, ARCH_WASM32, C_WORDS, archEnvironments, codeMasks, codeMaskChars, CODE_MASK_CACHE_CHARS, FOUNDATION_NETWORKING_TYPES, FOUNDATION_OVERLAY_TYPES, FOUNDATION_OVERLAY_GLOBALS, CORE_FOUNDATION_OVERLAY_GLOBALS, CORE_FOUNDATION_GEOMETRY_TYPES, CORE_FOUNDATION_GRAPHICS_TYPES, CORE_FOUNDATION_HANDLE_IMPORTS, emptyMacroEnvironment, wasmMacroEnvironment, cPredefineTable, cPredefineCache, HIDDEN_UNITS, FIRST_WINS_PAIRS, LAST_WINS_PAIRS, VALUE_FLAGS, LIBXML_REFERENCE, LIBXML_SOURCE, ROOT_LOCKS, host, rootLocks, SHARED_ARTIFACT_BUDGET_BYTES, SHARED_ARTIFACT_GRACE_MS, RETIRED_PREFIX, retainedArtifacts, FRAMEWORK_LINK_TARGET, frameworkProductsReceiptSchema, SWIFT_LINK_STAMP, SWIFT_HOST_COMPILER_WRAPPER, SWIFT_FRAMEWORK_SLOTS, SWIFT_FRAMEWORK_UNOPTIMIZED_SLOTS, SWIFT_FRAMEWORK_SLOT_KEY, SWIFT_FRAMEWORK_SLOT_ORIGIN;
|
|
59790
|
+
var import_node_child_process40, import_node_crypto47, import_node_fs79, import_node_os16, import_node_path81, v6, WASM_TRIPLE, SWIFTPM_PROGRESS, SWIFTPM_NOISE, SWIFT_COMPILER_ENV_KEYS, distributionManifests, distributionCompileViews, REACH_STAGED_FRAMEWORKS, objcEnumerations, clangDeclarationEnumCache, objcEnumForward, sdkDeclarationOwners, swiftInterfaceDeclarations, linkedModuleDigests, compileSurfaces, SYSTEM_MODULE_LIBRARIES, SYSTEM_MODULE_IMPORT, OPTIONAL_FRAMEWORK_DEPENDENCIES, OPTIONAL_FRAMEWORKS, SWIFT_IMPORT, kleeneNot, kleeneAnd, kleeneOr, NON_IOS_MODULES, sdkPaths, availableModules, sdkOverlayFrameworks, DISTRIBUTION_CLANG_MODULES, CLANG_DISTRIBUTION_MODULES, ONE_PRODUCT, GAME_FAMILY, gameProducts, gameProduct, GAME_REACH, FOUNDATION_IMPLICIT_MODULES, FRAMEWORK_COMPANION_IMPORT, ONE_IMPLICIT_FLAGS, executableLinkFlags, darwinRecordsRegion, REACTOR_FLAG, MULTI_MANIFEST_VERSION, SWIFT_HEADER_PRODUCTS_TARGET, compilerSourceDigest, nativeCxxCompilerFlags, MODULE_MAP_RESPONSE_FILE_RUN, cFlagArray, cxxFlagArray, SWIFTPM_DEFAULT_IOS_DEPLOYMENT_TARGET, OS_IOS, ARCH_ARM64, NOT_ON_IOS, DELEGATE_CLASS, ARM64_MACRO, WASM_MACRO, ARCH_WASM32, C_WORDS, archEnvironments, codeMasks, codeMaskChars, CODE_MASK_CACHE_CHARS, FOUNDATION_NETWORKING_TYPES, FOUNDATION_OVERLAY_TYPES, FOUNDATION_OVERLAY_GLOBALS, CORE_FOUNDATION_OVERLAY_GLOBALS, CORE_FOUNDATION_GEOMETRY_TYPES, CORE_FOUNDATION_GRAPHICS_TYPES, CORE_FOUNDATION_HANDLE_IMPORTS, emptyMacroEnvironment, wasmMacroEnvironment, cPredefineTable, cPredefineCache, HIDDEN_UNITS, FIRST_WINS_PAIRS, LAST_WINS_PAIRS, VALUE_FLAGS, LIBXML_REFERENCE, LIBXML_SOURCE, ROOT_LOCKS, host, rootLocks, SHARED_ARTIFACT_BUDGET_BYTES, SHARED_ARTIFACT_GRACE_MS, RETIRED_PREFIX, retainedArtifacts, FRAMEWORK_LINK_TARGET, frameworkProductsReceiptSchema, SWIFT_LINK_STAMP, SWIFT_HOST_COMPILER_WRAPPER, SWIFT_FRAMEWORK_SLOTS, SWIFT_FRAMEWORK_UNOPTIMIZED_SLOTS, SWIFT_FRAMEWORK_SLOT_KEY, SWIFT_FRAMEWORK_SLOT_ORIGIN;
|
|
59263
59791
|
var init_swift_compile = __esm({
|
|
59264
59792
|
"src/swift-compile.ts"() {
|
|
59265
59793
|
"use strict";
|
|
@@ -59312,6 +59840,29 @@ var init_swift_compile = __esm({
|
|
|
59312
59840
|
WASM_TRIPLE = SWIFT_WASM_TRIPLE;
|
|
59313
59841
|
SWIFTPM_PROGRESS = /^\[\d+\/\d+\] /;
|
|
59314
59842
|
SWIFTPM_NOISE = /^(?:\[\d+\/\d+\] |Building for production\.\.\.$|warning: '--build-system native' has been deprecated)/;
|
|
59843
|
+
SWIFT_COMPILER_ENV_KEYS = [
|
|
59844
|
+
"PATH",
|
|
59845
|
+
"HOME",
|
|
59846
|
+
"USER",
|
|
59847
|
+
"LOGNAME",
|
|
59848
|
+
"LANG",
|
|
59849
|
+
"LC_ALL",
|
|
59850
|
+
"LC_CTYPE",
|
|
59851
|
+
"TZ",
|
|
59852
|
+
"SDKROOT",
|
|
59853
|
+
"DEVELOPER_DIR",
|
|
59854
|
+
"DYLD_LIBRARY_PATH",
|
|
59855
|
+
"SYSTEMROOT",
|
|
59856
|
+
"COMSPEC",
|
|
59857
|
+
"SSL_CERT_FILE",
|
|
59858
|
+
"SSL_CERT_DIR",
|
|
59859
|
+
"HTTP_PROXY",
|
|
59860
|
+
"HTTPS_PROXY",
|
|
59861
|
+
"NO_PROXY",
|
|
59862
|
+
"http_proxy",
|
|
59863
|
+
"https_proxy",
|
|
59864
|
+
"no_proxy"
|
|
59865
|
+
];
|
|
59315
59866
|
distributionManifests = /* @__PURE__ */ new Map();
|
|
59316
59867
|
distributionCompileViews = /* @__PURE__ */ new WeakMap();
|
|
59317
59868
|
REACH_STAGED_FRAMEWORKS = /* @__PURE__ */ new Set(["React"]);
|
|
@@ -59507,7 +60058,7 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
|
|
|
59507
60058
|
REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
|
|
59508
60059
|
MULTI_MANIFEST_VERSION = 76;
|
|
59509
60060
|
SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
|
|
59510
|
-
compilerSourceDigest = true ? "
|
|
60061
|
+
compilerSourceDigest = true ? "4d55fa7cbb29586c08e4e51867226f96047bae2103c89f4fa59d9cf3ed3862fb" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
|
|
59511
60062
|
nativeCxxCompilerFlags = ["-fno-cxx-modules"];
|
|
59512
60063
|
MODULE_MAP_RESPONSE_FILE_RUN = 16;
|
|
59513
60064
|
cFlagArray = (flags) => JSON.stringify(withoutGlogModuleMap(flags));
|
|
@@ -115908,7 +116459,10 @@ var init_oneNativeControlsContract = __esm({
|
|
|
115908
116459
|
ONE_NATIVE_CONTROLS_CONTRACT = "one-native-controls-v1";
|
|
115909
116460
|
ONE_NATIVE_CONTROLS_NAVIGATION_STACK_VIEW = "OneNativeNavigationStack";
|
|
115910
116461
|
ONE_NATIVE_CONTROLS_NAVIGATION_SPLIT_VIEW = "OneNativeNavigationSplitView";
|
|
115911
|
-
ONE_NATIVE_CONTROLS_VISUAL_VIEWS = [
|
|
116462
|
+
ONE_NATIVE_CONTROLS_VISUAL_VIEWS = [
|
|
116463
|
+
"OneNativeCircle",
|
|
116464
|
+
"OneNativeLinearGradient"
|
|
116465
|
+
];
|
|
115912
116466
|
}
|
|
115913
116467
|
});
|
|
115914
116468
|
|
|
@@ -115972,7 +116526,11 @@ async function oneNativeControlsPackage(appRoot, linkedGroups, sdk2) {
|
|
|
115972
116526
|
"OneNativeLabel",
|
|
115973
116527
|
"OneNativeText",
|
|
115974
116528
|
"OneNativeImage",
|
|
115975
|
-
...ONE_NATIVE_CONTROLS_VISUAL_VIEWS
|
|
116529
|
+
...ONE_NATIVE_CONTROLS_VISUAL_VIEWS,
|
|
116530
|
+
"OneNativeHStack",
|
|
116531
|
+
"OneNativeProgressView",
|
|
116532
|
+
"OneNativeSpacer",
|
|
116533
|
+
"OneNativeVStack"
|
|
115976
116534
|
],
|
|
115977
116535
|
linkedGroups
|
|
115978
116536
|
);
|
|
@@ -116278,12 +116836,37 @@ private class ControlComposition {
|
|
|
116278
116836
|
var children: [String: [UIView]] = [:]
|
|
116279
116837
|
var slots: [String: UIView] = [:]
|
|
116280
116838
|
var emit: ((String, String) -> Void)?
|
|
116839
|
+
private var leafMeasure: UIHostingController<AnyView>?
|
|
116840
|
+
private var measuredRoot: NSDictionary?
|
|
116841
|
+
private var intrinsicWidth: CGFloat?
|
|
116281
116842
|
|
|
116282
116843
|
func send(_ id: String, _ event: String, _ fields: Spec) {
|
|
116283
116844
|
let payload = try! JSONSerialization.data(withJSONObject: [id, event, fields])
|
|
116284
116845
|
emit?("dispatch", String(decoding: payload, as: UTF8.self))
|
|
116285
116846
|
}
|
|
116286
116847
|
|
|
116848
|
+
func measureLeafWidth(_ view: UIView, root: Spec) {
|
|
116849
|
+
let spec = root as NSDictionary
|
|
116850
|
+
guard measuredRoot != spec else { return }
|
|
116851
|
+
measuredRoot = spec
|
|
116852
|
+
let unconstrained = CGFloat.greatestFiniteMagnitude
|
|
116853
|
+
let proposal = CGSize(width: unconstrained, height: unconstrained)
|
|
116854
|
+
let width: CGFloat
|
|
116855
|
+
if let size = (view as? OneNativeDirectMeasure)?.directSizeThatFits(proposal) {
|
|
116856
|
+
width = size.width
|
|
116857
|
+
} else {
|
|
116858
|
+
guard let content = view as? OneNativeComposable else { return }
|
|
116859
|
+
let host = leafMeasure ?? UIHostingController(rootView: content.compositionContent())
|
|
116860
|
+
host.safeAreaRegions = []
|
|
116861
|
+
leafMeasure = host
|
|
116862
|
+
width = host.sizeThatFits(in: proposal).width
|
|
116863
|
+
}
|
|
116864
|
+
guard width.isFinite, width >= 0,
|
|
116865
|
+
intrinsicWidth.map({ abs(width - $0) >= 0.1 }) ?? true else { return }
|
|
116866
|
+
intrinsicWidth = width
|
|
116867
|
+
send(root["id"] as! String, "intrinsicWidth", ["width": width])
|
|
116868
|
+
}
|
|
116869
|
+
|
|
116287
116870
|
func reconcile(
|
|
116288
116871
|
_ next: [UIView],
|
|
116289
116872
|
previous: [UIView],
|
|
@@ -116421,6 +117004,7 @@ private class ControlComposition {
|
|
|
116421
117004
|
private struct ControlBridge: UIViewRepresentable {
|
|
116422
117005
|
let root: Spec
|
|
116423
117006
|
let emit: (String, String) -> Void
|
|
117007
|
+
let measureWidth: Bool
|
|
116424
117008
|
|
|
116425
117009
|
func makeCoordinator() -> ControlComposition { ControlComposition() }
|
|
116426
117010
|
|
|
@@ -116431,6 +117015,7 @@ private struct ControlBridge: UIViewRepresentable {
|
|
|
116431
117015
|
state.emit = emit
|
|
116432
117016
|
var visited = Set<String>()
|
|
116433
117017
|
let control = state.render(root, visited: &visited)
|
|
117018
|
+
if measureWidth { state.measureLeafWidth(control, root: root) }
|
|
116434
117019
|
if control.superview !== host {
|
|
116435
117020
|
host.subviews.forEach { $0.removeFromSuperview() }
|
|
116436
117021
|
control.frame = host.bounds
|
|
@@ -116720,7 +117305,7 @@ private struct NavigationSplitViewBridge: UIViewRepresentable {
|
|
|
116720
117305
|
default:
|
|
116721
117306
|
let root = spec["root"] as! Spec
|
|
116722
117307
|
precondition((root["spec"] as? Spec)?["control"] as? String == view)
|
|
116723
|
-
let bridge = ControlBridge(root: root, emit: emit)
|
|
117308
|
+
let bridge = ControlBridge(root: root, emit: emit, measureWidth: spec["measureWidth"] as? Bool == true)
|
|
116724
117309
|
.frame(minWidth: 0, maxWidth: .infinity, maxHeight: .infinity)
|
|
116725
117310
|
let height = (spec["height"] as? Double).map { CGFloat($0) }
|
|
116726
117311
|
return AnyView(bridge.frame(height: height))
|
|
@@ -121159,7 +121744,7 @@ var init_nitro_superset = __esm({
|
|
|
121159
121744
|
init_nitroContract();
|
|
121160
121745
|
init_swift_standin_digest();
|
|
121161
121746
|
NITRO_SUPERSET_ENTRY_NAME = "superset";
|
|
121162
|
-
NITRO_COMPILER_DIGEST = true ? "
|
|
121747
|
+
NITRO_COMPILER_DIGEST = true ? "e035fd2365cc4b70f472d1b90eb9d912a775ab289e281922a22092c6945c4f46" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
|
|
121163
121748
|
nitroSupersetLock = parseLock(nitro_superset_lock_default);
|
|
121164
121749
|
nitroSupersetKey = (inputs2) => nativeEntryKey({ ...inputs2, compiler: NITRO_COMPILER_DIGEST });
|
|
121165
121750
|
published3 = /* @__PURE__ */ new Map();
|