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
|
@@ -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;
|
|
@@ -5712,13 +5712,13 @@ var init_swift_standin_digest = __esm({
|
|
|
5712
5712
|
STANDIN_DIGEST_ENTRYPOINTS = ["swift-standins.ts", "swift-objc-compile.ts"];
|
|
5713
5713
|
SPECIFIER = /from\s*['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
5714
5714
|
standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
|
|
5715
|
-
STANDIN_SOURCE_DIGEST = true ? "
|
|
5715
|
+
STANDIN_SOURCE_DIGEST = true ? "63adfed92cb0f03f7e74bd25588e866da41eaddd5ff8c13d50802edd65706617" : standinSourceDigest();
|
|
5716
5716
|
}
|
|
5717
5717
|
});
|
|
5718
5718
|
|
|
5719
5719
|
// src/expo-native-compiler-digest.ts
|
|
5720
5720
|
function expoNativeCompilerDigestValue() {
|
|
5721
|
-
return true ? "
|
|
5721
|
+
return true ? "8d9cc2b3945c4c67d77156d4c44a7d06d014ce6884cbc3351e77b81e4d4318aa" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
|
|
5722
5722
|
}
|
|
5723
5723
|
var import_node_crypto11;
|
|
5724
5724
|
var init_expo_native_compiler_digest = __esm({
|
|
@@ -31923,7 +31923,9 @@ async function selectOneSDK(appRoot) {
|
|
|
31923
31923
|
const imports2 = /* @__PURE__ */ new Set();
|
|
31924
31924
|
const skipped = /* @__PURE__ */ new Set(["node_modules", "ios", "android", "dist", "build", "types"]);
|
|
31925
31925
|
async function scan3(directory2) {
|
|
31926
|
+
if (imports2.has("one")) return;
|
|
31926
31927
|
for (const entry of import_node_fs49.default.readdirSync(directory2, { withFileTypes: true })) {
|
|
31928
|
+
if (imports2.has("one")) return;
|
|
31927
31929
|
if (entry.name.startsWith(".") || skipped.has(entry.name)) continue;
|
|
31928
31930
|
const file = import_node_path49.default.join(directory2, entry.name);
|
|
31929
31931
|
if (entry.isDirectory()) await scan3(file);
|
|
@@ -31937,8 +31939,10 @@ async function selectOneSDK(appRoot) {
|
|
|
31937
31939
|
});
|
|
31938
31940
|
for (const match of code.matchAll(
|
|
31939
31941
|
/(?:\bfrom\s*|\bimport\s*\(?\s*|\brequire\s*\(\s*)['"](one(?:\/ios\/[A-Za-z_][A-Za-z0-9_]*)?)(?:\/[^'"]*)?['"]/g
|
|
31940
|
-
))
|
|
31942
|
+
)) {
|
|
31941
31943
|
imports2.add(match[1]);
|
|
31944
|
+
if (match[1] === "one") return;
|
|
31945
|
+
}
|
|
31942
31946
|
}
|
|
31943
31947
|
}
|
|
31944
31948
|
}
|
|
@@ -32004,6 +32008,22 @@ async function prepareOneSDKSources(appRoot, output) {
|
|
|
32004
32008
|
import_node_fs49.default.copyFileSync(import_node_path49.default.join(published4, name3), import_node_path49.default.join(directory2, name3));
|
|
32005
32009
|
return;
|
|
32006
32010
|
}
|
|
32011
|
+
const localCache = import_node_path49.default.join(swiftCacheDir(), "one-sdk-sources", entry.key);
|
|
32012
|
+
const localManifestPath = import_node_path49.default.join(localCache, "manifest.json");
|
|
32013
|
+
if (import_node_fs49.default.existsSync(localManifestPath)) {
|
|
32014
|
+
const manifest2 = readOneSDKSourceManifest(
|
|
32015
|
+
JSON.parse(import_node_fs49.default.readFileSync(localManifestPath, "utf8"))
|
|
32016
|
+
);
|
|
32017
|
+
if (manifest2.generation === generation && JSON.stringify(manifest2.frameworks) === JSON.stringify(selected.frameworks) && selected.frameworks.every(
|
|
32018
|
+
(name3) => manifest2.selection[name3] === selected.selection[name3]
|
|
32019
|
+
) && manifest2.files.every((name3) => import_node_fs49.default.existsSync(import_node_path49.default.join(localCache, name3)))) {
|
|
32020
|
+
import_node_fs49.default.rmSync(directory2, { recursive: true, force: true });
|
|
32021
|
+
import_node_fs49.default.mkdirSync(directory2, { recursive: true });
|
|
32022
|
+
for (const name3 of [...manifest2.files, "manifest.json"])
|
|
32023
|
+
import_node_fs49.default.copyFileSync(import_node_path49.default.join(localCache, name3), import_node_path49.default.join(directory2, name3));
|
|
32024
|
+
return;
|
|
32025
|
+
}
|
|
32026
|
+
}
|
|
32007
32027
|
const generated = await generateAppSdkInChild(
|
|
32008
32028
|
import_node_path49.default.join(selected.one, "dist/sdk/app.mjs"),
|
|
32009
32029
|
selected.frameworks,
|
|
@@ -32021,7 +32041,19 @@ async function prepareOneSDKSources(appRoot, output) {
|
|
|
32021
32041
|
selection: selected.selection,
|
|
32022
32042
|
files: [...generated.files.keys()]
|
|
32023
32043
|
};
|
|
32024
|
-
|
|
32044
|
+
const manifestJson = JSON.stringify(manifest);
|
|
32045
|
+
import_node_fs49.default.writeFileSync(import_node_path49.default.join(directory2, "manifest.json"), manifestJson);
|
|
32046
|
+
import_node_fs49.default.mkdirSync(import_node_path49.default.dirname(localCache), { recursive: true });
|
|
32047
|
+
const staging = import_node_fs49.default.mkdtempSync(`${localCache}.tmp-`);
|
|
32048
|
+
try {
|
|
32049
|
+
for (const [name3, from] of generated.files)
|
|
32050
|
+
import_node_fs49.default.copyFileSync(from, import_node_path49.default.join(staging, name3));
|
|
32051
|
+
import_node_fs49.default.writeFileSync(import_node_path49.default.join(staging, "manifest.json"), manifestJson);
|
|
32052
|
+
import_node_fs49.default.renameSync(staging, localCache);
|
|
32053
|
+
} catch (error) {
|
|
32054
|
+
import_node_fs49.default.rmSync(staging, { recursive: true, force: true });
|
|
32055
|
+
if (!import_node_fs49.default.existsSync(localManifestPath)) throw error;
|
|
32056
|
+
}
|
|
32025
32057
|
}
|
|
32026
32058
|
var import_node_child_process21, import_node_crypto24, import_node_fs49, import_node_module8, import_node_os10, import_node_path49, import_node_url6, import_sucrase2, GENERATE_SCRIPT;
|
|
32027
32059
|
var init_one_sdk_preparation = __esm({
|
|
@@ -32037,6 +32069,7 @@ var init_one_sdk_preparation = __esm({
|
|
|
32037
32069
|
import_sucrase2 = require("peachsim/vendor/sucrase");
|
|
32038
32070
|
init_native_prebuilt();
|
|
32039
32071
|
init_oneSdkContract();
|
|
32072
|
+
init_swift_toolchain();
|
|
32040
32073
|
GENERATE_SCRIPT = `
|
|
32041
32074
|
import { writeFileSync } from 'node:fs'
|
|
32042
32075
|
import { pathToFileURL } from 'node:url'
|
|
@@ -37042,6 +37075,7 @@ var init_swiftSdkLinkContract = __esm({
|
|
|
37042
37075
|
|
|
37043
37076
|
// src/swift-sdk-image-wasm.ts
|
|
37044
37077
|
function wasmReader(bytes, start) {
|
|
37078
|
+
const rawBuf = Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
37045
37079
|
let at = start;
|
|
37046
37080
|
const u = () => {
|
|
37047
37081
|
let value = 0;
|
|
@@ -37070,7 +37104,7 @@ function wasmReader(bytes, start) {
|
|
|
37070
37104
|
name: () => {
|
|
37071
37105
|
const length = u();
|
|
37072
37106
|
at += length;
|
|
37073
|
-
return
|
|
37107
|
+
return rawBuf.toString("utf8", at - length, at);
|
|
37074
37108
|
},
|
|
37075
37109
|
skip: (length) => {
|
|
37076
37110
|
at += length;
|
|
@@ -37424,7 +37458,7 @@ function codeOnlySdkImage(bytes, constructorMask) {
|
|
|
37424
37458
|
const bodies = m.bodies.map(({ start, end }) => bytes.subarray(start, end));
|
|
37425
37459
|
const initMemory = functionIndex("__wasm_init_memory") - m.importedFuncs;
|
|
37426
37460
|
{
|
|
37427
|
-
const body = Uint8Array
|
|
37461
|
+
const body = new Uint8Array(bodies[initMemory]);
|
|
37428
37462
|
const r = wasmReader(body, 0);
|
|
37429
37463
|
if (r.u() !== 0) throw new Error("sdk memory initializer has locals");
|
|
37430
37464
|
while (r.at < body.length) {
|
|
@@ -38460,7 +38494,18 @@ function parseWasmObjectBytes(file, buf, isDist, symbolFlagOffsets) {
|
|
|
38460
38494
|
dataOwnerSymIdx[kept] = ownerSymIdx;
|
|
38461
38495
|
kept++;
|
|
38462
38496
|
}
|
|
38463
|
-
const dataRelocs = {
|
|
38497
|
+
const dataRelocs = kept === rawData.count ? {
|
|
38498
|
+
count: kept,
|
|
38499
|
+
bytes: rawData.bytes,
|
|
38500
|
+
start: rawData.start,
|
|
38501
|
+
end: rawData.end,
|
|
38502
|
+
ro: rawData.ro,
|
|
38503
|
+
rs: rawData.rs,
|
|
38504
|
+
addend: rawData.addend,
|
|
38505
|
+
segIdx: dataSegIdx,
|
|
38506
|
+
offInSeg: dataOffInSeg,
|
|
38507
|
+
ownerSymIdx: dataOwnerSymIdx
|
|
38508
|
+
} : {
|
|
38464
38509
|
count: kept,
|
|
38465
38510
|
bytes: rawData.bytes,
|
|
38466
38511
|
start: rawData.start.slice(0, kept),
|
|
@@ -38472,26 +38517,29 @@ function parseWasmObjectBytes(file, buf, isDist, symbolFlagOffsets) {
|
|
|
38472
38517
|
offInSeg: dataOffInSeg.slice(0, kept),
|
|
38473
38518
|
ownerSymIdx: dataOwnerSymIdx.slice(0, kept)
|
|
38474
38519
|
};
|
|
38475
|
-
|
|
38476
|
-
|
|
38477
|
-
|
|
38478
|
-
|
|
38479
|
-
|
|
38480
|
-
|
|
38481
|
-
|
|
38482
|
-
|
|
38483
|
-
|
|
38484
|
-
const
|
|
38485
|
-
|
|
38486
|
-
|
|
38487
|
-
|
|
38488
|
-
|
|
38489
|
-
|
|
38490
|
-
|
|
38491
|
-
|
|
38492
|
-
|
|
38493
|
-
|
|
38494
|
-
|
|
38520
|
+
if (segTopSyms.size > 0) {
|
|
38521
|
+
const relocatedWords = /* @__PURE__ */ new Map();
|
|
38522
|
+
for (let i = 0; i < dataRelocs.count; i++) {
|
|
38523
|
+
const segIdx = dataRelocs.segIdx[i];
|
|
38524
|
+
if (!segTopSyms.has(segIdx)) continue;
|
|
38525
|
+
let words2 = relocatedWords.get(segIdx);
|
|
38526
|
+
if (!words2) relocatedWords.set(segIdx, words2 = /* @__PURE__ */ new Set());
|
|
38527
|
+
words2.add(dataRelocs.offInSeg[i]);
|
|
38528
|
+
}
|
|
38529
|
+
for (const [segIdx, tops] of segTopSyms) {
|
|
38530
|
+
const starts = new Map(tops.map((top) => [top.off, top.symIdx]));
|
|
38531
|
+
const relocated = relocatedWords.get(segIdx);
|
|
38532
|
+
const payload = dataStart + sPayloadStarts[segIdx];
|
|
38533
|
+
const view = new DataView(buf.buffer, buf.byteOffset + payload);
|
|
38534
|
+
for (const top of tops) {
|
|
38535
|
+
for (let at = top.off; at + 4 <= top.end; at += 4) {
|
|
38536
|
+
if (relocated?.has(at)) continue;
|
|
38537
|
+
const target = starts.get(at + (view.getInt32(at, true) & ~3));
|
|
38538
|
+
if (target === void 0 || target === top.symIdx) continue;
|
|
38539
|
+
let list2 = symDataRelocs.get(top.symIdx);
|
|
38540
|
+
if (!list2) symDataRelocs.set(top.symIdx, list2 = []);
|
|
38541
|
+
list2.push(target);
|
|
38542
|
+
}
|
|
38495
38543
|
}
|
|
38496
38544
|
}
|
|
38497
38545
|
}
|
|
@@ -38663,7 +38711,7 @@ function parseWasmObjectBytes(file, buf, isDist, symbolFlagOffsets) {
|
|
|
38663
38711
|
};
|
|
38664
38712
|
}
|
|
38665
38713
|
function parseWasmObjectFile(file, isDist) {
|
|
38666
|
-
return parseWasmObjectBytes(file,
|
|
38714
|
+
return parseWasmObjectBytes(file, import_node_fs56.default.readFileSync(file), isDist);
|
|
38667
38715
|
}
|
|
38668
38716
|
function parseWasmObjectCached(file, isDist, entries2) {
|
|
38669
38717
|
const key2 = `${isDist ? "1" : "0"}:${file}`;
|
|
@@ -38678,7 +38726,7 @@ function parseWasmObjectCached(file, isDist, entries2) {
|
|
|
38678
38726
|
function localizeDefinedWasmSymbols(bytes, names) {
|
|
38679
38727
|
const offsets = [];
|
|
38680
38728
|
const object9 = parseWasmObjectBytes("", bytes, false, offsets);
|
|
38681
|
-
const output = Uint8Array
|
|
38729
|
+
const output = new Uint8Array(bytes);
|
|
38682
38730
|
let changed2 = 0;
|
|
38683
38731
|
for (let index = 0; index < object9.symNames.length; index++) {
|
|
38684
38732
|
if (!names.has(object9.symNames[index])) continue;
|
|
@@ -42139,18 +42187,6 @@ function compactSparseWasmTable(bytes) {
|
|
|
42139
42187
|
bytes.subarray(elements.end)
|
|
42140
42188
|
]);
|
|
42141
42189
|
}
|
|
42142
|
-
function hasWasmExport(bytes, name3) {
|
|
42143
|
-
const section2 = wasmSections2(bytes).find((value) => value.id === 7);
|
|
42144
|
-
if (!section2) return false;
|
|
42145
|
-
const input = readWasmSection(bytes, section2.start, section2.end);
|
|
42146
|
-
for (let count = input.number(); count > 0; count--) {
|
|
42147
|
-
const found2 = input.name();
|
|
42148
|
-
input.byte();
|
|
42149
|
-
input.number();
|
|
42150
|
-
if (found2 === name3) return true;
|
|
42151
|
-
}
|
|
42152
|
-
return false;
|
|
42153
|
-
}
|
|
42154
42190
|
function withSections(bytes, layout2, replacements) {
|
|
42155
42191
|
const parts2 = [bytes.subarray(0, 8)];
|
|
42156
42192
|
let at = 8;
|
|
@@ -42884,23 +42920,40 @@ function reserveGuestProjectionStorage(images, capacities) {
|
|
|
42884
42920
|
};
|
|
42885
42921
|
}
|
|
42886
42922
|
function mergeGuestProjectionSpans(imageCount, spans) {
|
|
42887
|
-
const
|
|
42888
|
-
|
|
42889
|
-
)
|
|
42890
|
-
const merged = [];
|
|
42891
|
-
for (const span of sorted2) {
|
|
42923
|
+
const tableSpans = [];
|
|
42924
|
+
const memorySpans = [];
|
|
42925
|
+
for (const span of spans) {
|
|
42892
42926
|
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)
|
|
42893
42927
|
throw new Error("invalid linked guest span");
|
|
42894
|
-
|
|
42895
|
-
|
|
42896
|
-
throw new Error("linked guest span has ambiguous image ownership");
|
|
42897
|
-
if (previous && previous.space === span.space && previous.image === span.image && span.address <= previous.address + previous.length) {
|
|
42898
|
-
merged[merged.length - 1] = {
|
|
42899
|
-
...previous,
|
|
42900
|
-
length: Math.max(previous.address + previous.length, span.address + span.length) - previous.address
|
|
42901
|
-
};
|
|
42902
|
-
} else merged.push(span);
|
|
42928
|
+
if (span.space === "function-table") tableSpans.push(span);
|
|
42929
|
+
else memorySpans.push(span);
|
|
42903
42930
|
}
|
|
42931
|
+
const byAddress = (a, b) => a.address - b.address || a.image - b.image;
|
|
42932
|
+
tableSpans.sort(byAddress);
|
|
42933
|
+
memorySpans.sort(byAddress);
|
|
42934
|
+
const merged = [];
|
|
42935
|
+
const mergeGroup = (group) => {
|
|
42936
|
+
let previous = null;
|
|
42937
|
+
for (const span of group) {
|
|
42938
|
+
if (previous && span.address < previous.address + previous.length && previous.image !== span.image)
|
|
42939
|
+
throw new Error("linked guest span has ambiguous image ownership");
|
|
42940
|
+
if (previous && previous.image === span.image && span.address <= previous.address + previous.length) {
|
|
42941
|
+
const end = span.address + span.length;
|
|
42942
|
+
if (end > previous.address + previous.length)
|
|
42943
|
+
previous.length = end - previous.address;
|
|
42944
|
+
} else {
|
|
42945
|
+
previous = {
|
|
42946
|
+
image: span.image,
|
|
42947
|
+
space: span.space,
|
|
42948
|
+
address: span.address,
|
|
42949
|
+
length: span.length
|
|
42950
|
+
};
|
|
42951
|
+
merged.push(previous);
|
|
42952
|
+
}
|
|
42953
|
+
}
|
|
42954
|
+
};
|
|
42955
|
+
mergeGroup(tableSpans);
|
|
42956
|
+
mergeGroup(memorySpans);
|
|
42904
42957
|
return merged;
|
|
42905
42958
|
}
|
|
42906
42959
|
function guestProjectionRegionCounts(imageCount, spans) {
|
|
@@ -43096,7 +43149,7 @@ function sdkArtifactBytes(root, artifact) {
|
|
|
43096
43149
|
const source = (0, import_node_fs59.readFileSync)(import_node_path59.default.join(sourceDirectory, "libFoundation.a"));
|
|
43097
43150
|
if (hash(source) !== artifact.sha256)
|
|
43098
43151
|
throw new Error(`SDK product artifact changed ${file}`);
|
|
43099
|
-
const transformed = Uint8Array
|
|
43152
|
+
const transformed = new Uint8Array(source);
|
|
43100
43153
|
weakenFoundationOverridesInArchive(transformed);
|
|
43101
43154
|
if (!linked.equals(transformed))
|
|
43102
43155
|
throw new Error(`SDK view transformation changed ${file}`);
|
|
@@ -43636,17 +43689,17 @@ var init_binaryen_lock = __esm({
|
|
|
43636
43689
|
"linux-x64": {
|
|
43637
43690
|
asset: "x86_64-linux",
|
|
43638
43691
|
upstreamSha256: "195ddc94f9bc89f45abdabb0b9eea86023d727ba90eac8b35b80f2544fc30572",
|
|
43639
|
-
sha256: "
|
|
43692
|
+
sha256: "1024974f254c1c2edd738246ec6af5add16d3d36b5f58a94545febda3b33c869"
|
|
43640
43693
|
},
|
|
43641
43694
|
"linux-arm64": {
|
|
43642
43695
|
asset: "aarch64-linux",
|
|
43643
43696
|
upstreamSha256: "c58562417836c5d0493d89bdefc434933bdc097db641b483df86bcfa557a107f",
|
|
43644
|
-
sha256: "
|
|
43697
|
+
sha256: "7dedfc9f5cb32e75a28831f3b5aa053fd3e0bdd74f73dc4d1b1588947236daef"
|
|
43645
43698
|
},
|
|
43646
43699
|
"darwin-arm64": {
|
|
43647
43700
|
asset: "arm64-macos",
|
|
43648
43701
|
upstreamSha256: "98aad827847af7ef990ed7098d885725c8e5b5aae75073403635617ae4e259aa",
|
|
43649
|
-
sha256: "
|
|
43702
|
+
sha256: "0b56e0a06b6a873877871537a120fd94e2121e67f4bce5f8b5252c47b615854a"
|
|
43650
43703
|
}
|
|
43651
43704
|
}
|
|
43652
43705
|
};
|
|
@@ -43675,6 +43728,45 @@ var init_wasm_features = __esm({
|
|
|
43675
43728
|
});
|
|
43676
43729
|
|
|
43677
43730
|
// src/wasm-optimize.ts
|
|
43731
|
+
function readWasmMemoryFromFile(file) {
|
|
43732
|
+
const fd = (0, import_node_fs60.openSync)(file, "r");
|
|
43733
|
+
try {
|
|
43734
|
+
const total = (0, import_node_fs60.fstatSync)(fd).size;
|
|
43735
|
+
const header = Buffer.allocUnsafe(8);
|
|
43736
|
+
if (total < 8 || (0, import_node_fs60.readSync)(fd, header, 0, 8, 0) < 8) return void 0;
|
|
43737
|
+
let offset = 8;
|
|
43738
|
+
const probe = Buffer.allocUnsafe(16);
|
|
43739
|
+
let prefixEnd = 8;
|
|
43740
|
+
while (offset < total) {
|
|
43741
|
+
const read = (0, import_node_fs60.readSync)(fd, probe, 0, Math.min(16, total - offset), offset);
|
|
43742
|
+
if (read < 2) break;
|
|
43743
|
+
const id = probe[0];
|
|
43744
|
+
let size2 = 0;
|
|
43745
|
+
let shift = 0;
|
|
43746
|
+
let at = 1;
|
|
43747
|
+
for (; ; ) {
|
|
43748
|
+
const byte = probe[at++];
|
|
43749
|
+
size2 += (byte & 127) * 2 ** shift;
|
|
43750
|
+
if (!(byte & 128)) break;
|
|
43751
|
+
shift += 7;
|
|
43752
|
+
}
|
|
43753
|
+
const next = offset + at + size2;
|
|
43754
|
+
if (id === 2 || id === 5) prefixEnd = next;
|
|
43755
|
+
if (id > 5) break;
|
|
43756
|
+
offset = next;
|
|
43757
|
+
}
|
|
43758
|
+
const prefix = Buffer.allocUnsafe(prefixEnd);
|
|
43759
|
+
let filled = 0;
|
|
43760
|
+
while (filled < prefixEnd) {
|
|
43761
|
+
const n = (0, import_node_fs60.readSync)(fd, prefix, filled, prefixEnd - filled, filled);
|
|
43762
|
+
if (n <= 0) break;
|
|
43763
|
+
filled += n;
|
|
43764
|
+
}
|
|
43765
|
+
return readWasmMemory(prefix.subarray(0, filled));
|
|
43766
|
+
} finally {
|
|
43767
|
+
(0, import_node_fs60.closeSync)(fd);
|
|
43768
|
+
}
|
|
43769
|
+
}
|
|
43678
43770
|
async function runWasmOpt(file, output, optimize, skipPasses, binary2, sdkTableEnd, wideExports) {
|
|
43679
43771
|
const admittedCores = windowAdmission()?.cores ?? Number(process.env.TM_EXEC_CPU_CORES);
|
|
43680
43772
|
const requestedCores = Number(process.env.BINARYEN_CORES);
|
|
@@ -43691,25 +43783,75 @@ async function runWasmOpt(file, output, optimize, skipPasses, binary2, sdkTableE
|
|
|
43691
43783
|
return;
|
|
43692
43784
|
}
|
|
43693
43785
|
const optimizeSize = optimize === true || optimize === "app-module";
|
|
43694
|
-
const optimizeBeforeGuard = optimize === true;
|
|
43695
43786
|
const relink = optimize === "relink";
|
|
43696
|
-
const
|
|
43697
|
-
const
|
|
43698
|
-
let input = (0, import_node_fs60.readFileSync)(file);
|
|
43699
|
-
const memory = readWasmMemory(input);
|
|
43700
|
-
const checked = `${output}.stack-checked`;
|
|
43787
|
+
const keepNames = !optimizeSize && !relink || KEEP_WASM_NAMES;
|
|
43788
|
+
const memory = readWasmMemoryFromFile(file);
|
|
43701
43789
|
if (memory?.shared && memory.maximumPages !== 65536)
|
|
43702
43790
|
throw new Error("threaded native memory must declare a 65536-page maximum");
|
|
43703
|
-
if (memory?.shared
|
|
43704
|
-
|
|
43705
|
-
|
|
43706
|
-
|
|
43707
|
-
|
|
43708
|
-
|
|
43709
|
-
|
|
43710
|
-
"
|
|
43791
|
+
if (memory?.shared) {
|
|
43792
|
+
const wideExportsFile = wideExports.size ? `${output}.wide-exports` : void 0;
|
|
43793
|
+
const tableTool = (0, import_node_path60.join)((0, import_node_path60.dirname)(binary2), "wasm-table-guard");
|
|
43794
|
+
try {
|
|
43795
|
+
if (wideExportsFile)
|
|
43796
|
+
(0, import_node_fs60.writeFileSync)(wideExportsFile, [...wideExports].join("\n") + "\n");
|
|
43797
|
+
const pipelineArgs = [
|
|
43798
|
+
"--pipeline",
|
|
43799
|
+
"--in",
|
|
43800
|
+
file,
|
|
43801
|
+
"--out",
|
|
43802
|
+
output,
|
|
43803
|
+
"--narrow",
|
|
43804
|
+
...wideExportsFile ? ["--wide-exports-file", wideExportsFile] : [],
|
|
43805
|
+
"--lower",
|
|
43806
|
+
"--shared",
|
|
43807
|
+
...keepNames ? ["--debug"] : [],
|
|
43808
|
+
...sdkTableEnd !== void 0 ? ["--slots-range", "1", String(sdkTableEnd), "--adapt"] : [],
|
|
43809
|
+
...optimizeSize ? ["--optimize", "oz"] : relink ? ["--optimize", "relink"] : [],
|
|
43810
|
+
...skipPasses.flatMap((pass) => ["--skip-pass", pass])
|
|
43811
|
+
];
|
|
43812
|
+
const { stdout } = await runBinaryen(tableTool, pipelineArgs, { env: environment });
|
|
43813
|
+
const metadata = JSON.parse(stdout);
|
|
43814
|
+
if (typeof metadata !== "object" || metadata === null || !("tableMinimum" in metadata) || typeof metadata.tableMinimum !== "number" || !Number.isSafeInteger(metadata.tableMinimum) || metadata.tableMinimum < 0)
|
|
43815
|
+
throw new Error("native table tool returned an invalid table minimum");
|
|
43816
|
+
const sectionName = new TextEncoder().encode(NATIVE_IMAGE_SECTION);
|
|
43817
|
+
const layout2 = new TextEncoder().encode(
|
|
43818
|
+
JSON.stringify({
|
|
43819
|
+
initialPages: memory.initialPages,
|
|
43820
|
+
tableMinimum: metadata.tableMinimum
|
|
43821
|
+
})
|
|
43711
43822
|
);
|
|
43823
|
+
const encode2 = (value) => {
|
|
43824
|
+
const bytes2 = [];
|
|
43825
|
+
do {
|
|
43826
|
+
const byte = value & 127;
|
|
43827
|
+
value >>>= 7;
|
|
43828
|
+
bytes2.push(byte | (value ? 128 : 0));
|
|
43829
|
+
} while (value);
|
|
43830
|
+
return bytes2;
|
|
43831
|
+
};
|
|
43832
|
+
const body = new Uint8Array([
|
|
43833
|
+
...encode2(sectionName.length),
|
|
43834
|
+
...sectionName,
|
|
43835
|
+
...layout2
|
|
43836
|
+
]);
|
|
43837
|
+
const bytes = (0, import_node_fs60.readFileSync)(output);
|
|
43838
|
+
(0, import_node_fs60.writeFileSync)(
|
|
43839
|
+
output,
|
|
43840
|
+
Buffer.concat([
|
|
43841
|
+
sdkTableEnd === void 0 ? withWasmTableMinimum(
|
|
43842
|
+
bytes,
|
|
43843
|
+
metadata.tableMinimum + NATIVE_TABLE_RESERVE_SLOTS
|
|
43844
|
+
) : bytes,
|
|
43845
|
+
Buffer.from([0, ...encode2(body.length), ...body])
|
|
43846
|
+
])
|
|
43847
|
+
);
|
|
43848
|
+
} finally {
|
|
43849
|
+
if (wideExportsFile) (0, import_node_fs60.rmSync)(wideExportsFile, { force: true });
|
|
43850
|
+
}
|
|
43851
|
+
return;
|
|
43712
43852
|
}
|
|
43853
|
+
const outputNames = keepNames ? ["-g"] : [];
|
|
43854
|
+
const input = (0, import_node_fs60.readFileSync)(file);
|
|
43713
43855
|
const narrowed = narrowWasmBoundary(input, wideExports);
|
|
43714
43856
|
const merged = `${output}.narrowed`;
|
|
43715
43857
|
if (narrowed) {
|
|
@@ -43721,7 +43863,7 @@ async function runWasmOpt(file, output, optimize, skipPasses, binary2, sdkTableE
|
|
|
43721
43863
|
(0, import_node_path60.join)((0, import_node_path60.dirname)(binary2), "wasm-merge"),
|
|
43722
43864
|
[
|
|
43723
43865
|
...features,
|
|
43724
|
-
...
|
|
43866
|
+
...outputNames,
|
|
43725
43867
|
guest,
|
|
43726
43868
|
NARROW_MERGE_NAMES.guest,
|
|
43727
43869
|
thunks,
|
|
@@ -43735,118 +43877,25 @@ async function runWasmOpt(file, output, optimize, skipPasses, binary2, sdkTableE
|
|
|
43735
43877
|
(0, import_node_fs60.rmSync)(guest);
|
|
43736
43878
|
(0, import_node_fs60.rmSync)(thunks);
|
|
43737
43879
|
}
|
|
43738
|
-
const
|
|
43739
|
-
const compiled = narrowed ? merged : memory?.shared && optimizeBeforeGuard ? checked : file;
|
|
43880
|
+
const compiled = narrowed ? merged : file;
|
|
43740
43881
|
const skip = skipPasses.flatMap((pass) => ["--skip-pass", pass]);
|
|
43741
43882
|
try {
|
|
43742
|
-
|
|
43743
|
-
|
|
43744
|
-
|
|
43745
|
-
|
|
43746
|
-
|
|
43747
|
-
|
|
43748
|
-
|
|
43749
|
-
|
|
43750
|
-
|
|
43751
|
-
|
|
43752
|
-
|
|
43753
|
-
|
|
43754
|
-
|
|
43755
|
-
|
|
43756
|
-
);
|
|
43757
|
-
if (memory?.shared) {
|
|
43758
|
-
const guarded = `${output}.table.wasm`;
|
|
43759
|
-
const sdkGuarded = `${output}.sdk-table.wasm`;
|
|
43760
|
-
const sdkSlots = `${output}.sdk-table-slots`;
|
|
43761
|
-
const tableTool = (0, import_node_path60.join)((0, import_node_path60.dirname)(binary2), "wasm-table-guard");
|
|
43762
|
-
try {
|
|
43763
|
-
const { stdout } = await runBinaryen(
|
|
43764
|
-
tableTool,
|
|
43765
|
-
[
|
|
43766
|
-
optimizeBeforeGuard ? lowered : compiled,
|
|
43767
|
-
guarded,
|
|
43768
|
-
names.length ? "1" : "0",
|
|
43769
|
-
...optimizeBeforeGuard ? [] : ["lower"]
|
|
43770
|
-
],
|
|
43771
|
-
{ env: environment }
|
|
43772
|
-
);
|
|
43773
|
-
const metadata = JSON.parse(stdout);
|
|
43774
|
-
if (typeof metadata !== "object" || metadata === null || !("tableMinimum" in metadata) || typeof metadata.tableMinimum !== "number" || !Number.isSafeInteger(metadata.tableMinimum) || metadata.tableMinimum < 0)
|
|
43775
|
-
throw new Error("native table tool returned an invalid table minimum");
|
|
43776
|
-
if (sdkTableEnd !== void 0) {
|
|
43777
|
-
(0, import_node_fs60.writeFileSync)(
|
|
43778
|
-
sdkSlots,
|
|
43779
|
-
Array.from({ length: sdkTableEnd - 1 }, (_, index) => index + 1).join("\n")
|
|
43780
|
-
);
|
|
43781
|
-
await runBinaryen(
|
|
43782
|
-
tableTool,
|
|
43783
|
-
[guarded, sdkGuarded, names.length ? "1" : "0", "0", sdkSlots, "adapt"],
|
|
43784
|
-
{ env: environment }
|
|
43785
|
-
);
|
|
43786
|
-
(0, import_node_fs60.renameSync)(sdkGuarded, guarded);
|
|
43787
|
-
}
|
|
43788
|
-
if (optimize)
|
|
43789
|
-
await runBinaryen(
|
|
43790
|
-
binary2,
|
|
43791
|
-
[
|
|
43792
|
-
...features,
|
|
43793
|
-
// an adapted call tests its target's type with a typed function reference.
|
|
43794
|
-
...sdkTableEnd === void 0 ? [] : ["--enable-gc"],
|
|
43795
|
-
...optimizeSize ? ["-Oz"] : RELINK_PASSES,
|
|
43796
|
-
...outputNames,
|
|
43797
|
-
...skip,
|
|
43798
|
-
guarded,
|
|
43799
|
-
"-o",
|
|
43800
|
-
output
|
|
43801
|
-
],
|
|
43802
|
-
{ env: environment }
|
|
43803
|
-
);
|
|
43804
|
-
const sectionName = new TextEncoder().encode(NATIVE_IMAGE_SECTION);
|
|
43805
|
-
const layout2 = new TextEncoder().encode(
|
|
43806
|
-
JSON.stringify({
|
|
43807
|
-
initialPages: memory.initialPages,
|
|
43808
|
-
tableMinimum: metadata.tableMinimum
|
|
43809
|
-
})
|
|
43810
|
-
);
|
|
43811
|
-
const encode2 = (value) => {
|
|
43812
|
-
const bytes2 = [];
|
|
43813
|
-
do {
|
|
43814
|
-
const byte = value & 127;
|
|
43815
|
-
value >>>= 7;
|
|
43816
|
-
bytes2.push(byte | (value ? 128 : 0));
|
|
43817
|
-
} while (value);
|
|
43818
|
-
return bytes2;
|
|
43819
|
-
};
|
|
43820
|
-
const body = new Uint8Array([
|
|
43821
|
-
...encode2(sectionName.length),
|
|
43822
|
-
...sectionName,
|
|
43823
|
-
...layout2
|
|
43824
|
-
]);
|
|
43825
|
-
const image = optimize ? output : guarded;
|
|
43826
|
-
const bytes = (0, import_node_fs60.readFileSync)(image);
|
|
43827
|
-
(0, import_node_fs60.writeFileSync)(
|
|
43828
|
-
image,
|
|
43829
|
-
Buffer.concat([
|
|
43830
|
-
sdkTableEnd === void 0 ? withWasmTableMinimum(
|
|
43831
|
-
bytes,
|
|
43832
|
-
metadata.tableMinimum + NATIVE_TABLE_RESERVE_SLOTS
|
|
43833
|
-
) : bytes,
|
|
43834
|
-
Buffer.from([0, ...encode2(body.length), ...body])
|
|
43835
|
-
])
|
|
43836
|
-
);
|
|
43837
|
-
if (!optimize) (0, import_node_fs60.renameSync)(guarded, output);
|
|
43838
|
-
} finally {
|
|
43839
|
-
(0, import_node_fs60.rmSync)(guarded, { force: true });
|
|
43840
|
-
(0, import_node_fs60.rmSync)(sdkGuarded, { force: true });
|
|
43841
|
-
(0, import_node_fs60.rmSync)(sdkSlots, { force: true });
|
|
43842
|
-
}
|
|
43843
|
-
}
|
|
43883
|
+
await runBinaryen(
|
|
43884
|
+
binary2,
|
|
43885
|
+
[
|
|
43886
|
+
...LOWERING,
|
|
43887
|
+
...optimizeSize ? ["-Oz"] : relink ? RELINK_PASSES : [],
|
|
43888
|
+
...outputNames,
|
|
43889
|
+
...skip,
|
|
43890
|
+
...features,
|
|
43891
|
+
compiled,
|
|
43892
|
+
"-o",
|
|
43893
|
+
output
|
|
43894
|
+
],
|
|
43895
|
+
{ env: environment, maxBuffer: Infinity }
|
|
43896
|
+
);
|
|
43844
43897
|
} finally {
|
|
43845
43898
|
if (narrowed) (0, import_node_fs60.rmSync)(merged, { force: true });
|
|
43846
|
-
if (memory?.shared) {
|
|
43847
|
-
(0, import_node_fs60.rmSync)(checked, { force: true });
|
|
43848
|
-
(0, import_node_fs60.rmSync)(lowered, { force: true });
|
|
43849
|
-
}
|
|
43850
43899
|
}
|
|
43851
43900
|
}
|
|
43852
43901
|
async function installWasmOpt() {
|
|
@@ -48993,9 +49042,11 @@ async function linkSwiftSdkImage(moduleRoot, key2, directory2, work, scopedLooku
|
|
|
48993
49042
|
objects.push({ path: object9, bytes, instrumentDynamicLookups: false });
|
|
48994
49043
|
guestObjects.set(product, objects);
|
|
48995
49044
|
};
|
|
48996
|
-
const classifyFile = (file) => {
|
|
49045
|
+
const classifyFile = (file, collectAutolink = false) => {
|
|
48997
49046
|
const bytes = (0, import_node_fs70.readFileSync)(file);
|
|
48998
49047
|
if (!file.endsWith(".a")) {
|
|
49048
|
+
if (collectAutolink)
|
|
49049
|
+
for (const library of autolinkLibraries(bytes)) libraries.add(library);
|
|
48999
49050
|
const scoped = lookups2?.rewrite(file, bytes) ?? bytes;
|
|
49000
49051
|
return addObject(file, scoped, file);
|
|
49001
49052
|
}
|
|
@@ -49003,6 +49054,8 @@ async function linkSwiftSdkImage(moduleRoot, key2, directory2, work, scopedLooku
|
|
|
49003
49054
|
(0, import_node_fs70.mkdirSync)(import_node_path70.default.join(members2, archive));
|
|
49004
49055
|
const ordinals = /* @__PURE__ */ new Map();
|
|
49005
49056
|
readArMembers(bytes).forEach((member, index) => {
|
|
49057
|
+
if (collectAutolink)
|
|
49058
|
+
for (const library of autolinkLibraries(member.bytes)) libraries.add(library);
|
|
49006
49059
|
const object9 = import_node_path70.default.join(members2, archive, `${index}-${import_node_path70.default.basename(member.name)}`);
|
|
49007
49060
|
const ordinal = (ordinals.get(member.name) ?? 0) + 1;
|
|
49008
49061
|
ordinals.set(member.name, ordinal);
|
|
@@ -49017,9 +49070,7 @@ async function linkSwiftSdkImage(moduleRoot, key2, directory2, work, scopedLooku
|
|
|
49017
49070
|
});
|
|
49018
49071
|
};
|
|
49019
49072
|
for (const object9 of [...link.objects, ...link.providers]) {
|
|
49020
|
-
classifyFile(object9);
|
|
49021
|
-
for (const bytes of objectMembers(object9))
|
|
49022
|
-
for (const library of autolinkLibraries(bytes)) libraries.add(library);
|
|
49073
|
+
classifyFile(object9, true);
|
|
49023
49074
|
}
|
|
49024
49075
|
for (const library of libraries) {
|
|
49025
49076
|
if (unpacked.has(library.slice(2))) continue;
|
|
@@ -49032,6 +49083,7 @@ async function linkSwiftSdkImage(moduleRoot, key2, directory2, work, scopedLooku
|
|
|
49032
49083
|
const hostExports = sdkHostExports(appRoot);
|
|
49033
49084
|
const guestMap = /* @__PURE__ */ new Map();
|
|
49034
49085
|
const guestMetadataNames = {};
|
|
49086
|
+
const compiles = [];
|
|
49035
49087
|
if (lookups2) {
|
|
49036
49088
|
const ledger = lookups2.link(guestObjects, [
|
|
49037
49089
|
...hostExports,
|
|
@@ -49067,33 +49119,38 @@ async function linkSwiftSdkImage(moduleRoot, key2, directory2, work, scopedLooku
|
|
|
49067
49119
|
const scopeLedger = import_node_path70.default.join(work, "guest-ledger.ll");
|
|
49068
49120
|
const scopeObject = import_node_path70.default.join(work, "guest-ledger.o");
|
|
49069
49121
|
(0, import_node_fs70.writeFileSync)(scopeLedger, ledger.llvmIR);
|
|
49070
|
-
|
|
49071
|
-
|
|
49072
|
-
|
|
49073
|
-
|
|
49074
|
-
|
|
49075
|
-
|
|
49076
|
-
|
|
49077
|
-
|
|
49078
|
-
|
|
49122
|
+
compiles.push(
|
|
49123
|
+
run4(import_node_path70.default.join(toolchain.toolchainBin, "clang"), [
|
|
49124
|
+
`--target=${SWIFT_WASM_TRIPLE}`,
|
|
49125
|
+
"-matomics",
|
|
49126
|
+
"-mbulk-memory",
|
|
49127
|
+
"-c",
|
|
49128
|
+
scopeLedger,
|
|
49129
|
+
"-o",
|
|
49130
|
+
scopeObject
|
|
49131
|
+
])
|
|
49132
|
+
);
|
|
49079
49133
|
eager.push(scopeObject);
|
|
49080
49134
|
}
|
|
49081
49135
|
(0, import_node_fs70.writeFileSync)(
|
|
49082
49136
|
import_node_path70.default.join(work, "image-tables.c"),
|
|
49083
49137
|
IMAGE_TABLES + (guestLookups?.source ?? "")
|
|
49084
49138
|
);
|
|
49085
|
-
|
|
49086
|
-
|
|
49087
|
-
|
|
49088
|
-
|
|
49089
|
-
|
|
49090
|
-
|
|
49091
|
-
|
|
49092
|
-
|
|
49093
|
-
|
|
49094
|
-
|
|
49095
|
-
|
|
49096
|
-
|
|
49139
|
+
compiles.push(
|
|
49140
|
+
run4(import_node_path70.default.join(toolchain.toolchainBin, "clang"), [
|
|
49141
|
+
`--target=${SWIFT_WASM_TRIPLE}`,
|
|
49142
|
+
"-O2",
|
|
49143
|
+
"-matomics",
|
|
49144
|
+
"-mbulk-memory",
|
|
49145
|
+
"-ffreestanding",
|
|
49146
|
+
...lookups2 ? ["-DPEACH_SDK_GUEST_LINK"] : [],
|
|
49147
|
+
"-c",
|
|
49148
|
+
import_node_path70.default.join(work, "image-tables.c"),
|
|
49149
|
+
"-o",
|
|
49150
|
+
tables
|
|
49151
|
+
])
|
|
49152
|
+
);
|
|
49153
|
+
await Promise.all(compiles);
|
|
49097
49154
|
const quote3 = (value) => JSON.stringify(value);
|
|
49098
49155
|
(0, import_node_fs70.writeFileSync)(
|
|
49099
49156
|
import_node_path70.default.join(work, "exports.rsp"),
|
|
@@ -49152,23 +49209,31 @@ async function linkSwiftSdkImage(moduleRoot, key2, directory2, work, scopedLooku
|
|
|
49152
49209
|
if (mask === void 0) throw new Error("sdk image lacks its constructor mask");
|
|
49153
49210
|
const code = import_node_path70.default.join(work, "code.wasm");
|
|
49154
49211
|
(0, import_node_fs70.writeFileSync)(code, codeOnlySdkImage(finished2, mask));
|
|
49155
|
-
|
|
49212
|
+
const lowerPromise = lowerWasm(code, import_node_path70.default.join(work, IMAGE_FILE), {
|
|
49156
49213
|
optimize: true,
|
|
49157
49214
|
skipPasses: lookups2 ? ["duplicate-function-elimination"] : void 0
|
|
49158
49215
|
});
|
|
49216
|
+
await new Promise((resolve11) => setImmediate(resolve11));
|
|
49217
|
+
try {
|
|
49218
|
+
writeSdkManifest(
|
|
49219
|
+
work,
|
|
49220
|
+
linkMap,
|
|
49221
|
+
linkedBytes,
|
|
49222
|
+
finished2,
|
|
49223
|
+
(0, import_node_fs70.readFileSync)(withRelocs),
|
|
49224
|
+
functionSlots,
|
|
49225
|
+
lookups2 && { inputs: guestMap, metadataNames: guestMetadataNames }
|
|
49226
|
+
);
|
|
49227
|
+
} catch (error) {
|
|
49228
|
+
await lowerPromise.catch(() => {
|
|
49229
|
+
});
|
|
49230
|
+
throw error;
|
|
49231
|
+
}
|
|
49232
|
+
await lowerPromise;
|
|
49159
49233
|
const image = (0, import_node_fs70.readFileSync)(import_node_path70.default.join(work, IMAGE_FILE));
|
|
49160
49234
|
sdkInterface.layout.tableEnd += unslottedFunctions(image);
|
|
49161
49235
|
if (sdkInterface.layout.tableEnd > SWIFT_SDK_APP_TABLE_BASE)
|
|
49162
49236
|
throw new Error("Swift SDK image exceeds its reserved function table range");
|
|
49163
|
-
writeSdkManifest(
|
|
49164
|
-
work,
|
|
49165
|
-
linkMap,
|
|
49166
|
-
linkedBytes,
|
|
49167
|
-
finished2,
|
|
49168
|
-
(0, import_node_fs70.readFileSync)(withRelocs),
|
|
49169
|
-
functionSlots,
|
|
49170
|
-
lookups2 && { inputs: guestMap, metadataNames: guestMetadataNames }
|
|
49171
|
-
);
|
|
49172
49237
|
(0, import_node_fs70.writeFileSync)(import_node_path70.default.join(work, INTERFACE_FILE), JSON.stringify(sdkInterface));
|
|
49173
49238
|
(0, import_node_fs70.writeFileSync)(
|
|
49174
49239
|
import_node_path70.default.join(work, IMAGE_DIGEST),
|
|
@@ -49237,14 +49302,11 @@ function sdkLinkInputs(appRoot) {
|
|
|
49237
49302
|
if (!crt) throw new Error("the sdk image link found no reactor startup object");
|
|
49238
49303
|
return { flags, libraries, objects: [crt, ...objects], providers };
|
|
49239
49304
|
}
|
|
49240
|
-
function objectMembers(file) {
|
|
49241
|
-
const bytes = (0, import_node_fs70.readFileSync)(file);
|
|
49242
|
-
return file.endsWith(".a") ? readArMembers(bytes).map((member) => member.bytes) : [bytes];
|
|
49243
|
-
}
|
|
49244
49305
|
function autolinkLibraries(bytes) {
|
|
49245
49306
|
const entries2 = wasmSections(bytes).find((s) => s.name === ".swift1_autolink_entries");
|
|
49246
49307
|
if (!entries2) return [];
|
|
49247
|
-
|
|
49308
|
+
const raw2 = Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
49309
|
+
return raw2.toString("utf8", entries2.start, entries2.end).split("\0").filter((entry) => entry.startsWith("-l"));
|
|
49248
49310
|
}
|
|
49249
49311
|
function sdkHostExports(appRoot) {
|
|
49250
49312
|
const release = import_node_path70.default.join(appRoot, ".build", SWIFT_WASM_TRIPLE, "release");
|
|
@@ -49330,9 +49392,17 @@ function writeSdkManifest(work, map2, linked, finished2, withRelocs, functionSlo
|
|
|
49330
49392
|
return { starts, targets };
|
|
49331
49393
|
};
|
|
49332
49394
|
const byAddress = (edges2) => {
|
|
49333
|
-
const
|
|
49334
|
-
|
|
49335
|
-
|
|
49395
|
+
const count = edges2.length >>> 1;
|
|
49396
|
+
const order = new Uint32Array(count);
|
|
49397
|
+
for (let i = 0; i < count; i++) order[i] = i;
|
|
49398
|
+
order.sort((a, b) => edges2[a * 2] - edges2[b * 2]);
|
|
49399
|
+
const sorted2 = new Uint32Array(edges2.length);
|
|
49400
|
+
for (let i = 0; i < count; i++) {
|
|
49401
|
+
const src = order[i] * 2;
|
|
49402
|
+
sorted2[i * 2] = edges2[src];
|
|
49403
|
+
sorted2[i * 2 + 1] = edges2[src + 1];
|
|
49404
|
+
}
|
|
49405
|
+
return sorted2;
|
|
49336
49406
|
};
|
|
49337
49407
|
const functionData = flatten2(edges.code);
|
|
49338
49408
|
const functionCalls = flatten2(edges.calls);
|
|
@@ -49754,12 +49824,22 @@ async function buildSwiftAppModule(options2) {
|
|
|
49754
49824
|
work,
|
|
49755
49825
|
readInput
|
|
49756
49826
|
});
|
|
49757
|
-
|
|
49758
|
-
|
|
49759
|
-
|
|
49760
|
-
|
|
49761
|
-
|
|
49762
|
-
|
|
49827
|
+
const lowerPromise = link.lower();
|
|
49828
|
+
await new Promise((resolve11) => setImmediate(resolve11));
|
|
49829
|
+
let usage;
|
|
49830
|
+
let binding;
|
|
49831
|
+
try {
|
|
49832
|
+
usage = readSwiftSdkUsage(
|
|
49833
|
+
project2 ? projectOutputFile(buildRoot, map2, project2) : map2,
|
|
49834
|
+
pruned
|
|
49835
|
+
);
|
|
49836
|
+
binding = createSwiftSdkBinding(link.linkage, sdk2, usage);
|
|
49837
|
+
} catch (error) {
|
|
49838
|
+
await lowerPromise.catch(() => {
|
|
49839
|
+
});
|
|
49840
|
+
throw error;
|
|
49841
|
+
}
|
|
49842
|
+
await lowerPromise;
|
|
49763
49843
|
if (!project2)
|
|
49764
49844
|
writeSwiftSdkAppLink(import_node_path71.default.join(work, "app-link.json.gz"), {
|
|
49765
49845
|
linkage: link.linkage,
|
|
@@ -51669,7 +51749,6 @@ async function compileGuestLink(options2) {
|
|
|
51669
51749
|
bindingRows.set((address - values.address) / 8, value);
|
|
51670
51750
|
} else data.push(address, size2, value);
|
|
51671
51751
|
}
|
|
51672
|
-
const binding = createSwiftSdkBinding2({ ...link.linkage, data }, sdk2, usage);
|
|
51673
51752
|
const linked = (0, import_node_fs72.readFileSync)(
|
|
51674
51753
|
project2 ? projectOutputFile(work, linkedModule, project2) : linkedModule
|
|
51675
51754
|
);
|
|
@@ -51694,7 +51773,17 @@ async function compileGuestLink(options2) {
|
|
|
51694
51773
|
);
|
|
51695
51774
|
continue;
|
|
51696
51775
|
}
|
|
51697
|
-
|
|
51776
|
+
const lowerPromise = link.lower();
|
|
51777
|
+
await new Promise((resolve11) => setImmediate(resolve11));
|
|
51778
|
+
let binding;
|
|
51779
|
+
try {
|
|
51780
|
+
binding = createSwiftSdkBinding2({ ...link.linkage, data }, sdk2, usage);
|
|
51781
|
+
} catch (error) {
|
|
51782
|
+
await lowerPromise.catch(() => {
|
|
51783
|
+
});
|
|
51784
|
+
throw error;
|
|
51785
|
+
}
|
|
51786
|
+
await lowerPromise;
|
|
51698
51787
|
const finalized = finalizeGuestProjectionStorage({
|
|
51699
51788
|
map: map3,
|
|
51700
51789
|
linked,
|
|
@@ -59418,7 +59507,7 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
|
|
|
59418
59507
|
REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
|
|
59419
59508
|
MULTI_MANIFEST_VERSION = 76;
|
|
59420
59509
|
SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
|
|
59421
|
-
compilerSourceDigest = true ? "
|
|
59510
|
+
compilerSourceDigest = true ? "834b5c28c27bc5807cbb3c4eed5c44f7de81d47db3e3a8819bea6e6635689b24" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
|
|
59422
59511
|
nativeCxxCompilerFlags = ["-fno-cxx-modules"];
|
|
59423
59512
|
MODULE_MAP_RESPONSE_FILE_RUN = 16;
|
|
59424
59513
|
cFlagArray = (flags) => JSON.stringify(withoutGlogModuleMap(flags));
|
|
@@ -114488,6 +114577,11 @@ var init_rolldown_bundle_forward = __esm({
|
|
|
114488
114577
|
});
|
|
114489
114578
|
|
|
114490
114579
|
// src/host/fetch-proxy-handler.ts
|
|
114580
|
+
function isClientResponseClosed(req, res) {
|
|
114581
|
+
if (res.destroyed || res.writableEnded || res.writableFinished) return true;
|
|
114582
|
+
if (req instanceof import_node_http22.Http2ServerRequest) return req.stream.destroyed || req.stream.closed;
|
|
114583
|
+
return req.aborted || Boolean(req.socket?.destroyed);
|
|
114584
|
+
}
|
|
114491
114585
|
function fetchProxyAgentFor(targetUrl) {
|
|
114492
114586
|
return targetUrl.protocol === "https:" ? fetchProxyHttpsAgent : fetchProxyHttpAgent;
|
|
114493
114587
|
}
|
|
@@ -114699,10 +114793,22 @@ function serveBrowserProxyRoute(req, res) {
|
|
|
114699
114793
|
return false;
|
|
114700
114794
|
}
|
|
114701
114795
|
async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
114796
|
+
let clientClosed = isClientResponseClosed(req, res);
|
|
114797
|
+
let activeUpstream;
|
|
114798
|
+
const hasClientClosed = () => clientClosed || isClientResponseClosed(req, res);
|
|
114799
|
+
if (clientClosed) return;
|
|
114800
|
+
const markClosed = () => {
|
|
114801
|
+
if (res.writableFinished) return;
|
|
114802
|
+
clientClosed = true;
|
|
114803
|
+
if (activeUpstream && !activeUpstream.destroyed) activeUpstream.destroy();
|
|
114804
|
+
};
|
|
114805
|
+
req.once("aborted", markClosed);
|
|
114806
|
+
res.once("close", markClosed);
|
|
114702
114807
|
const originalMethod = req.method || "GET";
|
|
114703
114808
|
const minimumHeader = req.headers[FETCH_PROXY_TLS_MINIMUM_HEADER];
|
|
114704
114809
|
const minimumVersion = typeof minimumHeader === "string" ? tlsMinimumVersions.get(minimumHeader) : void 0;
|
|
114705
114810
|
const proxy = async (targetUrl, method, nextBody, redirects, setCookies) => {
|
|
114811
|
+
if (hasClientClosed()) return;
|
|
114706
114812
|
const transport = targetUrl.protocol === "https:" ? import_https2.default : import_http3.default;
|
|
114707
114813
|
const targetHeaders = route.requestHeaders(targetUrl);
|
|
114708
114814
|
if (targetUrl.origin !== upstreamUrl.origin) {
|
|
@@ -114724,16 +114830,16 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
114724
114830
|
body: nextBody
|
|
114725
114831
|
});
|
|
114726
114832
|
if (!allowed) throw new NetworkPolicyDeniedError(`${method} ${targetUrl.origin}`);
|
|
114833
|
+
if (hasClientClosed()) return;
|
|
114727
114834
|
const port = projectLoopbackPort(
|
|
114728
114835
|
targetUrl.hostname,
|
|
114729
114836
|
Number(targetUrl.port || (targetUrl.protocol === "https:" ? 443 : 80))
|
|
114730
114837
|
);
|
|
114731
|
-
let clientAborted = false;
|
|
114732
|
-
const markAborted = () => {
|
|
114733
|
-
clientAborted = true;
|
|
114734
|
-
};
|
|
114735
|
-
req.once("aborted", markAborted);
|
|
114736
114838
|
const send3 = () => new Promise((resolve11, reject) => {
|
|
114839
|
+
if (hasClientClosed()) {
|
|
114840
|
+
reject(new Error("client closed before upstream request"));
|
|
114841
|
+
return;
|
|
114842
|
+
}
|
|
114737
114843
|
let responded = false;
|
|
114738
114844
|
const proxyReq = transport.request(
|
|
114739
114845
|
{
|
|
@@ -114763,22 +114869,33 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
114763
114869
|
resolve11(upstream);
|
|
114764
114870
|
}
|
|
114765
114871
|
);
|
|
114766
|
-
const abort = () =>
|
|
114872
|
+
const abort = () => {
|
|
114873
|
+
if (!res.writableFinished) proxyReq.destroy();
|
|
114874
|
+
};
|
|
114767
114875
|
req.once("aborted", abort);
|
|
114768
|
-
|
|
114876
|
+
res.once("close", abort);
|
|
114877
|
+
proxyReq.once("close", () => {
|
|
114878
|
+
req.off("aborted", abort);
|
|
114879
|
+
res.off("close", abort);
|
|
114880
|
+
});
|
|
114769
114881
|
let failed = false;
|
|
114770
114882
|
proxyReq.on("error", (err) => {
|
|
114771
114883
|
if (failed) return;
|
|
114772
114884
|
failed = true;
|
|
114773
|
-
if (proxyReq.reusedSocket && !responded && !
|
|
114885
|
+
if (proxyReq.reusedSocket && !responded && !hasClientClosed() && err.code === "ECONNRESET")
|
|
114774
114886
|
resolve11(send3());
|
|
114775
114887
|
else reject(err);
|
|
114776
114888
|
});
|
|
114777
114889
|
if (nextBody === void 0) proxyReq.end();
|
|
114778
114890
|
else proxyReq.end(nextBody);
|
|
114779
114891
|
});
|
|
114780
|
-
const proxyRes = await send3()
|
|
114892
|
+
const proxyRes = await send3();
|
|
114893
|
+
activeUpstream = proxyRes;
|
|
114781
114894
|
upstreamAnswered = true;
|
|
114895
|
+
if (hasClientClosed()) {
|
|
114896
|
+
proxyRes.destroy();
|
|
114897
|
+
return;
|
|
114898
|
+
}
|
|
114782
114899
|
const status = proxyRes.statusCode ?? 502;
|
|
114783
114900
|
const location = proxyRes.headers.location;
|
|
114784
114901
|
const hopCookies = [...setCookies, ...proxyRes.headers["set-cookie"] ?? []];
|
|
@@ -114794,6 +114911,10 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
114794
114911
|
if (minimumVersion && targetUrl.protocol === "https:")
|
|
114795
114912
|
res.setHeader(FETCH_PROXY_TLS_ENFORCED_HEADER, minimumHeader);
|
|
114796
114913
|
await route.respond(proxyRes, hopCookies);
|
|
114914
|
+
if (hasClientClosed()) {
|
|
114915
|
+
proxyRes.destroy();
|
|
114916
|
+
return;
|
|
114917
|
+
}
|
|
114797
114918
|
if (isNativeCookieRedirect(hop)) res.removeHeader("location");
|
|
114798
114919
|
res.statusCode = isNativeCookieRedirect(hop) ? 200 : status;
|
|
114799
114920
|
await (0, import_promises17.pipeline)(proxyRes, res);
|
|
@@ -114808,6 +114929,7 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
114808
114929
|
const redirectUrl = resolveRedirectUrl(location, targetUrl);
|
|
114809
114930
|
proxyRes.resume();
|
|
114810
114931
|
await (0, import_promises17.finished)(proxyRes);
|
|
114932
|
+
if (hasClientClosed()) return;
|
|
114811
114933
|
await proxy(
|
|
114812
114934
|
redirectUrl,
|
|
114813
114935
|
switchToGet ? "GET" : method,
|
|
@@ -114819,9 +114941,17 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
114819
114941
|
}
|
|
114820
114942
|
if (redirects > 0) res.setHeader(FETCH_PROXY_RESPONSE_URL_HEADER, targetUrl.href);
|
|
114821
114943
|
await route.respond(proxyRes, hopCookies);
|
|
114944
|
+
if (hasClientClosed()) {
|
|
114945
|
+
proxyRes.destroy();
|
|
114946
|
+
return;
|
|
114947
|
+
}
|
|
114822
114948
|
res.statusCode = status;
|
|
114823
114949
|
if (isBundleProxyRequestUrl(req.url) && method === "GET" && status === 200 && targetUrl.pathname.endsWith(".bundle")) {
|
|
114824
114950
|
const { forwardRolldownBundleResponse: forwardRolldownBundleResponse2 } = await Promise.resolve().then(() => (init_rolldown_bundle_forward(), rolldown_bundle_forward_exports));
|
|
114951
|
+
if (hasClientClosed()) {
|
|
114952
|
+
proxyRes.destroy();
|
|
114953
|
+
return;
|
|
114954
|
+
}
|
|
114825
114955
|
await forwardRolldownBundleResponse2(proxyRes, res);
|
|
114826
114956
|
return;
|
|
114827
114957
|
}
|
|
@@ -114843,12 +114973,17 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
114843
114973
|
}
|
|
114844
114974
|
await proxy(upstreamUrl, originalMethod, body, 0, []);
|
|
114845
114975
|
} catch (err) {
|
|
114976
|
+
if (hasClientClosed()) {
|
|
114977
|
+
if (activeUpstream && !activeUpstream.destroyed) activeUpstream.destroy();
|
|
114978
|
+
return;
|
|
114979
|
+
}
|
|
114846
114980
|
const norm = normalizeHostname(upstreamUrl.hostname);
|
|
114847
114981
|
if (upstreamAnswered && !res.headersSent)
|
|
114848
114982
|
console.error(`[peach] fetch proxy could not forward ${upstreamUrl.href}:`, err);
|
|
114849
114983
|
if (!res.headersSent && isLoopbackHost(norm) && err?.code === "ECONNREFUSED") {
|
|
114850
114984
|
const altHosts = norm === "::1" ? ["127.0.0.1"] : norm === "127.0.0.1" ? ["[::1]"] : ["[::1]", "127.0.0.1"];
|
|
114851
114985
|
for (const altHost of altHosts) {
|
|
114986
|
+
if (hasClientClosed()) return;
|
|
114852
114987
|
try {
|
|
114853
114988
|
const altUrl = new URL(upstreamUrl.href);
|
|
114854
114989
|
altUrl.hostname = altHost;
|
|
@@ -114858,6 +114993,7 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
114858
114993
|
}
|
|
114859
114994
|
}
|
|
114860
114995
|
}
|
|
114996
|
+
if (hasClientClosed()) return;
|
|
114861
114997
|
if (!res.headersSent && reportFailure) {
|
|
114862
114998
|
const code = err?.code;
|
|
114863
114999
|
res.statusCode = 502;
|
|
@@ -114878,6 +115014,9 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
114878
115014
|
if (req instanceof import_node_http22.Http2ServerRequest)
|
|
114879
115015
|
req.stream.destroy(new Error("fetch proxy upstream failed", { cause: err }));
|
|
114880
115016
|
else req.socket.destroy();
|
|
115017
|
+
} finally {
|
|
115018
|
+
req.off("aborted", markClosed);
|
|
115019
|
+
res.off("close", markClosed);
|
|
114881
115020
|
}
|
|
114882
115021
|
}
|
|
114883
115022
|
var import_http3, import_https2, import_node_http22, import_promises17, fetchProxyHttpAgent, fetchProxyHttpsAgent, tlsMinimumVersions, tlsMinimumAgents, FETCH_PROXY_CORS_HEADERS, APP_API_HEADER_REWRITES;
|
|
@@ -115389,6 +115528,7 @@ function swiftGuestControls(one, names, linkedGroups) {
|
|
|
115389
115528
|
return {
|
|
115390
115529
|
source: [
|
|
115391
115530
|
"import UIKit",
|
|
115531
|
+
...names.includes("OneNativePicker") ? ["extension OneNativePickerView: OneGuestIncrementalContainer {}"] : [],
|
|
115392
115532
|
"let guestControls: [String: (UIView?, Spec, Spec?, Spec, @escaping (String, Spec) -> Void) -> UIView] = [",
|
|
115393
115533
|
...entries2,
|
|
115394
115534
|
"]",
|
|
@@ -116077,11 +116217,55 @@ private func normalizeStyle(_ raw: Spec?) -> Spec {
|
|
|
116077
116217
|
return style
|
|
116078
116218
|
}
|
|
116079
116219
|
|
|
116220
|
+
protocol OneGuestIncrementalContainer: AnyObject {
|
|
116221
|
+
func insertChild(_ child: UIView, at index: Int)
|
|
116222
|
+
func removeChild(_ child: UIView)
|
|
116223
|
+
func reset()
|
|
116224
|
+
}
|
|
116225
|
+
|
|
116226
|
+
private final class DeferredControl {
|
|
116227
|
+
private let composition = ControlComposition()
|
|
116228
|
+
private var node: Spec
|
|
116229
|
+
private lazy var realized = OneNativeDeferredRow(
|
|
116230
|
+
createView: { [weak self] in self?.render() },
|
|
116231
|
+
releaseView: { [weak self] _ in self?.composition.prune(keeping: []) }
|
|
116232
|
+
)
|
|
116233
|
+
|
|
116234
|
+
init(node: Spec, owner: ControlComposition) {
|
|
116235
|
+
self.node = node
|
|
116236
|
+
composition.emit = { [weak owner] name, fields in owner?.emit?(name, fields) }
|
|
116237
|
+
}
|
|
116238
|
+
|
|
116239
|
+
func update(_ node: Spec, content: Spec) -> OneNativeDeferredRow {
|
|
116240
|
+
self.node = node
|
|
116241
|
+
realized.configureListRowModifiers(
|
|
116242
|
+
styleModifiers(node),
|
|
116243
|
+
contentModifiers: styleModifiers(content)
|
|
116244
|
+
)
|
|
116245
|
+
if !composition.views.isEmpty { _ = render() }
|
|
116246
|
+
return realized
|
|
116247
|
+
}
|
|
116248
|
+
|
|
116249
|
+
private func styleModifiers(_ node: Spec) -> String? {
|
|
116250
|
+
let spec = node["spec"] as? Spec
|
|
116251
|
+
let style = spec?["swiftStyle"] as? Spec
|
|
116252
|
+
return style?["sdkModifiers"] as? String
|
|
116253
|
+
}
|
|
116254
|
+
|
|
116255
|
+
private func render() -> UIView {
|
|
116256
|
+
var visited = Set<String>()
|
|
116257
|
+
let view = composition.render(node, visited: &visited)
|
|
116258
|
+
composition.prune(keeping: visited)
|
|
116259
|
+
return view
|
|
116260
|
+
}
|
|
116261
|
+
}
|
|
116262
|
+
|
|
116080
116263
|
private class ControlComposition {
|
|
116081
116264
|
private static let reconciledContainers: Set<String> = [
|
|
116082
116265
|
"OneNativeLazyVStack", "OneNativeLazyHStack", "OneNativeLazyVGrid", "OneNativeLazyHGrid",
|
|
116083
116266
|
"OneNativeList", "OneNativeSection", "OneNativeForm",
|
|
116084
116267
|
]
|
|
116268
|
+
private var deferredRows: [String: DeferredControl] = [:]
|
|
116085
116269
|
var views: [String: UIView] = [:]
|
|
116086
116270
|
var specs: [String: Spec] = [:]
|
|
116087
116271
|
var children: [String: [UIView]] = [:]
|
|
@@ -116117,6 +116301,7 @@ private class ControlComposition {
|
|
|
116117
116301
|
}
|
|
116118
116302
|
let view: UIView
|
|
116119
116303
|
visited.insert(id)
|
|
116304
|
+
deferredRows.removeValue(forKey: id)
|
|
116120
116305
|
switch control {
|
|
116121
116306
|
case "OneNativeToolbar":
|
|
116122
116307
|
view = views[id] ?? OneNativeToolbarView()
|
|
@@ -116161,25 +116346,63 @@ private class ControlComposition {
|
|
|
116161
116346
|
if let container = view as? OneNativeContainerView {
|
|
116162
116347
|
container.configureSwiftStyle(style)
|
|
116163
116348
|
container.onSwiftStyleEvent = visit
|
|
116164
|
-
let
|
|
116349
|
+
let nodes = node["children"] as? [Spec] ?? []
|
|
116165
116350
|
if Self.reconciledContainers.contains(control) {
|
|
116351
|
+
let nested = nodes.map { child -> NSObject in
|
|
116352
|
+
if control == "OneNativeSection", let content = deferredContent(child) {
|
|
116353
|
+
let childID = child["id"] as! String
|
|
116354
|
+
visited.insert(childID)
|
|
116355
|
+
let deferred = deferredRows[childID] ?? DeferredControl(node: child, owner: self)
|
|
116356
|
+
deferredRows[childID] = deferred
|
|
116357
|
+
if let previous = views.removeValue(forKey: childID) {
|
|
116358
|
+
(previous as? OneNativeContainerView)?.reset()
|
|
116359
|
+
specs.removeValue(forKey: childID)
|
|
116360
|
+
children.removeValue(forKey: childID)
|
|
116361
|
+
}
|
|
116362
|
+
return deferred.update(child, content: content)
|
|
116363
|
+
}
|
|
116364
|
+
return render(child, visited: &visited)
|
|
116365
|
+
}
|
|
116166
116366
|
container.reconcileComposedChildren(nested)
|
|
116167
116367
|
} else {
|
|
116168
|
-
|
|
116169
|
-
nested,
|
|
116170
|
-
previous: children[id] ?? [],
|
|
116171
|
-
remove: container.removeChild,
|
|
116172
|
-
insert: container.insertChild
|
|
116173
|
-
)
|
|
116368
|
+
placeIncrementally(node, id: id, visited: &visited, remove: container.removeChild, insert: container.insertChild)
|
|
116174
116369
|
}
|
|
116175
|
-
|
|
116370
|
+
} else if let container = view as? OneGuestIncrementalContainer {
|
|
116371
|
+
placeIncrementally(node, id: id, visited: &visited, remove: container.removeChild, insert: container.insertChild)
|
|
116176
116372
|
}
|
|
116177
116373
|
return view
|
|
116178
116374
|
}
|
|
116179
116375
|
|
|
116376
|
+
private func deferredContent(_ node: Spec) -> Spec? {
|
|
116377
|
+
guard (node["spec"] as? Spec)?["control"] as? String == "OneNativeSwipeActions" else { return nil }
|
|
116378
|
+
let content = (node["children"] as? [Spec] ?? []).filter {
|
|
116379
|
+
($0["spec"] as? Spec)?["control"] as? String != "OneNativeSwipeActionsActions"
|
|
116380
|
+
}
|
|
116381
|
+
guard content.count == 1, (content[0]["spec"] as? Spec)?["control"] as? String == "OneNativeButton" else {
|
|
116382
|
+
return nil
|
|
116383
|
+
}
|
|
116384
|
+
return content[0]
|
|
116385
|
+
}
|
|
116386
|
+
|
|
116387
|
+
private func placeIncrementally(
|
|
116388
|
+
_ node: Spec,
|
|
116389
|
+
id: String,
|
|
116390
|
+
visited: inout Set<String>,
|
|
116391
|
+
remove: (UIView) -> Void,
|
|
116392
|
+
insert: (UIView, Int) -> Void
|
|
116393
|
+
) {
|
|
116394
|
+
let nested = (node["children"] as? [Spec] ?? []).map { render($0, visited: &visited) }
|
|
116395
|
+
reconcile(nested, previous: children[id] ?? [], remove: remove, insert: insert)
|
|
116396
|
+
children[id] = nested
|
|
116397
|
+
}
|
|
116398
|
+
|
|
116180
116399
|
func prune(keeping visited: Set<String>) {
|
|
116400
|
+
for id in deferredRows.keys where !visited.contains(id) {
|
|
116401
|
+
deferredRows.removeValue(forKey: id)
|
|
116402
|
+
}
|
|
116181
116403
|
for (id, view) in views where !visited.contains(id) {
|
|
116182
116404
|
if let container = view as? OneNativeContainerView { container.reset() }
|
|
116405
|
+
if let container = view as? OneGuestIncrementalContainer { container.reset() }
|
|
116183
116406
|
views.removeValue(forKey: id)
|
|
116184
116407
|
specs.removeValue(forKey: id)
|
|
116185
116408
|
children.removeValue(forKey: id)
|
|
@@ -116490,8 +116713,10 @@ private struct NavigationSplitViewBridge: UIViewRepresentable {
|
|
|
116490
116713
|
default:
|
|
116491
116714
|
let root = spec["root"] as! Spec
|
|
116492
116715
|
precondition((root["spec"] as? Spec)?["control"] as? String == view)
|
|
116493
|
-
|
|
116494
|
-
.frame(minWidth: 0, maxWidth: .infinity, maxHeight: .infinity)
|
|
116716
|
+
let bridge = ControlBridge(root: root, emit: emit)
|
|
116717
|
+
.frame(minWidth: 0, maxWidth: .infinity, maxHeight: .infinity)
|
|
116718
|
+
let height = (spec["height"] as? Double).map { CGFloat($0) }
|
|
116719
|
+
return AnyView(bridge.frame(height: height))
|
|
116495
116720
|
}
|
|
116496
116721
|
}
|
|
116497
116722
|
}
|
|
@@ -120927,7 +121152,7 @@ var init_nitro_superset = __esm({
|
|
|
120927
121152
|
init_nitroContract();
|
|
120928
121153
|
init_swift_standin_digest();
|
|
120929
121154
|
NITRO_SUPERSET_ENTRY_NAME = "superset";
|
|
120930
|
-
NITRO_COMPILER_DIGEST = true ? "
|
|
121155
|
+
NITRO_COMPILER_DIGEST = true ? "dc3119a2538cec9d009fc6b45b9a7c5729812bb7e7f263707bd7410c45a4719e" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
|
|
120931
121156
|
nitroSupersetLock = parseLock(nitro_superset_lock_default);
|
|
120932
121157
|
nitroSupersetKey = (inputs2) => nativeEntryKey({ ...inputs2, compiler: NITRO_COMPILER_DIGEST });
|
|
120933
121158
|
published3 = /* @__PURE__ */ new Map();
|