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/nitro-adapter.ts
CHANGED
|
@@ -1,35 +1,45 @@
|
|
|
1
|
-
// the private
|
|
2
|
-
// compile: the
|
|
3
|
-
//
|
|
4
|
-
// this build carries, then checked against the
|
|
5
|
-
// module root compiles with
|
|
6
|
-
// never reaches this machine.
|
|
1
|
+
// the private adapter archives an installed peach links into a native module
|
|
2
|
+
// compile: the Nitro adapter, and the TurboModule runtime, each built against
|
|
3
|
+
// the app's own original headers, downloaded from the Swift distribution endpoint,
|
|
4
|
+
// verified against the lock this build carries, then checked against the
|
|
5
|
+
// compiler, SDK and framework the module root compiles with
|
|
6
|
+
// (docs/swift-distribution.md). the adapter source never reaches this machine.
|
|
7
|
+
import { execFileSync, spawnSync } from 'node:child_process'
|
|
7
8
|
import fs from 'node:fs'
|
|
8
9
|
import path from 'node:path'
|
|
9
10
|
import { installVerifiedTarball } from '@contrast/runtime-delivery'
|
|
10
11
|
import { rnxHomeDir } from './home-paths'
|
|
11
|
-
import
|
|
12
|
+
import nitroLockJson from './nitro-adapter.lock.json' with { type: 'json' }
|
|
12
13
|
import {
|
|
14
|
+
ADAPTER_FAMILIES,
|
|
15
|
+
ADAPTER_MANIFEST,
|
|
16
|
+
adapterArchiveKey,
|
|
17
|
+
adapterPin,
|
|
18
|
+
digest,
|
|
13
19
|
headerDigests,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
type
|
|
20
|
-
type
|
|
21
|
-
type
|
|
20
|
+
parseAdapterLock,
|
|
21
|
+
parseAdapterManifest,
|
|
22
|
+
verifyInstalledAdapter,
|
|
23
|
+
type AdapterFamily,
|
|
24
|
+
type AdapterLock,
|
|
25
|
+
type AdapterManifest,
|
|
26
|
+
type AdapterPin,
|
|
27
|
+
type NitroAdapterRoots,
|
|
22
28
|
} from './nitroAdapterContract'
|
|
23
29
|
import { NITRO_GUEST_PLATFORM } from './nitroContract'
|
|
24
30
|
import { swiftDistributionAt, swiftModuleSdk, WASM_TRIPLE } from './swift-compile'
|
|
25
|
-
import {
|
|
26
|
-
import
|
|
31
|
+
import { swiftEndpoint } from './swift-distribution'
|
|
32
|
+
import { privateSwiftDistributionRoot, sourceSwiftCheckout } from './swift-toolchain'
|
|
33
|
+
import turboLockJson from './turbo-runtime.lock.json' with { type: 'json' }
|
|
27
34
|
|
|
28
|
-
/** the verified
|
|
29
|
-
export const
|
|
35
|
+
/** the verified archives this build ships, the only locks normal compiles use. */
|
|
36
|
+
export const committedAdapterLocks: Record<AdapterFamily, AdapterLock> = {
|
|
37
|
+
nitro: parseAdapterLock('nitro', nitroLockJson),
|
|
38
|
+
turbo: parseAdapterLock('turbo', turboLockJson),
|
|
39
|
+
}
|
|
30
40
|
|
|
31
|
-
export interface
|
|
32
|
-
manifest:
|
|
41
|
+
export interface AdapterArchive {
|
|
42
|
+
manifest: AdapterManifest
|
|
33
43
|
/** the static archive, base64, as SwiftCompileInput.libraries carries it. */
|
|
34
44
|
base64: string
|
|
35
45
|
}
|
|
@@ -44,11 +54,12 @@ const installedVersion = (root: string) =>
|
|
|
44
54
|
* fixes; the consumer cannot recompute it and the framework distribution id
|
|
45
55
|
* does not independently bind it. */
|
|
46
56
|
function selectPin(
|
|
47
|
-
|
|
48
|
-
|
|
57
|
+
family: AdapterFamily,
|
|
58
|
+
lock: AdapterLock,
|
|
59
|
+
roots: NitroAdapterRoots,
|
|
49
60
|
moduleRoot: string,
|
|
50
|
-
):
|
|
51
|
-
const {
|
|
61
|
+
): AdapterPin {
|
|
62
|
+
const { label } = ADAPTER_FAMILIES[family]
|
|
52
63
|
const distribution = swiftDistributionAt(moduleRoot)
|
|
53
64
|
if (!distribution) throw new Error(`${moduleRoot} holds no Swift distribution`)
|
|
54
65
|
const sdk = swiftModuleSdk(moduleRoot)
|
|
@@ -62,49 +73,106 @@ function selectPin(
|
|
|
62
73
|
].filter((name) => name !== false)
|
|
63
74
|
if (mismatched.length > 0)
|
|
64
75
|
throw new Error(
|
|
65
|
-
|
|
76
|
+
`${label} archives do not match this toolchain: ${mismatched.join(', ')}`,
|
|
66
77
|
)
|
|
67
|
-
const pin =
|
|
68
|
-
lock,
|
|
69
|
-
headerDigests({ nitroModules: nitro.root, reactNative: reactNative.root }),
|
|
70
|
-
)
|
|
78
|
+
const pin = adapterPin(lock, headerDigests(family, roots))
|
|
71
79
|
if (!pin)
|
|
72
80
|
throw new Error(
|
|
73
|
-
`this peach has no
|
|
81
|
+
`this peach has no ${label} for react-native ${installedVersion(roots.reactNative)}${roots.nitroModules ? ` with react-native-nitro-modules ${installedVersion(roots.nitroModules)}` : ''}`,
|
|
74
82
|
)
|
|
75
83
|
return pin
|
|
76
84
|
}
|
|
77
85
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
86
|
+
// a private distribution has no lock to pin an archive, so its adapter builds on
|
|
87
|
+
// this machine from a source checkout, bound to the distribution's own manifest,
|
|
88
|
+
// and caches by that identity. the builder's --verify recomputes every identity
|
|
89
|
+
// before a cached archive is reused, so a changed adapter source, header set or
|
|
90
|
+
// distribution rebuilds instead of linking a stale archive.
|
|
91
|
+
function privateAdapterArchive(
|
|
92
|
+
family: AdapterFamily,
|
|
93
|
+
roots: NitroAdapterRoots,
|
|
82
94
|
moduleRoot: string,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
|
|
95
|
+
): AdapterArchive {
|
|
96
|
+
const { label, key, archive } = ADAPTER_FAMILIES[family]
|
|
97
|
+
const distribution = swiftDistributionAt(moduleRoot)
|
|
98
|
+
if (!distribution) throw new Error(`${moduleRoot} holds no Swift distribution`)
|
|
99
|
+
const script = path.join(
|
|
100
|
+
sourceSwiftCheckout(),
|
|
101
|
+
'scripts/build-nitro-adapter-archive.ts',
|
|
102
|
+
)
|
|
103
|
+
if (!fs.existsSync(script))
|
|
89
104
|
throw new Error(
|
|
90
|
-
`
|
|
105
|
+
`the ${label} for a private Swift distribution builds from a Contrast source checkout`,
|
|
106
|
+
)
|
|
107
|
+
const dir = path.join(
|
|
108
|
+
rnxHomeDir(),
|
|
109
|
+
'swift',
|
|
110
|
+
`private-${key}-${digest({ distribution: distribution.id, ...headerDigests(family, roots) })}`,
|
|
111
|
+
)
|
|
112
|
+
const args = (target: string) => [
|
|
113
|
+
target,
|
|
114
|
+
'--family',
|
|
115
|
+
family,
|
|
116
|
+
'--react-native',
|
|
117
|
+
roots.reactNative,
|
|
118
|
+
...(roots.nitroModules ? ['--nitro-modules', roots.nitroModules] : []),
|
|
119
|
+
'--distribution',
|
|
120
|
+
moduleRoot,
|
|
121
|
+
]
|
|
122
|
+
const verified =
|
|
123
|
+
fs.existsSync(path.join(dir, ADAPTER_MANIFEST)) &&
|
|
124
|
+
spawnSync('bun', [script, '--verify', ...args(dir)], { stdio: 'ignore' }).status === 0
|
|
125
|
+
if (!verified) {
|
|
126
|
+
process.stderr.write(
|
|
127
|
+
`peach: building ${label} for private distribution ${distribution.id}…\n`,
|
|
91
128
|
)
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
129
|
+
const staged = `${dir}.${process.pid}`
|
|
130
|
+
fs.rmSync(staged, { recursive: true, force: true })
|
|
131
|
+
execFileSync('bun', [script, ...args(staged)], { stdio: ['ignore', 2, 2] })
|
|
132
|
+
fs.rmSync(dir, { recursive: true, force: true })
|
|
133
|
+
fs.renameSync(staged, dir)
|
|
134
|
+
}
|
|
135
|
+
const manifest = parseAdapterManifest(
|
|
136
|
+
family,
|
|
137
|
+
JSON.parse(fs.readFileSync(path.join(dir, ADAPTER_MANIFEST), 'utf8')),
|
|
138
|
+
)
|
|
139
|
+
return {
|
|
140
|
+
manifest,
|
|
141
|
+
base64: fs.readFileSync(path.join(dir, archive)).toString('base64'),
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/** the verified archive for an app's original headers: identity first, then
|
|
146
|
+
* the download, whose tarball and unpacked bytes the lock pins. */
|
|
147
|
+
export async function resolveAdapterArchive(
|
|
148
|
+
family: AdapterFamily,
|
|
149
|
+
roots: NitroAdapterRoots,
|
|
150
|
+
moduleRoot: string,
|
|
151
|
+
lock: AdapterLock,
|
|
152
|
+
signal?: AbortSignal,
|
|
153
|
+
): Promise<AdapterArchive> {
|
|
154
|
+
const { label, key } = ADAPTER_FAMILIES[family]
|
|
155
|
+
const privateRoot = privateSwiftDistributionRoot()
|
|
156
|
+
if (privateRoot && fs.realpathSync(privateRoot) === fs.realpathSync(moduleRoot))
|
|
157
|
+
return privateAdapterArchive(family, roots, moduleRoot)
|
|
158
|
+
const pin = selectPin(family, lock, roots, moduleRoot)
|
|
159
|
+
const dir = path.join(rnxHomeDir(), 'swift', `${key}-${pin.archive.sha256}`)
|
|
160
|
+
if (!fs.existsSync(path.join(dir, ADAPTER_MANIFEST))) {
|
|
161
|
+
const endpoint = swiftEndpoint()
|
|
162
|
+
process.stderr.write(`peach: downloading ${label} ${pin.archive.sha256}…\n`)
|
|
95
163
|
await installVerifiedTarball({
|
|
96
164
|
signal,
|
|
97
|
-
url: `${endpoint}/${
|
|
165
|
+
url: `${endpoint}/${adapterArchiveKey(family, pin)}`,
|
|
98
166
|
digest: { algorithm: 'sha256', encoding: 'hex', value: pin.archive.sha256 },
|
|
99
167
|
destDir: dir,
|
|
100
|
-
installedMarker:
|
|
101
|
-
label:
|
|
168
|
+
installedMarker: ADAPTER_MANIFEST,
|
|
169
|
+
label: `${label} archive`,
|
|
102
170
|
verify: (installed) => {
|
|
103
|
-
|
|
171
|
+
verifyInstalledAdapter(family, installed, pin)
|
|
104
172
|
},
|
|
105
173
|
})
|
|
106
174
|
}
|
|
107
|
-
const manifest =
|
|
175
|
+
const manifest = verifyInstalledAdapter(family, dir, pin)
|
|
108
176
|
return {
|
|
109
177
|
manifest,
|
|
110
178
|
base64: fs.readFileSync(path.join(dir, manifest.archive.path)).toString('base64'),
|
package/src/nitro-bundle.ts
CHANGED
|
@@ -13,32 +13,30 @@ import {
|
|
|
13
13
|
} from './nativePreparationContract'
|
|
14
14
|
import { compileNitroModule } from './nitro-compile'
|
|
15
15
|
import { discoverNitroProviders, selectNitroProviders } from './nitro-source'
|
|
16
|
-
import {
|
|
16
|
+
import { sharedNitroModule } from './nitro-superset'
|
|
17
|
+
import { swiftDistributionRoot } from './swift-distribution'
|
|
17
18
|
import { icuUrl, type SwiftArtifact } from './swift-host'
|
|
18
19
|
import type { NitroCompiledModule } from './nitroContract'
|
|
19
20
|
import type { IncomingMessage, ServerResponse } from 'node:http'
|
|
20
21
|
|
|
21
22
|
export const NITRO_ROUTE = '/__peach/nitro'
|
|
22
23
|
|
|
24
|
+
export type CompiledModuleAsset = { path: string; bytes: Buffer; contentType: string }
|
|
25
|
+
|
|
23
26
|
export interface NitroBundle {
|
|
24
27
|
metadata: NitroCompiledModule
|
|
25
|
-
assets:
|
|
28
|
+
assets: CompiledModuleAsset[]
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
const answeredPackages: ReadonlySet<string> = new Set(PEACH_ANSWERED_NATIVE_PACKAGE_NAMES)
|
|
29
32
|
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
export async function compileNitroApp(
|
|
38
|
-
appRoot: string,
|
|
39
|
-
origin: string,
|
|
40
|
-
moduleRoot?: string,
|
|
41
|
-
): Promise<{ metadata: NitroCompiledModule; artifact: SwiftArtifact } | null> {
|
|
33
|
+
// the installed iOS Nitro providers an app compiles and the HybridObject names
|
|
34
|
+
// its config answers, or null when none has an original constructor left. a
|
|
35
|
+
// provider Peach answers itself (a seam resolves before the original
|
|
36
|
+
// registration) is not compiled. a HybridObject the app's config answers, a
|
|
37
|
+
// view or an unsupported or file-answered name, registers no original
|
|
38
|
+
// constructor; a provider left with none is not compiled.
|
|
39
|
+
export async function selectCompiledNitroProviders(appRoot: string) {
|
|
42
40
|
const config = await loadRNXAppConfig(resolveAppProject(appRoot))
|
|
43
41
|
const providers = selectNitroProviders(await discoverNitroProviders(appRoot)).filter(
|
|
44
42
|
({ provider }) => !answeredPackages.has(provider.name),
|
|
@@ -56,19 +54,47 @@ export async function compileNitroApp(
|
|
|
56
54
|
}
|
|
57
55
|
const packageRoots = providers.map(({ provider }) => provider.root)
|
|
58
56
|
if (selectNitroProviders(packageRoots, answers).length === 0) return null
|
|
57
|
+
return { providers: providers.map(({ provider }) => provider), packageRoots, answers }
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// an expo app without its own ios project gets one from prebuild, the same
|
|
61
|
+
// prepared workspace its expo modules compile from
|
|
62
|
+
export async function nitroProjectRoot(appRoot: string): Promise<string> {
|
|
63
|
+
return readIosAppTarget(appRoot)
|
|
64
|
+
? appRoot
|
|
65
|
+
: (await prepareExpoNativeWorkspace(appRoot)).app
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// every provider selectCompiledNitroProviders returns compiles into one
|
|
69
|
+
// executable with the same compiler and asset addresses as local native loads.
|
|
70
|
+
// package javascript is carried verbatim by its bundler. asset urls are
|
|
71
|
+
// relative to `origin`.
|
|
72
|
+
export async function compileNitroApp(
|
|
73
|
+
appRoot: string,
|
|
74
|
+
origin: string,
|
|
75
|
+
moduleRoot?: string,
|
|
76
|
+
shared = true,
|
|
77
|
+
): Promise<{ metadata: NitroCompiledModule; artifact: SwiftArtifact | null } | null> {
|
|
78
|
+
const selection = await selectCompiledNitroProviders(appRoot)
|
|
79
|
+
if (!selection) return null
|
|
80
|
+
const { packageRoots, answers } = selection
|
|
81
|
+
const projectRoot = await nitroProjectRoot(appRoot)
|
|
82
|
+
// the providers' published executable serves an app whose inputs match it
|
|
83
|
+
const iosDeploymentTarget = readIosAppTarget(projectRoot)?.iosDeploymentTarget
|
|
84
|
+
const sharedModule =
|
|
85
|
+
shared && !moduleRoot && iosDeploymentTarget
|
|
86
|
+
? await sharedNitroModule({
|
|
87
|
+
appRoot,
|
|
88
|
+
iosDeploymentTarget,
|
|
89
|
+
providers: selection.providers,
|
|
90
|
+
answers,
|
|
91
|
+
})
|
|
92
|
+
: null
|
|
93
|
+
if (sharedModule) return { metadata: sharedModule, artifact: null }
|
|
59
94
|
// the adapter archive is built against the published distribution, so Nitro
|
|
60
95
|
// compiles against it even in a source checkout; the checkout framework has
|
|
61
96
|
// no manifest for the adapter identity check to bind.
|
|
62
97
|
const module = moduleRoot ?? (await swiftDistributionRoot())
|
|
63
|
-
if (!module)
|
|
64
|
-
throw new Error(
|
|
65
|
-
`Nitro compilation needs ${SWIFT_ENDPOINT_ENV} for the Swift distribution`,
|
|
66
|
-
)
|
|
67
|
-
// an expo app without its own ios project gets one from prebuild, the same
|
|
68
|
-
// prepared workspace its expo modules compile from
|
|
69
|
-
const projectRoot = readIosAppTarget(appRoot)
|
|
70
|
-
? appRoot
|
|
71
|
-
: (await prepareExpoNativeWorkspace(appRoot)).app
|
|
72
98
|
const { artifact, collection } = await compileNitroModule({
|
|
73
99
|
appRoot,
|
|
74
100
|
packageRoots,
|
|
@@ -93,14 +119,9 @@ export async function compileNitroApp(
|
|
|
93
119
|
}
|
|
94
120
|
}
|
|
95
121
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
): Promise<NitroBundle | null> {
|
|
100
|
-
const compiled = await compileNitroApp(appRoot, '', moduleRoot)
|
|
101
|
-
if (!compiled) return null
|
|
102
|
-
const { artifact, metadata } = compiled
|
|
103
|
-
const assets: NitroBundle['assets'] = [
|
|
122
|
+
/** a compiled module's served files: its wasm and, unless shared, its ICU. */
|
|
123
|
+
export function compiledModuleAssets(artifact: SwiftArtifact): CompiledModuleAsset[] {
|
|
124
|
+
const assets: CompiledModuleAsset[] = [
|
|
104
125
|
{
|
|
105
126
|
path: `__peach/swift/${artifact.hash}.wasm`,
|
|
106
127
|
bytes: artifact.bytes,
|
|
@@ -113,78 +134,95 @@ export async function buildNitroBundle(
|
|
|
113
134
|
bytes: artifact.icu.gzip,
|
|
114
135
|
contentType: 'application/gzip',
|
|
115
136
|
})
|
|
116
|
-
return
|
|
137
|
+
return assets
|
|
117
138
|
}
|
|
118
139
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
): Promise<void> {
|
|
130
|
-
const url = new URL(req.url ?? '/', 'http://localhost')
|
|
131
|
-
const remote = req.socket.remoteAddress?.replace(/^::ffff:/, '')
|
|
132
|
-
const origin = req.headers.origin
|
|
133
|
-
if (
|
|
134
|
-
!remote ||
|
|
135
|
-
!isLoopbackHost(remote) ||
|
|
136
|
-
(origin && !isLoopbackHost(new URL(origin).hostname))
|
|
137
|
-
) {
|
|
138
|
-
res.writeHead(403)
|
|
139
|
-
res.end('Nitro compilation requires a loopback client')
|
|
140
|
-
return
|
|
141
|
-
}
|
|
142
|
-
res.setHeader('Access-Control-Allow-Origin', origin ?? '*')
|
|
143
|
-
res.setHeader('Vary', 'Origin')
|
|
144
|
-
res.setHeader('Cross-Origin-Resource-Policy', 'cross-origin')
|
|
145
|
-
const root = url.searchParams.get('root')
|
|
146
|
-
const host = req.headers.host
|
|
147
|
-
if (req.method !== 'GET' || !root || !path.isAbsolute(root) || !host) {
|
|
148
|
-
res.writeHead(400)
|
|
149
|
-
res.end('Nitro compilation needs GET with an absolute app root')
|
|
150
|
-
return
|
|
140
|
+
export async function buildNitroBundle(
|
|
141
|
+
appRoot: string,
|
|
142
|
+
moduleRoot?: string,
|
|
143
|
+
shared = true,
|
|
144
|
+
): Promise<NitroBundle | null> {
|
|
145
|
+
const compiled = await compileNitroApp(appRoot, '', moduleRoot, shared)
|
|
146
|
+
if (!compiled) return null
|
|
147
|
+
return {
|
|
148
|
+
metadata: compiled.metadata,
|
|
149
|
+
assets: compiled.artifact ? compiledModuleAssets(compiled.artifact) : [],
|
|
151
150
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// the dev server's build of one kind of an app's installed native modules.
|
|
154
|
+
// one build per app root and dev server; concurrent boots share it. the
|
|
155
|
+
// compiler reuses an unchanged artifact, so a reload pays only the source
|
|
156
|
+
// check. its wasm and ICU are served from the same host by the Swift artifact
|
|
157
|
+
// route.
|
|
158
|
+
export function compiledModuleRequestHandler<Metadata>(
|
|
159
|
+
label: string,
|
|
160
|
+
compile: (appRoot: string, origin: string) => Promise<{ metadata: Metadata } | null>,
|
|
161
|
+
): (req: IncomingMessage, res: ServerResponse) => Promise<void> {
|
|
162
|
+
const compiling = new Map<string, Promise<Metadata | null>>()
|
|
163
|
+
const openPreparations = new NativePreparationReceipts<Metadata | null>()
|
|
164
|
+
return async (req, res) => {
|
|
165
|
+
const url = new URL(req.url ?? '/', 'http://localhost')
|
|
166
|
+
const remote = req.socket.remoteAddress?.replace(/^::ffff:/, '')
|
|
167
|
+
const origin = req.headers.origin
|
|
168
|
+
if (
|
|
169
|
+
!remote ||
|
|
170
|
+
!isLoopbackHost(remote) ||
|
|
171
|
+
(origin && !isLoopbackHost(new URL(origin).hostname))
|
|
172
|
+
) {
|
|
173
|
+
res.writeHead(403)
|
|
174
|
+
res.end(`${label} compilation requires a loopback client`)
|
|
175
|
+
return
|
|
176
|
+
}
|
|
177
|
+
res.setHeader('Access-Control-Allow-Origin', origin ?? '*')
|
|
178
|
+
res.setHeader('Vary', 'Origin')
|
|
179
|
+
res.setHeader('Cross-Origin-Resource-Policy', 'cross-origin')
|
|
180
|
+
const root = url.searchParams.get('root')
|
|
181
|
+
const host = req.headers.host
|
|
182
|
+
if (req.method !== 'GET' || !root || !path.isAbsolute(root) || !host) {
|
|
183
|
+
res.writeHead(400)
|
|
184
|
+
res.end(`${label} compilation needs GET with an absolute app root`)
|
|
185
|
+
return
|
|
186
|
+
}
|
|
187
|
+
try {
|
|
188
|
+
const key = `${host}\0${fs.realpathSync(root)}`
|
|
189
|
+
const prepared = openPreparations.take(
|
|
190
|
+
key,
|
|
191
|
+
url.searchParams.get(NATIVE_PREPARED_QUERY_PARAM),
|
|
192
|
+
)
|
|
193
|
+
if (prepared) {
|
|
194
|
+
res.writeHead(200, {
|
|
195
|
+
'Content-Type': 'application/json',
|
|
196
|
+
'Cache-Control': 'no-store',
|
|
197
|
+
})
|
|
198
|
+
res.end(JSON.stringify(prepared.value))
|
|
199
|
+
return
|
|
200
|
+
}
|
|
201
|
+
let pending = compiling.get(key)
|
|
202
|
+
if (!pending) {
|
|
203
|
+
pending = compile(fs.realpathSync(root), `http://${host}`)
|
|
204
|
+
.then((compiled) => compiled?.metadata ?? null)
|
|
205
|
+
.finally(() => compiling.delete(key))
|
|
206
|
+
compiling.set(key, pending)
|
|
207
|
+
}
|
|
208
|
+
const metadata = await pending
|
|
209
|
+
if (res.destroyed) return
|
|
210
|
+
openPreparations.store(
|
|
211
|
+
key,
|
|
212
|
+
url.searchParams.get(NATIVE_PREPARE_QUERY_PARAM),
|
|
213
|
+
metadata,
|
|
214
|
+
)
|
|
159
215
|
res.writeHead(200, {
|
|
160
216
|
'Content-Type': 'application/json',
|
|
161
217
|
'Cache-Control': 'no-store',
|
|
162
218
|
})
|
|
163
|
-
res.end(JSON.stringify(
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
pending = compileNitroApp(fs.realpathSync(root), `http://${host}`)
|
|
169
|
-
.then((compiled) => compiled?.metadata ?? null)
|
|
170
|
-
.finally(() => compiling.delete(key))
|
|
171
|
-
compiling.set(key, pending)
|
|
219
|
+
res.end(JSON.stringify(metadata))
|
|
220
|
+
} catch (error) {
|
|
221
|
+
if (res.destroyed) return
|
|
222
|
+
res.writeHead(500, { 'Content-Type': 'text/plain' })
|
|
223
|
+
res.end(error instanceof Error ? error.message : String(error))
|
|
172
224
|
}
|
|
173
|
-
const metadata = await pending
|
|
174
|
-
if (res.destroyed) return
|
|
175
|
-
openPreparations.store(
|
|
176
|
-
key,
|
|
177
|
-
url.searchParams.get(NATIVE_PREPARE_QUERY_PARAM),
|
|
178
|
-
metadata,
|
|
179
|
-
)
|
|
180
|
-
res.writeHead(200, {
|
|
181
|
-
'Content-Type': 'application/json',
|
|
182
|
-
'Cache-Control': 'no-store',
|
|
183
|
-
})
|
|
184
|
-
res.end(JSON.stringify(metadata))
|
|
185
|
-
} catch (error) {
|
|
186
|
-
if (res.destroyed) return
|
|
187
|
-
res.writeHead(500, { 'Content-Type': 'text/plain' })
|
|
188
|
-
res.end(error instanceof Error ? error.message : String(error))
|
|
189
225
|
}
|
|
190
226
|
}
|
|
227
|
+
|
|
228
|
+
export const handleNitroRequest = compiledModuleRequestHandler('Nitro', compileNitroApp)
|
package/src/nitro-compile.ts
CHANGED
|
@@ -4,9 +4,9 @@ import os from 'node:os'
|
|
|
4
4
|
import path from 'node:path'
|
|
5
5
|
import { readIosAppTarget } from './native-app-identity-project'
|
|
6
6
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
type
|
|
7
|
+
committedAdapterLocks,
|
|
8
|
+
resolveAdapterArchive,
|
|
9
|
+
type AdapterArchive,
|
|
10
10
|
} from './nitro-adapter'
|
|
11
11
|
import {
|
|
12
12
|
collectNitroSources,
|
|
@@ -58,7 +58,7 @@ function bundledNamespaceDefines(
|
|
|
58
58
|
// linking and reuse.
|
|
59
59
|
export function collectNitroCompileInput(
|
|
60
60
|
collection: NitroSourceCollection,
|
|
61
|
-
adapter:
|
|
61
|
+
adapter: AdapterArchive,
|
|
62
62
|
dependencies: SwiftCompileInput | null,
|
|
63
63
|
iosDeploymentTarget: string,
|
|
64
64
|
): SwiftCompileInput {
|
|
@@ -93,6 +93,11 @@ export function collectNitroCompileInput(
|
|
|
93
93
|
files['Sources/NitroCore/include/module.modulemap'] =
|
|
94
94
|
`${core.slice(0, -' export * }\n'.length)} header "PeachNitroEntry.hpp" export * }\n`
|
|
95
95
|
|
|
96
|
+
for (const target of collection.targets) {
|
|
97
|
+
if (target.cxxInterop) continue
|
|
98
|
+
files[`${target.path}/PeachPodPrefix.pch`] =
|
|
99
|
+
'#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#import <Foundation/Foundation.h>\n#endif\n'
|
|
100
|
+
}
|
|
96
101
|
const entry = 'Sources/PeachNitroApp/main.swift'
|
|
97
102
|
// every provider registers before the one runtime serves guest evaluation.
|
|
98
103
|
// the entry has no app to install the reactor's inline executor, so it does
|
|
@@ -110,7 +115,7 @@ export function collectNitroCompileInput(
|
|
|
110
115
|
...dependencyTargets,
|
|
111
116
|
...collection.targets.map(
|
|
112
117
|
(target) =>
|
|
113
|
-
`.target(name: ${JSON.stringify(target.name)}, dependencies: ${JSON.stringify(target.dependencies?.map((dependency) => dependency.name) ?? [])}, path: ${JSON.stringify(target.path)}, ${target.cxxInterop ? 'swiftSettings: [.interoperabilityMode(.Cxx)]' : `cxxSettings: [.define("DEBUG")${bundledNamespaceDefines(target.name, target.path, files)}]`}),`,
|
|
118
|
+
`.target(name: ${JSON.stringify(target.name)}, dependencies: ${JSON.stringify(target.dependencies?.map((dependency) => dependency.name) ?? [])}, path: ${JSON.stringify(target.path)}, ${target.cxxInterop ? 'swiftSettings: [.interoperabilityMode(.Cxx)]' : `cSettings: [.unsafeFlags(${JSON.stringify(['-include', `${target.path}/PeachPodPrefix.pch`])})], cxxSettings: [.define("DEBUG")${bundledNamespaceDefines(target.name, target.path, files)}, .unsafeFlags(${JSON.stringify(['-include', `${target.path}/PeachPodPrefix.pch`])})]`}),`,
|
|
114
119
|
),
|
|
115
120
|
`.executableTarget(name: "PeachNitroApp", dependencies: ${JSON.stringify(collection.registrations.map(({ target }) => target))}, swiftSettings: [.interoperabilityMode(.Cxx)]),`,
|
|
116
121
|
'], cxxLanguageStandard: .cxx20)',
|
|
@@ -183,7 +188,12 @@ export async function compileNitroModule(
|
|
|
183
188
|
)
|
|
184
189
|
const input = collectNitroCompileInput(
|
|
185
190
|
collection,
|
|
186
|
-
await
|
|
191
|
+
await resolveAdapterArchive(
|
|
192
|
+
'nitro',
|
|
193
|
+
{ nitroModules: collection.nitro.root, reactNative: collection.reactNative.root },
|
|
194
|
+
options.moduleRoot,
|
|
195
|
+
committedAdapterLocks.nitro,
|
|
196
|
+
),
|
|
187
197
|
dependencies,
|
|
188
198
|
iosDeploymentTarget,
|
|
189
199
|
)
|
|
@@ -59,31 +59,43 @@ export interface NitroDependencyHeader {
|
|
|
59
59
|
derivation?: { upstreamCommit: string; originalSha256: string }
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
// the archives React Native's podspecs pin, shared until a release moves one
|
|
63
|
+
const RN_SHARED_DEPENDENCIES: NitroDependency[] = [
|
|
64
|
+
{
|
|
65
|
+
name: 'RCT-Folly',
|
|
66
|
+
url: 'https://github.com/facebook/folly/archive/v2024.11.18.00.tar.gz',
|
|
67
|
+
sha256: 'b2c6879ba8ba625218d1ab9eefcc1611a9003d05bc2cb1a38f3bae21892e5167',
|
|
68
|
+
prefix: 'folly-2024.11.18.00',
|
|
69
|
+
headers: { from: 'folly', to: 'folly' },
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: 'boost',
|
|
73
|
+
url: 'https://github.com/react-native-community/boost-for-react-native/archive/v1.84.0.tar.gz',
|
|
74
|
+
sha256: '954a04e9468dee21259937b83a2b21c3985cc96f91ee0152a34a7f0f752093e8',
|
|
75
|
+
prefix: 'boost-for-react-native-1.84.0',
|
|
76
|
+
headers: { from: 'boost', to: 'boost' },
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
// the podspec's prepare_command renames src to double-conversion.
|
|
80
|
+
name: 'DoubleConversion',
|
|
81
|
+
url: 'https://github.com/google/double-conversion/archive/v1.1.6.tar.gz',
|
|
82
|
+
sha256: '6b850acd8e88515764472c52973277744a945f9a769a93968efc42efef64d67a',
|
|
83
|
+
prefix: 'double-conversion-1.1.6',
|
|
84
|
+
headers: { from: 'src', to: 'double-conversion' },
|
|
85
|
+
backport: { file: 'src/utils.h', ...DOUBLE_CONVERSION_WASM32_BACKPORT },
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: 'fast_float',
|
|
89
|
+
url: 'https://github.com/fastfloat/fast_float/archive/v8.0.0.tar.gz',
|
|
90
|
+
sha256: 'f312f2dc34c61e665f4b132c0307d6f70ad9420185fa831911bc24408acf625d',
|
|
91
|
+
prefix: 'fast_float-8.0.0',
|
|
92
|
+
headers: { from: 'include/fast_float', to: 'fast_float' },
|
|
93
|
+
},
|
|
94
|
+
]
|
|
95
|
+
|
|
62
96
|
const RN_DEPENDENCIES: Record<string, NitroDependency[]> = {
|
|
63
97
|
'0.83.1': [
|
|
64
|
-
|
|
65
|
-
name: 'RCT-Folly',
|
|
66
|
-
url: 'https://github.com/facebook/folly/archive/v2024.11.18.00.tar.gz',
|
|
67
|
-
sha256: 'b2c6879ba8ba625218d1ab9eefcc1611a9003d05bc2cb1a38f3bae21892e5167',
|
|
68
|
-
prefix: 'folly-2024.11.18.00',
|
|
69
|
-
headers: { from: 'folly', to: 'folly' },
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
name: 'boost',
|
|
73
|
-
url: 'https://github.com/react-native-community/boost-for-react-native/archive/v1.84.0.tar.gz',
|
|
74
|
-
sha256: '954a04e9468dee21259937b83a2b21c3985cc96f91ee0152a34a7f0f752093e8',
|
|
75
|
-
prefix: 'boost-for-react-native-1.84.0',
|
|
76
|
-
headers: { from: 'boost', to: 'boost' },
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
// the podspec's prepare_command renames src to double-conversion.
|
|
80
|
-
name: 'DoubleConversion',
|
|
81
|
-
url: 'https://github.com/google/double-conversion/archive/v1.1.6.tar.gz',
|
|
82
|
-
sha256: '6b850acd8e88515764472c52973277744a945f9a769a93968efc42efef64d67a',
|
|
83
|
-
prefix: 'double-conversion-1.1.6',
|
|
84
|
-
headers: { from: 'src', to: 'double-conversion' },
|
|
85
|
-
backport: { file: 'src/utils.h', ...DOUBLE_CONVERSION_WASM32_BACKPORT },
|
|
86
|
-
},
|
|
98
|
+
...RN_SHARED_DEPENDENCIES,
|
|
87
99
|
{
|
|
88
100
|
name: 'fmt',
|
|
89
101
|
url: 'https://github.com/fmtlib/fmt/archive/11.0.2.tar.gz',
|
|
@@ -91,12 +103,15 @@ const RN_DEPENDENCIES: Record<string, NitroDependency[]> = {
|
|
|
91
103
|
prefix: 'fmt-11.0.2',
|
|
92
104
|
headers: { from: 'include/fmt', to: 'fmt' },
|
|
93
105
|
},
|
|
106
|
+
],
|
|
107
|
+
'0.88.0': [
|
|
108
|
+
...RN_SHARED_DEPENDENCIES,
|
|
94
109
|
{
|
|
95
|
-
name: '
|
|
96
|
-
url: 'https://github.com/
|
|
97
|
-
sha256: '
|
|
98
|
-
prefix: '
|
|
99
|
-
headers: { from: 'include/
|
|
110
|
+
name: 'fmt',
|
|
111
|
+
url: 'https://github.com/fmtlib/fmt/archive/12.1.0.tar.gz',
|
|
112
|
+
sha256: 'ea7de4299689e12b6dddd392f9896f08fb0777ac7168897a244a6d6085043fea',
|
|
113
|
+
prefix: 'fmt-12.1.0',
|
|
114
|
+
headers: { from: 'include/fmt', to: 'fmt' },
|
|
100
115
|
},
|
|
101
116
|
],
|
|
102
117
|
}
|