peachsim 0.1.2591 → 0.1.2593
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 +5684 -5254
- 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 +2 -2
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/esm-chunks/{acorn-EMX4WZ72.mjs → acorn-DLENU3SM.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-VYZ5DC3M.mjs → chunk-23D4W2EY.mjs} +1015 -703
- package/dist-lib/esm-chunks/{chunk-MC6NMYWY.mjs → chunk-2MWUVSRW.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-UIVXVMS5.mjs → chunk-2UERF2EN.mjs} +2 -2
- package/dist-lib/esm-chunks/{chunk-VRVXRZI4.mjs → chunk-4YJJKKKF.mjs} +112 -58
- package/dist-lib/esm-chunks/{chunk-AKKHSVJ4.mjs → chunk-6O2M4J2Y.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-EGKH2L6J.mjs → chunk-BMKI4WBL.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-4QHHRGO4.mjs → chunk-DLSPHUHQ.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-UYJXLDCG.mjs → chunk-E6OGMX3T.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-VF5WVB3D.mjs → chunk-GFMQ5PNX.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-JHXDM3YU.mjs → chunk-IT4CC3HU.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-J676B57D.mjs → chunk-JPNUGMLE.mjs} +5 -5
- package/dist-lib/esm-chunks/{chunk-RKQZGWX2.mjs → chunk-KWMJUJJS.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-QBMFX3J2.mjs → chunk-LK3KQ4X3.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-ZL5N6ENT.mjs → chunk-LN7ZTBNS.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-Q4NA6PUR.mjs → chunk-NIYJBFXV.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-7627LKJK.mjs → chunk-OIHSBING.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-YR6DNV76.mjs → chunk-P3A4MQHR.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-VD27WNCT.mjs → chunk-TXBZEHNH.mjs} +4 -4
- package/dist-lib/esm-chunks/{chunk-TFG4LZ5T.mjs → chunk-UM4DCXPA.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-ILWFGZWW.mjs → chunk-UZPLSN2V.mjs} +107 -6
- package/dist-lib/esm-chunks/{chunk-SOAYP72T.mjs → chunk-XFFPOSW2.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-NX23AMX4.mjs → chunk-ZT5ZXQC2.mjs} +1 -1
- package/dist-lib/esm-chunks/{metro-layout-parser-ANKZARNW.mjs → metro-layout-parser-DHGC2DVE.mjs} +3 -3
- package/dist-lib/esm-chunks/{swift-package-prebuilt-4N5CXBOZ.mjs → swift-package-prebuilt-ROIDLGLU.mjs} +10 -10
- package/dist-lib/esm-chunks/{swift-sdk-app-module-5IUSRXYA.mjs → swift-sdk-app-module-5VU63S56.mjs} +30 -20
- package/dist-lib/esm-chunks/{swift-sdk-image-7T2LMQS5.mjs → swift-sdk-image-SNFZVUQ3.mjs} +14 -14
- package/dist-lib/esm-chunks/{swift-sdk-image-producer-7QJ3BF6E.mjs → swift-sdk-image-producer-5RQDIX53.mjs} +4 -4
- package/dist-lib/expo-swift-bundle.cjs +3561 -3134
- 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 +6082 -5142
- package/dist-lib/host/fetch-proxy-handler.cjs +314 -301
- 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 +241 -226
- package/dist-lib/native-app-identity-project.mjs +17 -17
- 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 +75 -73
- 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 +6704 -5764
- package/dist-lib/swift-compile.cjs +1333 -922
- 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 +12 -6
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
- package/dist-lib/vendor/@xmldom/xmldom.cjs +1 -1
- package/dist-lib/vendor/acorn.cjs +1 -1
- package/dist-lib/vendor/bplist-parser.cjs +1 -1
- package/dist-lib/vendor/ignore.cjs +1 -1
- package/dist-lib/vendor/magic-string.cjs +1 -1
- package/dist-lib/vendor/plist.cjs +1 -1
- package/dist-lib/vendor/smol-toml.cjs +1 -1
- package/dist-lib/vendor/stream-json.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
- package/dist-lib/vendor/sucrase.cjs +1 -1
- package/dist-lib/vendor/terser.cjs +1 -1
- package/dist-lib/vendor/valibot.cjs +1 -1
- package/dist-lib/vendor/ws.cjs +1 -1
- package/dist-lib/vendor/zod.cjs +1 -1
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +3 -3
- package/dist-types/packages/peach-engine/src/engine/native-node-queries.d.ts +1 -0
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/src/binaryen.lock.json +3 -3
- package/src/native-bundles.ts +2 -0
- package/src/one-native-controls-package.ts +235 -40
- package/src/one-sdk/source.ts +2 -1
- package/src/one-sdk-preparation.ts +40 -2
- package/src/oneSdkContract.ts +13 -2
- package/src/swift-compile.ts +301 -48
- 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-host.ts +88 -16
- package/src/swift-reproducible.ts +16 -2
- package/src/swift-root-lock.ts +77 -5
- package/src/swift-sdk-app-module.ts +15 -6
- package/src/swift-sdk-image-wasm.ts +5 -2
- package/src/swift-sdk-image.ts +122 -59
- package/src/swift-startup-split.ts +65 -27
- package/src/swift-toolchain.ts +16 -5
- package/src/swift-wasm-prune.ts +51 -34
- package/src/wasm-lazy-split.ts +46 -40
- package/src/wasm-optimize.ts +146 -140
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2593 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
import {
|
|
3
3
|
__commonJS,
|
|
4
4
|
__toESM
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-DLSPHUHQ.mjs";
|
|
6
6
|
|
|
7
7
|
// ../../node_modules/@xmldom/xmldom/lib/conventions.js
|
|
8
8
|
var require_conventions = __commonJS({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2593 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
import {
|
|
3
3
|
swiftModuleToolchain
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-JPNUGMLE.mjs";
|
|
5
5
|
import {
|
|
6
6
|
DARWIN_RECORDS_PREFIX,
|
|
7
7
|
KEEP_WASM_NAMES,
|
|
@@ -31,13 +31,13 @@ import {
|
|
|
31
31
|
swiftSdkPaths,
|
|
32
32
|
unslottedFunctions,
|
|
33
33
|
wasmSections
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-23D4W2EY.mjs";
|
|
35
35
|
import {
|
|
36
36
|
SWIFT_WASM_TRIPLE,
|
|
37
37
|
sourceSwiftCheckout,
|
|
38
38
|
swiftCacheDir,
|
|
39
39
|
withSwiftRootLock
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-UZPLSN2V.mjs";
|
|
41
41
|
|
|
42
42
|
// src/swift-sdk-image.ts
|
|
43
43
|
import { execFile } from "node:child_process";
|
|
@@ -49,6 +49,7 @@ import {
|
|
|
49
49
|
readFileSync,
|
|
50
50
|
renameSync,
|
|
51
51
|
rmSync,
|
|
52
|
+
statSync,
|
|
52
53
|
writeFileSync
|
|
53
54
|
} from "node:fs";
|
|
54
55
|
import path from "node:path";
|
|
@@ -171,18 +172,40 @@ function swiftSdkImageEntry(key, scopedLookups) {
|
|
|
171
172
|
key: nativeEntryKey(inputs)
|
|
172
173
|
};
|
|
173
174
|
}
|
|
175
|
+
var MAX_CACHED_SDK_IMAGES = 4;
|
|
176
|
+
var cachedSdkInterfaces = /* @__PURE__ */ new Map();
|
|
177
|
+
var cachedSdkManifestIndices = /* @__PURE__ */ new Map();
|
|
178
|
+
var cachedSdkManifests = /* @__PURE__ */ new Map();
|
|
179
|
+
function setBoundedCache(cache, key, value) {
|
|
180
|
+
cache.delete(key);
|
|
181
|
+
cache.set(key, value);
|
|
182
|
+
while (cache.size > MAX_CACHED_SDK_IMAGES) {
|
|
183
|
+
const oldest = cache.keys().next().value;
|
|
184
|
+
if (oldest !== void 0) cache.delete(oldest);
|
|
185
|
+
}
|
|
186
|
+
return value;
|
|
187
|
+
}
|
|
174
188
|
function cached(directory, key) {
|
|
175
|
-
const
|
|
189
|
+
const sdkInterfacePath = path.join(directory, INTERFACE_FILE);
|
|
176
190
|
const image = path.join(directory, IMAGE_FILE);
|
|
177
191
|
const address = path.join(directory, IMAGE_DIGEST);
|
|
178
|
-
if (!existsSync(image) || !existsSync(address) || !existsSync(
|
|
192
|
+
if (!existsSync(image) || !existsSync(address) || !existsSync(sdkInterfacePath) || !existsSync(path.join(directory, MANIFEST_FILE)) || !existsSync(path.join(directory, MANIFEST_DATA_FILE)))
|
|
179
193
|
return void 0;
|
|
194
|
+
const sha256 = readFileSync(address, "utf8");
|
|
195
|
+
const cacheKey = `${directory}\0${sha256}`;
|
|
196
|
+
let loadedInterface;
|
|
180
197
|
return {
|
|
181
198
|
key,
|
|
182
199
|
directory,
|
|
183
200
|
image,
|
|
184
|
-
sha256
|
|
185
|
-
sdkInterface
|
|
201
|
+
sha256,
|
|
202
|
+
get sdkInterface() {
|
|
203
|
+
if (loadedInterface) return loadedInterface;
|
|
204
|
+
const memo = cachedSdkInterfaces.get(cacheKey);
|
|
205
|
+
if (memo) return loadedInterface = memo;
|
|
206
|
+
const parsed = JSON.parse(readFileSync(sdkInterfacePath, "utf8"));
|
|
207
|
+
return loadedInterface = setBoundedCache(cachedSdkInterfaces, cacheKey, parsed);
|
|
208
|
+
}
|
|
186
209
|
};
|
|
187
210
|
}
|
|
188
211
|
async function buildSwiftSdkImage(moduleRoot, scopedLookups = false, frameworkImports = [], options) {
|
|
@@ -192,7 +215,7 @@ async function buildSwiftSdkImage(moduleRoot, scopedLookups = false, frameworkIm
|
|
|
192
215
|
const existing = cached(directory, key);
|
|
193
216
|
if (existing) return existing;
|
|
194
217
|
if (!options?.producer && !swiftDistributionAt(moduleRoot) && path.resolve(moduleRoot) === sourceSwiftCheckout() && process.platform === "linux" && process.env.TM_SESSION) {
|
|
195
|
-
const { produceSwiftSdkImage } = await import("./swift-sdk-image-producer-
|
|
218
|
+
const { produceSwiftSdkImage } = await import("./swift-sdk-image-producer-5RQDIX53.mjs");
|
|
196
219
|
await produceSwiftSdkImage({
|
|
197
220
|
moduleRoot,
|
|
198
221
|
key,
|
|
@@ -303,9 +326,11 @@ async function linkSwiftSdkImage(moduleRoot, key, directory, work, scopedLookups
|
|
|
303
326
|
objects.push({ path: object, bytes, instrumentDynamicLookups: false });
|
|
304
327
|
guestObjects.set(product, objects);
|
|
305
328
|
};
|
|
306
|
-
const classifyFile = (file) => {
|
|
329
|
+
const classifyFile = (file, collectAutolink = false) => {
|
|
307
330
|
const bytes = readFileSync(file);
|
|
308
331
|
if (!file.endsWith(".a")) {
|
|
332
|
+
if (collectAutolink)
|
|
333
|
+
for (const library of autolinkLibraries(bytes)) libraries.add(library);
|
|
309
334
|
const scoped = lookups?.rewrite(file, bytes) ?? bytes;
|
|
310
335
|
return addObject(file, scoped, file);
|
|
311
336
|
}
|
|
@@ -313,6 +338,8 @@ async function linkSwiftSdkImage(moduleRoot, key, directory, work, scopedLookups
|
|
|
313
338
|
mkdirSync(path.join(members, archive));
|
|
314
339
|
const ordinals = /* @__PURE__ */ new Map();
|
|
315
340
|
readArMembers(bytes).forEach((member, index) => {
|
|
341
|
+
if (collectAutolink)
|
|
342
|
+
for (const library of autolinkLibraries(member.bytes)) libraries.add(library);
|
|
316
343
|
const object = path.join(members, archive, `${index}-${path.basename(member.name)}`);
|
|
317
344
|
const ordinal = (ordinals.get(member.name) ?? 0) + 1;
|
|
318
345
|
ordinals.set(member.name, ordinal);
|
|
@@ -327,9 +354,7 @@ async function linkSwiftSdkImage(moduleRoot, key, directory, work, scopedLookups
|
|
|
327
354
|
});
|
|
328
355
|
};
|
|
329
356
|
for (const object of [...link.objects, ...link.providers]) {
|
|
330
|
-
classifyFile(object);
|
|
331
|
-
for (const bytes of objectMembers(object))
|
|
332
|
-
for (const library of autolinkLibraries(bytes)) libraries.add(library);
|
|
357
|
+
classifyFile(object, true);
|
|
333
358
|
}
|
|
334
359
|
for (const library of libraries) {
|
|
335
360
|
if (unpacked.has(library.slice(2))) continue;
|
|
@@ -342,6 +367,7 @@ async function linkSwiftSdkImage(moduleRoot, key, directory, work, scopedLookups
|
|
|
342
367
|
const hostExports = sdkHostExports(appRoot);
|
|
343
368
|
const guestMap = /* @__PURE__ */ new Map();
|
|
344
369
|
const guestMetadataNames = {};
|
|
370
|
+
const compiles = [];
|
|
345
371
|
if (lookups) {
|
|
346
372
|
const ledger = lookups.link(guestObjects, [
|
|
347
373
|
...hostExports,
|
|
@@ -377,33 +403,38 @@ async function linkSwiftSdkImage(moduleRoot, key, directory, work, scopedLookups
|
|
|
377
403
|
const scopeLedger = path.join(work, "guest-ledger.ll");
|
|
378
404
|
const scopeObject = path.join(work, "guest-ledger.o");
|
|
379
405
|
writeFileSync(scopeLedger, ledger.llvmIR);
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
406
|
+
compiles.push(
|
|
407
|
+
run(path.join(toolchain.toolchainBin, "clang"), [
|
|
408
|
+
`--target=${SWIFT_WASM_TRIPLE}`,
|
|
409
|
+
"-matomics",
|
|
410
|
+
"-mbulk-memory",
|
|
411
|
+
"-c",
|
|
412
|
+
scopeLedger,
|
|
413
|
+
"-o",
|
|
414
|
+
scopeObject
|
|
415
|
+
])
|
|
416
|
+
);
|
|
389
417
|
eager.push(scopeObject);
|
|
390
418
|
}
|
|
391
419
|
writeFileSync(
|
|
392
420
|
path.join(work, "image-tables.c"),
|
|
393
421
|
IMAGE_TABLES + (guestLookups?.source ?? "")
|
|
394
422
|
);
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
423
|
+
compiles.push(
|
|
424
|
+
run(path.join(toolchain.toolchainBin, "clang"), [
|
|
425
|
+
`--target=${SWIFT_WASM_TRIPLE}`,
|
|
426
|
+
"-O2",
|
|
427
|
+
"-matomics",
|
|
428
|
+
"-mbulk-memory",
|
|
429
|
+
"-ffreestanding",
|
|
430
|
+
...lookups ? ["-DPEACH_SDK_GUEST_LINK"] : [],
|
|
431
|
+
"-c",
|
|
432
|
+
path.join(work, "image-tables.c"),
|
|
433
|
+
"-o",
|
|
434
|
+
tables
|
|
435
|
+
])
|
|
436
|
+
);
|
|
437
|
+
await Promise.all(compiles);
|
|
407
438
|
const quote = (value) => JSON.stringify(value);
|
|
408
439
|
writeFileSync(
|
|
409
440
|
path.join(work, "exports.rsp"),
|
|
@@ -462,23 +493,31 @@ async function linkSwiftSdkImage(moduleRoot, key, directory, work, scopedLookups
|
|
|
462
493
|
if (mask === void 0) throw new Error("sdk image lacks its constructor mask");
|
|
463
494
|
const code = path.join(work, "code.wasm");
|
|
464
495
|
writeFileSync(code, codeOnlySdkImage(finished, mask));
|
|
465
|
-
|
|
496
|
+
const lowerPromise = lowerWasm(code, path.join(work, IMAGE_FILE), {
|
|
466
497
|
optimize: true,
|
|
467
498
|
skipPasses: lookups ? ["duplicate-function-elimination"] : void 0
|
|
468
499
|
});
|
|
500
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
501
|
+
try {
|
|
502
|
+
writeSdkManifest(
|
|
503
|
+
work,
|
|
504
|
+
linkMap,
|
|
505
|
+
linkedBytes,
|
|
506
|
+
finished,
|
|
507
|
+
readFileSync(withRelocs),
|
|
508
|
+
functionSlots,
|
|
509
|
+
lookups && { inputs: guestMap, metadataNames: guestMetadataNames }
|
|
510
|
+
);
|
|
511
|
+
} catch (error) {
|
|
512
|
+
await lowerPromise.catch(() => {
|
|
513
|
+
});
|
|
514
|
+
throw error;
|
|
515
|
+
}
|
|
516
|
+
await lowerPromise;
|
|
469
517
|
const image = readFileSync(path.join(work, IMAGE_FILE));
|
|
470
518
|
sdkInterface.layout.tableEnd += unslottedFunctions(image);
|
|
471
519
|
if (sdkInterface.layout.tableEnd > SWIFT_SDK_APP_TABLE_BASE)
|
|
472
520
|
throw new Error("Swift SDK image exceeds its reserved function table range");
|
|
473
|
-
writeSdkManifest(
|
|
474
|
-
work,
|
|
475
|
-
linkMap,
|
|
476
|
-
linkedBytes,
|
|
477
|
-
finished,
|
|
478
|
-
readFileSync(withRelocs),
|
|
479
|
-
functionSlots,
|
|
480
|
-
lookups && { inputs: guestMap, metadataNames: guestMetadataNames }
|
|
481
|
-
);
|
|
482
521
|
writeFileSync(path.join(work, INTERFACE_FILE), JSON.stringify(sdkInterface));
|
|
483
522
|
writeFileSync(
|
|
484
523
|
path.join(work, IMAGE_DIGEST),
|
|
@@ -547,14 +586,11 @@ function sdkLinkInputs(appRoot) {
|
|
|
547
586
|
if (!crt) throw new Error("the sdk image link found no reactor startup object");
|
|
548
587
|
return { flags, libraries, objects: [crt, ...objects], providers };
|
|
549
588
|
}
|
|
550
|
-
function objectMembers(file) {
|
|
551
|
-
const bytes = readFileSync(file);
|
|
552
|
-
return file.endsWith(".a") ? readArMembers(bytes).map((member) => member.bytes) : [bytes];
|
|
553
|
-
}
|
|
554
589
|
function autolinkLibraries(bytes) {
|
|
555
590
|
const entries = wasmSections(bytes).find((s) => s.name === ".swift1_autolink_entries");
|
|
556
591
|
if (!entries) return [];
|
|
557
|
-
|
|
592
|
+
const raw = Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
593
|
+
return raw.toString("utf8", entries.start, entries.end).split("\0").filter((entry) => entry.startsWith("-l"));
|
|
558
594
|
}
|
|
559
595
|
function sdkHostExports(appRoot) {
|
|
560
596
|
const release = path.join(appRoot, ".build", SWIFT_WASM_TRIPLE, "release");
|
|
@@ -641,9 +677,17 @@ function writeSdkManifest(work, map, linked, finished, withRelocs, functionSlots
|
|
|
641
677
|
return { starts, targets };
|
|
642
678
|
};
|
|
643
679
|
const byAddress = (edges2) => {
|
|
644
|
-
const
|
|
645
|
-
|
|
646
|
-
|
|
680
|
+
const count = edges2.length >>> 1;
|
|
681
|
+
const order = new Uint32Array(count);
|
|
682
|
+
for (let i = 0; i < count; i++) order[i] = i;
|
|
683
|
+
order.sort((a, b) => edges2[a * 2] - edges2[b * 2]);
|
|
684
|
+
const sorted = new Uint32Array(edges2.length);
|
|
685
|
+
for (let i = 0; i < count; i++) {
|
|
686
|
+
const src = order[i] * 2;
|
|
687
|
+
sorted[i * 2] = edges2[src];
|
|
688
|
+
sorted[i * 2 + 1] = edges2[src + 1];
|
|
689
|
+
}
|
|
690
|
+
return sorted;
|
|
647
691
|
};
|
|
648
692
|
const functionData = flatten(edges.code);
|
|
649
693
|
const functionCalls = flatten(edges.calls);
|
|
@@ -711,16 +755,26 @@ function writeSdkManifest(work, map, linked, finished, withRelocs, functionSlots
|
|
|
711
755
|
writeFileSync(path.join(work, MANIFEST_FILE), JSON.stringify(manifest));
|
|
712
756
|
}
|
|
713
757
|
function readSwiftSdkManifestIndex(image) {
|
|
714
|
-
const
|
|
715
|
-
|
|
716
|
-
|
|
758
|
+
const manifestPath = path.join(image.directory, MANIFEST_FILE);
|
|
759
|
+
const stat = statSync(manifestPath, { bigint: true });
|
|
760
|
+
const cacheKey = `${manifestPath}\0${stat.size}:${stat.mtimeNs}`;
|
|
761
|
+
const memo = cachedSdkManifestIndices.get(cacheKey);
|
|
762
|
+
if (memo) return memo;
|
|
763
|
+
const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
717
764
|
if (manifest.version !== SWIFT_SDK_IMAGE_VERSION)
|
|
718
765
|
throw new Error(`sdk manifest version ${manifest.version}`);
|
|
719
|
-
return manifest;
|
|
766
|
+
return setBoundedCache(cachedSdkManifestIndices, cacheKey, manifest);
|
|
720
767
|
}
|
|
721
768
|
function readSwiftSdkManifest(image) {
|
|
769
|
+
const manifestPath = path.join(image.directory, MANIFEST_FILE);
|
|
770
|
+
const dataPath = path.join(image.directory, MANIFEST_DATA_FILE);
|
|
771
|
+
const mStat = statSync(manifestPath, { bigint: true });
|
|
772
|
+
const dStat = statSync(dataPath, { bigint: true });
|
|
773
|
+
const cacheKey = `${image.directory}\0${mStat.size}:${mStat.mtimeNs}\0${dStat.size}:${dStat.mtimeNs}`;
|
|
774
|
+
const memo = cachedSdkManifests.get(cacheKey);
|
|
775
|
+
if (memo) return memo;
|
|
722
776
|
const manifest = readSwiftSdkManifestIndex(image);
|
|
723
|
-
const data = readFileSync(
|
|
777
|
+
const data = readFileSync(dataPath);
|
|
724
778
|
const words = new Uint32Array(data.buffer, data.byteOffset, manifest.segmentBytes / 4);
|
|
725
779
|
const blocks = /* @__PURE__ */ new Map();
|
|
726
780
|
let at = 0;
|
|
@@ -734,7 +788,7 @@ function readSwiftSdkManifest(image) {
|
|
|
734
788
|
...segment,
|
|
735
789
|
data: data.subarray(segment.bytes, segment.bytes + segment.length)
|
|
736
790
|
}));
|
|
737
|
-
return { manifest, block, segments };
|
|
791
|
+
return setBoundedCache(cachedSdkManifests, cacheKey, { manifest, block, segments });
|
|
738
792
|
}
|
|
739
793
|
var MANIFEST_BLOCKS = [
|
|
740
794
|
"pieces",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2593 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
|
|
3
3
|
// ../../node_modules/acorn/dist/acorn.mjs
|
|
4
4
|
var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 78, 5, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 199, 7, 137, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 55, 9, 266, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 233, 0, 3, 0, 8, 1, 6, 0, 475, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2593 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2593 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
import {
|
|
3
3
|
LAUNCH_METADATA_KEYS,
|
|
4
4
|
LAUNCH_METADATA_KEYS_PATH
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-OIHSBING.mjs";
|
|
6
6
|
import {
|
|
7
7
|
parseSwiftDistributionLock,
|
|
8
8
|
readActiveRuntime,
|
|
9
9
|
runtimeDir,
|
|
10
10
|
swiftDistributionAt,
|
|
11
11
|
swiftModuleSdk
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-23D4W2EY.mjs";
|
|
13
13
|
import {
|
|
14
14
|
SWIFT_WASM_TRIPLE,
|
|
15
15
|
registerSwiftHostCompiler,
|
|
16
16
|
swiftCompiler,
|
|
17
17
|
swiftToolchain
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-UZPLSN2V.mjs";
|
|
19
19
|
import {
|
|
20
20
|
isRecord
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-BMKI4WBL.mjs";
|
|
22
22
|
|
|
23
23
|
// src/swift-distribution.ts
|
|
24
24
|
import fs2 from "node:fs";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2593 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
import {
|
|
3
3
|
SIM_LONG_PRESS_MAX_MS
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-LN7ZTBNS.mjs";
|
|
5
5
|
import {
|
|
6
6
|
isRecord
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-BMKI4WBL.mjs";
|
|
8
8
|
|
|
9
9
|
// ../peach-globals/src/globalsContract.ts
|
|
10
10
|
var LEGACY_ALIAS_MARKER = Symbol.for("sootsim.legacy-aliases-installed");
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2593 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
import {
|
|
3
3
|
isSwiftImageVariants
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-2MWUVSRW.mjs";
|
|
5
5
|
import {
|
|
6
6
|
findBundleFooter
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-KWMJUJJS.mjs";
|
|
8
8
|
import {
|
|
9
9
|
isRecord
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-BMKI4WBL.mjs";
|
|
11
11
|
|
|
12
12
|
// src/android-string-value.ts
|
|
13
13
|
function compileAndroidStringValue(text, where) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2593 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
|
|
3
3
|
// src/swiftTargetContract.ts
|
|
4
4
|
var SWIFT_WASM_TRIPLE = "wasm64-unknown-wasip1-threads";
|
|
@@ -322,7 +322,8 @@ function swiftToolchainBin(release) {
|
|
|
322
322
|
const dirs = [os.homedir(), "/"].map(
|
|
323
323
|
(base) => path.join(base, `Library/Developer/Toolchains/${release}.xctoolchain/usr/bin`)
|
|
324
324
|
);
|
|
325
|
-
|
|
325
|
+
const found = dirs.find((dir) => fs.existsSync(path.join(dir, "swift")));
|
|
326
|
+
return found ? fs.realpathSync(found) : dirs[0];
|
|
326
327
|
}
|
|
327
328
|
if (process.env.CONTRAST_SWIFT_TOOLCHAINS) {
|
|
328
329
|
return path.join(process.env.CONTRAST_SWIFT_TOOLCHAINS, release, "usr/bin");
|
|
@@ -366,18 +367,59 @@ exec ${JSON.stringify(path.join(toolchainBin, "wasm-ld"))} "$@"
|
|
|
366
367
|
}
|
|
367
368
|
function peachHome() {
|
|
368
369
|
const override = process.env.PEACH_HOME;
|
|
369
|
-
|
|
370
|
+
if (override) return path.resolve(override);
|
|
371
|
+
const home = path.join(os.homedir(), ".peach");
|
|
372
|
+
return fs.existsSync(home) ? fs.realpathSync(home) : home;
|
|
370
373
|
}
|
|
371
374
|
function peachSwiftSdksDir() {
|
|
372
375
|
return process.env.PEACH_SWIFT_SDKS_PATH ?? path.join(peachHome(), "swift", "sdks");
|
|
373
376
|
}
|
|
374
377
|
var BUILDERS_ROOT_ENV = "CONTRAST_BUILDERS_ROOT";
|
|
378
|
+
var agentBuildersRoot;
|
|
379
|
+
function agentSharedCacheRoot() {
|
|
380
|
+
if (process.platform !== "darwin" || !process.env.TM_SESSION) return null;
|
|
381
|
+
if (agentBuildersRoot) return agentBuildersRoot;
|
|
382
|
+
const policy = JSON.parse(
|
|
383
|
+
execFileSync("tm", ["machine", "policy", "--json"], {
|
|
384
|
+
encoding: "utf8",
|
|
385
|
+
timeout: 3e4
|
|
386
|
+
})
|
|
387
|
+
);
|
|
388
|
+
const mounts = policy.storage_mounts ?? [];
|
|
389
|
+
if (!Array.isArray(mounts)) throw new Error("storage_mounts must be a list");
|
|
390
|
+
const isMount = (directory) => {
|
|
391
|
+
const lines = execFileSync("/bin/df", ["-P", directory], {
|
|
392
|
+
encoding: "utf8",
|
|
393
|
+
timeout: 3e4
|
|
394
|
+
}).trim().split("\n");
|
|
395
|
+
const fields = lines[lines.length - 1].trim().split(/\s+/);
|
|
396
|
+
const mount = fields.slice(5).join(" ");
|
|
397
|
+
if (!path.isAbsolute(mount))
|
|
398
|
+
throw new Error("filesystem mount identity is unavailable");
|
|
399
|
+
return fs.realpathSync(directory) === fs.realpathSync(mount);
|
|
400
|
+
};
|
|
401
|
+
for (const mount of mounts) {
|
|
402
|
+
if (typeof mount !== "string" || !path.isAbsolute(mount) || !isMount(mount))
|
|
403
|
+
throw new Error(`configured storage is not mounted: ${mount}`);
|
|
404
|
+
}
|
|
405
|
+
const heavy = policy.heavy_data_dir;
|
|
406
|
+
if (heavy == null) return agentBuildersRoot = path.join(os.homedir(), "builders");
|
|
407
|
+
if (typeof heavy !== "string" || !path.isAbsolute(heavy) || !fs.statSync(heavy).isDirectory())
|
|
408
|
+
throw new Error(`configured heavy_data_dir is unavailable: ${heavy}`);
|
|
409
|
+
const mounted = isMount(heavy);
|
|
410
|
+
if (path.dirname(heavy) === "/Volumes" && !mounted)
|
|
411
|
+
throw new Error(`configured storage is not mounted: ${heavy}`);
|
|
412
|
+
return agentBuildersRoot = mounted && fs.statSync(heavy).dev === fs.statSync(os.homedir()).dev ? path.join(os.homedir(), "builders") : path.join(heavy, "builders");
|
|
413
|
+
}
|
|
375
414
|
function buildersRootEnv() {
|
|
376
415
|
const root = process.env[BUILDERS_ROOT_ENV]?.trim();
|
|
377
416
|
return root ? root : null;
|
|
378
417
|
}
|
|
418
|
+
function resolvedBuildersRoot() {
|
|
419
|
+
return buildersRootEnv() ?? (process.env.PEACH_HOME ? null : agentSharedCacheRoot());
|
|
420
|
+
}
|
|
379
421
|
function swiftCacheDir() {
|
|
380
|
-
const root =
|
|
422
|
+
const root = resolvedBuildersRoot();
|
|
381
423
|
return root ? path.join(root, "peach-cache") : path.join(peachHome(), "cache");
|
|
382
424
|
}
|
|
383
425
|
var SWIFT_CACHE_HOLD_MARKER = ".tm-hold";
|
|
@@ -390,7 +432,7 @@ function refreshSwiftCacheHold(directory) {
|
|
|
390
432
|
const [kind, key] = relative.split(path.sep);
|
|
391
433
|
if (!key || kind === ".." || path.isAbsolute(relative)) return;
|
|
392
434
|
const entry = path.join(cacheRoot, kind, key);
|
|
393
|
-
if (!
|
|
435
|
+
if (!resolvedBuildersRoot()) {
|
|
394
436
|
const now = /* @__PURE__ */ new Date();
|
|
395
437
|
fs.utimesSync(entry, now, now);
|
|
396
438
|
return;
|
|
@@ -1331,12 +1373,68 @@ function rootLockKey(root) {
|
|
|
1331
1373
|
function swiftRootLocksDir() {
|
|
1332
1374
|
return path2.join(homedir(), ".peach", "cache", "swift-root-locks");
|
|
1333
1375
|
}
|
|
1334
|
-
|
|
1376
|
+
function lockDirectoryFor(root) {
|
|
1335
1377
|
const directory = path2.join(
|
|
1336
1378
|
swiftRootLocksDir(),
|
|
1337
1379
|
createHash2("sha256").update(rootLockKey(root)).digest("hex").slice(0, 32)
|
|
1338
1380
|
);
|
|
1339
1381
|
mkdirSync(directory, { recursive: true });
|
|
1382
|
+
return directory;
|
|
1383
|
+
}
|
|
1384
|
+
function acquireSwiftRootReadHold(root) {
|
|
1385
|
+
const directory = lockDirectoryFor(root);
|
|
1386
|
+
const token = randomUUID();
|
|
1387
|
+
const pending = path2.join(directory, `pending.reader.${token}`);
|
|
1388
|
+
const reader = path2.join(directory, `reader.${token}`);
|
|
1389
|
+
writeFileSync2(pending, JSON.stringify(ownIdentity(process.pid)));
|
|
1390
|
+
try {
|
|
1391
|
+
linkSync(pending, reader);
|
|
1392
|
+
} finally {
|
|
1393
|
+
rmSync2(pending, { force: true });
|
|
1394
|
+
}
|
|
1395
|
+
let released = false;
|
|
1396
|
+
return {
|
|
1397
|
+
release() {
|
|
1398
|
+
if (released) return;
|
|
1399
|
+
released = true;
|
|
1400
|
+
rmSync2(reader, { force: true });
|
|
1401
|
+
}
|
|
1402
|
+
};
|
|
1403
|
+
}
|
|
1404
|
+
async function hasLiveSwiftRootReaders(root, signal) {
|
|
1405
|
+
const directory = lockDirectoryFor(root);
|
|
1406
|
+
const entries = readdirSync3(directory).filter((entry) => entry.startsWith("reader."));
|
|
1407
|
+
if (entries.length === 0) return false;
|
|
1408
|
+
for (const entry of entries) {
|
|
1409
|
+
const file = path2.join(directory, entry);
|
|
1410
|
+
let text;
|
|
1411
|
+
try {
|
|
1412
|
+
text = readFileSync3(file, "utf8");
|
|
1413
|
+
} catch (error) {
|
|
1414
|
+
if (errorCode(error) === "ENOENT") continue;
|
|
1415
|
+
throw error;
|
|
1416
|
+
}
|
|
1417
|
+
const identity = parseIdentity(text);
|
|
1418
|
+
const rows = await processTableWithRetry(identity.pid, signal);
|
|
1419
|
+
if (rows.some((row) => !row.zombie && sameProcess(row, identity))) return true;
|
|
1420
|
+
rmSync2(file, { force: true });
|
|
1421
|
+
}
|
|
1422
|
+
return false;
|
|
1423
|
+
}
|
|
1424
|
+
async function waitForNoSwiftRootReaders(root, signal) {
|
|
1425
|
+
let announced = false;
|
|
1426
|
+
while (await hasLiveSwiftRootReaders(root, signal)) {
|
|
1427
|
+
signal?.throwIfAborted();
|
|
1428
|
+
if (!announced) {
|
|
1429
|
+
announced = true;
|
|
1430
|
+
process.stderr.write(`[swift-root-lock] waiting for readers of ${root}
|
|
1431
|
+
`);
|
|
1432
|
+
}
|
|
1433
|
+
await pause(POLL_MS, signal);
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
async function withSwiftRootLock(root, work, signal, wait = true) {
|
|
1437
|
+
const directory = lockDirectoryFor(root);
|
|
1340
1438
|
const token = randomUUID();
|
|
1341
1439
|
const ownRow = (await processTableWithRetry(process.pid, signal)).find(
|
|
1342
1440
|
(candidate) => candidate.pid === process.pid && !candidate.zombie
|
|
@@ -1471,5 +1569,8 @@ export {
|
|
|
1471
1569
|
swiftCompiler,
|
|
1472
1570
|
terminateProcessGroup,
|
|
1473
1571
|
windowAdmission,
|
|
1572
|
+
acquireSwiftRootReadHold,
|
|
1573
|
+
hasLiveSwiftRootReaders,
|
|
1574
|
+
waitForNoSwiftRootReaders,
|
|
1474
1575
|
withSwiftRootLock
|
|
1475
1576
|
};
|