peachsim 0.1.2592 → 0.1.2594
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +2 -2
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +5 -5
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +3 -3
- package/dist-lib/bundle-channel.cjs +1737 -1648
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +3 -3
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +3 -3
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +2 -2
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +7 -7
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +5 -5
- package/dist-lib/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/esm-chunks/{acorn-67PU73QE.mjs → acorn-M67PRRGJ.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-EWHA6X3Z.mjs → chunk-3VEDDAPT.mjs} +5 -5
- package/dist-lib/esm-chunks/{chunk-DFF5XZ5M.mjs → chunk-4AOZYVB2.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-PITO2NI2.mjs → chunk-6MZ5FKMK.mjs} +2 -2
- package/dist-lib/esm-chunks/{chunk-6DB5FR7S.mjs → chunk-EDBGKIQ2.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-EITX573K.mjs → chunk-FFHDCOXF.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-GY6TE4B4.mjs → chunk-GER2Z6BI.mjs} +4 -4
- package/dist-lib/esm-chunks/{chunk-QSFWBVUO.mjs → chunk-HJJI36KV.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-EHRSWFTD.mjs → chunk-INOLFCG5.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-CF3MTPMY.mjs → chunk-IUDVBSA4.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-GQ3EO2UV.mjs → chunk-NN73CP4F.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-XZ3FX3HW.mjs → chunk-PESI6OUB.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-RV4ACE6R.mjs → chunk-QHYHKB3J.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-KDI5YYQ6.mjs → chunk-QSPPJOT6.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-R3WTQB5J.mjs → chunk-QUMKCF67.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-FYXXFYML.mjs → chunk-RESE3ERA.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-TJZPNFVF.mjs → chunk-SBHXHWKH.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-M4QLI2SY.mjs → chunk-SV76NV36.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-XSQH4R5E.mjs → chunk-UAEIMMNH.mjs} +69 -48
- package/dist-lib/esm-chunks/{chunk-D4LYKRRB.mjs → chunk-X242Y5KS.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-L5T3HBPO.mjs → chunk-XM3OLATO.mjs} +240 -206
- package/dist-lib/esm-chunks/{chunk-SW4PSSTF.mjs → chunk-YGDCMWUX.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-5FTHILIE.mjs → chunk-Z6E7GAQS.mjs} +1 -1
- package/dist-lib/esm-chunks/{metro-layout-parser-EX65MARK.mjs → metro-layout-parser-ZJUAU4C3.mjs} +3 -3
- package/dist-lib/esm-chunks/{swift-package-prebuilt-3BPDQVA7.mjs → swift-package-prebuilt-2FFVA7SB.mjs} +10 -10
- package/dist-lib/esm-chunks/{swift-sdk-app-module-CRX6E3TR.mjs → swift-sdk-app-module-A2ZJMCBX.mjs} +30 -20
- package/dist-lib/esm-chunks/{swift-sdk-image-EJD5TPQH.mjs → swift-sdk-image-HJLWK2B6.mjs} +14 -14
- package/dist-lib/esm-chunks/{swift-sdk-image-producer-QAZOSLTZ.mjs → swift-sdk-image-producer-7EM7U2LR.mjs} +4 -4
- package/dist-lib/expo-swift-bundle.cjs +324 -235
- 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 +480 -255
- package/dist-lib/host/fetch-proxy-handler.cjs +67 -16
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +3 -3
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +3 -3
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +4 -4
- package/dist-lib/native-app-identity-project.cjs +5 -5
- package/dist-lib/native-app-identity-project.mjs +16 -16
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +6 -6
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +3 -3
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +2 -2
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +3 -3
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +81 -81
- package/dist-lib/public-origins-lib.json +71 -71
- 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 +480 -255
- package/dist-lib/swift-compile.cjs +286 -230
- package/dist-lib/swift-compile.mjs +10 -10
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +3 -3
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +6 -6
- package/dist-lib/swift-svg-raster.cjs +1 -1
- package/dist-lib/swift-svg-raster.mjs +2 -2
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
- package/dist-lib/vendor/@xmldom/xmldom.cjs +1 -1
- package/dist-lib/vendor/acorn.cjs +1 -1
- package/dist-lib/vendor/bplist-parser.cjs +1 -1
- package/dist-lib/vendor/ignore.cjs +1 -1
- package/dist-lib/vendor/magic-string.cjs +1 -1
- package/dist-lib/vendor/plist.cjs +1 -1
- package/dist-lib/vendor/smol-toml.cjs +1 -1
- package/dist-lib/vendor/stream-json.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
- package/dist-lib/vendor/sucrase.cjs +1 -1
- package/dist-lib/vendor/terser.cjs +1 -1
- package/dist-lib/vendor/valibot.cjs +1 -1
- package/dist-lib/vendor/ws.cjs +1 -1
- package/dist-lib/vendor/zod.cjs +1 -1
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +3 -3
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +1 -1
- package/src/binaryen.lock.json +3 -3
- package/src/host/fetch-proxy-handler.ts +63 -9
- package/src/one-native-controls-package.ts +95 -10
- package/src/one-sdk-preparation.ts +40 -2
- package/src/swift-guest-compile.ts +11 -2
- package/src/swift-guest-projection-storage.ts +45 -26
- package/src/swift-guest-runtime-plan.ts +1 -1
- package/src/swift-sdk-app-module.ts +15 -6
- package/src/swift-sdk-image-wasm.ts +5 -2
- package/src/swift-sdk-image.ts +69 -49
- package/src/swift-wasm-prune.ts +51 -34
- package/src/wasm-optimize.ts +146 -140
package/dist-lib/skills.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2594 | (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 ? "63adfed92cb0f03f7e74bd25588e866da41eaddd5ff8c13d50802edd65706617" : 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 ? "8d9cc2b3945c4c67d77156d4c44a7d06d014ce6884cbc3351e77b81e4d4318aa" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
|
|
35548
35548
|
}
|
|
35549
35549
|
var import_node_crypto12;
|
|
35550
35550
|
var init_expo_native_compiler_digest = __esm({
|
|
@@ -54528,7 +54528,9 @@ async function selectOneSDK(appRoot) {
|
|
|
54528
54528
|
const imports2 = /* @__PURE__ */ new Set();
|
|
54529
54529
|
const skipped = /* @__PURE__ */ new Set(["node_modules", "ios", "android", "dist", "build", "types"]);
|
|
54530
54530
|
async function scan3(directory2) {
|
|
54531
|
+
if (imports2.has("one")) return;
|
|
54531
54532
|
for (const entry of import_node_fs51.default.readdirSync(directory2, { withFileTypes: true })) {
|
|
54533
|
+
if (imports2.has("one")) return;
|
|
54532
54534
|
if (entry.name.startsWith(".") || skipped.has(entry.name)) continue;
|
|
54533
54535
|
const file = import_node_path49.default.join(directory2, entry.name);
|
|
54534
54536
|
if (entry.isDirectory()) await scan3(file);
|
|
@@ -54542,8 +54544,10 @@ async function selectOneSDK(appRoot) {
|
|
|
54542
54544
|
});
|
|
54543
54545
|
for (const match of code.matchAll(
|
|
54544
54546
|
/(?:\bfrom\s*|\bimport\s*\(?\s*|\brequire\s*\(\s*)['"](one(?:\/ios\/[A-Za-z_][A-Za-z0-9_]*)?)(?:\/[^'"]*)?['"]/g
|
|
54545
|
-
))
|
|
54547
|
+
)) {
|
|
54546
54548
|
imports2.add(match[1]);
|
|
54549
|
+
if (match[1] === "one") return;
|
|
54550
|
+
}
|
|
54547
54551
|
}
|
|
54548
54552
|
}
|
|
54549
54553
|
}
|
|
@@ -54609,6 +54613,22 @@ async function prepareOneSDKSources(appRoot, output) {
|
|
|
54609
54613
|
import_node_fs51.default.copyFileSync(import_node_path49.default.join(published4, name3), import_node_path49.default.join(directory2, name3));
|
|
54610
54614
|
return;
|
|
54611
54615
|
}
|
|
54616
|
+
const localCache = import_node_path49.default.join(swiftCacheDir(), "one-sdk-sources", entry.key);
|
|
54617
|
+
const localManifestPath = import_node_path49.default.join(localCache, "manifest.json");
|
|
54618
|
+
if (import_node_fs51.default.existsSync(localManifestPath)) {
|
|
54619
|
+
const manifest2 = readOneSDKSourceManifest(
|
|
54620
|
+
JSON.parse(import_node_fs51.default.readFileSync(localManifestPath, "utf8"))
|
|
54621
|
+
);
|
|
54622
|
+
if (manifest2.generation === generation && JSON.stringify(manifest2.frameworks) === JSON.stringify(selected.frameworks) && selected.frameworks.every(
|
|
54623
|
+
(name3) => manifest2.selection[name3] === selected.selection[name3]
|
|
54624
|
+
) && manifest2.files.every((name3) => import_node_fs51.default.existsSync(import_node_path49.default.join(localCache, name3)))) {
|
|
54625
|
+
import_node_fs51.default.rmSync(directory2, { recursive: true, force: true });
|
|
54626
|
+
import_node_fs51.default.mkdirSync(directory2, { recursive: true });
|
|
54627
|
+
for (const name3 of [...manifest2.files, "manifest.json"])
|
|
54628
|
+
import_node_fs51.default.copyFileSync(import_node_path49.default.join(localCache, name3), import_node_path49.default.join(directory2, name3));
|
|
54629
|
+
return;
|
|
54630
|
+
}
|
|
54631
|
+
}
|
|
54612
54632
|
const generated = await generateAppSdkInChild(
|
|
54613
54633
|
import_node_path49.default.join(selected.one, "dist/sdk/app.mjs"),
|
|
54614
54634
|
selected.frameworks,
|
|
@@ -54626,7 +54646,19 @@ async function prepareOneSDKSources(appRoot, output) {
|
|
|
54626
54646
|
selection: selected.selection,
|
|
54627
54647
|
files: [...generated.files.keys()]
|
|
54628
54648
|
};
|
|
54629
|
-
|
|
54649
|
+
const manifestJson = JSON.stringify(manifest);
|
|
54650
|
+
import_node_fs51.default.writeFileSync(import_node_path49.default.join(directory2, "manifest.json"), manifestJson);
|
|
54651
|
+
import_node_fs51.default.mkdirSync(import_node_path49.default.dirname(localCache), { recursive: true });
|
|
54652
|
+
const staging = import_node_fs51.default.mkdtempSync(`${localCache}.tmp-`);
|
|
54653
|
+
try {
|
|
54654
|
+
for (const [name3, from] of generated.files)
|
|
54655
|
+
import_node_fs51.default.copyFileSync(from, import_node_path49.default.join(staging, name3));
|
|
54656
|
+
import_node_fs51.default.writeFileSync(import_node_path49.default.join(staging, "manifest.json"), manifestJson);
|
|
54657
|
+
import_node_fs51.default.renameSync(staging, localCache);
|
|
54658
|
+
} catch (error) {
|
|
54659
|
+
import_node_fs51.default.rmSync(staging, { recursive: true, force: true });
|
|
54660
|
+
if (!import_node_fs51.default.existsSync(localManifestPath)) throw error;
|
|
54661
|
+
}
|
|
54630
54662
|
}
|
|
54631
54663
|
var import_node_child_process23, import_node_crypto25, import_node_fs51, import_node_module8, import_node_os10, import_node_path49, import_node_url6, import_sucrase2, GENERATE_SCRIPT;
|
|
54632
54664
|
var init_one_sdk_preparation = __esm({
|
|
@@ -54642,6 +54674,7 @@ var init_one_sdk_preparation = __esm({
|
|
|
54642
54674
|
import_sucrase2 = require("peachsim/vendor/sucrase");
|
|
54643
54675
|
init_native_prebuilt();
|
|
54644
54676
|
init_oneSdkContract();
|
|
54677
|
+
init_swift_toolchain();
|
|
54645
54678
|
GENERATE_SCRIPT = `
|
|
54646
54679
|
import { writeFileSync } from 'node:fs'
|
|
54647
54680
|
import { pathToFileURL } from 'node:url'
|
|
@@ -59647,6 +59680,7 @@ var init_swiftSdkLinkContract = __esm({
|
|
|
59647
59680
|
|
|
59648
59681
|
// src/swift-sdk-image-wasm.ts
|
|
59649
59682
|
function wasmReader(bytes, start) {
|
|
59683
|
+
const rawBuf = Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
59650
59684
|
let at = start;
|
|
59651
59685
|
const u = () => {
|
|
59652
59686
|
let value = 0;
|
|
@@ -59675,7 +59709,7 @@ function wasmReader(bytes, start) {
|
|
|
59675
59709
|
name: () => {
|
|
59676
59710
|
const length = u();
|
|
59677
59711
|
at += length;
|
|
59678
|
-
return
|
|
59712
|
+
return rawBuf.toString("utf8", at - length, at);
|
|
59679
59713
|
},
|
|
59680
59714
|
skip: (length) => {
|
|
59681
59715
|
at += length;
|
|
@@ -60029,7 +60063,7 @@ function codeOnlySdkImage(bytes, constructorMask) {
|
|
|
60029
60063
|
const bodies = m.bodies.map(({ start, end }) => bytes.subarray(start, end));
|
|
60030
60064
|
const initMemory = functionIndex("__wasm_init_memory") - m.importedFuncs;
|
|
60031
60065
|
{
|
|
60032
|
-
const body = Uint8Array
|
|
60066
|
+
const body = new Uint8Array(bodies[initMemory]);
|
|
60033
60067
|
const r = wasmReader(body, 0);
|
|
60034
60068
|
if (r.u() !== 0) throw new Error("sdk memory initializer has locals");
|
|
60035
60069
|
while (r.at < body.length) {
|
|
@@ -61065,7 +61099,18 @@ function parseWasmObjectBytes(file, buf, isDist, symbolFlagOffsets) {
|
|
|
61065
61099
|
dataOwnerSymIdx[kept] = ownerSymIdx;
|
|
61066
61100
|
kept++;
|
|
61067
61101
|
}
|
|
61068
|
-
const dataRelocs = {
|
|
61102
|
+
const dataRelocs = kept === rawData.count ? {
|
|
61103
|
+
count: kept,
|
|
61104
|
+
bytes: rawData.bytes,
|
|
61105
|
+
start: rawData.start,
|
|
61106
|
+
end: rawData.end,
|
|
61107
|
+
ro: rawData.ro,
|
|
61108
|
+
rs: rawData.rs,
|
|
61109
|
+
addend: rawData.addend,
|
|
61110
|
+
segIdx: dataSegIdx,
|
|
61111
|
+
offInSeg: dataOffInSeg,
|
|
61112
|
+
ownerSymIdx: dataOwnerSymIdx
|
|
61113
|
+
} : {
|
|
61069
61114
|
count: kept,
|
|
61070
61115
|
bytes: rawData.bytes,
|
|
61071
61116
|
start: rawData.start.slice(0, kept),
|
|
@@ -61077,26 +61122,29 @@ function parseWasmObjectBytes(file, buf, isDist, symbolFlagOffsets) {
|
|
|
61077
61122
|
offInSeg: dataOffInSeg.slice(0, kept),
|
|
61078
61123
|
ownerSymIdx: dataOwnerSymIdx.slice(0, kept)
|
|
61079
61124
|
};
|
|
61080
|
-
|
|
61081
|
-
|
|
61082
|
-
|
|
61083
|
-
|
|
61084
|
-
|
|
61085
|
-
|
|
61086
|
-
|
|
61087
|
-
|
|
61088
|
-
|
|
61089
|
-
const
|
|
61090
|
-
|
|
61091
|
-
|
|
61092
|
-
|
|
61093
|
-
|
|
61094
|
-
|
|
61095
|
-
|
|
61096
|
-
|
|
61097
|
-
|
|
61098
|
-
|
|
61099
|
-
|
|
61125
|
+
if (segTopSyms.size > 0) {
|
|
61126
|
+
const relocatedWords = /* @__PURE__ */ new Map();
|
|
61127
|
+
for (let i = 0; i < dataRelocs.count; i++) {
|
|
61128
|
+
const segIdx = dataRelocs.segIdx[i];
|
|
61129
|
+
if (!segTopSyms.has(segIdx)) continue;
|
|
61130
|
+
let words2 = relocatedWords.get(segIdx);
|
|
61131
|
+
if (!words2) relocatedWords.set(segIdx, words2 = /* @__PURE__ */ new Set());
|
|
61132
|
+
words2.add(dataRelocs.offInSeg[i]);
|
|
61133
|
+
}
|
|
61134
|
+
for (const [segIdx, tops] of segTopSyms) {
|
|
61135
|
+
const starts = new Map(tops.map((top) => [top.off, top.symIdx]));
|
|
61136
|
+
const relocated = relocatedWords.get(segIdx);
|
|
61137
|
+
const payload = dataStart + sPayloadStarts[segIdx];
|
|
61138
|
+
const view = new DataView(buf.buffer, buf.byteOffset + payload);
|
|
61139
|
+
for (const top of tops) {
|
|
61140
|
+
for (let at = top.off; at + 4 <= top.end; at += 4) {
|
|
61141
|
+
if (relocated?.has(at)) continue;
|
|
61142
|
+
const target = starts.get(at + (view.getInt32(at, true) & ~3));
|
|
61143
|
+
if (target === void 0 || target === top.symIdx) continue;
|
|
61144
|
+
let list2 = symDataRelocs.get(top.symIdx);
|
|
61145
|
+
if (!list2) symDataRelocs.set(top.symIdx, list2 = []);
|
|
61146
|
+
list2.push(target);
|
|
61147
|
+
}
|
|
61100
61148
|
}
|
|
61101
61149
|
}
|
|
61102
61150
|
}
|
|
@@ -61268,7 +61316,7 @@ function parseWasmObjectBytes(file, buf, isDist, symbolFlagOffsets) {
|
|
|
61268
61316
|
};
|
|
61269
61317
|
}
|
|
61270
61318
|
function parseWasmObjectFile(file, isDist) {
|
|
61271
|
-
return parseWasmObjectBytes(file,
|
|
61319
|
+
return parseWasmObjectBytes(file, import_node_fs58.default.readFileSync(file), isDist);
|
|
61272
61320
|
}
|
|
61273
61321
|
function parseWasmObjectCached(file, isDist, entries2) {
|
|
61274
61322
|
const key2 = `${isDist ? "1" : "0"}:${file}`;
|
|
@@ -61283,7 +61331,7 @@ function parseWasmObjectCached(file, isDist, entries2) {
|
|
|
61283
61331
|
function localizeDefinedWasmSymbols(bytes, names) {
|
|
61284
61332
|
const offsets = [];
|
|
61285
61333
|
const object9 = parseWasmObjectBytes("", bytes, false, offsets);
|
|
61286
|
-
const output = Uint8Array
|
|
61334
|
+
const output = new Uint8Array(bytes);
|
|
61287
61335
|
let changed2 = 0;
|
|
61288
61336
|
for (let index = 0; index < object9.symNames.length; index++) {
|
|
61289
61337
|
if (!names.has(object9.symNames[index])) continue;
|
|
@@ -64744,18 +64792,6 @@ function compactSparseWasmTable(bytes) {
|
|
|
64744
64792
|
bytes.subarray(elements.end)
|
|
64745
64793
|
]);
|
|
64746
64794
|
}
|
|
64747
|
-
function hasWasmExport(bytes, name3) {
|
|
64748
|
-
const section2 = wasmSections2(bytes).find((value) => value.id === 7);
|
|
64749
|
-
if (!section2) return false;
|
|
64750
|
-
const input = readWasmSection(bytes, section2.start, section2.end);
|
|
64751
|
-
for (let count = input.number(); count > 0; count--) {
|
|
64752
|
-
const found2 = input.name();
|
|
64753
|
-
input.byte();
|
|
64754
|
-
input.number();
|
|
64755
|
-
if (found2 === name3) return true;
|
|
64756
|
-
}
|
|
64757
|
-
return false;
|
|
64758
|
-
}
|
|
64759
64795
|
function withSections(bytes, layout2, replacements) {
|
|
64760
64796
|
const parts2 = [bytes.subarray(0, 8)];
|
|
64761
64797
|
let at = 8;
|
|
@@ -65489,23 +65525,40 @@ function reserveGuestProjectionStorage(images, capacities) {
|
|
|
65489
65525
|
};
|
|
65490
65526
|
}
|
|
65491
65527
|
function mergeGuestProjectionSpans(imageCount, spans) {
|
|
65492
|
-
const
|
|
65493
|
-
|
|
65494
|
-
)
|
|
65495
|
-
const merged = [];
|
|
65496
|
-
for (const span of sorted3) {
|
|
65528
|
+
const tableSpans = [];
|
|
65529
|
+
const memorySpans = [];
|
|
65530
|
+
for (const span of spans) {
|
|
65497
65531
|
if (!Number.isInteger(span.image) || span.image < 0 || span.image >= imageCount || !Number.isInteger(span.address) || !Number.isInteger(span.length) || span.address < 0 || span.length <= 0 || span.address + span.length > 4294967296)
|
|
65498
65532
|
throw new Error("invalid linked guest span");
|
|
65499
|
-
|
|
65500
|
-
|
|
65501
|
-
throw new Error("linked guest span has ambiguous image ownership");
|
|
65502
|
-
if (previous && previous.space === span.space && previous.image === span.image && span.address <= previous.address + previous.length) {
|
|
65503
|
-
merged[merged.length - 1] = {
|
|
65504
|
-
...previous,
|
|
65505
|
-
length: Math.max(previous.address + previous.length, span.address + span.length) - previous.address
|
|
65506
|
-
};
|
|
65507
|
-
} else merged.push(span);
|
|
65533
|
+
if (span.space === "function-table") tableSpans.push(span);
|
|
65534
|
+
else memorySpans.push(span);
|
|
65508
65535
|
}
|
|
65536
|
+
const byAddress = (a, b) => a.address - b.address || a.image - b.image;
|
|
65537
|
+
tableSpans.sort(byAddress);
|
|
65538
|
+
memorySpans.sort(byAddress);
|
|
65539
|
+
const merged = [];
|
|
65540
|
+
const mergeGroup = (group) => {
|
|
65541
|
+
let previous = null;
|
|
65542
|
+
for (const span of group) {
|
|
65543
|
+
if (previous && span.address < previous.address + previous.length && previous.image !== span.image)
|
|
65544
|
+
throw new Error("linked guest span has ambiguous image ownership");
|
|
65545
|
+
if (previous && previous.image === span.image && span.address <= previous.address + previous.length) {
|
|
65546
|
+
const end = span.address + span.length;
|
|
65547
|
+
if (end > previous.address + previous.length)
|
|
65548
|
+
previous.length = end - previous.address;
|
|
65549
|
+
} else {
|
|
65550
|
+
previous = {
|
|
65551
|
+
image: span.image,
|
|
65552
|
+
space: span.space,
|
|
65553
|
+
address: span.address,
|
|
65554
|
+
length: span.length
|
|
65555
|
+
};
|
|
65556
|
+
merged.push(previous);
|
|
65557
|
+
}
|
|
65558
|
+
}
|
|
65559
|
+
};
|
|
65560
|
+
mergeGroup(tableSpans);
|
|
65561
|
+
mergeGroup(memorySpans);
|
|
65509
65562
|
return merged;
|
|
65510
65563
|
}
|
|
65511
65564
|
function guestProjectionRegionCounts(imageCount, spans) {
|
|
@@ -65701,7 +65754,7 @@ function sdkArtifactBytes(root, artifact) {
|
|
|
65701
65754
|
const source = (0, import_node_fs61.readFileSync)(import_node_path59.default.join(sourceDirectory, "libFoundation.a"));
|
|
65702
65755
|
if (hash(source) !== artifact.sha256)
|
|
65703
65756
|
throw new Error(`SDK product artifact changed ${file}`);
|
|
65704
|
-
const transformed = Uint8Array
|
|
65757
|
+
const transformed = new Uint8Array(source);
|
|
65705
65758
|
weakenFoundationOverridesInArchive(transformed);
|
|
65706
65759
|
if (!linked.equals(transformed))
|
|
65707
65760
|
throw new Error(`SDK view transformation changed ${file}`);
|
|
@@ -66241,17 +66294,17 @@ var init_binaryen_lock = __esm({
|
|
|
66241
66294
|
"linux-x64": {
|
|
66242
66295
|
asset: "x86_64-linux",
|
|
66243
66296
|
upstreamSha256: "195ddc94f9bc89f45abdabb0b9eea86023d727ba90eac8b35b80f2544fc30572",
|
|
66244
|
-
sha256: "
|
|
66297
|
+
sha256: "1024974f254c1c2edd738246ec6af5add16d3d36b5f58a94545febda3b33c869"
|
|
66245
66298
|
},
|
|
66246
66299
|
"linux-arm64": {
|
|
66247
66300
|
asset: "aarch64-linux",
|
|
66248
66301
|
upstreamSha256: "c58562417836c5d0493d89bdefc434933bdc097db641b483df86bcfa557a107f",
|
|
66249
|
-
sha256: "
|
|
66302
|
+
sha256: "7dedfc9f5cb32e75a28831f3b5aa053fd3e0bdd74f73dc4d1b1588947236daef"
|
|
66250
66303
|
},
|
|
66251
66304
|
"darwin-arm64": {
|
|
66252
66305
|
asset: "arm64-macos",
|
|
66253
66306
|
upstreamSha256: "98aad827847af7ef990ed7098d885725c8e5b5aae75073403635617ae4e259aa",
|
|
66254
|
-
sha256: "
|
|
66307
|
+
sha256: "0b56e0a06b6a873877871537a120fd94e2121e67f4bce5f8b5252c47b615854a"
|
|
66255
66308
|
}
|
|
66256
66309
|
}
|
|
66257
66310
|
};
|
|
@@ -66280,6 +66333,45 @@ var init_wasm_features = __esm({
|
|
|
66280
66333
|
});
|
|
66281
66334
|
|
|
66282
66335
|
// src/wasm-optimize.ts
|
|
66336
|
+
function readWasmMemoryFromFile(file) {
|
|
66337
|
+
const fd = (0, import_node_fs62.openSync)(file, "r");
|
|
66338
|
+
try {
|
|
66339
|
+
const total = (0, import_node_fs62.fstatSync)(fd).size;
|
|
66340
|
+
const header = Buffer.allocUnsafe(8);
|
|
66341
|
+
if (total < 8 || (0, import_node_fs62.readSync)(fd, header, 0, 8, 0) < 8) return void 0;
|
|
66342
|
+
let offset = 8;
|
|
66343
|
+
const probe2 = Buffer.allocUnsafe(16);
|
|
66344
|
+
let prefixEnd = 8;
|
|
66345
|
+
while (offset < total) {
|
|
66346
|
+
const read = (0, import_node_fs62.readSync)(fd, probe2, 0, Math.min(16, total - offset), offset);
|
|
66347
|
+
if (read < 2) break;
|
|
66348
|
+
const id = probe2[0];
|
|
66349
|
+
let size2 = 0;
|
|
66350
|
+
let shift = 0;
|
|
66351
|
+
let at = 1;
|
|
66352
|
+
for (; ; ) {
|
|
66353
|
+
const byte = probe2[at++];
|
|
66354
|
+
size2 += (byte & 127) * 2 ** shift;
|
|
66355
|
+
if (!(byte & 128)) break;
|
|
66356
|
+
shift += 7;
|
|
66357
|
+
}
|
|
66358
|
+
const next = offset + at + size2;
|
|
66359
|
+
if (id === 2 || id === 5) prefixEnd = next;
|
|
66360
|
+
if (id > 5) break;
|
|
66361
|
+
offset = next;
|
|
66362
|
+
}
|
|
66363
|
+
const prefix = Buffer.allocUnsafe(prefixEnd);
|
|
66364
|
+
let filled = 0;
|
|
66365
|
+
while (filled < prefixEnd) {
|
|
66366
|
+
const n = (0, import_node_fs62.readSync)(fd, prefix, filled, prefixEnd - filled, filled);
|
|
66367
|
+
if (n <= 0) break;
|
|
66368
|
+
filled += n;
|
|
66369
|
+
}
|
|
66370
|
+
return readWasmMemory(prefix.subarray(0, filled));
|
|
66371
|
+
} finally {
|
|
66372
|
+
(0, import_node_fs62.closeSync)(fd);
|
|
66373
|
+
}
|
|
66374
|
+
}
|
|
66283
66375
|
async function runWasmOpt(file, output, optimize, skipPasses, binary2, sdkTableEnd, wideExports) {
|
|
66284
66376
|
const admittedCores = windowAdmission()?.cores ?? Number(process.env.TM_EXEC_CPU_CORES);
|
|
66285
66377
|
const requestedCores = Number(process.env.BINARYEN_CORES);
|
|
@@ -66296,25 +66388,75 @@ async function runWasmOpt(file, output, optimize, skipPasses, binary2, sdkTableE
|
|
|
66296
66388
|
return;
|
|
66297
66389
|
}
|
|
66298
66390
|
const optimizeSize = optimize === true || optimize === "app-module";
|
|
66299
|
-
const optimizeBeforeGuard = optimize === true;
|
|
66300
66391
|
const relink = optimize === "relink";
|
|
66301
|
-
const
|
|
66302
|
-
const
|
|
66303
|
-
let input = (0, import_node_fs62.readFileSync)(file);
|
|
66304
|
-
const memory = readWasmMemory(input);
|
|
66305
|
-
const checked = `${output}.stack-checked`;
|
|
66392
|
+
const keepNames = !optimizeSize && !relink || KEEP_WASM_NAMES;
|
|
66393
|
+
const memory = readWasmMemoryFromFile(file);
|
|
66306
66394
|
if (memory?.shared && memory.maximumPages !== 65536)
|
|
66307
66395
|
throw new Error("threaded native memory must declare a 65536-page maximum");
|
|
66308
|
-
if (memory?.shared
|
|
66309
|
-
|
|
66310
|
-
|
|
66311
|
-
|
|
66312
|
-
|
|
66313
|
-
|
|
66314
|
-
|
|
66315
|
-
"
|
|
66396
|
+
if (memory?.shared) {
|
|
66397
|
+
const wideExportsFile = wideExports.size ? `${output}.wide-exports` : void 0;
|
|
66398
|
+
const tableTool = (0, import_node_path60.join)((0, import_node_path60.dirname)(binary2), "wasm-table-guard");
|
|
66399
|
+
try {
|
|
66400
|
+
if (wideExportsFile)
|
|
66401
|
+
(0, import_node_fs62.writeFileSync)(wideExportsFile, [...wideExports].join("\n") + "\n");
|
|
66402
|
+
const pipelineArgs = [
|
|
66403
|
+
"--pipeline",
|
|
66404
|
+
"--in",
|
|
66405
|
+
file,
|
|
66406
|
+
"--out",
|
|
66407
|
+
output,
|
|
66408
|
+
"--narrow",
|
|
66409
|
+
...wideExportsFile ? ["--wide-exports-file", wideExportsFile] : [],
|
|
66410
|
+
"--lower",
|
|
66411
|
+
"--shared",
|
|
66412
|
+
...keepNames ? ["--debug"] : [],
|
|
66413
|
+
...sdkTableEnd !== void 0 ? ["--slots-range", "1", String(sdkTableEnd), "--adapt"] : [],
|
|
66414
|
+
...optimizeSize ? ["--optimize", "oz"] : relink ? ["--optimize", "relink"] : [],
|
|
66415
|
+
...skipPasses.flatMap((pass) => ["--skip-pass", pass])
|
|
66416
|
+
];
|
|
66417
|
+
const { stdout } = await runBinaryen(tableTool, pipelineArgs, { env: environment });
|
|
66418
|
+
const metadata = JSON.parse(stdout);
|
|
66419
|
+
if (typeof metadata !== "object" || metadata === null || !("tableMinimum" in metadata) || typeof metadata.tableMinimum !== "number" || !Number.isSafeInteger(metadata.tableMinimum) || metadata.tableMinimum < 0)
|
|
66420
|
+
throw new Error("native table tool returned an invalid table minimum");
|
|
66421
|
+
const sectionName = new TextEncoder().encode(NATIVE_IMAGE_SECTION);
|
|
66422
|
+
const layout2 = new TextEncoder().encode(
|
|
66423
|
+
JSON.stringify({
|
|
66424
|
+
initialPages: memory.initialPages,
|
|
66425
|
+
tableMinimum: metadata.tableMinimum
|
|
66426
|
+
})
|
|
66316
66427
|
);
|
|
66428
|
+
const encode2 = (value) => {
|
|
66429
|
+
const bytes2 = [];
|
|
66430
|
+
do {
|
|
66431
|
+
const byte = value & 127;
|
|
66432
|
+
value >>>= 7;
|
|
66433
|
+
bytes2.push(byte | (value ? 128 : 0));
|
|
66434
|
+
} while (value);
|
|
66435
|
+
return bytes2;
|
|
66436
|
+
};
|
|
66437
|
+
const body = new Uint8Array([
|
|
66438
|
+
...encode2(sectionName.length),
|
|
66439
|
+
...sectionName,
|
|
66440
|
+
...layout2
|
|
66441
|
+
]);
|
|
66442
|
+
const bytes = (0, import_node_fs62.readFileSync)(output);
|
|
66443
|
+
(0, import_node_fs62.writeFileSync)(
|
|
66444
|
+
output,
|
|
66445
|
+
Buffer.concat([
|
|
66446
|
+
sdkTableEnd === void 0 ? withWasmTableMinimum(
|
|
66447
|
+
bytes,
|
|
66448
|
+
metadata.tableMinimum + NATIVE_TABLE_RESERVE_SLOTS
|
|
66449
|
+
) : bytes,
|
|
66450
|
+
Buffer.from([0, ...encode2(body.length), ...body])
|
|
66451
|
+
])
|
|
66452
|
+
);
|
|
66453
|
+
} finally {
|
|
66454
|
+
if (wideExportsFile) (0, import_node_fs62.rmSync)(wideExportsFile, { force: true });
|
|
66455
|
+
}
|
|
66456
|
+
return;
|
|
66317
66457
|
}
|
|
66458
|
+
const outputNames = keepNames ? ["-g"] : [];
|
|
66459
|
+
const input = (0, import_node_fs62.readFileSync)(file);
|
|
66318
66460
|
const narrowed = narrowWasmBoundary(input, wideExports);
|
|
66319
66461
|
const merged = `${output}.narrowed`;
|
|
66320
66462
|
if (narrowed) {
|
|
@@ -66326,7 +66468,7 @@ async function runWasmOpt(file, output, optimize, skipPasses, binary2, sdkTableE
|
|
|
66326
66468
|
(0, import_node_path60.join)((0, import_node_path60.dirname)(binary2), "wasm-merge"),
|
|
66327
66469
|
[
|
|
66328
66470
|
...features,
|
|
66329
|
-
...
|
|
66471
|
+
...outputNames,
|
|
66330
66472
|
guest,
|
|
66331
66473
|
NARROW_MERGE_NAMES.guest,
|
|
66332
66474
|
thunks,
|
|
@@ -66340,118 +66482,25 @@ async function runWasmOpt(file, output, optimize, skipPasses, binary2, sdkTableE
|
|
|
66340
66482
|
(0, import_node_fs62.rmSync)(guest);
|
|
66341
66483
|
(0, import_node_fs62.rmSync)(thunks);
|
|
66342
66484
|
}
|
|
66343
|
-
const
|
|
66344
|
-
const compiled = narrowed ? merged : memory?.shared && optimizeBeforeGuard ? checked : file;
|
|
66485
|
+
const compiled = narrowed ? merged : file;
|
|
66345
66486
|
const skip = skipPasses.flatMap((pass) => ["--skip-pass", pass]);
|
|
66346
66487
|
try {
|
|
66347
|
-
|
|
66348
|
-
|
|
66349
|
-
|
|
66350
|
-
|
|
66351
|
-
|
|
66352
|
-
|
|
66353
|
-
|
|
66354
|
-
|
|
66355
|
-
|
|
66356
|
-
|
|
66357
|
-
|
|
66358
|
-
|
|
66359
|
-
|
|
66360
|
-
|
|
66361
|
-
);
|
|
66362
|
-
if (memory?.shared) {
|
|
66363
|
-
const guarded = `${output}.table.wasm`;
|
|
66364
|
-
const sdkGuarded = `${output}.sdk-table.wasm`;
|
|
66365
|
-
const sdkSlots = `${output}.sdk-table-slots`;
|
|
66366
|
-
const tableTool = (0, import_node_path60.join)((0, import_node_path60.dirname)(binary2), "wasm-table-guard");
|
|
66367
|
-
try {
|
|
66368
|
-
const { stdout } = await runBinaryen(
|
|
66369
|
-
tableTool,
|
|
66370
|
-
[
|
|
66371
|
-
optimizeBeforeGuard ? lowered : compiled,
|
|
66372
|
-
guarded,
|
|
66373
|
-
names.length ? "1" : "0",
|
|
66374
|
-
...optimizeBeforeGuard ? [] : ["lower"]
|
|
66375
|
-
],
|
|
66376
|
-
{ env: environment }
|
|
66377
|
-
);
|
|
66378
|
-
const metadata = JSON.parse(stdout);
|
|
66379
|
-
if (typeof metadata !== "object" || metadata === null || !("tableMinimum" in metadata) || typeof metadata.tableMinimum !== "number" || !Number.isSafeInteger(metadata.tableMinimum) || metadata.tableMinimum < 0)
|
|
66380
|
-
throw new Error("native table tool returned an invalid table minimum");
|
|
66381
|
-
if (sdkTableEnd !== void 0) {
|
|
66382
|
-
(0, import_node_fs62.writeFileSync)(
|
|
66383
|
-
sdkSlots,
|
|
66384
|
-
Array.from({ length: sdkTableEnd - 1 }, (_, index) => index + 1).join("\n")
|
|
66385
|
-
);
|
|
66386
|
-
await runBinaryen(
|
|
66387
|
-
tableTool,
|
|
66388
|
-
[guarded, sdkGuarded, names.length ? "1" : "0", "0", sdkSlots, "adapt"],
|
|
66389
|
-
{ env: environment }
|
|
66390
|
-
);
|
|
66391
|
-
(0, import_node_fs62.renameSync)(sdkGuarded, guarded);
|
|
66392
|
-
}
|
|
66393
|
-
if (optimize)
|
|
66394
|
-
await runBinaryen(
|
|
66395
|
-
binary2,
|
|
66396
|
-
[
|
|
66397
|
-
...features,
|
|
66398
|
-
// an adapted call tests its target's type with a typed function reference.
|
|
66399
|
-
...sdkTableEnd === void 0 ? [] : ["--enable-gc"],
|
|
66400
|
-
...optimizeSize ? ["-Oz"] : RELINK_PASSES,
|
|
66401
|
-
...outputNames,
|
|
66402
|
-
...skip,
|
|
66403
|
-
guarded,
|
|
66404
|
-
"-o",
|
|
66405
|
-
output
|
|
66406
|
-
],
|
|
66407
|
-
{ env: environment }
|
|
66408
|
-
);
|
|
66409
|
-
const sectionName = new TextEncoder().encode(NATIVE_IMAGE_SECTION);
|
|
66410
|
-
const layout2 = new TextEncoder().encode(
|
|
66411
|
-
JSON.stringify({
|
|
66412
|
-
initialPages: memory.initialPages,
|
|
66413
|
-
tableMinimum: metadata.tableMinimum
|
|
66414
|
-
})
|
|
66415
|
-
);
|
|
66416
|
-
const encode2 = (value) => {
|
|
66417
|
-
const bytes2 = [];
|
|
66418
|
-
do {
|
|
66419
|
-
const byte = value & 127;
|
|
66420
|
-
value >>>= 7;
|
|
66421
|
-
bytes2.push(byte | (value ? 128 : 0));
|
|
66422
|
-
} while (value);
|
|
66423
|
-
return bytes2;
|
|
66424
|
-
};
|
|
66425
|
-
const body = new Uint8Array([
|
|
66426
|
-
...encode2(sectionName.length),
|
|
66427
|
-
...sectionName,
|
|
66428
|
-
...layout2
|
|
66429
|
-
]);
|
|
66430
|
-
const image = optimize ? output : guarded;
|
|
66431
|
-
const bytes = (0, import_node_fs62.readFileSync)(image);
|
|
66432
|
-
(0, import_node_fs62.writeFileSync)(
|
|
66433
|
-
image,
|
|
66434
|
-
Buffer.concat([
|
|
66435
|
-
sdkTableEnd === void 0 ? withWasmTableMinimum(
|
|
66436
|
-
bytes,
|
|
66437
|
-
metadata.tableMinimum + NATIVE_TABLE_RESERVE_SLOTS
|
|
66438
|
-
) : bytes,
|
|
66439
|
-
Buffer.from([0, ...encode2(body.length), ...body])
|
|
66440
|
-
])
|
|
66441
|
-
);
|
|
66442
|
-
if (!optimize) (0, import_node_fs62.renameSync)(guarded, output);
|
|
66443
|
-
} finally {
|
|
66444
|
-
(0, import_node_fs62.rmSync)(guarded, { force: true });
|
|
66445
|
-
(0, import_node_fs62.rmSync)(sdkGuarded, { force: true });
|
|
66446
|
-
(0, import_node_fs62.rmSync)(sdkSlots, { force: true });
|
|
66447
|
-
}
|
|
66448
|
-
}
|
|
66488
|
+
await runBinaryen(
|
|
66489
|
+
binary2,
|
|
66490
|
+
[
|
|
66491
|
+
...LOWERING,
|
|
66492
|
+
...optimizeSize ? ["-Oz"] : relink ? RELINK_PASSES : [],
|
|
66493
|
+
...outputNames,
|
|
66494
|
+
...skip,
|
|
66495
|
+
...features,
|
|
66496
|
+
compiled,
|
|
66497
|
+
"-o",
|
|
66498
|
+
output
|
|
66499
|
+
],
|
|
66500
|
+
{ env: environment, maxBuffer: Infinity }
|
|
66501
|
+
);
|
|
66449
66502
|
} finally {
|
|
66450
66503
|
if (narrowed) (0, import_node_fs62.rmSync)(merged, { force: true });
|
|
66451
|
-
if (memory?.shared) {
|
|
66452
|
-
(0, import_node_fs62.rmSync)(checked, { force: true });
|
|
66453
|
-
(0, import_node_fs62.rmSync)(lowered, { force: true });
|
|
66454
|
-
}
|
|
66455
66504
|
}
|
|
66456
66505
|
}
|
|
66457
66506
|
async function installWasmOpt() {
|
|
@@ -71598,9 +71647,11 @@ async function linkSwiftSdkImage(moduleRoot, key2, directory2, work, scopedLooku
|
|
|
71598
71647
|
objects.push({ path: object9, bytes, instrumentDynamicLookups: false });
|
|
71599
71648
|
guestObjects.set(product, objects);
|
|
71600
71649
|
};
|
|
71601
|
-
const classifyFile = (file) => {
|
|
71650
|
+
const classifyFile = (file, collectAutolink = false) => {
|
|
71602
71651
|
const bytes = (0, import_node_fs72.readFileSync)(file);
|
|
71603
71652
|
if (!file.endsWith(".a")) {
|
|
71653
|
+
if (collectAutolink)
|
|
71654
|
+
for (const library of autolinkLibraries(bytes)) libraries.add(library);
|
|
71604
71655
|
const scoped = lookups2?.rewrite(file, bytes) ?? bytes;
|
|
71605
71656
|
return addObject(file, scoped, file);
|
|
71606
71657
|
}
|
|
@@ -71608,6 +71659,8 @@ async function linkSwiftSdkImage(moduleRoot, key2, directory2, work, scopedLooku
|
|
|
71608
71659
|
(0, import_node_fs72.mkdirSync)(import_node_path70.default.join(members2, archive));
|
|
71609
71660
|
const ordinals = /* @__PURE__ */ new Map();
|
|
71610
71661
|
readArMembers(bytes).forEach((member, index) => {
|
|
71662
|
+
if (collectAutolink)
|
|
71663
|
+
for (const library of autolinkLibraries(member.bytes)) libraries.add(library);
|
|
71611
71664
|
const object9 = import_node_path70.default.join(members2, archive, `${index}-${import_node_path70.default.basename(member.name)}`);
|
|
71612
71665
|
const ordinal = (ordinals.get(member.name) ?? 0) + 1;
|
|
71613
71666
|
ordinals.set(member.name, ordinal);
|
|
@@ -71622,9 +71675,7 @@ async function linkSwiftSdkImage(moduleRoot, key2, directory2, work, scopedLooku
|
|
|
71622
71675
|
});
|
|
71623
71676
|
};
|
|
71624
71677
|
for (const object9 of [...link.objects, ...link.providers]) {
|
|
71625
|
-
classifyFile(object9);
|
|
71626
|
-
for (const bytes of objectMembers(object9))
|
|
71627
|
-
for (const library of autolinkLibraries(bytes)) libraries.add(library);
|
|
71678
|
+
classifyFile(object9, true);
|
|
71628
71679
|
}
|
|
71629
71680
|
for (const library of libraries) {
|
|
71630
71681
|
if (unpacked.has(library.slice(2))) continue;
|
|
@@ -71637,6 +71688,7 @@ async function linkSwiftSdkImage(moduleRoot, key2, directory2, work, scopedLooku
|
|
|
71637
71688
|
const hostExports = sdkHostExports(appRoot);
|
|
71638
71689
|
const guestMap = /* @__PURE__ */ new Map();
|
|
71639
71690
|
const guestMetadataNames = {};
|
|
71691
|
+
const compiles = [];
|
|
71640
71692
|
if (lookups2) {
|
|
71641
71693
|
const ledger = lookups2.link(guestObjects, [
|
|
71642
71694
|
...hostExports,
|
|
@@ -71672,33 +71724,38 @@ async function linkSwiftSdkImage(moduleRoot, key2, directory2, work, scopedLooku
|
|
|
71672
71724
|
const scopeLedger = import_node_path70.default.join(work, "guest-ledger.ll");
|
|
71673
71725
|
const scopeObject = import_node_path70.default.join(work, "guest-ledger.o");
|
|
71674
71726
|
(0, import_node_fs72.writeFileSync)(scopeLedger, ledger.llvmIR);
|
|
71675
|
-
|
|
71676
|
-
|
|
71677
|
-
|
|
71678
|
-
|
|
71679
|
-
|
|
71680
|
-
|
|
71681
|
-
|
|
71682
|
-
|
|
71683
|
-
|
|
71727
|
+
compiles.push(
|
|
71728
|
+
run5(import_node_path70.default.join(toolchain.toolchainBin, "clang"), [
|
|
71729
|
+
`--target=${SWIFT_WASM_TRIPLE}`,
|
|
71730
|
+
"-matomics",
|
|
71731
|
+
"-mbulk-memory",
|
|
71732
|
+
"-c",
|
|
71733
|
+
scopeLedger,
|
|
71734
|
+
"-o",
|
|
71735
|
+
scopeObject
|
|
71736
|
+
])
|
|
71737
|
+
);
|
|
71684
71738
|
eager.push(scopeObject);
|
|
71685
71739
|
}
|
|
71686
71740
|
(0, import_node_fs72.writeFileSync)(
|
|
71687
71741
|
import_node_path70.default.join(work, "image-tables.c"),
|
|
71688
71742
|
IMAGE_TABLES + (guestLookups?.source ?? "")
|
|
71689
71743
|
);
|
|
71690
|
-
|
|
71691
|
-
|
|
71692
|
-
|
|
71693
|
-
|
|
71694
|
-
|
|
71695
|
-
|
|
71696
|
-
|
|
71697
|
-
|
|
71698
|
-
|
|
71699
|
-
|
|
71700
|
-
|
|
71701
|
-
|
|
71744
|
+
compiles.push(
|
|
71745
|
+
run5(import_node_path70.default.join(toolchain.toolchainBin, "clang"), [
|
|
71746
|
+
`--target=${SWIFT_WASM_TRIPLE}`,
|
|
71747
|
+
"-O2",
|
|
71748
|
+
"-matomics",
|
|
71749
|
+
"-mbulk-memory",
|
|
71750
|
+
"-ffreestanding",
|
|
71751
|
+
...lookups2 ? ["-DPEACH_SDK_GUEST_LINK"] : [],
|
|
71752
|
+
"-c",
|
|
71753
|
+
import_node_path70.default.join(work, "image-tables.c"),
|
|
71754
|
+
"-o",
|
|
71755
|
+
tables
|
|
71756
|
+
])
|
|
71757
|
+
);
|
|
71758
|
+
await Promise.all(compiles);
|
|
71702
71759
|
const quote3 = (value) => JSON.stringify(value);
|
|
71703
71760
|
(0, import_node_fs72.writeFileSync)(
|
|
71704
71761
|
import_node_path70.default.join(work, "exports.rsp"),
|
|
@@ -71757,23 +71814,31 @@ async function linkSwiftSdkImage(moduleRoot, key2, directory2, work, scopedLooku
|
|
|
71757
71814
|
if (mask2 === void 0) throw new Error("sdk image lacks its constructor mask");
|
|
71758
71815
|
const code = import_node_path70.default.join(work, "code.wasm");
|
|
71759
71816
|
(0, import_node_fs72.writeFileSync)(code, codeOnlySdkImage(finished2, mask2));
|
|
71760
|
-
|
|
71817
|
+
const lowerPromise = lowerWasm(code, import_node_path70.default.join(work, IMAGE_FILE), {
|
|
71761
71818
|
optimize: true,
|
|
71762
71819
|
skipPasses: lookups2 ? ["duplicate-function-elimination"] : void 0
|
|
71763
71820
|
});
|
|
71821
|
+
await new Promise((resolve16) => setImmediate(resolve16));
|
|
71822
|
+
try {
|
|
71823
|
+
writeSdkManifest(
|
|
71824
|
+
work,
|
|
71825
|
+
linkMap,
|
|
71826
|
+
linkedBytes,
|
|
71827
|
+
finished2,
|
|
71828
|
+
(0, import_node_fs72.readFileSync)(withRelocs),
|
|
71829
|
+
functionSlots,
|
|
71830
|
+
lookups2 && { inputs: guestMap, metadataNames: guestMetadataNames }
|
|
71831
|
+
);
|
|
71832
|
+
} catch (error) {
|
|
71833
|
+
await lowerPromise.catch(() => {
|
|
71834
|
+
});
|
|
71835
|
+
throw error;
|
|
71836
|
+
}
|
|
71837
|
+
await lowerPromise;
|
|
71764
71838
|
const image = (0, import_node_fs72.readFileSync)(import_node_path70.default.join(work, IMAGE_FILE));
|
|
71765
71839
|
sdkInterface.layout.tableEnd += unslottedFunctions(image);
|
|
71766
71840
|
if (sdkInterface.layout.tableEnd > SWIFT_SDK_APP_TABLE_BASE)
|
|
71767
71841
|
throw new Error("Swift SDK image exceeds its reserved function table range");
|
|
71768
|
-
writeSdkManifest(
|
|
71769
|
-
work,
|
|
71770
|
-
linkMap,
|
|
71771
|
-
linkedBytes,
|
|
71772
|
-
finished2,
|
|
71773
|
-
(0, import_node_fs72.readFileSync)(withRelocs),
|
|
71774
|
-
functionSlots,
|
|
71775
|
-
lookups2 && { inputs: guestMap, metadataNames: guestMetadataNames }
|
|
71776
|
-
);
|
|
71777
71842
|
(0, import_node_fs72.writeFileSync)(import_node_path70.default.join(work, INTERFACE_FILE), JSON.stringify(sdkInterface));
|
|
71778
71843
|
(0, import_node_fs72.writeFileSync)(
|
|
71779
71844
|
import_node_path70.default.join(work, IMAGE_DIGEST),
|
|
@@ -71842,14 +71907,11 @@ function sdkLinkInputs(appRoot) {
|
|
|
71842
71907
|
if (!crt) throw new Error("the sdk image link found no reactor startup object");
|
|
71843
71908
|
return { flags, libraries, objects: [crt, ...objects], providers };
|
|
71844
71909
|
}
|
|
71845
|
-
function objectMembers(file) {
|
|
71846
|
-
const bytes = (0, import_node_fs72.readFileSync)(file);
|
|
71847
|
-
return file.endsWith(".a") ? readArMembers(bytes).map((member) => member.bytes) : [bytes];
|
|
71848
|
-
}
|
|
71849
71910
|
function autolinkLibraries(bytes) {
|
|
71850
71911
|
const entries2 = wasmSections(bytes).find((s) => s.name === ".swift1_autolink_entries");
|
|
71851
71912
|
if (!entries2) return [];
|
|
71852
|
-
|
|
71913
|
+
const raw2 = Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
71914
|
+
return raw2.toString("utf8", entries2.start, entries2.end).split("\0").filter((entry) => entry.startsWith("-l"));
|
|
71853
71915
|
}
|
|
71854
71916
|
function sdkHostExports(appRoot) {
|
|
71855
71917
|
const release = import_node_path70.default.join(appRoot, ".build", SWIFT_WASM_TRIPLE, "release");
|
|
@@ -71935,9 +71997,17 @@ function writeSdkManifest(work, map2, linked, finished2, withRelocs, functionSlo
|
|
|
71935
71997
|
return { starts, targets };
|
|
71936
71998
|
};
|
|
71937
71999
|
const byAddress = (edges2) => {
|
|
71938
|
-
const
|
|
71939
|
-
|
|
71940
|
-
|
|
72000
|
+
const count = edges2.length >>> 1;
|
|
72001
|
+
const order = new Uint32Array(count);
|
|
72002
|
+
for (let i = 0; i < count; i++) order[i] = i;
|
|
72003
|
+
order.sort((a, b) => edges2[a * 2] - edges2[b * 2]);
|
|
72004
|
+
const sorted3 = new Uint32Array(edges2.length);
|
|
72005
|
+
for (let i = 0; i < count; i++) {
|
|
72006
|
+
const src = order[i] * 2;
|
|
72007
|
+
sorted3[i * 2] = edges2[src];
|
|
72008
|
+
sorted3[i * 2 + 1] = edges2[src + 1];
|
|
72009
|
+
}
|
|
72010
|
+
return sorted3;
|
|
71941
72011
|
};
|
|
71942
72012
|
const functionData = flatten2(edges.code);
|
|
71943
72013
|
const functionCalls = flatten2(edges.calls);
|
|
@@ -72359,12 +72429,22 @@ async function buildSwiftAppModule(options2) {
|
|
|
72359
72429
|
work,
|
|
72360
72430
|
readInput
|
|
72361
72431
|
});
|
|
72362
|
-
|
|
72363
|
-
|
|
72364
|
-
|
|
72365
|
-
|
|
72366
|
-
|
|
72367
|
-
|
|
72432
|
+
const lowerPromise = link.lower();
|
|
72433
|
+
await new Promise((resolve16) => setImmediate(resolve16));
|
|
72434
|
+
let usage;
|
|
72435
|
+
let binding;
|
|
72436
|
+
try {
|
|
72437
|
+
usage = readSwiftSdkUsage(
|
|
72438
|
+
project2 ? projectOutputFile(buildRoot, map2, project2) : map2,
|
|
72439
|
+
pruned
|
|
72440
|
+
);
|
|
72441
|
+
binding = createSwiftSdkBinding(link.linkage, sdk2, usage);
|
|
72442
|
+
} catch (error) {
|
|
72443
|
+
await lowerPromise.catch(() => {
|
|
72444
|
+
});
|
|
72445
|
+
throw error;
|
|
72446
|
+
}
|
|
72447
|
+
await lowerPromise;
|
|
72368
72448
|
if (!project2)
|
|
72369
72449
|
writeSwiftSdkAppLink(import_node_path71.default.join(work, "app-link.json.gz"), {
|
|
72370
72450
|
linkage: link.linkage,
|
|
@@ -74274,7 +74354,6 @@ async function compileGuestLink(options2) {
|
|
|
74274
74354
|
bindingRows.set((address - values.address) / 8, value);
|
|
74275
74355
|
} else data.push(address, size2, value);
|
|
74276
74356
|
}
|
|
74277
|
-
const binding = createSwiftSdkBinding2({ ...link.linkage, data }, sdk2, usage);
|
|
74278
74357
|
const linked = (0, import_node_fs74.readFileSync)(
|
|
74279
74358
|
project2 ? projectOutputFile(work, linkedModule, project2) : linkedModule
|
|
74280
74359
|
);
|
|
@@ -74299,7 +74378,17 @@ async function compileGuestLink(options2) {
|
|
|
74299
74378
|
);
|
|
74300
74379
|
continue;
|
|
74301
74380
|
}
|
|
74302
|
-
|
|
74381
|
+
const lowerPromise = link.lower();
|
|
74382
|
+
await new Promise((resolve16) => setImmediate(resolve16));
|
|
74383
|
+
let binding;
|
|
74384
|
+
try {
|
|
74385
|
+
binding = createSwiftSdkBinding2({ ...link.linkage, data }, sdk2, usage);
|
|
74386
|
+
} catch (error) {
|
|
74387
|
+
await lowerPromise.catch(() => {
|
|
74388
|
+
});
|
|
74389
|
+
throw error;
|
|
74390
|
+
}
|
|
74391
|
+
await lowerPromise;
|
|
74303
74392
|
const finalized = finalizeGuestProjectionStorage({
|
|
74304
74393
|
map: map3,
|
|
74305
74394
|
linked,
|
|
@@ -82023,7 +82112,7 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
|
|
|
82023
82112
|
REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
|
|
82024
82113
|
MULTI_MANIFEST_VERSION = 76;
|
|
82025
82114
|
SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
|
|
82026
|
-
compilerSourceDigest = true ? "
|
|
82115
|
+
compilerSourceDigest = true ? "834b5c28c27bc5807cbb3c4eed5c44f7de81d47db3e3a8819bea6e6635689b24" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
|
|
82027
82116
|
nativeCxxCompilerFlags = ["-fno-cxx-modules"];
|
|
82028
82117
|
MODULE_MAP_RESPONSE_FILE_RUN = 16;
|
|
82029
82118
|
cFlagArray = (flags) => JSON.stringify(withoutGlogModuleMap(flags));
|
|
@@ -137402,6 +137491,11 @@ var init_rolldown_bundle_forward = __esm({
|
|
|
137402
137491
|
});
|
|
137403
137492
|
|
|
137404
137493
|
// src/host/fetch-proxy-handler.ts
|
|
137494
|
+
function isClientResponseClosed(req, res) {
|
|
137495
|
+
if (res.destroyed || res.writableEnded || res.writableFinished) return true;
|
|
137496
|
+
if (req instanceof import_node_http22.Http2ServerRequest) return req.stream.destroyed || req.stream.closed;
|
|
137497
|
+
return req.aborted || Boolean(req.socket?.destroyed);
|
|
137498
|
+
}
|
|
137405
137499
|
function fetchProxyAgentFor(targetUrl) {
|
|
137406
137500
|
return targetUrl.protocol === "https:" ? fetchProxyHttpsAgent : fetchProxyHttpAgent;
|
|
137407
137501
|
}
|
|
@@ -137613,10 +137707,22 @@ function serveBrowserProxyRoute(req, res) {
|
|
|
137613
137707
|
return false;
|
|
137614
137708
|
}
|
|
137615
137709
|
async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
137710
|
+
let clientClosed = isClientResponseClosed(req, res);
|
|
137711
|
+
let activeUpstream;
|
|
137712
|
+
const hasClientClosed = () => clientClosed || isClientResponseClosed(req, res);
|
|
137713
|
+
if (clientClosed) return;
|
|
137714
|
+
const markClosed = () => {
|
|
137715
|
+
if (res.writableFinished) return;
|
|
137716
|
+
clientClosed = true;
|
|
137717
|
+
if (activeUpstream && !activeUpstream.destroyed) activeUpstream.destroy();
|
|
137718
|
+
};
|
|
137719
|
+
req.once("aborted", markClosed);
|
|
137720
|
+
res.once("close", markClosed);
|
|
137616
137721
|
const originalMethod = req.method || "GET";
|
|
137617
137722
|
const minimumHeader = req.headers[FETCH_PROXY_TLS_MINIMUM_HEADER];
|
|
137618
137723
|
const minimumVersion = typeof minimumHeader === "string" ? tlsMinimumVersions.get(minimumHeader) : void 0;
|
|
137619
137724
|
const proxy = async (targetUrl, method, nextBody, redirects, setCookies) => {
|
|
137725
|
+
if (hasClientClosed()) return;
|
|
137620
137726
|
const transport = targetUrl.protocol === "https:" ? import_https2.default : import_http3.default;
|
|
137621
137727
|
const targetHeaders = route.requestHeaders(targetUrl);
|
|
137622
137728
|
if (targetUrl.origin !== upstreamUrl.origin) {
|
|
@@ -137638,16 +137744,16 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
137638
137744
|
body: nextBody
|
|
137639
137745
|
});
|
|
137640
137746
|
if (!allowed) throw new NetworkPolicyDeniedError(`${method} ${targetUrl.origin}`);
|
|
137747
|
+
if (hasClientClosed()) return;
|
|
137641
137748
|
const port = projectLoopbackPort(
|
|
137642
137749
|
targetUrl.hostname,
|
|
137643
137750
|
Number(targetUrl.port || (targetUrl.protocol === "https:" ? 443 : 80))
|
|
137644
137751
|
);
|
|
137645
|
-
let clientAborted = false;
|
|
137646
|
-
const markAborted = () => {
|
|
137647
|
-
clientAborted = true;
|
|
137648
|
-
};
|
|
137649
|
-
req.once("aborted", markAborted);
|
|
137650
137752
|
const send3 = () => new Promise((resolve16, reject) => {
|
|
137753
|
+
if (hasClientClosed()) {
|
|
137754
|
+
reject(new Error("client closed before upstream request"));
|
|
137755
|
+
return;
|
|
137756
|
+
}
|
|
137651
137757
|
let responded = false;
|
|
137652
137758
|
const proxyReq = transport.request(
|
|
137653
137759
|
{
|
|
@@ -137677,22 +137783,33 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
137677
137783
|
resolve16(upstream);
|
|
137678
137784
|
}
|
|
137679
137785
|
);
|
|
137680
|
-
const abort = () =>
|
|
137786
|
+
const abort = () => {
|
|
137787
|
+
if (!res.writableFinished) proxyReq.destroy();
|
|
137788
|
+
};
|
|
137681
137789
|
req.once("aborted", abort);
|
|
137682
|
-
|
|
137790
|
+
res.once("close", abort);
|
|
137791
|
+
proxyReq.once("close", () => {
|
|
137792
|
+
req.off("aborted", abort);
|
|
137793
|
+
res.off("close", abort);
|
|
137794
|
+
});
|
|
137683
137795
|
let failed = false;
|
|
137684
137796
|
proxyReq.on("error", (err) => {
|
|
137685
137797
|
if (failed) return;
|
|
137686
137798
|
failed = true;
|
|
137687
|
-
if (proxyReq.reusedSocket && !responded && !
|
|
137799
|
+
if (proxyReq.reusedSocket && !responded && !hasClientClosed() && err.code === "ECONNRESET")
|
|
137688
137800
|
resolve16(send3());
|
|
137689
137801
|
else reject(err);
|
|
137690
137802
|
});
|
|
137691
137803
|
if (nextBody === void 0) proxyReq.end();
|
|
137692
137804
|
else proxyReq.end(nextBody);
|
|
137693
137805
|
});
|
|
137694
|
-
const proxyRes = await send3()
|
|
137806
|
+
const proxyRes = await send3();
|
|
137807
|
+
activeUpstream = proxyRes;
|
|
137695
137808
|
upstreamAnswered = true;
|
|
137809
|
+
if (hasClientClosed()) {
|
|
137810
|
+
proxyRes.destroy();
|
|
137811
|
+
return;
|
|
137812
|
+
}
|
|
137696
137813
|
const status = proxyRes.statusCode ?? 502;
|
|
137697
137814
|
const location = proxyRes.headers.location;
|
|
137698
137815
|
const hopCookies = [...setCookies, ...proxyRes.headers["set-cookie"] ?? []];
|
|
@@ -137708,6 +137825,10 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
137708
137825
|
if (minimumVersion && targetUrl.protocol === "https:")
|
|
137709
137826
|
res.setHeader(FETCH_PROXY_TLS_ENFORCED_HEADER, minimumHeader);
|
|
137710
137827
|
await route.respond(proxyRes, hopCookies);
|
|
137828
|
+
if (hasClientClosed()) {
|
|
137829
|
+
proxyRes.destroy();
|
|
137830
|
+
return;
|
|
137831
|
+
}
|
|
137711
137832
|
if (isNativeCookieRedirect(hop)) res.removeHeader("location");
|
|
137712
137833
|
res.statusCode = isNativeCookieRedirect(hop) ? 200 : status;
|
|
137713
137834
|
await (0, import_promises17.pipeline)(proxyRes, res);
|
|
@@ -137722,6 +137843,7 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
137722
137843
|
const redirectUrl = resolveRedirectUrl(location, targetUrl);
|
|
137723
137844
|
proxyRes.resume();
|
|
137724
137845
|
await (0, import_promises17.finished)(proxyRes);
|
|
137846
|
+
if (hasClientClosed()) return;
|
|
137725
137847
|
await proxy(
|
|
137726
137848
|
redirectUrl,
|
|
137727
137849
|
switchToGet ? "GET" : method,
|
|
@@ -137733,9 +137855,17 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
137733
137855
|
}
|
|
137734
137856
|
if (redirects > 0) res.setHeader(FETCH_PROXY_RESPONSE_URL_HEADER, targetUrl.href);
|
|
137735
137857
|
await route.respond(proxyRes, hopCookies);
|
|
137858
|
+
if (hasClientClosed()) {
|
|
137859
|
+
proxyRes.destroy();
|
|
137860
|
+
return;
|
|
137861
|
+
}
|
|
137736
137862
|
res.statusCode = status;
|
|
137737
137863
|
if (isBundleProxyRequestUrl(req.url) && method === "GET" && status === 200 && targetUrl.pathname.endsWith(".bundle")) {
|
|
137738
137864
|
const { forwardRolldownBundleResponse: forwardRolldownBundleResponse2 } = await Promise.resolve().then(() => (init_rolldown_bundle_forward(), rolldown_bundle_forward_exports));
|
|
137865
|
+
if (hasClientClosed()) {
|
|
137866
|
+
proxyRes.destroy();
|
|
137867
|
+
return;
|
|
137868
|
+
}
|
|
137739
137869
|
await forwardRolldownBundleResponse2(proxyRes, res);
|
|
137740
137870
|
return;
|
|
137741
137871
|
}
|
|
@@ -137757,12 +137887,17 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
137757
137887
|
}
|
|
137758
137888
|
await proxy(upstreamUrl, originalMethod, body, 0, []);
|
|
137759
137889
|
} catch (err) {
|
|
137890
|
+
if (hasClientClosed()) {
|
|
137891
|
+
if (activeUpstream && !activeUpstream.destroyed) activeUpstream.destroy();
|
|
137892
|
+
return;
|
|
137893
|
+
}
|
|
137760
137894
|
const norm = normalizeHostname(upstreamUrl.hostname);
|
|
137761
137895
|
if (upstreamAnswered && !res.headersSent)
|
|
137762
137896
|
console.error(`[peach] fetch proxy could not forward ${upstreamUrl.href}:`, err);
|
|
137763
137897
|
if (!res.headersSent && isLoopbackHost(norm) && err?.code === "ECONNREFUSED") {
|
|
137764
137898
|
const altHosts = norm === "::1" ? ["127.0.0.1"] : norm === "127.0.0.1" ? ["[::1]"] : ["[::1]", "127.0.0.1"];
|
|
137765
137899
|
for (const altHost of altHosts) {
|
|
137900
|
+
if (hasClientClosed()) return;
|
|
137766
137901
|
try {
|
|
137767
137902
|
const altUrl = new URL(upstreamUrl.href);
|
|
137768
137903
|
altUrl.hostname = altHost;
|
|
@@ -137772,6 +137907,7 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
137772
137907
|
}
|
|
137773
137908
|
}
|
|
137774
137909
|
}
|
|
137910
|
+
if (hasClientClosed()) return;
|
|
137775
137911
|
if (!res.headersSent && reportFailure) {
|
|
137776
137912
|
const code = err?.code;
|
|
137777
137913
|
res.statusCode = 502;
|
|
@@ -137792,6 +137928,9 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
137792
137928
|
if (req instanceof import_node_http22.Http2ServerRequest)
|
|
137793
137929
|
req.stream.destroy(new Error("fetch proxy upstream failed", { cause: err }));
|
|
137794
137930
|
else req.socket.destroy();
|
|
137931
|
+
} finally {
|
|
137932
|
+
req.off("aborted", markClosed);
|
|
137933
|
+
res.off("close", markClosed);
|
|
137795
137934
|
}
|
|
137796
137935
|
}
|
|
137797
137936
|
var import_http3, import_https2, import_node_http22, import_promises17, fetchProxyHttpAgent, fetchProxyHttpsAgent, tlsMinimumVersions, tlsMinimumAgents, FETCH_PROXY_CORS_HEADERS, APP_API_HEADER_REWRITES;
|
|
@@ -139608,6 +139747,7 @@ function swiftGuestControls(one, names, linkedGroups) {
|
|
|
139608
139747
|
return {
|
|
139609
139748
|
source: [
|
|
139610
139749
|
"import UIKit",
|
|
139750
|
+
...names.includes("OneNativePicker") ? ["extension OneNativePickerView: OneGuestIncrementalContainer {}"] : [],
|
|
139611
139751
|
"let guestControls: [String: (UIView?, Spec, Spec?, Spec, @escaping (String, Spec) -> Void) -> UIView] = [",
|
|
139612
139752
|
...entries2,
|
|
139613
139753
|
"]",
|
|
@@ -140296,11 +140436,55 @@ private func normalizeStyle(_ raw: Spec?) -> Spec {
|
|
|
140296
140436
|
return style
|
|
140297
140437
|
}
|
|
140298
140438
|
|
|
140439
|
+
protocol OneGuestIncrementalContainer: AnyObject {
|
|
140440
|
+
func insertChild(_ child: UIView, at index: Int)
|
|
140441
|
+
func removeChild(_ child: UIView)
|
|
140442
|
+
func reset()
|
|
140443
|
+
}
|
|
140444
|
+
|
|
140445
|
+
private final class DeferredControl {
|
|
140446
|
+
private let composition = ControlComposition()
|
|
140447
|
+
private var node: Spec
|
|
140448
|
+
private lazy var realized = OneNativeDeferredRow(
|
|
140449
|
+
createView: { [weak self] in self?.render() },
|
|
140450
|
+
releaseView: { [weak self] _ in self?.composition.prune(keeping: []) }
|
|
140451
|
+
)
|
|
140452
|
+
|
|
140453
|
+
init(node: Spec, owner: ControlComposition) {
|
|
140454
|
+
self.node = node
|
|
140455
|
+
composition.emit = { [weak owner] name, fields in owner?.emit?(name, fields) }
|
|
140456
|
+
}
|
|
140457
|
+
|
|
140458
|
+
func update(_ node: Spec, content: Spec) -> OneNativeDeferredRow {
|
|
140459
|
+
self.node = node
|
|
140460
|
+
realized.configureListRowModifiers(
|
|
140461
|
+
styleModifiers(node),
|
|
140462
|
+
contentModifiers: styleModifiers(content)
|
|
140463
|
+
)
|
|
140464
|
+
if !composition.views.isEmpty { _ = render() }
|
|
140465
|
+
return realized
|
|
140466
|
+
}
|
|
140467
|
+
|
|
140468
|
+
private func styleModifiers(_ node: Spec) -> String? {
|
|
140469
|
+
let spec = node["spec"] as? Spec
|
|
140470
|
+
let style = spec?["swiftStyle"] as? Spec
|
|
140471
|
+
return style?["sdkModifiers"] as? String
|
|
140472
|
+
}
|
|
140473
|
+
|
|
140474
|
+
private func render() -> UIView {
|
|
140475
|
+
var visited = Set<String>()
|
|
140476
|
+
let view = composition.render(node, visited: &visited)
|
|
140477
|
+
composition.prune(keeping: visited)
|
|
140478
|
+
return view
|
|
140479
|
+
}
|
|
140480
|
+
}
|
|
140481
|
+
|
|
140299
140482
|
private class ControlComposition {
|
|
140300
140483
|
private static let reconciledContainers: Set<String> = [
|
|
140301
140484
|
"OneNativeLazyVStack", "OneNativeLazyHStack", "OneNativeLazyVGrid", "OneNativeLazyHGrid",
|
|
140302
140485
|
"OneNativeList", "OneNativeSection", "OneNativeForm",
|
|
140303
140486
|
]
|
|
140487
|
+
private var deferredRows: [String: DeferredControl] = [:]
|
|
140304
140488
|
var views: [String: UIView] = [:]
|
|
140305
140489
|
var specs: [String: Spec] = [:]
|
|
140306
140490
|
var children: [String: [UIView]] = [:]
|
|
@@ -140336,6 +140520,7 @@ private class ControlComposition {
|
|
|
140336
140520
|
}
|
|
140337
140521
|
let view: UIView
|
|
140338
140522
|
visited.insert(id)
|
|
140523
|
+
deferredRows.removeValue(forKey: id)
|
|
140339
140524
|
switch control {
|
|
140340
140525
|
case "OneNativeToolbar":
|
|
140341
140526
|
view = views[id] ?? OneNativeToolbarView()
|
|
@@ -140380,25 +140565,63 @@ private class ControlComposition {
|
|
|
140380
140565
|
if let container = view as? OneNativeContainerView {
|
|
140381
140566
|
container.configureSwiftStyle(style)
|
|
140382
140567
|
container.onSwiftStyleEvent = visit
|
|
140383
|
-
let
|
|
140568
|
+
let nodes = node["children"] as? [Spec] ?? []
|
|
140384
140569
|
if Self.reconciledContainers.contains(control) {
|
|
140570
|
+
let nested = nodes.map { child -> NSObject in
|
|
140571
|
+
if control == "OneNativeSection", let content = deferredContent(child) {
|
|
140572
|
+
let childID = child["id"] as! String
|
|
140573
|
+
visited.insert(childID)
|
|
140574
|
+
let deferred = deferredRows[childID] ?? DeferredControl(node: child, owner: self)
|
|
140575
|
+
deferredRows[childID] = deferred
|
|
140576
|
+
if let previous = views.removeValue(forKey: childID) {
|
|
140577
|
+
(previous as? OneNativeContainerView)?.reset()
|
|
140578
|
+
specs.removeValue(forKey: childID)
|
|
140579
|
+
children.removeValue(forKey: childID)
|
|
140580
|
+
}
|
|
140581
|
+
return deferred.update(child, content: content)
|
|
140582
|
+
}
|
|
140583
|
+
return render(child, visited: &visited)
|
|
140584
|
+
}
|
|
140385
140585
|
container.reconcileComposedChildren(nested)
|
|
140386
140586
|
} else {
|
|
140387
|
-
|
|
140388
|
-
nested,
|
|
140389
|
-
previous: children[id] ?? [],
|
|
140390
|
-
remove: container.removeChild,
|
|
140391
|
-
insert: container.insertChild
|
|
140392
|
-
)
|
|
140587
|
+
placeIncrementally(node, id: id, visited: &visited, remove: container.removeChild, insert: container.insertChild)
|
|
140393
140588
|
}
|
|
140394
|
-
|
|
140589
|
+
} else if let container = view as? OneGuestIncrementalContainer {
|
|
140590
|
+
placeIncrementally(node, id: id, visited: &visited, remove: container.removeChild, insert: container.insertChild)
|
|
140395
140591
|
}
|
|
140396
140592
|
return view
|
|
140397
140593
|
}
|
|
140398
140594
|
|
|
140595
|
+
private func deferredContent(_ node: Spec) -> Spec? {
|
|
140596
|
+
guard (node["spec"] as? Spec)?["control"] as? String == "OneNativeSwipeActions" else { return nil }
|
|
140597
|
+
let content = (node["children"] as? [Spec] ?? []).filter {
|
|
140598
|
+
($0["spec"] as? Spec)?["control"] as? String != "OneNativeSwipeActionsActions"
|
|
140599
|
+
}
|
|
140600
|
+
guard content.count == 1, (content[0]["spec"] as? Spec)?["control"] as? String == "OneNativeButton" else {
|
|
140601
|
+
return nil
|
|
140602
|
+
}
|
|
140603
|
+
return content[0]
|
|
140604
|
+
}
|
|
140605
|
+
|
|
140606
|
+
private func placeIncrementally(
|
|
140607
|
+
_ node: Spec,
|
|
140608
|
+
id: String,
|
|
140609
|
+
visited: inout Set<String>,
|
|
140610
|
+
remove: (UIView) -> Void,
|
|
140611
|
+
insert: (UIView, Int) -> Void
|
|
140612
|
+
) {
|
|
140613
|
+
let nested = (node["children"] as? [Spec] ?? []).map { render($0, visited: &visited) }
|
|
140614
|
+
reconcile(nested, previous: children[id] ?? [], remove: remove, insert: insert)
|
|
140615
|
+
children[id] = nested
|
|
140616
|
+
}
|
|
140617
|
+
|
|
140399
140618
|
func prune(keeping visited: Set<String>) {
|
|
140619
|
+
for id in deferredRows.keys where !visited.contains(id) {
|
|
140620
|
+
deferredRows.removeValue(forKey: id)
|
|
140621
|
+
}
|
|
140400
140622
|
for (id, view) in views where !visited.contains(id) {
|
|
140401
140623
|
if let container = view as? OneNativeContainerView { container.reset() }
|
|
140624
|
+
if let container = view as? OneGuestIncrementalContainer { container.reset() }
|
|
140402
140625
|
views.removeValue(forKey: id)
|
|
140403
140626
|
specs.removeValue(forKey: id)
|
|
140404
140627
|
children.removeValue(forKey: id)
|
|
@@ -140709,8 +140932,10 @@ private struct NavigationSplitViewBridge: UIViewRepresentable {
|
|
|
140709
140932
|
default:
|
|
140710
140933
|
let root = spec["root"] as! Spec
|
|
140711
140934
|
precondition((root["spec"] as? Spec)?["control"] as? String == view)
|
|
140712
|
-
|
|
140713
|
-
.frame(minWidth: 0, maxWidth: .infinity, maxHeight: .infinity)
|
|
140935
|
+
let bridge = ControlBridge(root: root, emit: emit)
|
|
140936
|
+
.frame(minWidth: 0, maxWidth: .infinity, maxHeight: .infinity)
|
|
140937
|
+
let height = (spec["height"] as? Double).map { CGFloat($0) }
|
|
140938
|
+
return AnyView(bridge.frame(height: height))
|
|
140714
140939
|
}
|
|
140715
140940
|
}
|
|
140716
140941
|
}
|
|
@@ -145251,7 +145476,7 @@ var init_nitro_superset = __esm({
|
|
|
145251
145476
|
init_nitroContract();
|
|
145252
145477
|
init_swift_standin_digest();
|
|
145253
145478
|
NITRO_SUPERSET_ENTRY_NAME = "superset";
|
|
145254
|
-
NITRO_COMPILER_DIGEST = true ? "
|
|
145479
|
+
NITRO_COMPILER_DIGEST = true ? "dc3119a2538cec9d009fc6b45b9a7c5729812bb7e7f263707bd7410c45a4719e" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
|
|
145255
145480
|
nitroSupersetLock = parseLock(nitro_superset_lock_default);
|
|
145256
145481
|
nitroSupersetKey = (inputs2) => nativeEntryKey({ ...inputs2, compiler: NITRO_COMPILER_DIGEST });
|
|
145257
145482
|
published3 = /* @__PURE__ */ new Map();
|