peachsim 0.1.2600 → 0.1.2602
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/commands/detect.ts +16 -10
- 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 +11432 -11074
- 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 +11 -2276
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/esm-chunks/{acorn-FGRSVFK5.mjs → acorn-OY6WD7QV.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-GTJLYHLX.mjs → chunk-4RQOWOMT.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-RFLRGBWJ.mjs → chunk-7T3ACQVD.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-ZPZHTSVV.mjs → chunk-A4ONOIAH.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-7VUNHZJ4.mjs → chunk-DW7F2DCV.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-F72K7HJL.mjs → chunk-FTNF3J4Y.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-DB24TNAU.mjs → chunk-GCFOJXHC.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-23YC72IU.mjs → chunk-HA4NBBPR.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-66EJ2CSG.mjs → chunk-I47W3MVR.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-GNN4EGGX.mjs → chunk-I7DN6IVP.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-R5YW43IZ.mjs → chunk-IH7VXRII.mjs} +4 -4
- package/dist-lib/esm-chunks/{chunk-CC6C72OW.mjs → chunk-IUZHDZYD.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-FQRSMKOT.mjs → chunk-JFRVR54X.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-46MZJPMK.mjs → chunk-K5IL7A47.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-BVRFDE5A.mjs → chunk-OPEVMW4Z.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-C2BC7GUJ.mjs → chunk-PRC3KSZK.mjs} +2 -2
- package/dist-lib/esm-chunks/{chunk-7O5GHZNG.mjs → chunk-QREYIKY5.mjs} +5 -5
- package/dist-lib/esm-chunks/{chunk-IEXENIW2.mjs → chunk-RS3CUH42.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-IANEFUXF.mjs → chunk-T22TWE3B.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-LLIEH2SU.mjs → chunk-T6MXHYHI.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-T7BVUONU.mjs → chunk-VZORKVTY.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-C3YFMHVW.mjs → chunk-WKCN2CSK.mjs} +5 -5
- package/dist-lib/esm-chunks/{chunk-G2OL3VLT.mjs → chunk-ZDI63AW4.mjs} +1024 -653
- package/dist-lib/esm-chunks/{metro-layout-parser-WVDFEJTE.mjs → metro-layout-parser-2ERWNLZ7.mjs} +3 -3
- package/dist-lib/esm-chunks/{swift-package-prebuilt-FRKYWMMQ.mjs → swift-package-prebuilt-SP4MCJOF.mjs} +10 -10
- package/dist-lib/esm-chunks/{swift-sdk-app-module-TMDS6TCR.mjs → swift-sdk-app-module-LXIPYGVM.mjs} +14 -14
- package/dist-lib/esm-chunks/{swift-sdk-image-73TU5HWR.mjs → swift-sdk-image-RTRI5IV4.mjs} +14 -14
- package/dist-lib/esm-chunks/{swift-sdk-image-producer-WJTPYSJ4.mjs → swift-sdk-image-producer-7NXHRRJE.mjs} +4 -4
- package/dist-lib/expo-swift-bundle.cjs +12833 -12475
- 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 +12809 -12451
- package/dist-lib/host/fetch-proxy-handler.cjs +5434 -5422
- 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 +10 -2275
- 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 +23 -11
- 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 +82 -81
- package/dist-lib/public-origins-lib.json +372 -429
- 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 +1093 -735
- package/dist-lib/swift-compile.cjs +1029 -652
- 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/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/java-platform/licenses/android.txt +3 -0
- package/java-platform/licenses/openjdk.txt +9 -2
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +1 -2
- package/src/device-catalog.ts +4 -5
- package/src/ios-version.ts +8 -0
- package/src/swift-guest-compile.ts +5 -3
- package/src/swift-guest-image-ledger.ts +563 -264
- package/src/swift-guest-link.ts +628 -468
- package/src/wasm-binary-sections.ts +1 -1
package/dist-lib/skills.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2602 | (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;
|
|
@@ -35538,13 +35538,13 @@ var init_swift_standin_digest = __esm({
|
|
|
35538
35538
|
STANDIN_DIGEST_ENTRYPOINTS = ["swift-standins.ts", "swift-objc-compile.ts"];
|
|
35539
35539
|
SPECIFIER = /from\s*['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
35540
35540
|
standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
|
|
35541
|
-
STANDIN_SOURCE_DIGEST = true ? "
|
|
35541
|
+
STANDIN_SOURCE_DIGEST = true ? "cb9d3dbcce3fdc3dbbec1990247cf5b2a1f9fd7cd32791740e313792bd8bcfcc" : standinSourceDigest();
|
|
35542
35542
|
}
|
|
35543
35543
|
});
|
|
35544
35544
|
|
|
35545
35545
|
// src/expo-native-compiler-digest.ts
|
|
35546
35546
|
function expoNativeCompilerDigestValue() {
|
|
35547
|
-
return true ? "
|
|
35547
|
+
return true ? "44397a0b3e88337f5b32aff5624195731368bcaedc23469e69cd426953557f58" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
|
|
35548
35548
|
}
|
|
35549
35549
|
var import_node_crypto12;
|
|
35550
35550
|
var init_expo_native_compiler_digest = __esm({
|
|
@@ -50561,7 +50561,6 @@ var init_detect = __esm({
|
|
|
50561
50561
|
import_node_child_process18 = require("node:child_process");
|
|
50562
50562
|
import_node_fs45 = require("node:fs");
|
|
50563
50563
|
import_node_path42 = require("node:path");
|
|
50564
|
-
init_browser();
|
|
50565
50564
|
init_nodeRepoFileReader();
|
|
50566
50565
|
CONFIG_EXTENSIONS = ["ts", "js", "cjs", "mjs", "mts", "cts"];
|
|
50567
50566
|
REPORT_SKIP_DIRS = /* @__PURE__ */ new Set([
|
|
@@ -51304,6 +51303,14 @@ var init_runtimePlatformContract = __esm({
|
|
|
51304
51303
|
}
|
|
51305
51304
|
});
|
|
51306
51305
|
|
|
51306
|
+
// src/ios-version.ts
|
|
51307
|
+
var init_ios_version = __esm({
|
|
51308
|
+
"src/ios-version.ts"() {
|
|
51309
|
+
"use strict";
|
|
51310
|
+
init_runtimePlatformContract();
|
|
51311
|
+
}
|
|
51312
|
+
});
|
|
51313
|
+
|
|
51307
51314
|
// src/device-catalog.ts
|
|
51308
51315
|
function modernButtons(action, volumeUp, volumeDown, power) {
|
|
51309
51316
|
return {
|
|
@@ -51415,7 +51422,7 @@ var LEGACY_HARDWARE_BUTTONS, PIXEL_HARDWARE_BUTTONS, GALAXY_HARDWARE_BUTTONS, AN
|
|
|
51415
51422
|
var init_device_catalog = __esm({
|
|
51416
51423
|
"src/device-catalog.ts"() {
|
|
51417
51424
|
"use strict";
|
|
51418
|
-
|
|
51425
|
+
init_ios_version();
|
|
51419
51426
|
LEGACY_HARDWARE_BUTTONS = {
|
|
51420
51427
|
width: 2.5,
|
|
51421
51428
|
lock: { side: "right", top: 188.7, height: 68.1 },
|
|
@@ -62527,13 +62534,24 @@ function llvmType(value) {
|
|
|
62527
62534
|
throw new Error(`unsupported wasm function value type ${value}`);
|
|
62528
62535
|
}
|
|
62529
62536
|
}
|
|
62537
|
+
function concatParts(parts2) {
|
|
62538
|
+
let total = 0;
|
|
62539
|
+
for (let i = 0; i < parts2.length; i++) total += parts2[i].byteLength;
|
|
62540
|
+
const out = Buffer.allocUnsafe(total);
|
|
62541
|
+
let offset = 0;
|
|
62542
|
+
for (let i = 0; i < parts2.length; i++) {
|
|
62543
|
+
const part = parts2[i];
|
|
62544
|
+
out.set(part, offset);
|
|
62545
|
+
offset += part.byteLength;
|
|
62546
|
+
}
|
|
62547
|
+
return out;
|
|
62548
|
+
}
|
|
62530
62549
|
function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLookups, preserveCanonical, options2 = {}) {
|
|
62531
62550
|
if (!isWasmMagic(bytes)) throw new Error("expected wasm object");
|
|
62532
62551
|
const rawBuf = Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
62533
|
-
const { sdkLookupOnly, sdkProduct, collectRewrittenSymbols } = options2;
|
|
62552
|
+
const { sdkLookupOnly, sdkProduct, collectRewrittenSymbols, scan: scan3 } = options2;
|
|
62534
62553
|
const comdatScope = sdkProduct === void 0 ? callerAlias : `${callerAlias}:${sdkProduct}`;
|
|
62535
62554
|
const rewrite = binding !== void 0;
|
|
62536
|
-
const sections = rewrite ? [bytes.subarray(0, 8)] : void 0;
|
|
62537
62555
|
const types2 = [];
|
|
62538
62556
|
const functionTypes = [];
|
|
62539
62557
|
const definitions = [];
|
|
@@ -62544,10 +62562,344 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
|
|
|
62544
62562
|
const eventImportNames = [];
|
|
62545
62563
|
const functionSymbols = [];
|
|
62546
62564
|
const addressTaken = /* @__PURE__ */ new Set();
|
|
62547
|
-
let usesDlsym = false;
|
|
62548
|
-
let usesDlerror = false;
|
|
62565
|
+
let usesDlsym = scan3?.usesDlsym ?? false;
|
|
62566
|
+
let usesDlerror = scan3?.usesDlerror ?? false;
|
|
62549
62567
|
const dlerrorAlias = sdkLookupOnly ? "__peach_sdk_dlerror" : "__peach_dlerror";
|
|
62550
62568
|
const usedSymbols = /* @__PURE__ */ new Set();
|
|
62569
|
+
const rewriteImportSection = (start, end) => {
|
|
62570
|
+
let offset = start;
|
|
62571
|
+
const number4 = () => {
|
|
62572
|
+
if (offset < end) {
|
|
62573
|
+
const first = bytes[offset];
|
|
62574
|
+
if (first < 128) {
|
|
62575
|
+
offset++;
|
|
62576
|
+
return first;
|
|
62577
|
+
}
|
|
62578
|
+
}
|
|
62579
|
+
let value = 0;
|
|
62580
|
+
let shift = 0;
|
|
62581
|
+
for (; ; ) {
|
|
62582
|
+
if (offset >= end || shift > 63) throw new Error("invalid wasm integer");
|
|
62583
|
+
const byte = bytes[offset++];
|
|
62584
|
+
value += (byte & 127) * 2 ** shift;
|
|
62585
|
+
if (!(byte & 128)) return value;
|
|
62586
|
+
shift += 7;
|
|
62587
|
+
}
|
|
62588
|
+
};
|
|
62589
|
+
const string9 = () => {
|
|
62590
|
+
const length = number4();
|
|
62591
|
+
const strEnd = offset + length;
|
|
62592
|
+
if (strEnd > end) throw new Error("invalid wasm string");
|
|
62593
|
+
const value = rawBuf.toString("utf8", offset, strEnd);
|
|
62594
|
+
offset = strEnd;
|
|
62595
|
+
return value;
|
|
62596
|
+
};
|
|
62597
|
+
const count = number4();
|
|
62598
|
+
const importWriter = new ByteWriter(end - start + 64);
|
|
62599
|
+
importWriter.uleb(count);
|
|
62600
|
+
for (let i = 0; i < count; i++) {
|
|
62601
|
+
const entryStart = offset;
|
|
62602
|
+
const module2 = string9();
|
|
62603
|
+
const nameStart = offset;
|
|
62604
|
+
const name3 = string9();
|
|
62605
|
+
const nameEnd = offset;
|
|
62606
|
+
const kind = bytes[offset++];
|
|
62607
|
+
if (kind === 0) {
|
|
62608
|
+
number4();
|
|
62609
|
+
if (collectRewrittenSymbols) functionImportNames.push(name3);
|
|
62610
|
+
} else if (kind === 1) {
|
|
62611
|
+
const referenceType = bytes[offset++];
|
|
62612
|
+
if (referenceType !== 112 && referenceType !== 111)
|
|
62613
|
+
throw new Error("unsupported table type");
|
|
62614
|
+
const flags = number4();
|
|
62615
|
+
if (flags & ~7) throw new Error("unsupported table limits");
|
|
62616
|
+
number4();
|
|
62617
|
+
if (flags & 1) number4();
|
|
62618
|
+
} else if (kind === 2) {
|
|
62619
|
+
const flags = number4();
|
|
62620
|
+
if (flags & ~7) throw new Error("unsupported memory limits");
|
|
62621
|
+
number4();
|
|
62622
|
+
if (flags & 1) number4();
|
|
62623
|
+
} else if (kind === 3) offset += 2;
|
|
62624
|
+
else if (kind === 4) {
|
|
62625
|
+
number4();
|
|
62626
|
+
number4();
|
|
62627
|
+
} else throw new Error("unsupported wasm import");
|
|
62628
|
+
const isDlsym = instrumentDynamicLookups && module2 === "env" && name3 === "dlsym" && kind === 0;
|
|
62629
|
+
const isDlerror = instrumentDynamicLookups && module2 === "env" && name3 === "dlerror" && kind === 0;
|
|
62630
|
+
const rewrittenName = isDlsym ? callerAlias : isDlerror ? dlerrorAlias : module2 === "env" && name3 !== "dlsym" && name3 !== "dlerror" ? binding(name3) ?? name3 : name3;
|
|
62631
|
+
if (rewrittenName === name3) {
|
|
62632
|
+
importWriter.bytes(bytes, entryStart, offset);
|
|
62633
|
+
} else {
|
|
62634
|
+
importWriter.bytes(bytes, entryStart, nameStart);
|
|
62635
|
+
importWriter.string(rewrittenName);
|
|
62636
|
+
importWriter.bytes(bytes, nameEnd, offset);
|
|
62637
|
+
}
|
|
62638
|
+
if (collectRewrittenSymbols) {
|
|
62639
|
+
if (kind === 0)
|
|
62640
|
+
functionImportNames[functionImportNames.length - 1] = rewrittenName;
|
|
62641
|
+
else if (kind === 1) tableImportNames.push(rewrittenName);
|
|
62642
|
+
else if (kind === 3) globalImportNames.push(rewrittenName);
|
|
62643
|
+
else if (kind === 4) eventImportNames.push(rewrittenName);
|
|
62644
|
+
}
|
|
62645
|
+
}
|
|
62646
|
+
if (offset !== end) throw new Error("invalid wasm import section");
|
|
62647
|
+
return importWriter.finish();
|
|
62648
|
+
};
|
|
62649
|
+
const rewriteLinkingSection = (start, end) => {
|
|
62650
|
+
let offset = start;
|
|
62651
|
+
const number4 = () => {
|
|
62652
|
+
if (offset < end) {
|
|
62653
|
+
const first = bytes[offset];
|
|
62654
|
+
if (first < 128) {
|
|
62655
|
+
offset++;
|
|
62656
|
+
return first;
|
|
62657
|
+
}
|
|
62658
|
+
}
|
|
62659
|
+
let value = 0;
|
|
62660
|
+
let shift = 0;
|
|
62661
|
+
for (; ; ) {
|
|
62662
|
+
if (offset >= end || shift > 63) throw new Error("invalid wasm integer");
|
|
62663
|
+
const byte = bytes[offset++];
|
|
62664
|
+
value += (byte & 127) * 2 ** shift;
|
|
62665
|
+
if (!(byte & 128)) return value;
|
|
62666
|
+
shift += 7;
|
|
62667
|
+
}
|
|
62668
|
+
};
|
|
62669
|
+
const string9 = () => {
|
|
62670
|
+
const length = number4();
|
|
62671
|
+
const strEnd = offset + length;
|
|
62672
|
+
if (strEnd > end) throw new Error("invalid wasm string");
|
|
62673
|
+
const value = rawBuf.toString("utf8", offset, strEnd);
|
|
62674
|
+
offset = strEnd;
|
|
62675
|
+
return value;
|
|
62676
|
+
};
|
|
62677
|
+
const sectionName = string9();
|
|
62678
|
+
const version2 = number4();
|
|
62679
|
+
if (version2 !== 2) throw new Error("unsupported wasm linking version");
|
|
62680
|
+
const subsections = [];
|
|
62681
|
+
let objcLoader;
|
|
62682
|
+
while (offset < end) {
|
|
62683
|
+
const kind = bytes[offset++];
|
|
62684
|
+
const length = number4();
|
|
62685
|
+
const stop2 = offset + length;
|
|
62686
|
+
if (stop2 > end) throw new Error("invalid linking subsection");
|
|
62687
|
+
const contentStart = offset;
|
|
62688
|
+
if (kind === 7 && !sdkLookupOnly) {
|
|
62689
|
+
const comdatWriter = new ByteWriter(length + 64);
|
|
62690
|
+
const count = number4();
|
|
62691
|
+
comdatWriter.uleb(count);
|
|
62692
|
+
for (let i = 0; i < count; i++) {
|
|
62693
|
+
const group = string9();
|
|
62694
|
+
const begin = offset;
|
|
62695
|
+
number4();
|
|
62696
|
+
const members2 = number4();
|
|
62697
|
+
for (let member = 0; member < members2 * 2; member++) number4();
|
|
62698
|
+
comdatWriter.string(
|
|
62699
|
+
group === OBJC_INIT_RECORD ? group : `${comdatScope}:${group}`
|
|
62700
|
+
);
|
|
62701
|
+
comdatWriter.bytes(bytes, begin, offset);
|
|
62702
|
+
}
|
|
62703
|
+
if (offset !== stop2) throw new Error("invalid comdat subsection");
|
|
62704
|
+
const buf = comdatWriter.finish();
|
|
62705
|
+
subsections.push({ kind, parts: [buf], byteLength: buf.length });
|
|
62706
|
+
} else if (kind === 8) {
|
|
62707
|
+
const entryWriter = new ByteWriter(length + 128);
|
|
62708
|
+
let extraWriter;
|
|
62709
|
+
const count = number4();
|
|
62710
|
+
let added = 0;
|
|
62711
|
+
for (let i = 0; i < count; i++) {
|
|
62712
|
+
const begin = offset;
|
|
62713
|
+
const symbolKind = bytes[offset++];
|
|
62714
|
+
const flags = number4();
|
|
62715
|
+
const flagsEnd = offset;
|
|
62716
|
+
let index = -1;
|
|
62717
|
+
let name3 = "";
|
|
62718
|
+
let nameStart = -1;
|
|
62719
|
+
let nameEnd = -1;
|
|
62720
|
+
const isLocalDefined = !(flags & 16) && (flags & 3) === 2;
|
|
62721
|
+
if (symbolKind === 0 || symbolKind === 2 || symbolKind === 4 || symbolKind === 5) {
|
|
62722
|
+
index = number4();
|
|
62723
|
+
if (!(flags & 16) || flags & 64) {
|
|
62724
|
+
nameStart = offset;
|
|
62725
|
+
const nameLen = number4();
|
|
62726
|
+
nameEnd = offset + nameLen;
|
|
62727
|
+
if (nameEnd > end) throw new Error("invalid wasm string");
|
|
62728
|
+
if (!isLocalDefined || !sdkLookupOnly && symbolKind === 0 && nameLen === OBJC_LOAD_FUNCTION.length) {
|
|
62729
|
+
name3 = rawBuf.toString("utf8", offset, nameEnd);
|
|
62730
|
+
}
|
|
62731
|
+
offset = nameEnd;
|
|
62732
|
+
}
|
|
62733
|
+
} else if (symbolKind === 1) {
|
|
62734
|
+
nameStart = offset;
|
|
62735
|
+
const nameLen = number4();
|
|
62736
|
+
nameEnd = offset + nameLen;
|
|
62737
|
+
if (nameEnd > end) throw new Error("invalid wasm string");
|
|
62738
|
+
if (!isLocalDefined) name3 = rawBuf.toString("utf8", offset, nameEnd);
|
|
62739
|
+
offset = nameEnd;
|
|
62740
|
+
if (!(flags & 16)) {
|
|
62741
|
+
if ((flags & 3) !== 3) {
|
|
62742
|
+
number4();
|
|
62743
|
+
number4();
|
|
62744
|
+
}
|
|
62745
|
+
number4();
|
|
62746
|
+
if ((flags & 3) === 3) offset++;
|
|
62747
|
+
}
|
|
62748
|
+
} else if (symbolKind === 3) number4();
|
|
62749
|
+
else throw new Error("unsupported wasm symbol kind");
|
|
62750
|
+
if (!sdkLookupOnly && symbolKind === 0 && !(flags & 16) && name3 === OBJC_LOAD_FUNCTION) {
|
|
62751
|
+
objcLoader = i;
|
|
62752
|
+
}
|
|
62753
|
+
if (isLocalDefined) {
|
|
62754
|
+
entryWriter.bytes(bytes, begin, offset);
|
|
62755
|
+
continue;
|
|
62756
|
+
}
|
|
62757
|
+
let rewrittenSym = name3;
|
|
62758
|
+
let addedCanonical;
|
|
62759
|
+
let bound;
|
|
62760
|
+
let alias;
|
|
62761
|
+
if ((name3 === "dlsym" && usesDlsym || name3 === "dlerror" && usesDlerror) && flags & 16 && flags & 64 && symbolKind === 0) {
|
|
62762
|
+
rewrittenSym = name3 === "dlsym" ? callerAlias : dlerrorAlias;
|
|
62763
|
+
entryWriter.bytes(bytes, begin, nameStart);
|
|
62764
|
+
entryWriter.string(rewrittenSym);
|
|
62765
|
+
entryWriter.bytes(bytes, nameEnd, offset);
|
|
62766
|
+
} else if (flags & 16 && name3 !== "dlsym" && name3 !== "dlerror" && (bound = binding(name3)) !== void 0) {
|
|
62767
|
+
rewrittenSym = bound;
|
|
62768
|
+
entryWriter.bytes(bytes, begin, nameStart);
|
|
62769
|
+
entryWriter.string(rewrittenSym);
|
|
62770
|
+
entryWriter.bytes(bytes, nameEnd, offset);
|
|
62771
|
+
} else if (!(flags & 16) && (alias = names.get(name3)) !== void 0) {
|
|
62772
|
+
if (symbolKind !== 0 && symbolKind !== 1)
|
|
62773
|
+
throw new Error(`unsupported symbol ${name3}`);
|
|
62774
|
+
if (preserveCanonical.has(name3)) {
|
|
62775
|
+
entryWriter.bytes(bytes, begin, offset);
|
|
62776
|
+
extraWriter ??= new ByteWriter(256);
|
|
62777
|
+
extraWriter.byte(bytes[begin]);
|
|
62778
|
+
extraWriter.uleb(flags & ~32);
|
|
62779
|
+
extraWriter.bytes(bytes, flagsEnd, nameStart);
|
|
62780
|
+
extraWriter.string(alias);
|
|
62781
|
+
extraWriter.bytes(bytes, nameEnd, offset);
|
|
62782
|
+
added++;
|
|
62783
|
+
addedCanonical = alias;
|
|
62784
|
+
} else {
|
|
62785
|
+
rewrittenSym = alias;
|
|
62786
|
+
entryWriter.bytes(bytes, begin, nameStart);
|
|
62787
|
+
entryWriter.string(alias);
|
|
62788
|
+
entryWriter.bytes(bytes, nameEnd, offset);
|
|
62789
|
+
}
|
|
62790
|
+
} else {
|
|
62791
|
+
entryWriter.bytes(bytes, begin, offset);
|
|
62792
|
+
}
|
|
62793
|
+
if (collectRewrittenSymbols) {
|
|
62794
|
+
if (flags & 16) {
|
|
62795
|
+
const resolved = flags & 64 || symbolKind === 1 ? rewrittenSym : symbolKind === 0 ? functionImportNames[index] ?? "" : symbolKind === 2 ? globalImportNames[index] ?? "" : symbolKind === 4 ? eventImportNames[index] ?? "" : symbolKind === 5 ? tableImportNames[index] ?? "" : "";
|
|
62796
|
+
if (resolved) collectRewrittenSymbols.referenced.add(resolved);
|
|
62797
|
+
} else {
|
|
62798
|
+
if (rewrittenSym) collectRewrittenSymbols.defined.add(rewrittenSym);
|
|
62799
|
+
if (addedCanonical) collectRewrittenSymbols.defined.add(addedCanonical);
|
|
62800
|
+
}
|
|
62801
|
+
}
|
|
62802
|
+
}
|
|
62803
|
+
if (offset !== stop2) throw new Error("invalid symbol subsection");
|
|
62804
|
+
const countBytes = encodeNumber(count + added);
|
|
62805
|
+
const entryBuf = entryWriter.finish();
|
|
62806
|
+
if (extraWriter) {
|
|
62807
|
+
const extraBuf = extraWriter.finish();
|
|
62808
|
+
subsections.push({
|
|
62809
|
+
kind,
|
|
62810
|
+
parts: [countBytes, entryBuf, extraBuf],
|
|
62811
|
+
byteLength: countBytes.length + entryBuf.length + extraBuf.length
|
|
62812
|
+
});
|
|
62813
|
+
} else {
|
|
62814
|
+
subsections.push({
|
|
62815
|
+
kind,
|
|
62816
|
+
parts: [countBytes, entryBuf],
|
|
62817
|
+
byteLength: countBytes.length + entryBuf.length
|
|
62818
|
+
});
|
|
62819
|
+
}
|
|
62820
|
+
} else {
|
|
62821
|
+
subsections.push({
|
|
62822
|
+
kind,
|
|
62823
|
+
parts: [bytes.subarray(contentStart, stop2)],
|
|
62824
|
+
byteLength: length
|
|
62825
|
+
});
|
|
62826
|
+
}
|
|
62827
|
+
offset = stop2;
|
|
62828
|
+
}
|
|
62829
|
+
const linkingWriter = new ByteWriter(end - start + 128);
|
|
62830
|
+
linkingWriter.string(sectionName);
|
|
62831
|
+
linkingWriter.uleb(version2);
|
|
62832
|
+
for (const subsection of subsections) {
|
|
62833
|
+
if (subsection.kind === 6 && objcLoader !== void 0) {
|
|
62834
|
+
const content = subsection.parts[0];
|
|
62835
|
+
const [count, entriesStart] = readNumber(content, 0);
|
|
62836
|
+
const initWriter = new ByteWriter(content.length + 16);
|
|
62837
|
+
initWriter.bytes(content, 0, entriesStart);
|
|
62838
|
+
let entryStart = entriesStart;
|
|
62839
|
+
for (let i = 0; i < count; i++) {
|
|
62840
|
+
const [, symbolStart] = readNumber(content, entryStart);
|
|
62841
|
+
const [symbol2, entryEnd] = readNumber(content, symbolStart);
|
|
62842
|
+
if (symbol2 === objcLoader) {
|
|
62843
|
+
initWriter.uleb(1);
|
|
62844
|
+
initWriter.bytes(content, symbolStart, entryEnd);
|
|
62845
|
+
} else {
|
|
62846
|
+
initWriter.bytes(content, entryStart, entryEnd);
|
|
62847
|
+
}
|
|
62848
|
+
entryStart = entryEnd;
|
|
62849
|
+
}
|
|
62850
|
+
if (entryStart !== content.length)
|
|
62851
|
+
throw new Error("invalid init functions subsection");
|
|
62852
|
+
const initBuf = initWriter.finish();
|
|
62853
|
+
linkingWriter.byte(subsection.kind);
|
|
62854
|
+
linkingWriter.uleb(initBuf.length);
|
|
62855
|
+
linkingWriter.bytes(initBuf);
|
|
62856
|
+
} else {
|
|
62857
|
+
linkingWriter.byte(subsection.kind);
|
|
62858
|
+
linkingWriter.uleb(subsection.byteLength);
|
|
62859
|
+
for (const part of subsection.parts) linkingWriter.bytes(part);
|
|
62860
|
+
}
|
|
62861
|
+
}
|
|
62862
|
+
return linkingWriter.finish();
|
|
62863
|
+
};
|
|
62864
|
+
if (rewrite && scan3 && (scan3.importHeaderStart < 0 || scan3.linkingHeaderStart < 0 || scan3.importHeaderStart < scan3.linkingHeaderStart)) {
|
|
62865
|
+
const parts2 = [];
|
|
62866
|
+
let cursor = 0;
|
|
62867
|
+
if (scan3.importHeaderStart >= 0) {
|
|
62868
|
+
if (scan3.importHeaderStart > cursor)
|
|
62869
|
+
parts2.push(bytes.subarray(cursor, scan3.importHeaderStart));
|
|
62870
|
+
const rewrittenImport = rewriteImportSection(scan3.importStart, scan3.importEnd);
|
|
62871
|
+
parts2.push(Buffer.from([2]), encodeNumber(rewrittenImport.length), rewrittenImport);
|
|
62872
|
+
cursor = scan3.importEnd;
|
|
62873
|
+
}
|
|
62874
|
+
if (scan3.linkingHeaderStart >= 0) {
|
|
62875
|
+
if (scan3.linkingHeaderStart > cursor)
|
|
62876
|
+
parts2.push(bytes.subarray(cursor, scan3.linkingHeaderStart));
|
|
62877
|
+
const rewrittenLinking = rewriteLinkingSection(scan3.linkingStart, scan3.linkingEnd);
|
|
62878
|
+
parts2.push(
|
|
62879
|
+
Buffer.from([0]),
|
|
62880
|
+
encodeNumber(rewrittenLinking.length),
|
|
62881
|
+
rewrittenLinking
|
|
62882
|
+
);
|
|
62883
|
+
cursor = scan3.linkingEnd;
|
|
62884
|
+
}
|
|
62885
|
+
if (cursor < bytes.length) parts2.push(bytes.subarray(cursor));
|
|
62886
|
+
return {
|
|
62887
|
+
bytes: concatParts(parts2),
|
|
62888
|
+
definitions,
|
|
62889
|
+
functionImports,
|
|
62890
|
+
usesDlsym,
|
|
62891
|
+
usesDlerror,
|
|
62892
|
+
usedSymbols,
|
|
62893
|
+
addressTaken: []
|
|
62894
|
+
};
|
|
62895
|
+
}
|
|
62896
|
+
const sections = rewrite ? [bytes.subarray(0, 8)] : void 0;
|
|
62897
|
+
let importHeaderStart = -1;
|
|
62898
|
+
let importStart = -1;
|
|
62899
|
+
let importEnd = -1;
|
|
62900
|
+
let linkingHeaderStart = -1;
|
|
62901
|
+
let linkingStart = -1;
|
|
62902
|
+
let linkingEnd = -1;
|
|
62551
62903
|
let position = 8;
|
|
62552
62904
|
while (position < bytes.length) {
|
|
62553
62905
|
const headerStart2 = position;
|
|
@@ -62611,6 +62963,9 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
|
|
|
62611
62963
|
types2.push({ parameters, results });
|
|
62612
62964
|
}
|
|
62613
62965
|
} else if (id === 2) {
|
|
62966
|
+
importHeaderStart = headerStart2;
|
|
62967
|
+
importStart = start;
|
|
62968
|
+
importEnd = end;
|
|
62614
62969
|
const count = number4();
|
|
62615
62970
|
const importWriter = rewrite ? new ByteWriter(size2 + 64) : void 0;
|
|
62616
62971
|
importWriter?.uleb(count);
|
|
@@ -62685,210 +63040,88 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
|
|
|
62685
63040
|
} else if (id === 0) {
|
|
62686
63041
|
const sectionName = string9();
|
|
62687
63042
|
if (sectionName === "linking") {
|
|
62688
|
-
|
|
62689
|
-
|
|
62690
|
-
|
|
62691
|
-
|
|
62692
|
-
|
|
62693
|
-
|
|
62694
|
-
const
|
|
62695
|
-
|
|
62696
|
-
|
|
62697
|
-
|
|
62698
|
-
|
|
62699
|
-
const
|
|
62700
|
-
|
|
62701
|
-
|
|
62702
|
-
|
|
62703
|
-
|
|
62704
|
-
|
|
62705
|
-
|
|
62706
|
-
|
|
62707
|
-
|
|
62708
|
-
|
|
62709
|
-
|
|
62710
|
-
|
|
62711
|
-
|
|
62712
|
-
|
|
62713
|
-
|
|
62714
|
-
|
|
62715
|
-
|
|
62716
|
-
|
|
62717
|
-
|
|
62718
|
-
|
|
62719
|
-
|
|
62720
|
-
|
|
62721
|
-
|
|
62722
|
-
|
|
62723
|
-
const symbolKind = bytes[offset++];
|
|
62724
|
-
const flags = number4();
|
|
62725
|
-
const flagsEnd = offset;
|
|
62726
|
-
let index = -1;
|
|
62727
|
-
let name3 = "";
|
|
62728
|
-
let nameStart = -1;
|
|
62729
|
-
let nameEnd = -1;
|
|
62730
|
-
if (symbolKind === 0 || symbolKind === 2 || symbolKind === 4 || symbolKind === 5) {
|
|
62731
|
-
index = number4();
|
|
62732
|
-
if (!(flags & 16) || flags & 64) {
|
|
62733
|
-
nameStart = offset;
|
|
62734
|
-
name3 = string9();
|
|
62735
|
-
nameEnd = offset;
|
|
62736
|
-
}
|
|
62737
|
-
} else if (symbolKind === 1) {
|
|
62738
|
-
nameStart = offset;
|
|
62739
|
-
name3 = string9();
|
|
62740
|
-
nameEnd = offset;
|
|
62741
|
-
if (!(flags & 16)) {
|
|
62742
|
-
if ((flags & 3) !== 3) {
|
|
62743
|
-
number4();
|
|
63043
|
+
linkingHeaderStart = headerStart2;
|
|
63044
|
+
linkingStart = start;
|
|
63045
|
+
linkingEnd = end;
|
|
63046
|
+
if (rewrite) {
|
|
63047
|
+
rewrittenSection = rewriteLinkingSection(start, end);
|
|
63048
|
+
} else {
|
|
63049
|
+
const version2 = number4();
|
|
63050
|
+
if (version2 !== 2) throw new Error("unsupported wasm linking version");
|
|
63051
|
+
while (offset < end) {
|
|
63052
|
+
const kind = bytes[offset++];
|
|
63053
|
+
const length = number4();
|
|
63054
|
+
const stop2 = offset + length;
|
|
63055
|
+
if (stop2 > end) throw new Error("invalid linking subsection");
|
|
63056
|
+
if (kind === 8) {
|
|
63057
|
+
const count = number4();
|
|
63058
|
+
for (let i = 0; i < count; i++) {
|
|
63059
|
+
const symbolKind = bytes[offset++];
|
|
63060
|
+
const flags = number4();
|
|
63061
|
+
let index = -1;
|
|
63062
|
+
let name3 = "";
|
|
63063
|
+
if (symbolKind === 0 || symbolKind === 2 || symbolKind === 4 || symbolKind === 5) {
|
|
63064
|
+
index = number4();
|
|
63065
|
+
if (!(flags & 16) || flags & 64) name3 = string9();
|
|
63066
|
+
} else if (symbolKind === 1) {
|
|
63067
|
+
const nameLen = number4();
|
|
63068
|
+
const nameEnd = offset + nameLen;
|
|
63069
|
+
if (nameEnd > end) throw new Error("invalid wasm string");
|
|
63070
|
+
if (flags & 16 || (flags & 3) !== 2)
|
|
63071
|
+
name3 = rawBuf.toString("utf8", offset, nameEnd);
|
|
63072
|
+
offset = nameEnd;
|
|
63073
|
+
if (!(flags & 16)) {
|
|
63074
|
+
if ((flags & 3) !== 3) {
|
|
63075
|
+
number4();
|
|
63076
|
+
number4();
|
|
63077
|
+
}
|
|
62744
63078
|
number4();
|
|
63079
|
+
if ((flags & 3) === 3) offset++;
|
|
62745
63080
|
}
|
|
62746
|
-
|
|
62747
|
-
|
|
62748
|
-
|
|
62749
|
-
|
|
62750
|
-
|
|
62751
|
-
|
|
62752
|
-
|
|
62753
|
-
if (rewrite && !sdkLookupOnly && name3 === OBJC_LOAD_FUNCTION && symbolKind === 0 && !(flags & 16)) {
|
|
62754
|
-
objcLoader = i;
|
|
62755
|
-
}
|
|
62756
|
-
const alias = names.get(name3);
|
|
62757
|
-
if (!rewrite && flags & 16 && symbolKind === 1 && alias)
|
|
62758
|
-
usedSymbols.add(name3);
|
|
62759
|
-
if (entryWriter && binding) {
|
|
62760
|
-
let rewrittenSym = name3;
|
|
62761
|
-
let addedCanonical;
|
|
62762
|
-
if ((name3 === "dlsym" && usesDlsym || name3 === "dlerror" && usesDlerror) && flags & 16 && flags & 64 && symbolKind === 0) {
|
|
62763
|
-
rewrittenSym = name3 === "dlsym" ? callerAlias : dlerrorAlias;
|
|
62764
|
-
entryWriter.bytes(bytes, begin, nameStart);
|
|
62765
|
-
entryWriter.string(rewrittenSym);
|
|
62766
|
-
entryWriter.bytes(bytes, nameEnd, offset);
|
|
62767
|
-
} else if (flags & 16 && name3 !== "dlsym" && name3 !== "dlerror" && binding(name3) !== void 0) {
|
|
62768
|
-
rewrittenSym = binding(name3);
|
|
62769
|
-
entryWriter.bytes(bytes, begin, nameStart);
|
|
62770
|
-
entryWriter.string(rewrittenSym);
|
|
62771
|
-
entryWriter.bytes(bytes, nameEnd, offset);
|
|
62772
|
-
} else if (alias && !(flags & 16) && (flags & 3) !== 2) {
|
|
63081
|
+
} else if (symbolKind === 3) number4();
|
|
63082
|
+
else throw new Error("unsupported wasm symbol kind");
|
|
63083
|
+
if (symbolKind === 0)
|
|
63084
|
+
functionSymbols[i] = name3 || functionImportNames[index];
|
|
63085
|
+
if (flags & 16) {
|
|
63086
|
+
if (symbolKind === 1 && names.has(name3)) usedSymbols.add(name3);
|
|
63087
|
+
} else if ((flags & 3) !== 2 && names.has(name3)) {
|
|
62773
63088
|
if (symbolKind !== 0 && symbolKind !== 1)
|
|
62774
63089
|
throw new Error(`unsupported symbol ${name3}`);
|
|
62775
|
-
|
|
62776
|
-
|
|
62777
|
-
|
|
62778
|
-
|
|
62779
|
-
|
|
62780
|
-
|
|
62781
|
-
|
|
62782
|
-
|
|
62783
|
-
|
|
62784
|
-
|
|
62785
|
-
}
|
|
62786
|
-
rewrittenSym = alias;
|
|
62787
|
-
entryWriter.bytes(bytes, begin, nameStart);
|
|
62788
|
-
entryWriter.string(alias);
|
|
62789
|
-
entryWriter.bytes(bytes, nameEnd, offset);
|
|
62790
|
-
}
|
|
62791
|
-
} else {
|
|
62792
|
-
entryWriter.bytes(bytes, begin, offset);
|
|
62793
|
-
}
|
|
62794
|
-
if (collectRewrittenSymbols) {
|
|
62795
|
-
if (flags & 16) {
|
|
62796
|
-
const resolved = flags & 64 || symbolKind === 1 ? rewrittenSym : symbolKind === 0 ? functionImportNames[index] ?? "" : symbolKind === 2 ? globalImportNames[index] ?? "" : symbolKind === 4 ? eventImportNames[index] ?? "" : symbolKind === 5 ? tableImportNames[index] ?? "" : "";
|
|
62797
|
-
if (resolved) collectRewrittenSymbols.referenced.add(resolved);
|
|
62798
|
-
} else if ((flags & 3) !== 2) {
|
|
62799
|
-
if (rewrittenSym) collectRewrittenSymbols.defined.add(rewrittenSym);
|
|
62800
|
-
if (addedCanonical)
|
|
62801
|
-
collectRewrittenSymbols.defined.add(addedCanonical);
|
|
62802
|
-
}
|
|
62803
|
-
}
|
|
62804
|
-
} else if (alias && !(flags & 16) && (flags & 3) !== 2) {
|
|
62805
|
-
if (symbolKind !== 0 && symbolKind !== 1)
|
|
62806
|
-
throw new Error(`unsupported symbol ${name3}`);
|
|
62807
|
-
const type = symbolKind === 0 ? types2[functionTypes[index]] : void 0;
|
|
62808
|
-
if (symbolKind === 0 && !type) throw new Error(`missing type for ${name3}`);
|
|
62809
|
-
definitions.push({
|
|
62810
|
-
name: name3,
|
|
62811
|
-
kind: symbolKind === 0 ? "function" : "data",
|
|
62812
|
-
weak: (flags & 3) === 1,
|
|
62813
|
-
exportName: (flags & 32) !== 0,
|
|
62814
|
-
hidden: (flags & 4) !== 0,
|
|
62815
|
-
type
|
|
62816
|
-
});
|
|
62817
|
-
}
|
|
62818
|
-
}
|
|
62819
|
-
if (offset !== stop2) throw new Error("invalid symbol subsection");
|
|
62820
|
-
if (entryWriter) {
|
|
62821
|
-
const countBytes = encodeNumber(count + added);
|
|
62822
|
-
const entryBuf = entryWriter.finish();
|
|
62823
|
-
if (extraWriter) {
|
|
62824
|
-
const extraBuf = extraWriter.finish();
|
|
62825
|
-
subsections.push({
|
|
62826
|
-
kind,
|
|
62827
|
-
parts: [countBytes, entryBuf, extraBuf],
|
|
62828
|
-
byteLength: countBytes.length + entryBuf.length + extraBuf.length
|
|
62829
|
-
});
|
|
62830
|
-
} else {
|
|
62831
|
-
subsections.push({
|
|
62832
|
-
kind,
|
|
62833
|
-
parts: [countBytes, entryBuf],
|
|
62834
|
-
byteLength: countBytes.length + entryBuf.length
|
|
62835
|
-
});
|
|
62836
|
-
}
|
|
62837
|
-
}
|
|
62838
|
-
} else if (subsections) {
|
|
62839
|
-
subsections.push({
|
|
62840
|
-
kind,
|
|
62841
|
-
parts: [bytes.subarray(contentStart, stop2)],
|
|
62842
|
-
byteLength: length
|
|
62843
|
-
});
|
|
62844
|
-
}
|
|
62845
|
-
offset = stop2;
|
|
62846
|
-
}
|
|
62847
|
-
if (subsections) {
|
|
62848
|
-
const linkingWriter = new ByteWriter(size2 + 128);
|
|
62849
|
-
linkingWriter.string(sectionName);
|
|
62850
|
-
linkingWriter.uleb(version2);
|
|
62851
|
-
for (const subsection of subsections) {
|
|
62852
|
-
if (subsection.kind === 6 && objcLoader !== void 0) {
|
|
62853
|
-
const content = subsection.parts[0];
|
|
62854
|
-
const [count, entriesStart] = readNumber(content, 0);
|
|
62855
|
-
const initWriter = new ByteWriter(content.length + 16);
|
|
62856
|
-
initWriter.bytes(content, 0, entriesStart);
|
|
62857
|
-
let entryStart = entriesStart;
|
|
62858
|
-
for (let i = 0; i < count; i++) {
|
|
62859
|
-
const [, symbolStart] = readNumber(content, entryStart);
|
|
62860
|
-
const [symbol2, entryEnd] = readNumber(content, symbolStart);
|
|
62861
|
-
if (symbol2 === objcLoader) {
|
|
62862
|
-
initWriter.uleb(1);
|
|
62863
|
-
initWriter.bytes(content, symbolStart, entryEnd);
|
|
62864
|
-
} else {
|
|
62865
|
-
initWriter.bytes(content, entryStart, entryEnd);
|
|
63090
|
+
const type = symbolKind === 0 ? types2[functionTypes[index]] : void 0;
|
|
63091
|
+
if (symbolKind === 0 && !type)
|
|
63092
|
+
throw new Error(`missing type for ${name3}`);
|
|
63093
|
+
definitions.push({
|
|
63094
|
+
name: name3,
|
|
63095
|
+
kind: symbolKind === 0 ? "function" : "data",
|
|
63096
|
+
weak: (flags & 3) === 1,
|
|
63097
|
+
exportName: (flags & 32) !== 0,
|
|
63098
|
+
hidden: (flags & 4) !== 0,
|
|
63099
|
+
type
|
|
63100
|
+
});
|
|
62866
63101
|
}
|
|
62867
|
-
entryStart = entryEnd;
|
|
62868
63102
|
}
|
|
62869
|
-
if (
|
|
62870
|
-
throw new Error("invalid init functions subsection");
|
|
62871
|
-
const initBuf = initWriter.finish();
|
|
62872
|
-
linkingWriter.byte(subsection.kind);
|
|
62873
|
-
linkingWriter.uleb(initBuf.length);
|
|
62874
|
-
linkingWriter.bytes(initBuf);
|
|
62875
|
-
} else {
|
|
62876
|
-
linkingWriter.byte(subsection.kind);
|
|
62877
|
-
linkingWriter.uleb(subsection.byteLength);
|
|
62878
|
-
for (const part of subsection.parts) linkingWriter.bytes(part);
|
|
63103
|
+
if (offset !== stop2) throw new Error("invalid symbol subsection");
|
|
62879
63104
|
}
|
|
63105
|
+
offset = stop2;
|
|
62880
63106
|
}
|
|
62881
|
-
rewrittenSection = linkingWriter.finish();
|
|
62882
63107
|
}
|
|
62883
63108
|
} else if (!rewrite && sectionName.startsWith("reloc.")) {
|
|
62884
63109
|
number4();
|
|
62885
63110
|
for (let count = number4(); count > 0; count--) {
|
|
62886
|
-
const
|
|
62887
|
-
number4();
|
|
62888
|
-
|
|
62889
|
-
|
|
62890
|
-
|
|
62891
|
-
|
|
63111
|
+
const b0 = bytes[offset];
|
|
63112
|
+
const type = b0 < 128 ? (offset++, b0) : number4();
|
|
63113
|
+
if (offset < end && bytes[offset] < 128) offset++;
|
|
63114
|
+
else number4();
|
|
63115
|
+
const b2 = bytes[offset];
|
|
63116
|
+
const symIdx = b2 < 128 ? (offset++, b2) : number4();
|
|
63117
|
+
if (ADDEND_RELOCATIONS.has(type)) {
|
|
63118
|
+
if (offset < end && bytes[offset] < 128) offset++;
|
|
63119
|
+
else number4();
|
|
63120
|
+
}
|
|
63121
|
+
if (TABLE_INDEX_RELOCATIONS.has(type)) {
|
|
63122
|
+
const name3 = functionSymbols[symIdx];
|
|
63123
|
+
if (name3 !== void 0) addressTaken.add(name3);
|
|
63124
|
+
}
|
|
62892
63125
|
}
|
|
62893
63126
|
if (offset !== end) throw new Error(`invalid relocation section ${sectionName}`);
|
|
62894
63127
|
}
|
|
@@ -62907,9 +63140,21 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
|
|
|
62907
63140
|
}
|
|
62908
63141
|
return {
|
|
62909
63142
|
bytes: sections ? Buffer.concat(sections) : bytes,
|
|
63143
|
+
parts: sections,
|
|
63144
|
+
scan: !rewrite ? {
|
|
63145
|
+
importHeaderStart,
|
|
63146
|
+
importStart,
|
|
63147
|
+
importEnd,
|
|
63148
|
+
linkingHeaderStart,
|
|
63149
|
+
linkingStart,
|
|
63150
|
+
linkingEnd,
|
|
63151
|
+
usesDlsym,
|
|
63152
|
+
usesDlerror
|
|
63153
|
+
} : void 0,
|
|
62910
63154
|
definitions,
|
|
62911
63155
|
functionImports,
|
|
62912
63156
|
usesDlsym,
|
|
63157
|
+
usesDlerror,
|
|
62913
63158
|
usedSymbols,
|
|
62914
63159
|
addressTaken: [...addressTaken]
|
|
62915
63160
|
};
|
|
@@ -62979,7 +63224,8 @@ function createGuestImageLedger(input) {
|
|
|
62979
63224
|
object: object9,
|
|
62980
63225
|
aliases,
|
|
62981
63226
|
usedSymbols: rewritten.usedSymbols,
|
|
62982
|
-
functionImports: rewritten.functionImports
|
|
63227
|
+
functionImports: rewritten.functionImports,
|
|
63228
|
+
scan: rewritten.scan
|
|
62983
63229
|
});
|
|
62984
63230
|
for (const symbol2 of rewritten.definitions) {
|
|
62985
63231
|
if (symbol2.type && symbol2.type.results.length > 1)
|
|
@@ -63024,10 +63270,24 @@ function createGuestImageLedger(input) {
|
|
|
63024
63270
|
);
|
|
63025
63271
|
}
|
|
63026
63272
|
const preserveCanonical = /* @__PURE__ */ new Set();
|
|
63027
|
-
|
|
63273
|
+
let definitionsByName;
|
|
63274
|
+
const neededNames = /* @__PURE__ */ new Set();
|
|
63275
|
+
if (symbolIndices.has("__cxa_throw")) neededNames.add("__cxa_throw");
|
|
63276
|
+
for (const binding of input.directBindings ?? []) neededNames.add(binding.symbol);
|
|
63277
|
+
if (input.sdkWeakReferences) {
|
|
63278
|
+
definitionsByName = Map.groupBy(definitions, (definition2) => definition2.name);
|
|
63279
|
+
} else if (neededNames.size > 0) {
|
|
63280
|
+
definitionsByName = /* @__PURE__ */ new Map();
|
|
63281
|
+
for (const definition2 of definitions) {
|
|
63282
|
+
if (!neededNames.has(definition2.name)) continue;
|
|
63283
|
+
let list2 = definitionsByName.get(definition2.name);
|
|
63284
|
+
if (!list2) definitionsByName.set(definition2.name, list2 = []);
|
|
63285
|
+
list2.push(definition2);
|
|
63286
|
+
}
|
|
63287
|
+
}
|
|
63028
63288
|
if (symbolIndices.has("__cxa_throw")) {
|
|
63029
63289
|
const name3 = "__cxa_throw";
|
|
63030
|
-
const matching2 = definitionsByName
|
|
63290
|
+
const matching2 = definitionsByName?.get(name3) ?? [];
|
|
63031
63291
|
if (new Set(matching2.map((definition2) => definition2.image)).size >= 2 && matching2.some((definition2) => definition2.weak)) {
|
|
63032
63292
|
const weak = matching2.filter((definition2) => definition2.weak);
|
|
63033
63293
|
const strong = matching2.filter((definition2) => !definition2.weak);
|
|
@@ -63121,7 +63381,7 @@ function createGuestImageLedger(input) {
|
|
|
63121
63381
|
const unitsByPath = new Map(units.map((unit2) => [unit2.object.path, unit2]));
|
|
63122
63382
|
for (const binding of input.directBindings ?? []) {
|
|
63123
63383
|
const unit2 = unitsByPath.get(binding.object);
|
|
63124
|
-
const matches = (definitionsByName
|
|
63384
|
+
const matches = (definitionsByName?.get(binding.symbol) ?? []).filter(
|
|
63125
63385
|
(definition2) => definition2.object === binding.providerObject && definition2.image === binding.providerImage
|
|
63126
63386
|
);
|
|
63127
63387
|
if (!unit2 || !unit2.usedSymbols.has(binding.symbol) || matches.length !== 1)
|
|
@@ -63165,7 +63425,7 @@ function createGuestImageLedger(input) {
|
|
|
63165
63425
|
}
|
|
63166
63426
|
}
|
|
63167
63427
|
const appSymbols = input.registerAppTables ? { referenced: /* @__PURE__ */ new Set(), defined: /* @__PURE__ */ new Set() } : void 0;
|
|
63168
|
-
const objects = units.map(({ image, object: object9, aliases, functionImports }) => {
|
|
63428
|
+
const objects = units.map(({ image, object: object9, aliases, functionImports, scan: scan3 }) => {
|
|
63169
63429
|
const shared = sharedLookupByImage.get(image);
|
|
63170
63430
|
const own2 = startup.get(object9.path);
|
|
63171
63431
|
const bindings = new Map(own2);
|
|
@@ -63188,22 +63448,24 @@ function createGuestImageLedger(input) {
|
|
|
63188
63448
|
}
|
|
63189
63449
|
bindings.set(name3, wrapper.symbol);
|
|
63190
63450
|
}
|
|
63451
|
+
const rewritten = rewriteObject(
|
|
63452
|
+
object9.bytes,
|
|
63453
|
+
aliases,
|
|
63454
|
+
`__peach_dlsym_caller_${image}`,
|
|
63455
|
+
binding,
|
|
63456
|
+
object9.instrumentDynamicLookups,
|
|
63457
|
+
preserveCanonical,
|
|
63458
|
+
{
|
|
63459
|
+
sdkProduct: object9.sdkProduct,
|
|
63460
|
+
collectRewrittenSymbols: object9.sdkProduct === void 0 ? appSymbols : void 0,
|
|
63461
|
+
scan: scan3
|
|
63462
|
+
}
|
|
63463
|
+
);
|
|
63191
63464
|
return {
|
|
63192
63465
|
path: object9.path,
|
|
63193
63466
|
instrumentDynamicLookups: object9.instrumentDynamicLookups,
|
|
63194
63467
|
sdkProduct: object9.sdkProduct,
|
|
63195
|
-
bytes:
|
|
63196
|
-
object9.bytes,
|
|
63197
|
-
aliases,
|
|
63198
|
-
`__peach_dlsym_caller_${image}`,
|
|
63199
|
-
binding,
|
|
63200
|
-
object9.instrumentDynamicLookups,
|
|
63201
|
-
preserveCanonical,
|
|
63202
|
-
{
|
|
63203
|
-
sdkProduct: object9.sdkProduct,
|
|
63204
|
-
collectRewrittenSymbols: object9.sdkProduct === void 0 ? appSymbols : void 0
|
|
63205
|
-
}
|
|
63206
|
-
).bytes
|
|
63468
|
+
bytes: rewritten.bytes
|
|
63207
63469
|
};
|
|
63208
63470
|
});
|
|
63209
63471
|
const exported2 = /* @__PURE__ */ new Map();
|
|
@@ -63365,8 +63627,7 @@ function sdkGuestCallerId(product) {
|
|
|
63365
63627
|
return (hash | 2147483648) >>> 0;
|
|
63366
63628
|
}
|
|
63367
63629
|
function sdkGuestSymbolName(product, name3) {
|
|
63368
|
-
|
|
63369
|
-
return `__peach_sdk_symbol_${digest3.slice(0, 32)}`;
|
|
63630
|
+
return `__peach_sdk_symbol_${sha256PairHex(product, name3).slice(0, 32)}`;
|
|
63370
63631
|
}
|
|
63371
63632
|
function rewriteSdkGuestLookup(bytes, callerId) {
|
|
63372
63633
|
return rewriteObject(
|
|
@@ -63440,7 +63701,7 @@ function nameGuestImageAliases(wasm, symbols) {
|
|
|
63440
63701
|
}
|
|
63441
63702
|
return Buffer.concat(parts2);
|
|
63442
63703
|
}
|
|
63443
|
-
var import_node_crypto32, ByteWriter, OBJC_INIT_RECORD, TABLE_INDEX_RELOCATIONS, GUEST_DYLD_VALUES_SECTION, GUEST_LAZY_FUNCTION_BASE, SDK_DYLD_RESOLVER;
|
|
63704
|
+
var import_node_crypto32, ByteWriter, OBJC_INIT_RECORD, TABLE_INDEX_RELOCATIONS, sha256PairHex, GUEST_DYLD_VALUES_SECTION, GUEST_LAZY_FUNCTION_BASE, SDK_DYLD_RESOLVER;
|
|
63444
63705
|
var init_swift_guest_image_ledger = __esm({
|
|
63445
63706
|
"src/swift-guest-image-ledger.ts"() {
|
|
63446
63707
|
"use strict";
|
|
@@ -63501,6 +63762,7 @@ var init_swift_guest_image_ledger = __esm({
|
|
|
63501
63762
|
};
|
|
63502
63763
|
OBJC_INIT_RECORD = ".objc_init";
|
|
63503
63764
|
TABLE_INDEX_RELOCATIONS = /* @__PURE__ */ new Set([1, 2, 12, 18, 19, 24]);
|
|
63765
|
+
sha256PairHex = typeof Bun !== "undefined" ? (first, second) => new Bun.CryptoHasher("sha256").update(first).update("\0").update(second).digest("hex") : (first, second) => (0, import_node_crypto32.createHash)("sha256").update(first).update("\0").update(second).digest("hex");
|
|
63504
63766
|
GUEST_DYLD_VALUES_SECTION = "peach_dyld_values";
|
|
63505
63767
|
GUEST_LAZY_FUNCTION_BASE = 2 ** 32;
|
|
63506
63768
|
SDK_DYLD_RESOLVER = "__peach_sdk_dyld_resolve";
|
|
@@ -63518,7 +63780,7 @@ function encodeWasmNumber(value) {
|
|
|
63518
63780
|
}
|
|
63519
63781
|
}
|
|
63520
63782
|
function encodeWasmName(name3) {
|
|
63521
|
-
const bytes =
|
|
63783
|
+
const bytes = new TextEncoder().encode(name3);
|
|
63522
63784
|
return [...encodeWasmNumber(bytes.length), ...bytes];
|
|
63523
63785
|
}
|
|
63524
63786
|
function readWasmSection(bytes, start, end) {
|
|
@@ -64145,6 +64407,32 @@ var init_swift_guest_dyld_table = __esm({
|
|
|
64145
64407
|
}
|
|
64146
64408
|
});
|
|
64147
64409
|
|
|
64410
|
+
// ../../src/helpers/mapLimit.ts
|
|
64411
|
+
async function mapLimit(items2, limit, worker) {
|
|
64412
|
+
const results = new Array(items2.length);
|
|
64413
|
+
let next = 0;
|
|
64414
|
+
let failure3;
|
|
64415
|
+
await Promise.all(
|
|
64416
|
+
Array.from({ length: Math.min(limit, items2.length) }, async () => {
|
|
64417
|
+
while (!failure3 && next < items2.length) {
|
|
64418
|
+
const index = next++;
|
|
64419
|
+
try {
|
|
64420
|
+
results[index] = await worker(items2[index], index);
|
|
64421
|
+
} catch (error) {
|
|
64422
|
+
failure3 ??= { error };
|
|
64423
|
+
}
|
|
64424
|
+
}
|
|
64425
|
+
})
|
|
64426
|
+
);
|
|
64427
|
+
if (failure3) throw failure3.error;
|
|
64428
|
+
return results;
|
|
64429
|
+
}
|
|
64430
|
+
var init_mapLimit = __esm({
|
|
64431
|
+
"../../src/helpers/mapLimit.ts"() {
|
|
64432
|
+
"use strict";
|
|
64433
|
+
}
|
|
64434
|
+
});
|
|
64435
|
+
|
|
64148
64436
|
// src/swift-guest-link-plan.ts
|
|
64149
64437
|
function selectedGuestInputImage(artifact, member) {
|
|
64150
64438
|
if (artifact.kind === "object" !== (member === null))
|
|
@@ -65616,7 +65904,7 @@ function remapGuestLinkPlan(plan, rewritten) {
|
|
|
65616
65904
|
}))
|
|
65617
65905
|
};
|
|
65618
65906
|
}
|
|
65619
|
-
function
|
|
65907
|
+
function guestLinkInputFilesWithKind(args) {
|
|
65620
65908
|
const dirs = [];
|
|
65621
65909
|
for (let i = 0; i < args.length; i++) {
|
|
65622
65910
|
const arg = args[i];
|
|
@@ -65624,7 +65912,8 @@ function guestLinkInputFiles(args) {
|
|
|
65624
65912
|
else if (arg.startsWith("-L")) dirs.push(arg.slice(2));
|
|
65625
65913
|
else if (arg.startsWith("--library-path=")) dirs.push(arg.slice(15));
|
|
65626
65914
|
}
|
|
65627
|
-
const
|
|
65915
|
+
const magic = Buffer.allocUnsafe(8);
|
|
65916
|
+
const inputs2 = /* @__PURE__ */ new Map();
|
|
65628
65917
|
for (let i = 0; i < args.length; i++) {
|
|
65629
65918
|
const arg = args[i];
|
|
65630
65919
|
if (arg === "-L" || arg === "--library-path" || arg === "-o" || arg === "--output") {
|
|
@@ -65633,29 +65922,52 @@ function guestLinkInputFiles(args) {
|
|
|
65633
65922
|
}
|
|
65634
65923
|
if (arg.startsWith("@")) throw new Error(`nested linker response file ${arg}`);
|
|
65635
65924
|
let file;
|
|
65925
|
+
let kind;
|
|
65636
65926
|
if (arg === "-l" || arg === "--library" || arg.startsWith("--library=") || arg.startsWith("-l") && arg.length > 2) {
|
|
65637
65927
|
const name3 = arg === "-l" || arg === "--library" ? args[++i] : arg.startsWith("--library=") ? arg.slice(10) : arg.slice(2);
|
|
65638
65928
|
const archive = name3.startsWith(":") ? name3.slice(1) : `lib${name3}.a`;
|
|
65639
65929
|
file = dirs.map((dir) => import_node_path61.default.join(dir, archive)).find((item) => import_node_fs63.default.existsSync(item));
|
|
65640
65930
|
if (!file) throw new Error(`unresolved guest link library ${name3}`);
|
|
65641
|
-
} else if (!arg.startsWith("-")
|
|
65642
|
-
const
|
|
65643
|
-
|
|
65644
|
-
|
|
65645
|
-
|
|
65646
|
-
|
|
65647
|
-
|
|
65931
|
+
} else if (!arg.startsWith("-")) {
|
|
65932
|
+
const resolved = import_node_path61.default.resolve(arg);
|
|
65933
|
+
if (inputs2.has(resolved)) continue;
|
|
65934
|
+
const stat2 = import_node_fs63.default.statSync(arg, { throwIfNoEntry: false });
|
|
65935
|
+
if (stat2?.isFile()) {
|
|
65936
|
+
const fd = import_node_fs63.default.openSync(arg, "r");
|
|
65937
|
+
let read = 0;
|
|
65938
|
+
try {
|
|
65939
|
+
read = import_node_fs63.default.readSync(fd, magic, 0, 8, 0);
|
|
65940
|
+
} finally {
|
|
65941
|
+
import_node_fs63.default.closeSync(fd);
|
|
65942
|
+
}
|
|
65943
|
+
if (read >= 4) {
|
|
65944
|
+
if (read >= 8 && (magic.toString("ascii") === "!<arch>\n" || magic.toString("ascii") === "!<thin>\n")) {
|
|
65945
|
+
file = arg;
|
|
65946
|
+
kind = "archive";
|
|
65947
|
+
} else if (magic.subarray(0, 4).equals(WASM_MAGIC) || magic.subarray(0, 4).equals(BITCODE_MAGIC)) {
|
|
65948
|
+
file = arg;
|
|
65949
|
+
kind = "object";
|
|
65950
|
+
}
|
|
65951
|
+
}
|
|
65952
|
+
}
|
|
65953
|
+
}
|
|
65954
|
+
if (file) {
|
|
65955
|
+
const resolved = import_node_path61.default.resolve(file);
|
|
65956
|
+
if (!inputs2.has(resolved)) {
|
|
65957
|
+
if (!kind) {
|
|
65958
|
+
const fd = import_node_fs63.default.openSync(resolved, "r");
|
|
65959
|
+
try {
|
|
65960
|
+
import_node_fs63.default.readSync(fd, magic, 0, 8, 0);
|
|
65961
|
+
} finally {
|
|
65962
|
+
import_node_fs63.default.closeSync(fd);
|
|
65963
|
+
}
|
|
65964
|
+
kind = magic.toString("ascii") === "!<arch>\n" ? "archive" : "object";
|
|
65965
|
+
}
|
|
65966
|
+
inputs2.set(resolved, kind);
|
|
65648
65967
|
}
|
|
65649
|
-
if (magic.subarray(0, 4).equals(Buffer.from([0, 97, 115, 109])) || magic.subarray(0, 4).equals(Buffer.from([66, 67, 192, 222])) || magic.toString("ascii") === "!<arch>\n" || magic.toString("ascii") === "!<thin>\n")
|
|
65650
|
-
file = arg;
|
|
65651
65968
|
}
|
|
65652
|
-
if (file) inputs2.add(import_node_path61.default.resolve(file));
|
|
65653
65969
|
}
|
|
65654
|
-
return [...inputs2];
|
|
65655
|
-
}
|
|
65656
|
-
function unownedGuestLinkInputs(plan, args) {
|
|
65657
|
-
const owned = new Set(plan.artifacts.map((artifact) => import_node_path61.default.resolve(artifact.path)));
|
|
65658
|
-
return guestLinkInputFiles(args).filter((file) => !owned.has(file));
|
|
65970
|
+
return [...inputs2].map(([filePath, kind]) => ({ path: filePath, kind }));
|
|
65659
65971
|
}
|
|
65660
65972
|
function occurrences(plan, args) {
|
|
65661
65973
|
const dirs = [];
|
|
@@ -65821,15 +66133,15 @@ function withOutput(args, output, discovery) {
|
|
|
65821
66133
|
result.push("-o", output);
|
|
65822
66134
|
return result;
|
|
65823
66135
|
}
|
|
65824
|
-
function linkGuestImages(options2) {
|
|
66136
|
+
async function linkGuestImages(options2) {
|
|
65825
66137
|
const { args, directory: directory2, wasmLd, clang, llvmAr } = options2;
|
|
65826
66138
|
let plan = options2.plan;
|
|
65827
66139
|
if (!plan.images.some((image) => image.id === options2.ledgerDataImage))
|
|
65828
66140
|
throw new Error(`unknown ledger data image ${options2.ledgerDataImage}`);
|
|
65829
66141
|
import_node_fs63.default.mkdirSync(directory2, { recursive: true });
|
|
65830
|
-
|
|
66142
|
+
let discovery = import_node_path61.default.join(directory2, "discovery.wasm");
|
|
65831
66143
|
const whyPath = import_node_path61.default.join(directory2, "why-extract.txt");
|
|
65832
|
-
|
|
66144
|
+
let mapPath = import_node_path61.default.join(directory2, "discovery.map");
|
|
65833
66145
|
const runLink = (name3, arguments_) => {
|
|
65834
66146
|
const response = import_node_path61.default.join(directory2, `${name3}.rsp`);
|
|
65835
66147
|
const trace = import_node_path61.default.join(directory2, `${name3}-inputs.txt`);
|
|
@@ -65848,19 +66160,24 @@ function linkGuestImages(options2) {
|
|
|
65848
66160
|
}
|
|
65849
66161
|
return import_node_fs63.default.readFileSync(trace, "utf8");
|
|
65850
66162
|
};
|
|
66163
|
+
const preselection = options2.projection && options2.preselectionDiscovery ? options2.preselectionDiscovery : void 0;
|
|
65851
66164
|
let discoveryProjection;
|
|
65852
66165
|
if (options2.projection) {
|
|
65853
|
-
|
|
65854
|
-
|
|
65855
|
-
|
|
65856
|
-
source,
|
|
65857
|
-
|
|
65858
|
-
|
|
65859
|
-
|
|
65860
|
-
|
|
65861
|
-
|
|
65862
|
-
|
|
65863
|
-
|
|
66166
|
+
if (preselection) {
|
|
66167
|
+
discoveryProjection = preselection.projectionObject;
|
|
66168
|
+
} else {
|
|
66169
|
+
const source = import_node_path61.default.join(directory2, "projection-discovery.c");
|
|
66170
|
+
discoveryProjection = import_node_path61.default.join(directory2, "projection-discovery.o");
|
|
66171
|
+
import_node_fs63.default.writeFileSync(
|
|
66172
|
+
source,
|
|
66173
|
+
'#include "guest-image-projection.h"\nconst struct peach_guest_image __peach_guest_images[] = {{0}};\nconst uint32_t __peach_guest_image_count = 0;\n'
|
|
66174
|
+
);
|
|
66175
|
+
(0, import_node_child_process30.execFileSync)(
|
|
66176
|
+
clang,
|
|
66177
|
+
[...options2.projection.clangOptions, "-c", source, "-o", discoveryProjection],
|
|
66178
|
+
{ stdio: "pipe" }
|
|
66179
|
+
);
|
|
66180
|
+
}
|
|
65864
66181
|
}
|
|
65865
66182
|
const archives = /* @__PURE__ */ new Map();
|
|
65866
66183
|
const memberBytes = /* @__PURE__ */ new Map();
|
|
@@ -65898,6 +66215,17 @@ function linkGuestImages(options2) {
|
|
|
65898
66215
|
}
|
|
65899
66216
|
return byName2.get(item.member);
|
|
65900
66217
|
};
|
|
66218
|
+
const reusePreselection = () => {
|
|
66219
|
+
discovery = preselection.wasm;
|
|
66220
|
+
mapPath = preselection.map;
|
|
66221
|
+
return selectedGuestLinkInputs(
|
|
66222
|
+
plan,
|
|
66223
|
+
args,
|
|
66224
|
+
import_node_fs63.default.readFileSync(preselection.why, "utf8"),
|
|
66225
|
+
import_node_fs63.default.readFileSync(preselection.trace, "utf8"),
|
|
66226
|
+
archives
|
|
66227
|
+
);
|
|
66228
|
+
};
|
|
65901
66229
|
const discover = (provider2) => {
|
|
65902
66230
|
const trace = runLink("discovery", [
|
|
65903
66231
|
...withOutput(args, discovery, true),
|
|
@@ -65927,9 +66255,10 @@ function linkGuestImages(options2) {
|
|
|
65927
66255
|
const eagerProvider = [...eagerObjects].some(
|
|
65928
66256
|
(artifact) => needsProvider({ artifact, member: null })
|
|
65929
66257
|
);
|
|
65930
|
-
let selected = discover(eagerProvider);
|
|
66258
|
+
let selected = eagerProvider && preselection ? reusePreselection() : discover(eagerProvider);
|
|
65931
66259
|
const provider = eagerProvider || selected.some((item) => !eagerObjects.has(item.artifact) && needsProvider(item));
|
|
65932
|
-
if (provider && !eagerProvider)
|
|
66260
|
+
if (provider && !eagerProvider)
|
|
66261
|
+
selected = preselection ? reusePreselection() : discover(true);
|
|
65933
66262
|
if (options2.resolvePlan) {
|
|
65934
66263
|
const identity2 = (value) => JSON.stringify([
|
|
65935
66264
|
value.images.map(({ id, name: name3 }) => [id, name3]),
|
|
@@ -65970,11 +66299,11 @@ function linkGuestImages(options2) {
|
|
|
65970
66299
|
const product = (item.member === null ? void 0 : artifact.memberSdkProducts?.get(item.member)) ?? artifact.sdkProduct;
|
|
65971
66300
|
let sdkProduct;
|
|
65972
66301
|
if (sharedSdk && product !== void 0) {
|
|
65973
|
-
const
|
|
65974
|
-
if (
|
|
66302
|
+
const original = options2.projection?.identities.get(artifact.path);
|
|
66303
|
+
if (original === void 0)
|
|
65975
66304
|
throw new Error(`SDK input has no projection identity ${artifact.path}`);
|
|
65976
66305
|
const origin = item.member === null ? void 0 : artifact.memberOrigins?.get(item.member);
|
|
65977
|
-
const identity2 = item.member === null ?
|
|
66306
|
+
const identity2 = item.member === null ? original : guestRuntimeMemberIdentity(original, {
|
|
65978
66307
|
member: origin?.name ?? item.member,
|
|
65979
66308
|
ordinal: origin?.ordinal ?? 1
|
|
65980
66309
|
});
|
|
@@ -66041,76 +66370,11 @@ function linkGuestImages(options2) {
|
|
|
66041
66370
|
),
|
|
66042
66371
|
sdkCallerImages
|
|
66043
66372
|
});
|
|
66044
|
-
const
|
|
66045
|
-
const linkedOwners = /* @__PURE__ */ new Map();
|
|
66046
|
-
const ledgerObjects = new Map(ledger.objects.map((item) => [item.path, item]));
|
|
66047
|
-
const appObjects = /* @__PURE__ */ new Map();
|
|
66048
|
-
const sdkObjects = /* @__PURE__ */ new Map();
|
|
66049
|
-
const finalArchives = /* @__PURE__ */ new Map();
|
|
66050
|
-
for (const [index, artifact] of plan.artifacts.entries()) {
|
|
66051
|
-
const prefix = `${artifact.path}(`;
|
|
66052
|
-
if (artifact.kind === "object") {
|
|
66053
|
-
const object9 = ledgerObjects.get(artifact.path);
|
|
66054
|
-
if (!object9) continue;
|
|
66055
|
-
const output2 = import_node_path61.default.join(directory2, `object-${index}.o`);
|
|
66056
|
-
import_node_fs63.default.writeFileSync(output2, object9.bytes);
|
|
66057
|
-
replacements.set(artifact.path, output2);
|
|
66058
|
-
linkedOwners.set(output2, selectedGuestInputImage(artifact, null));
|
|
66059
|
-
const image = selectedGuestInputImage(artifact, null);
|
|
66060
|
-
if (object9.sdkProduct === void 0) appObjects.set(output2, image);
|
|
66061
|
-
else
|
|
66062
|
-
sdkObjects.set(output2, {
|
|
66063
|
-
image,
|
|
66064
|
-
product: object9.sdkProduct,
|
|
66065
|
-
identity: sdkIdentities.get(object9.path)
|
|
66066
|
-
});
|
|
66067
|
-
continue;
|
|
66068
|
-
}
|
|
66069
|
-
const members2 = archives.get(artifact.path);
|
|
66070
|
-
if (!members2) continue;
|
|
66071
|
-
const listing = (0, import_node_child_process30.execFileSync)(llvmAr, ["t", artifact.path], {
|
|
66072
|
-
encoding: "utf8"
|
|
66073
|
-
}).trimEnd();
|
|
66074
|
-
const listed = listing ? listing.split("\n") : [];
|
|
66075
|
-
if (listed.length !== members2.length || new Set(listed).size !== listed.length || members2.some(
|
|
66076
|
-
(member, i) => listed[i] !== member.name || import_node_path61.default.basename(member.name) !== member.name
|
|
66077
|
-
))
|
|
66078
|
-
throw new Error(`unsupported archive layout ${artifact.path}`);
|
|
66079
|
-
const memberDir = import_node_path61.default.join(directory2, `archive-${index}`);
|
|
66080
|
-
import_node_fs63.default.mkdirSync(memberDir, { recursive: true });
|
|
66081
|
-
const output = import_node_path61.default.join(directory2, `archive-${index}.a`);
|
|
66082
|
-
const inputs2 = members2.map((member) => {
|
|
66083
|
-
const memberOutput = import_node_path61.default.join(memberDir, member.name);
|
|
66084
|
-
const rewritten = ledgerObjects.get(`${prefix}${member.name})`);
|
|
66085
|
-
import_node_fs63.default.writeFileSync(memberOutput, rewritten?.bytes ?? member.bytes);
|
|
66086
|
-
if (rewritten) {
|
|
66087
|
-
const image = selectedGuestInputImage(artifact, member.name);
|
|
66088
|
-
linkedOwners.set(`${output}(${member.name})`, image);
|
|
66089
|
-
if (rewritten.sdkProduct === void 0) appObjects.set(memberOutput, image);
|
|
66090
|
-
else
|
|
66091
|
-
sdkObjects.set(`${output}(${member.name})`, {
|
|
66092
|
-
image,
|
|
66093
|
-
product: rewritten.sdkProduct,
|
|
66094
|
-
identity: sdkIdentities.get(rewritten.path)
|
|
66095
|
-
});
|
|
66096
|
-
}
|
|
66097
|
-
return memberOutput;
|
|
66098
|
-
});
|
|
66099
|
-
import_node_fs63.default.rmSync(output, { force: true });
|
|
66100
|
-
const response = import_node_path61.default.join(memberDir, "members.rsp");
|
|
66101
|
-
import_node_fs63.default.writeFileSync(response, inputs2.map((input) => JSON.stringify(input)).join(" "));
|
|
66102
|
-
(0, import_node_child_process30.execFileSync)(llvmAr, ["rcs", output, `@${response}`], { stdio: "pipe" });
|
|
66103
|
-
finalArchives.set(
|
|
66104
|
-
output,
|
|
66105
|
-
members2.map((member) => ({ name: member.name, bytes: new Uint8Array(0) }))
|
|
66106
|
-
);
|
|
66107
|
-
replacements.set(artifact.path, output);
|
|
66108
|
-
}
|
|
66109
|
-
const compileLedger = (name3, source) => {
|
|
66373
|
+
const compileLedgerAsync = (name3, source) => {
|
|
66110
66374
|
const irPath = import_node_path61.default.join(directory2, `${name3}.ll`);
|
|
66111
66375
|
const object9 = import_node_path61.default.join(directory2, `${name3}.o`);
|
|
66112
66376
|
import_node_fs63.default.writeFileSync(irPath, source);
|
|
66113
|
-
|
|
66377
|
+
return execFileAsync(
|
|
66114
66378
|
clang,
|
|
66115
66379
|
[
|
|
66116
66380
|
"--target=wasm64-unknown-wasip1-threads",
|
|
@@ -66120,177 +66384,264 @@ function linkGuestImages(options2) {
|
|
|
66120
66384
|
"-o",
|
|
66121
66385
|
object9
|
|
66122
66386
|
],
|
|
66123
|
-
{
|
|
66124
|
-
);
|
|
66125
|
-
return object9;
|
|
66387
|
+
{ maxBuffer: 64 * 1024 * 1024 }
|
|
66388
|
+
).then(() => object9);
|
|
66126
66389
|
};
|
|
66127
|
-
const
|
|
66128
|
-
const
|
|
66129
|
-
|
|
66130
|
-
|
|
66131
|
-
|
|
66132
|
-
ledger.
|
|
66133
|
-
|
|
66134
|
-
|
|
66135
|
-
|
|
66136
|
-
|
|
66137
|
-
|
|
66138
|
-
|
|
66139
|
-
|
|
66140
|
-
|
|
66141
|
-
|
|
66142
|
-
|
|
66143
|
-
|
|
66144
|
-
|
|
66145
|
-
|
|
66146
|
-
|
|
66147
|
-
|
|
66148
|
-
|
|
66149
|
-
|
|
66150
|
-
|
|
66151
|
-
|
|
66152
|
-
|
|
66153
|
-
|
|
66154
|
-
|
|
66155
|
-
|
|
66156
|
-
|
|
66157
|
-
|
|
66158
|
-
|
|
66159
|
-
|
|
66160
|
-
|
|
66161
|
-
|
|
66162
|
-
|
|
66163
|
-
|
|
66164
|
-
|
|
66165
|
-
|
|
66166
|
-
|
|
66167
|
-
|
|
66168
|
-
|
|
66169
|
-
|
|
66170
|
-
|
|
66171
|
-
|
|
66172
|
-
|
|
66173
|
-
|
|
66174
|
-
|
|
66175
|
-
|
|
66176
|
-
|
|
66177
|
-
|
|
66178
|
-
|
|
66179
|
-
|
|
66180
|
-
|
|
66181
|
-
|
|
66182
|
-
|
|
66183
|
-
|
|
66184
|
-
})
|
|
66185
|
-
);
|
|
66186
|
-
objectBytes.clear();
|
|
66187
|
-
memberBytes.clear();
|
|
66188
|
-
archives.clear();
|
|
66189
|
-
if (!discoveryRegions) throw new Error("guest projection layout object missing");
|
|
66190
|
-
const regionsBefore = discoveryRegions;
|
|
66191
|
-
const ledgerPieces = guestProjectionRegionCapacity([import_node_fs63.default.readFileSync(ledgerObject)], 0);
|
|
66192
|
-
const bundleCount = images.filter(
|
|
66193
|
-
(image) => image.resourceBundlePath !== void 0
|
|
66194
|
-
).length;
|
|
66195
|
-
const projectionPieces = images.length + 2 + (bundleCount ? bundleCount + 1 : 0);
|
|
66196
|
-
let capacities = ledger.images.map((image) => ({
|
|
66197
|
-
regions: regionsBefore[image.id] + 1 + ledger.callerWrappers.filter((wrapper) => wrapper.image === image.id).length + (image.id === options2.ledgerDataImage ? ledgerPieces : 0) + (image.id === projection.image ? projectionPieces : 0),
|
|
66198
|
-
memoryProtection: projection.memoryProtection,
|
|
66199
|
-
tableProtection: projection.tableProtection
|
|
66200
|
-
}));
|
|
66201
|
-
const projectionSource = import_node_path61.default.join(directory2, "projection.c");
|
|
66202
|
-
projectionObject = import_node_path61.default.join(directory2, "projection.o");
|
|
66203
|
-
const callerMap = args.find((arg) => arg.startsWith("--Map="))?.slice("--Map=".length);
|
|
66204
|
-
const layoutMap = callerMap ?? import_node_path61.default.join(directory2, "projection-layout.map");
|
|
66205
|
-
for (; ; ) {
|
|
66206
|
-
projectionStorage = reserveGuestProjectionStorage(images, capacities);
|
|
66207
|
-
import_node_fs63.default.writeFileSync(projectionSource, projectionStorage.source);
|
|
66208
|
-
(0, import_node_child_process30.execFileSync)(
|
|
66209
|
-
clang,
|
|
66210
|
-
[...projection.clangOptions, "-c", projectionSource, "-o", projectionObject],
|
|
66211
|
-
{ stdio: "pipe" }
|
|
66212
|
-
);
|
|
66213
|
-
finalTrace = linkFinal(projectionObject, callerMap ? void 0 : layoutMap);
|
|
66214
|
-
if (sharedSdk) break;
|
|
66215
|
-
const wasm = import_node_fs63.default.readFileSync(finalOutput);
|
|
66216
|
-
const actual = guestProjectionRegionCounts(
|
|
66217
|
-
images.length,
|
|
66218
|
-
guestLinkedSpans(
|
|
66219
|
-
guestLinkLines(layoutMap),
|
|
66220
|
-
wasm,
|
|
66221
|
-
wasm,
|
|
66222
|
-
new Map(linkedOwners).set(projectionObject, projection.image),
|
|
66223
|
-
sectionOwners
|
|
66224
|
-
)
|
|
66390
|
+
const ledgerObjectPromise = compileLedgerAsync("ledger", ledger.llvmIR);
|
|
66391
|
+
const appLedgerObjectPromise = options2.onSplitInputs && ledger.appLLVMIR ? compileLedgerAsync("app-ledger", ledger.appLLVMIR) : void 0;
|
|
66392
|
+
try {
|
|
66393
|
+
const replacements = /* @__PURE__ */ new Map();
|
|
66394
|
+
const linkedOwners = /* @__PURE__ */ new Map();
|
|
66395
|
+
const ledgerObjects = new Map(ledger.objects.map((item) => [item.path, item]));
|
|
66396
|
+
const appObjects = /* @__PURE__ */ new Map();
|
|
66397
|
+
const sdkObjects = /* @__PURE__ */ new Map();
|
|
66398
|
+
const finalArchives = /* @__PURE__ */ new Map();
|
|
66399
|
+
const archiveJobs = [];
|
|
66400
|
+
for (const [index, artifact] of plan.artifacts.entries()) {
|
|
66401
|
+
const prefix = `${artifact.path}(`;
|
|
66402
|
+
if (artifact.kind === "object") {
|
|
66403
|
+
const object9 = ledgerObjects.get(artifact.path);
|
|
66404
|
+
if (!object9) continue;
|
|
66405
|
+
const output2 = import_node_path61.default.join(directory2, `object-${index}.o`);
|
|
66406
|
+
import_node_fs63.default.writeFileSync(output2, object9.bytes);
|
|
66407
|
+
replacements.set(artifact.path, output2);
|
|
66408
|
+
linkedOwners.set(output2, selectedGuestInputImage(artifact, null));
|
|
66409
|
+
const image = selectedGuestInputImage(artifact, null);
|
|
66410
|
+
if (object9.sdkProduct === void 0) appObjects.set(output2, image);
|
|
66411
|
+
else
|
|
66412
|
+
sdkObjects.set(output2, {
|
|
66413
|
+
image,
|
|
66414
|
+
product: object9.sdkProduct,
|
|
66415
|
+
identity: sdkIdentities.get(object9.path)
|
|
66416
|
+
});
|
|
66417
|
+
continue;
|
|
66418
|
+
}
|
|
66419
|
+
const members2 = archives.get(artifact.path);
|
|
66420
|
+
if (!members2) continue;
|
|
66421
|
+
const memberDir = import_node_path61.default.join(directory2, `archive-${index}`);
|
|
66422
|
+
import_node_fs63.default.mkdirSync(memberDir, { recursive: true });
|
|
66423
|
+
const output = import_node_path61.default.join(directory2, `archive-${index}.a`);
|
|
66424
|
+
const inputs2 = members2.map((member) => {
|
|
66425
|
+
const memberOutput = import_node_path61.default.join(memberDir, member.name);
|
|
66426
|
+
const rewritten = ledgerObjects.get(`${prefix}${member.name})`);
|
|
66427
|
+
import_node_fs63.default.writeFileSync(memberOutput, rewritten?.bytes ?? member.bytes);
|
|
66428
|
+
if (rewritten) {
|
|
66429
|
+
const image = selectedGuestInputImage(artifact, member.name);
|
|
66430
|
+
linkedOwners.set(`${output}(${member.name})`, image);
|
|
66431
|
+
if (rewritten.sdkProduct === void 0) appObjects.set(memberOutput, image);
|
|
66432
|
+
else
|
|
66433
|
+
sdkObjects.set(`${output}(${member.name})`, {
|
|
66434
|
+
image,
|
|
66435
|
+
product: rewritten.sdkProduct,
|
|
66436
|
+
identity: sdkIdentities.get(rewritten.path)
|
|
66437
|
+
});
|
|
66438
|
+
}
|
|
66439
|
+
return memberOutput;
|
|
66440
|
+
});
|
|
66441
|
+
import_node_fs63.default.rmSync(output, { force: true });
|
|
66442
|
+
const response = import_node_path61.default.join(memberDir, "members.rsp");
|
|
66443
|
+
import_node_fs63.default.writeFileSync(response, inputs2.map((input) => JSON.stringify(input)).join(" "));
|
|
66444
|
+
finalArchives.set(
|
|
66445
|
+
output,
|
|
66446
|
+
members2.map((member) => ({ name: member.name, bytes: new Uint8Array(0) }))
|
|
66225
66447
|
);
|
|
66226
|
-
|
|
66227
|
-
|
|
66228
|
-
...capacity,
|
|
66229
|
-
regions: Math.max(actual[index], capacity.regions)
|
|
66230
|
-
}));
|
|
66448
|
+
replacements.set(artifact.path, output);
|
|
66449
|
+
archiveJobs.push({ artifact, index, members: members2, memberDir, output, response });
|
|
66231
66450
|
}
|
|
66232
|
-
|
|
66233
|
-
|
|
66234
|
-
|
|
66235
|
-
|
|
66236
|
-
|
|
66237
|
-
|
|
66238
|
-
|
|
66239
|
-
|
|
66240
|
-
|
|
66241
|
-
|
|
66242
|
-
|
|
66243
|
-
|
|
66244
|
-
|
|
66245
|
-
|
|
66246
|
-
|
|
66247
|
-
|
|
66248
|
-
|
|
66249
|
-
|
|
66250
|
-
|
|
66251
|
-
);
|
|
66252
|
-
|
|
66253
|
-
|
|
66254
|
-
import_node_fs63.default.writeFileSync(
|
|
66255
|
-
outputPath(args),
|
|
66256
|
-
nameGuestImageAliases(import_node_fs63.default.readFileSync(outputPath(args)), plan.symbols)
|
|
66257
|
-
);
|
|
66258
|
-
if (projectionStorage && projectionObject)
|
|
66259
|
-
options2.projection.onReserved(projectionStorage, projectionObject);
|
|
66260
|
-
options2.onLinkedOwners?.(linkedOwners);
|
|
66261
|
-
options2.onLinkedSections?.(sectionOwners);
|
|
66262
|
-
options2.onDyldRows?.(ledger);
|
|
66263
|
-
if (options2.onSplitInputs && ledger.appLLVMIR) {
|
|
66264
|
-
const appLedgerObject = compileLedger("app-ledger", ledger.appLLVMIR);
|
|
66265
|
-
const appSections = new Map(
|
|
66451
|
+
const [ledgerObject] = await Promise.all([
|
|
66452
|
+
ledgerObjectPromise,
|
|
66453
|
+
mapLimit(archiveJobs, 8, async ({ artifact, members: members2, output, response }) => {
|
|
66454
|
+
const { stdout } = await execFileAsync(llvmAr, ["t", artifact.path], {
|
|
66455
|
+
encoding: "utf8",
|
|
66456
|
+
maxBuffer: 64 * 1024 * 1024
|
|
66457
|
+
});
|
|
66458
|
+
const listing = stdout.trimEnd();
|
|
66459
|
+
const listed = listing ? listing.split("\n") : [];
|
|
66460
|
+
if (listed.length !== members2.length || new Set(listed).size !== listed.length || members2.some(
|
|
66461
|
+
(member, i) => listed[i] !== member.name || import_node_path61.default.basename(member.name) !== member.name
|
|
66462
|
+
))
|
|
66463
|
+
throw new Error(`unsupported archive layout ${artifact.path}`);
|
|
66464
|
+
await execFileAsync(llvmAr, ["rcs", output, `@${response}`], {
|
|
66465
|
+
maxBuffer: 64 * 1024 * 1024
|
|
66466
|
+
});
|
|
66467
|
+
})
|
|
66468
|
+
]);
|
|
66469
|
+
const lazyExports = import_node_path61.default.join(directory2, "lazy-exports.rsp");
|
|
66470
|
+
import_node_fs63.default.writeFileSync(lazyExports, guestLazyExports(ledger.lazyFunctions));
|
|
66471
|
+
linkedOwners.set(ledgerObject, options2.ledgerDataImage);
|
|
66472
|
+
const sectionOwners = new Map(
|
|
66266
66473
|
ledger.callerWrappers.map(({ symbol: symbol2, image }) => [
|
|
66267
|
-
`${
|
|
66474
|
+
`${ledgerObject}:(${symbol2})`,
|
|
66268
66475
|
image
|
|
66269
66476
|
])
|
|
66270
66477
|
);
|
|
66271
|
-
|
|
66272
|
-
|
|
66273
|
-
|
|
66274
|
-
|
|
66275
|
-
|
|
66276
|
-
|
|
66277
|
-
|
|
66278
|
-
|
|
66279
|
-
|
|
66280
|
-
|
|
66281
|
-
|
|
66282
|
-
|
|
66283
|
-
options2.onSplitInputs({
|
|
66284
|
-
appObjects,
|
|
66285
|
-
appSections,
|
|
66286
|
-
sdkObjects,
|
|
66287
|
-
lazyFunctions: ledger.appLazyFunctions ?? [],
|
|
66288
|
-
dyldSymbols: ledger.dyldSymbols,
|
|
66289
|
-
appReferencedSymbols,
|
|
66290
|
-
appDefinedSymbols
|
|
66478
|
+
const byToken = new Map(
|
|
66479
|
+
occurrences(plan, args).map(({ artifact, token }) => [
|
|
66480
|
+
token,
|
|
66481
|
+
replacements.get(artifact.path)
|
|
66482
|
+
])
|
|
66483
|
+
);
|
|
66484
|
+
const placed = /* @__PURE__ */ new Set();
|
|
66485
|
+
const finalArgs = args.map((arg) => byToken.get(arg) ?? arg).filter((arg) => {
|
|
66486
|
+
if (!arg.endsWith(".o") && !arg.endsWith(".a")) return true;
|
|
66487
|
+
if (placed.has(arg)) return false;
|
|
66488
|
+
placed.add(arg);
|
|
66489
|
+
return true;
|
|
66291
66490
|
});
|
|
66491
|
+
const finalOutput = import_node_path61.default.join(directory2, "final.wasm");
|
|
66492
|
+
const finalWhy = import_node_path61.default.join(directory2, "final-why-extract.txt");
|
|
66493
|
+
const linkFinal = (projectionObject2, layoutMap) => runLink("final", [
|
|
66494
|
+
...withOutput(finalArgs, finalOutput, false),
|
|
66495
|
+
ledgerObject,
|
|
66496
|
+
`@${lazyExports}`,
|
|
66497
|
+
...projectionObject2 ? [projectionObject2] : [],
|
|
66498
|
+
...provider ? [`--undefined=${providerSymbol}`] : [],
|
|
66499
|
+
...layoutMap ? [`--Map=${layoutMap}`] : [],
|
|
66500
|
+
`--why-extract=${finalWhy}`
|
|
66501
|
+
]);
|
|
66502
|
+
let projectionObject;
|
|
66503
|
+
let projectionStorage;
|
|
66504
|
+
let finalTrace;
|
|
66505
|
+
if (options2.projection) {
|
|
66506
|
+
const projection = options2.projection;
|
|
66507
|
+
if (!plan.images.some((image) => image.id === projection.image))
|
|
66508
|
+
throw new Error("guest projection has no source image");
|
|
66509
|
+
if (projection.images.length !== plan.images.length || projection.images.some(
|
|
66510
|
+
(image, index) => image.image !== index || plan.images[index]?.id !== index
|
|
66511
|
+
))
|
|
66512
|
+
throw new Error("guest projection image order differs from link plan");
|
|
66513
|
+
const selectedInputs = selectedGuestManifestInputs(
|
|
66514
|
+
plan,
|
|
66515
|
+
selected,
|
|
66516
|
+
projection.identities,
|
|
66517
|
+
readSelected
|
|
66518
|
+
);
|
|
66519
|
+
const images = projection.images.map(
|
|
66520
|
+
(image) => createGuestImageManifest({
|
|
66521
|
+
...image,
|
|
66522
|
+
inputs: selectedInputs.get(image.image) ?? [],
|
|
66523
|
+
linkOptions: projection.linkOptions,
|
|
66524
|
+
regions: []
|
|
66525
|
+
})
|
|
66526
|
+
);
|
|
66527
|
+
objectBytes.clear();
|
|
66528
|
+
memberBytes.clear();
|
|
66529
|
+
archives.clear();
|
|
66530
|
+
if (!discoveryRegions) throw new Error("guest projection layout object missing");
|
|
66531
|
+
const regionsBefore = discoveryRegions;
|
|
66532
|
+
const ledgerPieces = guestProjectionRegionCapacity(
|
|
66533
|
+
[import_node_fs63.default.readFileSync(ledgerObject)],
|
|
66534
|
+
0
|
|
66535
|
+
);
|
|
66536
|
+
const bundleCount = images.filter(
|
|
66537
|
+
(image) => image.resourceBundlePath !== void 0
|
|
66538
|
+
).length;
|
|
66539
|
+
const projectionPieces = images.length + 2 + (bundleCount ? bundleCount + 1 : 0);
|
|
66540
|
+
let capacities = ledger.images.map((image) => ({
|
|
66541
|
+
regions: regionsBefore[image.id] + 1 + ledger.callerWrappers.filter((wrapper) => wrapper.image === image.id).length + (image.id === options2.ledgerDataImage ? ledgerPieces : 0) + (image.id === projection.image ? projectionPieces : 0),
|
|
66542
|
+
memoryProtection: projection.memoryProtection,
|
|
66543
|
+
tableProtection: projection.tableProtection
|
|
66544
|
+
}));
|
|
66545
|
+
const projectionSource = import_node_path61.default.join(directory2, "projection.c");
|
|
66546
|
+
projectionObject = import_node_path61.default.join(directory2, "projection.o");
|
|
66547
|
+
const callerMap = args.find((arg) => arg.startsWith("--Map="))?.slice("--Map=".length);
|
|
66548
|
+
const layoutMap = callerMap ?? import_node_path61.default.join(directory2, "projection-layout.map");
|
|
66549
|
+
for (; ; ) {
|
|
66550
|
+
projectionStorage = reserveGuestProjectionStorage(images, capacities);
|
|
66551
|
+
import_node_fs63.default.writeFileSync(projectionSource, projectionStorage.source);
|
|
66552
|
+
(0, import_node_child_process30.execFileSync)(
|
|
66553
|
+
clang,
|
|
66554
|
+
[...projection.clangOptions, "-c", projectionSource, "-o", projectionObject],
|
|
66555
|
+
{ stdio: "pipe" }
|
|
66556
|
+
);
|
|
66557
|
+
finalTrace = linkFinal(projectionObject, callerMap ? void 0 : layoutMap);
|
|
66558
|
+
if (sharedSdk) break;
|
|
66559
|
+
const wasm = import_node_fs63.default.readFileSync(finalOutput);
|
|
66560
|
+
const actual = guestProjectionRegionCounts(
|
|
66561
|
+
images.length,
|
|
66562
|
+
guestLinkedSpans(
|
|
66563
|
+
guestLinkLines(layoutMap),
|
|
66564
|
+
wasm,
|
|
66565
|
+
wasm,
|
|
66566
|
+
new Map(linkedOwners).set(projectionObject, projection.image),
|
|
66567
|
+
sectionOwners
|
|
66568
|
+
)
|
|
66569
|
+
);
|
|
66570
|
+
if (actual.every((count, index) => count <= capacities[index].regions)) break;
|
|
66571
|
+
capacities = capacities.map((capacity, index) => ({
|
|
66572
|
+
...capacity,
|
|
66573
|
+
regions: Math.max(actual[index], capacity.regions)
|
|
66574
|
+
}));
|
|
66575
|
+
}
|
|
66576
|
+
linkedOwners.set(projectionObject, projection.image);
|
|
66577
|
+
} else finalTrace = linkFinal();
|
|
66578
|
+
const finalSelection = selectedGuestLinkInputs(
|
|
66579
|
+
remapGuestLinkPlan(plan, replacements),
|
|
66580
|
+
finalArgs,
|
|
66581
|
+
import_node_fs63.default.readFileSync(finalWhy, "utf8"),
|
|
66582
|
+
finalTrace,
|
|
66583
|
+
finalArchives
|
|
66584
|
+
);
|
|
66585
|
+
const original = new Map([...replacements].map(([before2, after2]) => [after2, before2]));
|
|
66586
|
+
const key2 = (item) => JSON.stringify([original.get(item.artifact) ?? item.artifact, item.member]);
|
|
66587
|
+
const before = new Set(selected.map(key2));
|
|
66588
|
+
const after = new Set(finalSelection.map(key2));
|
|
66589
|
+
const changed2 = [...before].filter((item) => !after.has(item));
|
|
66590
|
+
changed2.push(...[...after].filter((item) => !before.has(item)));
|
|
66591
|
+
if (changed2.length)
|
|
66592
|
+
throw new Error(
|
|
66593
|
+
`guest link selected different inputs after rewriting:
|
|
66594
|
+
${changed2.join("\n")}`
|
|
66595
|
+
);
|
|
66596
|
+
import_node_fs63.default.renameSync(finalOutput, outputPath(args));
|
|
66597
|
+
if (KEEP_WASM_NAMES)
|
|
66598
|
+
import_node_fs63.default.writeFileSync(
|
|
66599
|
+
outputPath(args),
|
|
66600
|
+
nameGuestImageAliases(import_node_fs63.default.readFileSync(outputPath(args)), plan.symbols)
|
|
66601
|
+
);
|
|
66602
|
+
if (projectionStorage && projectionObject)
|
|
66603
|
+
options2.projection.onReserved(projectionStorage, projectionObject);
|
|
66604
|
+
options2.onLinkedOwners?.(linkedOwners);
|
|
66605
|
+
options2.onLinkedSections?.(sectionOwners);
|
|
66606
|
+
options2.onDyldRows?.(ledger);
|
|
66607
|
+
if (options2.onSplitInputs && appLedgerObjectPromise) {
|
|
66608
|
+
const appLedgerObject = await appLedgerObjectPromise;
|
|
66609
|
+
const appSections = new Map(
|
|
66610
|
+
ledger.callerWrappers.map(({ symbol: symbol2, image }) => [
|
|
66611
|
+
`${appLedgerObject}:(${symbol2})`,
|
|
66612
|
+
image
|
|
66613
|
+
])
|
|
66614
|
+
);
|
|
66615
|
+
appObjects.set(appLedgerObject, options2.ledgerDataImage);
|
|
66616
|
+
let appReferencedSymbols;
|
|
66617
|
+
let appDefinedSymbols;
|
|
66618
|
+
if (ledger.appReferencedSymbols && ledger.appDefinedSymbols) {
|
|
66619
|
+
const referenced = new Set(ledger.appReferencedSymbols);
|
|
66620
|
+
const defined = new Set(ledger.appDefinedSymbols);
|
|
66621
|
+
const ledgerSyms = guestWasmSymbols(import_node_fs63.default.readFileSync(appLedgerObject));
|
|
66622
|
+
for (const name3 of ledgerSyms.undefined) referenced.add(name3);
|
|
66623
|
+
for (const name3 of ledgerSyms.defined) defined.add(name3);
|
|
66624
|
+
appReferencedSymbols = referenced;
|
|
66625
|
+
appDefinedSymbols = defined;
|
|
66626
|
+
}
|
|
66627
|
+
options2.onSplitInputs({
|
|
66628
|
+
appObjects,
|
|
66629
|
+
appSections,
|
|
66630
|
+
sdkObjects,
|
|
66631
|
+
lazyFunctions: ledger.appLazyFunctions ?? [],
|
|
66632
|
+
dyldSymbols: ledger.dyldSymbols,
|
|
66633
|
+
appReferencedSymbols,
|
|
66634
|
+
appDefinedSymbols
|
|
66635
|
+
});
|
|
66636
|
+
}
|
|
66637
|
+
return selected;
|
|
66638
|
+
} catch (error) {
|
|
66639
|
+
await Promise.allSettled([
|
|
66640
|
+
ledgerObjectPromise,
|
|
66641
|
+
...appLedgerObjectPromise ? [appLedgerObjectPromise] : []
|
|
66642
|
+
]);
|
|
66643
|
+
throw error;
|
|
66292
66644
|
}
|
|
66293
|
-
return selected;
|
|
66294
66645
|
}
|
|
66295
66646
|
function linkedMapSymbols(lines) {
|
|
66296
66647
|
const names = /* @__PURE__ */ new Set();
|
|
@@ -66392,24 +66743,19 @@ function aliasGuestLinkArguments(input, archives) {
|
|
|
66392
66743
|
throw new Error("aliased guest archive is not a link input");
|
|
66393
66744
|
return result;
|
|
66394
66745
|
}
|
|
66395
|
-
function linkCompleteGuestImages(options2) {
|
|
66746
|
+
async function linkCompleteGuestImages(options2) {
|
|
66396
66747
|
const args = normalizedGuestLinkArgs(options2.args);
|
|
66397
|
-
const
|
|
66398
|
-
|
|
66399
|
-
|
|
66400
|
-
|
|
66401
|
-
|
|
66402
|
-
import_node_fs63.default.readSync(descriptor, magic, 0, magic.length, 0);
|
|
66403
|
-
} finally {
|
|
66404
|
-
import_node_fs63.default.closeSync(descriptor);
|
|
66405
|
-
}
|
|
66406
|
-
return {
|
|
66748
|
+
const owned = new Set(
|
|
66749
|
+
options2.plan.artifacts.map((artifact) => import_node_path61.default.resolve(artifact.path))
|
|
66750
|
+
);
|
|
66751
|
+
const candidates = guestLinkInputFilesWithKind(args).filter((item) => !owned.has(item.path)).map(
|
|
66752
|
+
({ path: file, kind }) => ({
|
|
66407
66753
|
path: file,
|
|
66408
|
-
kind
|
|
66754
|
+
kind,
|
|
66409
66755
|
image: null,
|
|
66410
66756
|
instrumentDynamicLookups: false
|
|
66411
|
-
}
|
|
66412
|
-
|
|
66757
|
+
})
|
|
66758
|
+
);
|
|
66413
66759
|
return linkGuestImages({
|
|
66414
66760
|
...options2,
|
|
66415
66761
|
args,
|
|
@@ -66418,22 +66764,19 @@ function linkCompleteGuestImages(options2) {
|
|
|
66418
66764
|
}
|
|
66419
66765
|
function discoverGuestLinkInputs(options2) {
|
|
66420
66766
|
const args = normalizedGuestLinkArgs(options2.args);
|
|
66421
|
-
const artifacts =
|
|
66422
|
-
|
|
66423
|
-
|
|
66424
|
-
|
|
66425
|
-
|
|
66426
|
-
|
|
66427
|
-
|
|
66428
|
-
|
|
66429
|
-
const kind = magic.toString("ascii") === "!<arch>\n" ? "archive" : "object";
|
|
66430
|
-
return { path: file, kind, image: 0, instrumentDynamicLookups: false };
|
|
66431
|
-
});
|
|
66767
|
+
const artifacts = guestLinkInputFilesWithKind(args).map(
|
|
66768
|
+
({ path: file, kind }) => ({
|
|
66769
|
+
path: file,
|
|
66770
|
+
kind,
|
|
66771
|
+
image: 0,
|
|
66772
|
+
instrumentDynamicLookups: false
|
|
66773
|
+
})
|
|
66774
|
+
);
|
|
66432
66775
|
const plan = { images: [], callers: [], artifacts, symbols: [] };
|
|
66433
66776
|
import_node_fs63.default.mkdirSync(options2.directory, { recursive: true });
|
|
66434
66777
|
const why = import_node_path61.default.join(options2.directory, "preselection-why.txt");
|
|
66435
66778
|
const response = import_node_path61.default.join(options2.directory, "preselection.rsp");
|
|
66436
|
-
const output = process.platform !== "win32" ? "/dev/null" : import_node_path61.default.join(options2.directory, "preselection.wasm");
|
|
66779
|
+
const output = options2.output ?? (process.platform !== "win32" ? "/dev/null" : import_node_path61.default.join(options2.directory, "preselection.wasm"));
|
|
66437
66780
|
const flags = [
|
|
66438
66781
|
...withOutput(args, output, true),
|
|
66439
66782
|
...options2.objects,
|
|
@@ -66441,6 +66784,7 @@ function discoverGuestLinkInputs(options2) {
|
|
|
66441
66784
|
// the selection that assigns member owners.
|
|
66442
66785
|
"--undefined=__peach_dlsym_from_image",
|
|
66443
66786
|
`--why-extract=${why}`,
|
|
66787
|
+
...options2.mapPath ? [`--Map=${options2.mapPath}`] : [],
|
|
66444
66788
|
"--trace"
|
|
66445
66789
|
];
|
|
66446
66790
|
import_node_fs63.default.writeFileSync(response, flags.map((flag) => JSON.stringify(flag)).join(" "));
|
|
@@ -66454,6 +66798,7 @@ function discoverGuestLinkInputs(options2) {
|
|
|
66454
66798
|
} finally {
|
|
66455
66799
|
import_node_fs63.default.closeSync(traceOutput);
|
|
66456
66800
|
}
|
|
66801
|
+
options2.onOutput?.({ why, trace, output, mapPath: options2.mapPath });
|
|
66457
66802
|
return selectedGuestLinkInputs(
|
|
66458
66803
|
plan,
|
|
66459
66804
|
args,
|
|
@@ -66478,7 +66823,10 @@ function prepareGuestRuntimeInputs(options2) {
|
|
|
66478
66823
|
)
|
|
66479
66824
|
);
|
|
66480
66825
|
const archives = [];
|
|
66481
|
-
for (const file of
|
|
66826
|
+
for (const { path: file, kind } of guestLinkInputFilesWithKind(
|
|
66827
|
+
normalizedGuestLinkArgs(options2.args)
|
|
66828
|
+
)) {
|
|
66829
|
+
if (kind !== "archive") continue;
|
|
66482
66830
|
const original = originals.get(file) ?? file;
|
|
66483
66831
|
if (!recordedArchives.has(original) && libraryArchiveTarget(original) === null)
|
|
66484
66832
|
continue;
|
|
@@ -66493,11 +66841,23 @@ function prepareGuestRuntimeInputs(options2) {
|
|
|
66493
66841
|
);
|
|
66494
66842
|
}
|
|
66495
66843
|
const args = aliasGuestLinkArguments(options2.args, archives);
|
|
66844
|
+
let discovery;
|
|
66496
66845
|
const selected = discoverGuestLinkInputs({
|
|
66497
66846
|
args,
|
|
66498
66847
|
directory: options2.directory,
|
|
66499
66848
|
wasmLd: options2.wasmLd,
|
|
66500
|
-
objects: options2.discoveryObjects
|
|
66849
|
+
objects: options2.discoveryObjects,
|
|
66850
|
+
output: options2.discoveryOutput,
|
|
66851
|
+
mapPath: options2.discoveryMap,
|
|
66852
|
+
onOutput: options2.discoveryOutput && options2.discoveryMap && options2.discoveryObjects.length === 1 ? ({ why, trace, output, mapPath }) => {
|
|
66853
|
+
discovery = {
|
|
66854
|
+
wasm: output,
|
|
66855
|
+
map: mapPath,
|
|
66856
|
+
why,
|
|
66857
|
+
trace,
|
|
66858
|
+
projectionObject: options2.discoveryObjects[0]
|
|
66859
|
+
};
|
|
66860
|
+
} : void 0
|
|
66501
66861
|
});
|
|
66502
66862
|
const originalSelection = originalGuestArchiveSelections(selected, archives);
|
|
66503
66863
|
const closure = guestRuntimeProductsForInputs({
|
|
@@ -66529,7 +66889,15 @@ function prepareGuestRuntimeInputs(options2) {
|
|
|
66529
66889
|
rewritten: options2.rewritten,
|
|
66530
66890
|
images: new Map([...closure.images, ...closure.containingImages])
|
|
66531
66891
|
});
|
|
66532
|
-
return {
|
|
66892
|
+
return {
|
|
66893
|
+
args,
|
|
66894
|
+
selected,
|
|
66895
|
+
originalSelection,
|
|
66896
|
+
archives,
|
|
66897
|
+
sdkProducts,
|
|
66898
|
+
archiveArtifacts,
|
|
66899
|
+
discovery
|
|
66900
|
+
};
|
|
66533
66901
|
}
|
|
66534
66902
|
function selectedGuestSymbolInputs(plan, selected, readSelected) {
|
|
66535
66903
|
const artifacts = new Map(plan.artifacts.map((artifact) => [artifact.path, artifact]));
|
|
@@ -66623,10 +66991,21 @@ function verifyGuestSymbolScopes(options2) {
|
|
|
66623
66991
|
const records = /* @__PURE__ */ new Map();
|
|
66624
66992
|
for (const line of guestLinkLines(tracePath)) {
|
|
66625
66993
|
const refSep = line.lastIndexOf(": reference to ");
|
|
66626
|
-
|
|
66627
|
-
|
|
66628
|
-
|
|
66629
|
-
|
|
66994
|
+
let isRef = false;
|
|
66995
|
+
let sep5 = -1;
|
|
66996
|
+
if (refSep >= 0) {
|
|
66997
|
+
const defAfter = line.indexOf(": definition of ", refSep + 15);
|
|
66998
|
+
if (defAfter >= 0) {
|
|
66999
|
+
sep5 = line.lastIndexOf(": definition of ");
|
|
67000
|
+
isRef = false;
|
|
67001
|
+
} else {
|
|
67002
|
+
sep5 = refSep;
|
|
67003
|
+
isRef = true;
|
|
67004
|
+
}
|
|
67005
|
+
} else {
|
|
67006
|
+
sep5 = line.lastIndexOf(": definition of ");
|
|
67007
|
+
if (sep5 < 0) continue;
|
|
67008
|
+
}
|
|
66630
67009
|
const symbol2 = line.slice(sep5 + (isRef ? 15 : 16));
|
|
66631
67010
|
if (!requested.has(symbol2) || options2.hostImports.has(symbol2)) continue;
|
|
66632
67011
|
let record6 = records.get(symbol2);
|
|
@@ -66796,139 +67175,139 @@ function verifyGuestSymbolScopes(options2) {
|
|
|
66796
67175
|
}
|
|
66797
67176
|
return { bindings: result, directBindings };
|
|
66798
67177
|
}
|
|
66799
|
-
function linkPrunedGuestImages(options2) {
|
|
66800
|
-
let
|
|
67178
|
+
async function linkPrunedGuestImages(options2) {
|
|
67179
|
+
let pruned;
|
|
66801
67180
|
pruneSwiftWasmLink(
|
|
66802
67181
|
options2.buildDirectory,
|
|
66803
67182
|
options2.toolchainBin,
|
|
66804
67183
|
options2.moduleRoot,
|
|
66805
67184
|
options2.staticClangTargets,
|
|
66806
67185
|
void 0,
|
|
66807
|
-
(
|
|
66808
|
-
|
|
66809
|
-
throw new Error("guest link already has a linker map");
|
|
66810
|
-
const framework = options2.framework;
|
|
66811
|
-
const prepared = options2.prepareRuntime?.(args, rewritten, sdk2);
|
|
66812
|
-
if (prepared && options2.sdkProducts !== null)
|
|
66813
|
-
throw new Error("guest runtime products supplied twice");
|
|
66814
|
-
const linkedArgs = prepared?.args ?? args;
|
|
66815
|
-
const sdkProducts = prepared?.sdkProducts ?? (typeof options2.sdkProducts === "function" ? options2.sdkProducts(args, rewritten, sdk2) : options2.sdkProducts);
|
|
66816
|
-
const sourcePlan = options2.plan(linkedArgs, rewritten, sdk2, sdkProducts);
|
|
66817
|
-
let frameworkArtifacts = [];
|
|
66818
|
-
const selectedObjects = prepared && new Set(
|
|
66819
|
-
prepared.selected.filter((item) => item.member === null).map((item) => import_node_path61.default.resolve(item.artifact))
|
|
66820
|
-
);
|
|
66821
|
-
const selectedFramework = framework && (!prepared || framework.product.objects.some((object9) => {
|
|
66822
|
-
const original = import_node_path61.default.resolve(framework.root, object9.path);
|
|
66823
|
-
const linked = import_node_path61.default.resolve(rewritten.get(original) ?? original);
|
|
66824
|
-
return selectedObjects?.has(linked) ?? false;
|
|
66825
|
-
}));
|
|
66826
|
-
if (framework && selectedFramework) {
|
|
66827
|
-
const image = sdkProducts?.images.get(
|
|
66828
|
-
frameworkRuntimeProductId(framework.product)
|
|
66829
|
-
);
|
|
66830
|
-
if (image === void 0)
|
|
66831
|
-
throw new Error(
|
|
66832
|
-
"framework objects require their declared compiler runtime image"
|
|
66833
|
-
);
|
|
66834
|
-
frameworkArtifacts = guestFrameworkLinkArtifacts(
|
|
66835
|
-
framework.product,
|
|
66836
|
-
framework.root,
|
|
66837
|
-
linkedArgs,
|
|
66838
|
-
rewritten,
|
|
66839
|
-
image
|
|
66840
|
-
);
|
|
66841
|
-
}
|
|
66842
|
-
if (sdkProducts) {
|
|
66843
|
-
for (const image of guestSdkProductImages(
|
|
66844
|
-
sdkProducts.products.map((entry) => entry.product),
|
|
66845
|
-
sdkProducts.images
|
|
66846
|
-
)) {
|
|
66847
|
-
const planned = sourcePlan.images.find((entry) => entry.id === image.id);
|
|
66848
|
-
if (!planned || planned.name !== image.name || planned.dependencies.length !== image.dependencies.length || planned.dependencies.some(
|
|
66849
|
-
(dependency, index) => dependency !== image.dependencies[index]
|
|
66850
|
-
))
|
|
66851
|
-
throw new Error(`SDK image scope differs from source product ${image.name}`);
|
|
66852
|
-
}
|
|
66853
|
-
}
|
|
66854
|
-
const remappedPlan = remapGuestLinkPlan(
|
|
66855
|
-
{
|
|
66856
|
-
...sourcePlan,
|
|
66857
|
-
artifacts: [
|
|
66858
|
-
...sourcePlan.artifacts,
|
|
66859
|
-
...frameworkArtifacts,
|
|
66860
|
-
...sdkProducts ? guestSdkProductLinkArtifacts(
|
|
66861
|
-
sdkProducts.products,
|
|
66862
|
-
sdk2,
|
|
66863
|
-
linkedArgs,
|
|
66864
|
-
sdkProducts.linkedArchives,
|
|
66865
|
-
rewritten,
|
|
66866
|
-
new Map([...sdkProducts.images, ...sdkProducts.containingImages]),
|
|
66867
|
-
prepared?.selected
|
|
66868
|
-
) : [],
|
|
66869
|
-
...prepared?.archiveArtifacts ?? []
|
|
66870
|
-
]
|
|
66871
|
-
},
|
|
66872
|
-
rewritten
|
|
66873
|
-
);
|
|
66874
|
-
const plan = aliasGuestLinkPlan(remappedPlan, prepared?.archives ?? []);
|
|
66875
|
-
let owners = /* @__PURE__ */ new Map();
|
|
66876
|
-
let generatedSectionOwners = /* @__PURE__ */ new Map();
|
|
66877
|
-
let projection = typeof options2.projection === "function" ? options2.projection(linkedArgs, rewritten, sdk2, sdkProducts, plan) : options2.projection;
|
|
66878
|
-
if (projection && prepared) {
|
|
66879
|
-
const identities = new Map(projection.identities);
|
|
66880
|
-
for (const [before, after] of rewritten) {
|
|
66881
|
-
const identity2 = identities.get(before);
|
|
66882
|
-
const existing = identities.get(after);
|
|
66883
|
-
if (identity2 !== void 0 && existing !== void 0 && existing !== identity2)
|
|
66884
|
-
throw new Error(`rewritten guest input has conflicting identity ${after}`);
|
|
66885
|
-
if (identity2 !== void 0) identities.set(after, identity2);
|
|
66886
|
-
}
|
|
66887
|
-
projection = {
|
|
66888
|
-
...projection,
|
|
66889
|
-
identities: aliasGuestLinkIdentities(identities, prepared.archives)
|
|
66890
|
-
};
|
|
66891
|
-
}
|
|
66892
|
-
const selected = linkCompleteGuestImages({
|
|
66893
|
-
plan,
|
|
66894
|
-
args: [...linkedArgs, `--Map=${options2.mapPath}`],
|
|
66895
|
-
directory: options2.linkDirectory,
|
|
66896
|
-
wasmLd: import_node_path61.default.join(options2.toolchainBin, "wasm-ld"),
|
|
66897
|
-
clang: import_node_path61.default.join(options2.toolchainBin, "clang"),
|
|
66898
|
-
llvmAr: import_node_path61.default.join(options2.toolchainBin, "llvm-ar"),
|
|
66899
|
-
ledgerDataImage: options2.ledgerDataImage,
|
|
66900
|
-
projection,
|
|
66901
|
-
resolvePlan: options2.resolvePlan,
|
|
66902
|
-
sharedSdk: options2.sharedSdk,
|
|
66903
|
-
onSplitInputs: options2.onSplitInputs,
|
|
66904
|
-
onDyldRows: options2.onDyldRows,
|
|
66905
|
-
onLinkedOwners: (value) => {
|
|
66906
|
-
owners = value;
|
|
66907
|
-
},
|
|
66908
|
-
onLinkedSections: (value) => {
|
|
66909
|
-
generatedSectionOwners = value;
|
|
66910
|
-
}
|
|
66911
|
-
});
|
|
66912
|
-
result = {
|
|
66913
|
-
selected,
|
|
66914
|
-
owners,
|
|
66915
|
-
generatedSectionOwners,
|
|
66916
|
-
sdk: sdk2,
|
|
66917
|
-
mapPath: options2.mapPath
|
|
66918
|
-
};
|
|
67186
|
+
(args2, rewritten2, sdk3) => {
|
|
67187
|
+
pruned = { args: args2, rewritten: rewritten2, sdk: sdk3 };
|
|
66919
67188
|
},
|
|
66920
67189
|
options2.resourceReferences
|
|
66921
67190
|
);
|
|
66922
|
-
if (!
|
|
66923
|
-
|
|
67191
|
+
if (!pruned) throw new Error("guest link did not receive pruned inputs");
|
|
67192
|
+
const { args, rewritten, sdk: sdk2 } = pruned;
|
|
67193
|
+
if (args.some((arg) => arg === "--Map" || arg.startsWith("--Map=")))
|
|
67194
|
+
throw new Error("guest link already has a linker map");
|
|
67195
|
+
const framework = options2.framework;
|
|
67196
|
+
const prepared = options2.prepareRuntime?.(args, rewritten, sdk2);
|
|
67197
|
+
if (prepared && options2.sdkProducts !== null)
|
|
67198
|
+
throw new Error("guest runtime products supplied twice");
|
|
67199
|
+
const linkedArgs = prepared?.args ?? args;
|
|
67200
|
+
const sdkProducts = prepared?.sdkProducts ?? (typeof options2.sdkProducts === "function" ? options2.sdkProducts(args, rewritten, sdk2) : options2.sdkProducts);
|
|
67201
|
+
const sourcePlan = options2.plan(linkedArgs, rewritten, sdk2, sdkProducts);
|
|
67202
|
+
let frameworkArtifacts = [];
|
|
67203
|
+
const selectedObjects = prepared && new Set(
|
|
67204
|
+
prepared.selected.filter((item) => item.member === null).map((item) => import_node_path61.default.resolve(item.artifact))
|
|
67205
|
+
);
|
|
67206
|
+
const selectedFramework = framework && (!prepared || framework.product.objects.some((object9) => {
|
|
67207
|
+
const original = import_node_path61.default.resolve(framework.root, object9.path);
|
|
67208
|
+
const linked = import_node_path61.default.resolve(rewritten.get(original) ?? original);
|
|
67209
|
+
return selectedObjects?.has(linked) ?? false;
|
|
67210
|
+
}));
|
|
67211
|
+
if (framework && selectedFramework) {
|
|
67212
|
+
const image = sdkProducts?.images.get(frameworkRuntimeProductId(framework.product));
|
|
67213
|
+
if (image === void 0)
|
|
67214
|
+
throw new Error("framework objects require their declared compiler runtime image");
|
|
67215
|
+
frameworkArtifacts = guestFrameworkLinkArtifacts(
|
|
67216
|
+
framework.product,
|
|
67217
|
+
framework.root,
|
|
67218
|
+
linkedArgs,
|
|
67219
|
+
rewritten,
|
|
67220
|
+
image
|
|
67221
|
+
);
|
|
67222
|
+
}
|
|
67223
|
+
if (sdkProducts) {
|
|
67224
|
+
for (const image of guestSdkProductImages(
|
|
67225
|
+
sdkProducts.products.map((entry) => entry.product),
|
|
67226
|
+
sdkProducts.images
|
|
67227
|
+
)) {
|
|
67228
|
+
const planned = sourcePlan.images.find((entry) => entry.id === image.id);
|
|
67229
|
+
if (!planned || planned.name !== image.name || planned.dependencies.length !== image.dependencies.length || planned.dependencies.some(
|
|
67230
|
+
(dependency, index) => dependency !== image.dependencies[index]
|
|
67231
|
+
))
|
|
67232
|
+
throw new Error(`SDK image scope differs from source product ${image.name}`);
|
|
67233
|
+
}
|
|
67234
|
+
}
|
|
67235
|
+
const remappedPlan = remapGuestLinkPlan(
|
|
67236
|
+
{
|
|
67237
|
+
...sourcePlan,
|
|
67238
|
+
artifacts: [
|
|
67239
|
+
...sourcePlan.artifacts,
|
|
67240
|
+
...frameworkArtifacts,
|
|
67241
|
+
...sdkProducts ? guestSdkProductLinkArtifacts(
|
|
67242
|
+
sdkProducts.products,
|
|
67243
|
+
sdk2,
|
|
67244
|
+
linkedArgs,
|
|
67245
|
+
sdkProducts.linkedArchives,
|
|
67246
|
+
rewritten,
|
|
67247
|
+
new Map([...sdkProducts.images, ...sdkProducts.containingImages]),
|
|
67248
|
+
prepared?.selected
|
|
67249
|
+
) : [],
|
|
67250
|
+
...prepared?.archiveArtifacts ?? []
|
|
67251
|
+
]
|
|
67252
|
+
},
|
|
67253
|
+
rewritten
|
|
67254
|
+
);
|
|
67255
|
+
const plan = aliasGuestLinkPlan(remappedPlan, prepared?.archives ?? []);
|
|
67256
|
+
let owners = /* @__PURE__ */ new Map();
|
|
67257
|
+
let generatedSectionOwners = /* @__PURE__ */ new Map();
|
|
67258
|
+
let projection = typeof options2.projection === "function" ? options2.projection(linkedArgs, rewritten, sdk2, sdkProducts, plan) : options2.projection;
|
|
67259
|
+
if (projection && prepared) {
|
|
67260
|
+
const identities = new Map(projection.identities);
|
|
67261
|
+
for (const [before, after] of rewritten) {
|
|
67262
|
+
const identity2 = identities.get(before);
|
|
67263
|
+
const existing = identities.get(after);
|
|
67264
|
+
if (identity2 !== void 0 && existing !== void 0 && existing !== identity2)
|
|
67265
|
+
throw new Error(`rewritten guest input has conflicting identity ${after}`);
|
|
67266
|
+
if (identity2 !== void 0) identities.set(after, identity2);
|
|
67267
|
+
}
|
|
67268
|
+
projection = {
|
|
67269
|
+
...projection,
|
|
67270
|
+
identities: aliasGuestLinkIdentities(identities, prepared.archives)
|
|
67271
|
+
};
|
|
67272
|
+
}
|
|
67273
|
+
const selected = await linkCompleteGuestImages({
|
|
67274
|
+
plan,
|
|
67275
|
+
args: [...linkedArgs, `--Map=${options2.mapPath}`],
|
|
67276
|
+
directory: options2.linkDirectory,
|
|
67277
|
+
wasmLd: import_node_path61.default.join(options2.toolchainBin, "wasm-ld"),
|
|
67278
|
+
clang: import_node_path61.default.join(options2.toolchainBin, "clang"),
|
|
67279
|
+
llvmAr: import_node_path61.default.join(options2.toolchainBin, "llvm-ar"),
|
|
67280
|
+
ledgerDataImage: options2.ledgerDataImage,
|
|
67281
|
+
projection,
|
|
67282
|
+
preselectionDiscovery: prepared?.discovery,
|
|
67283
|
+
resolvePlan: options2.resolvePlan,
|
|
67284
|
+
sharedSdk: options2.sharedSdk,
|
|
67285
|
+
onSplitInputs: options2.onSplitInputs,
|
|
67286
|
+
onDyldRows: options2.onDyldRows,
|
|
67287
|
+
onLinkedOwners: (value) => {
|
|
67288
|
+
owners = value;
|
|
67289
|
+
},
|
|
67290
|
+
onLinkedSections: (value) => {
|
|
67291
|
+
generatedSectionOwners = value;
|
|
67292
|
+
}
|
|
67293
|
+
});
|
|
67294
|
+
return {
|
|
67295
|
+
selected,
|
|
67296
|
+
owners,
|
|
67297
|
+
generatedSectionOwners,
|
|
67298
|
+
sdk: sdk2,
|
|
67299
|
+
mapPath: options2.mapPath
|
|
67300
|
+
};
|
|
66924
67301
|
}
|
|
66925
|
-
var import_node_child_process30, import_node_fs63, import_node_path61;
|
|
67302
|
+
var import_node_child_process30, import_node_fs63, import_node_path61, import_node_util6, execFileAsync, WASM_MAGIC, BITCODE_MAGIC;
|
|
66926
67303
|
var init_swift_guest_link = __esm({
|
|
66927
67304
|
"src/swift-guest-link.ts"() {
|
|
66928
67305
|
"use strict";
|
|
66929
67306
|
import_node_child_process30 = require("node:child_process");
|
|
66930
67307
|
import_node_fs63 = __toESM(require("node:fs"), 1);
|
|
66931
67308
|
import_node_path61 = __toESM(require("node:path"), 1);
|
|
67309
|
+
import_node_util6 = require("node:util");
|
|
67310
|
+
init_mapLimit();
|
|
66932
67311
|
init_swift_guest_archive();
|
|
66933
67312
|
init_swift_guest_dyld_functions();
|
|
66934
67313
|
init_swift_guest_image_ledger();
|
|
@@ -66942,6 +67321,9 @@ var init_swift_guest_link = __esm({
|
|
|
66942
67321
|
init_swift_wasm_prune();
|
|
66943
67322
|
init_swiftTargetContract();
|
|
66944
67323
|
init_wasm_optimize();
|
|
67324
|
+
execFileAsync = (0, import_node_util6.promisify)(import_node_child_process30.execFile);
|
|
67325
|
+
WASM_MAGIC = Buffer.from([0, 97, 115, 109]);
|
|
67326
|
+
BITCODE_MAGIC = Buffer.from([66, 67, 192, 222]);
|
|
66945
67327
|
}
|
|
66946
67328
|
});
|
|
66947
67329
|
|
|
@@ -70543,7 +70925,7 @@ async function produceSwiftSdkImage(input) {
|
|
|
70543
70925
|
await (0, import_promises10.setTimeout)(2e3, void 0, { signal: input.signal });
|
|
70544
70926
|
}
|
|
70545
70927
|
}
|
|
70546
|
-
var import_node_child_process35, import_node_crypto41, import_node_fs71, import_node_path69, import_promises10,
|
|
70928
|
+
var import_node_child_process35, import_node_crypto41, import_node_fs71, import_node_path69, import_promises10, import_node_util7, run4, environmentNames, launcher;
|
|
70547
70929
|
var init_swift_sdk_image_producer = __esm({
|
|
70548
70930
|
"src/swift-sdk-image-producer.ts"() {
|
|
70549
70931
|
"use strict";
|
|
@@ -70552,12 +70934,12 @@ var init_swift_sdk_image_producer = __esm({
|
|
|
70552
70934
|
import_node_fs71 = require("node:fs");
|
|
70553
70935
|
import_node_path69 = __toESM(require("node:path"), 1);
|
|
70554
70936
|
import_promises10 = require("node:timers/promises");
|
|
70555
|
-
|
|
70937
|
+
import_node_util7 = require("node:util");
|
|
70556
70938
|
init_admitted_mac_build();
|
|
70557
70939
|
init_is_record();
|
|
70558
70940
|
init_swift_root_lock();
|
|
70559
70941
|
init_swift_toolchain();
|
|
70560
|
-
run4 = (0,
|
|
70942
|
+
run4 = (0, import_node_util7.promisify)(import_node_child_process35.execFile);
|
|
70561
70943
|
environmentNames = [
|
|
70562
70944
|
"CONTRAST_BUILDERS_ROOT",
|
|
70563
70945
|
"PEACH_HOME",
|
|
@@ -71252,7 +71634,7 @@ function readSwiftSdkManifest(image) {
|
|
|
71252
71634
|
}));
|
|
71253
71635
|
return setBoundedCache(cachedSdkManifests, cacheKey, { manifest, block: block2, segments });
|
|
71254
71636
|
}
|
|
71255
|
-
var import_node_child_process36, import_node_crypto42, import_node_fs72, import_node_path70,
|
|
71637
|
+
var import_node_child_process36, import_node_crypto42, import_node_fs72, import_node_path70, import_node_util8, run5, SWIFT_SDK_IMAGE_VERSION, SWIFT_SDK_APP_MEMORY_BASE, SWIFT_SDK_MEMORY_BASE, SWIFT_SDK_APP_TABLE_BASE, EMPTY_APP, IMAGE_TABLES, IMAGE_ENTRY, imageApp, IMAGE_FILE, IMAGE_DIGEST, swiftSdkImageFile, INTERFACE_FILE, MANIFEST_FILE, MANIFEST_DATA_FILE, SWIFT_SDK_IMAGE_FILES, SWIFT_SDK_IMAGE_BUNDLE, MAX_CACHED_SDK_IMAGES, cachedSdkInterfaces, cachedSdkManifestIndices, cachedSdkManifests, SWIFT_SDK_PIECE_FIELDS, MANIFEST_BLOCKS, isManifestBlock;
|
|
71256
71638
|
var init_swift_sdk_image = __esm({
|
|
71257
71639
|
"src/swift-sdk-image.ts"() {
|
|
71258
71640
|
"use strict";
|
|
@@ -71260,7 +71642,7 @@ var init_swift_sdk_image = __esm({
|
|
|
71260
71642
|
import_node_crypto42 = require("node:crypto");
|
|
71261
71643
|
import_node_fs72 = require("node:fs");
|
|
71262
71644
|
import_node_path70 = __toESM(require("node:path"), 1);
|
|
71263
|
-
|
|
71645
|
+
import_node_util8 = require("node:util");
|
|
71264
71646
|
init_native_prebuilt();
|
|
71265
71647
|
init_swift_compile();
|
|
71266
71648
|
init_swift_darwin_records();
|
|
@@ -71274,7 +71656,7 @@ var init_swift_sdk_image = __esm({
|
|
|
71274
71656
|
init_swift_wasm_prune();
|
|
71275
71657
|
init_swiftTargetContract();
|
|
71276
71658
|
init_wasm_optimize();
|
|
71277
|
-
run5 = (0,
|
|
71659
|
+
run5 = (0, import_node_util8.promisify)(import_node_child_process36.execFile);
|
|
71278
71660
|
SWIFT_SDK_IMAGE_VERSION = 13;
|
|
71279
71661
|
SWIFT_SDK_APP_MEMORY_BASE = 8372224;
|
|
71280
71662
|
SWIFT_SDK_MEMORY_BASE = 128 * 1024 * 1024;
|
|
@@ -73003,7 +73385,7 @@ function partitionParent(section2) {
|
|
|
73003
73385
|
"__objc_class_refs"
|
|
73004
73386
|
].find((name3) => section2 === name3 || section2.startsWith(`${name3}.`));
|
|
73005
73387
|
}
|
|
73006
|
-
var import_node_child_process37, import_node_crypto43, import_node_fs73, import_node_path71,
|
|
73388
|
+
var import_node_child_process37, import_node_crypto43, import_node_fs73, import_node_path71, import_node_util9, import_node_zlib5, run6, RELOCATION_WIDTHS, GLOBAL_INDEX, TLS_SLEB64, SDK_TLS_HELPER, SDK_TLS_DELTA, OBJC_SECTION_BOUNDARY, uleb4, sleb2, encodedName2, SCANNED, RUN_GAP;
|
|
73007
73389
|
var init_swift_sdk_app_module = __esm({
|
|
73008
73390
|
"src/swift-sdk-app-module.ts"() {
|
|
73009
73391
|
"use strict";
|
|
@@ -73011,7 +73393,7 @@ var init_swift_sdk_app_module = __esm({
|
|
|
73011
73393
|
import_node_crypto43 = require("node:crypto");
|
|
73012
73394
|
import_node_fs73 = require("node:fs");
|
|
73013
73395
|
import_node_path71 = __toESM(require("node:path"), 1);
|
|
73014
|
-
|
|
73396
|
+
import_node_util9 = require("node:util");
|
|
73015
73397
|
import_node_zlib5 = require("node:zlib");
|
|
73016
73398
|
init_nativeSdkBindingContract();
|
|
73017
73399
|
init_nativeWasmContract();
|
|
@@ -73026,7 +73408,7 @@ var init_swift_sdk_app_module = __esm({
|
|
|
73026
73408
|
init_swiftTargetContract();
|
|
73027
73409
|
init_wasm_narrow_boundary();
|
|
73028
73410
|
init_wasm_optimize();
|
|
73029
|
-
run6 = (0,
|
|
73411
|
+
run6 = (0, import_node_util9.promisify)(import_node_child_process37.execFile);
|
|
73030
73412
|
RELOCATION_WIDTHS = {
|
|
73031
73413
|
1: { addend: false, width: "sleb5" },
|
|
73032
73414
|
2: { addend: false, width: "u32" },
|
|
@@ -73131,8 +73513,8 @@ async function compileGuestLink(options2) {
|
|
|
73131
73513
|
`--sysroot=${options2.sysroot}`,
|
|
73132
73514
|
`-I${import_node_path72.default.join(options2.moduleRoot, "include")}`
|
|
73133
73515
|
];
|
|
73134
|
-
const stubSource = import_node_path72.default.join(directory2, "
|
|
73135
|
-
const stub = import_node_path72.default.join(directory2, "
|
|
73516
|
+
const stubSource = import_node_path72.default.join(directory2, "projection-discovery.c");
|
|
73517
|
+
const stub = import_node_path72.default.join(directory2, "projection-discovery.o");
|
|
73136
73518
|
(0, import_node_fs74.writeFileSync)(
|
|
73137
73519
|
stubSource,
|
|
73138
73520
|
'#include "guest-image-projection.h"\nconst struct peach_guest_image __peach_guest_images[] = {{0}};\nconst uint32_t __peach_guest_image_count = 0;\n'
|
|
@@ -73195,7 +73577,7 @@ async function compileGuestLink(options2) {
|
|
|
73195
73577
|
const sdkObjects = sdk2 ? (await Promise.resolve().then(() => (init_swift_sdk_image(), swift_sdk_image_exports))).readSwiftSdkManifestIndex(sdk2).guestObjects : void 0;
|
|
73196
73578
|
if (sdk2 && (!sdkCallers || !sdkObjects))
|
|
73197
73579
|
throw new Error("the SDK image has no guest link manifest");
|
|
73198
|
-
const result = linkPrunedGuestImages({
|
|
73580
|
+
const result = await linkPrunedGuestImages({
|
|
73199
73581
|
buildDirectory: options2.buildDirectory,
|
|
73200
73582
|
toolchainBin: options2.toolchainBin,
|
|
73201
73583
|
moduleRoot: options2.moduleRoot,
|
|
@@ -73224,6 +73606,8 @@ async function compileGuestLink(options2) {
|
|
|
73224
73606
|
wasmLd: import_node_path72.default.join(options2.toolchainBin, "wasm-ld"),
|
|
73225
73607
|
llvmAr: import_node_path72.default.join(options2.toolchainBin, "llvm-ar"),
|
|
73226
73608
|
discoveryObjects: [stub],
|
|
73609
|
+
discoveryOutput: import_node_path72.default.join(directory2, "discovery.wasm"),
|
|
73610
|
+
discoveryMap: import_node_path72.default.join(directory2, "discovery.map"),
|
|
73227
73611
|
products: catalogs.products,
|
|
73228
73612
|
rewritten,
|
|
73229
73613
|
sdk: sdk3,
|
|
@@ -74234,7 +74618,7 @@ async function swiftIcuBundleAsset(icu) {
|
|
|
74234
74618
|
contentType: "application/octet-stream"
|
|
74235
74619
|
};
|
|
74236
74620
|
}
|
|
74237
|
-
var import_node_child_process39, import_node_crypto45, import_node_fs76, import_promises11, import_node_os14, import_node_path75,
|
|
74621
|
+
var import_node_child_process39, import_node_crypto45, import_node_fs76, import_promises11, import_node_os14, import_node_path75, import_node_util10, import_node_zlib6, run7, deflate, compressBrotli, inflateGzip, ARCHIVE, MEMBER, raw, assets, brotliMemoryCache, packedFiles;
|
|
74238
74622
|
var init_swift_icu = __esm({
|
|
74239
74623
|
"src/swift-icu.ts"() {
|
|
74240
74624
|
"use strict";
|
|
@@ -74244,15 +74628,15 @@ var init_swift_icu = __esm({
|
|
|
74244
74628
|
import_promises11 = require("node:fs/promises");
|
|
74245
74629
|
import_node_os14 = __toESM(require("node:os"), 1);
|
|
74246
74630
|
import_node_path75 = __toESM(require("node:path"), 1);
|
|
74247
|
-
|
|
74631
|
+
import_node_util10 = require("node:util");
|
|
74248
74632
|
import_node_zlib6 = require("node:zlib");
|
|
74249
74633
|
init_icuData();
|
|
74250
74634
|
init_swift_toolchain();
|
|
74251
74635
|
init_swiftTargetContract();
|
|
74252
|
-
run7 = (0,
|
|
74253
|
-
deflate = (0,
|
|
74254
|
-
compressBrotli = (0,
|
|
74255
|
-
inflateGzip = (0,
|
|
74636
|
+
run7 = (0, import_node_util10.promisify)(import_node_child_process39.execFile);
|
|
74637
|
+
deflate = (0, import_node_util10.promisify)(import_node_zlib6.gzip);
|
|
74638
|
+
compressBrotli = (0, import_node_util10.promisify)(import_node_zlib6.brotliCompress);
|
|
74639
|
+
inflateGzip = (0, import_node_util10.promisify)(import_node_zlib6.gunzip);
|
|
74256
74640
|
ARCHIVE = "wasi/lib_FoundationICU.a";
|
|
74257
74641
|
MEMBER = "icu_packaged_data.cpp.obj";
|
|
74258
74642
|
raw = /* @__PURE__ */ new Map();
|
|
@@ -81550,7 +81934,7 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
|
|
|
81550
81934
|
REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
|
|
81551
81935
|
MULTI_MANIFEST_VERSION = 76;
|
|
81552
81936
|
SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
|
|
81553
|
-
compilerSourceDigest = true ? "
|
|
81937
|
+
compilerSourceDigest = true ? "6fbcbab3535da2f464a19f4d3c1db8a7e4b393927e5158477332f4cc978cc22f" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
|
|
81554
81938
|
nativeCxxCompilerFlags = ["-fno-cxx-modules"];
|
|
81555
81939
|
MODULE_MAP_RESPONSE_FILE_RUN = 16;
|
|
81556
81940
|
cFlagArray = (flags) => JSON.stringify(withoutGlogModuleMap(flags));
|
|
@@ -96049,7 +96433,7 @@ async function prepareSwiftManifestToolchain() {
|
|
|
96049
96433
|
const command = swiftCommand();
|
|
96050
96434
|
const fingerprint = toolchainFingerprint(command);
|
|
96051
96435
|
if (cachedToolchain?.fingerprint === fingerprint) return;
|
|
96052
|
-
const { stdout } = await
|
|
96436
|
+
const { stdout } = await execFileAsync2(command, ["--version"], {
|
|
96053
96437
|
encoding: "utf8",
|
|
96054
96438
|
env: swiftEnvironment()
|
|
96055
96439
|
});
|
|
@@ -96153,7 +96537,7 @@ async function prepareSwiftPackageManifest(dir, xcode) {
|
|
|
96153
96537
|
import_node_fs98.default.mkdirSync(cacheDir3, { recursive: true });
|
|
96154
96538
|
const scratch2 = import_node_fs98.default.mkdtempSync(import_node_path99.default.join(cacheDir3, `${key2}-`));
|
|
96155
96539
|
try {
|
|
96156
|
-
const { stdout } = await
|
|
96540
|
+
const { stdout } = await execFileAsync2(
|
|
96157
96541
|
command,
|
|
96158
96542
|
dumpArguments(dir, scratch2, overlays),
|
|
96159
96543
|
{ encoding: "utf8", env, maxBuffer: 64 * 1024 * 1024 }
|
|
@@ -96562,7 +96946,7 @@ async function resolveSwiftPackageRequirementsAsync(requirements, destination, s
|
|
|
96562
96946
|
const { dir, args, options: options2, failed, publish: publish2 } = resolveRequest(requirements);
|
|
96563
96947
|
try {
|
|
96564
96948
|
try {
|
|
96565
|
-
await (0,
|
|
96949
|
+
await (0, import_node_util11.promisify)(import_node_child_process46.execFile)(swiftCommand(), args, { ...options2, signal });
|
|
96566
96950
|
} catch (error) {
|
|
96567
96951
|
throw failed(error);
|
|
96568
96952
|
}
|
|
@@ -96603,7 +96987,7 @@ function swiftTargetFiles(manifest, target) {
|
|
|
96603
96987
|
}
|
|
96604
96988
|
return [...new Set(files2)].sort();
|
|
96605
96989
|
}
|
|
96606
|
-
var import_node_child_process46, import_node_crypto56, import_node_fs98, import_node_os19, import_node_path99,
|
|
96990
|
+
var import_node_child_process46, import_node_crypto56, import_node_fs98, import_node_os19, import_node_path99, import_node_util11, TARGET_TYPES, targetRelative, isTargetType, record3, array6, string7, cacheDir3, evaluated, execFileAsync2, cachedToolchain, SwiftManifestPreparationRequired, MANIFEST_HOST_OS, manifestPreparations, GUEST_PLATFORMS, within, requirementClause;
|
|
96607
96991
|
var init_swift_package_manifest = __esm({
|
|
96608
96992
|
"src/swift-package-manifest.ts"() {
|
|
96609
96993
|
"use strict";
|
|
@@ -96612,7 +96996,7 @@ var init_swift_package_manifest = __esm({
|
|
|
96612
96996
|
import_node_fs98 = __toESM(require("node:fs"), 1);
|
|
96613
96997
|
import_node_os19 = __toESM(require("node:os"), 1);
|
|
96614
96998
|
import_node_path99 = __toESM(require("node:path"), 1);
|
|
96615
|
-
|
|
96999
|
+
import_node_util11 = require("node:util");
|
|
96616
97000
|
init_git_repo_env();
|
|
96617
97001
|
init_home_paths();
|
|
96618
97002
|
init_swift_distribution();
|
|
@@ -96636,7 +97020,7 @@ var init_swift_package_manifest = __esm({
|
|
|
96636
97020
|
string7 = (value) => typeof value === "string" ? value : void 0;
|
|
96637
97021
|
cacheDir3 = import_node_path99.default.join(cacheDir(), "swift-manifests");
|
|
96638
97022
|
evaluated = /* @__PURE__ */ new Map();
|
|
96639
|
-
|
|
97023
|
+
execFileAsync2 = (0, import_node_util11.promisify)(import_node_child_process46.execFile);
|
|
96640
97024
|
SwiftManifestPreparationRequired = class extends Error {
|
|
96641
97025
|
constructor(dir, xcode) {
|
|
96642
97026
|
super(`swift package manifest requires preparation: ${dir}`);
|
|
@@ -101638,7 +102022,7 @@ async function walkWorkspaceInputs(app, everyByte, sourceOnly, podsEnvironment)
|
|
|
101638
102022
|
};
|
|
101639
102023
|
}
|
|
101640
102024
|
const pinnedNode = typeof manifest.engines?.node === "string" && /^\d+(\.\d+){0,2}$/.test(manifest.engines.node) ? `node@${manifest.engines.node}` : null;
|
|
101641
|
-
const node = await (0,
|
|
102025
|
+
const node = await (0, import_node_util12.promisify)(import_node_child_process48.execFile)(
|
|
101642
102026
|
pinnedNode ? "mise" : "node",
|
|
101643
102027
|
pinnedNode ? ["exec", pinnedNode, "--", "node", "--version"] : ["--version"],
|
|
101644
102028
|
{ cwd: root }
|
|
@@ -101846,7 +102230,7 @@ async function copyInstalledWorkspace(root, destination, excluded) {
|
|
|
101846
102230
|
const clone = async () => {
|
|
101847
102231
|
const relative7 = entries2.pop();
|
|
101848
102232
|
if (relative7 === void 0) return;
|
|
101849
|
-
await (0,
|
|
102233
|
+
await (0, import_node_util12.promisify)(import_node_child_process48.execFile)("cp", [
|
|
101850
102234
|
"-R",
|
|
101851
102235
|
"-p",
|
|
101852
102236
|
"--reflink=auto",
|
|
@@ -102209,7 +102593,7 @@ ${failedOutputLine(command, cwd, bytes)}`
|
|
|
102209
102593
|
});
|
|
102210
102594
|
});
|
|
102211
102595
|
}
|
|
102212
|
-
var import_node_child_process48, import_node_crypto60, import_node_fs101, import_node_module10, import_node_os20, import_node_path103,
|
|
102596
|
+
var import_node_child_process48, import_node_crypto60, import_node_fs101, import_node_module10, import_node_os20, import_node_path103, import_node_util12, isolatedGitEnv, NATIVE_CONFIG_FILE, NATIVE_SOURCE_FILE2, fileDigests, NATIVE_PACKAGE_ENTRY, hashing, KEPT_WORKSPACES, WORKSPACE_GRACE_MS, ABANDONED_WORKSPACE_MS, RETIRED_PREFIX2, preparing, watches, current, CLONE_ENTRIES;
|
|
102213
102597
|
var init_expo_native_workspace = __esm({
|
|
102214
102598
|
"src/expo-native-workspace.ts"() {
|
|
102215
102599
|
"use strict";
|
|
@@ -102219,7 +102603,7 @@ var init_expo_native_workspace = __esm({
|
|
|
102219
102603
|
import_node_module10 = require("node:module");
|
|
102220
102604
|
import_node_os20 = __toESM(require("node:os"), 1);
|
|
102221
102605
|
import_node_path103 = __toESM(require("node:path"), 1);
|
|
102222
|
-
|
|
102606
|
+
import_node_util12 = require("node:util");
|
|
102223
102607
|
init_detect();
|
|
102224
102608
|
init_admitted_mac_build();
|
|
102225
102609
|
init_expo_workspace_exclusion();
|
|
@@ -103992,7 +104376,7 @@ async function lookup2(appRoot) {
|
|
|
103992
104376
|
const entry = await pending2;
|
|
103993
104377
|
if (!entry) return null;
|
|
103994
104378
|
const digests2 = await expoNativePackageDigests(app.packages);
|
|
103995
|
-
return (0,
|
|
104379
|
+
return (0, import_node_util13.isDeepStrictEqual)(digests2, entry.packages) ? entry : null;
|
|
103996
104380
|
}
|
|
103997
104381
|
function prebuiltExpoNative(appRoot, iosTarget) {
|
|
103998
104382
|
if (iosTarget !== void 0) return Promise.resolve(null);
|
|
@@ -104059,7 +104443,7 @@ async function prebuiltExpoSwiftResult(appRoot, entry, signal) {
|
|
|
104059
104443
|
await prebuiltAppTarget(appRoot, signal, "installed")
|
|
104060
104444
|
);
|
|
104061
104445
|
}
|
|
104062
|
-
var import_node_crypto63, import_node_fs106, import_node_module13, import_node_path108,
|
|
104446
|
+
var import_node_crypto63, import_node_fs106, import_node_module13, import_node_path108, import_node_util13, import_plist8, EXPO_NATIVE_ENTRY_NAME, IDENTITY_SOURCE_SKIPS, expoNativeEntryUrl, isStringRecord, isPlistArray, published, lookups, answers;
|
|
104063
104447
|
var init_expo_native_prebuilt = __esm({
|
|
104064
104448
|
"src/expo-native-prebuilt.ts"() {
|
|
104065
104449
|
"use strict";
|
|
@@ -104067,7 +104451,7 @@ var init_expo_native_prebuilt = __esm({
|
|
|
104067
104451
|
import_node_fs106 = __toESM(require("node:fs"), 1);
|
|
104068
104452
|
import_node_module13 = require("node:module");
|
|
104069
104453
|
import_node_path108 = __toESM(require("node:path"), 1);
|
|
104070
|
-
|
|
104454
|
+
import_node_util13 = require("node:util");
|
|
104071
104455
|
import_plist8 = __toESM(require("peachsim/vendor/plist"), 1);
|
|
104072
104456
|
init_answeredNativePackages();
|
|
104073
104457
|
init_expo_native_compiler_digest();
|
|
@@ -104786,32 +105170,6 @@ var init_native_static_libraries = __esm({
|
|
|
104786
105170
|
}
|
|
104787
105171
|
});
|
|
104788
105172
|
|
|
104789
|
-
// ../../src/helpers/mapLimit.ts
|
|
104790
|
-
async function mapLimit(items2, limit, worker) {
|
|
104791
|
-
const results = new Array(items2.length);
|
|
104792
|
-
let next = 0;
|
|
104793
|
-
let failure3;
|
|
104794
|
-
await Promise.all(
|
|
104795
|
-
Array.from({ length: Math.min(limit, items2.length) }, async () => {
|
|
104796
|
-
while (!failure3 && next < items2.length) {
|
|
104797
|
-
const index = next++;
|
|
104798
|
-
try {
|
|
104799
|
-
results[index] = await worker(items2[index], index);
|
|
104800
|
-
} catch (error) {
|
|
104801
|
-
failure3 ??= { error };
|
|
104802
|
-
}
|
|
104803
|
-
}
|
|
104804
|
-
})
|
|
104805
|
-
);
|
|
104806
|
-
if (failure3) throw failure3.error;
|
|
104807
|
-
return results;
|
|
104808
|
-
}
|
|
104809
|
-
var init_mapLimit = __esm({
|
|
104810
|
-
"../../src/helpers/mapLimit.ts"() {
|
|
104811
|
-
"use strict";
|
|
104812
|
-
}
|
|
104813
|
-
});
|
|
104814
|
-
|
|
104815
105173
|
// src/numbered-lock.ts
|
|
104816
105174
|
function processAlive(pid) {
|
|
104817
105175
|
try {
|
|
@@ -105307,7 +105665,7 @@ async function fetchCheckout(checkouts, identity2, pin2, signal) {
|
|
|
105307
105665
|
...withoutGitRepositoryEnv(),
|
|
105308
105666
|
...UNATTENDED_GIT_ENV
|
|
105309
105667
|
};
|
|
105310
|
-
const git = async (cwd, ...args) => (await
|
|
105668
|
+
const git = async (cwd, ...args) => (await execFileAsync3("git", ["-C", cwd, ...args], {
|
|
105311
105669
|
encoding: "utf8",
|
|
105312
105670
|
env: gitEnv,
|
|
105313
105671
|
signal
|
|
@@ -105942,7 +106300,7 @@ function resolveSwiftPackages(options2) {
|
|
|
105942
106300
|
result.nativeProducts.push({ name: name3, packageDir: manifest.dir, source });
|
|
105943
106301
|
return result;
|
|
105944
106302
|
}
|
|
105945
|
-
var import_node_child_process52, import_node_crypto68, import_node_fs112, import_node_path114, import_promises14,
|
|
106303
|
+
var import_node_child_process52, import_node_crypto68, import_node_fs112, import_node_path114, import_promises14, import_node_util14, swiftBinaryOnDisk, SWIFT_PLACEHOLDER_PACKAGES, placeholderPackage, sourceFrameworkRecipes, UNSUPPORTED_NATIVE, BINARY, blockers, verified, execFileAsync3, checkoutKey;
|
|
105946
106304
|
var init_swift_packages = __esm({
|
|
105947
106305
|
"src/swift-packages.ts"() {
|
|
105948
106306
|
"use strict";
|
|
@@ -105951,7 +106309,7 @@ var init_swift_packages = __esm({
|
|
|
105951
106309
|
import_node_fs112 = __toESM(require("node:fs"), 1);
|
|
105952
106310
|
import_node_path114 = __toESM(require("node:path"), 1);
|
|
105953
106311
|
import_promises14 = require("node:timers/promises");
|
|
105954
|
-
|
|
106312
|
+
import_node_util14 = require("node:util");
|
|
105955
106313
|
init_git_repo_env();
|
|
105956
106314
|
init_home_paths();
|
|
105957
106315
|
init_native_git();
|
|
@@ -106016,7 +106374,7 @@ var init_swift_packages = __esm({
|
|
|
106016
106374
|
BINARY = "is a binary framework";
|
|
106017
106375
|
blockers = (reasons) => [...new Set(reasons.flat())];
|
|
106018
106376
|
verified = /* @__PURE__ */ new Set();
|
|
106019
|
-
|
|
106377
|
+
execFileAsync3 = (0, import_node_util14.promisify)(import_node_child_process52.execFile);
|
|
106020
106378
|
checkoutKey = (dir, pin2) => `${dir}\0${pin2.revision}`;
|
|
106021
106379
|
}
|
|
106022
106380
|
});
|
|
@@ -121356,7 +121714,7 @@ function describePart(file) {
|
|
|
121356
121714
|
);
|
|
121357
121715
|
return { file, functions, byteLength: bytes.byteLength };
|
|
121358
121716
|
}
|
|
121359
|
-
var import_node_child_process64, import_node_crypto78, import_node_fs130, import_node_os26, import_node_path132,
|
|
121717
|
+
var import_node_child_process64, import_node_crypto78, import_node_fs130, import_node_os26, import_node_path132, import_node_util15, run11, MAX_MODULE_FUNCTIONS, MAX_START_FUNCTIONS, SIDE_FUNCTIONS, SIDE_CODE_BYTES, FEATURES2, featuresOf;
|
|
121360
121718
|
var init_wasm_lazy_split = __esm({
|
|
121361
121719
|
"src/wasm-lazy-split.ts"() {
|
|
121362
121720
|
"use strict";
|
|
@@ -121365,7 +121723,7 @@ var init_wasm_lazy_split = __esm({
|
|
|
121365
121723
|
import_node_fs130 = require("node:fs");
|
|
121366
121724
|
import_node_os26 = require("node:os");
|
|
121367
121725
|
import_node_path132 = require("node:path");
|
|
121368
|
-
|
|
121726
|
+
import_node_util15 = require("node:util");
|
|
121369
121727
|
init_mapLimit();
|
|
121370
121728
|
init_nativeDyldTableContract();
|
|
121371
121729
|
init_nativeWasmContract();
|
|
@@ -121375,7 +121733,7 @@ var init_wasm_lazy_split = __esm({
|
|
|
121375
121733
|
init_wasm_features();
|
|
121376
121734
|
init_wasm_imports();
|
|
121377
121735
|
init_wasm_narrow_boundary();
|
|
121378
|
-
run11 = (0,
|
|
121736
|
+
run11 = (0, import_node_util15.promisify)(import_node_child_process64.execFile);
|
|
121379
121737
|
MAX_MODULE_FUNCTIONS = 1e6;
|
|
121380
121738
|
MAX_START_FUNCTIONS = 256e3;
|
|
121381
121739
|
SIDE_FUNCTIONS = 8e4;
|
|
@@ -126088,7 +126446,7 @@ async function runInstalledTurboCodegen(appRoot, outDir, signal) {
|
|
|
126088
126446
|
files: hashTree(generatedRoot)
|
|
126089
126447
|
};
|
|
126090
126448
|
}
|
|
126091
|
-
var import_node_child_process66, import_node_crypto82, import_node_fs136, import_node_module17, import_node_path138,
|
|
126449
|
+
var import_node_child_process66, import_node_crypto82, import_node_fs136, import_node_module17, import_node_path138, import_node_util16, run12, RENDERER_PODS, RENDERER_PODS_VERSIONED, COMPILED_SOURCE, LEGACY_BRIDGE_DEV_SUPPORT, LEGACY_BRIDGE_PODS, LEGACY_BRIDGE_PODS_VERSIONED;
|
|
126092
126450
|
var init_turbo_codegen_intake = __esm({
|
|
126093
126451
|
"src/turbo-codegen-intake.ts"() {
|
|
126094
126452
|
"use strict";
|
|
@@ -126097,12 +126455,12 @@ var init_turbo_codegen_intake = __esm({
|
|
|
126097
126455
|
import_node_fs136 = __toESM(require("node:fs"), 1);
|
|
126098
126456
|
import_node_module17 = require("node:module");
|
|
126099
126457
|
import_node_path138 = __toESM(require("node:path"), 1);
|
|
126100
|
-
|
|
126458
|
+
import_node_util16 = require("node:util");
|
|
126101
126459
|
init_forked_script_contract();
|
|
126102
126460
|
init_is_record();
|
|
126103
126461
|
init_nitro_source();
|
|
126104
126462
|
init_podspec_sources();
|
|
126105
|
-
run12 = (0,
|
|
126463
|
+
run12 = (0, import_node_util16.promisify)(import_node_child_process66.execFile);
|
|
126106
126464
|
RENDERER_PODS = /* @__PURE__ */ new Set([
|
|
126107
126465
|
"React-Fabric",
|
|
126108
126466
|
"React-FabricComponents",
|
|
@@ -131459,7 +131817,7 @@ async function prebuiltReactNativeCore(project2, reactNativeRoot, moduleRoot, mo
|
|
|
131459
131817
|
const descriptor = JSON.parse(
|
|
131460
131818
|
import_node_fs140.default.readFileSync(import_node_path142.default.join(dir, "descriptor.json"), "utf8")
|
|
131461
131819
|
);
|
|
131462
|
-
if (!(0,
|
|
131820
|
+
if (!(0, import_node_util17.isDeepStrictEqual)(
|
|
131463
131821
|
descriptor,
|
|
131464
131822
|
describeNativeEntry("react-native", entry.name, entry.inputs, [file])
|
|
131465
131823
|
))
|
|
@@ -131516,7 +131874,7 @@ function linkReactNativeCore(collection, core, moduleRoot) {
|
|
|
131516
131874
|
}
|
|
131517
131875
|
}
|
|
131518
131876
|
}
|
|
131519
|
-
var import_node_crypto85, import_node_fs140, import_node_module19, import_node_path142,
|
|
131877
|
+
var import_node_crypto85, import_node_fs140, import_node_module19, import_node_path142, import_node_util17, recipe, strings4, building;
|
|
131520
131878
|
var init_react_native_core = __esm({
|
|
131521
131879
|
"src/react-native-core.ts"() {
|
|
131522
131880
|
"use strict";
|
|
@@ -131524,7 +131882,7 @@ var init_react_native_core = __esm({
|
|
|
131524
131882
|
import_node_fs140 = __toESM(require("node:fs"), 1);
|
|
131525
131883
|
import_node_module19 = require("node:module");
|
|
131526
131884
|
import_node_path142 = __toESM(require("node:path"), 1);
|
|
131527
|
-
|
|
131885
|
+
import_node_util17 = require("node:util");
|
|
131528
131886
|
init_home_paths();
|
|
131529
131887
|
init_is_record();
|
|
131530
131888
|
init_native_prebuilt();
|
|
@@ -134156,7 +134514,7 @@ ${diagnostics}`}`
|
|
|
134156
134514
|
}
|
|
134157
134515
|
return true;
|
|
134158
134516
|
}
|
|
134159
|
-
var import_node_async_hooks3, import_node_child_process69, import_node_crypto87, import_node_fs142, import_node_module20, import_node_os30, import_node_path144, import_node_url7,
|
|
134517
|
+
var import_node_async_hooks3, import_node_child_process69, import_node_crypto87, import_node_fs142, import_node_module20, import_node_os30, import_node_path144, import_node_url7, import_node_util18, run13, scriptEnv, EXPO_SWIFT_ROUTE, EXPO_SWIFT_ENTRY, WITNESS_BATCH, traceStore, discoveryCache, preparedCache, savedFs, ignoredRoots, ownTemporaryRoots, EXPO_MODULE_SCAN_TIMEOUT_MS, preparedExpoSwift, openPreparations, ExpoSwiftLinkRefusal;
|
|
134160
134518
|
var init_expo_swift_host = __esm({
|
|
134161
134519
|
"src/expo-swift-host.ts"() {
|
|
134162
134520
|
"use strict";
|
|
@@ -134168,7 +134526,7 @@ var init_expo_swift_host = __esm({
|
|
|
134168
134526
|
import_node_os30 = __toESM(require("node:os"), 1);
|
|
134169
134527
|
import_node_path144 = __toESM(require("node:path"), 1);
|
|
134170
134528
|
import_node_url7 = require("node:url");
|
|
134171
|
-
|
|
134529
|
+
import_node_util18 = require("node:util");
|
|
134172
134530
|
init_expo_eager_seam_contract();
|
|
134173
134531
|
init_app_project();
|
|
134174
134532
|
init_answeredNativePackages();
|
|
@@ -134198,7 +134556,7 @@ var init_expo_swift_host = __esm({
|
|
|
134198
134556
|
init_swift_submit();
|
|
134199
134557
|
init_swift_toolchain();
|
|
134200
134558
|
init_turbo_source();
|
|
134201
|
-
run13 = (0,
|
|
134559
|
+
run13 = (0, import_node_util18.promisify)(import_node_child_process69.execFile);
|
|
134202
134560
|
scriptEnv = { ...process.env, [PEACH_FORKED_SCRIPT_ENV]: "1" };
|
|
134203
134561
|
EXPO_SWIFT_ROUTE = "/__peach/expo-swift";
|
|
134204
134562
|
EXPO_SWIFT_ENTRY = "Sources/PeachExpoApp/PeachExpoEntry.swift";
|
|
@@ -141126,7 +141484,7 @@ async function compileJavaModuleAbi(input) {
|
|
|
141126
141484
|
);
|
|
141127
141485
|
return library;
|
|
141128
141486
|
}
|
|
141129
|
-
var import_node_child_process72, import_node_crypto93, import_node_fs157, import_node_path159,
|
|
141487
|
+
var import_node_child_process72, import_node_crypto93, import_node_fs157, import_node_path159, import_node_util19, run14, JAVA_BINDINGS_INITIALIZER;
|
|
141130
141488
|
var init_java_module_abi = __esm({
|
|
141131
141489
|
"src/java-module-abi.ts"() {
|
|
141132
141490
|
"use strict";
|
|
@@ -141134,11 +141492,11 @@ var init_java_module_abi = __esm({
|
|
|
141134
141492
|
import_node_crypto93 = require("node:crypto");
|
|
141135
141493
|
import_node_fs157 = __toESM(require("node:fs"), 1);
|
|
141136
141494
|
import_node_path159 = __toESM(require("node:path"), 1);
|
|
141137
|
-
|
|
141495
|
+
import_node_util19 = require("node:util");
|
|
141138
141496
|
init_android_bridge_packages();
|
|
141139
141497
|
init_is_record();
|
|
141140
141498
|
init_kotlin_toolchain();
|
|
141141
|
-
run14 = (0,
|
|
141499
|
+
run14 = (0, import_node_util19.promisify)(import_node_child_process72.execFile);
|
|
141142
141500
|
JAVA_BINDINGS_INITIALIZER = "initializeJavaBindings";
|
|
141143
141501
|
}
|
|
141144
141502
|
});
|
|
@@ -141422,7 +141780,7 @@ async function installKotlinSdkArchive(archive, compiler) {
|
|
|
141422
141780
|
import_node_fs158.default.rmSync(work, { recursive: true, force: true });
|
|
141423
141781
|
}
|
|
141424
141782
|
}
|
|
141425
|
-
var import_node_child_process73, import_node_crypto94, import_node_fs158, import_node_path160,
|
|
141783
|
+
var import_node_child_process73, import_node_crypto94, import_node_fs158, import_node_path160, import_node_util20, run15;
|
|
141426
141784
|
var init_kotlin_sdk = __esm({
|
|
141427
141785
|
"src/kotlin-sdk.ts"() {
|
|
141428
141786
|
"use strict";
|
|
@@ -141430,10 +141788,10 @@ var init_kotlin_sdk = __esm({
|
|
|
141430
141788
|
import_node_crypto94 = require("node:crypto");
|
|
141431
141789
|
import_node_fs158 = __toESM(require("node:fs"), 1);
|
|
141432
141790
|
import_node_path160 = __toESM(require("node:path"), 1);
|
|
141433
|
-
|
|
141791
|
+
import_node_util20 = require("node:util");
|
|
141434
141792
|
init_kotlin_toolchain();
|
|
141435
141793
|
init_kotlinSdkContract();
|
|
141436
|
-
run15 = (0,
|
|
141794
|
+
run15 = (0, import_node_util20.promisify)(import_node_child_process73.execFile);
|
|
141437
141795
|
}
|
|
141438
141796
|
});
|
|
141439
141797
|
|
|
@@ -141751,7 +142109,7 @@ function readDependencySources(value) {
|
|
|
141751
142109
|
};
|
|
141752
142110
|
});
|
|
141753
142111
|
}
|
|
141754
|
-
var import_node_child_process74, import_node_crypto96, import_node_fs160, import_node_path162,
|
|
142112
|
+
var import_node_child_process74, import_node_crypto96, import_node_fs160, import_node_path162, import_node_util21, run16, modelQuery;
|
|
141755
142113
|
var init_android_gradle_sources = __esm({
|
|
141756
142114
|
"src/android-gradle-sources.ts"() {
|
|
141757
142115
|
"use strict";
|
|
@@ -141759,11 +142117,11 @@ var init_android_gradle_sources = __esm({
|
|
|
141759
142117
|
import_node_crypto96 = require("node:crypto");
|
|
141760
142118
|
import_node_fs160 = __toESM(require("node:fs"), 1);
|
|
141761
142119
|
import_node_path162 = __toESM(require("node:path"), 1);
|
|
141762
|
-
|
|
142120
|
+
import_node_util21 = require("node:util");
|
|
141763
142121
|
init_forked_script_contract();
|
|
141764
142122
|
init_is_record();
|
|
141765
142123
|
init_kotlin_toolchain();
|
|
141766
|
-
run16 = (0,
|
|
142124
|
+
run16 = (0, import_node_util21.promisify)(import_node_child_process74.execFile);
|
|
141767
142125
|
modelQuery = `
|
|
141768
142126
|
import groovy.json.JsonOutput
|
|
141769
142127
|
import groovy.json.JsonSlurper
|
|
@@ -143079,7 +143437,7 @@ async function serveKotlinRequest(pathname, res, app) {
|
|
|
143079
143437
|
}
|
|
143080
143438
|
return true;
|
|
143081
143439
|
}
|
|
143082
|
-
var import_node_child_process75, import_node_crypto97, import_node_fs161, import_node_module22, import_node_path163,
|
|
143440
|
+
var import_node_child_process75, import_node_crypto97, import_node_fs161, import_node_module22, import_node_path163, import_node_util22, run17, KOTLIN_ARTIFACT_PREFIX, SKIP_DIRS, configureDeviceSource, BUILD_FORMAT, builds, toolScans, BRIDGE_PARAMETERS, BRIDGE_CASTS, BRIDGE_RETURNS, bridgeType, JAVA_CLASSES, argb, escapes2, literal5, CONTENT_TYPES;
|
|
143083
143441
|
var init_kotlin_host = __esm({
|
|
143084
143442
|
"src/kotlin-host.ts"() {
|
|
143085
143443
|
"use strict";
|
|
@@ -143088,7 +143446,7 @@ var init_kotlin_host = __esm({
|
|
|
143088
143446
|
import_node_fs161 = __toESM(require("node:fs"), 1);
|
|
143089
143447
|
import_node_module22 = require("node:module");
|
|
143090
143448
|
import_node_path163 = __toESM(require("node:path"), 1);
|
|
143091
|
-
|
|
143449
|
+
import_node_util22 = require("node:util");
|
|
143092
143450
|
init_kotlinDiscoveryContract();
|
|
143093
143451
|
init_android_bridge_packages();
|
|
143094
143452
|
init_android_view_classes();
|
|
@@ -143101,7 +143459,7 @@ var init_kotlin_host = __esm({
|
|
|
143101
143459
|
init_kotlin_toolchain();
|
|
143102
143460
|
init_kotlin_view_models();
|
|
143103
143461
|
init_kotlin_module();
|
|
143104
|
-
run17 = (0,
|
|
143462
|
+
run17 = (0, import_node_util22.promisify)(import_node_child_process75.execFile);
|
|
143105
143463
|
KOTLIN_ARTIFACT_PREFIX = "/__peach/kotlin-artifact/";
|
|
143106
143464
|
SKIP_DIRS = /* @__PURE__ */ new Set([
|
|
143107
143465
|
"node_modules",
|
|
@@ -143391,7 +143749,7 @@ function handleOneNativeSourceUpgrade(req, socket, head) {
|
|
|
143391
143749
|
});
|
|
143392
143750
|
return true;
|
|
143393
143751
|
}
|
|
143394
|
-
var import_node_fs162, import_node_module23, import_node_path164, import_node_url9,
|
|
143752
|
+
var import_node_fs162, import_node_module23, import_node_path164, import_node_url9, import_node_util23, import_node_zlib10, import_ws2, apps, compressMetadata;
|
|
143395
143753
|
var init_one_native_source = __esm({
|
|
143396
143754
|
"src/one-native-source.ts"() {
|
|
143397
143755
|
"use strict";
|
|
@@ -143399,7 +143757,7 @@ var init_one_native_source = __esm({
|
|
|
143399
143757
|
import_node_module23 = require("node:module");
|
|
143400
143758
|
import_node_path164 = __toESM(require("node:path"), 1);
|
|
143401
143759
|
import_node_url9 = require("node:url");
|
|
143402
|
-
|
|
143760
|
+
import_node_util23 = require("node:util");
|
|
143403
143761
|
import_node_zlib10 = require("node:zlib");
|
|
143404
143762
|
init_kotlinDiscoveryContract();
|
|
143405
143763
|
import_ws2 = require("peachsim/vendor/ws");
|
|
@@ -143413,7 +143771,7 @@ var init_one_native_source = __esm({
|
|
|
143413
143771
|
init_swift_submit();
|
|
143414
143772
|
init_swift_toolchain();
|
|
143415
143773
|
apps = /* @__PURE__ */ new Map();
|
|
143416
|
-
compressMetadata = (0,
|
|
143774
|
+
compressMetadata = (0, import_node_util23.promisify)(import_node_zlib10.brotliCompress);
|
|
143417
143775
|
}
|
|
143418
143776
|
});
|
|
143419
143777
|
|
|
@@ -144954,7 +145312,7 @@ var init_nitro_superset = __esm({
|
|
|
144954
145312
|
init_nitroContract();
|
|
144955
145313
|
init_swift_standin_digest();
|
|
144956
145314
|
NITRO_SUPERSET_ENTRY_NAME = "superset";
|
|
144957
|
-
NITRO_COMPILER_DIGEST = true ? "
|
|
145315
|
+
NITRO_COMPILER_DIGEST = true ? "228003f16f1b081fea0ab10bb0ba40a8192beee02eb15e1a3363090ee53f71ef" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
|
|
144958
145316
|
nitroSupersetLock = parseLock(nitro_superset_lock_default);
|
|
144959
145317
|
nitroSupersetKey = (inputs2) => nativeEntryKey({ ...inputs2, compiler: NITRO_COMPILER_DIGEST });
|
|
144960
145318
|
published3 = /* @__PURE__ */ new Map();
|
|
@@ -145155,7 +145513,7 @@ async function buildExpoWidgetsBundle(appRoot, origin = "") {
|
|
|
145155
145513
|
const runtimeBundle = await withSwiftRootLock(
|
|
145156
145514
|
import_node_path174.default.join(await import_promises19.default.realpath(packageDir), "bundle"),
|
|
145157
145515
|
async () => {
|
|
145158
|
-
await (0,
|
|
145516
|
+
await (0, import_node_util24.promisify)(import_node_child_process76.execFile)(
|
|
145159
145517
|
process.env.NODE_BINARY || "node",
|
|
145160
145518
|
[import_node_path174.default.join(packageDir, "scripts/build-bundle.mjs"), appRoot],
|
|
145161
145519
|
{ cwd: appRoot, maxBuffer: 16 * 1024 * 1024 }
|
|
@@ -145171,7 +145529,7 @@ async function buildExpoWidgetsBundle(appRoot, origin = "") {
|
|
|
145171
145529
|
}
|
|
145172
145530
|
};
|
|
145173
145531
|
}
|
|
145174
|
-
var import_node_child_process76, import_promises19, import_node_module25, import_node_path174,
|
|
145532
|
+
var import_node_child_process76, import_promises19, import_node_module25, import_node_path174, import_node_util24, EXPO_WIDGETS_ROUTE, handleExpoWidgetsRequest;
|
|
145175
145533
|
var init_expo_widgets_bundle = __esm({
|
|
145176
145534
|
"src/expo-widgets-bundle.ts"() {
|
|
145177
145535
|
"use strict";
|
|
@@ -145179,7 +145537,7 @@ var init_expo_widgets_bundle = __esm({
|
|
|
145179
145537
|
import_promises19 = __toESM(require("node:fs/promises"), 1);
|
|
145180
145538
|
import_node_module25 = require("node:module");
|
|
145181
145539
|
import_node_path174 = __toESM(require("node:path"), 1);
|
|
145182
|
-
|
|
145540
|
+
import_node_util24 = require("node:util");
|
|
145183
145541
|
init_expo_widget_assets();
|
|
145184
145542
|
init_staged_host_files();
|
|
145185
145543
|
init_nitro_bundle();
|
|
@@ -156013,12 +156371,12 @@ function redactText(text7, configurationOnly, decodedString = false) {
|
|
|
156013
156371
|
(line, prefix, name3, value) => SECRET_NAME.test(name3) ? `${prefix}${mask(value)}` : line
|
|
156014
156372
|
).replace(EMAIL, mask).replace(OPAQUE_ID, mask);
|
|
156015
156373
|
}
|
|
156016
|
-
var import_node_crypto110,
|
|
156374
|
+
var import_node_crypto110, import_node_util25, SECRET_NAME, JWT, GOOGLE_API_KEY, BEARER, EMAIL, OPAQUE_ID, STRING, NUMBER, PAIR2, STRING_TOKEN, QUERY_PAIR, HEADER_LINE, MASKED, CONFIG_CONTAINER, utf8;
|
|
156017
156375
|
var init_output_redaction = __esm({
|
|
156018
156376
|
"cli/output-redaction.ts"() {
|
|
156019
156377
|
"use strict";
|
|
156020
156378
|
import_node_crypto110 = require("node:crypto");
|
|
156021
|
-
|
|
156379
|
+
import_node_util25 = require("node:util");
|
|
156022
156380
|
init_config();
|
|
156023
156381
|
SECRET_NAME = /^(?:[\w-]*(?:api[-_]?key|token|secret|password|passwd|authorization|cookie|signature|credential)s?|auth|sig|email|uid|[\w-]*(?:user|account|local|device|installation|client|app|project|sender|measurement|tenant)[-_]?id)$/i;
|
|
156024
156382
|
JWT = /\beyJ[\w-]{6,}\.[\w-]{6,}\.[\w-]{6,}/g;
|
|
@@ -179382,14 +179740,14 @@ async function runSwift(args, opts = {}) {
|
|
|
179382
179740
|
}
|
|
179383
179741
|
return code;
|
|
179384
179742
|
}
|
|
179385
|
-
var import_node_fs205, import_node_http6, import_node_path208,
|
|
179743
|
+
var import_node_fs205, import_node_http6, import_node_path208, import_node_util26, import_node_zlib13, import_ws7, compressMetadata2;
|
|
179386
179744
|
var init_swift2 = __esm({
|
|
179387
179745
|
"cli/commands/swift.ts"() {
|
|
179388
179746
|
"use strict";
|
|
179389
179747
|
import_node_fs205 = __toESM(require("node:fs"), 1);
|
|
179390
179748
|
import_node_http6 = __toESM(require("node:http"), 1);
|
|
179391
179749
|
import_node_path208 = __toESM(require("node:path"), 1);
|
|
179392
|
-
|
|
179750
|
+
import_node_util26 = require("node:util");
|
|
179393
179751
|
import_node_zlib13 = require("node:zlib");
|
|
179394
179752
|
init_swiftDiscoveryContract();
|
|
179395
179753
|
import_ws7 = require("peachsim/vendor/ws");
|
|
@@ -179402,7 +179760,7 @@ var init_swift2 = __esm({
|
|
|
179402
179760
|
init_settings_flags();
|
|
179403
179761
|
init_control();
|
|
179404
179762
|
init_guest_host();
|
|
179405
|
-
compressMetadata2 = (0,
|
|
179763
|
+
compressMetadata2 = (0, import_node_util26.promisify)(import_node_zlib13.brotliCompress);
|
|
179406
179764
|
}
|
|
179407
179765
|
});
|
|
179408
179766
|
|