peachsim 0.1.2590 → 0.1.2591
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 +323 -93
- 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-65FNEARV.mjs → acorn-EMX4WZ72.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-NZY4GOG5.mjs → chunk-4QHHRGO4.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-SRFKOU76.mjs → chunk-7627LKJK.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-BZS5SIYK.mjs → chunk-AKKHSVJ4.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-WPDY5IAD.mjs → chunk-EGKH2L6J.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-JG4AANWA.mjs → chunk-ILWFGZWW.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-SLPXTLBK.mjs → chunk-J676B57D.mjs} +5 -5
- package/dist-lib/esm-chunks/{chunk-ADKUIQXX.mjs → chunk-JHXDM3YU.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-RGC2JNCL.mjs → chunk-MC6NMYWY.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-HZTK7TP5.mjs → chunk-NX23AMX4.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-2GUB5OLB.mjs → chunk-Q4NA6PUR.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-EFKDUMB5.mjs → chunk-QBMFX3J2.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-462CWTWI.mjs → chunk-RKQZGWX2.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-5GNGHM5B.mjs → chunk-SOAYP72T.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-YPPH6F77.mjs → chunk-TFG4LZ5T.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-OZJ66CXY.mjs → chunk-UIVXVMS5.mjs} +2 -2
- package/dist-lib/esm-chunks/{chunk-X2EKFONU.mjs → chunk-UYJXLDCG.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-N2II5SRJ.mjs → chunk-VD27WNCT.mjs} +4 -4
- package/dist-lib/esm-chunks/{chunk-V5TTEXYO.mjs → chunk-VF5WVB3D.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-WYDRQRJL.mjs → chunk-VRVXRZI4.mjs} +5 -5
- package/dist-lib/esm-chunks/{chunk-4VCRUQ36.mjs → chunk-VYZ5DC3M.mjs} +194 -48
- package/dist-lib/esm-chunks/{chunk-GBD26EBV.mjs → chunk-YR6DNV76.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-XE3VHAU2.mjs → chunk-ZL5N6ENT.mjs} +1 -1
- package/dist-lib/esm-chunks/{metro-layout-parser-CRI3GMCM.mjs → metro-layout-parser-ANKZARNW.mjs} +3 -3
- package/dist-lib/esm-chunks/{swift-package-prebuilt-5XDZ2HZZ.mjs → swift-package-prebuilt-4N5CXBOZ.mjs} +10 -10
- package/dist-lib/esm-chunks/{swift-sdk-app-module-6H3G6AXD.mjs → swift-sdk-app-module-5IUSRXYA.mjs} +151 -67
- package/dist-lib/esm-chunks/{swift-sdk-image-WAC7GG2R.mjs → swift-sdk-image-7T2LMQS5.mjs} +14 -14
- package/dist-lib/esm-chunks/{swift-sdk-image-producer-B3L27QTG.mjs → swift-sdk-image-producer-7QJ3BF6E.mjs} +4 -4
- package/dist-lib/expo-swift-bundle.cjs +322 -92
- 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 +323 -93
- package/dist-lib/host/fetch-proxy-handler.cjs +4 -4
- 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 +2 -2
- 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 +323 -93
- package/dist-lib/swift-compile.cjs +320 -90
- 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/kotlin/sdk.tar.gz +0 -0
- package/package.json +1 -1
- package/src/swift-guest-compile.ts +41 -8
- package/src/swift-guest-link.ts +3 -0
- package/src/swift-guest-source-inputs.ts +158 -30
- package/src/swift-sdk-app-module.ts +146 -59
package/dist-lib/esm-chunks/{swift-sdk-app-module-6H3G6AXD.mjs → swift-sdk-app-module-5IUSRXYA.mjs}
RENAMED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2591 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
import {
|
|
3
3
|
SWIFT_SDK_APP_MEMORY_BASE,
|
|
4
4
|
SWIFT_SDK_APP_TABLE_BASE,
|
|
5
5
|
SWIFT_SDK_MEMORY_BASE,
|
|
6
6
|
SWIFT_SDK_PIECE_FIELDS,
|
|
7
7
|
readSwiftSdkManifest
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-VRVXRZI4.mjs";
|
|
9
|
+
import "./chunk-J676B57D.mjs";
|
|
10
|
+
import "./chunk-7627LKJK.mjs";
|
|
11
|
+
import "./chunk-VF5WVB3D.mjs";
|
|
12
12
|
import {
|
|
13
13
|
ADDEND_RELOCATIONS,
|
|
14
14
|
KEEP_WASM_NAMES,
|
|
@@ -36,17 +36,17 @@ import {
|
|
|
36
36
|
wasmReader,
|
|
37
37
|
wasmSections,
|
|
38
38
|
writeWasmCustomSection
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-VYZ5DC3M.mjs";
|
|
40
40
|
import {
|
|
41
41
|
SWIFT_WASM_TRIPLE
|
|
42
|
-
} from "./chunk-
|
|
43
|
-
import "./chunk-
|
|
44
|
-
import "./chunk-
|
|
45
|
-
import "./chunk-
|
|
46
|
-
import "./chunk-
|
|
47
|
-
import "./chunk-
|
|
48
|
-
import "./chunk-
|
|
49
|
-
import "./chunk-
|
|
42
|
+
} from "./chunk-ILWFGZWW.mjs";
|
|
43
|
+
import "./chunk-SOAYP72T.mjs";
|
|
44
|
+
import "./chunk-YR6DNV76.mjs";
|
|
45
|
+
import "./chunk-MC6NMYWY.mjs";
|
|
46
|
+
import "./chunk-JHXDM3YU.mjs";
|
|
47
|
+
import "./chunk-TFG4LZ5T.mjs";
|
|
48
|
+
import "./chunk-EGKH2L6J.mjs";
|
|
49
|
+
import "./chunk-4QHHRGO4.mjs";
|
|
50
50
|
|
|
51
51
|
// src/swift-sdk-app-module.ts
|
|
52
52
|
import { execFile } from "node:child_process";
|
|
@@ -211,15 +211,18 @@ async function compileSdkForwarders(inputs, sdk, toolchainBin, output, project,
|
|
|
211
211
|
index++;
|
|
212
212
|
}
|
|
213
213
|
const errno = tls.errno;
|
|
214
|
+
let declaredErrno = false;
|
|
214
215
|
for (const name of referenced) {
|
|
215
216
|
const offset = tls[name];
|
|
216
217
|
if (offset === void 0 || defined.has(name)) continue;
|
|
217
218
|
if (errno === void 0 || signatures.__errno_location !== ":j")
|
|
218
219
|
throw new Error("the sdk image has no errno to find its thread block by");
|
|
219
|
-
if (!
|
|
220
|
+
if (!declaredErrno) {
|
|
221
|
+
declaredErrno = true;
|
|
220
222
|
lines.push(
|
|
221
223
|
`__attribute__((import_module("env"), import_name("__errno_location"))) char *__peach_errno(void);`
|
|
222
224
|
);
|
|
225
|
+
}
|
|
223
226
|
lines.push(
|
|
224
227
|
`__attribute__((weak)) _Thread_local char t${index} __asm__(${literal(name)});`,
|
|
225
228
|
`__attribute__((used)) long long h${index}(void) __asm__(${literal(SDK_TLS_HELPER + name)});`,
|
|
@@ -638,6 +641,20 @@ function resolveSdkReferences(source, sdk, forwarders) {
|
|
|
638
641
|
symbols.filter((symbol) => symbol.kind === 0 && symbol.name.startsWith(SDK_TLS_HELPER)).map((symbol) => [symbol.name.slice(SDK_TLS_HELPER.length), symbol.index])
|
|
639
642
|
);
|
|
640
643
|
const segments = guestWasmDataSegments(bytes, false);
|
|
644
|
+
const segmentsByOffset = [...segments].sort((a, b) => a.offset - b.offset);
|
|
645
|
+
const segmentNameSet = new Set(segmentNames);
|
|
646
|
+
const findSegmentByOffset = (at, size) => {
|
|
647
|
+
let lo = 0;
|
|
648
|
+
let hi = segmentsByOffset.length - 1;
|
|
649
|
+
while (lo <= hi) {
|
|
650
|
+
const mid = lo + hi >> 1;
|
|
651
|
+
const entry = segmentsByOffset[mid];
|
|
652
|
+
if (at < entry.offset) hi = mid - 1;
|
|
653
|
+
else if (at >= entry.offset + entry.length) lo = mid + 1;
|
|
654
|
+
else return at + size <= entry.offset + entry.length ? entry : void 0;
|
|
655
|
+
}
|
|
656
|
+
return void 0;
|
|
657
|
+
};
|
|
641
658
|
const tdata = segmentNames.indexOf(".tdata");
|
|
642
659
|
const tlsTemplate = tdata < 0 ? void 0 : passiveSegments(bytes)[tdata];
|
|
643
660
|
const tlsStart = tlsTemplate && tlsTemplate.byteOffset - bytes.byteOffset;
|
|
@@ -702,7 +719,7 @@ function resolveSdkReferences(source, sdk, forwarders) {
|
|
|
702
719
|
const encoding = width.width;
|
|
703
720
|
if (kind === "address" && target.id === 11 && encoding === "u64" && addend === 0n) {
|
|
704
721
|
const section = OBJC_SECTION_BOUNDARY.exec(name)?.[1];
|
|
705
|
-
if (section && !
|
|
722
|
+
if (section && !segmentNameSet.has(section)) {
|
|
706
723
|
bytes.fill(0, at, at + 8);
|
|
707
724
|
continue;
|
|
708
725
|
}
|
|
@@ -714,9 +731,7 @@ function resolveSdkReferences(source, sdk, forwarders) {
|
|
|
714
731
|
if (tlsStart !== void 0 && at >= tlsStart && at < tlsStart + tlsTemplate.length)
|
|
715
732
|
linkage.tls.push(at - tlsStart, size, value);
|
|
716
733
|
else {
|
|
717
|
-
const segment =
|
|
718
|
-
(entry) => at >= entry.offset && at + size <= entry.offset + entry.length
|
|
719
|
-
);
|
|
734
|
+
const segment = findSegmentByOffset(at, size);
|
|
720
735
|
if (!segment)
|
|
721
736
|
throw new Error(`Swift SDK relocation has no load address for ${name}`);
|
|
722
737
|
linkage.data.push(segment.address + at - segment.offset, size, value);
|
|
@@ -760,15 +775,29 @@ function resolveSdkReferences(source, sdk, forwarders) {
|
|
|
760
775
|
}
|
|
761
776
|
}
|
|
762
777
|
}
|
|
763
|
-
const
|
|
778
|
+
const encodedNameBuf = (name) => {
|
|
779
|
+
const raw = Buffer.from(name, "utf8");
|
|
780
|
+
const len = uleb(raw.length);
|
|
781
|
+
const out = Buffer.allocUnsafe(len.length + raw.length);
|
|
782
|
+
for (let i = 0; i < len.length; i++) out[i] = len[i];
|
|
783
|
+
raw.copy(out, len.length);
|
|
784
|
+
return out;
|
|
785
|
+
};
|
|
786
|
+
const importParts = [];
|
|
787
|
+
let importEntryCount = imports.length + 1;
|
|
788
|
+
for (const entry of imports) {
|
|
764
789
|
const slot = entry.kind === 0 && entry.module === "env" ? functionSlots.get(entry.name) : void 0;
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
}
|
|
771
|
-
|
|
790
|
+
importParts.push(
|
|
791
|
+
encodedNameBuf(slot === void 0 ? entry.module : NATIVE_SDK_IMPORT_MODULE),
|
|
792
|
+
encodedNameBuf(slot === void 0 ? entry.name : String(slot)),
|
|
793
|
+
bytes.subarray(entry.start, entry.end)
|
|
794
|
+
);
|
|
795
|
+
}
|
|
796
|
+
importParts.push(
|
|
797
|
+
encodedNameBuf("env"),
|
|
798
|
+
encodedNameBuf("__stack_pointer"),
|
|
799
|
+
Buffer.from([3, 126, 1])
|
|
800
|
+
);
|
|
772
801
|
const tags = sections.find((section) => section.id === 13);
|
|
773
802
|
if (tags) {
|
|
774
803
|
const r = wasmReader(bytes, tags.start);
|
|
@@ -783,15 +812,18 @@ function resolveSdkReferences(source, sdk, forwarders) {
|
|
|
783
812
|
throw new Error(
|
|
784
813
|
`Swift app defines an exception tag the sdk does not own: ${name}`
|
|
785
814
|
);
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
4,
|
|
790
|
-
|
|
791
|
-
|
|
815
|
+
importParts.push(
|
|
816
|
+
encodedNameBuf("env"),
|
|
817
|
+
encodedNameBuf(name),
|
|
818
|
+
Buffer.from([4]),
|
|
819
|
+
bytes.subarray(start, r.at)
|
|
820
|
+
);
|
|
821
|
+
importEntryCount++;
|
|
792
822
|
}
|
|
793
823
|
}
|
|
794
|
-
const
|
|
824
|
+
const globalParts = [
|
|
825
|
+
Buffer.from(uleb(globalCount - 1 + syntheticGlobals.length))
|
|
826
|
+
];
|
|
795
827
|
for (let index = 0; index < globalCount; index++) {
|
|
796
828
|
const start = gr.at;
|
|
797
829
|
const type = gr.byte();
|
|
@@ -803,12 +835,12 @@ function resolveSdkReferences(source, sdk, forwarders) {
|
|
|
803
835
|
if (gr.byte() !== 11) throw new Error("app global initializer has no end");
|
|
804
836
|
if (index === 0) continue;
|
|
805
837
|
const value = got.get(index);
|
|
806
|
-
if (value === void 0)
|
|
807
|
-
else
|
|
838
|
+
if (value === void 0) globalParts.push(bytes.subarray(start, gr.at));
|
|
839
|
+
else globalParts.push(Buffer.from([type, 1, type === 126 ? 66 : 65, 0, 11]));
|
|
808
840
|
}
|
|
809
841
|
for (const type of syntheticGlobals) {
|
|
810
842
|
const zero = type === 125 ? [67, 0, 0, 0, 0] : type === 124 ? [68, 0, 0, 0, 0, 0, 0, 0, 0] : [type === 126 ? 66 : 65, 0];
|
|
811
|
-
|
|
843
|
+
globalParts.push(Buffer.from([type, 1, ...zero, 11]));
|
|
812
844
|
}
|
|
813
845
|
const exportSection = sections.find((s) => s.id === 7);
|
|
814
846
|
if (!exportSection) throw new Error("app link has no exports");
|
|
@@ -831,24 +863,21 @@ function resolveSdkReferences(source, sdk, forwarders) {
|
|
|
831
863
|
throw new Error("Swift app exceeds its reserved static memory range");
|
|
832
864
|
}
|
|
833
865
|
}
|
|
866
|
+
const exportParts = [
|
|
867
|
+
Buffer.from(uleb(exportCount + 1 + got.size)),
|
|
868
|
+
bytes.subarray(originalExportsStart, exportSection.end)
|
|
869
|
+
];
|
|
870
|
+
for (const [index, value] of got) {
|
|
871
|
+
exportParts.push(
|
|
872
|
+
encodedNameBuf(`${NATIVE_SDK_GLOBAL_PREFIX}${value}.${index}`),
|
|
873
|
+
Buffer.from([3, ...uleb(index)])
|
|
874
|
+
);
|
|
875
|
+
}
|
|
876
|
+
exportParts.push(encodedNameBuf("__indirect_function_table"), Buffer.from([1, 0]));
|
|
834
877
|
const replaced = /* @__PURE__ */ new Map([
|
|
835
|
-
[2, [
|
|
836
|
-
[6,
|
|
837
|
-
[
|
|
838
|
-
7,
|
|
839
|
-
[
|
|
840
|
-
...uleb(exportCount + 1 + got.size),
|
|
841
|
-
...bytes.subarray(originalExportsStart, exportSection.end),
|
|
842
|
-
...[...got].flatMap(([index, value]) => [
|
|
843
|
-
...encodedName(`${NATIVE_SDK_GLOBAL_PREFIX}${value}.${index}`),
|
|
844
|
-
3,
|
|
845
|
-
...uleb(index)
|
|
846
|
-
]),
|
|
847
|
-
...encodedName("__indirect_function_table"),
|
|
848
|
-
1,
|
|
849
|
-
0
|
|
850
|
-
]
|
|
851
|
-
]
|
|
878
|
+
[2, Buffer.concat([Buffer.from(uleb(importEntryCount)), ...importParts])],
|
|
879
|
+
[6, Buffer.concat(globalParts)],
|
|
880
|
+
[7, Buffer.concat(exportParts)]
|
|
852
881
|
]);
|
|
853
882
|
const rebuiltCode = expanded.length ? expandSdkRelocations(
|
|
854
883
|
bytes,
|
|
@@ -860,9 +889,13 @@ function resolveSdkReferences(source, sdk, forwarders) {
|
|
|
860
889
|
if (s === tags || s.name === "linking" || s.name?.startsWith("reloc.") || s.name === ".swift1_autolink_entries")
|
|
861
890
|
continue;
|
|
862
891
|
const payload = replaced.get(s.id);
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
)
|
|
892
|
+
if (s.id === 10 && rebuiltCode) {
|
|
893
|
+
parts.push(rebuiltCode);
|
|
894
|
+
} else if (payload) {
|
|
895
|
+
parts.push(Buffer.from([s.id, ...uleb(payload.length)]), payload);
|
|
896
|
+
} else {
|
|
897
|
+
parts.push(bytes.subarray(s.offset, s.end));
|
|
898
|
+
}
|
|
866
899
|
}
|
|
867
900
|
return { bytes: Buffer.concat(parts), linkage };
|
|
868
901
|
}
|
|
@@ -970,6 +1003,49 @@ function readSwiftSdkUsage(mapFile, linkedFile, sdkObjects) {
|
|
|
970
1003
|
constructors: [...new Set(constructorKeys(map, readFileSync(linkedFile)))]
|
|
971
1004
|
};
|
|
972
1005
|
}
|
|
1006
|
+
function swiftSdkProjectionSpans(sdk, imageFor) {
|
|
1007
|
+
const { manifest, block } = readSwiftSdkManifest(sdk);
|
|
1008
|
+
const guestObjects = manifest.guestObjects;
|
|
1009
|
+
if (!guestObjects) return [];
|
|
1010
|
+
const { strings } = manifest;
|
|
1011
|
+
const fields = block("pieces");
|
|
1012
|
+
const ordered = [];
|
|
1013
|
+
for (let i = 0; i < fields.length; i += SWIFT_SDK_PIECE_FIELDS) {
|
|
1014
|
+
const size = fields[i + 1];
|
|
1015
|
+
if (!size) continue;
|
|
1016
|
+
ordered.push({
|
|
1017
|
+
address: fields[i],
|
|
1018
|
+
size,
|
|
1019
|
+
object: strings[fields[i + 3]]
|
|
1020
|
+
});
|
|
1021
|
+
}
|
|
1022
|
+
ordered.sort((a, b) => a.address - b.address);
|
|
1023
|
+
const imageOf = (object) => {
|
|
1024
|
+
const product = guestObjects[object]?.product;
|
|
1025
|
+
return product === void 0 ? void 0 : imageFor(object, product);
|
|
1026
|
+
};
|
|
1027
|
+
const spans = [];
|
|
1028
|
+
for (let index = 0; index < ordered.length; index++) {
|
|
1029
|
+
const { object, address, size } = ordered[index];
|
|
1030
|
+
const image = imageOf(object);
|
|
1031
|
+
if (image === void 0) continue;
|
|
1032
|
+
let next = index + 1;
|
|
1033
|
+
while (next < ordered.length && ordered[next].address < address + size) next++;
|
|
1034
|
+
const end = ordered[next]?.address ?? address + size;
|
|
1035
|
+
spans.push({ image, space: "linear-memory", address, length: end - address });
|
|
1036
|
+
}
|
|
1037
|
+
const functionKeys = block("functions");
|
|
1038
|
+
const slots = block("functionSlots");
|
|
1039
|
+
for (let index = 0; index < functionKeys.length; index++) {
|
|
1040
|
+
const slot = slots[index];
|
|
1041
|
+
if (!slot) continue;
|
|
1042
|
+
const key = strings[functionKeys[index]];
|
|
1043
|
+
const image = imageOf(key.slice(0, key.indexOf(":")));
|
|
1044
|
+
if (image !== void 0)
|
|
1045
|
+
spans.push({ image, space: "function-table", address: slot, length: 1 });
|
|
1046
|
+
}
|
|
1047
|
+
return spans;
|
|
1048
|
+
}
|
|
973
1049
|
function selectSwiftSdkData(sdk, usage, linkage, projection) {
|
|
974
1050
|
const { manifest, block, segments } = readSwiftSdkManifest(sdk);
|
|
975
1051
|
const { strings } = manifest;
|
|
@@ -992,15 +1068,24 @@ function selectSwiftSdkData(sdk, usage, linkage, projection) {
|
|
|
992
1068
|
});
|
|
993
1069
|
}
|
|
994
1070
|
const memory = new Map(segments.map((segment) => [segment.name, segment]));
|
|
995
|
-
|
|
1071
|
+
let lastSegment = segments[0];
|
|
1072
|
+
const segmentAt = (address2, size) => {
|
|
1073
|
+
if (lastSegment && address2 >= lastSegment.address && address2 + size <= lastSegment.address + lastSegment.data.length)
|
|
1074
|
+
return lastSegment;
|
|
996
1075
|
for (const segment of segments)
|
|
997
|
-
if (address2 >= segment.address && address2 + size <= segment.address + segment.data.length)
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
);
|
|
1076
|
+
if (address2 >= segment.address && address2 + size <= segment.address + segment.data.length) {
|
|
1077
|
+
lastSegment = segment;
|
|
1078
|
+
return segment;
|
|
1079
|
+
}
|
|
1002
1080
|
return void 0;
|
|
1003
1081
|
};
|
|
1082
|
+
const read = (address2, size) => {
|
|
1083
|
+
const segment = segmentAt(address2, size);
|
|
1084
|
+
return segment?.data.subarray(
|
|
1085
|
+
address2 - segment.address,
|
|
1086
|
+
address2 - segment.address + size
|
|
1087
|
+
);
|
|
1088
|
+
};
|
|
1004
1089
|
const appSectionsByObject = /* @__PURE__ */ new Map();
|
|
1005
1090
|
const appSections = /* @__PURE__ */ new Set();
|
|
1006
1091
|
const appSymbols = /* @__PURE__ */ new Set();
|
|
@@ -1106,9 +1191,7 @@ function selectSwiftSdkData(sdk, usage, linkage, projection) {
|
|
|
1106
1191
|
const classAddress = Number(
|
|
1107
1192
|
new DataView(field.buffer, field.byteOffset, 8).getBigUint64(0, true)
|
|
1108
1193
|
);
|
|
1109
|
-
const segment =
|
|
1110
|
-
({ address: address3, data }) => classAddress >= address3 && classAddress < address3 + data.length
|
|
1111
|
-
);
|
|
1194
|
+
const segment = segmentAt(classAddress, 1);
|
|
1112
1195
|
if (!segment) continue;
|
|
1113
1196
|
const start = classAddress - segment.address;
|
|
1114
1197
|
const end = segment.data.indexOf(0, start);
|
|
@@ -1316,7 +1399,7 @@ function selectSwiftSdkData(sdk, usage, linkage, projection) {
|
|
|
1316
1399
|
if (current)
|
|
1317
1400
|
runs.push({
|
|
1318
1401
|
address: current.address,
|
|
1319
|
-
bytes:
|
|
1402
|
+
bytes: Buffer.concat(current.parts)
|
|
1320
1403
|
});
|
|
1321
1404
|
};
|
|
1322
1405
|
for (const piece of loaded) {
|
|
@@ -1457,5 +1540,6 @@ export {
|
|
|
1457
1540
|
readSwiftSdkUsage,
|
|
1458
1541
|
selectSwiftSdkData,
|
|
1459
1542
|
swiftAppModuleInputs,
|
|
1543
|
+
swiftSdkProjectionSpans,
|
|
1460
1544
|
writeSwiftSdkAppLink
|
|
1461
1545
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2591 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
import {
|
|
3
3
|
SWIFT_SDK_APP_MEMORY_BASE,
|
|
4
4
|
SWIFT_SDK_APP_TABLE_BASE,
|
|
@@ -15,19 +15,19 @@ import {
|
|
|
15
15
|
swiftSdkImageFile,
|
|
16
16
|
swiftSdkImageKey,
|
|
17
17
|
swiftSdkImageProducts
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import "./chunk-
|
|
29
|
-
import "./chunk-
|
|
30
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-VRVXRZI4.mjs";
|
|
19
|
+
import "./chunk-J676B57D.mjs";
|
|
20
|
+
import "./chunk-7627LKJK.mjs";
|
|
21
|
+
import "./chunk-VF5WVB3D.mjs";
|
|
22
|
+
import "./chunk-VYZ5DC3M.mjs";
|
|
23
|
+
import "./chunk-ILWFGZWW.mjs";
|
|
24
|
+
import "./chunk-SOAYP72T.mjs";
|
|
25
|
+
import "./chunk-YR6DNV76.mjs";
|
|
26
|
+
import "./chunk-MC6NMYWY.mjs";
|
|
27
|
+
import "./chunk-JHXDM3YU.mjs";
|
|
28
|
+
import "./chunk-TFG4LZ5T.mjs";
|
|
29
|
+
import "./chunk-EGKH2L6J.mjs";
|
|
30
|
+
import "./chunk-4QHHRGO4.mjs";
|
|
31
31
|
export {
|
|
32
32
|
SWIFT_SDK_APP_MEMORY_BASE,
|
|
33
33
|
SWIFT_SDK_APP_TABLE_BASE,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2591 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
import {
|
|
3
3
|
swiftCacheDir,
|
|
4
4
|
windowAdmission,
|
|
5
5
|
withSwiftRootLock
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ILWFGZWW.mjs";
|
|
7
7
|
import {
|
|
8
8
|
isRecord
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-EGKH2L6J.mjs";
|
|
10
|
+
import "./chunk-4QHHRGO4.mjs";
|
|
11
11
|
|
|
12
12
|
// src/swift-sdk-image-producer.ts
|
|
13
13
|
import { execFile, execFileSync } from "node:child_process";
|