peachsim 0.1.1728 → 0.1.1744
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/README.md +4 -0
- package/cli/app-catalog.ts +47 -23
- package/cli/app-fonts.ts +19 -1
- package/cli/command-registry.ts +3 -0
- package/cli/commands/control.ts +68 -16
- package/cli/commands/coverage-swift.ts +112 -4
- package/cli/commands/device.ts +3 -1
- package/cli/commands/doctor.ts +1 -4
- package/cli/commands/inspect/settling.ts +6 -1
- package/cli/commands/inspect/wait-ready.ts +22 -2
- package/cli/commands/package.ts +33 -21
- package/cli/commands/push.ts +56 -0
- package/cli/commands/serve.ts +9 -0
- package/cli/commands/shell-url.ts +41 -9
- package/cli/commands/swift.ts +1 -1
- package/cli/current-sim.ts +27 -0
- package/cli/drivers/linux-browser-libs.lock.json +323 -1
- package/cli/drivers/linux-browser-libs.ts +8 -6
- package/cli/drivers/playwright.ts +5 -1
- package/cli/internal-child.ts +11 -1
- package/cli/main.ts +6 -0
- package/cli/native-input.ts +1 -7
- package/cli/outbound-endpoints.ts +9 -1
- package/cli/packaged-app-launcher.ts +3 -1
- package/cli/scene-video.ts +28 -7
- package/cli/ws-bridge.ts +3 -1
- package/detox/index.ts +18 -5
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +5 -2
- package/dist-lib/auth/shared-session.cjs +5 -2
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +9932 -4561
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +30 -8
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +6886 -3303
- package/dist-lib/expo-swift-metadata.cjs +14 -2
- package/dist-lib/expo-swift-metadata.mjs +14 -2
- package/dist-lib/home-paths.cjs +7 -2
- package/dist-lib/host/bridge-host.cjs +8513 -3085
- package/dist-lib/host/fetch-proxy-handler.cjs +19 -7
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +6 -3
- package/dist-lib/index.cjs +175 -80
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +209 -32
- package/dist-lib/menu.cjs +7 -1
- package/dist-lib/menu.mjs +7 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +146 -76
- package/dist-lib/native-app-identity-project.cjs +76 -39
- package/dist-lib/native-app-identity-project.mjs +76 -39
- package/dist-lib/native-app-identity.cjs +10 -3
- package/dist-lib/native-app-identity.mjs +10 -3
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +5 -2
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +25 -23
- package/dist-lib/public-origins-lib.json +138 -80
- package/dist-lib/react-native-host-modules.cjs +5 -2
- package/dist-lib/react-native-host-modules.mjs +5 -2
- package/dist-lib/reap-browser.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +4 -1
- package/dist-lib/sdk.mjs +4 -1
- package/dist-lib/skills.cjs +41126 -36493
- package/dist-lib/swift-compile.cjs +2103 -444
- package/dist-lib/swift-compile.mjs +2025 -369
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +2 -2
- package/dist-lib/swift-submit.mjs +2 -2
- package/dist-lib/swift-toolchain.cjs +84 -24
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +6094 -2687
- package/dist-lib/vite.cjs +32 -10
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-compat/src/stubs/screen-transition-math.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/cli-companion.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/canvaskit-renderer.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/engine/font-config.d.ts +7 -4
- package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +1 -3
- package/dist-types/packages/peach-engine/src/engine/liquid-glass.d.ts +0 -5
- package/dist-types/packages/peach-engine/src/engine/memory-counts.d.ts +8 -0
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +10 -1
- package/dist-types/packages/peach-engine/src/engine/paint-boundary.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/render-damage.d.ts +2 -2
- package/dist-types/packages/peach-engine/src/engine/scene-table.d.ts +25 -3
- package/dist-types/packages/peach-engine/src/engine/scroll-platform.d.ts +1 -15
- package/dist-types/packages/peach-engine/src/engine/scroll.d.ts +1 -3
- package/dist-types/packages/peach-engine/src/engine/text-first-baseline.d.ts +6 -0
- package/dist-types/packages/peach-engine/src/engine/text-paragraph.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/types.d.ts +23 -0
- package/dist-types/packages/peach-engine/src/ios/chrome-metrics.d.ts +6 -0
- package/dist-types/packages/peach-engine/src/metro-identity-contract.d.ts +33 -0
- package/dist-types/packages/peach-engine/src/native-preview-bundle.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/preview/bundle-layout.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/remote-stream/scene-recording.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/render-worker/compositor-gpu.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/render-worker/metro-bundle-metadata.d.ts +28 -0
- package/dist-types/packages/peach-engine/src/render-worker/native-ui-protocol.d.ts +21 -1
- package/dist-types/packages/peach-engine/src/render-worker/prepared-boot-bundle.d.ts +7 -0
- package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +15 -2
- package/dist-types/packages/peach-engine/src/render-worker/scroll-mirror.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/render-worker/shell-protocol.d.ts +6 -0
- package/dist-types/packages/peach-engine/src/render-worker/test-bridge-protocol.d.ts +3 -3
- package/dist-types/packages/peach-engine/src/render-worker/webgpu-frame-transaction.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/render-worker/webgpu-readback-scheduler.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +14 -1
- package/dist-types/packages/peach-engine/src/rolldown-bundle-inventory.d.ts +8 -1
- package/dist-types/packages/peach-engine/src/rolldown-production-fingerprint.d.ts +1 -4
- package/dist-types/packages/peach-engine/src/rolldown-production-module.d.ts +12 -0
- package/dist-types/packages/peach-engine/src/rolldown-production-roles.d.ts +6 -0
- package/dist-types/packages/peach-engine/src/settings/devices.d.ts +6 -1
- package/dist-types/packages/peach-engine/src/settings/duo-fold-bus.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/shell-events.d.ts +4 -0
- package/dist-types/packages/peach-kit/src/capabilities.d.ts +8 -0
- package/kotlin/README.md +3 -0
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +2 -1
- package/runtime-companion.json +1 -1
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccount.h +55 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountCredential.h +35 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountStore.h +94 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountType.h +53 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACError.h +37 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/Accounts.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/AccountsDefines.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Modules/module.modulemap +5 -0
- package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetwork.h +1 -0
- package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetworkErrors.h +257 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFByteOrder.h +305 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +2 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGAffineTransform.h +204 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBitmapContext.h +260 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGColor.h +164 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGColorConversionInfo.h +101 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGColorSpace.h +510 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGContext.h +1132 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGConvertColorDataWithFormat.h +34 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDataConsumer.h +83 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDataProvider.h +197 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGEXRToneMappingGamma.h +36 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGError.h +38 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGFont.h +312 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGFunction.h +106 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGGradient.h +123 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGITUToneMapping.h +31 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGImage.h +409 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGLayer.h +78 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFArray.h +120 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFContentStream.h +55 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFContext.h +535 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFDictionary.h +133 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFDocument.h +252 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFMarkedContentItem.h +37 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFObject.h +67 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFOperatorTable.h +51 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFPage.h +101 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFScanner.h +123 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFStream.h +44 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFString.h +52 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFStructureElement.h +87 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPath.h +441 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPattern.h +89 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGRenderingBufferProvider.h +49 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGShading.h +124 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGToneMapping.h +85 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h +44 -252
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Modules/module.modulemap +1 -0
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/CFNetworkErrors.h +257 -0
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes +58 -9
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +992 -98
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/NSURLSession+Network.h +32 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/Network.h +51 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/advertise_descriptor.h +193 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/browse_descriptor.h +163 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/browse_result.h +207 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/browser.h +285 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/connection.h +714 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/connection_group.h +629 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/connection_report.h +932 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/content_context.h +229 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/endpoint.h +390 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/error.h +135 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/ethernet_channel.h +349 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/framer_options.h +1187 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/group_descriptor.h +184 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/interface.h +150 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/ip_options.h +351 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/listener.h +438 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/nw_object.h +200 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/parameters.h +1205 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/path.h +392 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/path_monitor.h +216 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/privacy_context.h +188 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/protocol_options.h +126 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/proxy_config.h +357 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/quic_options.h +889 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/resolver_config.h +94 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/tcp_options.h +459 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/tls_options.h +115 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/txt_record.h +432 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/udp_options.h +112 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Headers/ws_options.h +743 -0
- package/sdk/ios/System/Library/Frameworks/Network.framework/Modules/module.modulemap +9 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAAnimation.h +395 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CABase.h +132 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CADisplayLink.h +107 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAEmitterCell.h +153 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAEmitterLayer.h +151 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAFrameRateRange.h +40 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAGradientLayer.h +78 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CALayer.h +1078 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAMediaTiming.h +97 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAMediaTimingFunction.h +67 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAReplicatorLayer.h +65 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAScrollLayer.h +64 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAShapeLayer.h +135 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATextLayer.h +99 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATiledLayer.h +67 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATransaction.h +124 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATransform3D.h +138 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CATransformLayer.h +40 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CAValueFunction.h +78 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.h +19 -38
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecureTransport.h +1757 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/NSAttributedString.h +19 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/NSParagraphStyle.h +28 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibilityConstants.h +114 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h +16 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIBarAppearance.h +47 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIDataDetectors.h +20 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIDatePicker.h +13 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h +16 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIEvent.h +84 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIGestureRecognizer.h +119 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIGestureRecognizerSubclass.h +66 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIHoverGestureRecognizer.h +45 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h +161 -37
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIPickerView.h +76 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITabBar.h +8 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITabBarAppearance.h +78 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITextInputTraits.h +29 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITouch.h +104 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITraitCollection.h +19 -0
- package/sdk/ios/usr/include/dns_sd.h +3616 -0
- package/sdk/ios/usr/include/dnssd.modulemap +4 -0
- package/sdk/ios/usr/include/module.modulemap +1 -0
- package/sdk/ios/usr/include/os/signpost.h +414 -0
- package/sdk/ios/usr/include/os.modulemap +5 -0
- package/sdk/ios/usr/include/sys/socketvar.h +191 -0
- package/sdk/ios/usr/include/sys/vsock.h +84 -0
- package/sdk/ios/wasm/include/errno.h +4 -20
- package/sdk/ios/wasm/include/pthread.h +3 -0
- package/sdk/ios/wasm/include/setjmp.h +57 -0
- package/sdk/ios/wasm/include/sys/resource.h +2 -2
- package/sdk/native-hashes.json +3 -3
- package/skills/contrast/SKILL.md +6 -5
- package/skills/peach-debug/SKILL.md +68 -265
- package/skills/peach-debug/references/accessibility.md +37 -73
- package/skills/peach-debug/references/commands.md +2 -2
- package/skills/peach-debug/references/events.md +74 -0
- package/skills/peach-perf/SKILL.md +64 -402
- package/skills/peach-perf/references/presentation.md +46 -0
- package/skills/peach-perf/references/profiling.md +93 -0
- package/skills/peach-perf/references/render-counters.md +57 -0
- package/skills/peach-setup/SKILL.md +66 -217
- package/skills/peach-setup/references/native-config.md +35 -0
- package/skills/peach-setup/references/reporting.md +28 -0
- package/skills/peach-test/SKILL.md +68 -285
- package/skills/peach-test/references/detox.md +69 -0
- package/skills/peach-test/references/maestro.md +95 -0
- package/skills/peach-visual/SKILL.md +53 -106
- package/src/android-autolinking.ts +1 -0
- package/src/android-bridge-packages.ts +279 -0
- package/src/appPackageContract.ts +14 -1
- package/src/assetCatalogContract.ts +8 -1
- package/src/bridge-contract.ts +6 -0
- package/src/bundle-channel.mjs +152 -60
- package/src/cli-runtime.ts +3 -0
- package/src/configured-bundle-producer.ts +10 -0
- package/src/device-catalog.ts +68 -4
- package/src/expo-discovery-cache.ts +10 -3
- package/src/expo-kotlin-host.ts +97 -26
- package/src/expo-native-workspace.ts +211 -52
- package/src/expo-swift-host.ts +149 -123
- package/src/expo-swift-ready.ts +5 -1
- package/src/expo-widget-assets.ts +76 -0
- package/src/expoKotlinContract.ts +12 -2
- package/src/expoSwiftContract.ts +21 -2
- package/src/generated/swift-c-predefines.json +1 -1
- package/src/home-paths.ts +6 -1
- package/src/host/bridge-host.ts +5 -0
- package/src/host/fetch-proxy-handler.ts +10 -0
- package/src/host/websocket-proxy.ts +7 -2
- package/src/kotlin-host.ts +204 -30
- package/src/kotlinSdkContract.ts +2 -1
- package/src/menu.ts +7 -0
- package/src/native-prebuilt.ts +154 -0
- package/src/nitro-adapter.lock.json +261 -261
- package/src/nitro-adapter.ts +118 -50
- package/src/nitro-bundle.ts +134 -96
- package/src/nitro-compile.ts +16 -6
- package/src/nitro-dependencies.ts +43 -28
- package/src/nitro-source.ts +142 -30
- package/src/nitro-superset.lock.json +103 -0
- package/src/nitro-superset.ts +137 -0
- package/src/nitroAdapterContract.ts +146 -98
- package/src/nitroContract.ts +68 -21
- package/src/react-bridge-importers.ts +1 -0
- package/src/react-native-bridge-modules.ts +2 -0
- package/src/react-native-host-modules.ts +4 -1
- package/src/settingsContract.ts +37 -1
- package/src/storageSnapshotContract.ts +29 -81
- package/src/swift-compile.ts +315 -117
- package/src/swift-compiler-digest.ts +2 -0
- package/src/swift-coverage/indexdump.ts +22 -6
- package/src/swift-coverage/indexing.ts +4 -4
- package/src/swift-coverage/sdk.ts +104 -20
- package/src/swift-coverage/types.ts +34 -0
- package/src/swift-coverage/xcode-packages.ts +61 -1
- package/src/swift-coverage/xcode.ts +19 -13
- package/src/swift-cxx-reachable.ts +1 -1
- package/src/swift-distribution.lock.json +18 -13
- package/src/swift-distribution.ts +57 -26
- package/src/swift-host.ts +51 -35
- package/src/swift-link-roots.ts +45 -18
- package/src/swift-objc-compile.ts +78 -2
- package/src/swift-objc-standin.ts +3 -0
- package/src/swift-shared-sdk.ts +85 -1
- package/src/swift-standin-emit.ts +6 -1
- package/src/swift-standins.ts +403 -19
- package/src/swift-submit.ts +17 -1
- package/src/swift-toolchain.ts +98 -23
- package/src/swift-wasm-prune.ts +1629 -0
- package/src/turbo-bundle.ts +82 -0
- package/src/turbo-compile.ts +120 -0
- package/src/turbo-runtime.lock.json +69 -0
- package/src/turbo-source.ts +754 -0
- package/src/vite-plugin-one.ts +15 -3
- package/src/vite-plugin.ts +82 -23
- package/src/wasm-optimize.ts +34 -0
- package/src/worker-system-chunks.ts +3 -3
- package/src/xcode-project.ts +52 -0
- package/src/xcode-target-members.ts +12 -1
package/src/swift-compile.ts
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
type ExecFileOptions,
|
|
5
5
|
type SpawnOptions,
|
|
6
6
|
} from 'node:child_process'
|
|
7
|
-
import { createHash } from 'node:crypto'
|
|
7
|
+
import { createHash, randomUUID } from 'node:crypto'
|
|
8
8
|
import {
|
|
9
9
|
cpSync,
|
|
10
10
|
existsSync,
|
|
@@ -62,7 +62,11 @@ import {
|
|
|
62
62
|
type SwiftPackageTarget,
|
|
63
63
|
} from './swift-package'
|
|
64
64
|
import { withSwiftRootLock, type SwiftRootLease } from './swift-root-lock'
|
|
65
|
-
import {
|
|
65
|
+
import {
|
|
66
|
+
swiftSharedSdkInputFiles,
|
|
67
|
+
swiftSharedSdkRoot,
|
|
68
|
+
swiftSharedSdkViewOptions,
|
|
69
|
+
} from './swift-shared-sdk'
|
|
66
70
|
import {
|
|
67
71
|
sourceSwiftCheckout,
|
|
68
72
|
SWIFT_AUTOLINK_LINKER,
|
|
@@ -73,6 +77,7 @@ import {
|
|
|
73
77
|
writeSwiftAutolinkLinker,
|
|
74
78
|
type SwiftWasmSdk,
|
|
75
79
|
} from './swift-toolchain'
|
|
80
|
+
import { pruneSwiftWasmLink } from './swift-wasm-prune'
|
|
76
81
|
import {
|
|
77
82
|
isSwiftNativeTargets,
|
|
78
83
|
isSwiftPackageFiles,
|
|
@@ -85,6 +90,7 @@ import {
|
|
|
85
90
|
type SwiftNativeTarget,
|
|
86
91
|
type SwiftProjectPreparation,
|
|
87
92
|
} from './swiftContract'
|
|
93
|
+
import { optimizeWasm, WASM_OPTIMIZE_IDENTITY } from './wasm-optimize'
|
|
88
94
|
import { writeXcodeHeaderSearch } from './xcode-header-search'
|
|
89
95
|
import type { SwiftImageUpload } from './swift-submit'
|
|
90
96
|
import type { SwiftResourceBundle } from './swiftContract'
|
|
@@ -297,6 +303,53 @@ export function swiftDistributionAt(root: string): SwiftDistributionManifest | n
|
|
|
297
303
|
return parseSwiftDistributionManifest(JSON.parse(readFileSync(file, 'utf8')))
|
|
298
304
|
}
|
|
299
305
|
|
|
306
|
+
/**
|
|
307
|
+
* the Objective-C interface an SDK module defines: the names Swift owns and
|
|
308
|
+
* its generated header. a distribution ships the header; a source checkout
|
|
309
|
+
* names them by `@objc(Name)` and builds the header with the module
|
|
310
|
+
* (`.build/host`), so it stands as an empty header until that build.
|
|
311
|
+
*/
|
|
312
|
+
export function swiftModuleInterface(
|
|
313
|
+
moduleRoot: string,
|
|
314
|
+
name: string,
|
|
315
|
+
): { declared: ReadonlySet<string>; header: string } | null {
|
|
316
|
+
if (swiftDistributionAt(moduleRoot)) {
|
|
317
|
+
const file = path.join(moduleRoot, 'modules', `${name}-Swift.h`)
|
|
318
|
+
if (!existsSync(file)) return null
|
|
319
|
+
const header = clangInterfaceHeader(readFileSync(file, 'utf8'))
|
|
320
|
+
return { declared: swiftInterfaceDeclarations(header), header }
|
|
321
|
+
}
|
|
322
|
+
const sources = path.join(moduleRoot, 'Sources', name)
|
|
323
|
+
if (!existsSync(sources)) return null
|
|
324
|
+
const declared = new Set<string>()
|
|
325
|
+
for (const file of readdirSync(sources, { recursive: true, encoding: 'utf8' }))
|
|
326
|
+
if (file.endsWith('.swift'))
|
|
327
|
+
for (const [, objc] of readFileSync(path.join(sources, file), 'utf8').matchAll(
|
|
328
|
+
/@objc\((\w+)\)\s+(?:\w+\s+)*?(?:protocol|class)\s/g,
|
|
329
|
+
))
|
|
330
|
+
declared.add(objc!)
|
|
331
|
+
if (declared.size === 0) return null
|
|
332
|
+
const built = path.join(moduleRoot, '.build/host', `${name}-Swift.h`)
|
|
333
|
+
return {
|
|
334
|
+
declared,
|
|
335
|
+
header: existsSync(built)
|
|
336
|
+
? clangInterfaceHeader(readFileSync(built, 'utf8'))
|
|
337
|
+
: `// ${name}-Swift.h is generated when ${name} builds\n`,
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// the compiler imports the module that defines a type, and UIKit's declarations
|
|
342
|
+
// live in UIKitCore, which only the umbrella UIKit module represents to clang.
|
|
343
|
+
const clangInterfaceHeader = (header: string): string =>
|
|
344
|
+
header.replace(/^@import UIKitCore;$/m, '@import UIKit;')
|
|
345
|
+
|
|
346
|
+
/** the Objective-C protocols and classes a generated interface header defines. */
|
|
347
|
+
const swiftInterfaceDeclarations = (header: string): Set<string> =>
|
|
348
|
+
new Set([
|
|
349
|
+
...[...header.matchAll(/^@protocol\s+(\w+)\b(?![^\n]*;\s*$)/gm)].map((m) => m[1]!),
|
|
350
|
+
...[...header.matchAll(/^@interface\s+(\w+)\s*(?=[:<{]|$)/gm)].map((m) => m[1]!),
|
|
351
|
+
])
|
|
352
|
+
|
|
300
353
|
/** the wasm SDK a module root compiles with: a distribution's manifest names
|
|
301
354
|
* it, a source checkout's toolchain.json pins it. */
|
|
302
355
|
export function swiftModuleSdk(root: string): SwiftWasmSdk {
|
|
@@ -308,6 +361,20 @@ export function swiftModuleSdk(root: string): SwiftWasmSdk {
|
|
|
308
361
|
}
|
|
309
362
|
}
|
|
310
363
|
|
|
364
|
+
/** swiftpm's sdk option for a compile against `moduleRoot`: the installed
|
|
365
|
+
* sdk seen through the module root's shared framework headers. */
|
|
366
|
+
export function swiftCompileSdkOptions(
|
|
367
|
+
moduleRoot: string,
|
|
368
|
+
toolchainBin: string,
|
|
369
|
+
): string[] {
|
|
370
|
+
return swiftSharedSdkViewOptions(
|
|
371
|
+
moduleRoot,
|
|
372
|
+
swiftDistributionAt(moduleRoot) !== null,
|
|
373
|
+
toolchainBin,
|
|
374
|
+
swiftModuleSdk(moduleRoot).wasmSdkId,
|
|
375
|
+
)
|
|
376
|
+
}
|
|
377
|
+
|
|
311
378
|
// toolchain.json is an input for its wasm sdk checksum: the sdk's icu blob,
|
|
312
379
|
// which the host fills into every artifact, is part of what the address names.
|
|
313
380
|
// distribution producers are inputs so repaired builds get a fresh immutable id.
|
|
@@ -318,6 +385,7 @@ export function swiftModuleInputFiles(root: string): string[] {
|
|
|
318
385
|
...swiftSharedSdkInputFiles(root),
|
|
319
386
|
'../peachsim/src/swift-shared-sdk.ts',
|
|
320
387
|
'../../scripts/generate/swift-sdk-module/darwin-mach.json',
|
|
388
|
+
'../../scripts/generate/swift-sdk-module/darwin-socketvar.json',
|
|
321
389
|
'../../scripts/ops/swift-distribution-publish.ts',
|
|
322
390
|
'Package.swift',
|
|
323
391
|
'scripts/contrast-app-Package.swift',
|
|
@@ -519,6 +587,8 @@ export function withNativeSourceGlue(
|
|
|
519
587
|
|
|
520
588
|
// optional families link only into an app whose sources import them, each
|
|
521
589
|
// with the optional families it depends on (packages/sootsim-swift/Package.swift).
|
|
590
|
+
// a family a base framework depends on is base too: CoreGraphics decodes
|
|
591
|
+
// through PeachCodec, so PeachCodec links into every app.
|
|
522
592
|
const OPTIONAL_FRAMEWORK_DEPENDENCIES: Record<string, string[]> = {
|
|
523
593
|
GameplayKit: [],
|
|
524
594
|
simd: [],
|
|
@@ -530,9 +600,8 @@ const OPTIONAL_FRAMEWORK_DEPENDENCIES: Record<string, string[]> = {
|
|
|
530
600
|
ImagePlayground: [],
|
|
531
601
|
QuickLookThumbnailing: [],
|
|
532
602
|
libxml2: [],
|
|
533
|
-
Compression: [
|
|
534
|
-
zlib: [
|
|
535
|
-
PeachCodec: [],
|
|
603
|
+
Compression: [],
|
|
604
|
+
zlib: [],
|
|
536
605
|
TikTokBusinessSDK: [],
|
|
537
606
|
nSure: [],
|
|
538
607
|
Statsig: [],
|
|
@@ -762,7 +831,8 @@ export function swiftSdkPaths(
|
|
|
762
831
|
cFlags: string[]
|
|
763
832
|
} {
|
|
764
833
|
const sdk = swiftModuleSdk(moduleRoot).wasmSdkId
|
|
765
|
-
const
|
|
834
|
+
const options = swiftCompileSdkOptions(moduleRoot, toolchainBin)
|
|
835
|
+
const key = JSON.stringify([toolchainBin, sdk, options])
|
|
766
836
|
const cached = sdkPaths.get(key)
|
|
767
837
|
if (cached) return cached
|
|
768
838
|
const configuration = execFileSync(
|
|
@@ -770,7 +840,7 @@ export function swiftSdkPaths(
|
|
|
770
840
|
[
|
|
771
841
|
'sdk',
|
|
772
842
|
'configure',
|
|
773
|
-
...
|
|
843
|
+
...options,
|
|
774
844
|
'--show-configuration',
|
|
775
845
|
sdk,
|
|
776
846
|
'wasm32-unknown-wasip1',
|
|
@@ -1072,7 +1142,7 @@ const executableLinkFlags = (root: string) => ` "-Xclang-linker", "-O0"
|
|
|
1072
1142
|
const REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n'
|
|
1073
1143
|
|
|
1074
1144
|
/** bump with any change to the emitted multi-target manifest text. */
|
|
1075
|
-
export const MULTI_MANIFEST_VERSION =
|
|
1145
|
+
export const MULTI_MANIFEST_VERSION = 51
|
|
1076
1146
|
|
|
1077
1147
|
// build-cli replaces this in every bundle; source runs read the files directly.
|
|
1078
1148
|
declare const __SWIFT_COMPILER_DIGEST__: string | undefined
|
|
@@ -1091,7 +1161,8 @@ export function swiftArtifactHash(
|
|
|
1091
1161
|
hash.update(compilerSourceDigest)
|
|
1092
1162
|
if (input.oneModule) hash.update('one-module\n')
|
|
1093
1163
|
hash.update(swiftModuleDigest(moduleRoot))
|
|
1094
|
-
if (input.lazyDistribution)
|
|
1164
|
+
if (input.lazyDistribution)
|
|
1165
|
+
hash.update(`lazy-distribution\n${WASM_OPTIMIZE_IDENTITY}\n`)
|
|
1095
1166
|
for (const file of Object.keys(input.files).sort()) {
|
|
1096
1167
|
hash.update(createHash('sha256').update(file).digest())
|
|
1097
1168
|
hash.update(createHash('sha256').update(input.files[file]).digest())
|
|
@@ -1320,7 +1391,12 @@ export function emitSwiftPackageManifest(args: {
|
|
|
1320
1391
|
? [
|
|
1321
1392
|
...objects.filter((object) => roots.has(object)).map(quoted),
|
|
1322
1393
|
'-Wl,--start-lib',
|
|
1323
|
-
...objects
|
|
1394
|
+
...objects
|
|
1395
|
+
.filter(
|
|
1396
|
+
(object) =>
|
|
1397
|
+
!roots.has(object) && object !== 'lib/Foundation-NSStringFormatting.o',
|
|
1398
|
+
)
|
|
1399
|
+
.map(quoted),
|
|
1324
1400
|
'-Wl,--end-lib',
|
|
1325
1401
|
]
|
|
1326
1402
|
: objects.map(quoted)
|
|
@@ -1645,8 +1721,7 @@ export function syncSwiftTree(base: string, files: Map<string, string | Buffer>)
|
|
|
1645
1721
|
dir === base &&
|
|
1646
1722
|
(entry.name === '.build' ||
|
|
1647
1723
|
entry.name.startsWith('.peach-modules-') ||
|
|
1648
|
-
entry.name === SWIFT_LINK_STAMP
|
|
1649
|
-
entry.name === SWIFT_FRAMEWORK_KEY)
|
|
1724
|
+
entry.name === SWIFT_LINK_STAMP)
|
|
1650
1725
|
)
|
|
1651
1726
|
continue
|
|
1652
1727
|
if (entry.isDirectory()) walk(full)
|
|
@@ -1690,7 +1765,7 @@ const DELEGATE_CLASS =
|
|
|
1690
1765
|
// init(style:reuseIdentifier:) and the header footer view's
|
|
1691
1766
|
// init(reuseIdentifier:).
|
|
1692
1767
|
const REUSABLE_INIT =
|
|
1693
|
-
/^override(?=\s+init\s*\(\s*(?:style\s*:[^,)]*,\s*reuseIdentifier|reuseIdentifier)\s*:)/
|
|
1768
|
+
/^override(?=\s+(?:(?:public|open|internal)\s+)?init\s*\(\s*(?:style\s*:[^,)]*,\s*reuseIdentifier|reuseIdentifier)\s*:)/
|
|
1694
1769
|
// a collection view makes its cells and supplementary views with
|
|
1695
1770
|
// init(frame:), so inside a class that inherits from one, directly or
|
|
1696
1771
|
// through a class declared earlier in the file, an override of it says
|
|
@@ -1894,34 +1969,12 @@ export function swiftCodeMask(source: string): string {
|
|
|
1894
1969
|
|
|
1895
1970
|
// darwin declares these in Foundation; the guest networking module owns them.
|
|
1896
1971
|
const FOUNDATION_NETWORKING_TYPES = new Set([
|
|
1897
|
-
'CachedURLResponse',
|
|
1898
|
-
'HTTPCookieStorage',
|
|
1899
|
-
'NSMutableURLRequest',
|
|
1900
1972
|
'NSURLConnection',
|
|
1901
1973
|
'NSURLConnectionDataDelegate',
|
|
1902
1974
|
'NSURLConnectionDelegate',
|
|
1903
1975
|
'NSURLConnectionDownloadDelegate',
|
|
1904
|
-
'URLCache',
|
|
1905
|
-
'URLCredentialStorage',
|
|
1906
1976
|
'URLProtocol',
|
|
1907
1977
|
'URLProtocolClient',
|
|
1908
|
-
'URLRequest',
|
|
1909
|
-
'URLSession',
|
|
1910
|
-
'URLSessionConfiguration',
|
|
1911
|
-
'URLSessionDataDelegate',
|
|
1912
|
-
'URLSessionDataTask',
|
|
1913
|
-
'URLSessionDelegate',
|
|
1914
|
-
'URLSessionDownloadDelegate',
|
|
1915
|
-
'URLSessionDownloadTask',
|
|
1916
|
-
'URLSessionStreamDelegate',
|
|
1917
|
-
'URLSessionStreamTask',
|
|
1918
|
-
'URLSessionTask',
|
|
1919
|
-
'URLSessionTaskDelegate',
|
|
1920
|
-
'URLSessionTaskMetrics',
|
|
1921
|
-
'URLSessionTaskTransactionMetrics',
|
|
1922
|
-
'URLSessionUploadTask',
|
|
1923
|
-
'URLSessionWebSocketDelegate',
|
|
1924
|
-
'URLSessionWebSocketTask',
|
|
1925
1978
|
])
|
|
1926
1979
|
|
|
1927
1980
|
// Foundation overlay declarations live in the shared guest overlay module.
|
|
@@ -1949,6 +2002,7 @@ const FOUNDATION_OVERLAY_TYPES = new Set([
|
|
|
1949
2002
|
'NSCollectionChangeType',
|
|
1950
2003
|
'NSConditionLock',
|
|
1951
2004
|
'NSDataDetector',
|
|
2005
|
+
'NSErrorPointer',
|
|
1952
2006
|
'NSException',
|
|
1953
2007
|
'NSExtensionContext',
|
|
1954
2008
|
'NSExtensionItem',
|
|
@@ -2041,8 +2095,6 @@ const FOUNDATION_OVERLAY_TYPES = new Set([
|
|
|
2041
2095
|
'URLUbiquitousSharedItemRole',
|
|
2042
2096
|
'UndoManager',
|
|
2043
2097
|
'ValueTransformer',
|
|
2044
|
-
'XMLParser',
|
|
2045
|
-
'XMLParserDelegate',
|
|
2046
2098
|
])
|
|
2047
2099
|
|
|
2048
2100
|
// existing overlay globals retain their declaration and runtime owner.
|
|
@@ -2413,7 +2465,6 @@ const FOUNDATION_OVERLAY_GLOBALS = new Set([
|
|
|
2413
2465
|
'NSUnicodeStringEncoding',
|
|
2414
2466
|
'NSUserActivityErrorMaximum',
|
|
2415
2467
|
'NSUserActivityErrorMinimum',
|
|
2416
|
-
'NSUserActivityTypeBrowsingWeb',
|
|
2417
2468
|
'NSValidationErrorMaximum',
|
|
2418
2469
|
'NSValidationErrorMinimum',
|
|
2419
2470
|
'NSWindows95OperatingSystem',
|
|
@@ -2590,6 +2641,26 @@ const CORE_FOUNDATION_HANDLE_IMPORTS = [
|
|
|
2590
2641
|
])
|
|
2591
2642
|
.join('; ')
|
|
2592
2643
|
|
|
2644
|
+
// the guest module that owns a name darwin's Foundation declares
|
|
2645
|
+
export function foundationOwnerOf(name: string): string | undefined {
|
|
2646
|
+
if (
|
|
2647
|
+
name === 'NSClassFromString' ||
|
|
2648
|
+
name === 'NSKeyValueChange' ||
|
|
2649
|
+
name === 'NSKeyValueObservedChange' ||
|
|
2650
|
+
name === 'NSKeyValueObservation'
|
|
2651
|
+
)
|
|
2652
|
+
return 'PeachObjC'
|
|
2653
|
+
if (name === 'DispatchData') return 'Dispatch'
|
|
2654
|
+
if (FOUNDATION_NETWORKING_TYPES.has(name)) return 'FoundationNetworking'
|
|
2655
|
+
if (
|
|
2656
|
+
FOUNDATION_OVERLAY_TYPES.has(name) ||
|
|
2657
|
+
FOUNDATION_OVERLAY_GLOBALS.has(name) ||
|
|
2658
|
+
CORE_FOUNDATION_OVERLAY_GLOBALS.has(name)
|
|
2659
|
+
)
|
|
2660
|
+
return 'PeachFoundation'
|
|
2661
|
+
return undefined
|
|
2662
|
+
}
|
|
2663
|
+
|
|
2593
2664
|
export function swiftSourceAsIOS(source: string): string {
|
|
2594
2665
|
const { lineStarts, tokens } = swiftCodeScan(source)
|
|
2595
2666
|
let offset = 0
|
|
@@ -2665,25 +2736,8 @@ export function swiftSourceAsIOS(source: string): string {
|
|
|
2665
2736
|
const foundationMember =
|
|
2666
2737
|
/^Foundation\s*\.\s*(?:`([A-Za-z_]\w*)`|([A-Za-z_]\w*)\b)/.exec(rest)
|
|
2667
2738
|
const foundationName = foundationMember?.[1] ?? foundationMember?.[2]
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
if (
|
|
2671
|
-
foundationName === 'NSClassFromString' ||
|
|
2672
|
-
foundationName === 'NSKeyValueChange' ||
|
|
2673
|
-
foundationName === 'NSKeyValueObservedChange' ||
|
|
2674
|
-
foundationName === 'NSKeyValueObservation'
|
|
2675
|
-
)
|
|
2676
|
-
foundationOwner = 'PeachObjC'
|
|
2677
|
-
else if (foundationName === 'DispatchData') foundationOwner = 'Dispatch'
|
|
2678
|
-
else if (FOUNDATION_NETWORKING_TYPES.has(foundationName))
|
|
2679
|
-
foundationOwner = 'FoundationNetworking'
|
|
2680
|
-
else if (
|
|
2681
|
-
FOUNDATION_OVERLAY_TYPES.has(foundationName) ||
|
|
2682
|
-
FOUNDATION_OVERLAY_GLOBALS.has(foundationName) ||
|
|
2683
|
-
CORE_FOUNDATION_OVERLAY_GLOBALS.has(foundationName)
|
|
2684
|
-
)
|
|
2685
|
-
foundationOwner = 'PeachFoundation'
|
|
2686
|
-
}
|
|
2739
|
+
const foundationOwner =
|
|
2740
|
+
foundationName === undefined ? undefined : foundationOwnerOf(foundationName)
|
|
2687
2741
|
if (foundationOwner !== undefined) {
|
|
2688
2742
|
out += conditioned.slice(copied, at) + foundationOwner
|
|
2689
2743
|
copied = at + 'Foundation'.length
|
|
@@ -3363,11 +3417,14 @@ const HIDDEN_UNITS = 'PeachHiddenUnits'
|
|
|
3363
3417
|
// `-I` and no map file, so `@import` fails. the map passed here umbrellas
|
|
3364
3418
|
// those headers from outside the directory. a second map once
|
|
3365
3419
|
// `module.modulemap` sits in a searched directory redefines the module
|
|
3366
|
-
// (Xcode 27.1 clang).
|
|
3420
|
+
// (Xcode 27.1 clang). a dependency staged after its consumer has no map on
|
|
3421
|
+
// disk yet, so each generated map is recorded and forwards to the published
|
|
3422
|
+
// one once the whole project is staged.
|
|
3367
3423
|
function clangImportModuleMapFlags(
|
|
3368
3424
|
settings: SwiftNativeTarget,
|
|
3369
3425
|
layoutRoot: string,
|
|
3370
3426
|
written: Map<string, string>,
|
|
3427
|
+
generated: { output: string; module: string; published: string }[],
|
|
3371
3428
|
): string[] {
|
|
3372
3429
|
const searched = new Set(settings.headerSearchPaths)
|
|
3373
3430
|
const directory = path.join(layoutRoot, '.build', 'peach-clang-modulemaps')
|
|
@@ -3389,6 +3446,7 @@ function clangImportModuleMapFlags(
|
|
|
3389
3446
|
path: headers,
|
|
3390
3447
|
}),
|
|
3391
3448
|
)
|
|
3449
|
+
generated.push({ output, module: swiftTargetModuleName(map.module), published })
|
|
3392
3450
|
const flag = `-fmodule-map-file=${output}`
|
|
3393
3451
|
written.set(headers, flag)
|
|
3394
3452
|
return [flag]
|
|
@@ -3443,8 +3501,17 @@ export function writeSwiftProject(
|
|
|
3443
3501
|
},
|
|
3444
3502
|
]
|
|
3445
3503
|
: compileTargets(input)
|
|
3504
|
+
// an app target named like an optional sdk family replaces that family, so
|
|
3505
|
+
// the sdk's swift module must not stay on the module search path.
|
|
3446
3506
|
const distributionExcludes = distribution
|
|
3447
|
-
?
|
|
3507
|
+
? new Set([
|
|
3508
|
+
...swiftSystemLibraryExclusions(input.files, targets, distribution.modules),
|
|
3509
|
+
...distribution.modules.filter(
|
|
3510
|
+
(name) =>
|
|
3511
|
+
OPTIONAL_FRAMEWORKS.has(name) &&
|
|
3512
|
+
targets.some((target) => target.name === name),
|
|
3513
|
+
),
|
|
3514
|
+
])
|
|
3448
3515
|
: undefined
|
|
3449
3516
|
const files = new Map<string, string | Buffer>()
|
|
3450
3517
|
const native = new Map<string, SwiftNativeTargetPlan>()
|
|
@@ -3463,15 +3530,23 @@ export function writeSwiftProject(
|
|
|
3463
3530
|
// swiftpm builds a clang target's module only for an importer: a swift
|
|
3464
3531
|
// import, or a framework-style include or @import in any original source.
|
|
3465
3532
|
const importedModules = new Set<string>()
|
|
3533
|
+
const swiftImportedModules = new Set<string>()
|
|
3534
|
+
const clangImportedModules = new Set<string>()
|
|
3466
3535
|
for (const [file, contents] of Object.entries(input.files)) {
|
|
3467
3536
|
if (file.endsWith('.swift'))
|
|
3468
|
-
for (const name of swiftImportNames(contents))
|
|
3537
|
+
for (const name of swiftImportNames(contents)) {
|
|
3538
|
+
importedModules.add(name)
|
|
3539
|
+
swiftImportedModules.add(name)
|
|
3540
|
+
}
|
|
3469
3541
|
else if (
|
|
3470
3542
|
SWIFT_NATIVE_SOURCE_EXTENSIONS.some(
|
|
3471
3543
|
(extension) => extension !== '.modulemap' && file.endsWith(extension),
|
|
3472
3544
|
)
|
|
3473
3545
|
)
|
|
3474
|
-
for (const name of clangImportNames(contents))
|
|
3546
|
+
for (const name of clangImportNames(contents)) {
|
|
3547
|
+
importedModules.add(name)
|
|
3548
|
+
clangImportedModules.add(name)
|
|
3549
|
+
}
|
|
3475
3550
|
}
|
|
3476
3551
|
const headerDirectory = path.join(layout.root, '.build', 'peach-cxx-headers')
|
|
3477
3552
|
let checkedToolchain: string | undefined
|
|
@@ -3568,7 +3643,14 @@ export function writeSwiftProject(
|
|
|
3568
3643
|
// publishes; a swiftpm target's stay under its public headers directory.
|
|
3569
3644
|
for (const settings of input.nativeTargets ?? []) {
|
|
3570
3645
|
for (const file of settings.headers) {
|
|
3571
|
-
|
|
3646
|
+
// a source checkout's interface header exists once its module built,
|
|
3647
|
+
// after the input was cut; the staged copy stands in until then
|
|
3648
|
+
const interfaceModule = /(?:^|\/)(\w+)\.framework\/Headers\/\1-Swift\.h$/.exec(
|
|
3649
|
+
file,
|
|
3650
|
+
)?.[1]
|
|
3651
|
+
const contents =
|
|
3652
|
+
(interfaceModule && swiftModuleInterface(moduleRoot, interfaceModule)?.header) ||
|
|
3653
|
+
input.files[file]
|
|
3572
3654
|
if (contents === undefined)
|
|
3573
3655
|
throw new Error(`missing original Objective-C header ${file}`)
|
|
3574
3656
|
const destination = path.join(layout.root, file)
|
|
@@ -3618,6 +3700,7 @@ export function writeSwiftProject(
|
|
|
3618
3700
|
// declarations are imported before swift can emit the header that native
|
|
3619
3701
|
// implementations consume. give those implementations a downstream target.
|
|
3620
3702
|
const importModuleMaps = new Map<string, string>()
|
|
3703
|
+
const generatedModuleMaps: { output: string; module: string; published: string }[] = []
|
|
3621
3704
|
for (const target of targets) {
|
|
3622
3705
|
const prefix = target.path === '.' ? '' : `${target.path}/`
|
|
3623
3706
|
const entries = targetEntries(target)
|
|
@@ -3899,7 +3982,12 @@ export function writeSwiftProject(
|
|
|
3899
3982
|
const importFlags = [
|
|
3900
3983
|
...swiftClangImporterFlags(stageFlags(importOriginalFlags, sdkInclude)),
|
|
3901
3984
|
'-fmodule-map-file=' + path.join(layout.root, modulemap),
|
|
3902
|
-
...clangImportModuleMapFlags(
|
|
3985
|
+
...clangImportModuleMapFlags(
|
|
3986
|
+
settings,
|
|
3987
|
+
layout.root,
|
|
3988
|
+
importModuleMaps,
|
|
3989
|
+
generatedModuleMaps,
|
|
3990
|
+
),
|
|
3903
3991
|
]
|
|
3904
3992
|
const groups = new Map<
|
|
3905
3993
|
string,
|
|
@@ -4102,6 +4190,18 @@ export function writeSwiftProject(
|
|
|
4102
4190
|
].join('\n'),
|
|
4103
4191
|
)
|
|
4104
4192
|
}
|
|
4193
|
+
for (const map of generatedModuleMaps)
|
|
4194
|
+
if (
|
|
4195
|
+
files.has(map.published) ||
|
|
4196
|
+
Object.hasOwn(
|
|
4197
|
+
input.files,
|
|
4198
|
+
path.relative(layout.root, map.published).split(path.sep).join(path.posix.sep),
|
|
4199
|
+
)
|
|
4200
|
+
)
|
|
4201
|
+
writeFileSync(
|
|
4202
|
+
map.output,
|
|
4203
|
+
`extern module ${map.module} ${JSON.stringify(map.published)}\n`,
|
|
4204
|
+
)
|
|
4105
4205
|
if (native.size > 0) mkdirSync(headerDirectory, { recursive: true })
|
|
4106
4206
|
const nativeHeaderFlags: string[] = []
|
|
4107
4207
|
for (const name of new Set(
|
|
@@ -4357,7 +4457,8 @@ export function writeSwiftProject(
|
|
|
4357
4457
|
]
|
|
4358
4458
|
// a package reaches the distribution's frameworks through any Swift source
|
|
4359
4459
|
// but its entry (every target compiles with implicit framework imports),
|
|
4360
|
-
// through Objective-C, or by importing a distribution module. C
|
|
4460
|
+
// through Objective-C, or by importing a distribution module. a C include
|
|
4461
|
+
// of a libsystem header family such as <os/log.h> links libsystem only. C that calls
|
|
4361
4462
|
// libdispatch needs the run loop UIKit's host drives (rnx_tick). an entry
|
|
4362
4463
|
// that only calls other C and C++ targets links none of the frameworks'
|
|
4363
4464
|
// objects, so it carries no UIKit host and reserves no icu data.
|
|
@@ -4372,7 +4473,14 @@ export function writeSwiftProject(
|
|
|
4372
4473
|
[...importedModules].some(
|
|
4373
4474
|
(name) =>
|
|
4374
4475
|
distribution.modules.includes(name) &&
|
|
4375
|
-
!targets.some((target) => target.name === name)
|
|
4476
|
+
!targets.some((target) => target.name === name) &&
|
|
4477
|
+
!(
|
|
4478
|
+
clangImportedModules.has(name) &&
|
|
4479
|
+
!swiftImportedModules.has(name) &&
|
|
4480
|
+
existsSync(
|
|
4481
|
+
path.join(swiftSharedSdkRoot(moduleRoot, true), 'usr/include', name),
|
|
4482
|
+
)
|
|
4483
|
+
),
|
|
4376
4484
|
)
|
|
4377
4485
|
const frameworkLink = prebuilt
|
|
4378
4486
|
? path.join(layout.root, '.peach-framework-objects.rsp')
|
|
@@ -4571,18 +4679,7 @@ function builtArtifact(layout: SwiftProjectLayout): string {
|
|
|
4571
4679
|
if (executable === undefined) {
|
|
4572
4680
|
throw new Error('swift-compile: the written manifest names no executable target')
|
|
4573
4681
|
}
|
|
4574
|
-
|
|
4575
|
-
if (!existsSync(file)) {
|
|
4576
|
-
const found = existsSync(binDir)
|
|
4577
|
-
? readdirSync(binDir)
|
|
4578
|
-
.filter((name) => name.endsWith('.wasm'))
|
|
4579
|
-
.sort()
|
|
4580
|
-
: []
|
|
4581
|
-
throw new Error(
|
|
4582
|
-
`swift-compile: the build produced no ${executable.name}.wasm (found: ${found.join(', ') || 'none'})`,
|
|
4583
|
-
)
|
|
4584
|
-
}
|
|
4585
|
-
return file
|
|
4682
|
+
return path.join(binDir, `${executable.name}.wasm`)
|
|
4586
4683
|
}
|
|
4587
4684
|
|
|
4588
4685
|
function projectDiagnostic(
|
|
@@ -4993,15 +5090,19 @@ function frameworkLinkClosure(
|
|
|
4993
5090
|
return { objects: files, modules, moduleMaps: [...maps].sort() }
|
|
4994
5091
|
}
|
|
4995
5092
|
|
|
4996
|
-
|
|
5093
|
+
// apps with other optional frameworks share this directory, so only an artifact
|
|
5094
|
+
// whose name differs from a kept module by case alone is removed.
|
|
5095
|
+
function removeCaseCollidingModuleArtifacts(
|
|
4997
5096
|
modulesDir: string,
|
|
4998
5097
|
keep: ReadonlySet<string>,
|
|
4999
5098
|
): void {
|
|
5000
5099
|
if (!existsSync(modulesDir)) return
|
|
5100
|
+
const folded = new Set([...keep].map((name) => name.toLowerCase()))
|
|
5001
5101
|
for (const name of readdirSync(modulesDir)) {
|
|
5002
5102
|
const dot = name.indexOf('.')
|
|
5003
5103
|
if (dot <= 0) continue
|
|
5004
|
-
|
|
5104
|
+
const module = name.slice(0, dot)
|
|
5105
|
+
if (keep.has(module) || !folded.has(module.toLowerCase())) continue
|
|
5005
5106
|
rmSync(path.join(modulesDir, name), { recursive: true, force: true })
|
|
5006
5107
|
}
|
|
5007
5108
|
}
|
|
@@ -5014,7 +5115,7 @@ function removeUnbuiltModuleArtifacts(
|
|
|
5014
5115
|
// target's objects and modules under its own package, on either volume.
|
|
5015
5116
|
async function compileFrameworkProducts(args: {
|
|
5016
5117
|
moduleRoot: string
|
|
5017
|
-
|
|
5118
|
+
frameworkKey: string
|
|
5018
5119
|
input: SwiftCompileInput
|
|
5019
5120
|
swift: string
|
|
5020
5121
|
sdk: string
|
|
@@ -5027,8 +5128,33 @@ async function compileFrameworkProducts(args: {
|
|
|
5027
5128
|
link: string[]
|
|
5028
5129
|
moduleMaps: string[]
|
|
5029
5130
|
}> {
|
|
5030
|
-
const scratch = swiftFrameworkScratch(args.
|
|
5131
|
+
const scratch = swiftFrameworkScratch(args.frameworkKey)
|
|
5031
5132
|
mkdirSync(scratch, { recursive: true })
|
|
5133
|
+
// incremental builds leave the directory's own mtime alone, which the prune reads
|
|
5134
|
+
const now = new Date()
|
|
5135
|
+
utimesSync(scratch, now, now)
|
|
5136
|
+
// apps with this framework revision share the scratch, so one build at a time
|
|
5137
|
+
// uses it. a build that finds the products current only plans and returns.
|
|
5138
|
+
return withSwiftRootLock(
|
|
5139
|
+
scratch,
|
|
5140
|
+
(lease) =>
|
|
5141
|
+
buildFrameworkProducts(scratch, {
|
|
5142
|
+
...args,
|
|
5143
|
+
buildOptions: { ...args.buildOptions, lease },
|
|
5144
|
+
}),
|
|
5145
|
+
args.buildOptions.signal,
|
|
5146
|
+
)
|
|
5147
|
+
}
|
|
5148
|
+
|
|
5149
|
+
async function buildFrameworkProducts(
|
|
5150
|
+
scratch: string,
|
|
5151
|
+
args: Parameters<typeof compileFrameworkProducts>[0],
|
|
5152
|
+
): Promise<{
|
|
5153
|
+
modules: string
|
|
5154
|
+
objects: string[]
|
|
5155
|
+
link: string[]
|
|
5156
|
+
moduleMaps: string[]
|
|
5157
|
+
}> {
|
|
5032
5158
|
const linkedTargets = linkedFrameworkTargets(args.moduleRoot, args.input)
|
|
5033
5159
|
const linkRoot = path.join(scratch, 'link')
|
|
5034
5160
|
writeFrameworkLinkPackage(linkRoot, args.moduleRoot, linkedTargets.products)
|
|
@@ -5047,7 +5173,7 @@ async function compileFrameworkProducts(args: {
|
|
|
5047
5173
|
scratch,
|
|
5048
5174
|
'--target',
|
|
5049
5175
|
FRAMEWORK_LINK_TARGET,
|
|
5050
|
-
...
|
|
5176
|
+
...swiftCompileSdkOptions(args.moduleRoot, args.toolchainBin),
|
|
5051
5177
|
'--swift-sdk',
|
|
5052
5178
|
args.sdk,
|
|
5053
5179
|
'-c',
|
|
@@ -5074,14 +5200,17 @@ async function compileFrameworkProducts(args: {
|
|
|
5074
5200
|
args.buildOptions,
|
|
5075
5201
|
SWIFTPM_PROGRESS,
|
|
5076
5202
|
SWIFTPM_NOISE,
|
|
5077
|
-
)
|
|
5203
|
+
).catch((error: unknown) => {
|
|
5204
|
+
// the compiler's diagnostics ride on the error's streams, not its message
|
|
5205
|
+
throw new Error(outputOf(error), { cause: error })
|
|
5206
|
+
})
|
|
5078
5207
|
const release = path.join(scratch, WASM_TRIPLE, 'release')
|
|
5079
5208
|
const linked = frameworkLinkClosure(scratch, linkedTargets.targets)
|
|
5080
5209
|
const objects = linked.objects
|
|
5081
5210
|
// a previous plan of this scratch may have left a fixture module whose name
|
|
5082
5211
|
// differs only by case. the app searches this directory, so that file would
|
|
5083
5212
|
// satisfy the import on a case-insensitive volume.
|
|
5084
|
-
|
|
5213
|
+
removeCaseCollidingModuleArtifacts(path.join(release, 'Modules'), linked.modules)
|
|
5085
5214
|
const response = path.join(scratch, 'autolink-objects.rsp')
|
|
5086
5215
|
writeFileSync(response, objects.map((file) => JSON.stringify(file)).join('\n') + '\n')
|
|
5087
5216
|
const extracted = await runCompiler(
|
|
@@ -5120,12 +5249,49 @@ async function compileFrameworkProducts(args: {
|
|
|
5120
5249
|
// when it moves, so each revision compiles and links against its own objects
|
|
5121
5250
|
// the way the builder's per-build-key roots do.
|
|
5122
5251
|
const SWIFT_LINK_STAMP = '.peach-link-stamp'
|
|
5123
|
-
const SWIFT_FRAMEWORK_KEY = '.peach-framework-key'
|
|
5124
5252
|
|
|
5125
|
-
//
|
|
5126
|
-
//
|
|
5127
|
-
|
|
5128
|
-
|
|
5253
|
+
// one scratch per framework revision on the machine: every app built against
|
|
5254
|
+
// that revision reuses its compiled products.
|
|
5255
|
+
const SWIFT_FRAMEWORK_SCRATCHES_KEPT = 3
|
|
5256
|
+
|
|
5257
|
+
function swiftFrameworksDir(): string {
|
|
5258
|
+
return path.join(swiftCacheDir(), 'swift-frameworks')
|
|
5259
|
+
}
|
|
5260
|
+
|
|
5261
|
+
function swiftFrameworkScratch(frameworkKey: string): string {
|
|
5262
|
+
return path.join(swiftFrameworksDir(), frameworkKey)
|
|
5263
|
+
}
|
|
5264
|
+
|
|
5265
|
+
// a builder receives every delivery at a new path, and swiftpm keys its plan and
|
|
5266
|
+
// llbuild its inputs on absolute paths and inodes. one copy of the module and
|
|
5267
|
+
// its shared sdk per framework key, at a fixed path, gives every delivery
|
|
5268
|
+
// identical inputs. a published distribution is already immutable and stays put.
|
|
5269
|
+
function stageFrameworkSource(moduleRoot: string, frameworkKey: string): string {
|
|
5270
|
+
if (swiftDistributionAt(moduleRoot)) return moduleRoot
|
|
5271
|
+
const staged = path.join(swiftFrameworkScratch(frameworkKey), 'source')
|
|
5272
|
+
const stagedModule = path.join(staged, 'packages', path.basename(moduleRoot))
|
|
5273
|
+
if (existsSync(path.join(staged, '.complete'))) return stagedModule
|
|
5274
|
+
const partial = `${staged}.${randomUUID()}`
|
|
5275
|
+
mkdirSync(partial, { recursive: true })
|
|
5276
|
+
cpSync(moduleRoot, path.join(partial, 'packages', path.basename(moduleRoot)), {
|
|
5277
|
+
recursive: true,
|
|
5278
|
+
preserveTimestamps: true,
|
|
5279
|
+
filter: (source) => path.relative(moduleRoot, source) !== '.build',
|
|
5280
|
+
})
|
|
5281
|
+
cpSync(
|
|
5282
|
+
swiftSharedSdkRoot(moduleRoot, false),
|
|
5283
|
+
path.join(partial, 'packages/peachsim/sdk/ios'),
|
|
5284
|
+
{ recursive: true, preserveTimestamps: true },
|
|
5285
|
+
)
|
|
5286
|
+
// the plugin build resolves the macro scanner from the module's node_modules
|
|
5287
|
+
symlinkSync(
|
|
5288
|
+
realpathSync(path.join(moduleRoot, '../../node_modules')),
|
|
5289
|
+
path.join(partial, 'node_modules'),
|
|
5290
|
+
)
|
|
5291
|
+
writeFileSync(path.join(partial, '.complete'), '')
|
|
5292
|
+
rmSync(staged, { recursive: true, force: true })
|
|
5293
|
+
renameSync(partial, staged)
|
|
5294
|
+
return stagedModule
|
|
5129
5295
|
}
|
|
5130
5296
|
|
|
5131
5297
|
function swiftLinkStamp(args: {
|
|
@@ -5150,22 +5316,22 @@ function swiftLinkStamp(args: {
|
|
|
5150
5316
|
return hash.digest('hex')
|
|
5151
5317
|
}
|
|
5152
5318
|
|
|
5153
|
-
//
|
|
5154
|
-
//
|
|
5155
|
-
function
|
|
5156
|
-
const
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
}
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5319
|
+
// each scratch holds over a gibibyte, so the least recently built revisions go.
|
|
5320
|
+
// a scratch another process holds is skipped.
|
|
5321
|
+
async function pruneFrameworkScratches(keep: string): Promise<void> {
|
|
5322
|
+
const dir = swiftFrameworksDir()
|
|
5323
|
+
const idle = readdirSync(dir)
|
|
5324
|
+
.filter((name) => name !== keep)
|
|
5325
|
+
.map((name) => ({ name, modified: statSync(path.join(dir, name)).mtimeMs }))
|
|
5326
|
+
.sort((left, right) => right.modified - left.modified)
|
|
5327
|
+
.slice(SWIFT_FRAMEWORK_SCRATCHES_KEPT - 1)
|
|
5328
|
+
for (const { name } of idle)
|
|
5329
|
+
await withSwiftRootLock(
|
|
5330
|
+
path.join(dir, name),
|
|
5331
|
+
async () => rmSync(path.join(dir, name), { recursive: true, force: true }),
|
|
5332
|
+
undefined,
|
|
5333
|
+
false,
|
|
5334
|
+
)
|
|
5169
5335
|
}
|
|
5170
5336
|
|
|
5171
5337
|
/** the root keeps one app object tree per linked framework build. */
|
|
@@ -5311,18 +5477,26 @@ export function compileSwiftProjectUnit(
|
|
|
5311
5477
|
`swift-compile: no swift.org toolchain at ${options.toolchainBin}; install ${options.release} and its matching wasm sdk`,
|
|
5312
5478
|
)
|
|
5313
5479
|
}
|
|
5314
|
-
|
|
5315
|
-
|
|
5480
|
+
const frameworkRoot = await withSwiftRootLock(
|
|
5481
|
+
swiftFrameworkScratch(frameworkKey),
|
|
5482
|
+
async () => stageFrameworkSource(moduleRoot, frameworkKey),
|
|
5483
|
+
options.signal,
|
|
5484
|
+
)
|
|
5316
5485
|
report('preparing compiler plugins')
|
|
5317
|
-
const macroPlugins = await
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5486
|
+
const macroPlugins = await withSwiftRootLock(
|
|
5487
|
+
swiftFrameworkScratch(frameworkKey),
|
|
5488
|
+
async () =>
|
|
5489
|
+
ensureMacroPlugins(
|
|
5490
|
+
frameworkRoot,
|
|
5491
|
+
options.toolchainBin,
|
|
5492
|
+
options.release,
|
|
5493
|
+
options.signal,
|
|
5494
|
+
),
|
|
5321
5495
|
options.signal,
|
|
5322
5496
|
)
|
|
5323
5497
|
// memoized per toolchain, so only a process's first build waits on it,
|
|
5324
5498
|
// and that one reads and gzips it while swift builds
|
|
5325
|
-
const sdk = swiftModuleSdk(
|
|
5499
|
+
const sdk = swiftModuleSdk(frameworkRoot).wasmSdkId
|
|
5326
5500
|
const icu = swiftIcuAsset(options.toolchainBin, sdk)
|
|
5327
5501
|
const buildOptions = {
|
|
5328
5502
|
env: {
|
|
@@ -5339,6 +5513,7 @@ export function compileSwiftProjectUnit(
|
|
|
5339
5513
|
.join(':'),
|
|
5340
5514
|
}
|
|
5341
5515
|
: {}),
|
|
5516
|
+
...(input.lazyDistribution ? { PEACH_DEFER_WASM_LINK: '1' } : {}),
|
|
5342
5517
|
},
|
|
5343
5518
|
maxBuffer: 64 * 1024 * 1024,
|
|
5344
5519
|
timeout: options.timeoutMs,
|
|
@@ -5351,8 +5526,8 @@ export function compileSwiftProjectUnit(
|
|
|
5351
5526
|
if (!swiftDistributionAt(moduleRoot)) {
|
|
5352
5527
|
report('compiling framework products')
|
|
5353
5528
|
prebuilt = await compileFrameworkProducts({
|
|
5354
|
-
moduleRoot,
|
|
5355
|
-
|
|
5529
|
+
moduleRoot: frameworkRoot,
|
|
5530
|
+
frameworkKey,
|
|
5356
5531
|
input,
|
|
5357
5532
|
swift,
|
|
5358
5533
|
sdk,
|
|
@@ -5360,6 +5535,7 @@ export function compileSwiftProjectUnit(
|
|
|
5360
5535
|
plugins: macroPlugins,
|
|
5361
5536
|
buildOptions,
|
|
5362
5537
|
})
|
|
5538
|
+
await pruneFrameworkScratches(frameworkKey)
|
|
5363
5539
|
}
|
|
5364
5540
|
if (
|
|
5365
5541
|
retireStaleSwiftLink(
|
|
@@ -5371,7 +5547,7 @@ export function compileSwiftProjectUnit(
|
|
|
5371
5547
|
)
|
|
5372
5548
|
)
|
|
5373
5549
|
report('framework revision changed; rebuilding the app link')
|
|
5374
|
-
const preparation = writeSwiftProject(layout, input,
|
|
5550
|
+
const preparation = writeSwiftProject(layout, input, frameworkRoot, prebuilt)
|
|
5375
5551
|
writeSwiftAutolinkLinker(root, options.toolchainBin)
|
|
5376
5552
|
const unprepared = preparation.targetFailures.map(
|
|
5377
5553
|
(failure) => `error: target ${failure}`,
|
|
@@ -5385,7 +5561,7 @@ export function compileSwiftProjectUnit(
|
|
|
5385
5561
|
BUILD_JOBS,
|
|
5386
5562
|
'--package-path',
|
|
5387
5563
|
root,
|
|
5388
|
-
...
|
|
5564
|
+
...swiftCompileSdkOptions(frameworkRoot, options.toolchainBin),
|
|
5389
5565
|
'--swift-sdk',
|
|
5390
5566
|
sdk,
|
|
5391
5567
|
...(input.packageFiles || prebuilt
|
|
@@ -5412,6 +5588,12 @@ export function compileSwiftProjectUnit(
|
|
|
5412
5588
|
`${plugin}#ExpoModulesMacros`,
|
|
5413
5589
|
]),
|
|
5414
5590
|
]
|
|
5591
|
+
const linked = builtArtifact(layout)
|
|
5592
|
+
if (input.lazyDistribution) {
|
|
5593
|
+
rmSync(path.join(root, '.peach-link.rsp'), { force: true })
|
|
5594
|
+
if (existsSync(linked) && statSync(linked).size <= 8)
|
|
5595
|
+
rmSync(linked, { force: true })
|
|
5596
|
+
}
|
|
5415
5597
|
report('compiling and linking Swift modules')
|
|
5416
5598
|
try {
|
|
5417
5599
|
// clang consumes the real emitted headers after swift finishes.
|
|
@@ -5474,9 +5656,25 @@ export function compileSwiftProjectUnit(
|
|
|
5474
5656
|
}
|
|
5475
5657
|
}
|
|
5476
5658
|
if (unprepared.length) throw new Error(unprepared.join('\n'))
|
|
5659
|
+
if (!existsSync(linked)) {
|
|
5660
|
+
const binDir = path.dirname(linked)
|
|
5661
|
+
const found = existsSync(binDir)
|
|
5662
|
+
? readdirSync(binDir)
|
|
5663
|
+
.filter((name) => name.endsWith('.wasm'))
|
|
5664
|
+
.sort()
|
|
5665
|
+
: []
|
|
5666
|
+
throw new Error(
|
|
5667
|
+
`swift-compile: the build produced no ${path.basename(linked)} (found: ${found.join(', ') || 'none'})`,
|
|
5668
|
+
)
|
|
5669
|
+
}
|
|
5670
|
+
const optimized = `${linked}.optimized`
|
|
5671
|
+
if (input.lazyDistribution) {
|
|
5672
|
+
pruneSwiftWasmLink(root, options.toolchainBin, frameworkRoot)
|
|
5673
|
+
await optimizeWasm(linked, optimized)
|
|
5674
|
+
}
|
|
5477
5675
|
const artifact = {
|
|
5478
5676
|
hash,
|
|
5479
|
-
bytes: readFileSync(
|
|
5677
|
+
bytes: readFileSync(input.lazyDistribution ? optimized : linked),
|
|
5480
5678
|
icu: await icu,
|
|
5481
5679
|
}
|
|
5482
5680
|
saveCompiledArtifact(root, artifact)
|