peachsim 0.1.1684 → 0.1.1700
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/cli/bridge-flow-runner.ts +61 -39
- package/cli/commands/agent-wrapper.ts +21 -10
- package/cli/commands/control.ts +27 -7
- package/cli/commands/coverage-swift.ts +72 -5
- package/cli/commands/coverage.ts +1 -1
- package/cli/commands/detect.ts +17 -4
- package/cli/commands/inspect/actions.ts +1 -0
- package/cli/commands/maestro-compare.ts +25 -99
- package/cli/commands/screenshot.ts +12 -0
- package/cli/help-core.ts +3 -4
- package/cli/maestro-compare.ts +172 -4
- package/cli/outbound-endpoints.ts +2 -10
- package/detox/index.ts +15 -0
- package/detox/launch-permissions.ts +169 -0
- package/dist-lib/agent-daemon-client.cjs +2 -2
- package/dist-lib/agent-events.cjs +2 -2
- package/dist-lib/attached-projects.cjs +2 -2
- package/dist-lib/auth/shared-session.cjs +2 -2
- package/dist-lib/backend-origin.cjs +2 -2
- package/dist-lib/beta.cjs +2 -2
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +2 -2
- package/dist-lib/bridge-contract-input.cjs +2 -2
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +2 -2
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +6729 -3591
- package/dist-lib/capture-contract.cjs +2 -2
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +2 -2
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +2 -2
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +2 -2
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +2 -2
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +104 -3
- package/dist-lib/dev-bundle-resolution.cjs +208 -44
- package/dist-lib/expo-swift-bundle.cjs +3475 -2137
- package/dist-lib/expo-swift-metadata.cjs +2 -2
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +2 -2
- package/dist-lib/host/bridge-host.cjs +8970 -3652
- package/dist-lib/host/fetch-proxy-handler.cjs +332 -40
- package/dist-lib/host/fetch-proxy-overrides.cjs +2 -2
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +2 -2
- package/dist-lib/host/websocket-proxy.cjs +2 -2
- package/dist-lib/index.cjs +469 -143
- package/dist-lib/jump-to-source-babel.cjs +2 -2
- package/dist-lib/jump-to-source-native.cjs +2 -2
- package/dist-lib/kotlin-host.cjs +2 -2
- package/dist-lib/menu.cjs +2 -2
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +2 -2
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +2 -2
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +465 -139
- package/dist-lib/native-app-identity-project.cjs +209 -86
- package/dist-lib/native-app-identity-project.mjs +251 -116
- package/dist-lib/native-app-identity.cjs +2 -2
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +2 -2
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +2 -2
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +2 -2
- package/dist-lib/public-brand.cjs +2 -2
- package/dist-lib/public-origins-lib-esm.json +27 -23
- package/dist-lib/public-origins-lib.json +221 -88
- package/dist-lib/react-native-host-modules.cjs +2 -2
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/reap-browser.cjs +2 -2
- package/dist-lib/scripts/dev-server-scanner.cjs +206 -31
- package/dist-lib/sdk.cjs +3 -3
- package/dist-lib/sdk.mjs +2 -2
- package/dist-lib/skills.cjs +20997 -16596
- package/dist-lib/swift-compile.cjs +3075 -459
- package/dist-lib/swift-compile.mjs +3028 -415
- package/dist-lib/swift-package.cjs +131 -69
- package/dist-lib/swift-package.mjs +126 -68
- package/dist-lib/swift-submit.cjs +2 -2
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +31 -4
- package/dist-lib/swift.cjs +2 -2
- package/dist-lib/vite-swift.cjs +5049 -1704
- package/dist-lib/vite.cjs +261 -58
- package/dist-lib/worklet-executable.cjs +8 -5
- package/dist-lib/worklet-executable.mjs +7 -4
- package/dist-types/packages/peach-engine/src/engine/clipboardContract.d.ts +15 -1
- package/dist-types/packages/peach-engine/src/engine/font-config.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/scroll-pan-contacts.d.ts +3 -1
- package/dist-types/packages/peach-engine/src/engine/scroll.d.ts +7 -0
- package/dist-types/packages/peach-engine/src/engine/types.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +2 -2
- package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/render-worker/scroll-mirror.d.ts +17 -0
- package/dist-types/packages/peach-engine/src/render-worker/worker-input-runtime.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +3 -0
- package/dist-types/packages/peach-globals/src/cameraBridgeContract.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/clipboardBridgeContract.d.ts +6 -0
- package/dist-types/packages/peach-globals/src/index.d.ts +1 -1
- package/dist-types/packages/peach-globals/src/nodeContract.d.ts +3 -2
- package/dist-types/packages/peach-globals/src/replayBridgeContract.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/shellHostBridgeContract.d.ts +3 -0
- package/dist-types/packages/peach-kit/src/capabilities.d.ts +1 -0
- package/dist-types/packages/peach-kit/src/materials/types.d.ts +1 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/scripts/dev-server-scanner.ts +4 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Alpha.h +2282 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/BasicImageTypes.h +55 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Conversion.h +10551 -6
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Convolution.h +4236 -3
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Geometry.h +827 -8
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Histogram.h +1369 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Morphology.h +1243 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Transform.h +1747 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage.h +291 -2
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_CVUtilities.h +1283 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Types.h +811 -91
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Utilities.h +1342 -25
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns.h +2738 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_constants.h +1685 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_graph.h +913 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_structures.h +1917 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/LinearAlgebra.h +23 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/arithmetic.h +209 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/base.h +104 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/linear_systems.h +77 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/matrix.h +554 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/norms.h +58 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/object.h +186 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/splat.h +86 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/vector.h +364 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Quadrature/Integration.h +195 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Quadrature/Quadrature.h +44 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/BLAS/BLAS.h +2330 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/BLAS/Types.h +123 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/Solve.h +8339 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/SolveImplementation.h +520 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/SolveImplementationTyped.h +1893 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/Sparse.h +10 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/blas_new.h +1098 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas.h +859 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas_new.h +1134 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/clapack.h +10555 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/fortran_blas.h +695 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack.h +38526 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack_types.h +60 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack_version.h +20 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/thread_api.h +50 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vBasicOps.h +1218 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vBigNum.h +1458 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vDSP.h +10377 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vDSP_translate.h +167 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vForce.h +1243 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vecLib.h +114 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vecLibTypes.h +146 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vectorOps.h +1106 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vfp.h +294 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.h +25 -1
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFArray.h +673 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFAvailability.h +232 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h +827 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFCalendar.h +121 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFCharacterSet.h +387 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFData.h +79 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDate.h +122 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDictionary.h +674 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFError.h +182 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFLocale.h +213 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFNotificationCenter.h +82 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFNumber.h +129 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFSet.h +491 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFString.h +883 -2
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFTimeZone.h +98 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +11 -220
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h +2 -6
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLAvailability.h +22 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLBackgroundActivitySession.h +145 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLBeaconIdentityCondition.h +113 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLBeaconIdentityConstraint.h +34 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLBeaconRegion.h +225 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLBody.h +26 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLCircularGeographicCondition.h +59 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLCircularRegion.h +64 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLCondition.h +48 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLError.h +52 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLErrorDomain.h +24 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLGeocoder.h +55 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLHeading.h +117 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocation.h +9 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationManager+CLVisitExtensions.h +45 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationManager.h +877 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationManagerDelegate.h +225 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationPushServiceError.h +33 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationPushServiceExtension.h +28 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationUpdater.h +250 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLMonitor.h +140 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLMonitorConfiguration.h +77 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLMonitoringEvent.h +184 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLMonitoringRecord.h +57 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLPlacemark.h +98 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLRegion.h +123 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLServiceSession.h +211 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLVisit.h +66 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CoreLocation.h +46 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Modules/module.modulemap +7 -0
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +98 -3
- package/sdk/ios/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceBase.h +52 -0
- package/sdk/ios/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceObjC.h +240 -0
- package/sdk/ios/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceRef.h +474 -0
- package/sdk/ios/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceTypes.h +66 -0
- package/sdk/ios/System/Library/Frameworks/IOSurface.framework/Modules/module.modulemap +10 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4AccelerationStructure.h +9 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4Archive.h +16 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4ArgumentTable.h +17 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4BinaryFunction.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4BinaryFunctionDescriptor.h +14 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4BufferRange.h +79 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4CommandAllocator.h +15 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4CommandBuffer.h +17 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4CommandEncoder.h +16 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4CommandQueue.h +19 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4CommitFeedback.h +15 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4Compiler.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4CompilerTask.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4ComputeCommandEncoder.h +19 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4ComputePipeline.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4Counters.h +19 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4FunctionDescriptor.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4LibraryDescriptor.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4LibraryFunctionDescriptor.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4LinkingDescriptor.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4MachineLearningCommandEncoder.h +17 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4MachineLearningPipeline.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4MeshRenderPipeline.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4PipelineDataSetSerializer.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4PipelineState.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4RenderCommandEncoder.h +17 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4RenderPass.h +17 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4RenderPipeline.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4SpecializedFunctionDescriptor.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4StitchedFunctionDescriptor.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4TileRenderPipeline.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLAccelerationStructure.h +1212 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLAccelerationStructureCommandEncoder.h +322 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLAccelerationStructureTypes.h +224 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLAllocation.h +22 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLArgument.h +279 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLArgumentEncoder.h +199 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLBinaryArchive.h +142 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLBlitCommandEncoder.h +266 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLBlitPass.h +82 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLBuffer.h +94 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLCaptureManager.h +113 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLCaptureScope.h +43 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLCommandBuffer.h +449 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLCommandEncoder.h +148 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLCommandQueue.h +102 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLComputeCommandEncoder.h +350 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLComputePass.h +90 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLComputePipeline.h +274 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLCounters.h +225 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLDataType.h +232 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLDefines.h +39 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLDepthStencil.h +93 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLDevice.h +1122 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLDeviceCertification.h +29 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLDrawable.h +36 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLDynamicLibrary.h +81 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLEvent.h +79 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLFence.h +22 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLFunctionConstantValues.h +30 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLFunctionDescriptor.h +95 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLFunctionHandle.h +29 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLFunctionLog.h +37 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLFunctionStitching.h +131 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLGPUAddress.h +19 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLHeap.h +284 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLIOCommandBuffer.h +10 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLIOCommandQueue.h +11 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLIOCompressor.h +10 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLIndirectCommandBuffer.h +157 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLIndirectCommandEncoder.h +110 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLIntersectionFunctionTable.h +186 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLLibrary.h +549 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLLinkedFunctions.h +57 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLLogState.h +65 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLParallelRenderCommandEncoder.h +77 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLPipeline.h +57 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLPixelFormat.h +342 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLRasterizationRate.h +323 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLRenderCommandEncoder.h +1068 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLRenderPass.h +411 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLRenderPipeline.h +788 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLResidencySet.h +141 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLResource.h +307 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLResourceStateCommandEncoder.h +125 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLResourceStatePass.h +85 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLResourceViewPool.h +22 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLSampler.h +252 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLStageInputOutputDescriptor.h +158 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLTensor.h +17 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLTexture.h +460 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLTextureViewPool.h +18 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLTypes.h +125 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLVertexDescriptor.h +153 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLVisibleFunctionTable.h +45 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/Metal.h +94 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Modules/module.modulemap +6 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.h +1 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecBase.h +906 -3
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecCertificate.h +613 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecItem.h +1284 -29
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecPolicy.h +441 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecTrust.h +845 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/Security.h +4 -0
- package/sdk/ios/System/Library/Frameworks/UniformTypeIdentifiers.framework/Headers/UTDefines.h +35 -0
- package/sdk/ios/System/Library/Frameworks/UniformTypeIdentifiers.framework/Headers/UTTagClass.h +33 -0
- package/sdk/ios/System/Library/Frameworks/UniformTypeIdentifiers.framework/Headers/UTType.h +504 -0
- package/sdk/ios/System/Library/Frameworks/_LocationEssentials.framework/Headers/CLEssentialsAvailability.h +14 -0
- package/sdk/ios/System/Library/Frameworks/_LocationEssentials.framework/Headers/CLLocationEssentials.h +444 -0
- package/sdk/ios/System/Library/Frameworks/_LocationEssentials.framework/Headers/LocationEssentials.h +14 -0
- package/sdk/ios/System/Library/Frameworks/_LocationEssentials.framework/Modules/module.modulemap +14 -0
- package/sdk/ios/usr/include/AvailabilityMacros.h +3985 -0
- package/sdk/ios/usr/include/complex.h +167 -0
- package/sdk/ios/usr/include/copyfile.h +143 -0
- package/sdk/ios/usr/include/dispatch/dispatch.h +5 -0
- package/sdk/ios/usr/include/mach/mach_types.h +1 -0
- package/sdk/ios/usr/include/malloc/_malloc.h +143 -0
- package/sdk/ios/usr/include/malloc/_malloc_type.h +153 -0
- package/sdk/ios/usr/include/malloc/_platform.h +80 -0
- package/sdk/ios/usr/include/malloc/_ptrcheck.h +43 -0
- package/sdk/ios/usr/include/malloc/malloc.h +768 -0
- package/sdk/ios/usr/include/math.h +835 -2
- package/sdk/ios/usr/include/os/availability.h +168 -6
- package/sdk/ios/usr/include/os/base.h +351 -0
- package/sdk/ios/usr/include/os/clock.h +18 -0
- package/sdk/ios/usr/include/os/lock.h +232 -10
- package/sdk/ios/usr/include/os/log.h +521 -38
- package/sdk/ios/usr/include/os/object.h +320 -3
- package/sdk/ios/usr/include/os/trace.h +492 -0
- package/sdk/ios/usr/include/os/trace_base.h +167 -0
- package/sdk/ios/usr/include/os/workgroup.h +37 -0
- package/sdk/ios/usr/include/os/workgroup_base.h +91 -0
- package/sdk/ios/usr/include/os/workgroup_interval.h +156 -0
- package/sdk/ios/usr/include/os/workgroup_object.h +359 -0
- package/sdk/ios/usr/include/os/workgroup_parallel.h +76 -0
- package/sdk/ios/usr/include/sys/cdefs.h +38 -1
- package/sdk/ios/wasm/include/unistd.h +3 -0
- package/skills/contrast/SKILL.md +3 -0
- package/src/codex-client.ts +11 -6
- package/src/dev-bundle-resolution.ts +124 -48
- package/src/expo-native-workspace.ts +176 -0
- package/src/expo-swift-host.ts +161 -26
- package/src/expo-swift-ready.ts +14 -28
- package/src/expoSwiftContract.ts +4 -1
- package/src/generated/swift-c-predefines.json +2044 -0
- package/src/host/bridge-host.ts +5 -0
- package/src/installed-package-versions.ts +14 -1
- package/src/metro-project-root.ts +44 -33
- package/src/native-app-identity-project.ts +1 -0
- package/src/nitro-adapter.lock.json +916 -10
- package/src/nitro-adapter.ts +33 -24
- package/src/nitro-bundle.ts +108 -21
- package/src/nitro-compile.ts +36 -5
- package/src/nitro-source.ts +13 -3
- package/src/nitroAdapterContract.ts +100 -20
- package/src/nitroContract.ts +18 -2
- package/src/node-http-fetch.ts +116 -0
- package/src/packageVersionsContract.ts +46 -0
- package/src/serverDiscoveryContract.ts +1 -0
- package/src/settingsContract.ts +0 -30
- package/src/swift-binary-modules.ts +20 -5
- package/src/swift-compile.ts +598 -81
- package/src/swift-coverage/package.ts +3 -1
- package/src/swift-coverage/xcode-assets.ts +66 -5
- package/src/swift-coverage/xcode-packages.ts +11 -6
- package/src/swift-host.ts +347 -60
- package/src/swift-objc-compile.ts +52 -10
- package/src/swift-objc-metadata.ts +2 -2
- package/src/swift-objc-platform.ts +2 -2
- package/src/swift-objc-standin.ts +53 -13
- package/src/swift-package-manifest.ts +151 -28
- package/src/swift-package.ts +158 -75
- package/src/swift-packages.ts +141 -44
- package/src/swift-source-file.ts +10 -15
- package/src/swift-source-pods.ts +126 -41
- package/src/swift-standin-digest.ts +77 -0
- package/src/swift-standin-emit.ts +40 -4
- package/src/swift-standins.ts +154 -31
- package/src/swift-submit.ts +5 -0
- package/src/swift-toolchain.ts +38 -0
- package/src/swiftContract.ts +168 -75
- package/src/target-matcher.ts +15 -2
- package/src/vite-plugin.ts +0 -10
- package/src/worklet-executable.ts +7 -3
- package/src/xcode-json-project.ts +14 -2
- package/src/xcode-project.ts +215 -100
- package/src/settings-flags.ts +0 -107
package/src/nitro-adapter.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// the private Nitro adapter archive an installed peach links into every Nitro
|
|
2
|
-
// compile:
|
|
3
|
-
//
|
|
4
|
-
// compiler, SDK and framework the
|
|
5
|
-
// (docs/swift-distribution.md). the adapter source
|
|
2
|
+
// compile: the one built against the app's own original React Native JSI and
|
|
3
|
+
// Nitro headers, downloaded from PEACH_SWIFT_ENDPOINT, verified against the lock
|
|
4
|
+
// this build carries, then checked against the compiler, SDK and framework the
|
|
5
|
+
// module root compiles with (docs/swift-distribution.md). the adapter source
|
|
6
|
+
// never reaches this machine.
|
|
6
7
|
import fs from 'node:fs'
|
|
7
8
|
import path from 'node:path'
|
|
8
9
|
import { installVerifiedTarball } from '@contrast/runtime-delivery'
|
|
@@ -12,17 +13,19 @@ import {
|
|
|
12
13
|
headerDigests,
|
|
13
14
|
NITRO_ADAPTER_MANIFEST,
|
|
14
15
|
nitroAdapterArchiveKey,
|
|
16
|
+
nitroAdapterPin,
|
|
15
17
|
parseNitroAdapterLock,
|
|
16
18
|
verifyInstalledNitroAdapter,
|
|
17
19
|
type NitroAdapterLock,
|
|
18
20
|
type NitroAdapterManifest,
|
|
21
|
+
type NitroAdapterPin,
|
|
19
22
|
} from './nitroAdapterContract'
|
|
20
23
|
import { NITRO_GUEST_PLATFORM } from './nitroContract'
|
|
21
24
|
import { swiftDistributionAt, swiftModuleSdk, WASM_TRIPLE } from './swift-compile'
|
|
22
25
|
import { SWIFT_ENDPOINT_ENV } from './swift-distribution'
|
|
23
26
|
import type { NitroSourceCollection } from './nitro-source'
|
|
24
27
|
|
|
25
|
-
/** the verified
|
|
28
|
+
/** the verified adapters this build ships, the only lock normal compiles use. */
|
|
26
29
|
export const committedNitroAdapterLock = parseNitroAdapterLock(lockJson)
|
|
27
30
|
|
|
28
31
|
export interface NitroAdapterArchive {
|
|
@@ -31,30 +34,27 @@ export interface NitroAdapterArchive {
|
|
|
31
34
|
base64: string
|
|
32
35
|
}
|
|
33
36
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
const installedVersion = (root: string) =>
|
|
38
|
+
String(JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8')).version)
|
|
39
|
+
|
|
40
|
+
/** the archive for this app's original headers, after rejecting a lock built for
|
|
41
|
+
* another guest platform, target, compiler, SDK or framework than the module
|
|
42
|
+
* root compiling it. the committed lock is the trust root and pins each whole
|
|
37
43
|
* manifest. its wire ABI digest is producer provenance the reviewed lock
|
|
38
44
|
* fixes; the consumer cannot recompute it and the framework distribution id
|
|
39
45
|
* does not independently bind it. */
|
|
40
|
-
function
|
|
46
|
+
function selectPin(
|
|
41
47
|
lock: NitroAdapterLock,
|
|
42
48
|
collection: NitroSourceCollection,
|
|
43
49
|
moduleRoot: string,
|
|
44
|
-
) {
|
|
50
|
+
): NitroAdapterPin {
|
|
45
51
|
const { nitro, reactNative } = collection
|
|
46
52
|
const distribution = swiftDistributionAt(moduleRoot)
|
|
47
53
|
if (!distribution) throw new Error(`${moduleRoot} holds no Swift distribution`)
|
|
48
54
|
const sdk = swiftModuleSdk(moduleRoot)
|
|
49
|
-
const headers = headerDigests({
|
|
50
|
-
nitroModules: nitro.root,
|
|
51
|
-
reactNative: reactNative.root,
|
|
52
|
-
})
|
|
53
55
|
const mismatched = [
|
|
54
56
|
lock.platform !== NITRO_GUEST_PLATFORM && 'guest platform',
|
|
55
57
|
lock.target !== WASM_TRIPLE && 'target',
|
|
56
|
-
lock.headers.reactNativeJsi !== headers.reactNativeJsi && 'React Native JSI headers',
|
|
57
|
-
lock.headers.nitroModules !== headers.nitroModules && 'Nitro Modules headers',
|
|
58
58
|
lock.compiler !== distribution.release && 'compiler',
|
|
59
59
|
(lock.sdk.id !== sdk.wasmSdkId || lock.sdk.checksum !== sdk.wasmSdkChecksum) &&
|
|
60
60
|
'Swift SDK',
|
|
@@ -62,8 +62,17 @@ function verifyIdentity(
|
|
|
62
62
|
].filter((name) => name !== false)
|
|
63
63
|
if (mismatched.length > 0)
|
|
64
64
|
throw new Error(
|
|
65
|
-
`Nitro adapter
|
|
65
|
+
`Nitro adapter archives do not match this toolchain: ${mismatched.join(', ')}`,
|
|
66
|
+
)
|
|
67
|
+
const pin = nitroAdapterPin(
|
|
68
|
+
lock,
|
|
69
|
+
headerDigests({ nitroModules: nitro.root, reactNative: reactNative.root }),
|
|
70
|
+
)
|
|
71
|
+
if (!pin)
|
|
72
|
+
throw new Error(
|
|
73
|
+
`this peach has no Nitro adapter for react-native ${installedVersion(reactNative.root)} with react-native-nitro-modules ${installedVersion(nitro.root)}`,
|
|
66
74
|
)
|
|
75
|
+
return pin
|
|
67
76
|
}
|
|
68
77
|
|
|
69
78
|
/** the verified adapter archive for a collection: identity first, then the
|
|
@@ -74,28 +83,28 @@ export async function resolveNitroAdapter(
|
|
|
74
83
|
lock: NitroAdapterLock,
|
|
75
84
|
signal?: AbortSignal,
|
|
76
85
|
): Promise<NitroAdapterArchive> {
|
|
77
|
-
|
|
86
|
+
const pin = selectPin(lock, collection, moduleRoot)
|
|
78
87
|
const endpoint = process.env[SWIFT_ENDPOINT_ENV]?.trim().replace(/\/+$/, '')
|
|
79
88
|
if (!endpoint)
|
|
80
89
|
throw new Error(
|
|
81
90
|
`Nitro compilation needs ${SWIFT_ENDPOINT_ENV} for its adapter archive`,
|
|
82
91
|
)
|
|
83
|
-
const dir = path.join(rnxHomeDir(), 'swift', `nitro-adapter-${
|
|
92
|
+
const dir = path.join(rnxHomeDir(), 'swift', `nitro-adapter-${pin.archive.sha256}`)
|
|
84
93
|
if (!fs.existsSync(path.join(dir, NITRO_ADAPTER_MANIFEST))) {
|
|
85
|
-
process.stderr.write(`peach: downloading Nitro adapter ${
|
|
94
|
+
process.stderr.write(`peach: downloading Nitro adapter ${pin.archive.sha256}…\n`)
|
|
86
95
|
await installVerifiedTarball({
|
|
87
96
|
signal,
|
|
88
|
-
url: `${endpoint}/${nitroAdapterArchiveKey(
|
|
89
|
-
digest: { algorithm: 'sha256', encoding: 'hex', value:
|
|
97
|
+
url: `${endpoint}/${nitroAdapterArchiveKey(pin)}`,
|
|
98
|
+
digest: { algorithm: 'sha256', encoding: 'hex', value: pin.archive.sha256 },
|
|
90
99
|
destDir: dir,
|
|
91
100
|
installedMarker: NITRO_ADAPTER_MANIFEST,
|
|
92
101
|
label: 'Nitro adapter archive',
|
|
93
102
|
verify: (installed) => {
|
|
94
|
-
verifyInstalledNitroAdapter(installed,
|
|
103
|
+
verifyInstalledNitroAdapter(installed, pin)
|
|
95
104
|
},
|
|
96
105
|
})
|
|
97
106
|
}
|
|
98
|
-
const manifest = verifyInstalledNitroAdapter(dir,
|
|
107
|
+
const manifest = verifyInstalledNitroAdapter(dir, pin)
|
|
99
108
|
return {
|
|
100
109
|
manifest,
|
|
101
110
|
base64: fs.readFileSync(path.join(dir, manifest.archive.path)).toString('base64'),
|
package/src/nitro-bundle.ts
CHANGED
|
@@ -1,31 +1,53 @@
|
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import { PEACH_ANSWERED_NATIVE_PACKAGE_NAMES } from '../../peach-compat/src/generated/supported-native-packages'
|
|
1
4
|
import { loadRNXAppConfig } from '../cli/app-config'
|
|
2
5
|
import { resolveAppProject } from '../cli/app-project'
|
|
6
|
+
import { isLoopbackHost } from './backend-origin'
|
|
3
7
|
import { compileNitroModule } from './nitro-compile'
|
|
4
8
|
import { discoverNitroProviders, selectNitroProviders } from './nitro-source'
|
|
5
9
|
import { SWIFT_ENDPOINT_ENV, swiftDistributionRoot } from './swift-distribution'
|
|
6
|
-
import { icuUrl } from './swift-host'
|
|
10
|
+
import { icuUrl, type SwiftArtifact } from './swift-host'
|
|
7
11
|
import type { NitroCompiledModule } from './nitroContract'
|
|
12
|
+
import type { IncomingMessage, ServerResponse } from 'node:http'
|
|
13
|
+
|
|
14
|
+
export const NITRO_ROUTE = '/__peach/nitro'
|
|
8
15
|
|
|
9
16
|
export interface NitroBundle {
|
|
10
17
|
metadata: NitroCompiledModule
|
|
11
18
|
assets: { path: string; bytes: Buffer; contentType: string }[]
|
|
12
19
|
}
|
|
13
20
|
|
|
21
|
+
const answeredPackages: ReadonlySet<string> = new Set(PEACH_ANSWERED_NATIVE_PACKAGE_NAMES)
|
|
22
|
+
|
|
14
23
|
// every installed iOS Nitro provider the app declares compiles into one
|
|
15
24
|
// executable with the same compiler and asset addresses as local native loads.
|
|
16
|
-
// package javascript is carried verbatim by its bundler. a
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
|
|
25
|
+
// package javascript is carried verbatim by its bundler. a provider Peach
|
|
26
|
+
// answers itself (a seam resolves before the original registration) is not
|
|
27
|
+
// compiled. a HybridObject the app's config answers, a view or an unsupported
|
|
28
|
+
// or file-answered name, registers no original constructor; a provider left
|
|
29
|
+
// with none is not compiled. asset urls are relative to `origin`.
|
|
30
|
+
export async function compileNitroApp(
|
|
20
31
|
appRoot: string,
|
|
32
|
+
origin: string,
|
|
21
33
|
moduleRoot?: string,
|
|
22
|
-
): Promise<
|
|
34
|
+
): Promise<{ metadata: NitroCompiledModule; artifact: SwiftArtifact } | null> {
|
|
23
35
|
const config = await loadRNXAppConfig(resolveAppProject(appRoot))
|
|
36
|
+
const providers = selectNitroProviders(discoverNitroProviders(appRoot)).filter(
|
|
37
|
+
({ provider }) => !answeredPackages.has(provider.name),
|
|
38
|
+
)
|
|
39
|
+
const registered = new Set(
|
|
40
|
+
providers.flatMap(({ config }) => config.classes.map(({ name }) => name)),
|
|
41
|
+
)
|
|
24
42
|
const answers = {
|
|
25
|
-
hybridObjects: new Set(
|
|
43
|
+
hybridObjects: new Set(
|
|
44
|
+
Object.keys(config?.nativeHybridObjects ?? {}).filter((name) =>
|
|
45
|
+
registered.has(name),
|
|
46
|
+
),
|
|
47
|
+
),
|
|
26
48
|
views: new Set(Object.keys(config?.nativeViews ?? {})),
|
|
27
49
|
}
|
|
28
|
-
const packageRoots =
|
|
50
|
+
const packageRoots = providers.map(({ provider }) => provider.root)
|
|
29
51
|
if (selectNitroProviders(packageRoots, answers).length === 0) return null
|
|
30
52
|
// the adapter archive is built against the published distribution, so Nitro
|
|
31
53
|
// compiles against it even in a source checkout; the checkout framework has
|
|
@@ -41,6 +63,30 @@ export async function buildNitroBundle(
|
|
|
41
63
|
answers,
|
|
42
64
|
moduleRoot: module,
|
|
43
65
|
})
|
|
66
|
+
return {
|
|
67
|
+
artifact,
|
|
68
|
+
metadata: {
|
|
69
|
+
platform: 'ios',
|
|
70
|
+
packages: collection.providers.map(({ name, version, hybridObjects }) => ({
|
|
71
|
+
name,
|
|
72
|
+
version,
|
|
73
|
+
hybridObjects,
|
|
74
|
+
})),
|
|
75
|
+
url: `${origin}/__peach/swift/${artifact.hash}.wasm`,
|
|
76
|
+
hash: artifact.hash,
|
|
77
|
+
icuUrl: icuUrl(origin, artifact),
|
|
78
|
+
bundleFiles: artifact.package.bundleFiles.files,
|
|
79
|
+
},
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export async function buildNitroBundle(
|
|
84
|
+
appRoot: string,
|
|
85
|
+
moduleRoot?: string,
|
|
86
|
+
): Promise<NitroBundle | null> {
|
|
87
|
+
const compiled = await compileNitroApp(appRoot, '', moduleRoot)
|
|
88
|
+
if (!compiled) return null
|
|
89
|
+
const { artifact, metadata } = compiled
|
|
44
90
|
const assets: NitroBundle['assets'] = [
|
|
45
91
|
{
|
|
46
92
|
path: `__peach/swift/${artifact.hash}.wasm`,
|
|
@@ -54,18 +100,59 @@ export async function buildNitroBundle(
|
|
|
54
100
|
bytes: artifact.icu.gzip,
|
|
55
101
|
contentType: 'application/gzip',
|
|
56
102
|
})
|
|
57
|
-
return {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
103
|
+
return { metadata, assets }
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// one build per app root and dev server; concurrent boots share it. the
|
|
107
|
+
// compiler reuses an unchanged artifact, so a reload pays only the source check.
|
|
108
|
+
const compiling = new Map<string, Promise<NitroCompiledModule | null>>()
|
|
109
|
+
|
|
110
|
+
// the dev server's build of an app's installed Nitro providers. its wasm and
|
|
111
|
+
// ICU are served from the same host by the Swift artifact route.
|
|
112
|
+
export async function handleNitroRequest(
|
|
113
|
+
req: IncomingMessage,
|
|
114
|
+
res: ServerResponse,
|
|
115
|
+
): Promise<void> {
|
|
116
|
+
const url = new URL(req.url ?? '/', 'http://localhost')
|
|
117
|
+
const remote = req.socket.remoteAddress?.replace(/^::ffff:/, '')
|
|
118
|
+
const origin = req.headers.origin
|
|
119
|
+
if (
|
|
120
|
+
!remote ||
|
|
121
|
+
!isLoopbackHost(remote) ||
|
|
122
|
+
(origin && !isLoopbackHost(new URL(origin).hostname))
|
|
123
|
+
) {
|
|
124
|
+
res.writeHead(403)
|
|
125
|
+
res.end('Nitro compilation requires a loopback client')
|
|
126
|
+
return
|
|
127
|
+
}
|
|
128
|
+
res.setHeader('Access-Control-Allow-Origin', origin ?? '*')
|
|
129
|
+
res.setHeader('Vary', 'Origin')
|
|
130
|
+
res.setHeader('Cross-Origin-Resource-Policy', 'cross-origin')
|
|
131
|
+
const root = url.searchParams.get('root')
|
|
132
|
+
const host = req.headers.host
|
|
133
|
+
if (req.method !== 'GET' || !root || !path.isAbsolute(root) || !host) {
|
|
134
|
+
res.writeHead(400)
|
|
135
|
+
res.end('Nitro compilation needs GET with an absolute app root')
|
|
136
|
+
return
|
|
137
|
+
}
|
|
138
|
+
try {
|
|
139
|
+
const key = `${host}\0${fs.realpathSync(root)}`
|
|
140
|
+
let pending = compiling.get(key)
|
|
141
|
+
if (!pending) {
|
|
142
|
+
pending = compileNitroApp(fs.realpathSync(root), `http://${host}`)
|
|
143
|
+
.then((compiled) => compiled?.metadata ?? null)
|
|
144
|
+
.finally(() => compiling.delete(key))
|
|
145
|
+
compiling.set(key, pending)
|
|
146
|
+
}
|
|
147
|
+
const metadata = await pending
|
|
148
|
+
res.writeHead(200, {
|
|
149
|
+
'Content-Type': 'application/json',
|
|
150
|
+
'Cache-Control': 'no-store',
|
|
151
|
+
})
|
|
152
|
+
res.end(JSON.stringify(metadata))
|
|
153
|
+
} catch (error) {
|
|
154
|
+
if (res.destroyed) return
|
|
155
|
+
res.writeHead(500, { 'Content-Type': 'text/plain' })
|
|
156
|
+
res.end(error instanceof Error ? error.message : String(error))
|
|
70
157
|
}
|
|
71
158
|
}
|
package/src/nitro-compile.ts
CHANGED
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
swiftManifestCxxLanguageStandard,
|
|
25
25
|
swiftManifestTargets,
|
|
26
26
|
} from './swift-package'
|
|
27
|
-
import { collectSwiftSourcePods } from './swift-source-pods'
|
|
27
|
+
import { appPodfileLock, collectSwiftSourcePods } from './swift-source-pods'
|
|
28
28
|
import type { SwiftCompileInput } from './swift-compile'
|
|
29
29
|
|
|
30
30
|
// every selected installed implementation, its generated registration and the
|
|
@@ -69,9 +69,11 @@ export function collectNitroCompileInput(
|
|
|
69
69
|
|
|
70
70
|
const entry = 'Sources/PeachNitroApp/main.swift'
|
|
71
71
|
// every provider registers before the one runtime serves guest evaluation.
|
|
72
|
+
// the entry has no app to install the reactor's inline executor, so it does
|
|
73
|
+
// that first: a Task a HybridObject launches (Promise.async) runs on it.
|
|
72
74
|
files[entry] =
|
|
73
|
-
|
|
74
|
-
`
|
|
75
|
+
`@_spi(Peach) import PeachFoundation\nimport NitroCore\n${collection.registrations.map(({ target }) => `import ${target}\n`).join('')}` +
|
|
76
|
+
`PeachHostDriver.installExecutor()\npeachNitroInitialize()\n${collection.registrations.map(({ symbol }) => `${symbol}()\n`).join('')}`
|
|
75
77
|
files['Package.swift'] = [
|
|
76
78
|
'// swift-tools-version: 6.2',
|
|
77
79
|
'import PackageDescription',
|
|
@@ -93,15 +95,40 @@ export function collectNitroCompileInput(
|
|
|
93
95
|
...(dependencies?.resourceBundles
|
|
94
96
|
? { resourceBundles: dependencies.resourceBundles }
|
|
95
97
|
: {}),
|
|
98
|
+
...(dependencies?.resources ? { resources: dependencies.resources } : {}),
|
|
96
99
|
}
|
|
97
100
|
}
|
|
98
101
|
|
|
102
|
+
// framework names C-family sources include as `<Name/Header.h>` or
|
|
103
|
+
// `"Name/Header.h"` that no collected file provides: a pod the provider's
|
|
104
|
+
// podspec depends on, which CocoaPods would put on the header search path.
|
|
105
|
+
function unresolvedFrameworkIncludes(files: Record<string, string>): string[] {
|
|
106
|
+
const paths = Object.keys(files)
|
|
107
|
+
const names = new Set<string>()
|
|
108
|
+
for (const [file, contents] of Object.entries(files)) {
|
|
109
|
+
if (!/\.(?:h|hh|hpp|hxx|c|cc|cpp|cxx|m|mm)$/.test(file)) continue
|
|
110
|
+
for (const match of contents.matchAll(
|
|
111
|
+
/^\s*#\s*(?:include|import)\s*[<"]([A-Za-z_]\w*)\/([^>"]+)[>"]/gm,
|
|
112
|
+
)) {
|
|
113
|
+
const header = `${match[1]}/${match[2]}`
|
|
114
|
+
if (
|
|
115
|
+
!paths.some(
|
|
116
|
+
(candidate) => candidate === header || candidate.endsWith(`/${header}`),
|
|
117
|
+
)
|
|
118
|
+
)
|
|
119
|
+
names.add(match[1]!)
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return [...names].sort()
|
|
123
|
+
}
|
|
124
|
+
|
|
99
125
|
export async function compileNitroModule(
|
|
100
126
|
options: NitroSourceOptions & { moduleRoot: string },
|
|
101
127
|
): Promise<{ artifact: SwiftArtifact; collection: NitroSourceCollection }> {
|
|
102
128
|
const collection = collectNitroSources(options)
|
|
103
129
|
let dependencies: SwiftCompileInput | null = null
|
|
104
|
-
|
|
130
|
+
const podfileLock = options.appRoot && appPodfileLock(options.appRoot)
|
|
131
|
+
if (podfileLock) {
|
|
105
132
|
const available = new Set(
|
|
106
133
|
swiftAvailableModules(
|
|
107
134
|
options.moduleRoot,
|
|
@@ -111,9 +138,10 @@ export async function compileNitroModule(
|
|
|
111
138
|
for (const target of collection.targets) available.add(target.name)
|
|
112
139
|
const missing = [...missingSwiftModules(collection.files, available).keys()]
|
|
113
140
|
dependencies = await collectSwiftSourcePods(
|
|
114
|
-
|
|
141
|
+
podfileLock,
|
|
115
142
|
missing,
|
|
116
143
|
options.moduleRoot,
|
|
144
|
+
unresolvedFrameworkIncludes(collection.files),
|
|
117
145
|
)
|
|
118
146
|
}
|
|
119
147
|
const input = collectNitroCompileInput(
|
|
@@ -144,6 +172,9 @@ export async function compileNitroModule(
|
|
|
144
172
|
project.libraries = input.libraries
|
|
145
173
|
project.nativeTargets = input.nativeTargets
|
|
146
174
|
project.resourceBundles = input.resourceBundles
|
|
175
|
+
project.bundleFiles = input.resources
|
|
176
|
+
? { files: input.resources, bundles: input.resourceBundles ?? [], watched: [] }
|
|
177
|
+
: undefined
|
|
147
178
|
return {
|
|
148
179
|
artifact: await artifactFor(project, input.entry, options.moduleRoot),
|
|
149
180
|
collection,
|
package/src/nitro-source.ts
CHANGED
|
@@ -379,7 +379,9 @@ export function collectNitroSources(options: NitroSourceOptions): NitroSourceCol
|
|
|
379
379
|
const key = `${targetPath(name)}/upstream/${path.relative(root, source).split(path.sep).join('/')}`
|
|
380
380
|
let original = originals.get(source)
|
|
381
381
|
if (!original) {
|
|
382
|
-
|
|
382
|
+
// Nitro compiles only on this machine, so the compile service's
|
|
383
|
+
// request limit does not bound one upstream file (simdutf.cpp).
|
|
384
|
+
const bytes = readPackageFile(root, source, Infinity)
|
|
383
385
|
original = key
|
|
384
386
|
const text = bytes.toString('utf8')
|
|
385
387
|
if (!Buffer.from(text).equals(bytes))
|
|
@@ -445,7 +447,7 @@ export function collectNitroSources(options: NitroSourceOptions): NitroSourceCol
|
|
|
445
447
|
directory,
|
|
446
448
|
'NitroModules',
|
|
447
449
|
null,
|
|
448
|
-
new Set(
|
|
450
|
+
new Set(),
|
|
449
451
|
() => true,
|
|
450
452
|
/\.swift$/,
|
|
451
453
|
)
|
|
@@ -461,7 +463,15 @@ export function collectNitroSources(options: NitroSourceOptions): NitroSourceCol
|
|
|
461
463
|
const implementationHeaders = fs.existsSync(path.join(module.root, 'cpp'))
|
|
462
464
|
? collect(module.root, 'cpp', targetName, null)
|
|
463
465
|
: new Map<string, string>()
|
|
464
|
-
|
|
466
|
+
// views/ holds nitrogen's Fabric component descriptor and props parser,
|
|
467
|
+
// which only React Native's Fabric renderer reads.
|
|
468
|
+
collect(
|
|
469
|
+
module.root,
|
|
470
|
+
'nitrogen/generated/shared/c++',
|
|
471
|
+
targetName,
|
|
472
|
+
null,
|
|
473
|
+
new Set(['views']),
|
|
474
|
+
)
|
|
465
475
|
for (const entry of config.classes)
|
|
466
476
|
if (
|
|
467
477
|
entry.language === 'c++' &&
|
|
@@ -50,9 +50,24 @@ export interface NitroAdapterManifest {
|
|
|
50
50
|
archive: { path: string; size: number; sha256: string }
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
/**
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
/** every published tarball one CLI build installs, committed beside
|
|
54
|
+
* swift-distribution.lock.json: one build identity, and one archive per pair of
|
|
55
|
+
* original React Native JSI and Nitro headers it was compiled against. */
|
|
56
|
+
export interface NitroAdapterLock extends Omit<
|
|
57
|
+
NitroAdapterManifest,
|
|
58
|
+
'schema' | 'archive' | 'headers'
|
|
59
|
+
> {
|
|
60
|
+
schema: 2
|
|
61
|
+
/** each downloaded .tar.gz, which installVerifiedTarball checks. */
|
|
62
|
+
archives: {
|
|
63
|
+
headers: NitroAdapterManifest['headers']
|
|
64
|
+
sha256: string
|
|
65
|
+
size: number
|
|
66
|
+
}[]
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** the one archive an app's headers select: its manifest identity and tarball. */
|
|
70
|
+
export interface NitroAdapterPin extends Omit<NitroAdapterManifest, 'archive'> {
|
|
56
71
|
archive: { sha256: string; size: number }
|
|
57
72
|
}
|
|
58
73
|
|
|
@@ -170,44 +185,109 @@ export function parseNitroAdapterManifest(value: unknown): NitroAdapterManifest
|
|
|
170
185
|
}
|
|
171
186
|
}
|
|
172
187
|
|
|
188
|
+
function headerPair(value: unknown): NitroAdapterManifest['headers'] {
|
|
189
|
+
if (!isRecord(value)) throw new Error('invalid Nitro adapter headers')
|
|
190
|
+
return {
|
|
191
|
+
reactNativeJsi: digestField(value.reactNativeJsi, 'JSI header digest'),
|
|
192
|
+
nitroModules: digestField(value.nitroModules, 'Nitro header digest'),
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const sameHeaders = (
|
|
197
|
+
a: NitroAdapterManifest['headers'],
|
|
198
|
+
b: NitroAdapterManifest['headers'],
|
|
199
|
+
) => a.reactNativeJsi === b.reactNativeJsi && a.nitroModules === b.nitroModules
|
|
200
|
+
|
|
173
201
|
export function parseNitroAdapterLock(value: unknown): NitroAdapterLock {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
202
|
+
if (!isRecord(value) || value.schema !== 2 || !Array.isArray(value.archives))
|
|
203
|
+
throw new Error('invalid Nitro adapter lock')
|
|
204
|
+
const { headers: _headers, ...shared } = identity({
|
|
205
|
+
...value,
|
|
206
|
+
schema: 1,
|
|
207
|
+
headers: { reactNativeJsi: '0'.repeat(64), nitroModules: '0'.repeat(64) },
|
|
208
|
+
})
|
|
209
|
+
const archives = value.archives.map((entry: unknown) => {
|
|
210
|
+
if (!isRecord(entry) || typeof entry.size !== 'number')
|
|
211
|
+
throw new Error('invalid Nitro adapter lock archive')
|
|
212
|
+
return {
|
|
213
|
+
headers: headerPair(entry.headers),
|
|
214
|
+
sha256: digestField(entry.sha256, 'lock archive digest'),
|
|
215
|
+
size: entry.size,
|
|
216
|
+
}
|
|
217
|
+
})
|
|
218
|
+
archives.forEach((entry, index) => {
|
|
219
|
+
if (
|
|
220
|
+
archives.findIndex((other) => sameHeaders(other.headers, entry.headers)) !== index
|
|
221
|
+
)
|
|
222
|
+
throw new Error('Nitro adapter lock repeats a header pair')
|
|
223
|
+
})
|
|
224
|
+
return { ...shared, schema: 2, archives }
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/** the archive built against these original headers, or null when none was published. */
|
|
228
|
+
export function nitroAdapterPin(
|
|
229
|
+
lock: NitroAdapterLock,
|
|
230
|
+
headers: NitroAdapterManifest['headers'],
|
|
231
|
+
): NitroAdapterPin | null {
|
|
232
|
+
const entry = lock.archives.find((archive) => sameHeaders(archive.headers, headers))
|
|
233
|
+
if (!entry) return null
|
|
234
|
+
// manifest field order: the installed manifest is compared as JSON
|
|
177
235
|
return {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
236
|
+
schema: 1,
|
|
237
|
+
platform: lock.platform,
|
|
238
|
+
target: lock.target,
|
|
239
|
+
recipe: lock.recipe,
|
|
240
|
+
adapter: lock.adapter,
|
|
241
|
+
headers: entry.headers,
|
|
242
|
+
compiler: lock.compiler,
|
|
243
|
+
sdk: lock.sdk,
|
|
244
|
+
framework: lock.framework,
|
|
245
|
+
archive: { sha256: entry.sha256, size: entry.size },
|
|
183
246
|
}
|
|
184
247
|
}
|
|
185
248
|
|
|
186
|
-
/** the lock one published manifest
|
|
187
|
-
|
|
249
|
+
/** the lock with one published manifest's tarball added, replacing the archive
|
|
250
|
+
* for the same headers. every archive in a lock shares one build identity. */
|
|
251
|
+
export function withNitroAdapterArchive(
|
|
252
|
+
lock: NitroAdapterLock | null,
|
|
188
253
|
manifest: NitroAdapterManifest,
|
|
189
254
|
tarball: { sha256: string; size: number },
|
|
190
255
|
): NitroAdapterLock {
|
|
191
|
-
const { archive: _library, ...
|
|
192
|
-
|
|
256
|
+
const { archive: _library, headers, schema: _schema, ...shared } = manifest
|
|
257
|
+
if (lock) {
|
|
258
|
+
const { archives: _archives, schema: _lockSchema, ...current } = lock
|
|
259
|
+
if (JSON.stringify(current) !== JSON.stringify(shared))
|
|
260
|
+
throw new Error(
|
|
261
|
+
'the archive was built with another adapter, recipe, compiler, SDK or distribution than the lock; rebuild every archive',
|
|
262
|
+
)
|
|
263
|
+
}
|
|
264
|
+
const archives = [
|
|
265
|
+
...(lock?.archives ?? []).filter((entry) => !sameHeaders(entry.headers, headers)),
|
|
266
|
+
{ headers, ...tarball },
|
|
267
|
+
].sort((a, b) =>
|
|
268
|
+
`${a.headers.reactNativeJsi}${a.headers.nitroModules}`.localeCompare(
|
|
269
|
+
`${b.headers.reactNativeJsi}${b.headers.nitroModules}`,
|
|
270
|
+
),
|
|
271
|
+
)
|
|
272
|
+
return { schema: 2, ...shared, archives }
|
|
193
273
|
}
|
|
194
274
|
|
|
195
275
|
/** the tarball's path under PEACH_SWIFT_ENDPOINT: content addressed, so immutable. */
|
|
196
|
-
export function nitroAdapterArchiveKey(
|
|
197
|
-
return `nitro-adapter/${
|
|
276
|
+
export function nitroAdapterArchiveKey(pin: { archive: { sha256: string } }): string {
|
|
277
|
+
return `nitro-adapter/${pin.archive.sha256}.tar.gz`
|
|
198
278
|
}
|
|
199
279
|
|
|
200
|
-
/** throws unless an unpacked adapter is the one the
|
|
280
|
+
/** throws unless an unpacked adapter is the one the pin names and its library
|
|
201
281
|
* bytes are the ones its manifest records. needs no adapter source. */
|
|
202
282
|
export function verifyInstalledNitroAdapter(
|
|
203
283
|
directory: string,
|
|
204
|
-
|
|
284
|
+
pin: NitroAdapterPin,
|
|
205
285
|
): NitroAdapterManifest {
|
|
206
286
|
const manifest = parseNitroAdapterManifest(
|
|
207
287
|
JSON.parse(readFileSync(path.join(directory, NITRO_ADAPTER_MANIFEST), 'utf8')),
|
|
208
288
|
)
|
|
209
289
|
const { archive, ...recorded } = manifest
|
|
210
|
-
const { archive: _tarball, ...pinned } =
|
|
290
|
+
const { archive: _tarball, ...pinned } = pin
|
|
211
291
|
if (JSON.stringify(recorded) !== JSON.stringify(pinned))
|
|
212
292
|
throw new Error('Nitro adapter manifest does not match the lock this build carries')
|
|
213
293
|
const bytes = readFileSync(path.join(directory, archive.path))
|
package/src/nitroContract.ts
CHANGED
|
@@ -2,6 +2,8 @@ import {
|
|
|
2
2
|
insertBundleMetadataFooter,
|
|
3
3
|
readBundleMetadataFooter,
|
|
4
4
|
} from './bundleGlobalFooter'
|
|
5
|
+
import { isRecord } from './is-record'
|
|
6
|
+
import { isSwiftResourcePath, type SwiftEntryOptions } from './swiftContract'
|
|
5
7
|
|
|
6
8
|
/** the guest platform every Nitro compile targets. */
|
|
7
9
|
export const NITRO_GUEST_PLATFORM = 'ios'
|
|
@@ -15,6 +17,7 @@ export interface NitroCompiledModule {
|
|
|
15
17
|
url: string
|
|
16
18
|
hash: string
|
|
17
19
|
icuUrl: string
|
|
20
|
+
bundleFiles: NonNullable<SwiftEntryOptions['bundleFiles']>
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
function readNitroPackage(
|
|
@@ -49,6 +52,7 @@ export function readNitroMetadata(value: unknown): NitroCompiledModule | null {
|
|
|
49
52
|
const url = Reflect.get(value, 'url')
|
|
50
53
|
const hash = Reflect.get(value, 'hash')
|
|
51
54
|
const icuUrl = Reflect.get(value, 'icuUrl')
|
|
55
|
+
const packed = Reflect.get(value, 'bundleFiles')
|
|
52
56
|
if (
|
|
53
57
|
packages.length === 0 ||
|
|
54
58
|
!packages.every((entry) => entry !== null) ||
|
|
@@ -60,10 +64,22 @@ export function readNitroMetadata(value: unknown): NitroCompiledModule | null {
|
|
|
60
64
|
typeof hash !== 'string' ||
|
|
61
65
|
!/^[a-f0-9]{64}$/.test(hash) ||
|
|
62
66
|
typeof icuUrl !== 'string' ||
|
|
63
|
-
!icuUrl
|
|
67
|
+
!icuUrl ||
|
|
68
|
+
!isRecord(packed)
|
|
64
69
|
)
|
|
65
70
|
throw new Error('invalid Nitro compilation metadata')
|
|
66
|
-
|
|
71
|
+
const bundleFiles = Object.fromEntries(
|
|
72
|
+
Object.entries(packed).map(([name, bytes]) => {
|
|
73
|
+
if (
|
|
74
|
+
!isSwiftResourcePath(name) ||
|
|
75
|
+
typeof bytes !== 'string' ||
|
|
76
|
+
!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(bytes)
|
|
77
|
+
)
|
|
78
|
+
throw new Error('invalid Nitro bundle file')
|
|
79
|
+
return [name, bytes] satisfies [string, string]
|
|
80
|
+
}),
|
|
81
|
+
)
|
|
82
|
+
return { platform: 'ios', packages, url, hash, icuUrl, bundleFiles }
|
|
67
83
|
}
|
|
68
84
|
|
|
69
85
|
export function readNitroFooter(source: string): NitroCompiledModule | null {
|