peachsim 0.1.1738 → 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 +67 -16
- 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 +22 -20
- package/cli/commands/push.ts +56 -0
- package/cli/commands/serve.ts +9 -0
- package/cli/commands/shell-url.ts +37 -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 +4 -0
- package/cli/ws-bridge.ts +3 -1
- package/detox/index.ts +9 -4
- 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 +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 +7372 -3675
- 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 +22 -8
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +6340 -3064
- package/dist-lib/expo-swift-metadata.cjs +14 -2
- package/dist-lib/expo-swift-metadata.mjs +14 -2
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +6524 -2720
- package/dist-lib/host/fetch-proxy-handler.cjs +8 -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 +97 -31
- 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 +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -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 +71 -29
- package/dist-lib/native-app-identity-project.cjs +53 -22
- package/dist-lib/native-app-identity-project.mjs +53 -22
- 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 +1 -1
- 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 +111 -79
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- 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 +40549 -37613
- package/dist-lib/swift-compile.cjs +2054 -388
- package/dist-lib/swift-compile.mjs +1976 -312
- 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 +68 -8
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +5867 -2646
- package/dist-lib/vite.cjs +18 -8
- 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/image-loader.d.ts +0 -3
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +6 -0
- package/dist-types/packages/peach-engine/src/engine/paint-boundary.d.ts +1 -0
- 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 +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/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 +8 -0
- 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 +5 -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 +1 -0
- 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 +7 -0
- package/package.json +2 -1
- package/runtime-companion.json +1 -1
- 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 +0 -6
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +356 -61
- 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/sys/socketvar.h +191 -0
- package/sdk/ios/usr/include/sys/vsock.h +84 -0
- package/sdk/native-hashes.json +1 -1
- package/skills/contrast/SKILL.md +6 -5
- package/skills/peach-debug/SKILL.md +68 -264
- 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 -401
- 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 -216
- 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 -284
- 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 -105
- package/src/appPackageContract.ts +12 -1
- package/src/assetCatalogContract.ts +8 -1
- package/src/bridge-contract.ts +6 -0
- package/src/bundle-channel.mjs +133 -59
- package/src/cli-runtime.ts +8 -9
- package/src/configured-bundle-producer.ts +10 -0
- package/src/device-catalog.ts +68 -4
- package/src/expo-discovery-cache.ts +3 -0
- package/src/expo-native-workspace.ts +81 -17
- package/src/expo-swift-host.ts +57 -104
- package/src/expo-widget-assets.ts +76 -0
- package/src/expoSwiftContract.ts +13 -1
- package/src/host/websocket-proxy.ts +7 -2
- package/src/native-prebuilt.ts +3 -3
- package/src/nitro-adapter.lock.json +263 -263
- package/src/nitro-adapter.ts +69 -7
- package/src/nitro-bundle.ts +52 -24
- package/src/nitro-compile.ts +6 -1
- package/src/nitro-source.ts +82 -4
- package/src/nitro-superset.lock.json +103 -0
- package/src/nitro-superset.ts +137 -0
- package/src/nitroContract.ts +5 -1
- package/src/react-bridge-importers.ts +1 -0
- package/src/settingsContract.ts +26 -1
- package/src/swift-compile.ts +267 -68
- package/src/swift-compiler-digest.ts +2 -0
- package/src/swift-coverage/xcode-packages.ts +61 -1
- package/src/swift-coverage/xcode.ts +10 -12
- package/src/swift-cxx-reachable.ts +1 -1
- package/src/swift-distribution.lock.json +15 -13
- package/src/swift-distribution.ts +57 -26
- package/src/swift-host.ts +48 -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-standins.ts +233 -11
- package/src/swift-submit.ts +13 -1
- package/src/swift-toolchain.ts +82 -7
- package/src/swift-wasm-prune.ts +1629 -0
- package/src/turbo-bundle.ts +11 -10
- package/src/turbo-runtime.lock.json +16 -16
- package/src/vite-plugin-one.ts +12 -1
- 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
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { execFileSync } from 'node:child_process'
|
|
2
2
|
import { createHash } from 'node:crypto'
|
|
3
|
-
import { mkdirSync, realpathSync } from 'node:fs'
|
|
3
|
+
import { mkdirSync, realpathSync, writeFileSync } from 'node:fs'
|
|
4
4
|
import { basename, isAbsolute, join, relative, resolve, sep } from 'node:path'
|
|
5
|
+
import { swiftImplicitResourcePaths } from '../swift-package'
|
|
5
6
|
import {
|
|
6
7
|
swiftPackageDescription,
|
|
7
8
|
swiftPackageManifest,
|
|
8
9
|
swiftProductDependency,
|
|
10
|
+
swiftTargetFiles,
|
|
9
11
|
type SwiftManifestTarget,
|
|
10
12
|
type SwiftPackageManifest,
|
|
11
13
|
} from '../swift-package-manifest'
|
|
12
14
|
import { readPackageFile } from '../swift-source-file'
|
|
15
|
+
import { generatePackageAssetSymbols } from './xcode-assets'
|
|
13
16
|
import type { readXcodeAppTarget } from '../xcode-project'
|
|
14
17
|
import type { SwiftSourceLeg } from './types'
|
|
15
18
|
|
|
@@ -54,6 +57,12 @@ export type SwiftLocalModule = {
|
|
|
54
57
|
files: string[]
|
|
55
58
|
languageMode: number
|
|
56
59
|
mainActorIsolation: boolean
|
|
60
|
+
/** true when implicit resources give the target swiftpm's generated Bundle.module. */
|
|
61
|
+
resources: boolean
|
|
62
|
+
/** asset catalog directories the target holds, relative to the app root. */
|
|
63
|
+
catalogs: string[]
|
|
64
|
+
/** the iOS version the package declares, which its catalogs compile for. */
|
|
65
|
+
iosDeployment: string | null
|
|
57
66
|
/** compilation conditions active in the app's build configuration. */
|
|
58
67
|
defines: string[]
|
|
59
68
|
/** module names this module imports among the local package modules. */
|
|
@@ -160,6 +169,22 @@ export function createSwiftModuleWalker(
|
|
|
160
169
|
}
|
|
161
170
|
if (target.languageMode !== 5 && target.languageMode !== 6)
|
|
162
171
|
return { reason: `Unsupported Swift language mode: ${target.languageMode}` }
|
|
172
|
+
const targetFiles = swiftTargetFiles(manifest, target)
|
|
173
|
+
const implicitResources = swiftImplicitResourcePaths(
|
|
174
|
+
targetFiles.map((file) => relative(target.dir, file)),
|
|
175
|
+
)
|
|
176
|
+
const catalogs = [
|
|
177
|
+
...new Set(
|
|
178
|
+
targetFiles.flatMap((file) => {
|
|
179
|
+
const at = file.indexOf(`.xcassets${sep}`)
|
|
180
|
+
return at >= 0 ? [relative(root, file.slice(0, at + '.xcassets'.length))] : []
|
|
181
|
+
}),
|
|
182
|
+
),
|
|
183
|
+
].sort()
|
|
184
|
+
if (catalogs.length && !manifest.iosDeployment)
|
|
185
|
+
return {
|
|
186
|
+
reason: `Asset symbols for package ${manifest.name}, which declares no iOS platform, are unproven.`,
|
|
187
|
+
}
|
|
163
188
|
visiting.add(key)
|
|
164
189
|
const resolved = addDependencies(manifest, target.dependencies)
|
|
165
190
|
visiting.delete(key)
|
|
@@ -193,6 +218,9 @@ export function createSwiftModuleWalker(
|
|
|
193
218
|
files,
|
|
194
219
|
languageMode: target.languageMode,
|
|
195
220
|
mainActorIsolation: target.mainActorIsolation,
|
|
221
|
+
resources: implicitResources.length > 0,
|
|
222
|
+
catalogs,
|
|
223
|
+
iosDeployment: manifest.iosDeployment,
|
|
196
224
|
defines: swiftPackageConditions(target, configuration),
|
|
197
225
|
dependsOn: [...new Set(dependsOn)],
|
|
198
226
|
})
|
|
@@ -336,6 +364,36 @@ export function buildLocalPackageModules(
|
|
|
336
364
|
const modules = join(work, 'package-modules')
|
|
337
365
|
mkdirSync(modules, { recursive: true })
|
|
338
366
|
for (const module of plan.modules) {
|
|
367
|
+
// swiftpm generates this accessor for a target with resources
|
|
368
|
+
const symbols = join(modules, `${module.moduleName}.GeneratedAssetSymbols.swift`)
|
|
369
|
+
if (module.catalogs.length)
|
|
370
|
+
writeFileSync(
|
|
371
|
+
symbols,
|
|
372
|
+
generatePackageAssetSymbols(
|
|
373
|
+
module.catalogs.map((catalog) => join(root, catalog)),
|
|
374
|
+
join(root, module.package),
|
|
375
|
+
module.iosDeployment!,
|
|
376
|
+
),
|
|
377
|
+
)
|
|
378
|
+
const accessor = join(modules, `${module.moduleName}.resource_bundle_accessor.swift`)
|
|
379
|
+
if (module.resources)
|
|
380
|
+
writeFileSync(
|
|
381
|
+
accessor,
|
|
382
|
+
[
|
|
383
|
+
'import Foundation',
|
|
384
|
+
'',
|
|
385
|
+
'extension Foundation.Bundle {',
|
|
386
|
+
' static let module: Bundle = {',
|
|
387
|
+
` let mainPath = Bundle.main.bundleURL.appendingPathComponent("${module.packageName}_${module.target}.bundle").path`,
|
|
388
|
+
' guard let bundle = Bundle(path: mainPath) else {',
|
|
389
|
+
` Swift.fatalError("could not load resource bundle: \\(mainPath)")`,
|
|
390
|
+
' }',
|
|
391
|
+
' return bundle',
|
|
392
|
+
' }()',
|
|
393
|
+
'}',
|
|
394
|
+
'',
|
|
395
|
+
].join('\n'),
|
|
396
|
+
)
|
|
339
397
|
try {
|
|
340
398
|
execFileSync(
|
|
341
399
|
leg.swiftc,
|
|
@@ -356,6 +414,8 @@ export function buildLocalPackageModules(
|
|
|
356
414
|
'-I',
|
|
357
415
|
modules,
|
|
358
416
|
...module.sources.map(({ path }) => join(root, path)),
|
|
417
|
+
...(module.resources ? [accessor] : []),
|
|
418
|
+
...(module.catalogs.length ? [symbols] : []),
|
|
359
419
|
],
|
|
360
420
|
{ cwd: root, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] },
|
|
361
421
|
)
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
readXcodeAppTarget,
|
|
11
11
|
str,
|
|
12
12
|
} from '../xcode-project'
|
|
13
|
-
import { xcodePathResolver } from '../xcode-target-members'
|
|
13
|
+
import { xcodeBuildFileBuildsForIos, xcodePathResolver } from '../xcode-target-members'
|
|
14
14
|
import { swiftCoverageProvenance } from './provenance'
|
|
15
15
|
import { indexSwiftApp } from './source'
|
|
16
16
|
import {
|
|
@@ -259,19 +259,15 @@ export function swiftXcodeSourceInput(request: SwiftXcodeSourceInput) {
|
|
|
259
259
|
const file = objects[id]
|
|
260
260
|
if (!isDict(file) || !str(file.fileRef))
|
|
261
261
|
return unknown('Unsupported Xcode source build file reference.')
|
|
262
|
+
// a file filtered away from ios is not in the target's members either
|
|
263
|
+
if (!xcodeBuildFileBuildsForIos(file)) continue
|
|
262
264
|
const member = resolveMember(str(file.fileRef)!)
|
|
263
265
|
if (!member || !app.allSources.includes(member))
|
|
264
266
|
return unknown(
|
|
265
267
|
'Xcode source references must resolve to original target members.',
|
|
266
268
|
)
|
|
267
|
-
if (
|
|
268
|
-
file.
|
|
269
|
-
list(file.platformFilters).length ||
|
|
270
|
-
(isDict(file.settings) && Object.keys(file.settings).length)
|
|
271
|
-
)
|
|
272
|
-
return unknown(
|
|
273
|
-
'Per-file Xcode compiler settings and platform filters remain unknown.',
|
|
274
|
-
)
|
|
269
|
+
if (isDict(file.settings) && Object.keys(file.settings).length)
|
|
270
|
+
return unknown('Per-file Xcode compiler settings remain unknown.')
|
|
275
271
|
}
|
|
276
272
|
}
|
|
277
273
|
if (list(target.buildRules).length)
|
|
@@ -451,9 +447,11 @@ export function swiftXcodeSourceInput(request: SwiftXcodeSourceInput) {
|
|
|
451
447
|
'Only compilation conditions in OTHER_SWIFT_FLAGS are supported; remaining flags are unknown.',
|
|
452
448
|
)
|
|
453
449
|
if (
|
|
454
|
-
(settings.SDKROOT &&
|
|
450
|
+
(settings.SDKROOT &&
|
|
451
|
+
!['auto', 'iphoneos', 'iphonesimulator'].includes(settings.SDKROOT)) ||
|
|
455
452
|
(settings.SUPPORTED_PLATFORMS &&
|
|
456
|
-
!settings.SUPPORTED_PLATFORMS.split(/\s+/).includes('iphonesimulator'))
|
|
453
|
+
!settings.SUPPORTED_PLATFORMS.split(/\s+/).includes('iphonesimulator')) ||
|
|
454
|
+
(settings.SDKROOT === 'auto' && !settings.SUPPORTED_PLATFORMS)
|
|
457
455
|
)
|
|
458
456
|
return unknown(
|
|
459
457
|
'Only the existing arm64 iOS simulator project configuration is supported.',
|
|
@@ -568,7 +566,7 @@ export function swiftXcodeSourceInput(request: SwiftXcodeSourceInput) {
|
|
|
568
566
|
),
|
|
569
567
|
},
|
|
570
568
|
unknowns: [
|
|
571
|
-
'Membership and configuration come from the original Xcode target, using the existing arm64 iOS simulator reader. Schemes and other destinations are not evaluated.',
|
|
569
|
+
'Membership and configuration come from the original Xcode target, using the existing arm64 iOS simulator reader. A multiplatform target resolves to its iOS simulator destination, and build files filtered away from ios are not members. Schemes and other destinations are not evaluated.',
|
|
572
570
|
'Asset symbols are generated by peach to match actool, and string catalog symbols with xcstringstool. Local package products compile as modules the app imports. Bridging headers pass the target header maps, search paths and preprocessor definitions to clang. Script and build rule outputs, per-file flags, source filters, native peers and dependency modules are rejected. SDK and dependency artifact identities and native proof remain unknown.',
|
|
573
571
|
],
|
|
574
572
|
}
|
|
@@ -47,7 +47,7 @@ export function xcodeCxxReachable(
|
|
|
47
47
|
moduleRoot: string,
|
|
48
48
|
clang: string,
|
|
49
49
|
): SwiftPackageBinary[] {
|
|
50
|
-
const inputs = xcodeObjCInputs(app, binaries)
|
|
50
|
+
const inputs = xcodeObjCInputs(app, binaries, moduleRoot)
|
|
51
51
|
if (
|
|
52
52
|
!inputs.targets.some((target) =>
|
|
53
53
|
target.files.some((file) => /\.(mm|cc|cpp|cxx)$/.test(file)),
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"id": "
|
|
3
|
-
"release": "swift-6.4.0-RELEASE-custom-
|
|
4
|
-
"wasmSdkId": "swift-6.4.0-RELEASE_wasm-peach-
|
|
5
|
-
"wasmSdkUrl": "https://r2.sootsim.com/swift-wasm-sdk/swift-6.4.0-RELEASE_wasm-peach-
|
|
6
|
-
"wasmSdkChecksum": "
|
|
7
|
-
"source": "
|
|
2
|
+
"id": "6ce04be1c3d3504e",
|
|
3
|
+
"release": "swift-6.4.0-RELEASE-custom-f7c03c3f59ec5d83",
|
|
4
|
+
"wasmSdkId": "swift-6.4.0-RELEASE_wasm-peach-6dd8eba1",
|
|
5
|
+
"wasmSdkUrl": "https://r2.sootsim.com/swift-wasm-sdk/swift-6.4.0-RELEASE_wasm-peach-6dd8eba1.artifactbundle.tar.gz",
|
|
6
|
+
"wasmSdkChecksum": "6e213e9d4d25351960f6befcfbdee9695bbaa267085085e5394f4c086ac9bdb1",
|
|
7
|
+
"source": "358174c50acfa0806d79ae3ebf1ad7c51bb6411e",
|
|
8
8
|
"targets": [
|
|
9
9
|
"ImagePlayground",
|
|
10
10
|
"QuickLookThumbnailing",
|
|
@@ -161,6 +161,7 @@
|
|
|
161
161
|
"Intents",
|
|
162
162
|
"IntentsUI",
|
|
163
163
|
"WatchConnectivity",
|
|
164
|
+
"ReplayKit",
|
|
164
165
|
"CoreServices",
|
|
165
166
|
"MobileCoreServices",
|
|
166
167
|
"CoreTelephony",
|
|
@@ -202,20 +203,21 @@
|
|
|
202
203
|
],
|
|
203
204
|
"horizontalSizeClass": ["string:compact", "string:regular"],
|
|
204
205
|
"verticalSizeClass": ["string:compact", "string:regular"],
|
|
205
|
-
"accessibilityReduceMotion": ["bool"]
|
|
206
|
+
"accessibilityReduceMotion": ["bool"],
|
|
207
|
+
"hinge": ["null", "object"]
|
|
206
208
|
},
|
|
207
209
|
"hosts": {
|
|
208
210
|
"darwin-arm64": {
|
|
209
|
-
"sha256": "
|
|
210
|
-
"size":
|
|
211
|
+
"sha256": "e0cb6487e64d3089d0795817b5f7543db57552bf1e21da7847351aee3b9227d0",
|
|
212
|
+
"size": 90762105
|
|
211
213
|
},
|
|
212
214
|
"linux-x64": {
|
|
213
|
-
"sha256": "
|
|
214
|
-
"size":
|
|
215
|
+
"sha256": "fcadab7f519c456fd2ff7a780f36001cd2c51a90a29938684d0f2ab94c377440",
|
|
216
|
+
"size": 93479763
|
|
215
217
|
},
|
|
216
218
|
"linux-arm64": {
|
|
217
|
-
"sha256": "
|
|
218
|
-
"size":
|
|
219
|
+
"sha256": "9a225586903eca8a4b13e03301814883e743a33cdbfc4b9eced867facff5472b",
|
|
220
|
+
"size": 92973106
|
|
219
221
|
}
|
|
220
222
|
}
|
|
221
223
|
}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
// the SwiftUI module app Swift compiles against on this machine, and the
|
|
2
2
|
// swift.org toolchain that compiles it. a source checkout links
|
|
3
3
|
// packages/sootsim-swift; an installed peach downloads the prebuilt
|
|
4
|
-
// distribution from PEACH_SWIFT_ENDPOINT,
|
|
5
|
-
// build carries, and unpacks it under
|
|
4
|
+
// distribution from PEACH_SWIFT_ENDPOINT, or the public default when it is
|
|
5
|
+
// unset, verifies it against the lock this build carries, and unpacks it under
|
|
6
|
+
// the peach home
|
|
6
7
|
// (docs/swift-distribution.md). no path here asks Contrast to compile.
|
|
7
8
|
import fs from 'node:fs'
|
|
8
9
|
import os from 'node:os'
|
|
9
10
|
import path from 'node:path'
|
|
10
11
|
import { installVerifiedTarball } from '@contrast/runtime-delivery'
|
|
12
|
+
import { ensureLinuxBrowserLibraries } from '../cli/drivers/linux-browser-libs'
|
|
11
13
|
import { rnxHomeDir } from './home-paths'
|
|
12
14
|
import { swiftDistributionAt, swiftModuleSdk } from './swift-compile'
|
|
13
15
|
import {
|
|
@@ -19,10 +21,14 @@ import {
|
|
|
19
21
|
import lockJson from './swift-distribution.lock.json' with { type: 'json' }
|
|
20
22
|
import {
|
|
21
23
|
confineSwiftScratch,
|
|
24
|
+
ensureSwiftLinuxRuntime,
|
|
22
25
|
installSwiftWasmSdk,
|
|
26
|
+
privateSwiftDistributionRoot,
|
|
27
|
+
SWIFT_PRIVATE_DISTRIBUTION_ENV,
|
|
23
28
|
swiftCompiler,
|
|
24
29
|
swiftCompilerInstallSteps,
|
|
25
30
|
sourceSwiftCheckout,
|
|
31
|
+
setSwiftLinuxLibraryPath,
|
|
26
32
|
swiftHostCompilerArchive,
|
|
27
33
|
swiftToolchain,
|
|
28
34
|
swiftToolchainBin,
|
|
@@ -32,6 +38,17 @@ import {
|
|
|
32
38
|
|
|
33
39
|
export const SWIFT_ENDPOINT_ENV = 'PEACH_SWIFT_ENDPOINT'
|
|
34
40
|
|
|
41
|
+
/** where an installed peach downloads distribution archives when
|
|
42
|
+
* PEACH_SWIFT_ENDPOINT is unset: compiled objects only, content addressed and
|
|
43
|
+
* checked against the locks this build carries. */
|
|
44
|
+
export const DEFAULT_SWIFT_ENDPOINT = 'https://r2.sootsim.com/swift-distribution'
|
|
45
|
+
|
|
46
|
+
export function swiftEndpoint(): string {
|
|
47
|
+
return (
|
|
48
|
+
process.env[SWIFT_ENDPOINT_ENV]?.trim().replace(/\/+$/, '') || DEFAULT_SWIFT_ENDPOINT
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
35
52
|
export interface SwiftModule {
|
|
36
53
|
/** the module root compileSwiftProjectUnit links: a checkout or a distribution. */
|
|
37
54
|
root: string
|
|
@@ -48,21 +65,29 @@ const installs = new Map<
|
|
|
48
65
|
}
|
|
49
66
|
>()
|
|
50
67
|
|
|
51
|
-
/** the installed distribution's root, downloading it on first use
|
|
52
|
-
|
|
53
|
-
export async function swiftDistributionRoot(
|
|
54
|
-
signal?: AbortSignal,
|
|
55
|
-
): Promise<string | null> {
|
|
68
|
+
/** the installed distribution's root, downloading it on first use. */
|
|
69
|
+
export async function swiftDistributionRoot(signal?: AbortSignal): Promise<string> {
|
|
56
70
|
signal?.throwIfAborted()
|
|
57
|
-
const endpoint = process.env[SWIFT_ENDPOINT_ENV]?.trim().replace(/\/+$/, '')
|
|
58
|
-
if (!endpoint) return null
|
|
59
|
-
const lock = parseSwiftDistributionLock(lockJson)
|
|
60
71
|
const host = swiftDistributionHost(process.platform, process.arch)
|
|
61
72
|
if (!host) {
|
|
62
73
|
throw new Error(
|
|
63
74
|
`peach has no Swift distribution for ${process.platform}-${process.arch}; it ships for macOS arm64 and Linux x64 and arm64`,
|
|
64
75
|
)
|
|
65
76
|
}
|
|
77
|
+
// a developer's unpublished distribution: its own manifest is the identity,
|
|
78
|
+
// so no lock, endpoint or download applies. its builder installs the compiler
|
|
79
|
+
// and SDK; swiftModuleToolchain verifies them against the manifest.
|
|
80
|
+
const privateRoot = privateSwiftDistributionRoot()
|
|
81
|
+
if (privateRoot) {
|
|
82
|
+
const manifest = swiftDistributionAt(privateRoot)
|
|
83
|
+
if (manifest?.host !== host)
|
|
84
|
+
throw new Error(
|
|
85
|
+
`${privateRoot} holds no Swift distribution for ${host} (${SWIFT_PRIVATE_DISTRIBUTION_ENV})`,
|
|
86
|
+
)
|
|
87
|
+
return privateRoot
|
|
88
|
+
}
|
|
89
|
+
const endpoint = swiftEndpoint()
|
|
90
|
+
const lock = parseSwiftDistributionLock(lockJson)
|
|
66
91
|
// the archive is useless without its compiler, so the toolchain installs
|
|
67
92
|
// or fails before the download
|
|
68
93
|
await installSwiftToolchain(lock.release, lock, signal)
|
|
@@ -151,7 +176,6 @@ async function installSwiftToolchain(
|
|
|
151
176
|
signal?: AbortSignal,
|
|
152
177
|
): Promise<void> {
|
|
153
178
|
process.env.PEACH_SWIFT_SDKS_PATH ??= path.join(rnxHomeDir(), 'swift', 'sdks')
|
|
154
|
-
if (swiftToolchainReady(release, sdk)) return
|
|
155
179
|
const root = path.resolve(swiftToolchainBin(release), '../..')
|
|
156
180
|
// macOS installs where the locator looks first, the user's Toolchains
|
|
157
181
|
// directory, and only into a directory without a compiler; linux installs
|
|
@@ -181,6 +205,15 @@ async function installSwiftToolchain(
|
|
|
181
205
|
verify: (dir) => verifySwiftHostCompiler(release, dir),
|
|
182
206
|
})
|
|
183
207
|
}
|
|
208
|
+
ensureSwiftLinuxRuntime(release)
|
|
209
|
+
for (const executable of ['swift', 'swift-package', 'swift-frontend', 'wasm-ld']) {
|
|
210
|
+
const libraries = await ensureLinuxBrowserLibraries(
|
|
211
|
+
path.join(root, 'usr/bin', executable),
|
|
212
|
+
'Swift',
|
|
213
|
+
)
|
|
214
|
+
if (!libraries.ok) throw new Error(libraries.message)
|
|
215
|
+
if (libraries.libraryPath) setSwiftLinuxLibraryPath(libraries.libraryPath)
|
|
216
|
+
}
|
|
184
217
|
try {
|
|
185
218
|
swiftCompiler(release)
|
|
186
219
|
} catch (error) {
|
|
@@ -225,28 +258,26 @@ function swiftToolchainReady(release: string, sdk: SwiftWasmSdk): boolean {
|
|
|
225
258
|
}
|
|
226
259
|
}
|
|
227
260
|
|
|
228
|
-
/** the module this process compiles app Swift against
|
|
229
|
-
*
|
|
230
|
-
* nothing without it, so a checkout's toolchain error surfaces to them. */
|
|
261
|
+
/** the module this process compiles app Swift against, installing its pinned
|
|
262
|
+
* compiler and SDK before returning either a checkout or a distribution. */
|
|
231
263
|
export async function resolveSwiftModule({
|
|
232
|
-
required = false,
|
|
233
264
|
signal,
|
|
234
|
-
}: {
|
|
265
|
+
}: { signal?: AbortSignal } = {}): Promise<SwiftModule> {
|
|
235
266
|
signal?.throwIfAborted()
|
|
236
267
|
confineSwiftScratch(path.join(rnxHomeDir(), 'cache', 'swift-tmp'))
|
|
237
268
|
const checkout = sourceSwiftCheckout()
|
|
238
|
-
if (
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
269
|
+
if (
|
|
270
|
+
!privateSwiftDistributionRoot() &&
|
|
271
|
+
fs.existsSync(path.join(checkout, 'toolchain.json'))
|
|
272
|
+
) {
|
|
273
|
+
const pin: { release: string } = JSON.parse(
|
|
274
|
+
fs.readFileSync(path.join(checkout, 'toolchain.json'), 'utf8'),
|
|
275
|
+
)
|
|
276
|
+
await installSwiftToolchain(pin.release, swiftModuleSdk(checkout), signal)
|
|
277
|
+
return { root: checkout, ...swiftModuleToolchain(checkout) }
|
|
247
278
|
}
|
|
248
279
|
const root = await swiftDistributionRoot(signal)
|
|
249
|
-
return
|
|
280
|
+
return { root, ...swiftModuleToolchain(root) }
|
|
250
281
|
}
|
|
251
282
|
|
|
252
283
|
/** the release a module root was built for and its installed toolchain. */
|
package/src/swift-host.ts
CHANGED
|
@@ -11,8 +11,6 @@ import {
|
|
|
11
11
|
resolveSwiftImageResourceUrls,
|
|
12
12
|
} from '../../sootsim-swift/src/bundleAssets'
|
|
13
13
|
import { compileStringCatalog } from '../../sootsim-swift/src/stringCatalog'
|
|
14
|
-
import { authHeaderValue, resolveCliAuth } from '../cli/auth'
|
|
15
|
-
import { resolveContrastBackendOrigin } from './backend-origin'
|
|
16
14
|
import { swiftCacheDir } from './home-paths'
|
|
17
15
|
import iosSdk from './ios-sdk-frameworks.json' with { type: 'json' }
|
|
18
16
|
import { type NativeAppIdentity } from './native-app-identity'
|
|
@@ -296,6 +294,8 @@ interface XcodeProjectEntry {
|
|
|
296
294
|
provided: ReadonlySet<string> | null
|
|
297
295
|
/** the module root a local compile links, which builds binary stand-ins. */
|
|
298
296
|
moduleRoot: string | null
|
|
297
|
+
/** the distribution whose generated interface headers an installed pod's declarations come from. */
|
|
298
|
+
interfaceRoot: string | null
|
|
299
299
|
behavior?: SwiftStandinBehaviors
|
|
300
300
|
packages?: {
|
|
301
301
|
key: string
|
|
@@ -371,6 +371,7 @@ export function openXcodeProject(
|
|
|
371
371
|
target: string | undefined,
|
|
372
372
|
moduleRoot: string | undefined,
|
|
373
373
|
configuration?: string,
|
|
374
|
+
interfaceRoot?: string,
|
|
374
375
|
): string {
|
|
375
376
|
const app = readXcodeAppTargetPrepared(xcodeproj, target, configuration, {
|
|
376
377
|
prepareGeneratedSources: true,
|
|
@@ -383,6 +384,7 @@ export function openXcodeProject(
|
|
|
383
384
|
configuration: app.configuration,
|
|
384
385
|
provided: moduleRoot ? new Set(swiftPeachModules(moduleRoot)) : null,
|
|
385
386
|
moduleRoot: moduleRoot ?? null,
|
|
387
|
+
interfaceRoot: interfaceRoot ?? null,
|
|
386
388
|
})
|
|
387
389
|
return root
|
|
388
390
|
}
|
|
@@ -903,7 +905,11 @@ function buildXcodeLayout(root: string): XcodeLayout | null {
|
|
|
903
905
|
file,
|
|
904
906
|
path.relative(app.rootDir, file).split(path.sep).join('/') || '.',
|
|
905
907
|
)
|
|
906
|
-
const nativeInputs = xcodeObjCInputs(
|
|
908
|
+
const nativeInputs = xcodeObjCInputs(
|
|
909
|
+
app,
|
|
910
|
+
binaries,
|
|
911
|
+
registered.moduleRoot ?? registered.interfaceRoot,
|
|
912
|
+
)
|
|
907
913
|
const nativeFiles = nativeInputs.sources
|
|
908
914
|
for (const file of nativeFiles.keys()) files.add(file)
|
|
909
915
|
const nativeHeaders = [...nativeFiles.keys()].filter((file) =>
|
|
@@ -1015,6 +1021,9 @@ function buildXcodeLayout(root: string): XcodeLayout | null {
|
|
|
1015
1021
|
if (!settings.publicHeaders) continue
|
|
1016
1022
|
const target = packages.targets.find((value) => value.name === settings.name)
|
|
1017
1023
|
if (!target) continue
|
|
1024
|
+
const prefixHeader = path.posix.join(target.path, 'PeachPodPrefix.pch')
|
|
1025
|
+
generatedSources[prefixHeader] =
|
|
1026
|
+
'#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#import <Foundation/Foundation.h>\n#endif\n'
|
|
1018
1027
|
nativeTargets.push({
|
|
1019
1028
|
name: target.name,
|
|
1020
1029
|
deploymentTarget: settings.deploymentTarget,
|
|
@@ -1028,7 +1037,7 @@ function buildXcodeLayout(root: string): XcodeLayout | null {
|
|
|
1028
1037
|
.map(relative),
|
|
1029
1038
|
flattensPublicHeaders: false,
|
|
1030
1039
|
bridgingHeader: null,
|
|
1031
|
-
prefixHeader
|
|
1040
|
+
prefixHeader,
|
|
1032
1041
|
headerSearchPaths: settings.includes.map(relative),
|
|
1033
1042
|
moduleMaps: settings.moduleMaps.map((map) => ({
|
|
1034
1043
|
module: map.module,
|
|
@@ -1366,6 +1375,7 @@ const RESOURCE_CONTENT_TYPES: Record<string, string> = {
|
|
|
1366
1375
|
'.jpeg': 'image/jpeg',
|
|
1367
1376
|
'.jpg': 'image/jpeg',
|
|
1368
1377
|
'.png': 'image/png',
|
|
1378
|
+
'.svg': 'image/svg+xml',
|
|
1369
1379
|
'.webp': 'image/webp',
|
|
1370
1380
|
}
|
|
1371
1381
|
|
|
@@ -1480,7 +1490,7 @@ export function buildSwiftResourceTable(
|
|
|
1480
1490
|
registered.set(`${sha256}.metal`, { bytes, contentType: 'text/plain; charset=utf-8' })
|
|
1481
1491
|
}
|
|
1482
1492
|
let imageBytes = 0
|
|
1483
|
-
for (const { name, file, scale, bundlePath } of found) {
|
|
1493
|
+
for (const { name, file, scale, bundlePath, renderingMode } of found) {
|
|
1484
1494
|
const disk = byRelative.get(file)
|
|
1485
1495
|
if (!disk) continue
|
|
1486
1496
|
if (Object.keys(images).length >= limits.images) {
|
|
@@ -1516,7 +1526,11 @@ export function buildSwiftResourceTable(
|
|
|
1516
1526
|
const hash = createHash('sha256').update(bytes).digest('hex').slice(0, 16)
|
|
1517
1527
|
const bundle = table[bundlePath] ?? Object.create(null)
|
|
1518
1528
|
const variants = (bundle[name] ??= [])
|
|
1519
|
-
variants.push({
|
|
1529
|
+
variants.push({
|
|
1530
|
+
uri: `${baseUrl}${RESOURCE_PATH}${hash}${ext}`,
|
|
1531
|
+
scale,
|
|
1532
|
+
...(renderingMode ? { renderingMode } : {}),
|
|
1533
|
+
})
|
|
1520
1534
|
table[bundlePath] = bundle
|
|
1521
1535
|
const key = layout ? xcodeInputKey(layout, disk, file) : file
|
|
1522
1536
|
images[key] = {
|
|
@@ -2062,6 +2076,21 @@ export function compileInput(packagePath: string, entry: string): SwiftCompileIn
|
|
|
2062
2076
|
)
|
|
2063
2077
|
}
|
|
2064
2078
|
|
|
2079
|
+
// the compile input of an installed workspace with the binary frameworks its
|
|
2080
|
+
// pods and project vendor, read from one layout.
|
|
2081
|
+
export function installedWorkspaceInput(
|
|
2082
|
+
packagePath: string,
|
|
2083
|
+
entry: string,
|
|
2084
|
+
): { input: SwiftCompileInput; binaryFrameworks: string[] } {
|
|
2085
|
+
return withXcodeLayout(() => {
|
|
2086
|
+
const input = snapshotCompileInput(packageSnapshot(projectFor(packagePath), entry))
|
|
2087
|
+
const binaryFrameworks = (
|
|
2088
|
+
xcodeLayout(fs.realpathSync(packagePath))?.app.binaryFrameworks ?? []
|
|
2089
|
+
).flatMap(({ path: dir }) => (dir ? [dir] : []))
|
|
2090
|
+
return { input, binaryFrameworks }
|
|
2091
|
+
})
|
|
2092
|
+
}
|
|
2093
|
+
|
|
2065
2094
|
async function compile(
|
|
2066
2095
|
packagePath: string,
|
|
2067
2096
|
stamp: string,
|
|
@@ -2088,20 +2117,13 @@ async function compile(
|
|
|
2088
2117
|
stamp,
|
|
2089
2118
|
package: content,
|
|
2090
2119
|
}
|
|
2091
|
-
// a linked checkout, else the installed distribution
|
|
2092
|
-
// package compiles on Contrast as before
|
|
2120
|
+
// a linked checkout, else the installed distribution
|
|
2093
2121
|
const moduleRoot =
|
|
2094
2122
|
moduleRootOverride ??
|
|
2095
2123
|
linkedModuleRoots(packagePath).find((root) =>
|
|
2096
2124
|
fs.existsSync(path.join(root, 'toolchain.json')),
|
|
2097
2125
|
) ??
|
|
2098
2126
|
(await swiftDistributionRoot(signal))
|
|
2099
|
-
if (!moduleRoot)
|
|
2100
|
-
return {
|
|
2101
|
-
...(await compileRemote(packagePath, snapshot, undefined, signal)),
|
|
2102
|
-
stamp,
|
|
2103
|
-
package: content,
|
|
2104
|
-
}
|
|
2105
2127
|
const toolchain = swiftModuleToolchain(moduleRoot)
|
|
2106
2128
|
const input = snapshotCompileInput(snapshot)
|
|
2107
2129
|
const compiled = {
|
|
@@ -2147,16 +2169,14 @@ async function compile(
|
|
|
2147
2169
|
if (process.env.CONTRAST_SWIFT_BUILD_ROOT)
|
|
2148
2170
|
return process.env.CONTRAST_SWIFT_BUILD_ROOT
|
|
2149
2171
|
const resolvedPath = path.resolve(packagePath)
|
|
2150
|
-
// units of one app share a root so the module cache stays warm
|
|
2151
|
-
// peach-expo-swift/<app>/<scope>/<package> shares
|
|
2152
|
-
//
|
|
2153
|
-
// process, so two servers do not compile into one tree.
|
|
2172
|
+
// units of one app share a root so the module cache stays warm across
|
|
2173
|
+
// server restarts: peach-expo-swift/<app>/<scope>/<package> shares
|
|
2174
|
+
// <app>. servers on one app queue on the root lock.
|
|
2154
2175
|
const parts = resolvedPath.split(path.sep)
|
|
2155
2176
|
const expoAt = parts.lastIndexOf('peach-expo-swift')
|
|
2156
|
-
const scoped = expoAt >= 0 && parts.length >= expoAt + 4
|
|
2157
2177
|
const buildKeyPath =
|
|
2158
2178
|
expoAt >= 0 && parts.length >= expoAt + 3
|
|
2159
|
-
? parts.slice(0,
|
|
2179
|
+
? parts.slice(0, expoAt + 2).join(path.sep)
|
|
2160
2180
|
: (sourceEntries.get(resolvedPath) ?? resolvedPath)
|
|
2161
2181
|
return path.join(
|
|
2162
2182
|
swiftCacheDir(),
|
|
@@ -2337,9 +2357,9 @@ async function missingModulesMessage(
|
|
|
2337
2357
|
].join('\n')
|
|
2338
2358
|
}
|
|
2339
2359
|
|
|
2340
|
-
// a
|
|
2341
|
-
//
|
|
2342
|
-
//
|
|
2360
|
+
// a hosted compile (`peach swift --upload-source`) compiles the package where
|
|
2361
|
+
// a Contrast project's compiles: Contrast's compile route, authorized by
|
|
2362
|
+
// `peach login` or PEACH_API_KEY. the service renders the
|
|
2343
2363
|
// native dispatch glue itself under the package's id and answers the wasm at a
|
|
2344
2364
|
// public content address, which is fetched once and served from this dev
|
|
2345
2365
|
// server like a local build. resource bytes share the compile snapshot and
|
|
@@ -2347,20 +2367,10 @@ async function missingModulesMessage(
|
|
|
2347
2367
|
async function compileRemote(
|
|
2348
2368
|
packagePath: string,
|
|
2349
2369
|
snapshot: SwiftPackageSnapshot,
|
|
2350
|
-
hosted
|
|
2370
|
+
hosted: SwiftHostedCompileOptions,
|
|
2351
2371
|
ownerSignal?: AbortSignal,
|
|
2352
2372
|
): Promise<Omit<SwiftArtifact, 'stamp' | 'package'>> {
|
|
2353
|
-
const
|
|
2354
|
-
if (!hosted && (!auth || auth.kind === 'github')) {
|
|
2355
|
-
throw new Error(
|
|
2356
|
-
`compiling ${path.basename(packagePath)} for Peach needs \`peach login\` or PEACH_API_KEY: this peachsim has no local SwiftUI module, so Contrast compiles it`,
|
|
2357
|
-
)
|
|
2358
|
-
}
|
|
2359
|
-
const origin =
|
|
2360
|
-
hosted?.origin ??
|
|
2361
|
-
resolveContrastBackendOrigin(auth?.kind === 'session' ? auth.origin : null)
|
|
2362
|
-
const authorization =
|
|
2363
|
-
hosted?.authorization ?? (auth ? authHeaderValue(auth) : undefined)
|
|
2373
|
+
const { origin, authorization } = hosted
|
|
2364
2374
|
const signal = AbortSignal.any([
|
|
2365
2375
|
...(ownerSignal ? [ownerSignal] : []),
|
|
2366
2376
|
AbortSignal.timeout(DEFAULT_SWIFT_COMPILE_BUILD_MS + 60_000),
|
|
@@ -2394,6 +2404,9 @@ async function compileRemote(
|
|
|
2394
2404
|
}
|
|
2395
2405
|
: {}),
|
|
2396
2406
|
...(snapshot.nativeTargets ? { nativeTargets: snapshot.nativeTargets } : {}),
|
|
2407
|
+
...(snapshot.defaultLocalization
|
|
2408
|
+
? { defaultLocalization: snapshot.defaultLocalization }
|
|
2409
|
+
: {}),
|
|
2397
2410
|
metalSources: snapshot.resources.metalUploads,
|
|
2398
2411
|
resourcePaths: snapshot.resourcePaths,
|
|
2399
2412
|
resourceBundles: snapshot.bundleFiles.bundles,
|