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
|
@@ -0,0 +1,743 @@
|
|
|
1
|
+
//
|
|
2
|
+
// ws_options.h
|
|
3
|
+
// Network
|
|
4
|
+
//
|
|
5
|
+
// Copyright (c) 2018-2019, 2022 Apple Inc. All rights reserved.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#ifndef __NW_WS_OPTIONS_H__
|
|
9
|
+
#define __NW_WS_OPTIONS_H__
|
|
10
|
+
|
|
11
|
+
#ifndef __NW_INDIRECT__
|
|
12
|
+
#error "Please include <Network/Network.h> instead of this file directly."
|
|
13
|
+
#endif // __NW_INDIRECT__
|
|
14
|
+
|
|
15
|
+
#include <Network/error.h>
|
|
16
|
+
#include <Network/protocol_options.h>
|
|
17
|
+
|
|
18
|
+
__BEGIN_DECLS
|
|
19
|
+
|
|
20
|
+
NW_ASSUME_NONNULL_BEGIN
|
|
21
|
+
|
|
22
|
+
# pragma mark - WebSocket Constants
|
|
23
|
+
|
|
24
|
+
/*!
|
|
25
|
+
* @typedef nw_ws_opcode_t
|
|
26
|
+
* @abstract
|
|
27
|
+
* WebSocket opcodes that denote the type of frame sent or received by
|
|
28
|
+
* a WebSocket endpoint. Opcodes define the interpretation of their
|
|
29
|
+
* associated payload data.
|
|
30
|
+
*/
|
|
31
|
+
typedef enum {
|
|
32
|
+
|
|
33
|
+
/*!
|
|
34
|
+
* @const nw_ws_opcode_invalid Denotes an invalid frame.
|
|
35
|
+
*/
|
|
36
|
+
nw_ws_opcode_invalid = -1,
|
|
37
|
+
|
|
38
|
+
/*!
|
|
39
|
+
* @const nw_ws_opcode_cont Denotes a continuation frame.
|
|
40
|
+
*
|
|
41
|
+
* Protocol WebSocket handles continuation frames internally,
|
|
42
|
+
* so clients will not see or use continuation frames.
|
|
43
|
+
*/
|
|
44
|
+
nw_ws_opcode_cont = 0x0,
|
|
45
|
+
|
|
46
|
+
/*!
|
|
47
|
+
* @const nw_ws_opcode_text Denotes a text frame.
|
|
48
|
+
*/
|
|
49
|
+
nw_ws_opcode_text = 0x1,
|
|
50
|
+
|
|
51
|
+
/*!
|
|
52
|
+
* @const nw_ws_opcode_text Denotes a binary frame.
|
|
53
|
+
*/
|
|
54
|
+
nw_ws_opcode_binary = 0x2,
|
|
55
|
+
|
|
56
|
+
/*!
|
|
57
|
+
* @const nw_ws_opcode_text Denotes a close frame.
|
|
58
|
+
*/
|
|
59
|
+
nw_ws_opcode_close = 0x8,
|
|
60
|
+
|
|
61
|
+
/*!
|
|
62
|
+
* @const nw_ws_opcode_text Denotes a ping frame.
|
|
63
|
+
*/
|
|
64
|
+
nw_ws_opcode_ping = 0x9,
|
|
65
|
+
|
|
66
|
+
/*!
|
|
67
|
+
* @const nw_ws_opcode_text Denotes a pong frame.
|
|
68
|
+
*/
|
|
69
|
+
nw_ws_opcode_pong = 0xA,
|
|
70
|
+
|
|
71
|
+
} nw_ws_opcode_t;
|
|
72
|
+
|
|
73
|
+
/*!
|
|
74
|
+
* @typedef nw_ws_close_code_t
|
|
75
|
+
* @abstract
|
|
76
|
+
* WebSocket close codes that describe the reason for closing a WebSocket
|
|
77
|
+
* connection. Endpoints MAY use the following pre-defined status codes
|
|
78
|
+
* when sending a Close frame.
|
|
79
|
+
*/
|
|
80
|
+
typedef enum {
|
|
81
|
+
/*!
|
|
82
|
+
* @const nw_ws_close_code_normal_closure Indicates a normal closure,
|
|
83
|
+
* meaning that the purpose for which the connection was established
|
|
84
|
+
* has been fulfilled.
|
|
85
|
+
*/
|
|
86
|
+
nw_ws_close_code_normal_closure = 1000,
|
|
87
|
+
|
|
88
|
+
/*!
|
|
89
|
+
* @const nw_ws_close_code_normal_going_away Indicates that an endpoint is
|
|
90
|
+
* "going away", such as a server going down or a browser having
|
|
91
|
+
* navigated away from a page.
|
|
92
|
+
*/
|
|
93
|
+
nw_ws_close_code_going_away = 1001,
|
|
94
|
+
|
|
95
|
+
/*!
|
|
96
|
+
* @const nw_ws_close_code_protocol_error Indicates that an endpoint is
|
|
97
|
+
* terminating the connection due to a protocol error.
|
|
98
|
+
*/
|
|
99
|
+
nw_ws_close_code_protocol_error = 1002,
|
|
100
|
+
|
|
101
|
+
/*!
|
|
102
|
+
* @const nw_ws_close_code_normal_closure Indicates that an endpoint is
|
|
103
|
+
* terminating the connection because it has received a type of data
|
|
104
|
+
* it cannot accept (e.g., an endpoint that understands only text data
|
|
105
|
+
* MAY send this if it receives a binary message).
|
|
106
|
+
*/
|
|
107
|
+
nw_ws_close_code_unsupported_data = 1003,
|
|
108
|
+
|
|
109
|
+
/*!
|
|
110
|
+
* @const nw_ws_close_code_no_status_received A reserved value and MUST NOT
|
|
111
|
+
* be set as a status code in a Close control frame by an endpoint. It
|
|
112
|
+
* is designated for use in applications expecting a status code to
|
|
113
|
+
* indicate that no status code was actually present.
|
|
114
|
+
*/
|
|
115
|
+
nw_ws_close_code_no_status_received = 1005,
|
|
116
|
+
|
|
117
|
+
/*!
|
|
118
|
+
* @const nw_ws_close_code_abnormal_closure A reserved value and MUST NOT
|
|
119
|
+
* be set as a status code in a Close control frame by an endpoint.
|
|
120
|
+
* It is designated for use in applications expecting a status code to
|
|
121
|
+
* indicate that the connection was closed abnormally, e.g., without
|
|
122
|
+
* sending or receiving a Close control frame.
|
|
123
|
+
*/
|
|
124
|
+
nw_ws_close_code_abnormal_closure = 1006,
|
|
125
|
+
|
|
126
|
+
/*!
|
|
127
|
+
* @const nw_ws_close_code_invalid_frame_payload_data Indicates that an
|
|
128
|
+
* endpoint is terminating the connection because it has received data
|
|
129
|
+
* within a message that was not consistent with the type of the
|
|
130
|
+
* message (e.g., non-UTF-8 [RFC3629] data within a text message).
|
|
131
|
+
*/
|
|
132
|
+
nw_ws_close_code_invalid_frame_payload_data = 1007,
|
|
133
|
+
|
|
134
|
+
/*!
|
|
135
|
+
* @const nw_ws_close_code_policy_violation Indicates that an endpoint is
|
|
136
|
+
* terminating the connection because it has received a message that
|
|
137
|
+
* violates its policy. This is a generic status code that can be
|
|
138
|
+
* returned when there is no other more suitable status code (e.g.,
|
|
139
|
+
* 1003 or 1009) or if there is a need to hide specific details about
|
|
140
|
+
* the policy.
|
|
141
|
+
*/
|
|
142
|
+
nw_ws_close_code_policy_violation = 1008,
|
|
143
|
+
|
|
144
|
+
/*!
|
|
145
|
+
* @const nw_ws_close_code_message_too_big Indicates that an endpoint is
|
|
146
|
+
* terminating the connection because it has received a message that
|
|
147
|
+
* is too big for it to process.
|
|
148
|
+
*/
|
|
149
|
+
nw_ws_close_code_message_too_big = 1009,
|
|
150
|
+
|
|
151
|
+
/*!
|
|
152
|
+
* @const nw_ws_close_code_mandatory_extension Indicates that an endpoint
|
|
153
|
+
* (client) is terminating the connection because it has expected the
|
|
154
|
+
* server to negotiate one or more extensions, but the server didn't
|
|
155
|
+
* return them in the response message of the WebSocket handshake. The
|
|
156
|
+
* list of extensions that are needed SHOULD appear in the /reason/
|
|
157
|
+
* part of the Close frame. Note that this status code is not used by
|
|
158
|
+
* the server, because it can fail the WebSocket handshake instead.
|
|
159
|
+
*/
|
|
160
|
+
nw_ws_close_code_mandatory_extension = 1010,
|
|
161
|
+
|
|
162
|
+
/*!
|
|
163
|
+
* @const nw_ws_close_code_internal_server_error Indicates that a server is
|
|
164
|
+
* terminating the connection because it encountered an unexpected
|
|
165
|
+
* condition that prevented it from fulfilling the request.
|
|
166
|
+
*/
|
|
167
|
+
nw_ws_close_code_internal_server_error = 1011,
|
|
168
|
+
|
|
169
|
+
/*!
|
|
170
|
+
* @const nw_ws_close_code_tls_handshake A reserved value and MUST NOT
|
|
171
|
+
* be set as a status code in a Close control frame by an endpoint. It
|
|
172
|
+
* is designated for use in applications expecting a status code to
|
|
173
|
+
* indicate that the connection was closed due to a failure to perform
|
|
174
|
+
* a TLS handshake (e.g., the server certificate can't be verified).
|
|
175
|
+
*/
|
|
176
|
+
nw_ws_close_code_tls_handshake = 1015,
|
|
177
|
+
} nw_ws_close_code_t;
|
|
178
|
+
|
|
179
|
+
/*!
|
|
180
|
+
* @typedef nw_ws_version_t
|
|
181
|
+
* @abstract
|
|
182
|
+
* The WebSocket Protocol version.
|
|
183
|
+
*/
|
|
184
|
+
typedef enum {
|
|
185
|
+
/*! @const nw_ws_version_invalid An invalid WebSocket version */
|
|
186
|
+
nw_ws_version_invalid = 0,
|
|
187
|
+
/*! @const nw_ws_version_13 WebSocket v13 as defined in RFC 6455 */
|
|
188
|
+
nw_ws_version_13 = 1,
|
|
189
|
+
} nw_ws_version_t;
|
|
190
|
+
|
|
191
|
+
# pragma mark - WebSocket Definition
|
|
192
|
+
|
|
193
|
+
/*!
|
|
194
|
+
* @function nw_protocol_copy_ws_definition
|
|
195
|
+
*
|
|
196
|
+
* @abstract
|
|
197
|
+
* Access the definition of the default system implementation of the
|
|
198
|
+
* WebSocket protocol. This protocol can be appended to a connection's
|
|
199
|
+
* protocol stack.
|
|
200
|
+
*
|
|
201
|
+
* @result
|
|
202
|
+
* Returns a retained protocol definition object.
|
|
203
|
+
*/
|
|
204
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
205
|
+
NW_RETURNS_RETAINED nw_protocol_definition_t
|
|
206
|
+
nw_protocol_copy_ws_definition(void);
|
|
207
|
+
|
|
208
|
+
# pragma mark - WebSocket Options
|
|
209
|
+
|
|
210
|
+
/*!
|
|
211
|
+
* @function nw_ws_create_options
|
|
212
|
+
*
|
|
213
|
+
* @abstract
|
|
214
|
+
* Create an instance of WebSocket protocol options. This object can be
|
|
215
|
+
* added to an nw_protocol_stack_t to be used in an nw_connection_t or
|
|
216
|
+
* an nw_listener_t.
|
|
217
|
+
*
|
|
218
|
+
* @result
|
|
219
|
+
* Returns a retained protocol options object.
|
|
220
|
+
*/
|
|
221
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
222
|
+
NW_RETURNS_RETAINED nw_protocol_options_t
|
|
223
|
+
nw_ws_create_options(nw_ws_version_t version);
|
|
224
|
+
|
|
225
|
+
/*!
|
|
226
|
+
* @function nw_ws_options_add_additional_header
|
|
227
|
+
*
|
|
228
|
+
* @abstract
|
|
229
|
+
* Set additional HTTP headers to be sent by the client during the
|
|
230
|
+
* WebSocket handshake.
|
|
231
|
+
*
|
|
232
|
+
* @param options
|
|
233
|
+
* The WebSocket protocol options object.
|
|
234
|
+
*
|
|
235
|
+
* @param name
|
|
236
|
+
* The HTTP header name.
|
|
237
|
+
*
|
|
238
|
+
* @param value
|
|
239
|
+
* The HTTP header value.
|
|
240
|
+
*/
|
|
241
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
242
|
+
void
|
|
243
|
+
nw_ws_options_add_additional_header(nw_protocol_options_t options,
|
|
244
|
+
const char *name, const char *value);
|
|
245
|
+
|
|
246
|
+
/*!
|
|
247
|
+
* @function nw_ws_options_add_subprotocol
|
|
248
|
+
*
|
|
249
|
+
* @abstract
|
|
250
|
+
* Add to the list of subprotocols that will be presented to a
|
|
251
|
+
* WebSocket server during connection establishment.
|
|
252
|
+
*
|
|
253
|
+
* @param options
|
|
254
|
+
* The WebSocket protocol options object.
|
|
255
|
+
*
|
|
256
|
+
* @param subprotocol
|
|
257
|
+
* The subprotocol supported by the client.
|
|
258
|
+
*/
|
|
259
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
260
|
+
void
|
|
261
|
+
nw_ws_options_add_subprotocol(nw_protocol_options_t options,
|
|
262
|
+
const char *subprotocol);
|
|
263
|
+
|
|
264
|
+
/*!
|
|
265
|
+
* @function nw_ws_options_set_auto_reply_ping
|
|
266
|
+
*
|
|
267
|
+
* @abstract
|
|
268
|
+
* Set whether the WebSocket connection should automatically reply to all
|
|
269
|
+
* incoming pings. If set to true, the WebSocket protocol will automatically
|
|
270
|
+
* reply to incoming pings and will deliver the pings to receive requests
|
|
271
|
+
* on the connection.
|
|
272
|
+
*
|
|
273
|
+
* @param options
|
|
274
|
+
* The WebSocket protocol options object.
|
|
275
|
+
*
|
|
276
|
+
* @param auto_reply_ping
|
|
277
|
+
* Whether the WebSocket connection should automatically reply to all
|
|
278
|
+
* incoming pings.
|
|
279
|
+
*/
|
|
280
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
281
|
+
void
|
|
282
|
+
nw_ws_options_set_auto_reply_ping(nw_protocol_options_t options,
|
|
283
|
+
bool auto_reply_ping);
|
|
284
|
+
|
|
285
|
+
/*!
|
|
286
|
+
* @function nw_ws_options_set_skip_handshake
|
|
287
|
+
*
|
|
288
|
+
* @abstract
|
|
289
|
+
* Set whether the WebSocket protocol should skip the opening handshake
|
|
290
|
+
* and begin framing data as soon as a connection is established.
|
|
291
|
+
*
|
|
292
|
+
* @param options
|
|
293
|
+
* The WebSocket protocol options object.
|
|
294
|
+
*
|
|
295
|
+
* @param skip_handshake
|
|
296
|
+
* Whether the WebSocket connection should skip the opening handshake.
|
|
297
|
+
*/
|
|
298
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
299
|
+
void
|
|
300
|
+
nw_ws_options_set_skip_handshake(nw_protocol_options_t options, bool skip_handshake);
|
|
301
|
+
|
|
302
|
+
/*!
|
|
303
|
+
* @function nw_ws_options_set_maximum_message_size
|
|
304
|
+
*
|
|
305
|
+
* @abstract
|
|
306
|
+
* Set the maximum allowed message size to be received by the WebSocket
|
|
307
|
+
* connection. This does not limit the sending message size.
|
|
308
|
+
*
|
|
309
|
+
* @param options
|
|
310
|
+
* The WebSocket protocol options object.
|
|
311
|
+
*
|
|
312
|
+
* @param maximum_message_size
|
|
313
|
+
* The maximum message size in bytes. A maximum message size of 0 means
|
|
314
|
+
* there is no receive limit. The default maximum message size is 0.
|
|
315
|
+
*/
|
|
316
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
317
|
+
void
|
|
318
|
+
nw_ws_options_set_maximum_message_size(nw_protocol_options_t options,
|
|
319
|
+
size_t maximum_message_size);
|
|
320
|
+
|
|
321
|
+
# pragma mark - WebSocket Metadata
|
|
322
|
+
|
|
323
|
+
/*!
|
|
324
|
+
* @function nw_protocol_metadata_is_ws
|
|
325
|
+
*
|
|
326
|
+
* @abstract
|
|
327
|
+
* Checks if a protocol metadata object is compatible with the
|
|
328
|
+
* accessors defined in this file for the default system
|
|
329
|
+
* implementation of WebSocket.
|
|
330
|
+
*
|
|
331
|
+
* @result
|
|
332
|
+
* Returns true if the metadata is for the default system
|
|
333
|
+
* implementation of WebSocket, false otherwise.
|
|
334
|
+
*/
|
|
335
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
336
|
+
bool
|
|
337
|
+
nw_protocol_metadata_is_ws(nw_protocol_metadata_t metadata);
|
|
338
|
+
|
|
339
|
+
/*!
|
|
340
|
+
* @function nw_ws_create_metadata
|
|
341
|
+
*
|
|
342
|
+
* @abstract
|
|
343
|
+
* Creates a protocol metadata object that can be used to define the
|
|
344
|
+
* content context of messages sent over a WebSocket connection.
|
|
345
|
+
*
|
|
346
|
+
* @param opcode
|
|
347
|
+
* Set the opcode on a WebSocket frame. This must be defined on create.
|
|
348
|
+
*
|
|
349
|
+
* @result
|
|
350
|
+
* Returns a retained metadata object representing the WebSocket frame.
|
|
351
|
+
*/
|
|
352
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
353
|
+
NW_RETURNS_RETAINED nw_protocol_metadata_t
|
|
354
|
+
nw_ws_create_metadata(nw_ws_opcode_t opcode);
|
|
355
|
+
|
|
356
|
+
/*!
|
|
357
|
+
* @function nw_ws_metadata_get_opcode
|
|
358
|
+
*
|
|
359
|
+
* @abstract
|
|
360
|
+
* Get the opcode on a WebSocket frame.
|
|
361
|
+
*
|
|
362
|
+
* @param metadata
|
|
363
|
+
* The metadata object representing the WebSocket frame.
|
|
364
|
+
*
|
|
365
|
+
* @result
|
|
366
|
+
* The opcode on the WebSocket frame.
|
|
367
|
+
*/
|
|
368
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
369
|
+
nw_ws_opcode_t
|
|
370
|
+
nw_ws_metadata_get_opcode(nw_protocol_metadata_t metadata);
|
|
371
|
+
|
|
372
|
+
/*!
|
|
373
|
+
* @function nw_ws_metadata_set_close_code
|
|
374
|
+
*
|
|
375
|
+
* @abstract
|
|
376
|
+
* Set the close code on a WebSocket frame. The WebSocket frame's opcode
|
|
377
|
+
* should be nw_ws_opcode_close.
|
|
378
|
+
*
|
|
379
|
+
* @param metadata
|
|
380
|
+
* The metadata object representing the WebSocket frame.
|
|
381
|
+
*
|
|
382
|
+
* @param close_code
|
|
383
|
+
* The close code on the WebSocket frame.
|
|
384
|
+
*/
|
|
385
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
386
|
+
void
|
|
387
|
+
nw_ws_metadata_set_close_code(nw_protocol_metadata_t metadata, nw_ws_close_code_t close_code);
|
|
388
|
+
|
|
389
|
+
/*!
|
|
390
|
+
* @function nw_ws_metadata_get_close_code
|
|
391
|
+
*
|
|
392
|
+
* @abstract
|
|
393
|
+
* Get the close code from a WebSocket frame. If the close code is equal
|
|
394
|
+
* to nw_ws_close_code_no_status_received, it means that a close code
|
|
395
|
+
* was not actually present in the WebSocket frame.
|
|
396
|
+
*
|
|
397
|
+
* @param metadata
|
|
398
|
+
* The metadata object representing the WebSocket frame.
|
|
399
|
+
*
|
|
400
|
+
* @result
|
|
401
|
+
* The close code on the WebSocket frame.
|
|
402
|
+
*/
|
|
403
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
404
|
+
nw_ws_close_code_t
|
|
405
|
+
nw_ws_metadata_get_close_code(nw_protocol_metadata_t metadata);
|
|
406
|
+
|
|
407
|
+
#ifdef __BLOCKS__
|
|
408
|
+
|
|
409
|
+
/*!
|
|
410
|
+
* @typedef nw_ws_pong_handler_t
|
|
411
|
+
*
|
|
412
|
+
* @abstract
|
|
413
|
+
* A block to be invoked when a pong reply is received after sending a ping
|
|
414
|
+
* message, or if the WebSocket connection has closed or failed.
|
|
415
|
+
*
|
|
416
|
+
* @param error
|
|
417
|
+
* An optional error if the WebSocket connection fails or closes before a
|
|
418
|
+
* pong reply is received.
|
|
419
|
+
*/
|
|
420
|
+
typedef void (^nw_ws_pong_handler_t)(nw_error_t _Nullable error);
|
|
421
|
+
|
|
422
|
+
/*!
|
|
423
|
+
* @function nw_ws_metadata_set_pong_handler
|
|
424
|
+
*
|
|
425
|
+
* @abstract
|
|
426
|
+
* Set a callback that will notify the client when a pong message has been
|
|
427
|
+
* received for a ping message sent. The metadata object's associated
|
|
428
|
+
* opcode should be nw_ws_opcode_ping.
|
|
429
|
+
*
|
|
430
|
+
* @param metadata
|
|
431
|
+
* The WebSocket metadata object.
|
|
432
|
+
*
|
|
433
|
+
* @param client_queue
|
|
434
|
+
* The queue on which the pong handler will be delivered.
|
|
435
|
+
*
|
|
436
|
+
* @param pong_handler
|
|
437
|
+
* The handler that gets called when a pong reply is received.
|
|
438
|
+
*/
|
|
439
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
440
|
+
void
|
|
441
|
+
nw_ws_metadata_set_pong_handler(nw_protocol_metadata_t metadata,
|
|
442
|
+
dispatch_queue_t client_queue,
|
|
443
|
+
nw_ws_pong_handler_t pong_handler);
|
|
444
|
+
|
|
445
|
+
#endif // __BLOCKS__
|
|
446
|
+
|
|
447
|
+
# pragma mark - WebSocket Request
|
|
448
|
+
|
|
449
|
+
/*!
|
|
450
|
+
* @typedef nw_ws_request_t
|
|
451
|
+
* @abstract
|
|
452
|
+
* A WebSocket request represents a client's request to connect to a WebSocket
|
|
453
|
+
* server.
|
|
454
|
+
*
|
|
455
|
+
* This type supports ARC and the -[description] method. In non-ARC files, use
|
|
456
|
+
* nw_retain() and nw_release() to retain and release the object.
|
|
457
|
+
*/
|
|
458
|
+
#ifndef NW_WS_REQUEST_IMPL
|
|
459
|
+
NW_OBJECT_DECL(nw_ws_request);
|
|
460
|
+
#endif // NW_WS_REQUEST_IMPL
|
|
461
|
+
|
|
462
|
+
#ifdef __BLOCKS__
|
|
463
|
+
|
|
464
|
+
/*!
|
|
465
|
+
* @typedef nw_ws_subprotocol_enumerator_t
|
|
466
|
+
*
|
|
467
|
+
* @abstract
|
|
468
|
+
* A block that can be applied to every subprotocol in a client's WebSocket
|
|
469
|
+
* request.
|
|
470
|
+
*
|
|
471
|
+
* @param subprotocol
|
|
472
|
+
* A subprotocol presented by the client.
|
|
473
|
+
*
|
|
474
|
+
* @result
|
|
475
|
+
* A boolean value that indicating if enumeration should continue.
|
|
476
|
+
*/
|
|
477
|
+
typedef bool (^nw_ws_subprotocol_enumerator_t)(const char *subprotocol);
|
|
478
|
+
|
|
479
|
+
/*!
|
|
480
|
+
* @function nw_ws_request_enumerate_subprotocols
|
|
481
|
+
*
|
|
482
|
+
* @abstract
|
|
483
|
+
* Enumerates the list of subprotocols on the client's request.
|
|
484
|
+
*
|
|
485
|
+
* @param request
|
|
486
|
+
* The client request.
|
|
487
|
+
*
|
|
488
|
+
* @param enumerator
|
|
489
|
+
* The enumerator block.
|
|
490
|
+
*
|
|
491
|
+
* @result
|
|
492
|
+
* Whether the enumeration completed.
|
|
493
|
+
*/
|
|
494
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
495
|
+
bool
|
|
496
|
+
nw_ws_request_enumerate_subprotocols(nw_ws_request_t request,
|
|
497
|
+
NW_NOESCAPE nw_ws_subprotocol_enumerator_t enumerator);
|
|
498
|
+
|
|
499
|
+
/*!
|
|
500
|
+
* @typedef nw_ws_additional_header_enumerator_t
|
|
501
|
+
*
|
|
502
|
+
* @abstract
|
|
503
|
+
* A block that can be applied to every additional header in a client's
|
|
504
|
+
* WebSocket request.
|
|
505
|
+
*
|
|
506
|
+
* @param name
|
|
507
|
+
* The HTTP name.
|
|
508
|
+
*
|
|
509
|
+
* @param value
|
|
510
|
+
* The HTTP value.
|
|
511
|
+
*/
|
|
512
|
+
typedef bool (^nw_ws_additional_header_enumerator_t)(const char *name,
|
|
513
|
+
const char *value);
|
|
514
|
+
|
|
515
|
+
/*!
|
|
516
|
+
* @function nw_ws_request_enumerate_additional_headers
|
|
517
|
+
*
|
|
518
|
+
* @abstract
|
|
519
|
+
* Enumerates the list of additional headers on the client's request.
|
|
520
|
+
*
|
|
521
|
+
* @param request
|
|
522
|
+
* The client request.
|
|
523
|
+
*
|
|
524
|
+
* @param enumerator
|
|
525
|
+
* The enumerator block.
|
|
526
|
+
*
|
|
527
|
+
* @result
|
|
528
|
+
* Whether the enumeration completed.
|
|
529
|
+
*/
|
|
530
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
531
|
+
bool
|
|
532
|
+
nw_ws_request_enumerate_additional_headers(nw_ws_request_t request,
|
|
533
|
+
NW_NOESCAPE nw_ws_additional_header_enumerator_t enumerator);
|
|
534
|
+
|
|
535
|
+
#endif // __BLOCKS__
|
|
536
|
+
|
|
537
|
+
# pragma mark - WebSocket Response
|
|
538
|
+
|
|
539
|
+
/*!
|
|
540
|
+
* @typedef nw_ws_response_t
|
|
541
|
+
* @abstract
|
|
542
|
+
* A WebSocket response represents a server's response to a client's request
|
|
543
|
+
* to connect.
|
|
544
|
+
*
|
|
545
|
+
* This type supports ARC and the -[description] method. In non-ARC files, use
|
|
546
|
+
* nw_retain() and nw_release() to retain and release the object.
|
|
547
|
+
*/
|
|
548
|
+
#ifndef NW_WS_RESPONSE_IMPL
|
|
549
|
+
NW_OBJECT_DECL(nw_ws_response);
|
|
550
|
+
#endif // NW_WS_RESPONSE_IMPL
|
|
551
|
+
|
|
552
|
+
/*!
|
|
553
|
+
* @typedef nw_ws_response_status_t
|
|
554
|
+
* @abstract
|
|
555
|
+
* The status of a WebSocket server's response to a client's request to
|
|
556
|
+
* connect.
|
|
557
|
+
*/
|
|
558
|
+
typedef enum {
|
|
559
|
+
|
|
560
|
+
/*!
|
|
561
|
+
* @const nw_ws_response_status_invalid The response is invalid. This should
|
|
562
|
+
* be treated as an unexpected value.
|
|
563
|
+
*/
|
|
564
|
+
nw_ws_response_status_invalid = 0,
|
|
565
|
+
|
|
566
|
+
/*!
|
|
567
|
+
* @const nw_ws_response_status_accept Accept the request to connect. The
|
|
568
|
+
* WebSocket connection will begin framing data.
|
|
569
|
+
*/
|
|
570
|
+
nw_ws_response_status_accept = 1,
|
|
571
|
+
|
|
572
|
+
/*!
|
|
573
|
+
* @const nw_ws_response_status_accept Reject the request to connect. The
|
|
574
|
+
* WebSocket connection will be closed.
|
|
575
|
+
*/
|
|
576
|
+
nw_ws_response_status_reject = 2,
|
|
577
|
+
} nw_ws_response_status_t;
|
|
578
|
+
|
|
579
|
+
/*!
|
|
580
|
+
* @function nw_ws_response_create
|
|
581
|
+
*
|
|
582
|
+
* @abstract
|
|
583
|
+
* Create a server response to a WebSocket client's opening handshake.
|
|
584
|
+
*
|
|
585
|
+
* @param status
|
|
586
|
+
* The status of the response. If the status is nw_ws_response_status_accept,
|
|
587
|
+
* the server will accept the handshake and open the WebSocket connection.
|
|
588
|
+
* If the status is nw_ws_response_status_reject, the server will reject the
|
|
589
|
+
* handshake and respond with the HTTP error 400 Bad Request.
|
|
590
|
+
*
|
|
591
|
+
* @param selected_subprotocol
|
|
592
|
+
* The server's selected protocol from the client's list of proposed
|
|
593
|
+
* subprotocols. If the status of this response is nw_ws_response_status_reject,
|
|
594
|
+
* this parameter is ignored. Pass NULL to indicate the server did not find
|
|
595
|
+
* a suitable subprotocol, but has accepted the handshake anyways.
|
|
596
|
+
* Passing an empty string is prohibited by the WebSocket protocol.
|
|
597
|
+
*
|
|
598
|
+
* @result
|
|
599
|
+
* An instantiated WebSocket server response object.
|
|
600
|
+
*/
|
|
601
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
602
|
+
NW_RETURNS_RETAINED nw_ws_response_t
|
|
603
|
+
nw_ws_response_create(nw_ws_response_status_t status,
|
|
604
|
+
const char * _Nullable selected_subprotocol);
|
|
605
|
+
|
|
606
|
+
/*!
|
|
607
|
+
* @function nw_ws_response_get_status
|
|
608
|
+
*
|
|
609
|
+
* @abstract
|
|
610
|
+
* Get the status from a WebSocket server's response. If the response is
|
|
611
|
+
* nil, the return value will be nw_ws_response_status_invalid.
|
|
612
|
+
*
|
|
613
|
+
* @param response
|
|
614
|
+
* The server response.
|
|
615
|
+
*
|
|
616
|
+
* @result
|
|
617
|
+
* The status of the server's response.
|
|
618
|
+
*/
|
|
619
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
620
|
+
nw_ws_response_status_t
|
|
621
|
+
nw_ws_response_get_status(nw_ws_response_t _Nullable response);
|
|
622
|
+
|
|
623
|
+
/*!
|
|
624
|
+
* @function nw_ws_response_get_selected_subprotocol
|
|
625
|
+
*
|
|
626
|
+
* @abstract
|
|
627
|
+
* Get the selected subprotocol from a WebSocket server's response.
|
|
628
|
+
*
|
|
629
|
+
* @param response
|
|
630
|
+
* The server response.
|
|
631
|
+
*
|
|
632
|
+
* @result
|
|
633
|
+
* The status of the server's response.
|
|
634
|
+
*/
|
|
635
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
636
|
+
const char * _Nullable
|
|
637
|
+
nw_ws_response_get_selected_subprotocol(nw_ws_response_t response);
|
|
638
|
+
|
|
639
|
+
/*!
|
|
640
|
+
* @function nw_ws_response_add_additional_header
|
|
641
|
+
*
|
|
642
|
+
* @abstract
|
|
643
|
+
* Add additional HTTP headers to be sent back to the WebSocket client in
|
|
644
|
+
* the server's response.
|
|
645
|
+
*
|
|
646
|
+
* @param response
|
|
647
|
+
* The server response.
|
|
648
|
+
*
|
|
649
|
+
* @param name
|
|
650
|
+
* The HTTP name.
|
|
651
|
+
*
|
|
652
|
+
* @param value
|
|
653
|
+
* The HTTP value.
|
|
654
|
+
*/
|
|
655
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
656
|
+
void
|
|
657
|
+
nw_ws_response_add_additional_header(nw_ws_response_t response,
|
|
658
|
+
const char *name, const char *value);
|
|
659
|
+
|
|
660
|
+
/*!
|
|
661
|
+
* @function nw_ws_metadata_copy_server_response
|
|
662
|
+
*
|
|
663
|
+
* @abstract
|
|
664
|
+
* Copy the WebSocket server's response to a client's request to connect.
|
|
665
|
+
* If this is called on a WebSocket server, the response object will contain
|
|
666
|
+
* the server's own response to the client.
|
|
667
|
+
*
|
|
668
|
+
* @param metadata
|
|
669
|
+
* The metadata object representing the WebSocket connection.
|
|
670
|
+
*
|
|
671
|
+
* @result
|
|
672
|
+
* The server response.
|
|
673
|
+
*/
|
|
674
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
675
|
+
NW_RETURNS_RETAINED nw_ws_response_t
|
|
676
|
+
nw_ws_metadata_copy_server_response(nw_protocol_metadata_t metadata);
|
|
677
|
+
|
|
678
|
+
#ifdef __BLOCKS__
|
|
679
|
+
|
|
680
|
+
/*!
|
|
681
|
+
* @function nw_ws_response_enumerate_additional_headers
|
|
682
|
+
*
|
|
683
|
+
* @abstract
|
|
684
|
+
* Enumerates the list of additional headers on the server's response.
|
|
685
|
+
*
|
|
686
|
+
* @param response
|
|
687
|
+
* The server response.
|
|
688
|
+
*
|
|
689
|
+
* @param enumerator
|
|
690
|
+
* The enumerator block.
|
|
691
|
+
*
|
|
692
|
+
* @result
|
|
693
|
+
* Whether the enumeration completed.
|
|
694
|
+
*/
|
|
695
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
696
|
+
bool
|
|
697
|
+
nw_ws_response_enumerate_additional_headers(nw_ws_response_t response,
|
|
698
|
+
NW_NOESCAPE nw_ws_additional_header_enumerator_t enumerator);
|
|
699
|
+
|
|
700
|
+
/*!
|
|
701
|
+
* @typedef nw_ws_client_request_handler_t
|
|
702
|
+
*
|
|
703
|
+
* @abstract
|
|
704
|
+
* A block to be invoked when a WebSocket server receives a WebSocket
|
|
705
|
+
* client's request to connect.
|
|
706
|
+
*
|
|
707
|
+
* @param request
|
|
708
|
+
* The client request.
|
|
709
|
+
*
|
|
710
|
+
* @result
|
|
711
|
+
* The server response.
|
|
712
|
+
*/
|
|
713
|
+
typedef _Nonnull nw_ws_response_t (^nw_ws_client_request_handler_t)(_Nonnull nw_ws_request_t request);
|
|
714
|
+
|
|
715
|
+
/*!
|
|
716
|
+
* @typedef nw_ws_options_set_client_request_handler
|
|
717
|
+
*
|
|
718
|
+
* @abstract
|
|
719
|
+
* Set callback handler to be invoked when a WebSocket server receives a
|
|
720
|
+
* WebSocket client's request to connect.
|
|
721
|
+
*
|
|
722
|
+
* @param options
|
|
723
|
+
* The protocol options object.
|
|
724
|
+
*
|
|
725
|
+
* @param client_queue
|
|
726
|
+
* The queue on which the client request handler will be delivered.
|
|
727
|
+
*
|
|
728
|
+
* @param handler
|
|
729
|
+
* The callback handler.
|
|
730
|
+
*/
|
|
731
|
+
API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0))
|
|
732
|
+
void
|
|
733
|
+
nw_ws_options_set_client_request_handler(nw_protocol_options_t options,
|
|
734
|
+
dispatch_queue_t client_queue,
|
|
735
|
+
nw_ws_client_request_handler_t handler);
|
|
736
|
+
|
|
737
|
+
#endif // __BLOCKS__
|
|
738
|
+
|
|
739
|
+
NW_ASSUME_NONNULL_END
|
|
740
|
+
|
|
741
|
+
__END_DECLS
|
|
742
|
+
|
|
743
|
+
#endif /* __NW_WS_OPTIONS_H__ */
|