peachsim 0.1.2935 → 0.1.2937
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/LICENSE +6 -8
- package/cli/account-gate.ts +20 -3
- package/cli/app-bundle-resources.ts +66 -19
- package/cli/catalog/meta.ts +2 -106
- package/cli/command-agent.ts +7 -0
- package/cli/command-registry.ts +0 -1
- package/cli/commands/control.ts +13 -5
- package/cli/commands/daemon.ts +4 -2
- package/cli/commands/device.ts +78 -8
- package/cli/commands/do-chain.ts +11 -8
- package/cli/commands/inspect/core.ts +4 -9
- package/cli/commands/inspect/settling.ts +1 -0
- package/cli/commands/logout.ts +6 -1
- package/cli/commands/map.ts +2 -6
- package/cli/commands/package.ts +112 -57
- package/cli/commands/shell-url.ts +0 -1
- package/cli/download-auth.ts +2 -0
- package/cli/drivers/playwright-provisioning.ts +10 -38
- package/cli/github-workflow-identity.ts +8 -0
- package/cli/internal-child-contract.ts +1 -0
- package/cli/internal-child.ts +5 -0
- package/cli/main.ts +2 -10
- package/cli/outbound-endpoints.ts +26 -0
- package/detox/index.ts +227 -131
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +2 -2
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +47 -3
- package/dist-lib/bridge-contract-input.mjs +6 -6
- package/dist-lib/bridge-contract.cjs +10 -1
- package/dist-lib/bridge-contract.mjs +3 -3
- package/dist-lib/bundle-channel.cjs +12779 -9515
- package/dist-lib/capture-contract.cjs +39 -17
- package/dist-lib/capture-contract.mjs +3 -3
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +3 -3
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +2 -2
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +8 -8
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +6 -6
- package/dist-lib/detox/index.cjs +200 -132
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/esm-chunks/{acorn-Q5TRRYSO.mjs → acorn-IIBLEO25.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-UDWBTBVG.mjs → chunk-4FTPQKPT.mjs} +10 -1
- package/dist-lib/esm-chunks/chunk-4WIDTRBB.mjs +10232 -0
- package/dist-lib/esm-chunks/{chunk-LCMFYMT7.mjs → chunk-5QZOQ3NZ.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-BJ2OGUX7.mjs → chunk-CIY67HNL.mjs} +39 -17
- package/dist-lib/esm-chunks/{chunk-SKQTNQYE.mjs → chunk-CQFEMJ64.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-AXWVXRHX.mjs → chunk-CWVMCW23.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-MTALOHQR.mjs → chunk-F6DZ4DS2.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-I4R7IZRD.mjs → chunk-HJMF6O7L.mjs} +74 -46
- package/dist-lib/esm-chunks/chunk-I6T4PXJF.mjs +154 -0
- package/dist-lib/esm-chunks/{chunk-XWAUZKIA.mjs → chunk-IJU3JMWM.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-CXWUIOCH.mjs → chunk-KODEPXQC.mjs} +4 -4
- package/dist-lib/esm-chunks/{chunk-WJE5QHSD.mjs → chunk-LD4K2VBL.mjs} +155 -36
- package/dist-lib/esm-chunks/{chunk-2TSM64HI.mjs → chunk-LTE7YMEG.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-3GGOXUJA.mjs → chunk-M3CSKAJE.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-7G5UETIG.mjs → chunk-NA6DJPB6.mjs} +43 -1
- package/dist-lib/esm-chunks/{chunk-MSUHMNAI.mjs → chunk-NNAX24FS.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-VDJA4LP4.mjs → chunk-PZPJJBAS.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-UEEEJVQA.mjs → chunk-QXSTHMWN.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-S2RJB5I7.mjs → chunk-RBPVK5YI.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-VRAXNGYT.mjs → chunk-SCT5OFDV.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-T3M73LGP.mjs → chunk-U3CJGYSP.mjs} +50 -6
- package/dist-lib/esm-chunks/{chunk-SLUGTGQQ.mjs → chunk-VXTOQ522.mjs} +12 -6
- package/dist-lib/esm-chunks/{chunk-EL44SZMV.mjs → chunk-WMSVGYTH.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-FEDEPSEV.mjs → chunk-WRWINRWK.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-BNO52N2S.mjs → chunk-YZF2USRD.mjs} +1905 -8760
- package/dist-lib/esm-chunks/{chunk-TQLKYMVP.mjs → chunk-ZNHR6C3L.mjs} +1 -1
- package/dist-lib/esm-chunks/{download-auth-registry-G75MIT55.mjs → download-auth-registry-AHS5MSIB.mjs} +4 -4
- package/dist-lib/esm-chunks/{metro-layout-parser-FXLUDTYT.mjs → metro-layout-parser-24ZYK5UP.mjs} +3 -3
- package/dist-lib/esm-chunks/{swift-package-prebuilt-524D4MA2.mjs → swift-package-prebuilt-L4YNXQRD.mjs} +15 -15
- package/dist-lib/esm-chunks/{swift-sdk-app-module-EX544YJY.mjs → swift-sdk-app-module-RM652JSW.mjs} +87 -71
- package/dist-lib/esm-chunks/{swift-sdk-image-LOTMWVM7.mjs → swift-sdk-image-5PQ44UJT.mjs} +15 -15
- package/dist-lib/esm-chunks/{swift-sdk-image-producer-UO6B3M4U.mjs → swift-sdk-image-producer-GD3SM6YI.mjs} +5 -5
- package/dist-lib/esm-chunks/swift-sdk-later-data-62QYJ2KH.mjs +590 -0
- package/dist-lib/expo-swift-bundle.cjs +21037 -17896
- package/dist-lib/expo-swift-metadata.cjs +8 -2
- package/dist-lib/expo-swift-metadata.mjs +9 -8
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +22481 -18741
- package/dist-lib/host/fetch-proxy-handler.cjs +21079 -17980
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +68 -38
- package/dist-lib/kotlin-host.cjs +97 -21
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +3 -3
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +3 -3
- package/dist-lib/metro-production-bundle.cjs +23 -1
- package/dist-lib/metro-production-bundle.mjs +24 -4
- package/dist-lib/native-app-identity-project.cjs +3582 -571
- package/dist-lib/native-app-identity-project.mjs +1024 -398
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +6 -6
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +3 -3
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +2 -2
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +3 -3
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +132 -116
- package/dist-lib/public-origins-lib.json +215 -173
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +2 -2
- package/dist-lib/reap-browser.cjs +17 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +6 -7
- package/dist-lib/sdk.mjs +13 -14
- package/dist-lib/skills.cjs +23216 -19650
- package/dist-lib/swift-compile.cjs +4337 -2905
- package/dist-lib/swift-compile.mjs +15 -13
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +3 -3
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +6 -6
- package/dist-lib/swift-svg-raster.cjs +1 -1
- package/dist-lib/swift-svg-raster.mjs +2 -2
- package/dist-lib/swift-toolchain.cjs +19 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
- package/dist-lib/vendor/acorn.cjs +1 -1
- package/dist-lib/vendor/stream-json.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
- package/dist-lib/vendor/sucrase.cjs +1 -1
- package/dist-lib/vendor/terser.cjs +1 -1
- package/dist-lib/vendor/valibot.cjs +1 -1
- package/dist-lib/vendor/ws.cjs +94 -32
- package/dist-lib/vendor/zod.cjs +1 -1
- package/dist-lib/worklet-executable.cjs +8 -5
- package/dist-lib/worklet-executable.mjs +9 -6
- package/dist-types/packages/peach-engine/src/canvaskit-artifact-urls.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/capture/compositor-presentation-recording.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/generated/canvaskit-artifact-hashes.d.ts +26 -0
- package/dist-types/packages/peach-engine/src/engine/guest-scene-inspect.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/inspect-info.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/metalTypes.d.ts +32 -2
- package/dist-types/packages/peach-engine/src/engine/portalContract.d.ts +24 -0
- package/dist-types/packages/peach-engine/src/engine/remote-display-protocol.d.ts +12 -2
- package/dist-types/packages/peach-engine/src/guest/http-cookie-storage.d.ts +73 -0
- package/dist-types/packages/peach-engine/src/guest/native-evaluation-lease.d.ts +5 -0
- package/dist-types/packages/peach-engine/src/guest/nitro-jsi-host.d.ts +3 -1
- package/dist-types/packages/peach-engine/src/ios/apps/canvas-map-data.d.ts +225 -9
- package/dist-types/packages/peach-engine/src/ios/chrome-metrics.d.ts +4 -1
- package/dist-types/packages/peach-engine/src/ios/duo-vertical-bar-geometry.d.ts +0 -1
- package/dist-types/packages/peach-engine/src/native-preview-bundle.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/remote-stream/canvas-display-compositor.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/remote-stream/canvas-display-contract.d.ts +44 -10
- package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +4 -3
- package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +2 -4
- package/dist-types/packages/peach-engine/src/render-worker/metro-bundle-metadata.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/render-worker/native-widgetContract.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +15 -27
- package/dist-types/packages/peach-engine/src/render-worker/reanimated-readiness.d.ts +2 -6
- package/dist-types/packages/peach-engine/src/render-worker/shell-protocol.d.ts +11 -3
- package/dist-types/packages/peach-engine/src/settings/devices.d.ts +3 -1
- package/dist-types/packages/peach-engine/src/settings/duo-fold.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/webview-automation-host.d.ts +1 -1
- package/dist-types/packages/peach-globals/src/app-bundle-resources.d.ts +10 -0
- package/dist-types/packages/peach-globals/src/compositorBridgeContract.d.ts +1 -1
- package/dist-types/packages/peach-globals/src/hostStorageBridgeContract.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/index.d.ts +2 -2
- package/dist-types/packages/peach-globals/src/lockstepCaptureBridgeContract.d.ts +9 -6
- package/dist-types/packages/peach-globals/src/nodeContract.d.ts +11 -0
- package/dist-types/packages/peach-globals/src/oneWidgetContract.d.ts +28 -0
- package/package.json +2 -2
- package/runtime-companion.json +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreHaptics.framework/Headers/CoreHaptics.h +251 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INImage.h +14 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INIntent.h +18 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INIntentIdentifiers.h +30 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INIntentResponse.h +12 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INInteraction.h +35 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INObjectCollection.h +0 -7
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INObjectSection.h +0 -7
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INOutgoingMessageType.h +7 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INPerson.h +36 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INPersonHandle.h +22 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INSendMessageIntent+UserNotifications.h +6 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INSendMessageIntent.h +33 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INSpeakableString.h +24 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/Intents.h +11 -7
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMailComposeViewController.h +1 -1
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMessageComposeViewController.h +1 -1
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLRenderCommandEncoder.h +0 -8
- package/sdk/ios/System/Library/Frameworks/MetalTypes.framework/Headers/MetalTypes.h +8 -0
- package/sdk/ios/System/Library/Frameworks/Social.framework/Headers/SLServiceTypes.h +9 -0
- package/sdk/ios/System/Library/Frameworks/Social.framework/Headers/Social.h +1 -0
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotification.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationAction.h +2 -2
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationAttachment.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationCategory.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationContent.h +2 -2
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationRequest.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationResponse.h +2 -2
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationSound.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationTrigger.h +5 -5
- package/sdk/ios/usr/lib/swift/UIKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +4 -0
- package/sdk/ios/wasm/include/unistd.h +1 -0
- package/src/acorn-program.ts +3 -0
- package/src/audio-codec-archives.ts +141 -0
- package/src/bridge-contract-input.ts +61 -1
- package/src/bridge-contract.ts +45 -4
- package/src/bundle-channel.mjs +44 -30
- package/src/capture-contract.ts +57 -39
- package/src/conformance-comparison-contract.ts +2 -0
- package/src/expo-discovery-cache.ts +0 -2
- package/src/expo-macro-host.ts +8 -3
- package/src/expo-native-compiler-digest.ts +0 -1
- package/src/expo-native-prebuilt.ts +1 -1
- package/src/expo-native-workspace.ts +83 -45
- package/src/expo-pod-prebuilt.ts +1 -0
- package/src/expo-swift-host.ts +158 -77
- package/src/expo-swift-legacy-runtime-source.ts +12 -1
- package/src/expo-swift-view-source.ts +51 -20
- package/src/expo-workspace-exclusion.ts +7 -1
- package/src/expoSwiftContract.ts +10 -1
- package/src/ffmpeg-source-build.ts +123 -59
- package/src/genrule-archives.ts +7 -2
- package/src/genrule-library-builds.ts +101 -18
- package/src/host/bridge-host.ts +10 -1
- package/src/installed-native-libraries.ts +147 -23
- package/src/installed-package-versions.ts +30 -0
- package/src/ios-rn-bundle-request.ts +3 -1
- package/src/ios-rn-bundle.ts +38 -27
- package/src/ios-rn-compile.ts +23 -6
- package/src/ios-rn-startup.ts +2 -1
- package/src/java-module-abi.ts +4 -3
- package/src/kotlin-host.ts +4 -4
- package/src/kotlin-library-sources.ts +8 -5
- package/src/metro-production-bundle.ts +24 -0
- package/src/native-firebase-config.ts +2 -0
- package/src/native-framework-compiler.ts +5 -0
- package/src/native-package-slice-build.ts +3 -0
- package/src/native-package-slice.ts +15 -10
- package/src/native-preparation.ts +4 -1
- package/src/native-static-libraries.ts +107 -33
- package/src/nativeRuntimePackageIndex.ts +1 -4
- package/src/nitro-adapter.lock.json +286 -286
- package/src/nitro-app-providers.ts +20 -8
- package/src/nitro-compile.ts +131 -37
- package/src/nitro-dependencies.ts +42 -8
- package/src/nitro-source.ts +40 -36
- package/src/nitro-superset.lock.json +4 -4
- package/src/nitroAdapterContract.ts +32 -7
- package/src/nitroContract.ts +21 -37
- package/src/one-direct-host-source.ts +247 -140
- package/src/one-fabric.ts +129 -0
- package/src/one-native-controls-package.ts +95 -21
- package/src/one-native-controls-release.ts +147 -14
- package/src/one-native-source.ts +4 -1
- package/src/one-nitro-inputs.ts +1 -1
- package/src/one-nitro-source.ts +45 -1
- package/src/one-sdk/source.ts +10 -41
- package/src/one-widget-metadata.ts +2 -2
- package/src/one-widget-package.ts +1 -1
- package/src/oneSdkContract.ts +3 -0
- package/src/playwright-browser-paths.ts +30 -0
- package/src/pods-install.ts +6 -2
- package/src/pods-post-install.ts +2 -2
- package/src/pods-project.ts +10 -0
- package/src/podspec-ruby-stdlib.ts +73 -0
- package/src/podspec-ruby.ts +1 -1
- package/src/podspec-sources.ts +31 -13
- package/src/process-group.ts +135 -5
- package/src/published-swift-sdk.ts +25 -1
- package/src/react-native-bridge-modules.ts +35 -3
- package/src/react-native-core-build.ts +14 -2
- package/src/react-native-core.ts +12 -2
- package/src/rive-runtime-dependencies.ts +178 -40
- package/src/serverDiscoveryContract.ts +1 -1
- package/src/storageSnapshotContract.ts +1 -1
- package/src/swift-app-data-store.ts +35 -0
- package/src/swift-compile.ts +403 -121
- package/src/swift-compiler-digest.ts +4 -0
- package/src/swift-darwin-records.ts +6 -0
- package/src/swift-distribution-mirror.ts +10 -1
- package/src/swift-distribution.lock.json +19 -18
- package/src/swift-distribution.ts +17 -1
- package/src/swift-entry-module.ts +1 -0
- package/src/swift-guest-compile.ts +8 -1
- package/src/swift-host.ts +79 -23
- package/src/swift-installed-targets.ts +51 -20
- package/src/swift-objc-standin.ts +60 -8
- package/src/swift-packages.ts +104 -24
- package/src/swift-project-user.ts +2 -1
- package/src/swift-reproducible.ts +99 -1
- package/src/swift-root-lock.ts +52 -46
- package/src/swift-sdk-app-module.ts +65 -13
- package/src/swift-sdk-image-producer.ts +2 -1
- package/src/swift-sdk-image.ts +23 -8
- package/src/swift-sdk-later-data.ts +294 -44
- package/src/swift-sdk-surface.ts +233 -55
- package/src/swift-shared-sdk.ts +7 -0
- package/src/swift-standin-builtin-behavior.ts +18 -0
- package/src/swift-standin-emit.ts +242 -54
- package/src/swift-standins.ts +184 -38
- package/src/swift-startup-split.ts +19 -9
- package/src/swift-toolchain.ts +18 -0
- package/src/swift-wasm-prune.ts +179 -9
- package/src/swift-xcframework.ts +16 -0
- package/src/swiftContract.ts +4 -1
- package/src/swiftSdkLinkContract.ts +2 -0
- package/src/swiftTargetContract.ts +1 -0
- package/src/turbo-bundle.ts +6 -3
- package/src/turbo-codegen-intake.ts +106 -16
- package/src/turbo-compile.ts +89 -68
- package/src/turbo-fabric-app.ts +287 -23
- package/src/turbo-provider-host.ts +122 -31
- package/src/turbo-runtime.lock.json +26 -26
- package/src/turbo-source.ts +374 -157
- package/src/vite-plugin.ts +48 -112
- package/src/wasm-binary-sections.ts +40 -0
- package/src/wasm-code-immediates.ts +35 -5
- package/src/widget-extension-bundle.ts +15 -1
- package/src/worklet-executable.ts +2 -1
- package/src/worklet-kernel.ts +5 -3
- package/src/worklets-babel.ts +2 -1
- package/src/xcode-project.ts +151 -53
- package/src/xcode-scheme-actions.ts +104 -0
- package/cli/commands/canvas.ts +0 -1204
- package/dist-lib/esm-chunks/chunk-B5QD2KEV.mjs +0 -2787
- package/dist-lib/vendor/magic-string.cjs +0 -1693
- package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-cookies.d.ts +0 -127
- package/src/appBundleResourcesContract.ts +0 -51
- package/src/canvas-groups.ts +0 -28
- package/src/canvas-map-layout.ts +0 -161
- package/src/oneWidgetContract.ts +0 -134
|
@@ -23,6 +23,7 @@ export type GraphSymbol = {
|
|
|
23
23
|
declarationFragments?: SymbolFragment[]
|
|
24
24
|
accessLevel: string
|
|
25
25
|
spi?: boolean
|
|
26
|
+
objcAccessors?: { get?: string; set?: string }
|
|
26
27
|
functionSignature?: { returns?: SymbolFragment[] }
|
|
27
28
|
swiftExtension?: {
|
|
28
29
|
extendedModule: string
|
|
@@ -61,12 +62,22 @@ function extensionWhere(constraints: readonly GraphConstraint[] = []): string {
|
|
|
61
62
|
return ` where ${requirements.join(', ')}`
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
export function
|
|
65
|
+
export const SWIFT_OBJC_ONLY = /@available\(swift,\s*obsoleted:\s*[\d.]+\)/
|
|
66
|
+
export function exposeObjCOnlyDeclarations(source: string): string {
|
|
67
|
+
return source.replace(
|
|
68
|
+
new RegExp(`^ *${SWIFT_OBJC_ONLY.source} *\\n(?=[ \\t]*@objc\\b)`, 'gm'),
|
|
69
|
+
'',
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** the shipped interface owns the SPI groups and Objective-C exports omitted at intake. */
|
|
74
|
+
export function restoreSwiftInterfaceAttributes(
|
|
66
75
|
interfaceText: string,
|
|
67
76
|
module: string,
|
|
68
77
|
graphs: SymbolGraph[],
|
|
69
|
-
|
|
78
|
+
preserveObjC = false,
|
|
79
|
+
): Map<string, string> {
|
|
80
|
+
const superclasses = new Map<string, string>()
|
|
70
81
|
const modules = new Set([
|
|
71
82
|
module,
|
|
72
83
|
'Swift',
|
|
@@ -74,23 +85,56 @@ export function restoreSwiftInterfaceSPI(
|
|
|
74
85
|
...interfaceText.matchAll(/^\s*(?:@[\w.]+(?:\([^)]*\))?\s+)*import\s+(\w+)/gm),
|
|
75
86
|
].map((match) => match[1]!),
|
|
76
87
|
])
|
|
88
|
+
const attributePattern = String.raw`@[\w.]+(?:\((?:"(?:\\.|[^"\\])*"|[^()"\n]|\([^()\n]*\))*\))?`
|
|
89
|
+
const attribute = new RegExp(attributePattern, 'g')
|
|
90
|
+
const leadingAttributes = new RegExp(`^\\s*(?:${attributePattern}\\s*)*`)
|
|
77
91
|
const canonical = (declaration: string) =>
|
|
78
92
|
declaration
|
|
79
93
|
.replace(/::/g, '.')
|
|
80
|
-
.replace(
|
|
94
|
+
.replace(attribute, '')
|
|
81
95
|
.replace(/\b(?:public|open|final|convenience|override|required)\s+/g, '')
|
|
82
96
|
.replace(/\b(\w+)\./g, (prefix, name: string) => (modules.has(name) ? '' : prefix))
|
|
83
97
|
.replace(/\s*\{.*$/, '')
|
|
84
98
|
.replace(/\s+/g, '')
|
|
85
|
-
const declarations = new Map<
|
|
86
|
-
|
|
99
|
+
const declarations = new Map<
|
|
100
|
+
string,
|
|
101
|
+
{
|
|
102
|
+
spi: string
|
|
103
|
+
objc: string
|
|
104
|
+
signature: string
|
|
105
|
+
labels?: string
|
|
106
|
+
requirement: boolean
|
|
107
|
+
accessors?: GraphSymbol['objcAccessors']
|
|
108
|
+
}[]
|
|
109
|
+
>()
|
|
110
|
+
const scopes: {
|
|
111
|
+
depth: number
|
|
112
|
+
path: string[]
|
|
113
|
+
extensionSPI: string[]
|
|
114
|
+
protocol: boolean
|
|
115
|
+
}[] = []
|
|
87
116
|
let depth = 0
|
|
117
|
+
let precedingAttrs: string[] = []
|
|
118
|
+
let property:
|
|
119
|
+
| { depth: number; accessors: NonNullable<GraphSymbol['objcAccessors']> }
|
|
120
|
+
| undefined
|
|
88
121
|
for (const line of interfaceText.split('\n')) {
|
|
89
122
|
const enclosing = scopes.at(-1)?.path ?? []
|
|
123
|
+
const prefix = leadingAttributes.exec(line)![0]
|
|
124
|
+
const codeWithNoAttrs = line.slice(prefix.length).replace(/::/g, '.')
|
|
90
125
|
const declaration =
|
|
91
|
-
/^\s*(
|
|
92
|
-
|
|
126
|
+
/^\s*(?:\w+\s+)*?(class(?!\s+(?:func|var|subscript)\b)|struct|enum|protocol|actor|extension|func|var|let|init|subscript|typealias|case)\b\s*([/=\-+!*%<>&|^~?]+|[\w.`]*)/.exec(
|
|
127
|
+
codeWithNoAttrs,
|
|
93
128
|
)
|
|
129
|
+
if (!codeWithNoAttrs.trim() && line.trim().startsWith('@')) {
|
|
130
|
+
precedingAttrs.push(...line.match(attribute)!)
|
|
131
|
+
continue
|
|
132
|
+
}
|
|
133
|
+
if (property) {
|
|
134
|
+
const accessor = /^\s*@objc\((\w+:?)\)\s+(get|set)\b/.exec(line)
|
|
135
|
+
if (accessor?.[2] === 'get') property.accessors.get = accessor[1]
|
|
136
|
+
if (accessor?.[2] === 'set') property.accessors.set = accessor[1]
|
|
137
|
+
}
|
|
94
138
|
if (declaration) {
|
|
95
139
|
const kind = declaration[1]!
|
|
96
140
|
const nominal = /^(?:class|struct|enum|protocol|actor|extension)$/.test(kind)
|
|
@@ -106,18 +150,47 @@ export function restoreSwiftInterfaceSPI(
|
|
|
106
150
|
!(index === 0 && names.length > 1 && modules.has(part)),
|
|
107
151
|
)
|
|
108
152
|
: [...enclosing, name]
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
153
|
+
if (kind === 'class') {
|
|
154
|
+
const tail = codeWithNoAttrs.slice(declaration[0].length).split('{', 1)[0]!
|
|
155
|
+
const bases = splitTopLevel(tail, ':')[1]
|
|
156
|
+
const base = bases && splitTopLevel(bases)[0]
|
|
157
|
+
const generic = base && /^([\w.]+<.*>)(?=$|\s+where\b)/.exec(base)?.[1]
|
|
158
|
+
if (generic)
|
|
159
|
+
superclasses.set(
|
|
160
|
+
owner.join('.'),
|
|
161
|
+
generic.replaceAll(new RegExp('\\b' + module + '\\.', 'g'), ''),
|
|
162
|
+
)
|
|
163
|
+
}
|
|
164
|
+
const attrs = [...precedingAttrs, ...(prefix.match(attribute) ?? [])]
|
|
165
|
+
const ownSPI = attrs.filter((attr) => attr.startsWith('@_spi('))
|
|
166
|
+
const spi = [...new Set([...ownSPI, ...(scopes.at(-1)?.extensionSPI ?? [])])].join(
|
|
167
|
+
' ',
|
|
168
|
+
)
|
|
169
|
+
const objc =
|
|
170
|
+
preserveObjC && /^(?:func|var|let|init|subscript)$/.test(kind)
|
|
171
|
+
? attrs
|
|
172
|
+
.filter(
|
|
173
|
+
(attr) =>
|
|
174
|
+
/^@(?:objc(?:\(|$)|nonobjc$)/.test(attr) || SWIFT_OBJC_ONLY.test(attr),
|
|
175
|
+
)
|
|
176
|
+
.join(' ')
|
|
177
|
+
: ''
|
|
117
178
|
if (kind !== 'extension') {
|
|
118
179
|
const key = owner.join('.')
|
|
119
180
|
const candidates = declarations.get(key) ?? []
|
|
120
|
-
|
|
181
|
+
const accessors = objc && kind === 'var' && line.endsWith('{') ? {} : undefined
|
|
182
|
+
if (accessors) property = { depth: depth + 1, accessors }
|
|
183
|
+
candidates.push({
|
|
184
|
+
spi,
|
|
185
|
+
objc,
|
|
186
|
+
signature: canonical(line),
|
|
187
|
+
labels:
|
|
188
|
+
preserveObjC && /^(?:func|init|subscript)$/.test(kind)
|
|
189
|
+
? swiftArgumentLabels(codeWithNoAttrs.slice(declaration[0].length))
|
|
190
|
+
: undefined,
|
|
191
|
+
requirement: scopes.at(-1)?.protocol ?? false,
|
|
192
|
+
accessors,
|
|
193
|
+
})
|
|
121
194
|
declarations.set(key, candidates)
|
|
122
195
|
}
|
|
123
196
|
if (nominal && line.includes('{'))
|
|
@@ -125,41 +198,85 @@ export function restoreSwiftInterfaceSPI(
|
|
|
125
198
|
depth: depth + 1,
|
|
126
199
|
path: owner,
|
|
127
200
|
extensionSPI: kind === 'extension' ? ownSPI : [],
|
|
201
|
+
protocol: kind === 'protocol',
|
|
128
202
|
})
|
|
129
203
|
}
|
|
204
|
+
precedingAttrs = []
|
|
130
205
|
// interfaces contain declarations and attributes, with no executable bodies.
|
|
131
206
|
const code = line.replace(/"(?:\\.|[^"\\])*"|\/\/.*$/g, '')
|
|
132
207
|
depth += (code.match(/\{/g) ?? []).length - (code.match(/\}/g) ?? []).length
|
|
208
|
+
if (property && property.depth > depth) property = undefined
|
|
133
209
|
while (scopes.length && scopes.at(-1)!.depth > depth) scopes.pop()
|
|
134
210
|
}
|
|
211
|
+
const requirements = new Set(
|
|
212
|
+
preserveObjC
|
|
213
|
+
? graphs.flatMap((graph) =>
|
|
214
|
+
graph.relationships
|
|
215
|
+
.filter(
|
|
216
|
+
({ kind }) => kind === 'requirementOf' || kind === 'optionalRequirementOf',
|
|
217
|
+
)
|
|
218
|
+
.map(({ source }) => source),
|
|
219
|
+
)
|
|
220
|
+
: [],
|
|
221
|
+
)
|
|
135
222
|
for (const graph of graphs)
|
|
136
223
|
for (const symbol of graph.symbols) {
|
|
137
|
-
if (!symbol.spi || !isSwiftDeclaration(symbol)) continue
|
|
224
|
+
if ((!symbol.spi && !preserveObjC) || !isSwiftDeclaration(symbol)) continue
|
|
138
225
|
const key = symbol.pathComponents.map((part) => part.replace(/\(.*$/, '')).join('.')
|
|
139
|
-
const
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
226
|
+
const labels = /^\w+\((.*)\)$/.exec(symbol.pathComponents.at(-1) ?? '')?.[1]
|
|
227
|
+
const candidates = (declarations.get(key) ?? []).filter(
|
|
228
|
+
({ requirement, labels: vendorLabels }) =>
|
|
229
|
+
!preserveObjC ||
|
|
230
|
+
(requirement === requirements.has(symbol.identifier.precise) &&
|
|
231
|
+
(labels === undefined ||
|
|
232
|
+
vendorLabels === undefined ||
|
|
233
|
+
vendorLabels === labels)),
|
|
234
|
+
)
|
|
235
|
+
const declaration = (symbol.declarationFragments ?? [])
|
|
236
|
+
.map((fragment) => fragment.spelling)
|
|
237
|
+
.join('')
|
|
238
|
+
const attrs = (candidate: (typeof candidates)[number]) =>
|
|
239
|
+
[
|
|
240
|
+
symbol.spi ? candidate.spi : '',
|
|
241
|
+
/@(?:objc|nonobjc)\b/.test(declaration)
|
|
242
|
+
? candidate.objc.replace(/@(?:objc(?:\([^)]*\))?|nonobjc)(?!\w)/g, '').trim()
|
|
243
|
+
: candidate.objc,
|
|
244
|
+
]
|
|
245
|
+
.filter(Boolean)
|
|
246
|
+
.join(' ')
|
|
247
|
+
const groups = (matches: typeof candidates) =>
|
|
248
|
+
new Set(
|
|
249
|
+
matches.map((candidate) =>
|
|
250
|
+
JSON.stringify([
|
|
251
|
+
attrs(candidate),
|
|
252
|
+
candidate.accessors?.get,
|
|
253
|
+
candidate.accessors?.set,
|
|
254
|
+
]),
|
|
255
|
+
),
|
|
256
|
+
).size
|
|
257
|
+
const signature = canonical(declaration)
|
|
258
|
+
const matches =
|
|
259
|
+
groups(candidates) === 1
|
|
260
|
+
? candidates
|
|
261
|
+
: candidates.filter((candidate) => candidate.signature === signature)
|
|
262
|
+
const exact = groups(matches) === 1 ? matches[0] : undefined
|
|
263
|
+
if (!exact && symbol.spi)
|
|
154
264
|
throw new Error(
|
|
155
265
|
`${module}.${symbol.pathComponents.join('.')}: cannot recover native SPI groups`,
|
|
156
266
|
)
|
|
157
|
-
|
|
267
|
+
const restored = exact && attrs(exact).match(attribute)
|
|
268
|
+
if (restored)
|
|
158
269
|
symbol.declarationFragments = [
|
|
159
|
-
|
|
270
|
+
...restored.flatMap((spelling) => [
|
|
271
|
+
{ kind: 'attribute', spelling },
|
|
272
|
+
{ kind: 'text', spelling: ' ' },
|
|
273
|
+
]),
|
|
160
274
|
...(symbol.declarationFragments ?? []),
|
|
161
275
|
]
|
|
276
|
+
if (exact?.accessors?.get || exact?.accessors?.set)
|
|
277
|
+
symbol.objcAccessors = exact.accessors
|
|
162
278
|
}
|
|
279
|
+
return superclasses
|
|
163
280
|
}
|
|
164
281
|
|
|
165
282
|
export type StandinOptions = {
|
|
@@ -308,8 +425,16 @@ const OBJC_ONLY =
|
|
|
308
425
|
/@(?:objcMembers|objc|IBOutlet|IBInspectable|IBAction|IBSegueAction|GKInspectable|nonobjc|NSCopying|NSManaged)(?:\([^)]*\))?\s*|\bdynamic\s+/g
|
|
309
426
|
export const isSwiftDeclaration = (symbol: GraphSymbol) =>
|
|
310
427
|
symbol.identifier.precise.startsWith('s:') || /^c:@C?M@/.test(symbol.identifier.precise)
|
|
428
|
+
export const OBJC_UNREPRESENTABLE =
|
|
429
|
+
/cannot be (?:marked '@objc'|an implementation of an '@objc' requirement) because (?:(?:its|the) (?:result )?type|the type of the parameter(?: \d+)?) cannot be represented in Objective-C/
|
|
311
430
|
const isObjC = (symbol: GraphSymbol) =>
|
|
312
431
|
symbol.identifier.precise.startsWith('c:') && !isSwiftDeclaration(symbol)
|
|
432
|
+
const objcClassSelector = (symbol: GraphSymbol) =>
|
|
433
|
+
/^c:objc\(cs\)\w+\((?:cm|im)\)([A-Za-z_][A-Za-z_0-9:]*)$/.exec(
|
|
434
|
+
symbol.identifier.precise,
|
|
435
|
+
)?.[1]
|
|
436
|
+
const objcClassProperty = (symbol: GraphSymbol) =>
|
|
437
|
+
/^c:objc\(cs\)\w+\(py\)\w+$/.test(symbol.identifier.precise)
|
|
313
438
|
const text = (symbol: GraphSymbol) =>
|
|
314
439
|
isObjC(symbol)
|
|
315
440
|
? (symbol.declarationFragments ?? [])
|
|
@@ -669,6 +794,20 @@ function splitTopLevel(text: string, separator = ','): string[] {
|
|
|
669
794
|
return last ? [...parts, last] : parts
|
|
670
795
|
}
|
|
671
796
|
|
|
797
|
+
function swiftArgumentLabels(tail: string): string | undefined {
|
|
798
|
+
const start = tail.indexOf('(')
|
|
799
|
+
if (start < 0) return undefined
|
|
800
|
+
let depth = 1
|
|
801
|
+
for (let end = start + 1; end < tail.length; end++) {
|
|
802
|
+
if (tail[end] === '(') depth++
|
|
803
|
+
if (tail[end] === ')' && --depth === 0)
|
|
804
|
+
return splitTopLevel(tail.slice(start + 1, end))
|
|
805
|
+
.map((parameter) => `${parameter.split(/[:\s]/, 1)[0]}:`)
|
|
806
|
+
.join('')
|
|
807
|
+
}
|
|
808
|
+
return undefined
|
|
809
|
+
}
|
|
810
|
+
|
|
672
811
|
export function emitSwiftStandin(
|
|
673
812
|
sourceGraphs: SymbolGraph[],
|
|
674
813
|
options: StandinOptions,
|
|
@@ -695,6 +834,25 @@ export function emitSwiftStandin(
|
|
|
695
834
|
qualifyImportedTypes(graph, imported, importedTypeModules),
|
|
696
835
|
)
|
|
697
836
|
const nativeObjcProtocols = objcProtocolsInSwiftSignatures(graphs)
|
|
837
|
+
const adaptedObjcProtocols = new Set<string>()
|
|
838
|
+
if (options.unobjc?.size) {
|
|
839
|
+
const unrepresentable = new Set(
|
|
840
|
+
graphs.flatMap(({ symbols }) =>
|
|
841
|
+
symbols
|
|
842
|
+
.filter((symbol) => options.unobjc?.has(pathOf(symbol)))
|
|
843
|
+
.map(({ identifier }) => identifier.precise),
|
|
844
|
+
),
|
|
845
|
+
)
|
|
846
|
+
for (const { relationships } of graphs)
|
|
847
|
+
for (const { kind, source, target } of relationships)
|
|
848
|
+
if (
|
|
849
|
+
(kind === 'requirementOf' || kind === 'optionalRequirementOf') &&
|
|
850
|
+
unrepresentable.has(source)
|
|
851
|
+
) {
|
|
852
|
+
nativeObjcProtocols.delete(target)
|
|
853
|
+
adaptedObjcProtocols.add(target)
|
|
854
|
+
}
|
|
855
|
+
}
|
|
698
856
|
// clang enum graphs omit @objc even when the native compiler accepts that
|
|
699
857
|
// enum in an @objc swift declaration. preserve its original objc name when
|
|
700
858
|
// that declaration refers to the enum by its compiler identity.
|
|
@@ -703,8 +861,9 @@ export function emitSwiftStandin(
|
|
|
703
861
|
graph.symbols.flatMap((symbol) => {
|
|
704
862
|
const fragments = symbol.declarationFragments ?? []
|
|
705
863
|
if (
|
|
706
|
-
!isSwiftDeclaration(symbol)
|
|
707
|
-
|
|
864
|
+
!(isSwiftDeclaration(symbol)
|
|
865
|
+
? fragments.some((fragment) => /^@objc(?:\(|$)/.test(fragment.spelling))
|
|
866
|
+
: !options.inert && (objcClassSelector(symbol) || objcClassProperty(symbol)))
|
|
708
867
|
)
|
|
709
868
|
return []
|
|
710
869
|
return fragments.flatMap((fragment) =>
|
|
@@ -1291,15 +1450,19 @@ export function emitSwiftStandin(
|
|
|
1291
1450
|
const selector =
|
|
1292
1451
|
context.inClass &&
|
|
1293
1452
|
!options.inert &&
|
|
1294
|
-
member.kind.identifier === 'swift.type.method'
|
|
1453
|
+
(member.kind.identifier === 'swift.type.method' ||
|
|
1454
|
+
member.kind.identifier === 'swift.method') &&
|
|
1295
1455
|
!/\basync\b/.test(rest!)
|
|
1296
|
-
?
|
|
1297
|
-
member.identifier.precise,
|
|
1298
|
-
)?.[1]
|
|
1456
|
+
? objcClassSelector(member)
|
|
1299
1457
|
: undefined
|
|
1458
|
+
const property =
|
|
1459
|
+
context.inClass &&
|
|
1460
|
+
!options.inert &&
|
|
1461
|
+
objcClassProperty(member) &&
|
|
1462
|
+
!/@objc\b/.test(wrapped)
|
|
1300
1463
|
const attrs = options.unobjc?.has(path)
|
|
1301
1464
|
? wrapped.replace(/@objc(?:\([^)]*\))?\s*/g, '')
|
|
1302
|
-
: `${wrapped}${selector ? `@objc(${selector}) ` : ''}`
|
|
1465
|
+
: `${wrapped}${selector ? `@objc(${selector}) ` : property ? '@objc ' : ''}`
|
|
1303
1466
|
const modifiers =
|
|
1304
1467
|
/^((?:(?:required|final|override|convenience|unowned(?:\(\w+\))?|weak|lazy|nonisolated|mutating|nonmutating) )*)(.*)$/s.exec(
|
|
1305
1468
|
rest!,
|
|
@@ -1418,8 +1581,11 @@ export function emitSwiftStandin(
|
|
|
1418
1581
|
)
|
|
1419
1582
|
return
|
|
1420
1583
|
}
|
|
1584
|
+
const objc = options.unobjc?.has(path) ? undefined : member.objcAccessors
|
|
1585
|
+
const get = objc?.get ? `@objc(${objc.get}) get` : 'get'
|
|
1586
|
+
const set = objc?.set ? `@objc(${objc.set}) set` : 'set'
|
|
1421
1587
|
emit(
|
|
1422
|
-
`${head.replace(/@NSCopying\b\s*/g, '')}${computed} { get${effects} { ${getter} }${settable && !effects ? ` ${parsed.nonmutating ? 'nonmutating ' : ''}set { ${measured?.set ?? (options.inert ? '' : trap(path))} }` : ''} }`,
|
|
1588
|
+
`${head.replace(/@NSCopying\b\s*/g, '')}${computed} { ${get}${effects} { ${getter} }${settable && !effects ? ` ${parsed.nonmutating ? 'nonmutating ' : ''}${set} { ${measured?.set ?? (options.inert ? '' : trap(path))} }` : ''} }`,
|
|
1423
1589
|
)
|
|
1424
1590
|
return
|
|
1425
1591
|
}
|
|
@@ -1589,9 +1755,20 @@ export function emitSwiftStandin(
|
|
|
1589
1755
|
openOwner: open,
|
|
1590
1756
|
inClass: true,
|
|
1591
1757
|
})
|
|
1758
|
+
// a swift root class can expose only convenience initializers while
|
|
1759
|
+
// its private designated initializer is absent from the graph.
|
|
1760
|
+
if (
|
|
1761
|
+
!parent &&
|
|
1762
|
+
!options.inert &&
|
|
1763
|
+
!designated(id) &&
|
|
1764
|
+
members.some((member) => leaf(member) === 'init()')
|
|
1765
|
+
)
|
|
1766
|
+
emit(
|
|
1767
|
+
`${inner}private init(_peachInert: Void) { ${trap(path + '.init(_peachInert:)')} }`,
|
|
1768
|
+
)
|
|
1592
1769
|
// a class that declares any designated init loses the inherited
|
|
1593
1770
|
// ones, and a coder-requiring superclass then needs its own.
|
|
1594
|
-
const
|
|
1771
|
+
const hasDesignated = members.some(
|
|
1595
1772
|
(member) =>
|
|
1596
1773
|
member.kind.identifier === 'swift.init' &&
|
|
1597
1774
|
!text(member).startsWith('convenience'),
|
|
@@ -1669,11 +1846,11 @@ export function emitSwiftStandin(
|
|
|
1669
1846
|
else emitWitness(member, inner, path, open && isObjC(member))
|
|
1670
1847
|
}
|
|
1671
1848
|
}
|
|
1672
|
-
if (options.inert &&
|
|
1849
|
+
if (options.inert && hasDesignated && classBuild(id) === 'hidden')
|
|
1673
1850
|
emitAt(hiddenInit(id), `${inner}init(_peachInert: Void) { ${superInit(id)} }`)
|
|
1674
1851
|
const coder = members.some((member) => leaf(member) === 'init(coder:)')
|
|
1675
1852
|
if (
|
|
1676
|
-
|
|
1853
|
+
hasDesignated &&
|
|
1677
1854
|
!coder &&
|
|
1678
1855
|
externalRoot(id) !== 'NSObject' &&
|
|
1679
1856
|
externalRoot(id) !== null
|
|
@@ -1684,7 +1861,7 @@ export function emitSwiftStandin(
|
|
|
1684
1861
|
// a designated init drops the inherited required init(), so a
|
|
1685
1862
|
// subclass restates it
|
|
1686
1863
|
if (
|
|
1687
|
-
|
|
1864
|
+
hasDesignated &&
|
|
1688
1865
|
!members.some((member) => leaf(member) === 'init()') &&
|
|
1689
1866
|
[...superChain(id)].some((at) =>
|
|
1690
1867
|
options.requiredInits?.has(`${pathOf(byId.get(at)!)}.init()`),
|
|
@@ -1843,6 +2020,7 @@ export function emitSwiftStandin(
|
|
|
1843
2020
|
path,
|
|
1844
2021
|
reason: `unparsed protocol ${text(symbol)}`,
|
|
1845
2022
|
})
|
|
2023
|
+
const adapt = adaptedObjcProtocols.has(id)
|
|
1846
2024
|
const native = nativeObjcProtocols.has(id)
|
|
1847
2025
|
const objcName = native ? /^c:objc\(pl\)(\w+)$/.exec(id)?.[1] : undefined
|
|
1848
2026
|
if (native && !objcName)
|
|
@@ -1853,11 +2031,11 @@ export function emitSwiftStandin(
|
|
|
1853
2031
|
// adapted objective-c protocols are class-bound; native ones are
|
|
1854
2032
|
// class-bound by @objc itself.
|
|
1855
2033
|
const list = [
|
|
1856
|
-
...(isObjC(symbol) && !native ? ['AnyObject'] : []),
|
|
2034
|
+
...((isObjC(symbol) || adapt) && !native ? ['AnyObject'] : []),
|
|
1857
2035
|
...inheritance(id),
|
|
1858
2036
|
]
|
|
1859
2037
|
emit(
|
|
1860
|
-
`${indent}${shape.attrs}${objcName ? `@objc(${objcName}) ` : ''}public protocol ${shape.name}${list.length ? `: ${list.join(', ')}` : ''}${shape.where} {`,
|
|
2038
|
+
`${indent}${adapt ? shape.attrs.replace(OBJC_ONLY, '') : shape.attrs}${objcName ? `@objc(${objcName}) ` : ''}public protocol ${shape.name}${list.length ? `: ${list.join(', ')}` : ''}${shape.where} {`,
|
|
1861
2039
|
)
|
|
1862
2040
|
const members = membersOf(id)
|
|
1863
2041
|
const defaults: GraphSymbol[] = []
|
|
@@ -1874,7 +2052,7 @@ export function emitSwiftStandin(
|
|
|
1874
2052
|
defaults.push(member)
|
|
1875
2053
|
continue
|
|
1876
2054
|
}
|
|
1877
|
-
emitRequirement(member, inner, native)
|
|
2055
|
+
emitRequirement(member, inner, native, adapt)
|
|
1878
2056
|
if (
|
|
1879
2057
|
isObjC(symbol) &&
|
|
1880
2058
|
!native &&
|
|
@@ -1917,11 +2095,11 @@ export function emitSwiftStandin(
|
|
|
1917
2095
|
owner: string,
|
|
1918
2096
|
openObjC = false,
|
|
1919
2097
|
) => {
|
|
1920
|
-
const visibility = openObjC ? 'open' : 'public'
|
|
1921
2098
|
const { 2: rest } = LEADING_ATTRS.exec(text(member))!
|
|
1922
2099
|
const decl = rest!
|
|
1923
2100
|
.replace(/^(?:weak |unowned )/, '')
|
|
1924
2101
|
.replace(/^((?:static )?)let /, '$1var ')
|
|
2102
|
+
const visibility = openObjC && !decl.startsWith('static ') ? 'open' : 'public'
|
|
1925
2103
|
const witness = `${owner}.${leaf(member)}`
|
|
1926
2104
|
// a superclass the graph cannot see already declares what the compiler says must override
|
|
1927
2105
|
if (options.forcedOverride?.has(witness)) return
|
|
@@ -1951,7 +2129,7 @@ export function emitSwiftStandin(
|
|
|
1951
2129
|
|
|
1952
2130
|
// a protocol requirement: no access modifier, body, or default values
|
|
1953
2131
|
const emitRequirement = scoped(
|
|
1954
|
-
(member: GraphSymbol, indent: string, native: boolean) => {
|
|
2132
|
+
(member: GraphSymbol, indent: string, native: boolean, adapt: boolean) => {
|
|
1955
2133
|
const { 1: attrs, 2: rest } = LEADING_ATTRS.exec(text(member))!
|
|
1956
2134
|
let declaration = stripDefaults(
|
|
1957
2135
|
rest!.replace(/^(?:weak |unowned )/, '').replace(/^((?:static )?)let /, '$1var '),
|
|
@@ -1987,7 +2165,7 @@ export function emitSwiftStandin(
|
|
|
1987
2165
|
}
|
|
1988
2166
|
}
|
|
1989
2167
|
emit(
|
|
1990
|
-
`${indent}${attrs}${objc}${native && optional.has(member.identifier.precise) ? 'optional ' : ''}${declaration}`,
|
|
2168
|
+
`${indent}${adapt ? attrs!.replace(OBJC_ONLY, '') : attrs}${objc}${native && optional.has(member.identifier.precise) ? 'optional ' : ''}${declaration}`,
|
|
1991
2169
|
)
|
|
1992
2170
|
},
|
|
1993
2171
|
)
|
|
@@ -2031,8 +2209,18 @@ export function emitSwiftStandin(
|
|
|
2031
2209
|
: /\bResult</.test(spelled)
|
|
2032
2210
|
? measured?.resultBody
|
|
2033
2211
|
: undefined
|
|
2212
|
+
const returns = symbol.functionSignature?.returns
|
|
2213
|
+
?.map(({ spelling }) => spelling)
|
|
2214
|
+
.join('')
|
|
2215
|
+
const discardable =
|
|
2216
|
+
/^c:(?:@M@[^@]+)?@F@/.test(symbol.identifier.precise) &&
|
|
2217
|
+
!attrs?.includes('@discardableResult') &&
|
|
2218
|
+
returns &&
|
|
2219
|
+
!/^(?:\(\)|(?:Swift(?:::|\.))?(?:Void|Never))$/.test(returns)
|
|
2220
|
+
? '@discardableResult '
|
|
2221
|
+
: ''
|
|
2034
2222
|
emit(
|
|
2035
|
-
`${attrs}public ${spelled} { ${overloadBody ?? measured?.body ?? (options.inert ? inertBody(symbol) : trap(path))} }`,
|
|
2223
|
+
`${discardable}${attrs}public ${spelled} { ${overloadBody ?? measured?.body ?? (options.inert ? inertBody(symbol) : trap(path))} }`,
|
|
2036
2224
|
)
|
|
2037
2225
|
} else if (kind === 'swift.var') {
|
|
2038
2226
|
const parsed = splitAccessors(text(symbol).replace(/^let /, 'var '))
|