peachsim 0.1.2738 → 0.1.2743
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 +310 -185
- 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-Q6ATHJ5Q.mjs → acorn-4LW63VJO.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-WCK2HANP.mjs → chunk-23OQSLRP.mjs} +289 -182
- package/dist-lib/esm-chunks/{chunk-PKLW5P4C.mjs → chunk-2HP5FPCA.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-V3CW4EN6.mjs → chunk-6FHNPTCA.mjs} +13 -7
- package/dist-lib/esm-chunks/{chunk-7JFDXIZQ.mjs → chunk-7NBU6OXB.mjs} +4 -4
- package/dist-lib/esm-chunks/{chunk-5NOBLXKV.mjs → chunk-B3F4HKM6.mjs} +5 -5
- package/dist-lib/esm-chunks/{chunk-3FBJGWPT.mjs → chunk-BJSA6VP6.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-YMCYBEB7.mjs → chunk-BNJ5YG7V.mjs} +2 -2
- package/dist-lib/esm-chunks/{chunk-BQW3EWAQ.mjs → chunk-BQUYNIMY.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-EU6UNSUW.mjs → chunk-BW3KZJV5.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-YU4ISPGO.mjs → chunk-EAAYQS4L.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-ZXORDMAT.mjs → chunk-EES2SLJK.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-XJDM6LFX.mjs → chunk-GIZQHA6L.mjs} +6 -6
- package/dist-lib/esm-chunks/{chunk-ONFP5RP7.mjs → chunk-HOUFNDEV.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-3CPES2EZ.mjs → chunk-JHOZWSFF.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-NMGEJJ2J.mjs → chunk-LVCSLWR2.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-GI5VVEKN.mjs → chunk-OEQBNK6V.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-P72RUOTY.mjs → chunk-SG7MN2KW.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-6Q3JLKPD.mjs → chunk-THJMTM3L.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-KDIDYS42.mjs → chunk-THSR72MV.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-HLWFKLLD.mjs → chunk-V3SRJIBE.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-TBX7JBPC.mjs → chunk-VJKLZAU2.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-JDLZMI2L.mjs → chunk-WKGJ6LAU.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-2FSMFZ42.mjs → chunk-XP5F6PNN.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-2EW5XIGF.mjs → chunk-ZLQX4SVV.mjs} +1 -1
- package/dist-lib/esm-chunks/{metro-layout-parser-R2UJPOJL.mjs → metro-layout-parser-L57PU3TD.mjs} +3 -3
- package/dist-lib/esm-chunks/{swift-package-prebuilt-W34QYBXU.mjs → swift-package-prebuilt-UNXWJN7B.mjs} +12 -12
- package/dist-lib/esm-chunks/{swift-sdk-app-module-RO5AZPWM.mjs → swift-sdk-app-module-DZV3XYCP.mjs} +16 -16
- package/dist-lib/esm-chunks/{swift-sdk-image-CWTI76JI.mjs → swift-sdk-image-WRYMP64Z.mjs} +16 -16
- package/dist-lib/esm-chunks/{swift-sdk-image-producer-JGTU2ZCE.mjs → swift-sdk-image-producer-D6DOCCCR.mjs} +5 -5
- package/dist-lib/expo-swift-bundle.cjs +310 -185
- 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 +3782 -1684
- package/dist-lib/host/fetch-proxy-handler.cjs +41 -10
- 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 +1 -1
- package/dist-lib/native-app-identity-project.mjs +15 -15
- 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 +88 -86
- package/dist-lib/public-origins-lib.json +86 -72
- 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 +4213 -2115
- package/dist-lib/swift-compile.cjs +303 -178
- package/dist-lib/swift-compile.mjs +12 -12
- 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/acorn.cjs +1 -1
- package/dist-lib/vendor/magic-string.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/canvaskit-api.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/effects-shader-registry.d.ts +2 -12
- package/dist-types/packages/peach-engine/src/engine/native-font-dataContract.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/native-style-store.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/scene-native-binding.d.ts +0 -1
- package/dist-types/packages/peach-kit/src/ui/hosting-safe-area.d.ts +17 -1
- package/package.json +1 -1
- package/src/one-direct-host-source.ts +254 -0
- package/src/one-native-controls-package.ts +99 -21
- package/src/swift-compile.ts +145 -120
- package/src/swift-sdk-image-map.ts +35 -0
- package/src/swift-sdk-image.ts +12 -2
package/src/swift-compile.ts
CHANGED
|
@@ -2508,7 +2508,6 @@ function compiledSwiftSources(
|
|
|
2508
2508
|
targets: SwiftPackageTarget[],
|
|
2509
2509
|
overlayFrameworks: () => ReadonlySet<string>,
|
|
2510
2510
|
headers: (target: SwiftPackageTarget) => Iterable<string>,
|
|
2511
|
-
nativeSourceGlue = false,
|
|
2512
2511
|
): Map<string, string> {
|
|
2513
2512
|
const ordered = [...targets].sort((a, b) => b.path.length - a.path.length)
|
|
2514
2513
|
const byDir = indexTargetsByDirectory(ordered)
|
|
@@ -2539,10 +2538,7 @@ function compiledSwiftSources(
|
|
|
2539
2538
|
return new Map(
|
|
2540
2539
|
[...owners].map(([file, { source, owner }]) => {
|
|
2541
2540
|
// generated transport must keep its wasi exports while app code emulates ios.
|
|
2542
|
-
if (
|
|
2543
|
-
nativeSourceGlue &&
|
|
2544
|
-
path.posix.basename(file) === 'OneNativeSource.generated.swift'
|
|
2545
|
-
)
|
|
2541
|
+
if (path.posix.basename(file) === 'OneNativeSource.generated.swift')
|
|
2546
2542
|
return [file, source]
|
|
2547
2543
|
const manifest = /(?:^|\/)Package(?:@swift-[\d.]+)?\.swift$/.test(file)
|
|
2548
2544
|
if (manifest && (!owner || /^Package(?:@swift-[\d.]+)?\.swift$/.test(file)))
|
|
@@ -4749,7 +4745,6 @@ export function writeSwiftProject(
|
|
|
4749
4745
|
.filter(([file]) => file.startsWith(`${directory}/`))
|
|
4750
4746
|
.map(([, contents]) => contents)
|
|
4751
4747
|
},
|
|
4752
|
-
input.oneModule,
|
|
4753
4748
|
)
|
|
4754
4749
|
// an application's swift module must precede its native implementations.
|
|
4755
4750
|
// the tiny executable calls the original typed entry after both are linked.
|
|
@@ -6355,9 +6350,11 @@ const frameworkProductsReceiptSchema = v.object({
|
|
|
6355
6350
|
function readFrameworkProductsReceipt(
|
|
6356
6351
|
scratch: string,
|
|
6357
6352
|
receiptKey: string,
|
|
6353
|
+
planChangedAt = 0n,
|
|
6358
6354
|
): SwiftFrameworkProducts | null {
|
|
6359
6355
|
const receiptFile = path.join(scratch, 'products-ready', `${receiptKey}.json`)
|
|
6360
|
-
|
|
6356
|
+
const receiptStat = statSync(receiptFile, { bigint: true, throwIfNoEntry: false })
|
|
6357
|
+
if (!receiptStat || receiptStat.mtimeNs < planChangedAt) return null
|
|
6361
6358
|
let parsed: v.InferOutput<typeof frameworkProductsReceiptSchema>
|
|
6362
6359
|
try {
|
|
6363
6360
|
parsed = v.parse(
|
|
@@ -6502,129 +6499,157 @@ async function buildFrameworkProducts(
|
|
|
6502
6499
|
const unoptimized = args.input.unoptimized === true
|
|
6503
6500
|
const sdkOptions = swiftCompileSdkOptions(args.moduleRoot, args.toolchainBin)
|
|
6504
6501
|
const selectorOptions = swiftObjCSelectorOptions(args.moduleRoot)
|
|
6505
|
-
const
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6502
|
+
const receiptKeyFor = (products: readonly string[]) =>
|
|
6503
|
+
createHash('sha256')
|
|
6504
|
+
.update(
|
|
6505
|
+
JSON.stringify([
|
|
6506
|
+
'framework-products/v2',
|
|
6507
|
+
args.frameworkKey,
|
|
6508
|
+
unoptimized,
|
|
6509
|
+
args.sdk,
|
|
6510
|
+
args.toolchainBin,
|
|
6511
|
+
[...products].sort(),
|
|
6512
|
+
darwinRecordsMinimum(),
|
|
6513
|
+
args.plugins,
|
|
6514
|
+
sdkOptions,
|
|
6515
|
+
selectorOptions,
|
|
6516
|
+
]),
|
|
6517
|
+
)
|
|
6518
|
+
.digest('hex')
|
|
6519
|
+
.slice(0, 32)
|
|
6520
|
+
const receiptKey = receiptKeyFor(linkedTargets.products)
|
|
6522
6521
|
const ready = readFrameworkProductsReceipt(scratch, receiptKey)
|
|
6523
6522
|
if (ready) return ready
|
|
6524
6523
|
if (!allowWrite) return
|
|
6525
6524
|
|
|
6526
6525
|
const linkRoot = path.join(scratch, 'link')
|
|
6527
|
-
|
|
6528
|
-
const
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
const
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
|
|
6541
|
-
|
|
6542
|
-
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
...swiftPackageCacheOptions(),
|
|
6548
|
-
'--build-system',
|
|
6549
|
-
'native',
|
|
6550
|
-
'-j',
|
|
6551
|
-
String(targetJobs),
|
|
6552
|
-
'--package-path',
|
|
6553
|
-
linkRoot,
|
|
6554
|
-
'--scratch-path',
|
|
6526
|
+
const manifest = path.join(linkRoot, 'Package.swift')
|
|
6527
|
+
const manifestStat = statSync(manifest, { bigint: true, throwIfNoEntry: false })
|
|
6528
|
+
const planStat = statSync(path.join(scratch, 'release.yaml'), {
|
|
6529
|
+
bigint: true,
|
|
6530
|
+
throwIfNoEntry: false,
|
|
6531
|
+
})
|
|
6532
|
+
const builtProducts =
|
|
6533
|
+
manifestStat && planStat
|
|
6534
|
+
? [
|
|
6535
|
+
...readFileSync(manifest, 'utf8').matchAll(
|
|
6536
|
+
/^\s*\.product\(name: "([^"]+)", package:/gm,
|
|
6537
|
+
),
|
|
6538
|
+
].map((match) => match[1]!)
|
|
6539
|
+
: []
|
|
6540
|
+
// a plan rewritten by a later build cannot borrow an older product receipt.
|
|
6541
|
+
const reusePlan =
|
|
6542
|
+
manifestStat &&
|
|
6543
|
+
planStat &&
|
|
6544
|
+
linkedTargets.products.every((product) => builtProducts.includes(product)) &&
|
|
6545
|
+
readFrameworkProductsReceipt(
|
|
6555
6546
|
scratch,
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
6547
|
+
receiptKeyFor(builtProducts),
|
|
6548
|
+
manifestStat.ctimeNs > planStat.ctimeNs ? manifestStat.ctimeNs : planStat.ctimeNs,
|
|
6549
|
+
)
|
|
6550
|
+
if (!reusePlan) {
|
|
6551
|
+
writeFrameworkLinkPackage(linkRoot, args.moduleRoot, linkedTargets.products)
|
|
6552
|
+
const frameworkTmp = path.join(scratch, 'peach-compiler-tmp')
|
|
6553
|
+
mkdirSync(frameworkTmp, { recursive: true })
|
|
6554
|
+
const jobs = swiftCompilerJobs()
|
|
6555
|
+
// keep cores available for the batch frontends inside large framework targets.
|
|
6556
|
+
const targetJobs = jobs >= 4 ? 2 : 1
|
|
6557
|
+
const driverJobs = Math.max(1, Math.floor(jobs / targetJobs))
|
|
6558
|
+
const cache = unoptimized
|
|
6559
|
+
? null
|
|
6560
|
+
: prepareFrameworkCompileCache(
|
|
6561
|
+
scratch,
|
|
6562
|
+
args.moduleRoot,
|
|
6563
|
+
args.toolchainBin,
|
|
6564
|
+
sdkOptions,
|
|
6565
|
+
linkedTargets.products,
|
|
6566
|
+
)
|
|
6567
|
+
await runCompiler(
|
|
6568
|
+
args.swift,
|
|
6569
|
+
[
|
|
6570
|
+
'build',
|
|
6571
|
+
...swiftPackageCacheOptions(),
|
|
6572
|
+
'--build-system',
|
|
6573
|
+
'native',
|
|
6574
|
+
'-j',
|
|
6575
|
+
String(targetJobs),
|
|
6576
|
+
'--package-path',
|
|
6577
|
+
linkRoot,
|
|
6578
|
+
'--scratch-path',
|
|
6579
|
+
scratch,
|
|
6580
|
+
'--target',
|
|
6581
|
+
FRAMEWORK_LINK_TARGET,
|
|
6582
|
+
...sdkOptions,
|
|
6583
|
+
...selectorOptions,
|
|
6584
|
+
'--swift-sdk',
|
|
6585
|
+
args.sdk,
|
|
6586
|
+
'-c',
|
|
6587
|
+
'release',
|
|
6588
|
+
...(cache
|
|
6589
|
+
? ['-Xswiftc', '-driver-use-frontend-path', '-Xswiftc', cache.wrapper]
|
|
6590
|
+
: []),
|
|
6598
6591
|
'-Xswiftc',
|
|
6599
|
-
'-
|
|
6592
|
+
unoptimized ? '-Onone' : '-Osize',
|
|
6600
6593
|
'-Xswiftc',
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6594
|
+
'-no-whole-module-optimization',
|
|
6595
|
+
// optimized batches can move specialized definitions between object files.
|
|
6596
|
+
...(unoptimized ? ['-Xswiftc', '-incremental'] : []),
|
|
6604
6597
|
'-Xswiftc',
|
|
6605
|
-
'-
|
|
6598
|
+
'-enable-batch-mode',
|
|
6599
|
+
// each batch repeats the same framework diagnostics.
|
|
6600
|
+
...(unoptimized ? [] : ['-Xswiftc', '-suppress-warnings']),
|
|
6606
6601
|
'-Xswiftc',
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6602
|
+
'-j',
|
|
6603
|
+
'-Xswiftc',
|
|
6604
|
+
String(driverJobs),
|
|
6605
|
+
// the release link strips all debug info, so none is generated.
|
|
6606
|
+
'-Xswiftc',
|
|
6607
|
+
'-gnone',
|
|
6608
|
+
'-Xcc',
|
|
6609
|
+
'-g0',
|
|
6610
|
+
'-Xcxx',
|
|
6611
|
+
'-g0',
|
|
6612
|
+
'-Xswiftc',
|
|
6613
|
+
'-num-threads',
|
|
6614
|
+
'-Xswiftc',
|
|
6615
|
+
'1',
|
|
6616
|
+
...swiftReproducibleBuildFlags([
|
|
6617
|
+
[path.dirname(args.toolchainBin), 'toolchain'],
|
|
6618
|
+
[args.moduleRoot, 'framework'],
|
|
6619
|
+
[scratch, 'framework-scratch'],
|
|
6620
|
+
]),
|
|
6621
|
+
...args.plugins.libraries.flatMap((plugin) => [
|
|
6622
|
+
'-Xswiftc',
|
|
6623
|
+
'-load-plugin-library',
|
|
6624
|
+
'-Xswiftc',
|
|
6625
|
+
plugin,
|
|
6626
|
+
]),
|
|
6627
|
+
...args.plugins.executables.flatMap((plugin) => [
|
|
6628
|
+
'-Xswiftc',
|
|
6629
|
+
'-load-plugin-executable',
|
|
6630
|
+
'-Xswiftc',
|
|
6631
|
+
`${plugin}#ExpoModulesMacros`,
|
|
6632
|
+
]),
|
|
6633
|
+
],
|
|
6634
|
+
// swiftpm hashes TMPDIR into its plan; keep one stable compiler scratch inside the locked slot.
|
|
6635
|
+
// the framework build's warnings alone pass the default 1 MiB cap, which kills
|
|
6636
|
+
// the build one step from the end.
|
|
6637
|
+
{
|
|
6638
|
+
...args.buildOptions,
|
|
6639
|
+
temporaryDirectory: frameworkTmp,
|
|
6640
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
6641
|
+
},
|
|
6642
|
+
SWIFTPM_PROGRESS,
|
|
6643
|
+
SWIFTPM_NOISE,
|
|
6644
|
+
)
|
|
6645
|
+
.catch((error: unknown) => {
|
|
6646
|
+
// the compiler's diagnostics ride on the error's streams, not its message
|
|
6647
|
+
throw new Error(outputOf(error), { cause: error })
|
|
6648
|
+
})
|
|
6649
|
+
.finally(() => {
|
|
6650
|
+
if (cache) reportFrameworkCompileCacheStats(scratch, cache.statsFile)
|
|
6651
|
+
})
|
|
6652
|
+
}
|
|
6628
6653
|
const release = path.join(scratch, WASM_TRIPLE, 'release')
|
|
6629
6654
|
const linked = frameworkLinkClosure(scratch, linkedTargets.targets)
|
|
6630
6655
|
const objects = linked.objects
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { basename } from 'node:path'
|
|
2
|
+
import {
|
|
3
|
+
PEACH_GUEST_SERVICE_MODULE,
|
|
4
|
+
peachGuestServiceSymbols,
|
|
5
|
+
} from '../../peach-kit/src/guest-engine-services'
|
|
2
6
|
import { guestLinkLines } from './swift-guest-linked-spans'
|
|
7
|
+
import { wasmSections } from './wasm-binary-sections'
|
|
8
|
+
import { readWasmImports } from './wasm-imports'
|
|
3
9
|
|
|
4
10
|
// the sections the pruner splits per symbol in the objects an app links, so an sdk piece
|
|
5
11
|
// in one of them is one top-level symbol (swift-wasm-prune.ts PARTITIONED_SEGS)
|
|
@@ -44,6 +50,35 @@ export interface WasmLinkMap {
|
|
|
44
50
|
code: WasmMapChunk[]
|
|
45
51
|
}
|
|
46
52
|
|
|
53
|
+
export function assertPeachGuestEngineLink(map: WasmLinkMap, linked: Uint8Array): void {
|
|
54
|
+
const guestSymbol = /^peach_guest_(sdk|removed|service)_/
|
|
55
|
+
const unresolved = new Set<string>()
|
|
56
|
+
// the sdk permits other unresolved symbols, which wasm-ld replaces with traps.
|
|
57
|
+
for (const chunk of map.code) {
|
|
58
|
+
if (chunk.inputFile !== '<internal>' || chunk.section !== 'undefined_stub') continue
|
|
59
|
+
for (const { name } of chunk.symbols) if (guestSymbol.test(name)) unresolved.add(name)
|
|
60
|
+
}
|
|
61
|
+
if (unresolved.size)
|
|
62
|
+
throw new Error(
|
|
63
|
+
`unresolved PeachEngine calls in the Swift SDK:\n${[...unresolved].sort().join('\n')}`,
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
const imports = wasmSections(linked).find((section) => section.id === 2)
|
|
67
|
+
if (imports)
|
|
68
|
+
readWasmImports(linked, imports, ({ kind, module, name }) => {
|
|
69
|
+
if (module !== PEACH_GUEST_SERVICE_MODULE && !guestSymbol.test(name)) return
|
|
70
|
+
if (
|
|
71
|
+
kind === 0 &&
|
|
72
|
+
module === PEACH_GUEST_SERVICE_MODULE &&
|
|
73
|
+
peachGuestServiceSymbols.includes(name)
|
|
74
|
+
)
|
|
75
|
+
return
|
|
76
|
+
throw new Error(
|
|
77
|
+
`unexpected PeachEngine host import in the Swift SDK: ${module}.${name}`,
|
|
78
|
+
)
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
|
|
47
82
|
/** an input's identity across links: archive members lose their library prefix. */
|
|
48
83
|
export const chunkKey = (
|
|
49
84
|
chunk: WasmMapChunkIdentity,
|
package/src/swift-sdk-image.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
} from 'node:fs'
|
|
13
13
|
import path from 'node:path'
|
|
14
14
|
import { promisify } from 'node:util'
|
|
15
|
+
import { peachGuestServiceAllowlist } from '../../peach-kit/src/guest-engine-services'
|
|
15
16
|
import { fetchNativeEntry, nativeEntryKey } from './native-prebuilt'
|
|
16
17
|
import {
|
|
17
18
|
compileSwiftProjectUnit,
|
|
@@ -26,7 +27,12 @@ import { swiftModuleToolchain } from './swift-distribution'
|
|
|
26
27
|
import { SDK_DYLD_RESOLVER, type GuestImageObject } from './swift-guest-image-ledger'
|
|
27
28
|
import { withSwiftRootLock, withSwiftRootReadHolds } from './swift-root-lock'
|
|
28
29
|
import { swiftSdkGuestLookups } from './swift-sdk-guest-lookups'
|
|
29
|
-
import {
|
|
30
|
+
import {
|
|
31
|
+
assertPeachGuestEngineLink,
|
|
32
|
+
chunkKey,
|
|
33
|
+
readWasmLinkMap,
|
|
34
|
+
type WasmLinkMap,
|
|
35
|
+
} from './swift-sdk-image-map'
|
|
30
36
|
import {
|
|
31
37
|
SOURCE_SWIFT_FRAMEWORK_RECIPE,
|
|
32
38
|
SWIFT_SDK_IMAGE_VERSION,
|
|
@@ -564,6 +570,8 @@ async function linkSwiftSdkImage(
|
|
|
564
570
|
path.join(work, 'exports.rsp'),
|
|
565
571
|
[...defined].map((name) => quote(`--export-if-defined=${name}`)).join('\n'),
|
|
566
572
|
)
|
|
573
|
+
const guestServices = path.join(work, 'peach-guest-services.allow')
|
|
574
|
+
writeFileSync(guestServices, peachGuestServiceAllowlist)
|
|
567
575
|
const args = [
|
|
568
576
|
...link.flags,
|
|
569
577
|
`--global-base=${SWIFT_SDK_MEMORY_BASE}`,
|
|
@@ -575,6 +583,7 @@ async function linkSwiftSdkImage(
|
|
|
575
583
|
...lazy,
|
|
576
584
|
'--end-lib',
|
|
577
585
|
'--unresolved-symbols=ignore-all',
|
|
586
|
+
`--allow-undefined-file=${guestServices}`,
|
|
578
587
|
'--export-dynamic',
|
|
579
588
|
...[
|
|
580
589
|
'__peach_sdk_register',
|
|
@@ -607,8 +616,9 @@ async function linkSwiftSdkImage(
|
|
|
607
616
|
if (result.status === 'rejected') throw result.reason
|
|
608
617
|
}
|
|
609
618
|
const rawLink = readFileSync(linked)
|
|
610
|
-
const linkedBytes = lookups ? rawLink : orderObjCConstructors(rawLink)
|
|
611
619
|
const linkMap = readWasmLinkMap(map, true)
|
|
620
|
+
assertPeachGuestEngineLink(linkMap, rawLink)
|
|
621
|
+
const linkedBytes = lookups ? rawLink : orderObjCConstructors(rawLink)
|
|
612
622
|
const {
|
|
613
623
|
image: finished,
|
|
614
624
|
sdkInterface,
|