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
|
@@ -0,0 +1,590 @@
|
|
|
1
|
+
/*! peach v0.1.2937 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
|
+
import {
|
|
3
|
+
decodeNativeSdkBinding,
|
|
4
|
+
encodeNativeSdkLater
|
|
5
|
+
} from "./chunk-I6T4PXJF.mjs";
|
|
6
|
+
import {
|
|
7
|
+
SWIFT_SDK_PIECE_FIELDS,
|
|
8
|
+
readSwiftSdkManifest,
|
|
9
|
+
wasmImmediates
|
|
10
|
+
} from "./chunk-HJMF6O7L.mjs";
|
|
11
|
+
import {
|
|
12
|
+
guestDyldValueRange,
|
|
13
|
+
readSwiftAppData,
|
|
14
|
+
readWasmCustomSection,
|
|
15
|
+
writeWasmCustomSection
|
|
16
|
+
} from "./chunk-YZF2USRD.mjs";
|
|
17
|
+
import "./chunk-VXTOQ522.mjs";
|
|
18
|
+
import {
|
|
19
|
+
guestWasmDataSegments,
|
|
20
|
+
readWasmLinkMap,
|
|
21
|
+
relocationEdges
|
|
22
|
+
} from "./chunk-4WIDTRBB.mjs";
|
|
23
|
+
import "./chunk-M3CSKAJE.mjs";
|
|
24
|
+
import "./chunk-LD4K2VBL.mjs";
|
|
25
|
+
import {
|
|
26
|
+
NATIVE_LAZY_DATA_SECTION,
|
|
27
|
+
NATIVE_LAZY_SECTION,
|
|
28
|
+
readNativeLazyParts
|
|
29
|
+
} from "./chunk-NA6DJPB6.mjs";
|
|
30
|
+
import "./chunk-IJU3JMWM.mjs";
|
|
31
|
+
import "./chunk-SCT5OFDV.mjs";
|
|
32
|
+
import "./chunk-F6DZ4DS2.mjs";
|
|
33
|
+
import "./chunk-NNAX24FS.mjs";
|
|
34
|
+
import "./chunk-WMSVGYTH.mjs";
|
|
35
|
+
import "./chunk-PZPJJBAS.mjs";
|
|
36
|
+
import "./chunk-LTE7YMEG.mjs";
|
|
37
|
+
|
|
38
|
+
// src/swift-sdk-later-data.ts
|
|
39
|
+
import { createHash } from "node:crypto";
|
|
40
|
+
import { readFileSync } from "node:fs";
|
|
41
|
+
var ADDRESS_REACH = 64;
|
|
42
|
+
var sdkPieces = /* @__PURE__ */ new Map();
|
|
43
|
+
function readSdkPieces(directory) {
|
|
44
|
+
const cached = sdkPieces.get(directory);
|
|
45
|
+
if (cached) return cached;
|
|
46
|
+
const { manifest, block } = readSwiftSdkManifest({ directory });
|
|
47
|
+
const fields = block("pieces");
|
|
48
|
+
const order = [];
|
|
49
|
+
for (let i = 0; i < fields.length; i += SWIFT_SDK_PIECE_FIELDS)
|
|
50
|
+
if (fields[i + 1] > 0) order.push(i);
|
|
51
|
+
order.sort((a, b) => fields[a] - fields[b]);
|
|
52
|
+
const starts = new Uint32Array(order.length);
|
|
53
|
+
const ends = new Uint32Array(order.length);
|
|
54
|
+
const walked = new Uint8Array(order.length);
|
|
55
|
+
const identifier = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
56
|
+
order.forEach((field, index) => {
|
|
57
|
+
starts[index] = fields[field];
|
|
58
|
+
ends[index] = fields[field] + fields[field + 1];
|
|
59
|
+
const segment = manifest.segments[fields[field + 2]]?.name;
|
|
60
|
+
if (segment && identifier.test(segment)) walked[index] = 1;
|
|
61
|
+
});
|
|
62
|
+
const edges = block("dataEdges");
|
|
63
|
+
const edgeSources = new Uint32Array(edges.length / 2);
|
|
64
|
+
const edgeTargets = new Uint32Array(edges.length / 2);
|
|
65
|
+
for (let i = 0; i < edgeSources.length; i++) {
|
|
66
|
+
edgeSources[i] = edges[i * 2];
|
|
67
|
+
edgeTargets[i] = edges[i * 2 + 1];
|
|
68
|
+
}
|
|
69
|
+
const recordSymbol = manifest.strings.indexOf("__peach_sdk_records");
|
|
70
|
+
const recordIndex = recordSymbol < 0 ? -1 : block("pieceSymbols").indexOf(recordSymbol);
|
|
71
|
+
const records = order.find(
|
|
72
|
+
(field) => fields[field + 5] <= recordIndex && recordIndex < fields[field + 5] + fields[field + 6]
|
|
73
|
+
);
|
|
74
|
+
const result = {
|
|
75
|
+
starts,
|
|
76
|
+
ends,
|
|
77
|
+
walked,
|
|
78
|
+
swiftRecordsAddress: records === void 0 ? void 0 : fields[records],
|
|
79
|
+
edgeSources,
|
|
80
|
+
edgeTargets,
|
|
81
|
+
functionSlots: block("functionSlots").slice(),
|
|
82
|
+
functionEdgeStarts: block("functionEdgeStarts").slice(),
|
|
83
|
+
functionEdges: block("functionEdges").slice(),
|
|
84
|
+
functionCallStarts: block("functionCallStarts").slice(),
|
|
85
|
+
functionCalls: block("functionCalls").slice()
|
|
86
|
+
};
|
|
87
|
+
sdkPieces.set(directory, result);
|
|
88
|
+
return result;
|
|
89
|
+
}
|
|
90
|
+
var firstAtOrAfter = (sorted, value) => {
|
|
91
|
+
let low = 0;
|
|
92
|
+
let high = sorted.length;
|
|
93
|
+
while (low < high) {
|
|
94
|
+
const middle = low + high >>> 1;
|
|
95
|
+
if (sorted[middle] < value) low = middle + 1;
|
|
96
|
+
else high = middle;
|
|
97
|
+
}
|
|
98
|
+
return low;
|
|
99
|
+
};
|
|
100
|
+
var pieceAt = ({ starts, ends }, address) => {
|
|
101
|
+
const index = firstAtOrAfter(starts, address + 1) - 1;
|
|
102
|
+
return index >= 0 && address < ends[index] ? index : -1;
|
|
103
|
+
};
|
|
104
|
+
function closeOverData(pieces, reached, seeds) {
|
|
105
|
+
const pending = [];
|
|
106
|
+
for (const piece of seeds) {
|
|
107
|
+
if (!reached[piece]) {
|
|
108
|
+
reached[piece] = 1;
|
|
109
|
+
pending.push(piece);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
while (pending.length) {
|
|
113
|
+
const piece = pending.pop();
|
|
114
|
+
const end = pieces.ends[piece];
|
|
115
|
+
for (let edge = firstAtOrAfter(pieces.edgeSources, pieces.starts[piece]); edge < pieces.edgeSources.length && pieces.edgeSources[edge] < end; edge++) {
|
|
116
|
+
const target = pieceAt(pieces, pieces.edgeTargets[edge]);
|
|
117
|
+
if (target >= 0 && !reached[target]) {
|
|
118
|
+
reached[target] = 1;
|
|
119
|
+
pending.push(target);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function reachedFrom(pieces, modules) {
|
|
125
|
+
const seeds = [];
|
|
126
|
+
const earliest = (pieces.starts[0] ?? Infinity) - ADDRESS_REACH;
|
|
127
|
+
for (const module of modules)
|
|
128
|
+
for (const value of wasmImmediates(module, earliest)) {
|
|
129
|
+
for (let piece = Math.max(0, firstAtOrAfter(pieces.ends, value - ADDRESS_REACH + 1)); piece < pieces.starts.length && pieces.starts[piece] <= value + ADDRESS_REACH; piece++)
|
|
130
|
+
seeds.push(piece);
|
|
131
|
+
}
|
|
132
|
+
const reached = new Uint8Array(pieces.starts.length);
|
|
133
|
+
closeOverData(pieces, reached, seeds);
|
|
134
|
+
return reached;
|
|
135
|
+
}
|
|
136
|
+
function markLinkedReferences(pieces, inventory, partitions) {
|
|
137
|
+
const { slotCount, partForSlot } = readNativeLazyParts(inventory);
|
|
138
|
+
const {
|
|
139
|
+
functionSlots,
|
|
140
|
+
functionEdgeStarts,
|
|
141
|
+
functionEdges,
|
|
142
|
+
functionCallStarts,
|
|
143
|
+
functionCalls
|
|
144
|
+
} = pieces;
|
|
145
|
+
const partOf = new Uint16Array(functionSlots.length);
|
|
146
|
+
const roots = partitions.map(() => new Array());
|
|
147
|
+
for (const [index, slot] of functionSlots.entries()) {
|
|
148
|
+
if (!slot) continue;
|
|
149
|
+
const part = slot < slotCount ? partForSlot(slot) : 0;
|
|
150
|
+
partOf[index] = part;
|
|
151
|
+
roots[part].push(index);
|
|
152
|
+
}
|
|
153
|
+
const seen = new Uint32Array(functionSlots.length);
|
|
154
|
+
for (const [part, reached] of partitions.entries()) {
|
|
155
|
+
const pending = roots[part];
|
|
156
|
+
const references = [];
|
|
157
|
+
while (pending.length) {
|
|
158
|
+
const index = pending.pop();
|
|
159
|
+
if (seen[index] === part + 1 || functionSlots[index] && partOf[index] !== part)
|
|
160
|
+
continue;
|
|
161
|
+
seen[index] = part + 1;
|
|
162
|
+
for (let i = functionCallStarts[index]; i < functionCallStarts[index + 1]; i++)
|
|
163
|
+
pending.push(functionCalls[i]);
|
|
164
|
+
for (let i = functionEdgeStarts[index]; i < functionEdgeStarts[index + 1]; i++) {
|
|
165
|
+
const piece = pieceAt(pieces, functionEdges[i]);
|
|
166
|
+
if (piece >= 0) references.push(piece);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
closeOverData(pieces, reached, references);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
var LATER_GROUP_BYTES = 16 * 1024;
|
|
173
|
+
var MAX_LATER_GROUPS = 255;
|
|
174
|
+
function laterGroups(pieces, eager, reaches) {
|
|
175
|
+
const owner = new Int32Array(pieces.starts.length).fill(-1);
|
|
176
|
+
const owned = new Float64Array(reaches.length);
|
|
177
|
+
for (const [part, reached] of reaches.entries())
|
|
178
|
+
for (let piece = 0; piece < reached.length; piece++)
|
|
179
|
+
if (reached[piece] && !eager[piece] && owner[piece] < 0) {
|
|
180
|
+
owner[piece] = part;
|
|
181
|
+
owned[part] += pieces.ends[piece] - pieces.starts[piece];
|
|
182
|
+
}
|
|
183
|
+
const total = owned.reduce((sum, bytes) => sum + bytes, 0);
|
|
184
|
+
const target = Math.max(LATER_GROUP_BYTES, total / (MAX_LATER_GROUPS - 1));
|
|
185
|
+
const groupOf = new Uint8Array(reaches.length);
|
|
186
|
+
let group = 0;
|
|
187
|
+
let filled = 0;
|
|
188
|
+
for (let part = 0; part < reaches.length; part++) {
|
|
189
|
+
groupOf[part] = group;
|
|
190
|
+
filled += owned[part];
|
|
191
|
+
if (filled >= target) {
|
|
192
|
+
group++;
|
|
193
|
+
filled = 0;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
const groups = Buffer.alloc(pieces.starts.length);
|
|
197
|
+
for (let piece = 0; piece < owner.length; piece++)
|
|
198
|
+
if (owner[piece] >= 0) groups[piece] = groupOf[owner[piece]] + 1;
|
|
199
|
+
const needs = reaches.map((reached) => {
|
|
200
|
+
const set = /* @__PURE__ */ new Set();
|
|
201
|
+
for (let piece = 0; piece < reached.length; piece++)
|
|
202
|
+
if (reached[piece] && owner[piece] >= 0) set.add(groupOf[owner[piece]]);
|
|
203
|
+
return [...set].sort((a, b) => a - b);
|
|
204
|
+
});
|
|
205
|
+
return { groups, needs };
|
|
206
|
+
}
|
|
207
|
+
function swiftSdkDeferredDataPlan(directory, primary, parts) {
|
|
208
|
+
const pieces = readSdkPieces(directory);
|
|
209
|
+
const inventory = readWasmCustomSection(primary, NATIVE_LAZY_SECTION);
|
|
210
|
+
if (!inventory) return Buffer.alloc(pieces.starts.length);
|
|
211
|
+
const eager = reachedFrom(pieces, [primary]);
|
|
212
|
+
const reaches = Array.from(parts, (part) => reachedFrom(pieces, [part]));
|
|
213
|
+
markLinkedReferences(pieces, inventory, [eager, ...reaches]);
|
|
214
|
+
const { groups, needs } = laterGroups(pieces, eager, reaches);
|
|
215
|
+
const appendix = Buffer.alloc(4 + needs.reduce((sum, list) => sum + 1 + list.length, 0));
|
|
216
|
+
appendix.writeUInt32LE(needs.length, 0);
|
|
217
|
+
let at = 4;
|
|
218
|
+
for (const list of needs) {
|
|
219
|
+
appendix[at++] = list.length;
|
|
220
|
+
for (const need of list) appendix[at++] = need;
|
|
221
|
+
}
|
|
222
|
+
return Buffer.concat([groups, appendix]);
|
|
223
|
+
}
|
|
224
|
+
function readSwiftSdkDataPlan(plan, pieceCount) {
|
|
225
|
+
if (plan.length < pieceCount)
|
|
226
|
+
throw new Error("Swift SDK data plan does not match its layout");
|
|
227
|
+
const groups = plan.subarray(0, pieceCount);
|
|
228
|
+
if (plan.length === pieceCount) return { groups };
|
|
229
|
+
const view = new DataView(plan.buffer, plan.byteOffset, plan.byteLength);
|
|
230
|
+
if (plan.length < pieceCount + 4) throw new Error("Swift SDK data plan is truncated");
|
|
231
|
+
let at = pieceCount + 4;
|
|
232
|
+
const needs = [];
|
|
233
|
+
for (let part = view.getUint32(pieceCount, true); part > 0; part--) {
|
|
234
|
+
const n = plan[at++];
|
|
235
|
+
if (n === void 0 || at + n > plan.length)
|
|
236
|
+
throw new Error("Swift SDK data plan is truncated");
|
|
237
|
+
needs.push(Array.from(plan.subarray(at, at + n)));
|
|
238
|
+
at += n;
|
|
239
|
+
}
|
|
240
|
+
if (at !== plan.length) throw new Error("Swift SDK data plan has trailing bytes");
|
|
241
|
+
return { groups, needs };
|
|
242
|
+
}
|
|
243
|
+
var publishedPlans = /* @__PURE__ */ new Map();
|
|
244
|
+
function fetchSwiftSdkDataPlan({ url, dataPlan }) {
|
|
245
|
+
if (!dataPlan) return void 0;
|
|
246
|
+
let pending = publishedPlans.get(dataPlan);
|
|
247
|
+
if (!pending) {
|
|
248
|
+
const address = new URL(dataPlan, url);
|
|
249
|
+
pending = fetch(address).then(async (response) => {
|
|
250
|
+
if (!response.ok)
|
|
251
|
+
throw new Error(`Swift SDK data plan ${address} answered ${response.status}`);
|
|
252
|
+
const bytes = Buffer.from(await response.arrayBuffer());
|
|
253
|
+
if (createHash("sha256").update(bytes).digest("hex") !== dataPlan)
|
|
254
|
+
throw new Error(`Swift SDK data plan ${address} failed its digest check`);
|
|
255
|
+
return bytes;
|
|
256
|
+
});
|
|
257
|
+
pending.catch(() => publishedPlans.delete(dataPlan));
|
|
258
|
+
publishedPlans.set(dataPlan, pending);
|
|
259
|
+
}
|
|
260
|
+
return pending;
|
|
261
|
+
}
|
|
262
|
+
function sparseStartupRuns(runs) {
|
|
263
|
+
let endAddress = 0;
|
|
264
|
+
for (const { address, bytes } of [...runs].sort((a, b) => a.address - b.address)) {
|
|
265
|
+
if (address < endAddress) return runs;
|
|
266
|
+
endAddress = address + bytes.length;
|
|
267
|
+
}
|
|
268
|
+
const sparse = [];
|
|
269
|
+
for (const { address, bytes } of runs) {
|
|
270
|
+
let start = 0;
|
|
271
|
+
const append = (end) => {
|
|
272
|
+
if (end > start)
|
|
273
|
+
sparse.push({ address: address + start, bytes: bytes.subarray(start, end) });
|
|
274
|
+
};
|
|
275
|
+
for (let offset = 0; offset < bytes.length; ) {
|
|
276
|
+
const first = bytes.indexOf(0, offset);
|
|
277
|
+
if (first < 0) break;
|
|
278
|
+
let next = first + 1;
|
|
279
|
+
while (bytes[next] === 0) next++;
|
|
280
|
+
if (!first || next === bytes.length || next - first > 128) {
|
|
281
|
+
append(first);
|
|
282
|
+
start = next;
|
|
283
|
+
}
|
|
284
|
+
offset = next;
|
|
285
|
+
}
|
|
286
|
+
append(bytes.length);
|
|
287
|
+
}
|
|
288
|
+
return sparse;
|
|
289
|
+
}
|
|
290
|
+
function splitSwiftSdkLaterData(directory, binding, plan) {
|
|
291
|
+
const decoded = decodeNativeSdkBinding(
|
|
292
|
+
binding.buffer.slice(binding.byteOffset, binding.byteOffset + binding.byteLength)
|
|
293
|
+
);
|
|
294
|
+
if (decoded.later) throw new Error("Swift SDK binding already names later data");
|
|
295
|
+
const pieces = readSdkPieces(directory);
|
|
296
|
+
const { groups, needs } = readSwiftSdkDataPlan(plan, pieces.starts.length);
|
|
297
|
+
if (!groups.some((group) => group > 0)) return { binding, later: [] };
|
|
298
|
+
const eager = new Uint8Array(groups.length);
|
|
299
|
+
const data = decoded.sdkData;
|
|
300
|
+
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
301
|
+
const runs = [];
|
|
302
|
+
for (let at = 4, count = view.getUint32(0, true); count > 0; count--) {
|
|
303
|
+
const length = view.getUint32(at + 8, true);
|
|
304
|
+
runs.push({
|
|
305
|
+
address: Number(view.getBigUint64(at, true)),
|
|
306
|
+
bytes: data.subarray(at + 12, at + 12 + length)
|
|
307
|
+
});
|
|
308
|
+
at += 12 + length;
|
|
309
|
+
}
|
|
310
|
+
const seeds = [];
|
|
311
|
+
const seed = (address) => {
|
|
312
|
+
const piece = pieceAt(pieces, address);
|
|
313
|
+
if (piece >= 0) seeds.push(piece);
|
|
314
|
+
};
|
|
315
|
+
for (const value of decoded.values)
|
|
316
|
+
if (value >= 0n && value < 2n ** 32n) seed(Number(value));
|
|
317
|
+
for (let i = 0; i < decoded.memory.length; i += 3) seed(decoded.memory[i]);
|
|
318
|
+
for (const { address, bytes } of runs) {
|
|
319
|
+
if (address === pieces.swiftRecordsAddress) {
|
|
320
|
+
seed(address);
|
|
321
|
+
const records = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
322
|
+
for (let offset = 9 * 4; offset < records.byteLength; offset += 4)
|
|
323
|
+
seed((records.getUint32(offset, true) & ~3) >>> 0);
|
|
324
|
+
}
|
|
325
|
+
for (let piece = firstAtOrAfter(pieces.ends, address + 1); piece < pieces.starts.length && pieces.starts[piece] < address + bytes.length; piece++)
|
|
326
|
+
if (pieces.walked[piece] || !groups[piece]) seeds.push(piece);
|
|
327
|
+
}
|
|
328
|
+
closeOverData(pieces, eager, seeds);
|
|
329
|
+
const now = [];
|
|
330
|
+
const deferred = /* @__PURE__ */ new Map();
|
|
331
|
+
for (const { address, bytes } of runs) {
|
|
332
|
+
let start = 0;
|
|
333
|
+
let deferring = 0;
|
|
334
|
+
const flush = (end) => {
|
|
335
|
+
if (end > start) {
|
|
336
|
+
const run = { address: address + start, bytes: bytes.subarray(start, end) };
|
|
337
|
+
if (!deferring) now.push(run);
|
|
338
|
+
else {
|
|
339
|
+
const list = deferred.get(deferring);
|
|
340
|
+
if (list) list.push(run);
|
|
341
|
+
else deferred.set(deferring, [run]);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
start = end;
|
|
345
|
+
};
|
|
346
|
+
let offset = 0;
|
|
347
|
+
while (offset < bytes.length) {
|
|
348
|
+
const piece = pieceAt(pieces, address + offset);
|
|
349
|
+
const end = piece < 0 ? Math.min(
|
|
350
|
+
bytes.length,
|
|
351
|
+
(pieces.starts[firstAtOrAfter(pieces.starts, address + offset)] ?? address + bytes.length) - address
|
|
352
|
+
) : Math.min(bytes.length, pieces.ends[piece] - address);
|
|
353
|
+
const deferrable = piece >= 0 && !eager[piece] ? groups[piece] : 0;
|
|
354
|
+
if (deferrable !== deferring) {
|
|
355
|
+
flush(offset);
|
|
356
|
+
deferring = deferrable;
|
|
357
|
+
}
|
|
358
|
+
offset = end;
|
|
359
|
+
}
|
|
360
|
+
flush(bytes.length);
|
|
361
|
+
}
|
|
362
|
+
if (!deferred.size) return { binding, later: [] };
|
|
363
|
+
const { later, trailer } = laterFiles(deferred, needs);
|
|
364
|
+
return {
|
|
365
|
+
binding: Buffer.concat([
|
|
366
|
+
binding.subarray(0, data.byteOffset),
|
|
367
|
+
encodeRuns(sparseStartupRuns(now)),
|
|
368
|
+
trailer
|
|
369
|
+
]),
|
|
370
|
+
later
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
function encodeRuns(list) {
|
|
374
|
+
const out = Buffer.alloc(4 + list.reduce((sum, run) => sum + 12 + run.bytes.length, 0));
|
|
375
|
+
out.writeUInt32LE(list.length, 0);
|
|
376
|
+
let at = 4;
|
|
377
|
+
for (const run of list) {
|
|
378
|
+
out.writeBigUInt64LE(BigInt(run.address), at);
|
|
379
|
+
out.writeUInt32LE(run.bytes.length, at + 8);
|
|
380
|
+
out.set(run.bytes, at + 12);
|
|
381
|
+
at += 12 + run.bytes.length;
|
|
382
|
+
}
|
|
383
|
+
return out;
|
|
384
|
+
}
|
|
385
|
+
function laterFiles(deferred, needs) {
|
|
386
|
+
const order = [...deferred.keys()].sort((a, b) => a - b);
|
|
387
|
+
const later = order.map((group) => encodeRuns(deferred.get(group)));
|
|
388
|
+
const fileOf = new Map(order.map((group, file) => [group - 1, file]));
|
|
389
|
+
const trailer = encodeNativeSdkLater({
|
|
390
|
+
files: later.map((bytes) => ({
|
|
391
|
+
sha256: createHash("sha256").update(bytes).digest("hex"),
|
|
392
|
+
byteLength: bytes.length
|
|
393
|
+
})),
|
|
394
|
+
...needs && {
|
|
395
|
+
needs: needs.map(
|
|
396
|
+
(list) => list.flatMap((group) => {
|
|
397
|
+
const file = fileOf.get(group);
|
|
398
|
+
return file === void 0 ? [] : [file];
|
|
399
|
+
})
|
|
400
|
+
)
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
return { later, trailer };
|
|
404
|
+
}
|
|
405
|
+
var APP_PIECE_WALKED = 1;
|
|
406
|
+
var APP_PIECE_PINNED = 2;
|
|
407
|
+
function swiftAppDataPieces(mapFile, relocations, fixups, pinnedInputs = /* @__PURE__ */ new Set()) {
|
|
408
|
+
const map = readWasmLinkMap(mapFile, true);
|
|
409
|
+
const holes = [];
|
|
410
|
+
for (let at2 = 0; at2 < fixups.length; at2 += 3) holes.push([fixups[at2], fixups[at2 + 1]]);
|
|
411
|
+
holes.sort((a, b) => a[0] - b[0]);
|
|
412
|
+
const dyld = guestDyldValueRange(readFileSync(mapFile, "utf8"));
|
|
413
|
+
const identifier = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
414
|
+
const chunks = map.data.filter(
|
|
415
|
+
(chunk) => chunk.address >= 0 && chunk.size > 0 && chunk.segment !== ".bss" && chunk.segment !== ".tdata"
|
|
416
|
+
).sort((a, b) => a.address - b.address);
|
|
417
|
+
const edges = relocationEdges(relocations, (name) => {
|
|
418
|
+
const segment = map.segments.get(name);
|
|
419
|
+
if (!segment) throw new Error(`app relocation link names unknown segment ${name}`);
|
|
420
|
+
return segment.address;
|
|
421
|
+
}).data;
|
|
422
|
+
const edgeCount = edges.length / 2;
|
|
423
|
+
const out = Buffer.alloc(12 + chunks.length * 9 + edgeCount * 8 + holes.length * 8);
|
|
424
|
+
out.writeUInt32LE(chunks.length, 0);
|
|
425
|
+
out.writeUInt32LE(edgeCount, 4);
|
|
426
|
+
out.writeUInt32LE(holes.length, 8);
|
|
427
|
+
const flags = 12 + chunks.length * 8;
|
|
428
|
+
for (const [index, chunk] of chunks.entries()) {
|
|
429
|
+
const end = chunk.address + chunk.size;
|
|
430
|
+
out.writeUInt32LE(chunk.address, 12 + index * 8);
|
|
431
|
+
out.writeUInt32LE(end, 16 + index * 8);
|
|
432
|
+
out[flags + index] = (identifier.test(chunk.segment) ? APP_PIECE_WALKED : 0) | (pinnedInputs.has(chunk.inputFile) || dyld && dyld.address < end && chunk.address < dyld.address + dyld.length ? APP_PIECE_PINNED : 0);
|
|
433
|
+
}
|
|
434
|
+
const order = Array.from({ length: edgeCount }, (_, i) => i).sort(
|
|
435
|
+
(a, b) => edges[a * 2] - edges[b * 2]
|
|
436
|
+
);
|
|
437
|
+
let at = flags + chunks.length;
|
|
438
|
+
for (const edge of order) {
|
|
439
|
+
out.writeUInt32LE(edges[edge * 2], at);
|
|
440
|
+
out.writeUInt32LE(edges[edge * 2 + 1], at + 4);
|
|
441
|
+
at += 8;
|
|
442
|
+
}
|
|
443
|
+
for (const [address, size] of holes) {
|
|
444
|
+
out.writeUInt32LE(address, at);
|
|
445
|
+
out.writeUInt32LE(size, at + 4);
|
|
446
|
+
at += 8;
|
|
447
|
+
}
|
|
448
|
+
return out;
|
|
449
|
+
}
|
|
450
|
+
function readAppPieces(bytes) {
|
|
451
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
452
|
+
const count = view.getUint32(0, true);
|
|
453
|
+
const edgeCount = view.getUint32(4, true);
|
|
454
|
+
const holeCount = view.getUint32(8, true);
|
|
455
|
+
if (bytes.byteLength !== 12 + count * 9 + edgeCount * 8 + holeCount * 8)
|
|
456
|
+
throw new Error("app data pieces do not match their counts");
|
|
457
|
+
const starts = new Uint32Array(count);
|
|
458
|
+
const ends = new Uint32Array(count);
|
|
459
|
+
for (let i = 0; i < count; i++) {
|
|
460
|
+
starts[i] = view.getUint32(12 + i * 8, true);
|
|
461
|
+
ends[i] = view.getUint32(16 + i * 8, true);
|
|
462
|
+
}
|
|
463
|
+
const flags = bytes.subarray(12 + count * 8, 12 + count * 9);
|
|
464
|
+
const edgeSources = new Uint32Array(edgeCount);
|
|
465
|
+
const edgeTargets = new Uint32Array(edgeCount);
|
|
466
|
+
let at = 12 + count * 9;
|
|
467
|
+
for (let i = 0; i < edgeCount; i++, at += 8) {
|
|
468
|
+
edgeSources[i] = view.getUint32(at, true);
|
|
469
|
+
edgeTargets[i] = view.getUint32(at + 4, true);
|
|
470
|
+
}
|
|
471
|
+
const holeStarts = new Uint32Array(holeCount);
|
|
472
|
+
const holeEnds = new Uint32Array(holeCount);
|
|
473
|
+
for (let i = 0; i < holeCount; i++, at += 8) {
|
|
474
|
+
holeStarts[i] = view.getUint32(at, true);
|
|
475
|
+
holeEnds[i] = holeStarts[i] + view.getUint32(at + 4, true);
|
|
476
|
+
}
|
|
477
|
+
const none = new Uint32Array(0);
|
|
478
|
+
const pieces = {
|
|
479
|
+
starts,
|
|
480
|
+
ends,
|
|
481
|
+
walked: flags.map((flag) => flag & APP_PIECE_WALKED),
|
|
482
|
+
swiftRecordsAddress: void 0,
|
|
483
|
+
edgeSources,
|
|
484
|
+
edgeTargets,
|
|
485
|
+
functionSlots: none,
|
|
486
|
+
functionEdgeStarts: none,
|
|
487
|
+
functionEdges: none,
|
|
488
|
+
functionCallStarts: none,
|
|
489
|
+
functionCalls: none
|
|
490
|
+
};
|
|
491
|
+
return { pieces, flags, holeStarts, holeEnds };
|
|
492
|
+
}
|
|
493
|
+
function primarySegments(original, primary) {
|
|
494
|
+
const linked = guestWasmDataSegments(original, false);
|
|
495
|
+
const found = [];
|
|
496
|
+
let at = 8;
|
|
497
|
+
const u = () => {
|
|
498
|
+
let value = 0;
|
|
499
|
+
for (let shift = 0; ; shift += 7) {
|
|
500
|
+
const byte = primary[at++];
|
|
501
|
+
value += (byte & 127) * 2 ** shift;
|
|
502
|
+
if (!(byte & 128)) return value;
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
while (at < primary.length) {
|
|
506
|
+
const id = primary[at++];
|
|
507
|
+
const end = u() + at;
|
|
508
|
+
if (id === 11)
|
|
509
|
+
for (let n = u(); n > 0; n--) {
|
|
510
|
+
if (u() !== 1) throw new Error("split app image has an active data segment");
|
|
511
|
+
const length = u();
|
|
512
|
+
if (!length) continue;
|
|
513
|
+
const segment = linked[found.length];
|
|
514
|
+
if (!segment || segment.length !== length)
|
|
515
|
+
throw new Error("split app image data does not match its unsplit image");
|
|
516
|
+
found.push({ address: segment.address, offset: at, length });
|
|
517
|
+
at += length;
|
|
518
|
+
}
|
|
519
|
+
at = end;
|
|
520
|
+
}
|
|
521
|
+
if (found.length !== linked.length)
|
|
522
|
+
throw new Error("split app image lost data segments");
|
|
523
|
+
return found;
|
|
524
|
+
}
|
|
525
|
+
function deferSwiftAppData(original, primary, parts) {
|
|
526
|
+
const appPieces = readSwiftAppData(original);
|
|
527
|
+
if (!appPieces) return void 0;
|
|
528
|
+
const { pieces, flags, holeStarts, holeEnds } = readAppPieces(appPieces);
|
|
529
|
+
const eager = reachedFrom(pieces, [primary]);
|
|
530
|
+
const seeds = [];
|
|
531
|
+
for (let piece = 0; piece < flags.length; piece++) if (flags[piece]) seeds.push(piece);
|
|
532
|
+
closeOverData(pieces, eager, seeds);
|
|
533
|
+
const { groups, needs } = laterGroups(
|
|
534
|
+
pieces,
|
|
535
|
+
eager,
|
|
536
|
+
parts.map((part) => reachedFrom(pieces, [part]))
|
|
537
|
+
);
|
|
538
|
+
const ranges = /* @__PURE__ */ new Map();
|
|
539
|
+
for (const { address, offset, length } of primarySegments(original, primary))
|
|
540
|
+
for (let piece = firstAtOrAfter(pieces.ends, address + 1); piece < pieces.starts.length && pieces.starts[piece] < address + length; piece++) {
|
|
541
|
+
const group = groups[piece];
|
|
542
|
+
const start = pieces.starts[piece];
|
|
543
|
+
const end = pieces.ends[piece];
|
|
544
|
+
if (!group || start < address || end > address + length) continue;
|
|
545
|
+
const list = ranges.get(group) ?? ranges.set(group, []).get(group);
|
|
546
|
+
const last = list[list.length - 1];
|
|
547
|
+
if (last && last.address + last.length === start) last.length += end - start;
|
|
548
|
+
else
|
|
549
|
+
list.push({ address: start, at: offset + start - address, length: end - start });
|
|
550
|
+
}
|
|
551
|
+
if (!ranges.size) return void 0;
|
|
552
|
+
const out = Buffer.from(primary);
|
|
553
|
+
const deferred = /* @__PURE__ */ new Map();
|
|
554
|
+
for (const [group, list] of ranges) {
|
|
555
|
+
const runs = [];
|
|
556
|
+
for (const { address, at, length } of list) {
|
|
557
|
+
out.fill(0, at, at + length);
|
|
558
|
+
let start = address;
|
|
559
|
+
const end = address + length;
|
|
560
|
+
for (let hole = Math.max(0, firstAtOrAfter(holeEnds, start + 1)); hole < holeStarts.length && holeStarts[hole] < end; hole++) {
|
|
561
|
+
if (holeStarts[hole] > start)
|
|
562
|
+
runs.push({
|
|
563
|
+
address: start,
|
|
564
|
+
bytes: Buffer.from(
|
|
565
|
+
primary.subarray(at + start - address, at + holeStarts[hole] - address)
|
|
566
|
+
)
|
|
567
|
+
});
|
|
568
|
+
start = Math.max(start, holeEnds[hole]);
|
|
569
|
+
}
|
|
570
|
+
if (end > start)
|
|
571
|
+
runs.push({
|
|
572
|
+
address: start,
|
|
573
|
+
bytes: Buffer.from(primary.subarray(at + start - address, at + end - address))
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
deferred.set(group, runs);
|
|
577
|
+
}
|
|
578
|
+
const { later, trailer } = laterFiles(deferred, needs);
|
|
579
|
+
return {
|
|
580
|
+
primary: writeWasmCustomSection(out, NATIVE_LAZY_DATA_SECTION, trailer),
|
|
581
|
+
later
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
export {
|
|
585
|
+
deferSwiftAppData,
|
|
586
|
+
fetchSwiftSdkDataPlan,
|
|
587
|
+
splitSwiftSdkLaterData,
|
|
588
|
+
swiftAppDataPieces,
|
|
589
|
+
swiftSdkDeferredDataPlan
|
|
590
|
+
};
|