peachsim 0.1.1674 → 0.1.1692
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/commands/control.ts +13 -1
- package/cli/commands/coverage-swift.ts +150 -27
- package/cli/commands/coverage.ts +219 -20
- package/cli/commands/detect.ts +10 -6
- package/cli/commands/inspect/actions.ts +1 -0
- package/cli/commands/inspect/core.ts +2 -0
- package/cli/commands/inspect/wait-ready.ts +7 -0
- package/cli/commands/screenshot.ts +12 -0
- package/cli/outbound-endpoints.ts +12 -0
- package/detox/index.ts +11 -1
- package/detox/jest-environment.cjs +14 -0
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +4833 -2432
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +6 -4
- package/dist-lib/detox/jest-environment.cjs +14 -0
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +3785 -1737
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +4253 -2205
- package/dist-lib/host/fetch-proxy-handler.cjs +20 -7
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +2065 -796
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +6325 -4287
- package/dist-lib/native-app-identity-project.cjs +192 -55
- package/dist-lib/native-app-identity-project.mjs +235 -86
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +27 -23
- package/dist-lib/public-origins-lib-static.json +1 -1
- package/dist-lib/public-origins-lib.json +156 -87
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/reap-browser.cjs +2 -2
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +3 -2
- package/dist-lib/sdk.mjs +3 -2
- package/dist-lib/skills.cjs +5036 -2833
- package/dist-lib/swift-compile.cjs +2937 -437
- package/dist-lib/swift-compile.mjs +2932 -435
- package/dist-lib/swift-package.cjs +137 -49
- package/dist-lib/swift-package.mjs +132 -49
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +26 -11
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +6005 -1725
- package/dist-lib/vite.cjs +1911 -776
- package/dist-lib/worklet-executable.cjs +7 -4
- package/dist-lib/worklet-executable.mjs +7 -4
- package/dist-types/packages/peach-engine/src/engine/canvaskit-api.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/clipboardContract.d.ts +24 -2
- package/dist-types/packages/peach-engine/src/preview/upload-protocol.d.ts +11 -3
- package/dist-types/packages/peach-engine/src/webview-automation-host.d.ts +6 -0
- package/dist-types/packages/peach-globals/src/clipboardBridgeContract.d.ts +8 -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-kit/src/capabilities.d.ts +1 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +60 -2
- 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 +117 -2
- 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/MessageUI.framework/Headers/MFComposeAssistantViewController.h +29 -0
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMailComposeControllerDeferredAction.h +14 -0
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMailComposeViewController.h +162 -0
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMailDraft.h +24 -0
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMessageComposeViewController+UPI.h +31 -0
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMessageComposeViewController.h +169 -0
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MessageUI.h +13 -0
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Modules/module.modulemap +11 -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/UIKit.framework/Headers/UIKit.h +10 -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/arm/param.h +151 -0
- package/sdk/ios/usr/include/complex.h +167 -0
- package/sdk/ios/usr/include/dispatch/dispatch.h +8 -0
- package/sdk/ios/usr/include/dlfcn.h +1 -2
- package/sdk/ios/usr/include/mach/mach_types.h +1 -0
- package/sdk/ios/usr/include/machine/param.h +42 -0
- package/sdk/ios/usr/include/math.h +835 -2
- package/sdk/ios/usr/include/net/if.h +1 -2
- package/sdk/ios/usr/include/peach/pthread.h +4 -4
- package/sdk/ios/usr/include/pthread/qos.h +304 -0
- package/sdk/ios/usr/include/sys/_types/_fd_clr.h +31 -0
- package/sdk/ios/usr/include/sys/_types/_fd_copy.h +31 -0
- package/sdk/ios/usr/include/sys/_types/_fd_def.h +121 -0
- package/sdk/ios/usr/include/sys/_types/_fd_isset.h +31 -0
- package/sdk/ios/usr/include/sys/_types/_fd_set.h +31 -0
- package/sdk/ios/usr/include/sys/_types/_fd_setsize.h +31 -0
- package/sdk/ios/usr/include/sys/_types/_fd_zero.h +31 -0
- package/sdk/ios/usr/include/sys/cdefs.h +3 -1
- package/sdk/ios/usr/include/sys/param.h +235 -0
- package/sdk/ios/usr/include/sys/proc.h +1 -0
- package/sdk/ios/usr/include/sys/qos.h +151 -12
- package/sdk/ios/wasm/include/__typedef_sigset_t.h +7 -0
- package/sdk/ios/wasm/include/fcntl.h +11 -0
- package/sdk/ios/wasm/include/mach/machine/boolean.h +2 -0
- package/sdk/ios/wasm/include/mach/machine/exception.h +5 -0
- package/sdk/ios/wasm/include/mach/machine/kern_return.h +2 -0
- package/sdk/ios/wasm/include/mach/machine/processor_info.h +2 -0
- package/sdk/ios/wasm/include/mach/machine/rpc.h +2 -0
- package/sdk/ios/wasm/include/mach/machine/thread_state.h +3 -0
- package/sdk/ios/wasm/include/mach/machine/thread_status.h +3 -0
- package/sdk/ios/wasm/include/mach/machine/vm_param.h +3 -0
- package/sdk/ios/wasm/include/mach/machine/vm_types.h +18 -0
- package/sdk/ios/wasm/include/machine/_types.h +153 -0
- package/sdk/ios/wasm/include/machine/endian.h +2 -0
- package/sdk/ios/wasm/include/machine/limits.h +2 -0
- package/sdk/ios/wasm/include/machine/types.h +30 -0
- package/sdk/ios/wasm/include/poll.h +8 -0
- package/sdk/ios/wasm/include/pthread.h +50 -0
- package/sdk/ios/wasm/include/signal.h +72 -0
- package/sdk/ios/wasm/include/stdlib.h +3 -0
- package/sdk/ios/wasm/include/string.h +10 -0
- package/sdk/ios/wasm/include/sys/_pthread/_pthread_attr_t.h +7 -0
- package/sdk/ios/wasm/include/sys/_pthread/_pthread_t.h +7 -0
- package/sdk/ios/wasm/include/sys/mman.h +122 -0
- package/sdk/ios/wasm/include/sys/select.h +37 -0
- package/sdk/ios/wasm/include/sys/signal.h +259 -0
- package/sdk/ios/wasm/include/sys/socket.h +8 -0
- package/sdk/ios/wasm/include/sys/types.h +14 -0
- package/sdk/ios/wasm/include/sys/ucontext.h +1 -0
- package/sdk/ios/wasm/include/sys/uio.h +11 -0
- package/sdk/ios/wasm/include/sys/wait.h +89 -0
- package/sdk/ios/wasm/include/time.h +8 -0
- package/sdk/ios/wasm/include/unistd.h +17 -0
- package/src/bridge-contract.ts +2 -0
- package/src/chromium-admission.ts +10 -5
- package/src/device-catalog.ts +4 -4
- package/src/generated/swift-c-predefines.json +1988 -0
- package/src/host/fetch-proxy-handler.ts +20 -0
- package/src/metro-plugin.ts +5 -2
- package/src/nitro-adapter.lock.json +6 -6
- package/src/nitro-bundle.ts +1 -0
- package/src/nitro-compile.ts +67 -2
- package/src/nitroContract.ts +18 -2
- package/src/numbered-lock.ts +72 -0
- package/src/react-native-coverage/capability-reference-resolution.ts +62 -5
- package/src/react-native-coverage/capability-source-references.ts +50 -13
- package/src/react-native-coverage/native-source-credit.ts +126 -0
- package/src/react-native-coverage/native-source-ranges-file.ts +38 -0
- package/src/react-native-coverage/native-surface.ts +49 -0
- package/src/react-native-coverage/verified-reach.ts +22 -2
- package/src/runtime-assets.ts +17 -0
- package/src/swift-compile.ts +530 -97
- package/src/swift-coverage/indexing.ts +17 -1
- package/src/swift-coverage/package.ts +3 -1
- package/src/swift-coverage/sdk.ts +71 -0
- package/src/swift-coverage/source.ts +74 -2
- package/src/swift-coverage/types.ts +6 -0
- package/src/swift-coverage/xcode-assets.ts +62 -2
- package/src/swift-coverage/xcode-packages.ts +11 -6
- package/src/swift-distribution.lock.json +12 -12
- package/src/swift-host.ts +457 -62
- package/src/swift-objc-compile.ts +26 -26
- package/src/swift-objc-metadata.ts +2 -8
- package/src/swift-objc-platform.ts +53 -0
- package/src/swift-objc-standin.ts +66 -12
- package/src/swift-package-manifest.ts +196 -28
- package/src/swift-package.ts +186 -60
- package/src/swift-packages.ts +298 -88
- package/src/swift-source-file.ts +10 -15
- package/src/swift-source-pods.ts +288 -0
- package/src/swift-standins.ts +87 -13
- package/src/swift-submit.ts +5 -0
- package/src/swift-toolchain.ts +32 -10
- package/src/swiftContract.ts +160 -75
- package/src/target-matcher.ts +15 -2
- package/src/vite-plugin-one.ts +5 -4
- package/src/worker-system-chunks.ts +7 -1
- package/src/worklet-executable.ts +7 -3
- package/src/xcode-json-project.ts +14 -2
- package/src/xcode-project.ts +193 -69
package/dist-lib/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1692 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -98,7 +98,7 @@ var init_bundleGlobalFooter = __esm({
|
|
|
98
98
|
var runtime_companion_default;
|
|
99
99
|
var init_runtime_companion = __esm({
|
|
100
100
|
"runtime-companion.json"() {
|
|
101
|
-
runtime_companion_default = { abi: 1, sha256: "
|
|
101
|
+
runtime_companion_default = { abi: 1, sha256: "0aa1bb93377f2ed084f869ab161285ff9e1c638510065738c97f0cbe806bb630", file: "node/cli-0aa1bb93377f2ed084f869ab161285ff9e1c638510065738c97f0cbe806bb630.cjs" };
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
104
|
|
|
@@ -356,7 +356,18 @@ function resolveRuntimeFilePath(runtimeRoot, pathname) {
|
|
|
356
356
|
if (!import_fs.default.existsSync(fullPath) || !import_fs.default.statSync(fullPath).isFile()) return null;
|
|
357
357
|
return fullPath;
|
|
358
358
|
}
|
|
359
|
+
function setRuntimeIsolationHeaders(res) {
|
|
360
|
+
res.setHeader("cross-origin-opener-policy", "same-origin");
|
|
361
|
+
res.setHeader("cross-origin-embedder-policy", "require-corp");
|
|
362
|
+
res.setHeader("cross-origin-resource-policy", "cross-origin");
|
|
363
|
+
}
|
|
364
|
+
function sendShellHtml(res, html) {
|
|
365
|
+
setRuntimeIsolationHeaders(res);
|
|
366
|
+
res.setHeader("content-type", "text/html");
|
|
367
|
+
res.end(html);
|
|
368
|
+
}
|
|
359
369
|
function serveRuntimeFile(req, res, fullPath) {
|
|
370
|
+
setRuntimeIsolationHeaders(res);
|
|
360
371
|
const ext = import_path.default.extname(fullPath);
|
|
361
372
|
const stat = import_fs.default.statSync(fullPath);
|
|
362
373
|
const lastModified = stat.mtime.toUTCString();
|
|
@@ -526,6 +537,26 @@ function isLoopbackHost(hostname) {
|
|
|
526
537
|
const normalized = normalizeHostname(hostname);
|
|
527
538
|
return normalized === "localhost" || normalized.endsWith(".localhost") || normalized === "0.0.0.0" || normalized === "::1" || /^127(?:\.\d{1,3}){3}$/.test(normalized);
|
|
528
539
|
}
|
|
540
|
+
function isTrustedBridgeRequest(headers) {
|
|
541
|
+
const origin = headers.origin;
|
|
542
|
+
if (origin === void 0) return true;
|
|
543
|
+
try {
|
|
544
|
+
const { hostname, host } = new URL(String(origin));
|
|
545
|
+
return isLoopbackHost(hostname) || [headers.host, headers[":authority"], headers["x-forwarded-host"]].some(
|
|
546
|
+
(value) => typeof value === "string" && value.toLowerCase() === host
|
|
547
|
+
);
|
|
548
|
+
} catch {
|
|
549
|
+
return false;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
function loopbackOriginOf(value) {
|
|
553
|
+
try {
|
|
554
|
+
const url = new URL(value);
|
|
555
|
+
return isLoopbackHost(url.hostname) ? url.origin : null;
|
|
556
|
+
} catch {
|
|
557
|
+
return null;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
529
560
|
var init_backend_origin = __esm({
|
|
530
561
|
"src/backend-origin.ts"() {
|
|
531
562
|
"use strict";
|
|
@@ -1732,17 +1763,17 @@ function visit(node, visitor) {
|
|
|
1732
1763
|
} else
|
|
1733
1764
|
visit_(null, node, visitor_, Object.freeze([]));
|
|
1734
1765
|
}
|
|
1735
|
-
function visit_(key, node, visitor,
|
|
1736
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
1766
|
+
function visit_(key, node, visitor, path22) {
|
|
1767
|
+
const ctrl = callVisitor(key, node, visitor, path22);
|
|
1737
1768
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
1738
|
-
replaceNode(key,
|
|
1739
|
-
return visit_(key, ctrl, visitor,
|
|
1769
|
+
replaceNode(key, path22, ctrl);
|
|
1770
|
+
return visit_(key, ctrl, visitor, path22);
|
|
1740
1771
|
}
|
|
1741
1772
|
if (typeof ctrl !== "symbol") {
|
|
1742
1773
|
if (isCollection(node)) {
|
|
1743
|
-
|
|
1774
|
+
path22 = Object.freeze(path22.concat(node));
|
|
1744
1775
|
for (let i = 0; i < node.items.length; ++i) {
|
|
1745
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
1776
|
+
const ci = visit_(i, node.items[i], visitor, path22);
|
|
1746
1777
|
if (typeof ci === "number")
|
|
1747
1778
|
i = ci - 1;
|
|
1748
1779
|
else if (ci === BREAK)
|
|
@@ -1753,13 +1784,13 @@ function visit_(key, node, visitor, path21) {
|
|
|
1753
1784
|
}
|
|
1754
1785
|
}
|
|
1755
1786
|
} else if (isPair(node)) {
|
|
1756
|
-
|
|
1757
|
-
const ck = visit_("key", node.key, visitor,
|
|
1787
|
+
path22 = Object.freeze(path22.concat(node));
|
|
1788
|
+
const ck = visit_("key", node.key, visitor, path22);
|
|
1758
1789
|
if (ck === BREAK)
|
|
1759
1790
|
return BREAK;
|
|
1760
1791
|
else if (ck === REMOVE)
|
|
1761
1792
|
node.key = null;
|
|
1762
|
-
const cv = visit_("value", node.value, visitor,
|
|
1793
|
+
const cv = visit_("value", node.value, visitor, path22);
|
|
1763
1794
|
if (cv === BREAK)
|
|
1764
1795
|
return BREAK;
|
|
1765
1796
|
else if (cv === REMOVE)
|
|
@@ -1777,17 +1808,17 @@ async function visitAsync(node, visitor) {
|
|
|
1777
1808
|
} else
|
|
1778
1809
|
await visitAsync_(null, node, visitor_, Object.freeze([]));
|
|
1779
1810
|
}
|
|
1780
|
-
async function visitAsync_(key, node, visitor,
|
|
1781
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
1811
|
+
async function visitAsync_(key, node, visitor, path22) {
|
|
1812
|
+
const ctrl = await callVisitor(key, node, visitor, path22);
|
|
1782
1813
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
1783
|
-
replaceNode(key,
|
|
1784
|
-
return visitAsync_(key, ctrl, visitor,
|
|
1814
|
+
replaceNode(key, path22, ctrl);
|
|
1815
|
+
return visitAsync_(key, ctrl, visitor, path22);
|
|
1785
1816
|
}
|
|
1786
1817
|
if (typeof ctrl !== "symbol") {
|
|
1787
1818
|
if (isCollection(node)) {
|
|
1788
|
-
|
|
1819
|
+
path22 = Object.freeze(path22.concat(node));
|
|
1789
1820
|
for (let i = 0; i < node.items.length; ++i) {
|
|
1790
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
1821
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path22);
|
|
1791
1822
|
if (typeof ci === "number")
|
|
1792
1823
|
i = ci - 1;
|
|
1793
1824
|
else if (ci === BREAK)
|
|
@@ -1798,13 +1829,13 @@ async function visitAsync_(key, node, visitor, path21) {
|
|
|
1798
1829
|
}
|
|
1799
1830
|
}
|
|
1800
1831
|
} else if (isPair(node)) {
|
|
1801
|
-
|
|
1802
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
1832
|
+
path22 = Object.freeze(path22.concat(node));
|
|
1833
|
+
const ck = await visitAsync_("key", node.key, visitor, path22);
|
|
1803
1834
|
if (ck === BREAK)
|
|
1804
1835
|
return BREAK;
|
|
1805
1836
|
else if (ck === REMOVE)
|
|
1806
1837
|
node.key = null;
|
|
1807
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
1838
|
+
const cv = await visitAsync_("value", node.value, visitor, path22);
|
|
1808
1839
|
if (cv === BREAK)
|
|
1809
1840
|
return BREAK;
|
|
1810
1841
|
else if (cv === REMOVE)
|
|
@@ -1831,23 +1862,23 @@ function initVisitor(visitor) {
|
|
|
1831
1862
|
}
|
|
1832
1863
|
return visitor;
|
|
1833
1864
|
}
|
|
1834
|
-
function callVisitor(key, node, visitor,
|
|
1865
|
+
function callVisitor(key, node, visitor, path22) {
|
|
1835
1866
|
if (typeof visitor === "function")
|
|
1836
|
-
return visitor(key, node,
|
|
1867
|
+
return visitor(key, node, path22);
|
|
1837
1868
|
if (isMap(node))
|
|
1838
|
-
return visitor.Map?.(key, node,
|
|
1869
|
+
return visitor.Map?.(key, node, path22);
|
|
1839
1870
|
if (isSeq(node))
|
|
1840
|
-
return visitor.Seq?.(key, node,
|
|
1871
|
+
return visitor.Seq?.(key, node, path22);
|
|
1841
1872
|
if (isPair(node))
|
|
1842
|
-
return visitor.Pair?.(key, node,
|
|
1873
|
+
return visitor.Pair?.(key, node, path22);
|
|
1843
1874
|
if (isScalar(node))
|
|
1844
|
-
return visitor.Scalar?.(key, node,
|
|
1875
|
+
return visitor.Scalar?.(key, node, path22);
|
|
1845
1876
|
if (isAlias(node))
|
|
1846
|
-
return visitor.Alias?.(key, node,
|
|
1877
|
+
return visitor.Alias?.(key, node, path22);
|
|
1847
1878
|
return void 0;
|
|
1848
1879
|
}
|
|
1849
|
-
function replaceNode(key,
|
|
1850
|
-
const parent =
|
|
1880
|
+
function replaceNode(key, path22, node) {
|
|
1881
|
+
const parent = path22[path22.length - 1];
|
|
1851
1882
|
if (isCollection(parent)) {
|
|
1852
1883
|
parent.items[key] = node;
|
|
1853
1884
|
} else if (isPair(parent)) {
|
|
@@ -2407,10 +2438,10 @@ var init_createNode = __esm({
|
|
|
2407
2438
|
});
|
|
2408
2439
|
|
|
2409
2440
|
// ../../node_modules/yaml/browser/dist/nodes/Collection.js
|
|
2410
|
-
function collectionFromPath(schema4,
|
|
2441
|
+
function collectionFromPath(schema4, path22, value) {
|
|
2411
2442
|
let v = value;
|
|
2412
|
-
for (let i =
|
|
2413
|
-
const k =
|
|
2443
|
+
for (let i = path22.length - 1; i >= 0; --i) {
|
|
2444
|
+
const k = path22[i];
|
|
2414
2445
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
2415
2446
|
const a = [];
|
|
2416
2447
|
a[k] = v;
|
|
@@ -2436,7 +2467,7 @@ var init_Collection = __esm({
|
|
|
2436
2467
|
init_createNode();
|
|
2437
2468
|
init_identity();
|
|
2438
2469
|
init_Node();
|
|
2439
|
-
isEmptyPath = (
|
|
2470
|
+
isEmptyPath = (path22) => path22 == null || typeof path22 === "object" && !!path22[Symbol.iterator]().next().done;
|
|
2440
2471
|
Collection = class extends NodeBase {
|
|
2441
2472
|
constructor(type, schema4) {
|
|
2442
2473
|
super(type);
|
|
@@ -2466,11 +2497,11 @@ var init_Collection = __esm({
|
|
|
2466
2497
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
2467
2498
|
* that already exists in the map.
|
|
2468
2499
|
*/
|
|
2469
|
-
addIn(
|
|
2470
|
-
if (isEmptyPath(
|
|
2500
|
+
addIn(path22, value) {
|
|
2501
|
+
if (isEmptyPath(path22))
|
|
2471
2502
|
this.add(value);
|
|
2472
2503
|
else {
|
|
2473
|
-
const [key, ...rest] =
|
|
2504
|
+
const [key, ...rest] = path22;
|
|
2474
2505
|
const node = this.get(key, true);
|
|
2475
2506
|
if (isCollection(node))
|
|
2476
2507
|
node.addIn(rest, value);
|
|
@@ -2484,8 +2515,8 @@ var init_Collection = __esm({
|
|
|
2484
2515
|
* Removes a value from the collection.
|
|
2485
2516
|
* @returns `true` if the item was found and removed.
|
|
2486
2517
|
*/
|
|
2487
|
-
deleteIn(
|
|
2488
|
-
const [key, ...rest] =
|
|
2518
|
+
deleteIn(path22) {
|
|
2519
|
+
const [key, ...rest] = path22;
|
|
2489
2520
|
if (rest.length === 0)
|
|
2490
2521
|
return this.delete(key);
|
|
2491
2522
|
const node = this.get(key, true);
|
|
@@ -2499,8 +2530,8 @@ var init_Collection = __esm({
|
|
|
2499
2530
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
2500
2531
|
* `true` (collections are always returned intact).
|
|
2501
2532
|
*/
|
|
2502
|
-
getIn(
|
|
2503
|
-
const [key, ...rest] =
|
|
2533
|
+
getIn(path22, keepScalar) {
|
|
2534
|
+
const [key, ...rest] = path22;
|
|
2504
2535
|
const node = this.get(key, true);
|
|
2505
2536
|
if (rest.length === 0)
|
|
2506
2537
|
return !keepScalar && isScalar(node) ? node.value : node;
|
|
@@ -2518,8 +2549,8 @@ var init_Collection = __esm({
|
|
|
2518
2549
|
/**
|
|
2519
2550
|
* Checks if the collection includes a value with the key `key`.
|
|
2520
2551
|
*/
|
|
2521
|
-
hasIn(
|
|
2522
|
-
const [key, ...rest] =
|
|
2552
|
+
hasIn(path22) {
|
|
2553
|
+
const [key, ...rest] = path22;
|
|
2523
2554
|
if (rest.length === 0)
|
|
2524
2555
|
return this.has(key);
|
|
2525
2556
|
const node = this.get(key, true);
|
|
@@ -2529,8 +2560,8 @@ var init_Collection = __esm({
|
|
|
2529
2560
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
2530
2561
|
* boolean to add/remove the item from the set.
|
|
2531
2562
|
*/
|
|
2532
|
-
setIn(
|
|
2533
|
-
const [key, ...rest] =
|
|
2563
|
+
setIn(path22, value) {
|
|
2564
|
+
const [key, ...rest] = path22;
|
|
2534
2565
|
if (rest.length === 0) {
|
|
2535
2566
|
this.set(key, value);
|
|
2536
2567
|
} else {
|
|
@@ -4503,15 +4534,15 @@ function visit2(cst, visitor) {
|
|
|
4503
4534
|
cst = { start: cst.start, value: cst.value };
|
|
4504
4535
|
_visit(Object.freeze([]), cst, visitor);
|
|
4505
4536
|
}
|
|
4506
|
-
function _visit(
|
|
4507
|
-
let ctrl = visitor(item,
|
|
4537
|
+
function _visit(path22, item, visitor) {
|
|
4538
|
+
let ctrl = visitor(item, path22);
|
|
4508
4539
|
if (typeof ctrl === "symbol")
|
|
4509
4540
|
return ctrl;
|
|
4510
4541
|
for (const field of ["key", "value"]) {
|
|
4511
4542
|
const token = item[field];
|
|
4512
4543
|
if (token && "items" in token) {
|
|
4513
4544
|
for (let i = 0; i < token.items.length; ++i) {
|
|
4514
|
-
const ci = _visit(Object.freeze(
|
|
4545
|
+
const ci = _visit(Object.freeze(path22.concat([[field, i]])), token.items[i], visitor);
|
|
4515
4546
|
if (typeof ci === "number")
|
|
4516
4547
|
i = ci - 1;
|
|
4517
4548
|
else if (ci === BREAK2)
|
|
@@ -4522,10 +4553,10 @@ function _visit(path21, item, visitor) {
|
|
|
4522
4553
|
}
|
|
4523
4554
|
}
|
|
4524
4555
|
if (typeof ctrl === "function" && field === "key")
|
|
4525
|
-
ctrl = ctrl(item,
|
|
4556
|
+
ctrl = ctrl(item, path22);
|
|
4526
4557
|
}
|
|
4527
4558
|
}
|
|
4528
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
4559
|
+
return typeof ctrl === "function" ? ctrl(item, path22) : ctrl;
|
|
4529
4560
|
}
|
|
4530
4561
|
var BREAK2, SKIP2, REMOVE2;
|
|
4531
4562
|
var init_cst_visit = __esm({
|
|
@@ -4537,9 +4568,9 @@ var init_cst_visit = __esm({
|
|
|
4537
4568
|
visit2.BREAK = BREAK2;
|
|
4538
4569
|
visit2.SKIP = SKIP2;
|
|
4539
4570
|
visit2.REMOVE = REMOVE2;
|
|
4540
|
-
visit2.itemAtPath = (cst,
|
|
4571
|
+
visit2.itemAtPath = (cst, path22) => {
|
|
4541
4572
|
let item = cst;
|
|
4542
|
-
for (const [field, index] of
|
|
4573
|
+
for (const [field, index] of path22) {
|
|
4543
4574
|
const tok = item?.[field];
|
|
4544
4575
|
if (tok && "items" in tok) {
|
|
4545
4576
|
item = tok.items[index];
|
|
@@ -4548,9 +4579,9 @@ var init_cst_visit = __esm({
|
|
|
4548
4579
|
}
|
|
4549
4580
|
return item;
|
|
4550
4581
|
};
|
|
4551
|
-
visit2.parentCollection = (cst,
|
|
4552
|
-
const parent = visit2.itemAtPath(cst,
|
|
4553
|
-
const field =
|
|
4582
|
+
visit2.parentCollection = (cst, path22) => {
|
|
4583
|
+
const parent = visit2.itemAtPath(cst, path22.slice(0, -1));
|
|
4584
|
+
const field = path22[path22.length - 1][0];
|
|
4554
4585
|
const coll = parent?.[field];
|
|
4555
4586
|
if (coll && "items" in coll)
|
|
4556
4587
|
return coll;
|
|
@@ -4720,8 +4751,8 @@ function metadataValue(value, key) {
|
|
|
4720
4751
|
if (!value || typeof value !== "object") return void 0;
|
|
4721
4752
|
return Object.getOwnPropertyDescriptor(value, key)?.value;
|
|
4722
4753
|
}
|
|
4723
|
-
function readProjectJson(
|
|
4724
|
-
const text2 = readProjectMetadata(
|
|
4754
|
+
function readProjectJson(path22, files = nodeRepoFileReader) {
|
|
4755
|
+
const text2 = readProjectMetadata(path22, files);
|
|
4725
4756
|
if (text2 === null) return null;
|
|
4726
4757
|
try {
|
|
4727
4758
|
const value = JSON.parse(text2);
|
|
@@ -4778,6 +4809,227 @@ var init_detect = __esm({
|
|
|
4778
4809
|
}
|
|
4779
4810
|
});
|
|
4780
4811
|
|
|
4812
|
+
// src/nativeViewSourceContract.ts
|
|
4813
|
+
function isNativeViewSource(value) {
|
|
4814
|
+
if (!isRecord(value)) return false;
|
|
4815
|
+
if (value.type === "placeholder")
|
|
4816
|
+
return (value.uri === void 0 || typeof value.uri === "string" && value.uri.length > 0) && (value.color === void 0 || typeof value.color === "string");
|
|
4817
|
+
if (value.type === "web") {
|
|
4818
|
+
if (typeof value.uri !== "string") return false;
|
|
4819
|
+
try {
|
|
4820
|
+
const url = new URL(value.uri);
|
|
4821
|
+
return url.protocol === "http:" || url.protocol === "https:";
|
|
4822
|
+
} catch {
|
|
4823
|
+
return false;
|
|
4824
|
+
}
|
|
4825
|
+
}
|
|
4826
|
+
return value.type === "video" && typeof value.uri === "string" && value.uri.length > 0 && ["paused", "loop", "muted"].every(
|
|
4827
|
+
(key) => value[key] === void 0 || typeof value[key] === "boolean"
|
|
4828
|
+
) && (value.currentTime === void 0 || typeof value.currentTime === "number" && Number.isFinite(value.currentTime) && value.currentTime >= 0) && (value.resizeMode === void 0 || value.resizeMode === "contain" || value.resizeMode === "cover" || value.resizeMode === "stretch");
|
|
4829
|
+
}
|
|
4830
|
+
var init_nativeViewSourceContract = __esm({
|
|
4831
|
+
"src/nativeViewSourceContract.ts"() {
|
|
4832
|
+
"use strict";
|
|
4833
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
4834
|
+
init_is_record();
|
|
4835
|
+
}
|
|
4836
|
+
});
|
|
4837
|
+
|
|
4838
|
+
// src/config.ts
|
|
4839
|
+
var config_exports = {};
|
|
4840
|
+
__export(config_exports, {
|
|
4841
|
+
PEACH_CONFIGURED_FILES_HOOK: () => PEACH_CONFIGURED_FILES_HOOK,
|
|
4842
|
+
PEACH_CONFIG_QUERY_PARAM: () => PEACH_CONFIG_QUERY_PARAM,
|
|
4843
|
+
applyPeachConfigToUrl: () => applyPeachConfigToUrl,
|
|
4844
|
+
collectConfiguredFileModules: () => collectConfiguredFileModules,
|
|
4845
|
+
createPeachBundleConfigFooter: () => createPeachBundleConfigFooter,
|
|
4846
|
+
defineConfig: () => defineConfig,
|
|
4847
|
+
detachPeachBundleConfigFooter: () => detachPeachBundleConfigFooter,
|
|
4848
|
+
hasPeachConfig: () => hasPeachConfig,
|
|
4849
|
+
isPackageStubs: () => isPackageStubs,
|
|
4850
|
+
isPeachConfig: () => isPeachConfig,
|
|
4851
|
+
mergePeachConfig: () => mergePeachConfig,
|
|
4852
|
+
readNativeRenderer: () => readNativeRenderer,
|
|
4853
|
+
readPeachBundleConfig: () => readPeachBundleConfig,
|
|
4854
|
+
readPeachBundleConfigFooter: () => readPeachBundleConfigFooter,
|
|
4855
|
+
readPeachConfigFromSearchParams: () => readPeachConfigFromSearchParams
|
|
4856
|
+
});
|
|
4857
|
+
function readNativeRenderer(value) {
|
|
4858
|
+
if (value === void 0) return void 0;
|
|
4859
|
+
if (value === "paper" || value === "fabric") return value;
|
|
4860
|
+
throw new Error("nativeRenderer must be paper or fabric");
|
|
4861
|
+
}
|
|
4862
|
+
function isHybridObjectAnswer(answer) {
|
|
4863
|
+
return answer === "unsupported" || isRecord(answer) && typeof answer.file === "string" && answer.file.length > 0;
|
|
4864
|
+
}
|
|
4865
|
+
function isHybridObjects(value) {
|
|
4866
|
+
return isRecord(value) && Object.entries(value).every(
|
|
4867
|
+
([name2, answer]) => name2.length > 0 && isHybridObjectAnswer(answer)
|
|
4868
|
+
);
|
|
4869
|
+
}
|
|
4870
|
+
function isPackageHybridObjects(value) {
|
|
4871
|
+
return isRecord(value) && Object.entries(value).every(
|
|
4872
|
+
([name2, answer]) => name2.length > 0 && typeof answer === "string" && answer.length > 0 && answer !== "noop"
|
|
4873
|
+
);
|
|
4874
|
+
}
|
|
4875
|
+
function isPackageStubs(value) {
|
|
4876
|
+
if (value === "noop") return true;
|
|
4877
|
+
if (!isRecord(value)) return false;
|
|
4878
|
+
return (value.modules === void 0 || isRecord(value.modules) && Object.values(value.modules).every(
|
|
4879
|
+
(stub) => typeof stub === "string" && stub.length > 0
|
|
4880
|
+
)) && (value.views === void 0 || isRecord(value.views) && Object.values(value.views).every(
|
|
4881
|
+
(stub) => typeof stub === "string" && stub.length > 0 || isNativeViewSource(stub)
|
|
4882
|
+
)) && (value.hybridObjects === void 0 || isPackageHybridObjects(value.hybridObjects));
|
|
4883
|
+
}
|
|
4884
|
+
function collectConfiguredFileModules(config) {
|
|
4885
|
+
return [
|
|
4886
|
+
...new Set(
|
|
4887
|
+
[
|
|
4888
|
+
"modules",
|
|
4889
|
+
"turboModules",
|
|
4890
|
+
"nativeModules",
|
|
4891
|
+
"nativeViews",
|
|
4892
|
+
"nativeHybridObjects"
|
|
4893
|
+
].flatMap((key) => {
|
|
4894
|
+
const entries = config && Reflect.get(config, key);
|
|
4895
|
+
if (!isRecord(entries)) return [];
|
|
4896
|
+
return Object.values(entries).flatMap(
|
|
4897
|
+
(entry) => isRecord(entry) && typeof entry.file === "string" ? [entry.file] : []
|
|
4898
|
+
);
|
|
4899
|
+
})
|
|
4900
|
+
)
|
|
4901
|
+
];
|
|
4902
|
+
}
|
|
4903
|
+
function isPeachConfig(value) {
|
|
4904
|
+
if (!isRecord(value)) return false;
|
|
4905
|
+
return (value.nativeRenderer === void 0 || value.nativeRenderer === "paper" || value.nativeRenderer === "fabric") && (value.mapKit === void 0 || isRecord(value.mapKit) && typeof value.mapKit.token === "string" && value.mapKit.token.length > 0 && value.mapKit.token === value.mapKit.token.trim()) && (value.runtimeVersion === void 0 || typeof value.runtimeVersion === "string" && value.runtimeVersion === value.runtimeVersion.trim() && isValidRuntimeVersion(value.runtimeVersion)) && [
|
|
4906
|
+
"modules",
|
|
4907
|
+
"packages",
|
|
4908
|
+
"turboModules",
|
|
4909
|
+
"nativeModules",
|
|
4910
|
+
"nativeViews",
|
|
4911
|
+
"nativeHybridObjects",
|
|
4912
|
+
"env",
|
|
4913
|
+
"network",
|
|
4914
|
+
"settings",
|
|
4915
|
+
"initialProps",
|
|
4916
|
+
"initialState"
|
|
4917
|
+
].every((key) => value[key] === void 0 || isRecord(value[key])) && (value.packages === void 0 || isRecord(value.packages) && Object.values(value.packages).every(isPackageStubs)) && (value.nativeHybridObjects === void 0 || isHybridObjects(value.nativeHybridObjects)) && (value.nativeViews === void 0 || isRecord(value.nativeViews) && Object.values(value.nativeViews).every(
|
|
4918
|
+
(entry) => entry === "noop" || isNativeViewSource(entry) || isRecord(entry) && typeof entry.file === "string" && entry.file.length > 0
|
|
4919
|
+
));
|
|
4920
|
+
}
|
|
4921
|
+
function readPeachBundleConfig(value) {
|
|
4922
|
+
if (value === void 0 || value === null) return null;
|
|
4923
|
+
if (!isRecord(value) || !isPeachConfig(value.config) || !Array.isArray(value.runtimePackages) || !value.runtimePackages.every((name2) => typeof name2 === "string")) {
|
|
4924
|
+
throw new Error("configured bundle metadata is malformed");
|
|
4925
|
+
}
|
|
4926
|
+
return { config: value.config, runtimePackages: [...value.runtimePackages] };
|
|
4927
|
+
}
|
|
4928
|
+
function readPeachBundleConfigFooter(source) {
|
|
4929
|
+
const start = findBundleFooter(source, BUNDLE_CONFIG_PREFIX);
|
|
4930
|
+
if (start < 0) return null;
|
|
4931
|
+
const end = source.indexOf("\n", start + 1);
|
|
4932
|
+
const line = source.slice(start + 1, end < 0 ? void 0 : end);
|
|
4933
|
+
if (!line.endsWith(";")) throw new Error("configured bundle footer is truncated");
|
|
4934
|
+
const result = readPeachBundleConfig(
|
|
4935
|
+
JSON.parse(line.slice(BUNDLE_CONFIG_PREFIX.length, -1))
|
|
4936
|
+
);
|
|
4937
|
+
if (!result) throw new Error("configured bundle footer is empty");
|
|
4938
|
+
return result;
|
|
4939
|
+
}
|
|
4940
|
+
function createPeachBundleConfigFooter(config) {
|
|
4941
|
+
const json = JSON.stringify(config).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029").replace(/<\//g, "<\\/");
|
|
4942
|
+
return "\n" + BUNDLE_CONFIG_PREFIX + json + ";";
|
|
4943
|
+
}
|
|
4944
|
+
function detachPeachBundleConfigFooter(source) {
|
|
4945
|
+
const configuredBundle = readPeachBundleConfigFooter(source);
|
|
4946
|
+
if (!configuredBundle) return { source, configuredBundle };
|
|
4947
|
+
const start = findBundleFooter(source, BUNDLE_CONFIG_PREFIX);
|
|
4948
|
+
const end = source.indexOf("\n", start + 1);
|
|
4949
|
+
return {
|
|
4950
|
+
source: source.slice(0, start) + source.slice(end < 0 ? source.length : end),
|
|
4951
|
+
configuredBundle
|
|
4952
|
+
};
|
|
4953
|
+
}
|
|
4954
|
+
function defineConfig(config) {
|
|
4955
|
+
return config;
|
|
4956
|
+
}
|
|
4957
|
+
function hasOwnKeys(value) {
|
|
4958
|
+
return !!value && Object.keys(value).length > 0;
|
|
4959
|
+
}
|
|
4960
|
+
function hasPeachConfig(config) {
|
|
4961
|
+
if (!config) return false;
|
|
4962
|
+
return config.nativeRenderer !== void 0 || config.mapKit !== void 0 || typeof config.runtimeVersion === "string" && config.runtimeVersion.length > 0 || hasOwnKeys(config.modules) || hasOwnKeys(config.turboModules) || hasOwnKeys(config.nativeModules) || hasOwnKeys(config.nativeViews) || hasOwnKeys(config.nativeHybridObjects) || hasOwnKeys(config.env) || hasOwnKeys(config.network?.remap) || hasOwnKeys(config.settings) || hasOwnKeys(config.initialProps) || hasOwnKeys(config.initialState);
|
|
4963
|
+
}
|
|
4964
|
+
function mergePeachConfig(base, override) {
|
|
4965
|
+
if (!hasPeachConfig(base) && !hasPeachConfig(override)) return void 0;
|
|
4966
|
+
if (!hasPeachConfig(base)) return override ? { ...override } : void 0;
|
|
4967
|
+
if (!hasPeachConfig(override)) return base ? { ...base } : void 0;
|
|
4968
|
+
return {
|
|
4969
|
+
runtimeVersion: override.runtimeVersion ?? base.runtimeVersion,
|
|
4970
|
+
nativeRenderer: override.nativeRenderer ?? base.nativeRenderer,
|
|
4971
|
+
mapKit: override.mapKit ?? base.mapKit,
|
|
4972
|
+
modules: { ...base.modules || {}, ...override.modules || {} },
|
|
4973
|
+
turboModules: { ...base.turboModules || {}, ...override.turboModules || {} },
|
|
4974
|
+
nativeModules: {
|
|
4975
|
+
...base.nativeModules || {},
|
|
4976
|
+
...override.nativeModules || {}
|
|
4977
|
+
},
|
|
4978
|
+
nativeViews: { ...base.nativeViews || {}, ...override.nativeViews || {} },
|
|
4979
|
+
nativeHybridObjects: {
|
|
4980
|
+
...base.nativeHybridObjects || {},
|
|
4981
|
+
...override.nativeHybridObjects || {}
|
|
4982
|
+
},
|
|
4983
|
+
env: { ...base.env || {}, ...override.env || {} },
|
|
4984
|
+
network: {
|
|
4985
|
+
remap: { ...base.network?.remap || {}, ...override.network?.remap || {} }
|
|
4986
|
+
},
|
|
4987
|
+
settings: {
|
|
4988
|
+
...base.settings || {},
|
|
4989
|
+
...override.settings || {}
|
|
4990
|
+
},
|
|
4991
|
+
initialProps: { ...base.initialProps || {}, ...override.initialProps || {} },
|
|
4992
|
+
initialState: { ...base.initialState || {}, ...override.initialState || {} }
|
|
4993
|
+
};
|
|
4994
|
+
}
|
|
4995
|
+
function readPeachConfigFromSearchParams(searchParams) {
|
|
4996
|
+
const raw = searchParams.get(PEACH_CONFIG_QUERY_PARAM);
|
|
4997
|
+
if (!raw) return void 0;
|
|
4998
|
+
let parsed;
|
|
4999
|
+
try {
|
|
5000
|
+
parsed = JSON.parse(raw);
|
|
5001
|
+
} catch (error) {
|
|
5002
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
5003
|
+
console.warn(`[peach] invalid ${PEACH_CONFIG_QUERY_PARAM}: ${message}`);
|
|
5004
|
+
return void 0;
|
|
5005
|
+
}
|
|
5006
|
+
if (isRecord(parsed)) readNativeRenderer(parsed.nativeRenderer);
|
|
5007
|
+
return isPeachConfig(parsed) && hasPeachConfig(parsed) ? parsed : void 0;
|
|
5008
|
+
}
|
|
5009
|
+
function applyPeachConfigToUrl(url, config) {
|
|
5010
|
+
const parsed = new URL(url);
|
|
5011
|
+
if (hasPeachConfig(config)) {
|
|
5012
|
+
parsed.searchParams.set(PEACH_CONFIG_QUERY_PARAM, JSON.stringify(config));
|
|
5013
|
+
} else {
|
|
5014
|
+
parsed.searchParams.delete(PEACH_CONFIG_QUERY_PARAM);
|
|
5015
|
+
}
|
|
5016
|
+
return parsed.toString();
|
|
5017
|
+
}
|
|
5018
|
+
var PEACH_CONFIG_QUERY_PARAM, BUNDLE_CONFIG_PREFIX, PEACH_CONFIGURED_FILES_HOOK;
|
|
5019
|
+
var init_config = __esm({
|
|
5020
|
+
"src/config.ts"() {
|
|
5021
|
+
"use strict";
|
|
5022
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
5023
|
+
init_version();
|
|
5024
|
+
init_bundleGlobalFooter();
|
|
5025
|
+
init_is_record();
|
|
5026
|
+
init_nativeViewSourceContract();
|
|
5027
|
+
PEACH_CONFIG_QUERY_PARAM = "peachConfig";
|
|
5028
|
+
BUNDLE_CONFIG_PREFIX = "globalThis.__peachBundleConfig=";
|
|
5029
|
+
PEACH_CONFIGURED_FILES_HOOK = "__peachInstallConfiguredFiles";
|
|
5030
|
+
}
|
|
5031
|
+
});
|
|
5032
|
+
|
|
4781
5033
|
// ../contrast-bundler/src/posixPath.ts
|
|
4782
5034
|
function isAbsolute(p) {
|
|
4783
5035
|
return p.charCodeAt(0) === 47;
|
|
@@ -4808,12 +5060,12 @@ function normalize(p) {
|
|
|
4808
5060
|
if (trailingSlash) joined += "/";
|
|
4809
5061
|
return absolute ? "/" + joined : joined;
|
|
4810
5062
|
}
|
|
4811
|
-
function
|
|
5063
|
+
function join5(...parts) {
|
|
4812
5064
|
const present = parts.filter((part) => part.length > 0);
|
|
4813
5065
|
if (present.length === 0) return ".";
|
|
4814
5066
|
return normalize(present.join("/"));
|
|
4815
5067
|
}
|
|
4816
|
-
function
|
|
5068
|
+
function resolve3(...parts) {
|
|
4817
5069
|
let resolved = "";
|
|
4818
5070
|
let absolute = false;
|
|
4819
5071
|
for (let i = parts.length - 1; i >= 0 && !absolute; i--) {
|
|
@@ -4872,8 +5124,8 @@ var init_posixPath = __esm({
|
|
|
4872
5124
|
delimiter,
|
|
4873
5125
|
isAbsolute,
|
|
4874
5126
|
normalize,
|
|
4875
|
-
join:
|
|
4876
|
-
resolve:
|
|
5127
|
+
join: join5,
|
|
5128
|
+
resolve: resolve3,
|
|
4877
5129
|
dirname: dirname4,
|
|
4878
5130
|
basename: basename3,
|
|
4879
5131
|
extname,
|
|
@@ -5115,16 +5367,16 @@ function sendJavaScript(req, res, source) {
|
|
|
5115
5367
|
res.end(req.method === "HEAD" ? void 0 : source);
|
|
5116
5368
|
}
|
|
5117
5369
|
function resolveReplacementModuleFile(fromFile, specifier) {
|
|
5118
|
-
const base =
|
|
5370
|
+
const base = import_node_path9.default.resolve(import_node_path9.default.dirname(fromFile), specifier);
|
|
5119
5371
|
const candidates = [
|
|
5120
5372
|
...REPLACEMENT_MODULE_EXTENSIONS.some(
|
|
5121
|
-
(ext) => ext ===
|
|
5373
|
+
(ext) => ext === import_node_path9.default.extname(base).toLowerCase()
|
|
5122
5374
|
) ? [base] : [],
|
|
5123
5375
|
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => base + ext),
|
|
5124
|
-
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) =>
|
|
5376
|
+
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => import_node_path9.default.join(base, `index${ext}`))
|
|
5125
5377
|
];
|
|
5126
5378
|
const found = candidates.find(
|
|
5127
|
-
(candidate) => (0,
|
|
5379
|
+
(candidate) => (0, import_node_fs10.statSync)(candidate, { throwIfNoEntry: false })?.isFile()
|
|
5128
5380
|
);
|
|
5129
5381
|
if (!found) {
|
|
5130
5382
|
throw new Error(
|
|
@@ -5135,8 +5387,8 @@ function resolveReplacementModuleFile(fromFile, specifier) {
|
|
|
5135
5387
|
}
|
|
5136
5388
|
function isInsideAny(roots, file) {
|
|
5137
5389
|
return roots.some((root) => {
|
|
5138
|
-
const relative3 =
|
|
5139
|
-
return !relative3.startsWith("..") && !
|
|
5390
|
+
const relative3 = import_node_path9.default.relative(root, file);
|
|
5391
|
+
return !relative3.startsWith("..") && !import_node_path9.default.isAbsolute(relative3);
|
|
5140
5392
|
});
|
|
5141
5393
|
}
|
|
5142
5394
|
function isReplacementModuleRequestUrl(rawUrl) {
|
|
@@ -5185,19 +5437,19 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
5185
5437
|
res.end("missing path param");
|
|
5186
5438
|
return true;
|
|
5187
5439
|
}
|
|
5188
|
-
const extension =
|
|
5440
|
+
const extension = import_node_path9.default.extname(targetPath).toLowerCase();
|
|
5189
5441
|
if (!REPLACEMENT_MODULE_EXTENSIONS.some((allowed) => allowed === extension)) {
|
|
5190
5442
|
res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
|
|
5191
5443
|
res.end(`replacement files must be ${REPLACEMENT_MODULE_EXTENSIONS.join(", ")}`);
|
|
5192
5444
|
return true;
|
|
5193
5445
|
}
|
|
5194
|
-
if (!
|
|
5446
|
+
if (!import_node_path9.default.isAbsolute(targetPath)) {
|
|
5195
5447
|
res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
|
|
5196
5448
|
res.end("replacement file path must be absolute");
|
|
5197
5449
|
return true;
|
|
5198
5450
|
}
|
|
5199
5451
|
const runtimePackages = new Set(url.searchParams.getAll("runtimePackage"));
|
|
5200
|
-
const servedRoots = options.servedRoots?.map((root) =>
|
|
5452
|
+
const servedRoots = options.servedRoots?.map((root) => import_node_path9.default.resolve(root));
|
|
5201
5453
|
if (servedRoots && !isInsideAny(servedRoots, targetPath)) {
|
|
5202
5454
|
res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
|
|
5203
5455
|
res.end("replacement file must be inside a folder the bundler serves");
|
|
@@ -5205,7 +5457,7 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
5205
5457
|
}
|
|
5206
5458
|
let resolvedTargetPath;
|
|
5207
5459
|
try {
|
|
5208
|
-
resolvedTargetPath = await
|
|
5460
|
+
resolvedTargetPath = await import_promises4.default.realpath(targetPath);
|
|
5209
5461
|
} catch (error) {
|
|
5210
5462
|
const message = error instanceof Error ? error.message : String(error);
|
|
5211
5463
|
res.writeHead(404, { "Content-Type": "text/plain; charset=utf-8" });
|
|
@@ -5213,7 +5465,7 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
5213
5465
|
return true;
|
|
5214
5466
|
}
|
|
5215
5467
|
if (servedRoots) {
|
|
5216
|
-
const realRoots = (await Promise.all(servedRoots.map((root) =>
|
|
5468
|
+
const realRoots = (await Promise.all(servedRoots.map((root) => import_promises4.default.realpath(root).catch(() => null)))).filter((root) => root !== null);
|
|
5217
5469
|
if (!isInsideAny(realRoots, resolvedTargetPath)) {
|
|
5218
5470
|
res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
|
|
5219
5471
|
res.end("replacement file must be inside a folder the bundler serves");
|
|
@@ -5223,7 +5475,7 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
5223
5475
|
try {
|
|
5224
5476
|
const compiled = compileReplacementModule({
|
|
5225
5477
|
filePath: resolvedTargetPath,
|
|
5226
|
-
source: await
|
|
5478
|
+
source: await import_promises4.default.readFile(resolvedTargetPath, "utf8"),
|
|
5227
5479
|
runtimePackages,
|
|
5228
5480
|
// the imported file's url is this request's with only its path changed,
|
|
5229
5481
|
// so the token, cache key and runtime packages carry over.
|
|
@@ -5249,14 +5501,14 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
5249
5501
|
}
|
|
5250
5502
|
return true;
|
|
5251
5503
|
}
|
|
5252
|
-
var
|
|
5504
|
+
var import_node_fs10, import_promises4, import_node_path9, REPLACEMENT_MODULE_ROUTE;
|
|
5253
5505
|
var init_replacement_module_handler = __esm({
|
|
5254
5506
|
"src/host/replacement-module-handler.ts"() {
|
|
5255
5507
|
"use strict";
|
|
5256
5508
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5509
|
+
import_node_fs10 = require("node:fs");
|
|
5510
|
+
import_promises4 = __toESM(require("node:fs/promises"), 1);
|
|
5511
|
+
import_node_path9 = __toESM(require("node:path"), 1);
|
|
5260
5512
|
init_replacementModule();
|
|
5261
5513
|
init_backend_origin();
|
|
5262
5514
|
REPLACEMENT_MODULE_ROUTE = "/__sootsim-replacement-module";
|
|
@@ -5264,26 +5516,20 @@ var init_replacement_module_handler = __esm({
|
|
|
5264
5516
|
});
|
|
5265
5517
|
|
|
5266
5518
|
// src/swift-source-file.ts
|
|
5267
|
-
function
|
|
5268
|
-
const
|
|
5269
|
-
const relative3 =
|
|
5270
|
-
if (relative3 === ".." || relative3.startsWith(`..${
|
|
5519
|
+
function packageInputPath(canonicalRoot, file) {
|
|
5520
|
+
const canonicalFile = import_node_fs11.default.realpathSync(file);
|
|
5521
|
+
const relative3 = import_node_path10.default.relative(canonicalRoot, canonicalFile);
|
|
5522
|
+
if (relative3 === ".." || relative3.startsWith(`..${import_node_path10.default.sep}`) || import_node_path10.default.isAbsolute(relative3)) {
|
|
5271
5523
|
throw new Error(`swift input escapes the selected package: ${file}`);
|
|
5272
5524
|
}
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
if (parent === ancestor)
|
|
5280
|
-
throw new Error(`swift input escapes the selected package: ${file}`);
|
|
5281
|
-
ancestor = parent;
|
|
5282
|
-
}
|
|
5283
|
-
const expected = import_node_fs10.default.statSync(file);
|
|
5284
|
-
const fd = import_node_fs10.default.openSync(file, import_node_fs10.default.constants.O_RDONLY | import_node_fs10.default.constants.O_NOFOLLOW);
|
|
5525
|
+
return canonicalFile;
|
|
5526
|
+
}
|
|
5527
|
+
function readPackageFile(root, file, maxBytes) {
|
|
5528
|
+
const canonicalFile = packageInputPath(import_node_fs11.default.realpathSync(root), file);
|
|
5529
|
+
const expected = import_node_fs11.default.statSync(canonicalFile);
|
|
5530
|
+
const fd = import_node_fs11.default.openSync(canonicalFile, import_node_fs11.default.constants.O_RDONLY | import_node_fs11.default.constants.O_NOFOLLOW);
|
|
5285
5531
|
try {
|
|
5286
|
-
const stat =
|
|
5532
|
+
const stat = import_node_fs11.default.fstatSync(fd);
|
|
5287
5533
|
if (stat.dev !== expected.dev || stat.ino !== expected.ino) {
|
|
5288
5534
|
throw new Error(`swift input changed while opening: ${file}`);
|
|
5289
5535
|
}
|
|
@@ -5293,25 +5539,25 @@ function readPackageFile(root, file, maxBytes) {
|
|
|
5293
5539
|
const bytes = Buffer.alloc(stat.size + 1);
|
|
5294
5540
|
let offset = 0;
|
|
5295
5541
|
while (offset < bytes.length) {
|
|
5296
|
-
const count =
|
|
5542
|
+
const count = import_node_fs11.default.readSync(fd, bytes, offset, bytes.length - offset, null);
|
|
5297
5543
|
if (count === 0) break;
|
|
5298
5544
|
offset += count;
|
|
5299
5545
|
}
|
|
5300
|
-
if (offset !== stat.size ||
|
|
5546
|
+
if (offset !== stat.size || import_node_fs11.default.fstatSync(fd).size !== stat.size) {
|
|
5301
5547
|
throw new Error(`swift input changed while reading: ${file}`);
|
|
5302
5548
|
}
|
|
5303
5549
|
return bytes.subarray(0, offset);
|
|
5304
5550
|
} finally {
|
|
5305
|
-
|
|
5551
|
+
import_node_fs11.default.closeSync(fd);
|
|
5306
5552
|
}
|
|
5307
5553
|
}
|
|
5308
|
-
var
|
|
5554
|
+
var import_node_fs11, import_node_path10;
|
|
5309
5555
|
var init_swift_source_file = __esm({
|
|
5310
5556
|
"src/swift-source-file.ts"() {
|
|
5311
5557
|
"use strict";
|
|
5312
5558
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
5313
|
-
|
|
5314
|
-
|
|
5559
|
+
import_node_fs11 = __toESM(require("node:fs"), 1);
|
|
5560
|
+
import_node_path10 = __toESM(require("node:path"), 1);
|
|
5315
5561
|
}
|
|
5316
5562
|
});
|
|
5317
5563
|
|
|
@@ -5357,9 +5603,9 @@ var init_swift_submit = __esm({
|
|
|
5357
5603
|
// cli/app-project.ts
|
|
5358
5604
|
function firstNamedFile(dir, names) {
|
|
5359
5605
|
for (const name2 of names) {
|
|
5360
|
-
const candidate =
|
|
5606
|
+
const candidate = import_node_path12.default.join(dir, name2);
|
|
5361
5607
|
try {
|
|
5362
|
-
if (
|
|
5608
|
+
if (import_node_fs13.default.statSync(candidate).isFile()) return candidate;
|
|
5363
5609
|
} catch {
|
|
5364
5610
|
}
|
|
5365
5611
|
}
|
|
@@ -5372,25 +5618,25 @@ function findRNXAppConfig(dir) {
|
|
|
5372
5618
|
return firstNamedFile(dir, PEACH_APP_CONFIG_NAMES);
|
|
5373
5619
|
}
|
|
5374
5620
|
function resolveAppProject(projectRoot) {
|
|
5375
|
-
const appDir =
|
|
5621
|
+
const appDir = import_node_path12.default.resolve(projectRoot);
|
|
5376
5622
|
try {
|
|
5377
|
-
if (!
|
|
5623
|
+
if (!import_node_fs13.default.statSync(appDir).isDirectory()) return null;
|
|
5378
5624
|
} catch {
|
|
5379
5625
|
return null;
|
|
5380
5626
|
}
|
|
5381
5627
|
const configPath = findRNXAppConfig(appDir);
|
|
5382
|
-
if (!configPath && !findExpoAppConfig(appDir) && !
|
|
5628
|
+
if (!configPath && !findExpoAppConfig(appDir) && !import_node_fs13.default.existsSync(import_node_path12.default.join(appDir, "package.json"))) {
|
|
5383
5629
|
return null;
|
|
5384
5630
|
}
|
|
5385
5631
|
return { appDir, configPath };
|
|
5386
5632
|
}
|
|
5387
|
-
var
|
|
5633
|
+
var import_node_fs13, import_node_path12, EXPO_APP_CONFIG_NAMES, PEACH_APP_CONFIG_NAMES;
|
|
5388
5634
|
var init_app_project = __esm({
|
|
5389
5635
|
"cli/app-project.ts"() {
|
|
5390
5636
|
"use strict";
|
|
5391
5637
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
5392
|
-
|
|
5393
|
-
|
|
5638
|
+
import_node_fs13 = __toESM(require("node:fs"), 1);
|
|
5639
|
+
import_node_path12 = __toESM(require("node:path"), 1);
|
|
5394
5640
|
EXPO_APP_CONFIG_NAMES = [
|
|
5395
5641
|
"app.config.js",
|
|
5396
5642
|
"app.config.ts",
|
|
@@ -5407,227 +5653,6 @@ var init_app_project = __esm({
|
|
|
5407
5653
|
}
|
|
5408
5654
|
});
|
|
5409
5655
|
|
|
5410
|
-
// src/nativeViewSourceContract.ts
|
|
5411
|
-
function isNativeViewSource(value) {
|
|
5412
|
-
if (!isRecord(value)) return false;
|
|
5413
|
-
if (value.type === "placeholder")
|
|
5414
|
-
return (value.uri === void 0 || typeof value.uri === "string" && value.uri.length > 0) && (value.color === void 0 || typeof value.color === "string");
|
|
5415
|
-
if (value.type === "web") {
|
|
5416
|
-
if (typeof value.uri !== "string") return false;
|
|
5417
|
-
try {
|
|
5418
|
-
const url = new URL(value.uri);
|
|
5419
|
-
return url.protocol === "http:" || url.protocol === "https:";
|
|
5420
|
-
} catch {
|
|
5421
|
-
return false;
|
|
5422
|
-
}
|
|
5423
|
-
}
|
|
5424
|
-
return value.type === "video" && typeof value.uri === "string" && value.uri.length > 0 && ["paused", "loop", "muted"].every(
|
|
5425
|
-
(key) => value[key] === void 0 || typeof value[key] === "boolean"
|
|
5426
|
-
) && (value.currentTime === void 0 || typeof value.currentTime === "number" && Number.isFinite(value.currentTime) && value.currentTime >= 0) && (value.resizeMode === void 0 || value.resizeMode === "contain" || value.resizeMode === "cover" || value.resizeMode === "stretch");
|
|
5427
|
-
}
|
|
5428
|
-
var init_nativeViewSourceContract = __esm({
|
|
5429
|
-
"src/nativeViewSourceContract.ts"() {
|
|
5430
|
-
"use strict";
|
|
5431
|
-
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
5432
|
-
init_is_record();
|
|
5433
|
-
}
|
|
5434
|
-
});
|
|
5435
|
-
|
|
5436
|
-
// src/config.ts
|
|
5437
|
-
var config_exports = {};
|
|
5438
|
-
__export(config_exports, {
|
|
5439
|
-
PEACH_CONFIGURED_FILES_HOOK: () => PEACH_CONFIGURED_FILES_HOOK,
|
|
5440
|
-
PEACH_CONFIG_QUERY_PARAM: () => PEACH_CONFIG_QUERY_PARAM,
|
|
5441
|
-
applyPeachConfigToUrl: () => applyPeachConfigToUrl,
|
|
5442
|
-
collectConfiguredFileModules: () => collectConfiguredFileModules,
|
|
5443
|
-
createPeachBundleConfigFooter: () => createPeachBundleConfigFooter,
|
|
5444
|
-
defineConfig: () => defineConfig,
|
|
5445
|
-
detachPeachBundleConfigFooter: () => detachPeachBundleConfigFooter,
|
|
5446
|
-
hasPeachConfig: () => hasPeachConfig,
|
|
5447
|
-
isPackageStubs: () => isPackageStubs,
|
|
5448
|
-
isPeachConfig: () => isPeachConfig,
|
|
5449
|
-
mergePeachConfig: () => mergePeachConfig,
|
|
5450
|
-
readNativeRenderer: () => readNativeRenderer,
|
|
5451
|
-
readPeachBundleConfig: () => readPeachBundleConfig,
|
|
5452
|
-
readPeachBundleConfigFooter: () => readPeachBundleConfigFooter,
|
|
5453
|
-
readPeachConfigFromSearchParams: () => readPeachConfigFromSearchParams
|
|
5454
|
-
});
|
|
5455
|
-
function readNativeRenderer(value) {
|
|
5456
|
-
if (value === void 0) return void 0;
|
|
5457
|
-
if (value === "paper" || value === "fabric") return value;
|
|
5458
|
-
throw new Error("nativeRenderer must be paper or fabric");
|
|
5459
|
-
}
|
|
5460
|
-
function isHybridObjectAnswer(answer) {
|
|
5461
|
-
return answer === "unsupported" || isRecord(answer) && typeof answer.file === "string" && answer.file.length > 0;
|
|
5462
|
-
}
|
|
5463
|
-
function isHybridObjects(value) {
|
|
5464
|
-
return isRecord(value) && Object.entries(value).every(
|
|
5465
|
-
([name2, answer]) => name2.length > 0 && isHybridObjectAnswer(answer)
|
|
5466
|
-
);
|
|
5467
|
-
}
|
|
5468
|
-
function isPackageHybridObjects(value) {
|
|
5469
|
-
return isRecord(value) && Object.entries(value).every(
|
|
5470
|
-
([name2, answer]) => name2.length > 0 && typeof answer === "string" && answer.length > 0 && answer !== "noop"
|
|
5471
|
-
);
|
|
5472
|
-
}
|
|
5473
|
-
function isPackageStubs(value) {
|
|
5474
|
-
if (value === "noop") return true;
|
|
5475
|
-
if (!isRecord(value)) return false;
|
|
5476
|
-
return (value.modules === void 0 || isRecord(value.modules) && Object.values(value.modules).every(
|
|
5477
|
-
(stub) => typeof stub === "string" && stub.length > 0
|
|
5478
|
-
)) && (value.views === void 0 || isRecord(value.views) && Object.values(value.views).every(
|
|
5479
|
-
(stub) => typeof stub === "string" && stub.length > 0 || isNativeViewSource(stub)
|
|
5480
|
-
)) && (value.hybridObjects === void 0 || isPackageHybridObjects(value.hybridObjects));
|
|
5481
|
-
}
|
|
5482
|
-
function collectConfiguredFileModules(config) {
|
|
5483
|
-
return [
|
|
5484
|
-
...new Set(
|
|
5485
|
-
[
|
|
5486
|
-
"modules",
|
|
5487
|
-
"turboModules",
|
|
5488
|
-
"nativeModules",
|
|
5489
|
-
"nativeViews",
|
|
5490
|
-
"nativeHybridObjects"
|
|
5491
|
-
].flatMap((key) => {
|
|
5492
|
-
const entries = config && Reflect.get(config, key);
|
|
5493
|
-
if (!isRecord(entries)) return [];
|
|
5494
|
-
return Object.values(entries).flatMap(
|
|
5495
|
-
(entry) => isRecord(entry) && typeof entry.file === "string" ? [entry.file] : []
|
|
5496
|
-
);
|
|
5497
|
-
})
|
|
5498
|
-
)
|
|
5499
|
-
];
|
|
5500
|
-
}
|
|
5501
|
-
function isPeachConfig(value) {
|
|
5502
|
-
if (!isRecord(value)) return false;
|
|
5503
|
-
return (value.nativeRenderer === void 0 || value.nativeRenderer === "paper" || value.nativeRenderer === "fabric") && (value.mapKit === void 0 || isRecord(value.mapKit) && typeof value.mapKit.token === "string" && value.mapKit.token.length > 0 && value.mapKit.token === value.mapKit.token.trim()) && (value.runtimeVersion === void 0 || typeof value.runtimeVersion === "string" && value.runtimeVersion === value.runtimeVersion.trim() && isValidRuntimeVersion(value.runtimeVersion)) && [
|
|
5504
|
-
"modules",
|
|
5505
|
-
"packages",
|
|
5506
|
-
"turboModules",
|
|
5507
|
-
"nativeModules",
|
|
5508
|
-
"nativeViews",
|
|
5509
|
-
"nativeHybridObjects",
|
|
5510
|
-
"env",
|
|
5511
|
-
"network",
|
|
5512
|
-
"settings",
|
|
5513
|
-
"initialProps",
|
|
5514
|
-
"initialState"
|
|
5515
|
-
].every((key) => value[key] === void 0 || isRecord(value[key])) && (value.packages === void 0 || isRecord(value.packages) && Object.values(value.packages).every(isPackageStubs)) && (value.nativeHybridObjects === void 0 || isHybridObjects(value.nativeHybridObjects)) && (value.nativeViews === void 0 || isRecord(value.nativeViews) && Object.values(value.nativeViews).every(
|
|
5516
|
-
(entry) => entry === "noop" || isNativeViewSource(entry) || isRecord(entry) && typeof entry.file === "string" && entry.file.length > 0
|
|
5517
|
-
));
|
|
5518
|
-
}
|
|
5519
|
-
function readPeachBundleConfig(value) {
|
|
5520
|
-
if (value === void 0 || value === null) return null;
|
|
5521
|
-
if (!isRecord(value) || !isPeachConfig(value.config) || !Array.isArray(value.runtimePackages) || !value.runtimePackages.every((name2) => typeof name2 === "string")) {
|
|
5522
|
-
throw new Error("configured bundle metadata is malformed");
|
|
5523
|
-
}
|
|
5524
|
-
return { config: value.config, runtimePackages: [...value.runtimePackages] };
|
|
5525
|
-
}
|
|
5526
|
-
function readPeachBundleConfigFooter(source) {
|
|
5527
|
-
const start = findBundleFooter(source, BUNDLE_CONFIG_PREFIX);
|
|
5528
|
-
if (start < 0) return null;
|
|
5529
|
-
const end = source.indexOf("\n", start + 1);
|
|
5530
|
-
const line = source.slice(start + 1, end < 0 ? void 0 : end);
|
|
5531
|
-
if (!line.endsWith(";")) throw new Error("configured bundle footer is truncated");
|
|
5532
|
-
const result = readPeachBundleConfig(
|
|
5533
|
-
JSON.parse(line.slice(BUNDLE_CONFIG_PREFIX.length, -1))
|
|
5534
|
-
);
|
|
5535
|
-
if (!result) throw new Error("configured bundle footer is empty");
|
|
5536
|
-
return result;
|
|
5537
|
-
}
|
|
5538
|
-
function createPeachBundleConfigFooter(config) {
|
|
5539
|
-
const json = JSON.stringify(config).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029").replace(/<\//g, "<\\/");
|
|
5540
|
-
return "\n" + BUNDLE_CONFIG_PREFIX + json + ";";
|
|
5541
|
-
}
|
|
5542
|
-
function detachPeachBundleConfigFooter(source) {
|
|
5543
|
-
const configuredBundle = readPeachBundleConfigFooter(source);
|
|
5544
|
-
if (!configuredBundle) return { source, configuredBundle };
|
|
5545
|
-
const start = findBundleFooter(source, BUNDLE_CONFIG_PREFIX);
|
|
5546
|
-
const end = source.indexOf("\n", start + 1);
|
|
5547
|
-
return {
|
|
5548
|
-
source: source.slice(0, start) + source.slice(end < 0 ? source.length : end),
|
|
5549
|
-
configuredBundle
|
|
5550
|
-
};
|
|
5551
|
-
}
|
|
5552
|
-
function defineConfig(config) {
|
|
5553
|
-
return config;
|
|
5554
|
-
}
|
|
5555
|
-
function hasOwnKeys(value) {
|
|
5556
|
-
return !!value && Object.keys(value).length > 0;
|
|
5557
|
-
}
|
|
5558
|
-
function hasPeachConfig(config) {
|
|
5559
|
-
if (!config) return false;
|
|
5560
|
-
return config.nativeRenderer !== void 0 || config.mapKit !== void 0 || typeof config.runtimeVersion === "string" && config.runtimeVersion.length > 0 || hasOwnKeys(config.modules) || hasOwnKeys(config.turboModules) || hasOwnKeys(config.nativeModules) || hasOwnKeys(config.nativeViews) || hasOwnKeys(config.nativeHybridObjects) || hasOwnKeys(config.env) || hasOwnKeys(config.network?.remap) || hasOwnKeys(config.settings) || hasOwnKeys(config.initialProps) || hasOwnKeys(config.initialState);
|
|
5561
|
-
}
|
|
5562
|
-
function mergePeachConfig(base, override) {
|
|
5563
|
-
if (!hasPeachConfig(base) && !hasPeachConfig(override)) return void 0;
|
|
5564
|
-
if (!hasPeachConfig(base)) return override ? { ...override } : void 0;
|
|
5565
|
-
if (!hasPeachConfig(override)) return base ? { ...base } : void 0;
|
|
5566
|
-
return {
|
|
5567
|
-
runtimeVersion: override.runtimeVersion ?? base.runtimeVersion,
|
|
5568
|
-
nativeRenderer: override.nativeRenderer ?? base.nativeRenderer,
|
|
5569
|
-
mapKit: override.mapKit ?? base.mapKit,
|
|
5570
|
-
modules: { ...base.modules || {}, ...override.modules || {} },
|
|
5571
|
-
turboModules: { ...base.turboModules || {}, ...override.turboModules || {} },
|
|
5572
|
-
nativeModules: {
|
|
5573
|
-
...base.nativeModules || {},
|
|
5574
|
-
...override.nativeModules || {}
|
|
5575
|
-
},
|
|
5576
|
-
nativeViews: { ...base.nativeViews || {}, ...override.nativeViews || {} },
|
|
5577
|
-
nativeHybridObjects: {
|
|
5578
|
-
...base.nativeHybridObjects || {},
|
|
5579
|
-
...override.nativeHybridObjects || {}
|
|
5580
|
-
},
|
|
5581
|
-
env: { ...base.env || {}, ...override.env || {} },
|
|
5582
|
-
network: {
|
|
5583
|
-
remap: { ...base.network?.remap || {}, ...override.network?.remap || {} }
|
|
5584
|
-
},
|
|
5585
|
-
settings: {
|
|
5586
|
-
...base.settings || {},
|
|
5587
|
-
...override.settings || {}
|
|
5588
|
-
},
|
|
5589
|
-
initialProps: { ...base.initialProps || {}, ...override.initialProps || {} },
|
|
5590
|
-
initialState: { ...base.initialState || {}, ...override.initialState || {} }
|
|
5591
|
-
};
|
|
5592
|
-
}
|
|
5593
|
-
function readPeachConfigFromSearchParams(searchParams) {
|
|
5594
|
-
const raw = searchParams.get(PEACH_CONFIG_QUERY_PARAM);
|
|
5595
|
-
if (!raw) return void 0;
|
|
5596
|
-
let parsed;
|
|
5597
|
-
try {
|
|
5598
|
-
parsed = JSON.parse(raw);
|
|
5599
|
-
} catch (error) {
|
|
5600
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
5601
|
-
console.warn(`[peach] invalid ${PEACH_CONFIG_QUERY_PARAM}: ${message}`);
|
|
5602
|
-
return void 0;
|
|
5603
|
-
}
|
|
5604
|
-
if (isRecord(parsed)) readNativeRenderer(parsed.nativeRenderer);
|
|
5605
|
-
return isPeachConfig(parsed) && hasPeachConfig(parsed) ? parsed : void 0;
|
|
5606
|
-
}
|
|
5607
|
-
function applyPeachConfigToUrl(url, config) {
|
|
5608
|
-
const parsed = new URL(url);
|
|
5609
|
-
if (hasPeachConfig(config)) {
|
|
5610
|
-
parsed.searchParams.set(PEACH_CONFIG_QUERY_PARAM, JSON.stringify(config));
|
|
5611
|
-
} else {
|
|
5612
|
-
parsed.searchParams.delete(PEACH_CONFIG_QUERY_PARAM);
|
|
5613
|
-
}
|
|
5614
|
-
return parsed.toString();
|
|
5615
|
-
}
|
|
5616
|
-
var PEACH_CONFIG_QUERY_PARAM, BUNDLE_CONFIG_PREFIX, PEACH_CONFIGURED_FILES_HOOK;
|
|
5617
|
-
var init_config = __esm({
|
|
5618
|
-
"src/config.ts"() {
|
|
5619
|
-
"use strict";
|
|
5620
|
-
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
5621
|
-
init_version();
|
|
5622
|
-
init_bundleGlobalFooter();
|
|
5623
|
-
init_is_record();
|
|
5624
|
-
init_nativeViewSourceContract();
|
|
5625
|
-
PEACH_CONFIG_QUERY_PARAM = "peachConfig";
|
|
5626
|
-
BUNDLE_CONFIG_PREFIX = "globalThis.__peachBundleConfig=";
|
|
5627
|
-
PEACH_CONFIGURED_FILES_HOOK = "__peachInstallConfiguredFiles";
|
|
5628
|
-
}
|
|
5629
|
-
});
|
|
5630
|
-
|
|
5631
5656
|
// src/nitro-source.ts
|
|
5632
5657
|
function object(value) {
|
|
5633
5658
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
@@ -5636,19 +5661,19 @@ function readJson(root, relative3) {
|
|
|
5636
5661
|
return JSON.parse(
|
|
5637
5662
|
readPackageFile(
|
|
5638
5663
|
root,
|
|
5639
|
-
|
|
5664
|
+
import_node_path18.default.join(root, relative3),
|
|
5640
5665
|
MAX_SWIFT_COMPILE_SOURCE_BYTES
|
|
5641
5666
|
).toString("utf8")
|
|
5642
5667
|
);
|
|
5643
5668
|
}
|
|
5644
5669
|
function registrations(root) {
|
|
5645
|
-
const directory =
|
|
5646
|
-
const initializers =
|
|
5670
|
+
const directory = import_node_path18.default.join(root, "nitrogen/generated/ios");
|
|
5671
|
+
const initializers = import_node_fs18.default.readdirSync(directory).filter((file) => file.endsWith("Autolinking.mm"));
|
|
5647
5672
|
if (initializers.length !== 1)
|
|
5648
5673
|
throw new Error(`${root}: expected one generated Nitro iOS initializer`);
|
|
5649
5674
|
const source = readPackageFile(
|
|
5650
5675
|
root,
|
|
5651
|
-
|
|
5676
|
+
import_node_path18.default.join(directory, initializers[0]),
|
|
5652
5677
|
MAX_SWIFT_COMPILE_SOURCE_BYTES
|
|
5653
5678
|
).toString("utf8");
|
|
5654
5679
|
const namespaces = [
|
|
@@ -5690,12 +5715,12 @@ function registrations(root) {
|
|
|
5690
5715
|
return { namespace, swiftModule, classes, views: viewNames(root, classes) };
|
|
5691
5716
|
}
|
|
5692
5717
|
function viewNames(root, classes) {
|
|
5693
|
-
const directory =
|
|
5694
|
-
if (!
|
|
5718
|
+
const directory = import_node_path18.default.join(root, "nitrogen/generated/shared/json");
|
|
5719
|
+
if (!import_node_fs18.default.existsSync(directory)) return /* @__PURE__ */ new Set();
|
|
5695
5720
|
const views = /* @__PURE__ */ new Set();
|
|
5696
|
-
for (const file of
|
|
5721
|
+
for (const file of import_node_fs18.default.readdirSync(directory)) {
|
|
5697
5722
|
if (!file.endsWith("Config.json")) continue;
|
|
5698
|
-
const config = readJson(root,
|
|
5723
|
+
const config = readJson(root, import_node_path18.default.join("nitrogen/generated/shared/json", file));
|
|
5699
5724
|
const name2 = object(config) ? config.uiViewClassName : void 0;
|
|
5700
5725
|
if (typeof name2 === "string" && classes.some((entry) => entry.name === name2))
|
|
5701
5726
|
views.add(name2);
|
|
@@ -5703,21 +5728,21 @@ function viewNames(root, classes) {
|
|
|
5703
5728
|
return views;
|
|
5704
5729
|
}
|
|
5705
5730
|
function hasNitroIosInitializer(root) {
|
|
5706
|
-
const generated =
|
|
5707
|
-
return
|
|
5731
|
+
const generated = import_node_path18.default.join(root, "nitrogen/generated/ios");
|
|
5732
|
+
return import_node_fs18.default.existsSync(generated) && import_node_fs18.default.readdirSync(generated).some((file) => file.endsWith("Autolinking.mm"));
|
|
5708
5733
|
}
|
|
5709
5734
|
function nitroRegisteredNames(root) {
|
|
5710
5735
|
if (!hasNitroIosInitializer(root)) return null;
|
|
5711
5736
|
const { classes, views } = registrations(root);
|
|
5712
5737
|
return { names: classes.map(({ name: name2 }) => name2), views: [...views].sort() };
|
|
5713
5738
|
}
|
|
5714
|
-
var
|
|
5739
|
+
var import_node_fs18, import_node_path18;
|
|
5715
5740
|
var init_nitro_source = __esm({
|
|
5716
5741
|
"src/nitro-source.ts"() {
|
|
5717
5742
|
"use strict";
|
|
5718
5743
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
5719
|
-
|
|
5720
|
-
|
|
5744
|
+
import_node_fs18 = __toESM(require("node:fs"), 1);
|
|
5745
|
+
import_node_path18 = __toESM(require("node:path"), 1);
|
|
5721
5746
|
init_swift_source_file();
|
|
5722
5747
|
init_swift_submit();
|
|
5723
5748
|
}
|
|
@@ -5839,7 +5864,7 @@ function resolveAppStubs(appDir, config, configDir) {
|
|
|
5839
5864
|
const { modules, views, hybridObjects } = expandStubs(appDir, source);
|
|
5840
5865
|
assertRegisteredHybridObjects(appDir, source, hybridObjects);
|
|
5841
5866
|
for (const [name2, answer] of Object.entries(hybridObjects))
|
|
5842
|
-
nativeHybridObjects[name2] = answer === "unsupported" ? answer : { file: (0,
|
|
5867
|
+
nativeHybridObjects[name2] = answer === "unsupported" ? answer : { file: (0, import_node_path19.resolve)(source.baseDir, answer) };
|
|
5843
5868
|
for (const [name2, stub] of Object.entries(modules))
|
|
5844
5869
|
nativeModules[name2] = lowerStub(stub, source.baseDir);
|
|
5845
5870
|
for (const [name2, stub] of Object.entries(views))
|
|
@@ -5903,10 +5928,10 @@ function assertRegisteredHybridObjects(appDir, source, hybridObjects) {
|
|
|
5903
5928
|
);
|
|
5904
5929
|
}
|
|
5905
5930
|
function lowerStub(stub, baseDir) {
|
|
5906
|
-
return stub === "noop" ? stub : { file: (0,
|
|
5931
|
+
return stub === "noop" ? stub : { file: (0, import_node_path19.resolve)(baseDir, stub) };
|
|
5907
5932
|
}
|
|
5908
5933
|
function readPackageJson(dir) {
|
|
5909
|
-
const text2 = readSmallFile((0,
|
|
5934
|
+
const text2 = readSmallFile((0, import_node_path19.join)(dir, "package.json"));
|
|
5910
5935
|
if (!text2) return null;
|
|
5911
5936
|
try {
|
|
5912
5937
|
const parsed = JSON.parse(text2);
|
|
@@ -5918,9 +5943,9 @@ function readPackageJson(dir) {
|
|
|
5918
5943
|
function installedPackageDir(appDir, name2) {
|
|
5919
5944
|
let current = appDir;
|
|
5920
5945
|
while (true) {
|
|
5921
|
-
const dir = (0,
|
|
5922
|
-
if ((0,
|
|
5923
|
-
const parent = (0,
|
|
5946
|
+
const dir = (0, import_node_path19.join)(current, "node_modules", name2);
|
|
5947
|
+
if ((0, import_node_fs19.existsSync)((0, import_node_path19.join)(dir, "package.json"))) return (0, import_node_fs19.realpathSync)(dir);
|
|
5948
|
+
const parent = (0, import_node_path19.dirname)(current);
|
|
5924
5949
|
if (parent === current) return null;
|
|
5925
5950
|
current = parent;
|
|
5926
5951
|
}
|
|
@@ -6012,7 +6037,7 @@ function mergeRequests(previous, next) {
|
|
|
6012
6037
|
function packageNativeRequests(dir) {
|
|
6013
6038
|
const found = /* @__PURE__ */ new Map();
|
|
6014
6039
|
const directories = scanRepository(dir).directories.filter((sub) => {
|
|
6015
|
-
const segments = (0,
|
|
6040
|
+
const segments = (0, import_node_path19.relative)(dir, sub).split("/");
|
|
6016
6041
|
return !NATIVE_SOURCE_DIRS.has(segments[0]) && !segments.some((segment) => PACKAGE_SKIP_DIRS.has(segment));
|
|
6017
6042
|
});
|
|
6018
6043
|
let files = 0;
|
|
@@ -6020,7 +6045,7 @@ function packageNativeRequests(dir) {
|
|
|
6020
6045
|
for (const name2 of listDir(sub)) {
|
|
6021
6046
|
if (!SOURCE_FILE.test(name2) || name2.endsWith(".d.ts") || files >= 2e3) continue;
|
|
6022
6047
|
files++;
|
|
6023
|
-
const file = (0,
|
|
6048
|
+
const file = (0, import_node_path19.join)(sub, name2);
|
|
6024
6049
|
const text2 = readSmallFile(file);
|
|
6025
6050
|
if (!text2) continue;
|
|
6026
6051
|
for (const { line: _line, ...request } of sourceNativeRequests(file, text2, true))
|
|
@@ -6139,27 +6164,27 @@ function wireSlotMigration(appDir, configPath, wire, kept = []) {
|
|
|
6139
6164
|
}
|
|
6140
6165
|
function listDir(dir) {
|
|
6141
6166
|
try {
|
|
6142
|
-
return (0,
|
|
6167
|
+
return (0, import_node_fs19.readdirSync)(dir);
|
|
6143
6168
|
} catch {
|
|
6144
6169
|
return [];
|
|
6145
6170
|
}
|
|
6146
6171
|
}
|
|
6147
6172
|
function readSmallFile(file) {
|
|
6148
6173
|
try {
|
|
6149
|
-
return (0,
|
|
6174
|
+
return (0, import_node_fs19.statSync)(file).size <= 1024 * 1024 ? (0, import_node_fs19.readFileSync)(file, "utf8") : null;
|
|
6150
6175
|
} catch {
|
|
6151
6176
|
return null;
|
|
6152
6177
|
}
|
|
6153
6178
|
}
|
|
6154
6179
|
function hasNativeCode(dir, platform) {
|
|
6155
|
-
const expoConfig = (0,
|
|
6180
|
+
const expoConfig = (0, import_node_path19.join)(dir, "expo-module.config.json");
|
|
6156
6181
|
const platforms = metadataValue(readProjectJson(expoConfig), "platforms");
|
|
6157
6182
|
if (Array.isArray(platforms))
|
|
6158
6183
|
return platforms.includes(platform) || platform === "ios" && platforms.includes("apple");
|
|
6159
|
-
if ([platform, "expo-module.config.json"].some((entry) => (0,
|
|
6184
|
+
if ([platform, "expo-module.config.json"].some((entry) => (0, import_node_fs19.existsSync)((0, import_node_path19.join)(dir, entry))))
|
|
6160
6185
|
return true;
|
|
6161
6186
|
if (listDir(dir).some((name2) => name2.endsWith(".podspec"))) return true;
|
|
6162
|
-
const manifest = readSmallFile((0,
|
|
6187
|
+
const manifest = readSmallFile((0, import_node_path19.join)(dir, "package.json"));
|
|
6163
6188
|
return manifest !== null && manifest.includes('"codegenConfig"');
|
|
6164
6189
|
}
|
|
6165
6190
|
function scanLocalNative(appDir, pkg, answered, platform, knownPackages = /* @__PURE__ */ new Set(), includeLegacy = false, providers) {
|
|
@@ -6172,7 +6197,7 @@ function scanLocalNative(appDir, pkg, answered, platform, knownPackages = /* @__
|
|
|
6172
6197
|
(excluded) => dir === excluded || dir.startsWith(`${excluded}/`)
|
|
6173
6198
|
))
|
|
6174
6199
|
continue;
|
|
6175
|
-
if ((0,
|
|
6200
|
+
if ((0, import_node_fs19.existsSync)((0, import_node_path19.join)(dir, "expo-module.config.json"))) {
|
|
6176
6201
|
if (platform && !hasNativeCode(dir, platform)) {
|
|
6177
6202
|
excludedModuleDirs.push(dir);
|
|
6178
6203
|
continue;
|
|
@@ -6181,7 +6206,7 @@ function scanLocalNative(appDir, pkg, answered, platform, knownPackages = /* @__
|
|
|
6181
6206
|
}
|
|
6182
6207
|
for (const name2 of listDir(dir)) {
|
|
6183
6208
|
if (SOURCE_FILE.test(name2) && !name2.endsWith(".d.ts"))
|
|
6184
|
-
sourceFiles.push((0,
|
|
6209
|
+
sourceFiles.push((0, import_node_path19.join)(dir, name2));
|
|
6185
6210
|
}
|
|
6186
6211
|
}
|
|
6187
6212
|
}
|
|
@@ -6191,7 +6216,7 @@ function scanLocalNative(appDir, pkg, answered, platform, knownPackages = /* @__
|
|
|
6191
6216
|
scanRepository(dir).directories.flatMap(
|
|
6192
6217
|
(sub) => listDir(sub).filter(
|
|
6193
6218
|
(name2) => NATIVE_SOURCE_FILE.test(name2) && (!platform || (platform === "ios" ? name2.endsWith(".swift") : name2.endsWith(".kt")))
|
|
6194
|
-
).map((name2) => (0,
|
|
6219
|
+
).map((name2) => (0, import_node_path19.join)(sub, name2))
|
|
6195
6220
|
)
|
|
6196
6221
|
])
|
|
6197
6222
|
);
|
|
@@ -6200,7 +6225,7 @@ function scanLocalNative(appDir, pkg, answered, platform, knownPackages = /* @__
|
|
|
6200
6225
|
const known = owners.get(dir);
|
|
6201
6226
|
if (known) return known;
|
|
6202
6227
|
const name2 = readPackageJson(dir)?.name;
|
|
6203
|
-
const parent = (0,
|
|
6228
|
+
const parent = (0, import_node_path19.dirname)(dir);
|
|
6204
6229
|
const result = typeof name2 === "string" ? name2 : parent === dir ? pkg.name ?? "app" : owner(parent);
|
|
6205
6230
|
owners.set(dir, result);
|
|
6206
6231
|
return result;
|
|
@@ -6214,18 +6239,18 @@ function scanLocalNative(appDir, pkg, answered, platform, knownPackages = /* @__
|
|
|
6214
6239
|
return;
|
|
6215
6240
|
}
|
|
6216
6241
|
providers ??= dependencyNativeOwners(appDir, pkg);
|
|
6217
|
-
const packageName = providers.get(key) ?? owner((0,
|
|
6242
|
+
const packageName = providers.get(key) ?? owner((0, import_node_path19.dirname)(file));
|
|
6218
6243
|
if (knownPackages.has(packageName)) return;
|
|
6219
6244
|
const moduleDir = expoModuleDirs.find((dir) => file.startsWith(`${dir}/`)) ?? null;
|
|
6220
6245
|
found.set(key, {
|
|
6221
6246
|
kind,
|
|
6222
6247
|
name: name2,
|
|
6223
6248
|
package: packageName,
|
|
6224
|
-
path: `${(0,
|
|
6225
|
-
expoModule: moduleDir ? (0,
|
|
6249
|
+
path: `${(0, import_node_path19.relative)(appDir, file)}:${line}`,
|
|
6250
|
+
expoModule: moduleDir ? (0, import_node_path19.relative)(appDir, moduleDir) || "." : null,
|
|
6226
6251
|
optional,
|
|
6227
6252
|
swift: moduleDir ? (nativeFilesByModule.get(moduleDir) ?? []).some(
|
|
6228
|
-
(
|
|
6253
|
+
(path22) => path22.endsWith(".swift") && [...(readSmallFile(path22) ?? "").matchAll(/\bName\(\s*"(\w+)"\s*\)/g)].some(
|
|
6229
6254
|
(match) => match[1] === name2
|
|
6230
6255
|
)
|
|
6231
6256
|
) : false,
|
|
@@ -6266,30 +6291,30 @@ function workspacePackageDirs(appDir, pkg) {
|
|
|
6266
6291
|
for (const name2 of Object.keys({ ...pkg.dependencies, ...pkg.devDependencies })) {
|
|
6267
6292
|
let current = appDir;
|
|
6268
6293
|
while (true) {
|
|
6269
|
-
const link = (0,
|
|
6270
|
-
if ((0,
|
|
6271
|
-
if ((0,
|
|
6272
|
-
const target = (0,
|
|
6294
|
+
const link = (0, import_node_path19.join)(current, "node_modules", name2);
|
|
6295
|
+
if ((0, import_node_fs19.existsSync)(link)) {
|
|
6296
|
+
if ((0, import_node_fs19.lstatSync)(link).isSymbolicLink()) {
|
|
6297
|
+
const target = (0, import_node_fs19.realpathSync)(link);
|
|
6273
6298
|
if (!target.split("/").includes("node_modules") && !target.startsWith(`${appDir}/`)) {
|
|
6274
6299
|
dirs.add(target);
|
|
6275
6300
|
}
|
|
6276
6301
|
}
|
|
6277
6302
|
break;
|
|
6278
6303
|
}
|
|
6279
|
-
const parent = (0,
|
|
6304
|
+
const parent = (0, import_node_path19.dirname)(current);
|
|
6280
6305
|
if (parent === current) break;
|
|
6281
6306
|
current = parent;
|
|
6282
6307
|
}
|
|
6283
6308
|
}
|
|
6284
6309
|
return [...dirs];
|
|
6285
6310
|
}
|
|
6286
|
-
var
|
|
6311
|
+
var import_node_fs19, import_node_path19, import_version_range, import_oxc_parser2, import_sucrase, SOURCE_FILE, NATIVE_LOOKUP, NATIVE_SOURCE_DIRS, PACKAGE_SKIP_DIRS, NATIVE_SOURCE_FILE;
|
|
6287
6312
|
var init_app_stubs = __esm({
|
|
6288
6313
|
"cli/app-stubs.ts"() {
|
|
6289
6314
|
"use strict";
|
|
6290
6315
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
6291
|
-
|
|
6292
|
-
|
|
6316
|
+
import_node_fs19 = require("node:fs");
|
|
6317
|
+
import_node_path19 = require("node:path");
|
|
6293
6318
|
import_version_range = require("@peach/compat/version-range");
|
|
6294
6319
|
import_oxc_parser2 = require("oxc-parser");
|
|
6295
6320
|
import_sucrase = require("sucrase");
|
|
@@ -6325,12 +6350,12 @@ function resolveFileEntries(entries, configDir) {
|
|
|
6325
6350
|
return Object.fromEntries(
|
|
6326
6351
|
Object.entries(entries).map(([name2, resolution]) => [
|
|
6327
6352
|
name2,
|
|
6328
|
-
resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file:
|
|
6353
|
+
resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file: import_node_path20.default.resolve(configDir, resolution.file) } : resolution
|
|
6329
6354
|
])
|
|
6330
6355
|
);
|
|
6331
6356
|
}
|
|
6332
6357
|
function resolveConfigReplacementFiles(config, configPath) {
|
|
6333
|
-
const configDir =
|
|
6358
|
+
const configDir = import_node_path20.default.dirname(configPath);
|
|
6334
6359
|
return {
|
|
6335
6360
|
...config,
|
|
6336
6361
|
modules: resolveFileEntries(config.modules, configDir)
|
|
@@ -6346,7 +6371,7 @@ async function loadRNXAppStubs(project) {
|
|
|
6346
6371
|
return resolveAppStubs(
|
|
6347
6372
|
project.appDir,
|
|
6348
6373
|
config,
|
|
6349
|
-
project.configPath ?
|
|
6374
|
+
project.configPath ? import_node_path20.default.dirname(project.configPath) : project.appDir
|
|
6350
6375
|
);
|
|
6351
6376
|
} catch (error) {
|
|
6352
6377
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -6365,7 +6390,7 @@ async function loadConfigFile(project) {
|
|
|
6365
6390
|
[`${rnxPublicBrand.packageName}/config`]: config_exports
|
|
6366
6391
|
}
|
|
6367
6392
|
});
|
|
6368
|
-
const loaded3 = project.configPath.endsWith(".json") ? JSON.parse((0,
|
|
6393
|
+
const loaded3 = project.configPath.endsWith(".json") ? JSON.parse((0, import_node_fs20.readFileSync)(project.configPath, "utf8")) : await jiti.import(project.configPath, { default: true });
|
|
6369
6394
|
if (!isPeachConfig(loaded3)) {
|
|
6370
6395
|
throw new Error("the default export must be a peach config object");
|
|
6371
6396
|
}
|
|
@@ -6401,13 +6426,13 @@ async function resolveRNXAppConfig(startDir = process.cwd()) {
|
|
|
6401
6426
|
const project = resolveAppProject(startDir);
|
|
6402
6427
|
return { project, ...await loadRNXAppStubs(project) };
|
|
6403
6428
|
}
|
|
6404
|
-
var
|
|
6429
|
+
var import_node_fs20, import_node_path20, import_jiti, WIRE_SLOTS;
|
|
6405
6430
|
var init_app_config = __esm({
|
|
6406
6431
|
"cli/app-config.ts"() {
|
|
6407
6432
|
"use strict";
|
|
6408
6433
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
6409
|
-
|
|
6410
|
-
|
|
6434
|
+
import_node_fs20 = require("node:fs");
|
|
6435
|
+
import_node_path20 = __toESM(require("node:path"), 1);
|
|
6411
6436
|
import_jiti = require("jiti");
|
|
6412
6437
|
init_config();
|
|
6413
6438
|
init_config();
|
|
@@ -6504,14 +6529,14 @@ async function produceConfiguredBundle(source, config, runtimePackages) {
|
|
|
6504
6529
|
const neededPackages = /* @__PURE__ */ new Set();
|
|
6505
6530
|
const factories = [];
|
|
6506
6531
|
const visit3 = (filePath) => {
|
|
6507
|
-
const real =
|
|
6532
|
+
const real = import_node_fs21.default.realpathSync(filePath);
|
|
6508
6533
|
const previous = files.get(real);
|
|
6509
6534
|
if (previous !== void 0) return previous;
|
|
6510
6535
|
const id = "peach-config-file:" + files.size;
|
|
6511
6536
|
files.set(real, id);
|
|
6512
6537
|
const compiled = compileReplacementModule({
|
|
6513
6538
|
filePath: real,
|
|
6514
|
-
source:
|
|
6539
|
+
source: import_node_fs21.default.readFileSync(real, "utf8"),
|
|
6515
6540
|
runtimePackages,
|
|
6516
6541
|
localModuleUrl: (specifier) => visit3(resolveReplacementModuleFile(real, specifier))
|
|
6517
6542
|
});
|
|
@@ -6535,7 +6560,7 @@ async function produceConfiguredBundle(source, config, runtimePackages) {
|
|
|
6535
6560
|
if (!entries || typeof entries !== "object") continue;
|
|
6536
6561
|
for (const resolution of Object.values(entries)) {
|
|
6537
6562
|
if (resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string") {
|
|
6538
|
-
resolution.file = visit3(
|
|
6563
|
+
resolution.file = visit3(import_node_path21.default.resolve(resolution.file));
|
|
6539
6564
|
}
|
|
6540
6565
|
}
|
|
6541
6566
|
}
|
|
@@ -6559,13 +6584,13 @@ async function produceConfiguredBundle(source, config, runtimePackages) {
|
|
|
6559
6584
|
const identityStart = findBundleFooter(source, "globalThis.__sootsimModulePaths=");
|
|
6560
6585
|
return prefix2 + (identityStart < 0 ? source + footer : source.slice(0, identityStart) + footer + source.slice(identityStart));
|
|
6561
6586
|
}
|
|
6562
|
-
var
|
|
6587
|
+
var import_node_fs21, import_node_path21, import_sucrase2, import_terser;
|
|
6563
6588
|
var init_configured_bundle_producer = __esm({
|
|
6564
6589
|
"src/configured-bundle-producer.ts"() {
|
|
6565
6590
|
"use strict";
|
|
6566
6591
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
6567
|
-
|
|
6568
|
-
|
|
6592
|
+
import_node_fs21 = __toESM(require("node:fs"), 1);
|
|
6593
|
+
import_node_path21 = __toESM(require("node:path"), 1);
|
|
6569
6594
|
import_sucrase2 = require("sucrase");
|
|
6570
6595
|
import_terser = require("terser");
|
|
6571
6596
|
init_dependencies();
|
|
@@ -7897,7 +7922,7 @@ function createBridge(wsPort, opts = {}) {
|
|
|
7897
7922
|
const identity = getCliIdentity();
|
|
7898
7923
|
const ownerPid = getStableOwnerPid();
|
|
7899
7924
|
let terminalError;
|
|
7900
|
-
const ready = new Promise((
|
|
7925
|
+
const ready = new Promise((resolve5, reject) => {
|
|
7901
7926
|
const handshakeTimer = setTimeout(() => {
|
|
7902
7927
|
reject(
|
|
7903
7928
|
new Error(
|
|
@@ -7926,7 +7951,7 @@ function createBridge(wsPort, opts = {}) {
|
|
|
7926
7951
|
);
|
|
7927
7952
|
} catch {
|
|
7928
7953
|
}
|
|
7929
|
-
|
|
7954
|
+
resolve5();
|
|
7930
7955
|
});
|
|
7931
7956
|
ws.on("close", (code, reason) => {
|
|
7932
7957
|
clearTimeout(handshakeTimer);
|
|
@@ -8022,7 +8047,7 @@ function createBridge(wsPort, opts = {}) {
|
|
|
8022
8047
|
await ready;
|
|
8023
8048
|
if (terminalError) throw terminalError;
|
|
8024
8049
|
const id = nextId++;
|
|
8025
|
-
return new Promise((
|
|
8050
|
+
return new Promise((resolve5, reject) => {
|
|
8026
8051
|
const payload = { ...cmdOverride ?? cmd, id };
|
|
8027
8052
|
if (payload.simId === void 0 && defaultSimId) {
|
|
8028
8053
|
payload.simId = defaultSimId;
|
|
@@ -8038,7 +8063,7 @@ function createBridge(wsPort, opts = {}) {
|
|
|
8038
8063
|
pending.set(id, {
|
|
8039
8064
|
resolve: (v) => {
|
|
8040
8065
|
clearTimeoutFn();
|
|
8041
|
-
|
|
8066
|
+
resolve5(v);
|
|
8042
8067
|
},
|
|
8043
8068
|
reject: (e) => {
|
|
8044
8069
|
clearTimeoutFn();
|
|
@@ -8964,6 +8989,7 @@ function waitReadyStatus(result, ready) {
|
|
|
8964
8989
|
externalError: probe?.externalError ?? "",
|
|
8965
8990
|
suppressedEntryError: probe?.suppressedEntryError ?? "",
|
|
8966
8991
|
errors: probe?.errors ?? 0,
|
|
8992
|
+
startup: probe?.startup,
|
|
8967
8993
|
bridgeError: result.error ?? "",
|
|
8968
8994
|
paintedAppContent: probe?.paintedAppContent ?? false,
|
|
8969
8995
|
treeQuietMs: probe?.treeQuietMs ?? 0,
|
|
@@ -9882,7 +9908,7 @@ function isTapSuccess(result) {
|
|
|
9882
9908
|
if (!result || result.hit === false || result.ok === false) return false;
|
|
9883
9909
|
if (result.handled === false) return false;
|
|
9884
9910
|
if (result.requestedTargetMatched === false) return false;
|
|
9885
|
-
if (result.pointerTapHandled === false && !result.keyboardOpened && !result.isTextInput) {
|
|
9911
|
+
if (result.pointerTapHandled === false && !(result.hit === true && result.requestedTargetMatched === true) && !result.keyboardOpened && !result.isTextInput) {
|
|
9886
9912
|
return false;
|
|
9887
9913
|
}
|
|
9888
9914
|
return true;
|
|
@@ -9993,7 +10019,7 @@ async function tapResolvedTarget(bridge, args) {
|
|
|
9993
10019
|
motionOnly: true
|
|
9994
10020
|
});
|
|
9995
10021
|
} catch {
|
|
9996
|
-
await new Promise((
|
|
10022
|
+
await new Promise((resolve5) => setTimeout(resolve5, Math.min(120, remaining)));
|
|
9997
10023
|
}
|
|
9998
10024
|
}
|
|
9999
10025
|
return {
|
|
@@ -10249,7 +10275,7 @@ var LAUNCH_METADATA_KEYS = [
|
|
|
10249
10275
|
// src/sleep.ts
|
|
10250
10276
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
10251
10277
|
function sleep(ms) {
|
|
10252
|
-
return new Promise((
|
|
10278
|
+
return new Promise((resolve5) => setTimeout(resolve5, ms));
|
|
10253
10279
|
}
|
|
10254
10280
|
|
|
10255
10281
|
// src/sim-client.ts
|
|
@@ -11111,13 +11137,13 @@ function isRnxCaptureRegionAtlas(value) {
|
|
|
11111
11137
|
|
|
11112
11138
|
// src/vite-plugin-one.ts
|
|
11113
11139
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
11114
|
-
var
|
|
11140
|
+
var import_fs6 = __toESM(require("fs"), 1);
|
|
11115
11141
|
var import_node_crypto6 = require("node:crypto");
|
|
11116
11142
|
var import_node_http = __toESM(require("node:http"), 1);
|
|
11117
11143
|
var import_node_https = __toESM(require("node:https"), 1);
|
|
11118
11144
|
var import_node_url = require("node:url");
|
|
11119
|
-
var
|
|
11120
|
-
var
|
|
11145
|
+
var import_path5 = __toESM(require("path"), 1);
|
|
11146
|
+
var import_promises5 = require("stream/promises");
|
|
11121
11147
|
var import_ws2 = require("ws");
|
|
11122
11148
|
init_cli_runtime();
|
|
11123
11149
|
|
|
@@ -11194,61 +11220,19 @@ function launchRnxDesktop(bundleUrl, appName) {
|
|
|
11194
11220
|
|
|
11195
11221
|
// src/vite-plugin-one.ts
|
|
11196
11222
|
init_home_paths();
|
|
11197
|
-
init_replacement_module_handler();
|
|
11198
11223
|
|
|
11199
|
-
// src/host/
|
|
11224
|
+
// src/host/fetch-proxy-handler.ts
|
|
11200
11225
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
11201
|
-
var
|
|
11202
|
-
var
|
|
11203
|
-
|
|
11204
|
-
var
|
|
11205
|
-
|
|
11206
|
-
|
|
11207
|
-
|
|
11208
|
-
|
|
11209
|
-
|
|
11210
|
-
|
|
11211
|
-
const contentType = typeof upstream.headers["content-type"] === "string" ? upstream.headers["content-type"] : "";
|
|
11212
|
-
const inventory = getCliRuntime().rolldown_bundle_inventory;
|
|
11213
|
-
res.removeHeader("content-length");
|
|
11214
|
-
const annotate = async function* () {
|
|
11215
|
-
const decoder = new TextDecoder();
|
|
11216
|
-
let payload = "";
|
|
11217
|
-
let sent = 0;
|
|
11218
|
-
let bundleStarted = false;
|
|
11219
|
-
for await (const chunk of upstream) {
|
|
11220
|
-
payload += decoder.decode(chunk, { stream: true });
|
|
11221
|
-
if (bundleStarted) continue;
|
|
11222
|
-
const releasable = inventory.releasableMultipartPrefix(payload, contentType);
|
|
11223
|
-
bundleStarted = releasable.bundleStarted;
|
|
11224
|
-
if (releasable.length > sent) {
|
|
11225
|
-
yield Buffer.from(payload.slice(sent, releasable.length), "utf8");
|
|
11226
|
-
sent = releasable.length;
|
|
11227
|
-
}
|
|
11228
|
-
}
|
|
11229
|
-
payload += decoder.decode();
|
|
11230
|
-
let annotated;
|
|
11231
|
-
try {
|
|
11232
|
-
annotated = await inventory.attachRolldownBundleHttpPayload(payload, contentType);
|
|
11233
|
-
} catch (error) {
|
|
11234
|
-
const message = `could not attach the rolldown bundle inventory: ${error instanceof Error ? error.message : String(error)}`;
|
|
11235
|
-
console.error(`[peach] ${message}`);
|
|
11236
|
-
if (contentType.toLowerCase().includes("multipart/mixed")) {
|
|
11237
|
-
yield Buffer.from(
|
|
11238
|
-
inventory.multipartFailurePart(contentType, message, payload.slice(0, sent)),
|
|
11239
|
-
"utf8"
|
|
11240
|
-
);
|
|
11241
|
-
return;
|
|
11242
|
-
}
|
|
11243
|
-
res.statusCode = 500;
|
|
11244
|
-
res.setHeader("content-type", "application/json");
|
|
11245
|
-
yield Buffer.from(JSON.stringify({ message }), "utf8");
|
|
11246
|
-
return;
|
|
11247
|
-
}
|
|
11248
|
-
yield Buffer.from(annotated.slice(sent), "utf8");
|
|
11249
|
-
};
|
|
11250
|
-
await (0, import_promises2.pipeline)(import_stream.Readable.from(annotate(), { objectMode: false }), res);
|
|
11251
|
-
}
|
|
11226
|
+
var import_http = __toESM(require("http"), 1);
|
|
11227
|
+
var import_https = __toESM(require("https"), 1);
|
|
11228
|
+
var import_node_http2 = require("node:http2");
|
|
11229
|
+
var import_promises3 = require("stream/promises");
|
|
11230
|
+
init_backend_origin();
|
|
11231
|
+
|
|
11232
|
+
// src/host/dev-server-package-versions.ts
|
|
11233
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
11234
|
+
var import_fs5 = __toESM(require("fs"), 1);
|
|
11235
|
+
var import_path4 = __toESM(require("path"), 1);
|
|
11252
11236
|
|
|
11253
11237
|
// src/installed-package-versions.ts
|
|
11254
11238
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -11264,7 +11248,6 @@ var LAZY_STUB_PATTERNS = [
|
|
|
11264
11248
|
"@azesmway/react-native-unity",
|
|
11265
11249
|
"@azzapp/react-native-skia-video",
|
|
11266
11250
|
"@batch.com/react-native-plugin",
|
|
11267
|
-
"@bravemobile/react-native-code-push",
|
|
11268
11251
|
"@bugsnag/react-native",
|
|
11269
11252
|
"@bugsnag/react-native-performance",
|
|
11270
11253
|
"@callstack/react-native-bottom-tabs",
|
|
@@ -11344,7 +11327,6 @@ var LAZY_STUB_PATTERNS = [
|
|
|
11344
11327
|
"react-native-adjust",
|
|
11345
11328
|
"react-native-advanced-input-mask",
|
|
11346
11329
|
"react-native-agora",
|
|
11347
|
-
"react-native-amplitude-analytics",
|
|
11348
11330
|
"react-native-android-location-enabler",
|
|
11349
11331
|
"react-native-android-widget",
|
|
11350
11332
|
"react-native-animateable-text",
|
|
@@ -11423,6 +11405,7 @@ var LAZY_STUB_PATTERNS = [
|
|
|
11423
11405
|
"react-native-share-menu",
|
|
11424
11406
|
"react-native-shared-element",
|
|
11425
11407
|
"react-native-simple-toast",
|
|
11408
|
+
"react-native-skia",
|
|
11426
11409
|
"react-native-spinkit",
|
|
11427
11410
|
"react-native-ssl-public-key-pinning",
|
|
11428
11411
|
"react-native-star-io10",
|
|
@@ -12637,6 +12620,7 @@ var NATIVE_STUB_PACKAGE_NAMES = [
|
|
|
12637
12620
|
"expo-quick-actions",
|
|
12638
12621
|
"expo-rich-input",
|
|
12639
12622
|
"expo-roomplan",
|
|
12623
|
+
"expo-router",
|
|
12640
12624
|
"expo-screen-capture",
|
|
12641
12625
|
"expo-screen-corner-radius",
|
|
12642
12626
|
"expo-screen-orientation",
|
|
@@ -13075,6 +13059,7 @@ var NATIVE_STUB_PACKAGE_NAMES = [
|
|
|
13075
13059
|
"react-native-simple-biometrics",
|
|
13076
13060
|
"react-native-simple-toast",
|
|
13077
13061
|
"react-native-siri-shortcut",
|
|
13062
|
+
"react-native-skia",
|
|
13078
13063
|
"react-native-smart-splash-screen",
|
|
13079
13064
|
"react-native-snackbar",
|
|
13080
13065
|
"react-native-social-share",
|
|
@@ -13236,7 +13221,6 @@ var NATIVE_RUNTIME_PACKAGE_NAMES = [
|
|
|
13236
13221
|
"@tamagui/native-registry",
|
|
13237
13222
|
"@uniswap/ethers-rs-mobile",
|
|
13238
13223
|
"@valora/react-native-keychain",
|
|
13239
|
-
"expo-router",
|
|
13240
13224
|
"react-native-app-control",
|
|
13241
13225
|
"react-native-blue-crypto",
|
|
13242
13226
|
"react-native-nitro-base64",
|
|
@@ -14159,12 +14143,32 @@ function answerSync(step) {
|
|
|
14159
14143
|
throw error;
|
|
14160
14144
|
}
|
|
14161
14145
|
}
|
|
14146
|
+
async function answerAsync(step) {
|
|
14147
|
+
if (step.op === "exists")
|
|
14148
|
+
return import_fs4.default.promises.access(step.path).then(
|
|
14149
|
+
() => true,
|
|
14150
|
+
() => false
|
|
14151
|
+
);
|
|
14152
|
+
if (step.op === "realpath") return import_fs4.default.promises.realpath(step.path);
|
|
14153
|
+
try {
|
|
14154
|
+
return parseManifest(await import_fs4.default.promises.readFile(step.path, "utf8"));
|
|
14155
|
+
} catch (error) {
|
|
14156
|
+
if (isMissing(error)) return null;
|
|
14157
|
+
throw error;
|
|
14158
|
+
}
|
|
14159
|
+
}
|
|
14162
14160
|
function runSync(walk) {
|
|
14163
14161
|
for (let step = walk.next(); ; ) {
|
|
14164
14162
|
if (step.done) return step.value;
|
|
14165
14163
|
step = walk.next(answerSync(step.value));
|
|
14166
14164
|
}
|
|
14167
14165
|
}
|
|
14166
|
+
async function runAsync(walk) {
|
|
14167
|
+
for (let step = walk.next(); ; ) {
|
|
14168
|
+
if (step.done) return step.value;
|
|
14169
|
+
step = walk.next(await answerAsync(step.value));
|
|
14170
|
+
}
|
|
14171
|
+
}
|
|
14168
14172
|
function createInstalledPackageReader() {
|
|
14169
14173
|
const hasModules = /* @__PURE__ */ new Map();
|
|
14170
14174
|
const manifests = /* @__PURE__ */ new Map();
|
|
@@ -14258,31 +14262,94 @@ function* nativePackageVersionsWalk(projectRoot) {
|
|
|
14258
14262
|
function readInstalledNativePackageVersions(projectRoot) {
|
|
14259
14263
|
return runSync(nativePackageVersionsWalk(projectRoot));
|
|
14260
14264
|
}
|
|
14265
|
+
var INSTALL_RECORD_FILES = [
|
|
14266
|
+
"package.json",
|
|
14267
|
+
"bun.lock",
|
|
14268
|
+
"bun.lockb",
|
|
14269
|
+
"package-lock.json",
|
|
14270
|
+
"yarn.lock",
|
|
14271
|
+
"pnpm-lock.yaml",
|
|
14272
|
+
"node_modules",
|
|
14273
|
+
"node_modules/.package-lock.json",
|
|
14274
|
+
"node_modules/.yarn-integrity",
|
|
14275
|
+
"node_modules/.modules.yaml"
|
|
14276
|
+
];
|
|
14277
|
+
async function installFingerprint(projectRoot) {
|
|
14278
|
+
const appRoot = await import_fs4.default.promises.realpath(projectRoot);
|
|
14279
|
+
const targets = [];
|
|
14280
|
+
for (let dir = appRoot; ; ) {
|
|
14281
|
+
if (import_path3.default.basename(dir) !== "node_modules")
|
|
14282
|
+
for (const file of INSTALL_RECORD_FILES) targets.push(import_path3.default.join(dir, file));
|
|
14283
|
+
const parent = import_path3.default.dirname(dir);
|
|
14284
|
+
if (parent === dir) break;
|
|
14285
|
+
dir = parent;
|
|
14286
|
+
}
|
|
14287
|
+
const stats = await Promise.all(
|
|
14288
|
+
targets.map(
|
|
14289
|
+
(target) => import_fs4.default.promises.stat(target).then(
|
|
14290
|
+
(stat) => `${stat.ino}:${stat.size}:${stat.mtimeMs}`,
|
|
14291
|
+
() => ""
|
|
14292
|
+
)
|
|
14293
|
+
)
|
|
14294
|
+
);
|
|
14295
|
+
return `${appRoot}
|
|
14296
|
+
${stats.join("\n")}`;
|
|
14297
|
+
}
|
|
14298
|
+
var scans = /* @__PURE__ */ new Map();
|
|
14299
|
+
async function readInstalledNativePackageVersionsAsync(projectRoot) {
|
|
14300
|
+
const fingerprint = await installFingerprint(projectRoot);
|
|
14301
|
+
const cached2 = scans.get(projectRoot);
|
|
14302
|
+
if (cached2?.fingerprint === fingerprint) return cached2.versions;
|
|
14303
|
+
const versions = runAsync(nativePackageVersionsWalk(projectRoot));
|
|
14304
|
+
scans.set(projectRoot, { fingerprint, versions });
|
|
14305
|
+
versions.catch(() => {
|
|
14306
|
+
if (scans.get(projectRoot)?.versions === versions) scans.delete(projectRoot);
|
|
14307
|
+
});
|
|
14308
|
+
return versions;
|
|
14309
|
+
}
|
|
14261
14310
|
|
|
14262
|
-
// src/
|
|
14311
|
+
// src/metro-project-root.ts
|
|
14263
14312
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
14264
|
-
var import_node_child_process3 = require("node:child_process");
|
|
14265
|
-
var import_node_crypto5 = require("node:crypto");
|
|
14266
|
-
var import_node_fs11 = __toESM(require("node:fs"), 1);
|
|
14267
|
-
var import_node_module2 = require("node:module");
|
|
14268
|
-
var import_node_path10 = __toESM(require("node:path"), 1);
|
|
14269
|
-
var import_node_util = require("node:util");
|
|
14270
14313
|
|
|
14271
|
-
//
|
|
14314
|
+
// scripts/dev-server-scanner.ts
|
|
14272
14315
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
14273
|
-
var
|
|
14316
|
+
var import_child_process2 = require("child_process");
|
|
14317
|
+
var import_promises = require("fs/promises");
|
|
14318
|
+
var import_node_fs9 = require("node:fs");
|
|
14319
|
+
var import_node_os3 = require("node:os");
|
|
14320
|
+
var import_node_path8 = require("node:path");
|
|
14321
|
+
init_backend_origin();
|
|
14322
|
+
init_config();
|
|
14274
14323
|
|
|
14275
|
-
// src/
|
|
14276
|
-
|
|
14324
|
+
// src/dev-bundle-resolution.ts
|
|
14325
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
14326
|
+
init_backend_origin();
|
|
14277
14327
|
|
|
14278
|
-
// src/
|
|
14328
|
+
// src/expo-manifest-body.ts
|
|
14279
14329
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
14330
|
+
function parseExpoManifestBody(body) {
|
|
14331
|
+
const opening = /^(--[^\r\n]+)\r?\n/.exec(body);
|
|
14332
|
+
if (!opening) return JSON.parse(body);
|
|
14333
|
+
for (const part of body.split(opening[1])) {
|
|
14334
|
+
const headerEnd = part.search(/\r?\n\r?\n/);
|
|
14335
|
+
if (headerEnd < 0 || !/\bname="manifest"/.test(part.slice(0, headerEnd))) continue;
|
|
14336
|
+
return JSON.parse(part.slice(headerEnd).trim());
|
|
14337
|
+
}
|
|
14338
|
+
throw new Error("Expo manifest response has no manifest part");
|
|
14339
|
+
}
|
|
14280
14340
|
|
|
14281
14341
|
// src/native-dev-bundle-url.ts
|
|
14282
14342
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
14283
14343
|
init_backend_origin();
|
|
14284
14344
|
|
|
14345
|
+
// src/dev-bundle-resolution.ts
|
|
14346
|
+
var MANIFEST_PROBE_TIMEOUT_MS = 3e4;
|
|
14347
|
+
|
|
14348
|
+
// src/kotlinDiscoveryContract.ts
|
|
14349
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
14350
|
+
|
|
14285
14351
|
// src/oneWidgetContract.ts
|
|
14352
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
14286
14353
|
var HOME_WIDGET_FAMILIES = [
|
|
14287
14354
|
"systemSmall",
|
|
14288
14355
|
"systemMedium",
|
|
@@ -14293,7 +14360,1080 @@ function isHomeWidgetFamily(value) {
|
|
|
14293
14360
|
return HOME_WIDGET_FAMILIES.some((family) => family === value);
|
|
14294
14361
|
}
|
|
14295
14362
|
|
|
14363
|
+
// src/settings-bundle.ts
|
|
14364
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
14365
|
+
init_is_record();
|
|
14366
|
+
|
|
14367
|
+
// src/plist.ts
|
|
14368
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
14369
|
+
var import_plist = __toESM(require("plist"), 1);
|
|
14370
|
+
function parsePlistSource(source) {
|
|
14371
|
+
return import_plist.default.parse(source);
|
|
14372
|
+
}
|
|
14373
|
+
|
|
14374
|
+
// src/swiftDiscoveryContract.ts
|
|
14375
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
14376
|
+
|
|
14377
|
+
// scripts/optional-demo-registry.ts
|
|
14378
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
14379
|
+
|
|
14380
|
+
// scripts/dev-server-scanner.ts
|
|
14381
|
+
var LISTENER_LOCK_PATH = (0, import_node_path8.join)((0, import_node_os3.tmpdir)(), "peach-listener-scan.lock");
|
|
14382
|
+
var LISTENER_RESULT_PATH = (0, import_node_path8.join)((0, import_node_os3.tmpdir)(), "peach-listener-scan.result");
|
|
14383
|
+
var LISTENER_LOCK_STALE_MS = 25e3;
|
|
14384
|
+
var LISTENER_LOCK_WAIT_MS = 8e3;
|
|
14385
|
+
function sleep2(ms) {
|
|
14386
|
+
return new Promise((resolve5) => setTimeout(resolve5, ms));
|
|
14387
|
+
}
|
|
14388
|
+
function pidIsAlive(pid) {
|
|
14389
|
+
if (!Number.isInteger(pid) || pid <= 0) return false;
|
|
14390
|
+
try {
|
|
14391
|
+
process.kill(pid, 0);
|
|
14392
|
+
return true;
|
|
14393
|
+
} catch (error) {
|
|
14394
|
+
const code = error && typeof error === "object" && "code" in error ? String(error.code) : "";
|
|
14395
|
+
return code !== "ESRCH";
|
|
14396
|
+
}
|
|
14397
|
+
}
|
|
14398
|
+
function readLockOwner() {
|
|
14399
|
+
try {
|
|
14400
|
+
const raw = (0, import_node_fs9.readFileSync)(LISTENER_LOCK_PATH, "utf8");
|
|
14401
|
+
const mtimeMs = (0, import_node_fs9.statSync)(LISTENER_LOCK_PATH).mtimeMs;
|
|
14402
|
+
const pid = Number(raw.split("-")[0]);
|
|
14403
|
+
return { raw, pid: Number.isInteger(pid) ? pid : -1, mtimeMs };
|
|
14404
|
+
} catch {
|
|
14405
|
+
return null;
|
|
14406
|
+
}
|
|
14407
|
+
}
|
|
14408
|
+
function lockIsAbandoned(owner) {
|
|
14409
|
+
if (owner.pid <= 0 || !pidIsAlive(owner.pid)) return true;
|
|
14410
|
+
return Date.now() - owner.mtimeMs > LISTENER_LOCK_STALE_MS;
|
|
14411
|
+
}
|
|
14412
|
+
function clearLock(raw) {
|
|
14413
|
+
try {
|
|
14414
|
+
if ((0, import_node_fs9.readFileSync)(LISTENER_LOCK_PATH, "utf8") !== raw) return;
|
|
14415
|
+
(0, import_node_fs9.unlinkSync)(LISTENER_LOCK_PATH);
|
|
14416
|
+
} catch {
|
|
14417
|
+
}
|
|
14418
|
+
}
|
|
14419
|
+
function readResult() {
|
|
14420
|
+
try {
|
|
14421
|
+
const parsed = JSON.parse(
|
|
14422
|
+
(0, import_node_fs9.readFileSync)(LISTENER_RESULT_PATH, "utf8")
|
|
14423
|
+
);
|
|
14424
|
+
if (!parsed || typeof parsed.token !== "string" || typeof parsed.key !== "string")
|
|
14425
|
+
return null;
|
|
14426
|
+
return parsed;
|
|
14427
|
+
} catch {
|
|
14428
|
+
return null;
|
|
14429
|
+
}
|
|
14430
|
+
}
|
|
14431
|
+
function publishResult(payload) {
|
|
14432
|
+
const tmp = `${LISTENER_RESULT_PATH}.${process.pid}.tmp`;
|
|
14433
|
+
(0, import_node_fs9.writeFileSync)(tmp, JSON.stringify(payload));
|
|
14434
|
+
(0, import_node_fs9.renameSync)(tmp, LISTENER_RESULT_PATH);
|
|
14435
|
+
}
|
|
14436
|
+
function throwPublished(payload) {
|
|
14437
|
+
throw Object.assign(new Error(payload.message || "listener scan failed"), {
|
|
14438
|
+
killed: payload.killed === true
|
|
14439
|
+
});
|
|
14440
|
+
}
|
|
14441
|
+
async function waitForSharedResult(owner, key) {
|
|
14442
|
+
const cap = Date.now() + LISTING_TIMEOUT_MS;
|
|
14443
|
+
let current = owner;
|
|
14444
|
+
while (Date.now() < cap) {
|
|
14445
|
+
const published = readResult();
|
|
14446
|
+
if (published && published.token === current.raw) {
|
|
14447
|
+
if (published.key !== key) return { kind: "retry" };
|
|
14448
|
+
if (!published.ok) throwPublished(published);
|
|
14449
|
+
return { kind: "value", value: published.value };
|
|
14450
|
+
}
|
|
14451
|
+
const latest = readLockOwner();
|
|
14452
|
+
if (!latest) {
|
|
14453
|
+
const again = readResult();
|
|
14454
|
+
if (again && again.token === current.raw && again.key === key) {
|
|
14455
|
+
if (!again.ok) throwPublished(again);
|
|
14456
|
+
return { kind: "value", value: again.value };
|
|
14457
|
+
}
|
|
14458
|
+
return { kind: "retry" };
|
|
14459
|
+
}
|
|
14460
|
+
if (latest.raw !== current.raw) current = latest;
|
|
14461
|
+
if (lockIsAbandoned(latest)) {
|
|
14462
|
+
clearLock(latest.raw);
|
|
14463
|
+
return { kind: "retry" };
|
|
14464
|
+
}
|
|
14465
|
+
await sleep2(25);
|
|
14466
|
+
}
|
|
14467
|
+
throw Object.assign(new Error("listener scan lock was held past the wait"), {
|
|
14468
|
+
killed: true
|
|
14469
|
+
});
|
|
14470
|
+
}
|
|
14471
|
+
async function withListenerLock(key, body) {
|
|
14472
|
+
const token = `${process.pid}-${Date.now()}-${Math.random()}`;
|
|
14473
|
+
const deadline = Date.now() + LISTENER_LOCK_WAIT_MS;
|
|
14474
|
+
for (; ; ) {
|
|
14475
|
+
let fd = null;
|
|
14476
|
+
try {
|
|
14477
|
+
fd = (0, import_node_fs9.openSync)(LISTENER_LOCK_PATH, "wx");
|
|
14478
|
+
} catch (error) {
|
|
14479
|
+
const code = error instanceof Error && "code" in error ? error.code : "";
|
|
14480
|
+
if (code !== "EEXIST") throw error;
|
|
14481
|
+
const owner = readLockOwner();
|
|
14482
|
+
if (!owner || lockIsAbandoned(owner)) {
|
|
14483
|
+
if (owner) clearLock(owner.raw);
|
|
14484
|
+
else {
|
|
14485
|
+
try {
|
|
14486
|
+
(0, import_node_fs9.unlinkSync)(LISTENER_LOCK_PATH);
|
|
14487
|
+
} catch {
|
|
14488
|
+
}
|
|
14489
|
+
}
|
|
14490
|
+
continue;
|
|
14491
|
+
}
|
|
14492
|
+
if (Date.now() >= deadline) {
|
|
14493
|
+
const shared = await waitForSharedResult(owner, key);
|
|
14494
|
+
if (shared.kind === "value") return shared.value;
|
|
14495
|
+
continue;
|
|
14496
|
+
}
|
|
14497
|
+
await sleep2(25);
|
|
14498
|
+
continue;
|
|
14499
|
+
}
|
|
14500
|
+
if (fd === null) continue;
|
|
14501
|
+
try {
|
|
14502
|
+
(0, import_node_fs9.writeSync)(fd, token);
|
|
14503
|
+
try {
|
|
14504
|
+
const value = await body();
|
|
14505
|
+
publishResult({ token, key, ok: true, value });
|
|
14506
|
+
return value;
|
|
14507
|
+
} catch (error) {
|
|
14508
|
+
publishResult({
|
|
14509
|
+
token,
|
|
14510
|
+
key,
|
|
14511
|
+
ok: false,
|
|
14512
|
+
message: error instanceof Error ? error.message : String(error),
|
|
14513
|
+
killed: !!(error && typeof error === "object" && error.killed)
|
|
14514
|
+
});
|
|
14515
|
+
throw error;
|
|
14516
|
+
}
|
|
14517
|
+
} finally {
|
|
14518
|
+
try {
|
|
14519
|
+
(0, import_node_fs9.closeSync)(fd);
|
|
14520
|
+
} catch {
|
|
14521
|
+
}
|
|
14522
|
+
clearLock(token);
|
|
14523
|
+
}
|
|
14524
|
+
}
|
|
14525
|
+
}
|
|
14526
|
+
function spawnReaped(file, args, timeoutMs, maxBuffer = 1024 * 1024) {
|
|
14527
|
+
return withListenerLock(
|
|
14528
|
+
`${file}\0${args.join("\0")}`,
|
|
14529
|
+
() => new Promise((resolvePromise, reject) => {
|
|
14530
|
+
const child = (0, import_child_process2.spawn)(file, args, {
|
|
14531
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
14532
|
+
});
|
|
14533
|
+
let stdout = "";
|
|
14534
|
+
let settled = false;
|
|
14535
|
+
let timedOut = false;
|
|
14536
|
+
let overflow = false;
|
|
14537
|
+
let spawnError = null;
|
|
14538
|
+
const timeoutError = () => Object.assign(new Error(`\`${file}\` did not exit within ${timeoutMs}ms`), {
|
|
14539
|
+
killed: true
|
|
14540
|
+
});
|
|
14541
|
+
const finish = (err, code) => {
|
|
14542
|
+
if (settled) return;
|
|
14543
|
+
settled = true;
|
|
14544
|
+
clearTimeout(deadline);
|
|
14545
|
+
clearTimeout(backup);
|
|
14546
|
+
if (err) reject(err);
|
|
14547
|
+
else resolvePromise({ stdout, code });
|
|
14548
|
+
};
|
|
14549
|
+
const killChild = () => {
|
|
14550
|
+
if (child.exitCode !== null || child.signalCode !== null) return;
|
|
14551
|
+
try {
|
|
14552
|
+
child.kill("SIGKILL");
|
|
14553
|
+
} catch {
|
|
14554
|
+
}
|
|
14555
|
+
};
|
|
14556
|
+
let backup;
|
|
14557
|
+
const deadline = setTimeout(() => {
|
|
14558
|
+
timedOut = true;
|
|
14559
|
+
killChild();
|
|
14560
|
+
backup = setTimeout(() => finish(timeoutError(), null), 1e3);
|
|
14561
|
+
}, timeoutMs);
|
|
14562
|
+
child.stdout?.setEncoding("utf8");
|
|
14563
|
+
child.stderr?.on("data", () => {
|
|
14564
|
+
});
|
|
14565
|
+
child.stdout?.on("data", (chunk) => {
|
|
14566
|
+
stdout += chunk;
|
|
14567
|
+
if (stdout.length > maxBuffer) {
|
|
14568
|
+
overflow = true;
|
|
14569
|
+
killChild();
|
|
14570
|
+
}
|
|
14571
|
+
});
|
|
14572
|
+
child.on("error", (err) => {
|
|
14573
|
+
spawnError = err;
|
|
14574
|
+
killChild();
|
|
14575
|
+
});
|
|
14576
|
+
child.on("close", (code) => {
|
|
14577
|
+
if (timedOut) finish(timeoutError(), code);
|
|
14578
|
+
else if (overflow)
|
|
14579
|
+
finish(new Error(`\`${file}\` exceeded maxBuffer ${maxBuffer}`), code);
|
|
14580
|
+
else if (spawnError && !stdout) finish(spawnError, code);
|
|
14581
|
+
else finish(null, code);
|
|
14582
|
+
});
|
|
14583
|
+
})
|
|
14584
|
+
);
|
|
14585
|
+
}
|
|
14586
|
+
var FALLBACK_PORTS = [
|
|
14587
|
+
8081,
|
|
14588
|
+
8082,
|
|
14589
|
+
8083,
|
|
14590
|
+
8084,
|
|
14591
|
+
8085,
|
|
14592
|
+
8086,
|
|
14593
|
+
3e3,
|
|
14594
|
+
3001,
|
|
14595
|
+
19e3
|
|
14596
|
+
].map((port) => ({ port, pid: 0 }));
|
|
14597
|
+
var LISTING_TIMEOUT_MS = 1e4;
|
|
14598
|
+
function wasKilledByTimeout(err) {
|
|
14599
|
+
return !!(err && typeof err === "object" && err.killed);
|
|
14600
|
+
}
|
|
14601
|
+
var LISTENER_CACHE_MS = 2e3;
|
|
14602
|
+
var listenerCache = null;
|
|
14603
|
+
var inflightListing = null;
|
|
14604
|
+
var listenerHolds = 0;
|
|
14605
|
+
function cachedPidsAlive(scan) {
|
|
14606
|
+
if (scan.state !== "looked") return true;
|
|
14607
|
+
return scan.processes.every((entry) => entry.pid <= 0 || pidIsAlive(entry.pid));
|
|
14608
|
+
}
|
|
14609
|
+
async function cachedPortsStillHeld(scan) {
|
|
14610
|
+
if (scan.state !== "looked") return true;
|
|
14611
|
+
const owned = scan.processes.filter((entry) => entry.pid > 0);
|
|
14612
|
+
if (owned.length === 0) return true;
|
|
14613
|
+
const pids = [...new Set(owned.map((entry) => entry.pid))];
|
|
14614
|
+
try {
|
|
14615
|
+
const { stdout, code } = await spawnReaped(
|
|
14616
|
+
"lsof",
|
|
14617
|
+
["-nP", "-b", "-w", "-a", "-p", pids.join(","), "-iTCP", "-sTCP:LISTEN", "-Fpcn"],
|
|
14618
|
+
8e3,
|
|
14619
|
+
16 * 1024 * 1024
|
|
14620
|
+
);
|
|
14621
|
+
if (code !== 0 && code !== 1) return false;
|
|
14622
|
+
const live = new Set(
|
|
14623
|
+
parseLsofListeners(stdout).map((entry) => `${entry.port}:${entry.pid}`)
|
|
14624
|
+
);
|
|
14625
|
+
return owned.every((entry) => live.has(`${entry.port}:${entry.pid}`));
|
|
14626
|
+
} catch {
|
|
14627
|
+
return false;
|
|
14628
|
+
}
|
|
14629
|
+
}
|
|
14630
|
+
function listListenersShared() {
|
|
14631
|
+
inflightListing ??= loadListeners().finally(() => {
|
|
14632
|
+
inflightListing = null;
|
|
14633
|
+
});
|
|
14634
|
+
return inflightListing;
|
|
14635
|
+
}
|
|
14636
|
+
async function loadListeners() {
|
|
14637
|
+
const cached2 = listenerCache;
|
|
14638
|
+
if (cached2 && (listenerHolds > 0 || Date.now() - cached2.at < LISTENER_CACHE_MS) && cachedPidsAlive(cached2.scan) && await cachedPortsStillHeld(cached2.scan)) {
|
|
14639
|
+
return cached2.scan;
|
|
14640
|
+
}
|
|
14641
|
+
listenerCache = null;
|
|
14642
|
+
const scan = await listListeners();
|
|
14643
|
+
listenerCache = { at: Date.now(), scan };
|
|
14644
|
+
return scan;
|
|
14645
|
+
}
|
|
14646
|
+
function isSpawnMissing(err) {
|
|
14647
|
+
return !!(err && typeof err === "object" && err.code === "ENOENT");
|
|
14648
|
+
}
|
|
14649
|
+
function parseLsofListeners(stdout) {
|
|
14650
|
+
const seen = /* @__PURE__ */ new Map();
|
|
14651
|
+
let pid = 0;
|
|
14652
|
+
let command = "";
|
|
14653
|
+
for (const line of stdout.split("\n")) {
|
|
14654
|
+
if (line.startsWith("p")) {
|
|
14655
|
+
pid = Number(line.slice(1));
|
|
14656
|
+
command = "";
|
|
14657
|
+
continue;
|
|
14658
|
+
}
|
|
14659
|
+
if (line.startsWith("c")) {
|
|
14660
|
+
command = line.slice(1);
|
|
14661
|
+
continue;
|
|
14662
|
+
}
|
|
14663
|
+
if (!line.startsWith("n") || pid <= 0) continue;
|
|
14664
|
+
if (!/^(node|bun|peach|vite)/.test(command)) continue;
|
|
14665
|
+
const match = line.match(/:(\d+)$/);
|
|
14666
|
+
if (!match) continue;
|
|
14667
|
+
const port = Number(match[1]);
|
|
14668
|
+
if (!seen.has(port)) seen.set(port, pid);
|
|
14669
|
+
}
|
|
14670
|
+
return [...seen.entries()].map(([port, owner]) => ({ port, pid: owner }));
|
|
14671
|
+
}
|
|
14672
|
+
function parseSsListeners(stdout) {
|
|
14673
|
+
const seen = /* @__PURE__ */ new Map();
|
|
14674
|
+
for (const line of stdout.split("\n")) {
|
|
14675
|
+
if (!/"(node|bun|peach|vite)/.test(line)) continue;
|
|
14676
|
+
const portMatch = line.match(/:(\d+)\s/);
|
|
14677
|
+
const pidMatch = line.match(/pid=(\d+)/);
|
|
14678
|
+
if (!portMatch) continue;
|
|
14679
|
+
const port = Number(portMatch[1]);
|
|
14680
|
+
const pid = pidMatch ? Number(pidMatch[1]) : 0;
|
|
14681
|
+
if (!seen.has(port)) seen.set(port, pid);
|
|
14682
|
+
}
|
|
14683
|
+
return [...seen.entries()].map(([port, pid]) => ({ port, pid }));
|
|
14684
|
+
}
|
|
14685
|
+
async function listListeners() {
|
|
14686
|
+
let timedOut = false;
|
|
14687
|
+
try {
|
|
14688
|
+
const { stdout, code } = await spawnReaped(
|
|
14689
|
+
"lsof",
|
|
14690
|
+
[
|
|
14691
|
+
"-nP",
|
|
14692
|
+
"-b",
|
|
14693
|
+
"-w",
|
|
14694
|
+
"-a",
|
|
14695
|
+
"-c",
|
|
14696
|
+
"node",
|
|
14697
|
+
"-c",
|
|
14698
|
+
"bun",
|
|
14699
|
+
"-c",
|
|
14700
|
+
"peach",
|
|
14701
|
+
"-c",
|
|
14702
|
+
"vite",
|
|
14703
|
+
"-iTCP",
|
|
14704
|
+
"-sTCP:LISTEN",
|
|
14705
|
+
"-Fpcn"
|
|
14706
|
+
],
|
|
14707
|
+
LISTING_TIMEOUT_MS,
|
|
14708
|
+
16 * 1024 * 1024
|
|
14709
|
+
);
|
|
14710
|
+
if (code === 0 || code === 1) {
|
|
14711
|
+
return { state: "looked", processes: parseLsofListeners(stdout) };
|
|
14712
|
+
}
|
|
14713
|
+
} catch (err) {
|
|
14714
|
+
if (wasKilledByTimeout(err)) timedOut = true;
|
|
14715
|
+
else if (!isSpawnMissing(err)) return { state: "could-not-look" };
|
|
14716
|
+
}
|
|
14717
|
+
if (!timedOut) {
|
|
14718
|
+
try {
|
|
14719
|
+
const { stdout, code } = await spawnReaped(
|
|
14720
|
+
"ss",
|
|
14721
|
+
["-H", "-ltnp"],
|
|
14722
|
+
LISTING_TIMEOUT_MS,
|
|
14723
|
+
16 * 1024 * 1024
|
|
14724
|
+
);
|
|
14725
|
+
if (code === 0 || code === 1) {
|
|
14726
|
+
return { state: "looked", processes: parseSsListeners(stdout) };
|
|
14727
|
+
}
|
|
14728
|
+
} catch (err) {
|
|
14729
|
+
if (wasKilledByTimeout(err)) timedOut = true;
|
|
14730
|
+
else if (!isSpawnMissing(err)) return { state: "could-not-look" };
|
|
14731
|
+
}
|
|
14732
|
+
}
|
|
14733
|
+
if (timedOut) return { state: "could-not-look" };
|
|
14734
|
+
return { state: "looked", processes: FALLBACK_PORTS };
|
|
14735
|
+
}
|
|
14736
|
+
async function resolveListeningPid(port) {
|
|
14737
|
+
if (!Number.isInteger(port) || port <= 0) return null;
|
|
14738
|
+
const scan = await listListenersShared();
|
|
14739
|
+
if (scan.state !== "looked") return null;
|
|
14740
|
+
const pids = [
|
|
14741
|
+
...new Set(
|
|
14742
|
+
scan.processes.filter((entry) => entry.port === port && entry.pid > 0).map((entry) => entry.pid)
|
|
14743
|
+
)
|
|
14744
|
+
];
|
|
14745
|
+
return pids.length === 1 && pids[0] !== void 0 ? pids[0] : null;
|
|
14746
|
+
}
|
|
14747
|
+
var cwdByPid = /* @__PURE__ */ new Map();
|
|
14748
|
+
var cwdQueue = [];
|
|
14749
|
+
var cwdFlushing = false;
|
|
14750
|
+
function kickCwdFlush() {
|
|
14751
|
+
if (cwdFlushing || cwdQueue.length === 0) return;
|
|
14752
|
+
cwdFlushing = true;
|
|
14753
|
+
void flushCwdQueue().finally(() => {
|
|
14754
|
+
cwdFlushing = false;
|
|
14755
|
+
kickCwdFlush();
|
|
14756
|
+
});
|
|
14757
|
+
}
|
|
14758
|
+
async function flushCwdQueue() {
|
|
14759
|
+
await Promise.resolve();
|
|
14760
|
+
while (cwdQueue.length > 0) {
|
|
14761
|
+
const batch = cwdQueue.splice(0, cwdQueue.length);
|
|
14762
|
+
const pending = [...new Set(batch.map((waiter) => waiter.pid))].filter(
|
|
14763
|
+
(pid) => !cwdByPid.has(pid)
|
|
14764
|
+
);
|
|
14765
|
+
const needLsof = [];
|
|
14766
|
+
for (const pid of pending) {
|
|
14767
|
+
try {
|
|
14768
|
+
const cwd = await (0, import_promises.readlink)(`/proc/${pid}/cwd`);
|
|
14769
|
+
if (cwd) {
|
|
14770
|
+
cwdByPid.set(pid, cwd);
|
|
14771
|
+
continue;
|
|
14772
|
+
}
|
|
14773
|
+
} catch {
|
|
14774
|
+
}
|
|
14775
|
+
needLsof.push(pid);
|
|
14776
|
+
}
|
|
14777
|
+
if (needLsof.length > 0) {
|
|
14778
|
+
let looked = false;
|
|
14779
|
+
try {
|
|
14780
|
+
const { stdout, code } = await spawnReaped(
|
|
14781
|
+
"lsof",
|
|
14782
|
+
["-b", "-w", "-nP", "-a", "-d", "cwd", "-p", needLsof.join(","), "-Fn"],
|
|
14783
|
+
8e3,
|
|
14784
|
+
4 * 1024 * 1024
|
|
14785
|
+
);
|
|
14786
|
+
if (code === 0 || code === 1) {
|
|
14787
|
+
looked = true;
|
|
14788
|
+
let current = 0;
|
|
14789
|
+
for (const line of stdout.split("\n")) {
|
|
14790
|
+
if (line.startsWith("p")) {
|
|
14791
|
+
current = Number(line.slice(1));
|
|
14792
|
+
continue;
|
|
14793
|
+
}
|
|
14794
|
+
if (!line.startsWith("n") || line.length <= 1 || !needLsof.includes(current))
|
|
14795
|
+
continue;
|
|
14796
|
+
const cwd = line.slice(1).trim();
|
|
14797
|
+
if (cwd) cwdByPid.set(current, cwd);
|
|
14798
|
+
}
|
|
14799
|
+
}
|
|
14800
|
+
} catch {
|
|
14801
|
+
}
|
|
14802
|
+
if (looked) {
|
|
14803
|
+
for (const pid of needLsof) {
|
|
14804
|
+
if (!cwdByPid.has(pid)) cwdByPid.set(pid, null);
|
|
14805
|
+
}
|
|
14806
|
+
}
|
|
14807
|
+
}
|
|
14808
|
+
for (const waiter of batch) waiter.resolve(cwdByPid.get(waiter.pid) ?? null);
|
|
14809
|
+
}
|
|
14810
|
+
}
|
|
14811
|
+
function resolveProcessCwd(pid) {
|
|
14812
|
+
if (pid <= 0) return Promise.resolve(null);
|
|
14813
|
+
if (cwdByPid.has(pid)) return Promise.resolve(cwdByPid.get(pid) ?? null);
|
|
14814
|
+
return new Promise((resolveCwd) => {
|
|
14815
|
+
cwdQueue.push({ pid, resolve: resolveCwd });
|
|
14816
|
+
kickCwdFlush();
|
|
14817
|
+
});
|
|
14818
|
+
}
|
|
14819
|
+
|
|
14820
|
+
// src/metro-project-root.ts
|
|
14821
|
+
init_backend_origin();
|
|
14822
|
+
async function resolveMetroProjectRoot(bundleUrl) {
|
|
14823
|
+
const origin = loopbackOriginOf(bundleUrl);
|
|
14824
|
+
if (!origin) return null;
|
|
14825
|
+
const controller = new AbortController();
|
|
14826
|
+
const timer = setTimeout(() => controller.abort(), MANIFEST_PROBE_TIMEOUT_MS);
|
|
14827
|
+
let servedManifest = false;
|
|
14828
|
+
let metroRunning = false;
|
|
14829
|
+
try {
|
|
14830
|
+
const status = await fetch(`${origin}/status`, { signal: controller.signal });
|
|
14831
|
+
const advertisedRoot = status.headers.get("X-React-Native-Project-Root");
|
|
14832
|
+
if (status.ok && advertisedRoot) return decodeURI(advertisedRoot);
|
|
14833
|
+
metroRunning = status.ok && (await status.text()).trim() === "packager-status:running";
|
|
14834
|
+
const res = await fetch(`${origin}/`, {
|
|
14835
|
+
headers: { "expo-platform": "ios", Accept: "application/json" },
|
|
14836
|
+
signal: controller.signal
|
|
14837
|
+
});
|
|
14838
|
+
if (res.ok) {
|
|
14839
|
+
const manifest = parseExpoManifestBody(await res.text());
|
|
14840
|
+
servedManifest = true;
|
|
14841
|
+
let root = manifest;
|
|
14842
|
+
for (const key of ["extra", "expoClient", "_internal", "projectRoot"]) {
|
|
14843
|
+
root = typeof root === "object" && root !== null ? Reflect.get(root, key) : void 0;
|
|
14844
|
+
}
|
|
14845
|
+
if (typeof root === "string" && root.length > 0) return root;
|
|
14846
|
+
}
|
|
14847
|
+
} catch {
|
|
14848
|
+
if (controller.signal.aborted)
|
|
14849
|
+
throw new Error(
|
|
14850
|
+
`Metro project root request timed out after ${MANIFEST_PROBE_TIMEOUT_MS / 1e3}s: ${origin}. Wait for the dev server to finish starting or pass --project-root.`
|
|
14851
|
+
);
|
|
14852
|
+
} finally {
|
|
14853
|
+
clearTimeout(timer);
|
|
14854
|
+
}
|
|
14855
|
+
if (servedManifest || !metroRunning) return null;
|
|
14856
|
+
const port = Number(new URL(origin).port);
|
|
14857
|
+
if (!Number.isFinite(port) || port <= 0) return null;
|
|
14858
|
+
const pid = await resolveListeningPid(port);
|
|
14859
|
+
return pid === null ? null : resolveProcessCwd(pid);
|
|
14860
|
+
}
|
|
14861
|
+
|
|
14862
|
+
// src/host/dev-server-package-versions.ts
|
|
14863
|
+
async function readDevServerPackageVersions(bundleUrl) {
|
|
14864
|
+
if (!bundleUrl.pathname.endsWith(".bundle")) return null;
|
|
14865
|
+
const projectRoot = await resolveMetroProjectRoot(bundleUrl.href);
|
|
14866
|
+
if (!projectRoot) return null;
|
|
14867
|
+
try {
|
|
14868
|
+
await import_fs5.default.promises.access(import_path4.default.join(projectRoot, "package.json"));
|
|
14869
|
+
} catch {
|
|
14870
|
+
return null;
|
|
14871
|
+
}
|
|
14872
|
+
return readInstalledNativePackageVersionsAsync(projectRoot);
|
|
14873
|
+
}
|
|
14874
|
+
|
|
14875
|
+
// src/host/fetch-proxy-overrides.ts
|
|
14876
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
14877
|
+
var FETCH_PROXY_NATIVE_USER_AGENT_HEADER = "x-sootsim-native-user-agent";
|
|
14878
|
+
var FETCH_PROXY_FAILURE_PARAM = "peachFailure";
|
|
14879
|
+
var FETCH_PROXY_FAILURE_HEADER = "x-peach-upstream-failure";
|
|
14880
|
+
var FETCH_PROXY_RESPONSE_URL_HEADER = "x-peach-response-url";
|
|
14881
|
+
var FETCH_PROXY_NATIVE_COOKIE_HEADER = "x-peach-native-cookie";
|
|
14882
|
+
var FETCH_PROXY_NATIVE_COOKIE_RESPONSE_HEADER = "x-peach-native-cookie-response";
|
|
14883
|
+
function nativeCookieHopHeader(hop) {
|
|
14884
|
+
return encodeURIComponent(JSON.stringify(hop));
|
|
14885
|
+
}
|
|
14886
|
+
function isNativeCookieRedirect(hop) {
|
|
14887
|
+
return hop.location !== null && [301, 302, 303, 307, 308].includes(hop.status);
|
|
14888
|
+
}
|
|
14889
|
+
function resolveRedirectUrl(location, from) {
|
|
14890
|
+
const next = new URL(location, from);
|
|
14891
|
+
if (!location.includes("#")) next.hash = from.hash;
|
|
14892
|
+
return next;
|
|
14893
|
+
}
|
|
14894
|
+
var HOST_HEADER_OVERRIDES = [
|
|
14895
|
+
{
|
|
14896
|
+
hostSuffix: "uniswap.org",
|
|
14897
|
+
headers: {
|
|
14898
|
+
origin: "https://app.uniswap.org",
|
|
14899
|
+
referer: "https://app.uniswap.org/"
|
|
14900
|
+
}
|
|
14901
|
+
}
|
|
14902
|
+
];
|
|
14903
|
+
function headerOverridesFor(hostname) {
|
|
14904
|
+
const host = hostname.toLowerCase();
|
|
14905
|
+
for (const override of HOST_HEADER_OVERRIDES) {
|
|
14906
|
+
if (host === override.hostSuffix || host.endsWith(`.${override.hostSuffix}`)) {
|
|
14907
|
+
return override;
|
|
14908
|
+
}
|
|
14909
|
+
}
|
|
14910
|
+
return void 0;
|
|
14911
|
+
}
|
|
14912
|
+
var PUBLIC_RPC_TENANT = "rnx-public-rpc";
|
|
14913
|
+
var QUICKNODE_HOST_SUFFIX = ".quiknode.pro";
|
|
14914
|
+
var PUBLIC_RPC_BY_QUICKNODE_CHAIN = {
|
|
14915
|
+
"": "https://ethereum-rpc.publicnode.com",
|
|
14916
|
+
"arbitrum-mainnet": "https://arbitrum-one-rpc.publicnode.com",
|
|
14917
|
+
"avalanche-mainnet": "https://avalanche-c-chain-rpc.publicnode.com",
|
|
14918
|
+
"base-mainnet": "https://base-rpc.publicnode.com",
|
|
14919
|
+
"blast-mainnet": "https://blast-rpc.publicnode.com",
|
|
14920
|
+
bsc: "https://bsc-rpc.publicnode.com",
|
|
14921
|
+
"celo-mainnet": "https://celo-rpc.publicnode.com",
|
|
14922
|
+
matic: "https://polygon-bor-rpc.publicnode.com",
|
|
14923
|
+
optimism: "https://optimism-rpc.publicnode.com",
|
|
14924
|
+
"soneium-mainnet": "https://soneium-rpc.publicnode.com",
|
|
14925
|
+
"unichain-mainnet": "https://unichain-rpc.publicnode.com"
|
|
14926
|
+
};
|
|
14927
|
+
function resolveFetchProxyTargetUrl(requested) {
|
|
14928
|
+
const host = requested.hostname.toLowerCase();
|
|
14929
|
+
if (!host.endsWith(QUICKNODE_HOST_SUFFIX)) return requested;
|
|
14930
|
+
const tenant = host.slice(0, -QUICKNODE_HOST_SUFFIX.length);
|
|
14931
|
+
if (tenant !== PUBLIC_RPC_TENANT && !tenant.startsWith(`${PUBLIC_RPC_TENANT}.`)) {
|
|
14932
|
+
return requested;
|
|
14933
|
+
}
|
|
14934
|
+
const chain = tenant === PUBLIC_RPC_TENANT ? "" : tenant.slice(PUBLIC_RPC_TENANT.length + 1);
|
|
14935
|
+
const replacement = PUBLIC_RPC_BY_QUICKNODE_CHAIN[chain];
|
|
14936
|
+
return replacement ? new URL(replacement) : requested;
|
|
14937
|
+
}
|
|
14938
|
+
var STRIP_FETCH_PROXY_REQUEST_HEADERS = /* @__PURE__ */ new Set([
|
|
14939
|
+
"host",
|
|
14940
|
+
"x-forwarded",
|
|
14941
|
+
"x-real-ip",
|
|
14942
|
+
"forwarded",
|
|
14943
|
+
"origin",
|
|
14944
|
+
"referer",
|
|
14945
|
+
"user-agent",
|
|
14946
|
+
"accept-encoding",
|
|
14947
|
+
"cookie",
|
|
14948
|
+
"connection",
|
|
14949
|
+
"keep-alive",
|
|
14950
|
+
"transfer-encoding",
|
|
14951
|
+
"upgrade",
|
|
14952
|
+
"content-length",
|
|
14953
|
+
"sec-fetch-site",
|
|
14954
|
+
"sec-fetch-mode",
|
|
14955
|
+
"sec-fetch-dest",
|
|
14956
|
+
"sec-ch-ua",
|
|
14957
|
+
"sec-ch-ua-mobile",
|
|
14958
|
+
"sec-ch-ua-platform",
|
|
14959
|
+
FETCH_PROXY_NATIVE_USER_AGENT_HEADER,
|
|
14960
|
+
FETCH_PROXY_NATIVE_COOKIE_HEADER,
|
|
14961
|
+
FETCH_PROXY_NATIVE_COOKIE_RESPONSE_HEADER
|
|
14962
|
+
]);
|
|
14963
|
+
function buildFetchProxyUpstreamHeaders(requestHeaders, targetUrl) {
|
|
14964
|
+
const headers = {};
|
|
14965
|
+
let nativeUserAgent;
|
|
14966
|
+
let nativeCookie;
|
|
14967
|
+
for (const [rawKey, value] of requestHeaders) {
|
|
14968
|
+
const key = rawKey.toLowerCase();
|
|
14969
|
+
if (key === FETCH_PROXY_NATIVE_USER_AGENT_HEADER) nativeUserAgent = value;
|
|
14970
|
+
if (key === FETCH_PROXY_NATIVE_COOKIE_HEADER) nativeCookie = decodeURIComponent(value);
|
|
14971
|
+
if (key.startsWith(":") || STRIP_FETCH_PROXY_REQUEST_HEADERS.has(key) || key.startsWith("x-forwarded-")) {
|
|
14972
|
+
continue;
|
|
14973
|
+
}
|
|
14974
|
+
headers[key] = value;
|
|
14975
|
+
}
|
|
14976
|
+
if (!targetUrl) return headers;
|
|
14977
|
+
return {
|
|
14978
|
+
...headers,
|
|
14979
|
+
"accept-encoding": "identity",
|
|
14980
|
+
...nativeUserAgent ? { "user-agent": nativeUserAgent } : {},
|
|
14981
|
+
...nativeCookie ? { cookie: nativeCookie } : {},
|
|
14982
|
+
...headerOverridesFor(targetUrl.hostname)?.headers
|
|
14983
|
+
};
|
|
14984
|
+
}
|
|
14985
|
+
function nodeRequestHeaderEntries(headers) {
|
|
14986
|
+
const entries = [];
|
|
14987
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
14988
|
+
if (!value) continue;
|
|
14989
|
+
entries.push([key, Array.isArray(value) ? value.join(", ") : value]);
|
|
14990
|
+
}
|
|
14991
|
+
return entries;
|
|
14992
|
+
}
|
|
14993
|
+
|
|
14994
|
+
// src/host/loopback-ports.ts
|
|
14995
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
14996
|
+
init_backend_origin();
|
|
14997
|
+
var LOOPBACK_PORTS = /* @__PURE__ */ new Map();
|
|
14998
|
+
for (const pair of process.env.PEACH_LOOPBACK_PORTS?.split(",").filter(Boolean) ?? []) {
|
|
14999
|
+
const match = /^\s*([1-9][0-9]{0,4}):([1-9][0-9]{0,4})\s*$/.exec(pair);
|
|
15000
|
+
const from = Number(match?.[1]);
|
|
15001
|
+
const to = Number(match?.[2]);
|
|
15002
|
+
if (!match || from > 65535 || to > 65535 || LOOPBACK_PORTS.has(from)) {
|
|
15003
|
+
throw new Error(`PEACH_LOOPBACK_PORTS has an invalid entry: ${JSON.stringify(pair)}`);
|
|
15004
|
+
}
|
|
15005
|
+
LOOPBACK_PORTS.set(from, to);
|
|
15006
|
+
}
|
|
15007
|
+
function projectLoopbackPort(hostname, port) {
|
|
15008
|
+
return isLoopbackHost(hostname) ? LOOPBACK_PORTS.get(port) ?? port : port;
|
|
15009
|
+
}
|
|
15010
|
+
|
|
15011
|
+
// src/host/rolldown-bundle-forward.ts
|
|
15012
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
15013
|
+
var import_stream = require("stream");
|
|
15014
|
+
var import_promises2 = require("stream/promises");
|
|
15015
|
+
init_cli_runtime();
|
|
15016
|
+
var ROLLDOWN_INVENTORY_HEADER = "x-peach-rolldown-inventory";
|
|
15017
|
+
async function forwardRolldownBundleResponse(upstream, res) {
|
|
15018
|
+
res.setHeader(ROLLDOWN_INVENTORY_HEADER, "1");
|
|
15019
|
+
if (upstream.headers[ROLLDOWN_INVENTORY_HEADER] === "1") {
|
|
15020
|
+
await (0, import_promises2.pipeline)(upstream, res);
|
|
15021
|
+
return;
|
|
15022
|
+
}
|
|
15023
|
+
const contentType = typeof upstream.headers["content-type"] === "string" ? upstream.headers["content-type"] : "";
|
|
15024
|
+
const inventory = getCliRuntime().rolldown_bundle_inventory;
|
|
15025
|
+
res.removeHeader("content-length");
|
|
15026
|
+
const annotate = async function* () {
|
|
15027
|
+
const decoder = new TextDecoder();
|
|
15028
|
+
let payload = "";
|
|
15029
|
+
let sent = 0;
|
|
15030
|
+
let bundleStarted = false;
|
|
15031
|
+
for await (const chunk of upstream) {
|
|
15032
|
+
payload += decoder.decode(chunk, { stream: true });
|
|
15033
|
+
if (bundleStarted) continue;
|
|
15034
|
+
const releasable = inventory.releasableMultipartPrefix(payload, contentType);
|
|
15035
|
+
bundleStarted = releasable.bundleStarted;
|
|
15036
|
+
if (releasable.length > sent) {
|
|
15037
|
+
yield Buffer.from(payload.slice(sent, releasable.length), "utf8");
|
|
15038
|
+
sent = releasable.length;
|
|
15039
|
+
}
|
|
15040
|
+
}
|
|
15041
|
+
payload += decoder.decode();
|
|
15042
|
+
let annotated;
|
|
15043
|
+
try {
|
|
15044
|
+
annotated = await inventory.attachRolldownBundleHttpPayload(payload, contentType);
|
|
15045
|
+
} catch (error) {
|
|
15046
|
+
const message = `could not attach the rolldown bundle inventory: ${error instanceof Error ? error.message : String(error)}`;
|
|
15047
|
+
console.error(`[peach] ${message}`);
|
|
15048
|
+
if (contentType.toLowerCase().includes("multipart/mixed")) {
|
|
15049
|
+
yield Buffer.from(
|
|
15050
|
+
inventory.multipartFailurePart(contentType, message, payload.slice(0, sent)),
|
|
15051
|
+
"utf8"
|
|
15052
|
+
);
|
|
15053
|
+
return;
|
|
15054
|
+
}
|
|
15055
|
+
res.statusCode = 500;
|
|
15056
|
+
res.setHeader("content-type", "application/json");
|
|
15057
|
+
yield Buffer.from(JSON.stringify({ message }), "utf8");
|
|
15058
|
+
return;
|
|
15059
|
+
}
|
|
15060
|
+
yield Buffer.from(annotated.slice(sent), "utf8");
|
|
15061
|
+
};
|
|
15062
|
+
await (0, import_promises2.pipeline)(import_stream.Readable.from(annotate(), { objectMode: false }), res);
|
|
15063
|
+
}
|
|
15064
|
+
|
|
15065
|
+
// src/host/fetch-proxy-handler.ts
|
|
15066
|
+
var fetchProxyHttpAgent = new import_http.default.Agent({ keepAlive: true, maxSockets: 256 });
|
|
15067
|
+
var fetchProxyHttpsAgent = new import_https.default.Agent({ keepAlive: true, maxSockets: 256 });
|
|
15068
|
+
function fetchProxyAgentFor(targetUrl) {
|
|
15069
|
+
return targetUrl.protocol === "https:" ? fetchProxyHttpsAgent : fetchProxyHttpAgent;
|
|
15070
|
+
}
|
|
15071
|
+
var FETCH_PROXY_CORS_HEADERS = {
|
|
15072
|
+
"access-control-allow-methods": "GET,HEAD,POST,PUT,DELETE,PATCH,OPTIONS",
|
|
15073
|
+
"access-control-max-age": "3600"
|
|
15074
|
+
};
|
|
15075
|
+
var APP_API_HEADER_REWRITES = /* @__PURE__ */ new Set([
|
|
15076
|
+
"host",
|
|
15077
|
+
"origin",
|
|
15078
|
+
"referer",
|
|
15079
|
+
"sec-fetch-site",
|
|
15080
|
+
"sec-fetch-mode",
|
|
15081
|
+
"sec-fetch-dest"
|
|
15082
|
+
]);
|
|
15083
|
+
function loopbackTlsOptions(targetUrl) {
|
|
15084
|
+
if (targetUrl.protocol !== "https:") return {};
|
|
15085
|
+
return isLoopbackHost(targetUrl.hostname) ? { rejectUnauthorized: false } : {};
|
|
15086
|
+
}
|
|
15087
|
+
function applyFetchProxyCors(req, res) {
|
|
15088
|
+
for (const [key, value] of Object.entries(FETCH_PROXY_CORS_HEADERS)) {
|
|
15089
|
+
res.setHeader(key, value);
|
|
15090
|
+
}
|
|
15091
|
+
res.setHeader("access-control-allow-origin", req.headers.origin ?? "*");
|
|
15092
|
+
res.setHeader("access-control-allow-credentials", "true");
|
|
15093
|
+
res.setHeader(
|
|
15094
|
+
"access-control-allow-headers",
|
|
15095
|
+
req.headers["access-control-request-headers"] ?? "*"
|
|
15096
|
+
);
|
|
15097
|
+
res.setHeader(
|
|
15098
|
+
"access-control-expose-headers",
|
|
15099
|
+
[
|
|
15100
|
+
...Object.keys(res.getHeaders()).filter(
|
|
15101
|
+
(name2) => !name2.startsWith("access-control-")
|
|
15102
|
+
),
|
|
15103
|
+
"x-sootsim-set-cookie"
|
|
15104
|
+
].join(", ")
|
|
15105
|
+
);
|
|
15106
|
+
const vary = res.getHeader("vary");
|
|
15107
|
+
res.setHeader(
|
|
15108
|
+
"vary",
|
|
15109
|
+
vary ? `${Array.isArray(vary) ? vary.join(", ") : vary}, Origin` : "Origin"
|
|
15110
|
+
);
|
|
15111
|
+
}
|
|
15112
|
+
function buildFetchProxyHeaders(reqHeaders, targetUrl) {
|
|
15113
|
+
return buildFetchProxyUpstreamHeaders(nodeRequestHeaderEntries(reqHeaders), targetUrl);
|
|
15114
|
+
}
|
|
15115
|
+
function buildAppApiProxyHeaders(reqHeaders, targetUrl) {
|
|
15116
|
+
const headers = {};
|
|
15117
|
+
for (const [key, value] of Object.entries(reqHeaders)) {
|
|
15118
|
+
if (!value) continue;
|
|
15119
|
+
if (key.toLowerCase() === FETCH_PROXY_NATIVE_COOKIE_HEADER || key.toLowerCase() === FETCH_PROXY_NATIVE_COOKIE_RESPONSE_HEADER || reqHeaders[FETCH_PROXY_NATIVE_COOKIE_HEADER] !== void 0 && key.toLowerCase() === "cookie" || APP_API_HEADER_REWRITES.has(key.toLowerCase()))
|
|
15120
|
+
continue;
|
|
15121
|
+
headers[key] = value;
|
|
15122
|
+
}
|
|
15123
|
+
const nativeCookie = reqHeaders[FETCH_PROXY_NATIVE_COOKIE_HEADER];
|
|
15124
|
+
if (typeof nativeCookie === "string" && nativeCookie)
|
|
15125
|
+
headers.cookie = decodeURIComponent(nativeCookie);
|
|
15126
|
+
headers.host = targetUrl.host;
|
|
15127
|
+
if (!Object.keys(headers).some((name2) => name2.toLowerCase() === "mobile-origin")) {
|
|
15128
|
+
headers.origin = targetUrl.origin;
|
|
15129
|
+
headers.referer = `${targetUrl.origin}/`;
|
|
15130
|
+
}
|
|
15131
|
+
return headers;
|
|
15132
|
+
}
|
|
15133
|
+
function rejectUntrustedBridgeOrigin(req, res) {
|
|
15134
|
+
if (isTrustedBridgeRequest(req.headers)) return false;
|
|
15135
|
+
res.statusCode = 403;
|
|
15136
|
+
res.setHeader("Content-Type", "text/plain; charset=utf-8");
|
|
15137
|
+
res.end(`peach bridge: origin ${req.headers.origin} may not use this bridge`);
|
|
15138
|
+
return true;
|
|
15139
|
+
}
|
|
15140
|
+
function isFetchProxyRequestUrl(rawUrl) {
|
|
15141
|
+
return rawUrl?.startsWith("/__fetch-proxy?") || rawUrl?.startsWith("/__proxy?") || false;
|
|
15142
|
+
}
|
|
15143
|
+
function isBundleProxyRequestUrl(rawUrl) {
|
|
15144
|
+
return rawUrl?.startsWith("/__bundle-proxy?") ?? false;
|
|
15145
|
+
}
|
|
15146
|
+
function isAppApiRequestUrl(rawUrl) {
|
|
15147
|
+
if (!rawUrl) return false;
|
|
15148
|
+
if (rawUrl.startsWith("/__app-api?")) return true;
|
|
15149
|
+
if (rawUrl.startsWith("/__app-api/")) return true;
|
|
15150
|
+
return false;
|
|
15151
|
+
}
|
|
15152
|
+
async function handleFetchProxyRequest(req, res) {
|
|
15153
|
+
if (req.method === "OPTIONS") {
|
|
15154
|
+
applyFetchProxyCors(req, res);
|
|
15155
|
+
res.statusCode = 204;
|
|
15156
|
+
res.end();
|
|
15157
|
+
return;
|
|
15158
|
+
}
|
|
15159
|
+
const params = new URLSearchParams((req.url || "").split("?")[1] || "");
|
|
15160
|
+
const targetUrl = params.get("url");
|
|
15161
|
+
if (!targetUrl) {
|
|
15162
|
+
applyFetchProxyCors(req, res);
|
|
15163
|
+
res.statusCode = 400;
|
|
15164
|
+
res.setHeader("Content-Type", "text/plain");
|
|
15165
|
+
res.end("missing url param");
|
|
15166
|
+
return;
|
|
15167
|
+
}
|
|
15168
|
+
let upstreamUrl;
|
|
15169
|
+
try {
|
|
15170
|
+
upstreamUrl = resolveFetchProxyTargetUrl(new URL(targetUrl));
|
|
15171
|
+
} catch {
|
|
15172
|
+
applyFetchProxyCors(req, res);
|
|
15173
|
+
res.statusCode = 400;
|
|
15174
|
+
res.setHeader("Content-Type", "text/plain");
|
|
15175
|
+
res.end("invalid url param");
|
|
15176
|
+
return;
|
|
15177
|
+
}
|
|
15178
|
+
const packageVersionsRead = isBundleProxyRequestUrl(req.url) && req.method === "GET" ? readDevServerPackageVersions(upstreamUrl) : null;
|
|
15179
|
+
packageVersionsRead?.catch(() => {
|
|
15180
|
+
});
|
|
15181
|
+
await proxyUpstream(req, res, upstreamUrl, params.has(FETCH_PROXY_FAILURE_PARAM), {
|
|
15182
|
+
requestHeaders: (target) => buildFetchProxyHeaders(req.headers, target),
|
|
15183
|
+
respond: async (upstream, setCookies) => {
|
|
15184
|
+
for (const [key, value] of Object.entries(upstream.headers)) {
|
|
15185
|
+
const lowerKey = key.toLowerCase();
|
|
15186
|
+
if (value === void 0 || lowerKey === "set-cookie" || lowerKey === "connection" || lowerKey === "keep-alive" || lowerKey === "proxy-authenticate" || lowerKey === "proxy-authorization" || lowerKey === "te" || lowerKey === "trailer" || lowerKey === "transfer-encoding" || lowerKey === "upgrade" || lowerKey === FETCH_PROXY_NATIVE_COOKIE_RESPONSE_HEADER || lowerKey === FETCH_PROXY_RESPONSE_URL_HEADER || lowerKey.startsWith("access-control-")) {
|
|
15187
|
+
continue;
|
|
15188
|
+
}
|
|
15189
|
+
res.setHeader(key, value);
|
|
15190
|
+
}
|
|
15191
|
+
if (packageVersionsRead && upstream.statusCode === 200 && !res.hasHeader(PACKAGE_VERSIONS_HEADER)) {
|
|
15192
|
+
const packageVersions = await packageVersionsRead;
|
|
15193
|
+
if (packageVersions)
|
|
15194
|
+
res.setHeader(PACKAGE_VERSIONS_HEADER, JSON.stringify(packageVersions));
|
|
15195
|
+
}
|
|
15196
|
+
applyFetchProxyCors(req, res);
|
|
15197
|
+
if (setCookies.length > 0)
|
|
15198
|
+
res.setHeader("x-sootsim-set-cookie", setCookies.join(", "));
|
|
15199
|
+
}
|
|
15200
|
+
});
|
|
15201
|
+
}
|
|
15202
|
+
function handleAppApiRequest(req, res) {
|
|
15203
|
+
const reqUrl = req.url || "";
|
|
15204
|
+
let targetPath = "";
|
|
15205
|
+
let targetOrigin = "";
|
|
15206
|
+
let reportFailure = false;
|
|
15207
|
+
if (reqUrl.startsWith("/__app-api?")) {
|
|
15208
|
+
const parsed = new URL(reqUrl, "http://sootsim.local");
|
|
15209
|
+
targetPath = parsed.searchParams.get("path") || "";
|
|
15210
|
+
targetOrigin = parsed.searchParams.get("origin")?.trim() || "";
|
|
15211
|
+
reportFailure = parsed.searchParams.has(FETCH_PROXY_FAILURE_PARAM);
|
|
15212
|
+
} else if (reqUrl.startsWith("/__app-api/")) {
|
|
15213
|
+
targetPath = reqUrl.slice("/__app-api".length);
|
|
15214
|
+
} else {
|
|
15215
|
+
return false;
|
|
15216
|
+
}
|
|
15217
|
+
if (!targetOrigin) {
|
|
15218
|
+
res.writeHead(400, { "Content-Type": "text/plain" });
|
|
15219
|
+
res.end("app-api: missing origin query param");
|
|
15220
|
+
return true;
|
|
15221
|
+
}
|
|
15222
|
+
if (req.method === "OPTIONS") {
|
|
15223
|
+
res.writeHead(204, {
|
|
15224
|
+
"Access-Control-Allow-Origin": req.headers.origin || "*",
|
|
15225
|
+
"Access-Control-Allow-Methods": "GET,POST,PUT,PATCH,DELETE,OPTIONS",
|
|
15226
|
+
"Access-Control-Allow-Headers": req.headers["access-control-request-headers"] || "*",
|
|
15227
|
+
"Access-Control-Allow-Credentials": "true",
|
|
15228
|
+
"Access-Control-Max-Age": "86400"
|
|
15229
|
+
});
|
|
15230
|
+
res.end();
|
|
15231
|
+
return true;
|
|
15232
|
+
}
|
|
15233
|
+
let targetUrl;
|
|
15234
|
+
try {
|
|
15235
|
+
targetUrl = new URL(targetPath, targetOrigin);
|
|
15236
|
+
} catch {
|
|
15237
|
+
res.writeHead(400, { "Content-Type": "text/plain" });
|
|
15238
|
+
res.end("app-api: invalid origin or path");
|
|
15239
|
+
return true;
|
|
15240
|
+
}
|
|
15241
|
+
void proxyUpstream(req, res, targetUrl, reportFailure, {
|
|
15242
|
+
requestHeaders: (target) => buildAppApiProxyHeaders(req.headers, target),
|
|
15243
|
+
respond: (upstream, setCookies) => {
|
|
15244
|
+
for (const [key, value] of Object.entries(upstream.headers)) {
|
|
15245
|
+
const lowerKey = key.toLowerCase();
|
|
15246
|
+
if (value === void 0 || lowerKey === "set-cookie" || lowerKey === FETCH_PROXY_NATIVE_COOKIE_RESPONSE_HEADER || lowerKey === FETCH_PROXY_RESPONSE_URL_HEADER) {
|
|
15247
|
+
continue;
|
|
15248
|
+
}
|
|
15249
|
+
res.setHeader(key, value);
|
|
15250
|
+
}
|
|
15251
|
+
if (setCookies.length > 0 && req.headers[FETCH_PROXY_NATIVE_COOKIE_HEADER] === void 0)
|
|
15252
|
+
res.setHeader("set-cookie", setCookies);
|
|
15253
|
+
res.setHeader("access-control-allow-origin", req.headers.origin || "*");
|
|
15254
|
+
res.setHeader("access-control-allow-credentials", "true");
|
|
15255
|
+
res.setHeader(
|
|
15256
|
+
"access-control-expose-headers",
|
|
15257
|
+
Object.keys(res.getHeaders()).filter((name2) => !name2.startsWith("access-control-") && name2 !== "set-cookie").join(", ")
|
|
15258
|
+
);
|
|
15259
|
+
}
|
|
15260
|
+
});
|
|
15261
|
+
return true;
|
|
15262
|
+
}
|
|
15263
|
+
function serveBrowserProxyRoute(req, res) {
|
|
15264
|
+
if (isBundleProxyRequestUrl(req.url) || isFetchProxyRequestUrl(req.url)) {
|
|
15265
|
+
if (!rejectUntrustedBridgeOrigin(req, res)) void handleFetchProxyRequest(req, res);
|
|
15266
|
+
return true;
|
|
15267
|
+
}
|
|
15268
|
+
if (isAppApiRequestUrl(req.url)) {
|
|
15269
|
+
if (rejectUntrustedBridgeOrigin(req, res)) return true;
|
|
15270
|
+
return handleAppApiRequest(req, res);
|
|
15271
|
+
}
|
|
15272
|
+
return false;
|
|
15273
|
+
}
|
|
15274
|
+
async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
15275
|
+
const originalMethod = req.method || "GET";
|
|
15276
|
+
const proxy = async (targetUrl, method, nextBody, redirects, setCookies) => {
|
|
15277
|
+
const transport = targetUrl.protocol === "https:" ? import_https.default : import_http.default;
|
|
15278
|
+
const targetHeaders = route.requestHeaders(targetUrl);
|
|
15279
|
+
if (targetUrl.origin !== upstreamUrl.origin) {
|
|
15280
|
+
delete targetHeaders.authorization;
|
|
15281
|
+
delete targetHeaders["proxy-authorization"];
|
|
15282
|
+
}
|
|
15283
|
+
if (method === "GET" || method === "HEAD") {
|
|
15284
|
+
delete targetHeaders["content-length"];
|
|
15285
|
+
delete targetHeaders["content-type"];
|
|
15286
|
+
} else if (nextBody) {
|
|
15287
|
+
delete targetHeaders["transfer-encoding"];
|
|
15288
|
+
targetHeaders["content-length"] = String(nextBody.byteLength);
|
|
15289
|
+
}
|
|
15290
|
+
const port = projectLoopbackPort(
|
|
15291
|
+
targetUrl.hostname,
|
|
15292
|
+
Number(targetUrl.port || (targetUrl.protocol === "https:" ? 443 : 80))
|
|
15293
|
+
);
|
|
15294
|
+
let clientAborted = false;
|
|
15295
|
+
const markAborted = () => {
|
|
15296
|
+
clientAborted = true;
|
|
15297
|
+
};
|
|
15298
|
+
req.once("aborted", markAborted);
|
|
15299
|
+
const send = () => new Promise((resolve5, reject) => {
|
|
15300
|
+
let responded = false;
|
|
15301
|
+
const proxyReq = transport.request(
|
|
15302
|
+
{
|
|
15303
|
+
hostname: normalizeHostname(targetUrl.hostname),
|
|
15304
|
+
port,
|
|
15305
|
+
path: targetUrl.pathname + targetUrl.search,
|
|
15306
|
+
method,
|
|
15307
|
+
headers: targetHeaders,
|
|
15308
|
+
agent: fetchProxyAgentFor(targetUrl),
|
|
15309
|
+
...loopbackTlsOptions(targetUrl)
|
|
15310
|
+
},
|
|
15311
|
+
(upstream) => {
|
|
15312
|
+
responded = true;
|
|
15313
|
+
resolve5(upstream);
|
|
15314
|
+
}
|
|
15315
|
+
);
|
|
15316
|
+
const abort = () => proxyReq.destroy();
|
|
15317
|
+
req.once("aborted", abort);
|
|
15318
|
+
proxyReq.once("close", () => req.off("aborted", abort));
|
|
15319
|
+
let failed = false;
|
|
15320
|
+
proxyReq.on("error", (err) => {
|
|
15321
|
+
if (failed) return;
|
|
15322
|
+
failed = true;
|
|
15323
|
+
if (proxyReq.reusedSocket && !responded && !clientAborted && err.code === "ECONNRESET")
|
|
15324
|
+
resolve5(send());
|
|
15325
|
+
else reject(err);
|
|
15326
|
+
});
|
|
15327
|
+
if (nextBody === void 0) proxyReq.end();
|
|
15328
|
+
else proxyReq.end(nextBody);
|
|
15329
|
+
});
|
|
15330
|
+
const proxyRes = await send().finally(() => req.off("aborted", markAborted));
|
|
15331
|
+
const status = proxyRes.statusCode ?? 502;
|
|
15332
|
+
const location = proxyRes.headers.location;
|
|
15333
|
+
const hopCookies = [...setCookies, ...proxyRes.headers["set-cookie"] ?? []];
|
|
15334
|
+
if (req.headers[FETCH_PROXY_NATIVE_COOKIE_HEADER] !== void 0) {
|
|
15335
|
+
const hop = {
|
|
15336
|
+
url: upstreamUrl.href,
|
|
15337
|
+
status,
|
|
15338
|
+
location: location ?? null,
|
|
15339
|
+
cookies: hopCookies,
|
|
15340
|
+
redirectLimit: 10
|
|
15341
|
+
};
|
|
15342
|
+
res.setHeader(FETCH_PROXY_NATIVE_COOKIE_RESPONSE_HEADER, nativeCookieHopHeader(hop));
|
|
15343
|
+
await route.respond(proxyRes, hopCookies);
|
|
15344
|
+
if (isNativeCookieRedirect(hop)) res.removeHeader("location");
|
|
15345
|
+
res.statusCode = isNativeCookieRedirect(hop) ? 200 : status;
|
|
15346
|
+
await (0, import_promises3.pipeline)(proxyRes, res);
|
|
15347
|
+
return;
|
|
15348
|
+
}
|
|
15349
|
+
if (location && (status === 301 || status === 302 || status === 303 || status === 307 || status === 308)) {
|
|
15350
|
+
if (redirects >= 10) {
|
|
15351
|
+
proxyRes.destroy();
|
|
15352
|
+
throw new Error("too many redirects");
|
|
15353
|
+
}
|
|
15354
|
+
const switchToGet = (status === 301 || status === 302) && method === "POST" || status === 303 && method !== "GET" && method !== "HEAD";
|
|
15355
|
+
const redirectUrl = resolveRedirectUrl(location, targetUrl);
|
|
15356
|
+
proxyRes.resume();
|
|
15357
|
+
await (0, import_promises3.finished)(proxyRes);
|
|
15358
|
+
await proxy(
|
|
15359
|
+
redirectUrl,
|
|
15360
|
+
switchToGet ? "GET" : method,
|
|
15361
|
+
switchToGet ? void 0 : nextBody,
|
|
15362
|
+
redirects + 1,
|
|
15363
|
+
hopCookies
|
|
15364
|
+
);
|
|
15365
|
+
return;
|
|
15366
|
+
}
|
|
15367
|
+
if (redirects > 0) res.setHeader(FETCH_PROXY_RESPONSE_URL_HEADER, targetUrl.href);
|
|
15368
|
+
await route.respond(proxyRes, hopCookies);
|
|
15369
|
+
res.statusCode = status;
|
|
15370
|
+
if (isBundleProxyRequestUrl(req.url) && method === "GET" && status === 200 && targetUrl.pathname.endsWith(".bundle")) {
|
|
15371
|
+
await forwardRolldownBundleResponse(proxyRes, res);
|
|
15372
|
+
return;
|
|
15373
|
+
}
|
|
15374
|
+
await (0, import_promises3.pipeline)(proxyRes, res);
|
|
15375
|
+
};
|
|
15376
|
+
let body;
|
|
15377
|
+
try {
|
|
15378
|
+
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
15379
|
+
const chunks = [];
|
|
15380
|
+
for await (const chunk of req) {
|
|
15381
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
15382
|
+
}
|
|
15383
|
+
if (chunks.length > 0) {
|
|
15384
|
+
body = Buffer.concat(chunks);
|
|
15385
|
+
}
|
|
15386
|
+
}
|
|
15387
|
+
await proxy(upstreamUrl, originalMethod, body, 0, []);
|
|
15388
|
+
} catch (err) {
|
|
15389
|
+
const norm = normalizeHostname(upstreamUrl.hostname);
|
|
15390
|
+
if (!res.headersSent && isLoopbackHost(norm) && err?.code === "ECONNREFUSED") {
|
|
15391
|
+
const altHosts = norm === "::1" ? ["127.0.0.1"] : norm === "127.0.0.1" ? ["[::1]"] : ["[::1]", "127.0.0.1"];
|
|
15392
|
+
for (const altHost of altHosts) {
|
|
15393
|
+
try {
|
|
15394
|
+
const altUrl = new URL(upstreamUrl.href);
|
|
15395
|
+
altUrl.hostname = altHost;
|
|
15396
|
+
await proxy(altUrl, originalMethod, body, 0, []);
|
|
15397
|
+
return;
|
|
15398
|
+
} catch {
|
|
15399
|
+
}
|
|
15400
|
+
}
|
|
15401
|
+
}
|
|
15402
|
+
if (!res.headersSent && reportFailure) {
|
|
15403
|
+
const code = err?.code;
|
|
15404
|
+
res.statusCode = 502;
|
|
15405
|
+
res.setHeader(
|
|
15406
|
+
FETCH_PROXY_FAILURE_HEADER,
|
|
15407
|
+
typeof code === "string" ? code : "unknown"
|
|
15408
|
+
);
|
|
15409
|
+
applyFetchProxyCors(req, res);
|
|
15410
|
+
res.end();
|
|
15411
|
+
return;
|
|
15412
|
+
}
|
|
15413
|
+
if (req instanceof import_node_http2.Http2ServerRequest)
|
|
15414
|
+
req.stream.destroy(new Error("fetch proxy upstream failed", { cause: err }));
|
|
15415
|
+
else req.socket.destroy();
|
|
15416
|
+
}
|
|
15417
|
+
}
|
|
15418
|
+
|
|
15419
|
+
// src/vite-plugin-one.ts
|
|
15420
|
+
init_replacement_module_handler();
|
|
15421
|
+
|
|
15422
|
+
// src/one-widget-metadata.ts
|
|
15423
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
15424
|
+
var import_node_child_process3 = require("node:child_process");
|
|
15425
|
+
var import_node_crypto5 = require("node:crypto");
|
|
15426
|
+
var import_node_fs12 = __toESM(require("node:fs"), 1);
|
|
15427
|
+
var import_node_module2 = require("node:module");
|
|
15428
|
+
var import_node_path11 = __toESM(require("node:path"), 1);
|
|
15429
|
+
var import_node_util = require("node:util");
|
|
15430
|
+
|
|
15431
|
+
// cli/internal-child.ts
|
|
15432
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
15433
|
+
var RNX_FORKED_SCRIPT_ENV = "PEACH_RUNS_FORKED_SCRIPTS";
|
|
15434
|
+
|
|
14296
15435
|
// src/one-widget-metadata.ts
|
|
15436
|
+
init_is_record();
|
|
14297
15437
|
init_swift_source_file();
|
|
14298
15438
|
init_swift_submit();
|
|
14299
15439
|
var run = (0, import_node_util.promisify)(import_node_child_process3.execFile);
|
|
@@ -14316,8 +15456,8 @@ fs.writeFileSync(process.argv[2], JSON.stringify({
|
|
|
14316
15456
|
function configStamp(files) {
|
|
14317
15457
|
return JSON.stringify(
|
|
14318
15458
|
files.map((file) => {
|
|
14319
|
-
if (!
|
|
14320
|
-
const stat =
|
|
15459
|
+
if (!import_node_fs12.default.existsSync(file)) return [file, null];
|
|
15460
|
+
const stat = import_node_fs12.default.statSync(file);
|
|
14321
15461
|
return [file, stat.mtimeMs, stat.ctimeMs, stat.size];
|
|
14322
15462
|
})
|
|
14323
15463
|
);
|
|
@@ -14328,13 +15468,13 @@ async function readConfig(root) {
|
|
|
14328
15468
|
const reading = reads.get(root);
|
|
14329
15469
|
if (reading) return reading;
|
|
14330
15470
|
const promise = (async () => {
|
|
14331
|
-
(0, import_node_module2.createRequire)(
|
|
14332
|
-
const cache =
|
|
14333
|
-
|
|
14334
|
-
const directory =
|
|
14335
|
-
const script =
|
|
14336
|
-
const result =
|
|
14337
|
-
|
|
15471
|
+
(0, import_node_module2.createRequire)(import_node_path11.default.join(root, "package.json")).resolve("one/vite");
|
|
15472
|
+
const cache = import_node_path11.default.join(root, "node_modules/.cache/peach-widget-config");
|
|
15473
|
+
import_node_fs12.default.mkdirSync(cache, { recursive: true });
|
|
15474
|
+
const directory = import_node_fs12.default.mkdtempSync(import_node_path11.default.join(cache, "read-"));
|
|
15475
|
+
const script = import_node_path11.default.join(directory, "read.mjs");
|
|
15476
|
+
const result = import_node_path11.default.join(directory, "result.json");
|
|
15477
|
+
import_node_fs12.default.writeFileSync(script, CONFIG_CHILD);
|
|
14338
15478
|
try {
|
|
14339
15479
|
await run(process.execPath, [script, result], {
|
|
14340
15480
|
cwd: root,
|
|
@@ -14342,7 +15482,7 @@ async function readConfig(root) {
|
|
|
14342
15482
|
timeout: 3e4,
|
|
14343
15483
|
maxBuffer: 1024 * 1024
|
|
14344
15484
|
});
|
|
14345
|
-
const value = JSON.parse(
|
|
15485
|
+
const value = JSON.parse(import_node_fs12.default.readFileSync(result, "utf8"));
|
|
14346
15486
|
if (!isRecord(value) || !Array.isArray(value.watched) || !value.watched.every((file) => typeof file === "string"))
|
|
14347
15487
|
throw new Error("One config loader returned invalid dependencies");
|
|
14348
15488
|
if (!Array.isArray(value.urlSchemes) || !value.urlSchemes.every(
|
|
@@ -14365,8 +15505,8 @@ async function readConfig(root) {
|
|
|
14365
15505
|
}
|
|
14366
15506
|
const watched = [
|
|
14367
15507
|
.../* @__PURE__ */ new Set([
|
|
14368
|
-
|
|
14369
|
-
...value.watched.map((file) =>
|
|
15508
|
+
import_node_path11.default.join(root, "package.json"),
|
|
15509
|
+
...value.watched.map((file) => import_node_path11.default.resolve(root, file))
|
|
14370
15510
|
])
|
|
14371
15511
|
];
|
|
14372
15512
|
const loaded3 = {
|
|
@@ -14378,7 +15518,7 @@ async function readConfig(root) {
|
|
|
14378
15518
|
configs.set(root, loaded3);
|
|
14379
15519
|
return loaded3;
|
|
14380
15520
|
} finally {
|
|
14381
|
-
|
|
15521
|
+
import_node_fs12.default.rmSync(directory, { recursive: true, force: true });
|
|
14382
15522
|
}
|
|
14383
15523
|
})();
|
|
14384
15524
|
reads.set(root, promise);
|
|
@@ -14399,13 +15539,13 @@ function declaredFamilies(source) {
|
|
|
14399
15539
|
return home;
|
|
14400
15540
|
}
|
|
14401
15541
|
async function readOneWidgetSources(appRoot) {
|
|
14402
|
-
const root =
|
|
15542
|
+
const root = import_node_fs12.default.realpathSync(appRoot);
|
|
14403
15543
|
const config = await readConfig(root);
|
|
14404
15544
|
if (!config.widget) return null;
|
|
14405
15545
|
const widget = config.widget;
|
|
14406
15546
|
const sourceFiles = {
|
|
14407
|
-
"OneWidget.swift":
|
|
14408
|
-
"OneWidgetContract.swift":
|
|
15547
|
+
"OneWidget.swift": import_node_path11.default.join(root, "ios/OneWidgets/OneWidget.swift"),
|
|
15548
|
+
"OneWidgetContract.swift": import_node_path11.default.join(
|
|
14409
15549
|
root,
|
|
14410
15550
|
"ios",
|
|
14411
15551
|
widget.appName,
|
|
@@ -14415,14 +15555,14 @@ async function readOneWidgetSources(appRoot) {
|
|
|
14415
15555
|
const files = /* @__PURE__ */ new Map();
|
|
14416
15556
|
const sources = {};
|
|
14417
15557
|
for (const [name2, file] of Object.entries(sourceFiles)) {
|
|
14418
|
-
if (!
|
|
15558
|
+
if (!import_node_fs12.default.existsSync(file))
|
|
14419
15559
|
throw new Error(`missing One widget prebuild source ${file}; run one prebuild`);
|
|
14420
15560
|
const bytes = readPackageFile(root, file, MAX_SWIFT_COMPILE_SOURCE_BYTES);
|
|
14421
15561
|
const text2 = bytes.toString("utf8");
|
|
14422
15562
|
if (!Buffer.from(text2).equals(bytes))
|
|
14423
15563
|
throw new Error(`One widget prebuild source is not UTF-8: ${file}`);
|
|
14424
15564
|
files.set(name2, text2);
|
|
14425
|
-
sources[
|
|
15565
|
+
sources[import_node_path11.default.relative(root, file).split(import_node_path11.default.sep).join("/")] = (0, import_node_crypto5.createHash)("sha256").update(bytes).digest("hex");
|
|
14426
15566
|
}
|
|
14427
15567
|
const contract = files.get("OneWidgetContract.swift") ?? "";
|
|
14428
15568
|
const source = files.get("OneWidget.swift") ?? "";
|
|
@@ -14590,7 +15730,7 @@ function peachPlugin(options = {}) {
|
|
|
14590
15730
|
}
|
|
14591
15731
|
res.setHeader(key, value);
|
|
14592
15732
|
}
|
|
14593
|
-
const forward = res.statusCode === 200 ? forwardRolldownBundleResponse(upstream, res) : (0,
|
|
15733
|
+
const forward = res.statusCode === 200 ? forwardRolldownBundleResponse(upstream, res) : (0, import_promises5.pipeline)(upstream, res);
|
|
14594
15734
|
forward.catch(
|
|
14595
15735
|
(error) => res.destroy(error instanceof Error ? error : new Error(String(error)))
|
|
14596
15736
|
);
|
|
@@ -14609,11 +15749,11 @@ function peachPlugin(options = {}) {
|
|
|
14609
15749
|
let swiftModuleRoot;
|
|
14610
15750
|
const moduleRootFor = () => {
|
|
14611
15751
|
if (swiftModuleRoot === void 0) {
|
|
14612
|
-
const moduleRoot =
|
|
14613
|
-
|
|
15752
|
+
const moduleRoot = import_path5.default.resolve(
|
|
15753
|
+
import_path5.default.dirname((0, import_node_url.fileURLToPath)(__sootsim_import_meta_url)),
|
|
14614
15754
|
"../../sootsim-swift"
|
|
14615
15755
|
);
|
|
14616
|
-
swiftModuleRoot =
|
|
15756
|
+
swiftModuleRoot = import_fs6.default.existsSync(import_path5.default.join(moduleRoot, "toolchain.json")) ? moduleRoot : null;
|
|
14617
15757
|
}
|
|
14618
15758
|
return swiftModuleRoot ?? void 0;
|
|
14619
15759
|
};
|
|
@@ -14698,15 +15838,15 @@ function peachPlugin(options = {}) {
|
|
|
14698
15838
|
});
|
|
14699
15839
|
}
|
|
14700
15840
|
server.watcher.on("add", (file) => {
|
|
14701
|
-
if (
|
|
15841
|
+
if (import_path5.default.basename(file) === "Package.swift") swiftPackages = void 0;
|
|
14702
15842
|
});
|
|
14703
15843
|
server.watcher.on("unlink", (file) => {
|
|
14704
|
-
if (
|
|
15844
|
+
if (import_path5.default.basename(file) === "Package.swift") swiftPackages = void 0;
|
|
14705
15845
|
});
|
|
14706
15846
|
let kotlinModuleRoot;
|
|
14707
15847
|
server.watcher.on("all", (_event, file) => {
|
|
14708
15848
|
if (!kotlinModuleRoot) return;
|
|
14709
|
-
if (file.endsWith(".kt") || file.startsWith(`${kotlinModuleRoot}${
|
|
15849
|
+
if (file.endsWith(".kt") || file.startsWith(`${kotlinModuleRoot}${import_path5.default.sep}`))
|
|
14710
15850
|
sendSwiftChange({ type: "kotlin", packageName: "kotlin" });
|
|
14711
15851
|
});
|
|
14712
15852
|
server.middlewares.use((req, res, next) => {
|
|
@@ -14717,7 +15857,7 @@ function peachPlugin(options = {}) {
|
|
|
14717
15857
|
const root = host.peachKotlinModuleRoot();
|
|
14718
15858
|
kotlinModuleRoot = root;
|
|
14719
15859
|
server.watcher.add(
|
|
14720
|
-
["sdk.tar.gz", "toolchain.json"].map((file) =>
|
|
15860
|
+
["sdk.tar.gz", "toolchain.json"].map((file) => import_path5.default.join(root, file))
|
|
14721
15861
|
);
|
|
14722
15862
|
}
|
|
14723
15863
|
const served = await host.serveKotlinRequest(pathname, res, {
|
|
@@ -14748,7 +15888,7 @@ function peachPlugin(options = {}) {
|
|
|
14748
15888
|
for (const packageName of activeSwiftPackages) {
|
|
14749
15889
|
const packagePath = packages.get(packageName);
|
|
14750
15890
|
const widgetChanged = packageName === "OneWidgets" && widgetPackage?.watched.includes(file);
|
|
14751
|
-
if (!widgetChanged && !(packagePath && file.startsWith(`${packagePath}${
|
|
15891
|
+
if (!widgetChanged && !(packagePath && file.startsWith(`${packagePath}${import_path5.default.sep}`)) && !(moduleRoot && file.startsWith(`${moduleRoot}${import_path5.default.sep}`)))
|
|
14752
15892
|
continue;
|
|
14753
15893
|
void packageMetadata(packageName, moduleRoot).then((metadata) => {
|
|
14754
15894
|
sendSwiftChange({
|
|
@@ -14818,7 +15958,7 @@ function peachPlugin(options = {}) {
|
|
|
14818
15958
|
);
|
|
14819
15959
|
};
|
|
14820
15960
|
const buildShellHtml = (runtimeRoot, origin) => {
|
|
14821
|
-
const html =
|
|
15961
|
+
const html = import_fs6.default.readFileSync(import_path5.default.join(runtimeRoot, "index.html"), "utf8");
|
|
14822
15962
|
const lock = readDaemonLockfile();
|
|
14823
15963
|
const bridgePort = lock && isDaemonLockfileFresh(lock) && lock.bridgePort > 0 ? lock.bridgePort : DEFAULT_SOOTSIM_BRIDGE_PORT;
|
|
14824
15964
|
const inject = `<script>(function(){var u=new URL(location.href);var b=${JSON.stringify(bundleForOrigin(origin))};if(!u.searchParams.has('bundle'))u.searchParams.set('bundle',b);window.__sootsimBridgePort=${bridgePort};window.__peachPageServingAuthority='contributor';history.replaceState(null,'','${prefix2}/'+u.search)})()</script>`;
|
|
@@ -14883,6 +16023,7 @@ function peachPlugin(options = {}) {
|
|
|
14883
16023
|
});
|
|
14884
16024
|
});
|
|
14885
16025
|
server.middlewares.use((req, res, next) => {
|
|
16026
|
+
if (serveBrowserProxyRoute(req, res)) return;
|
|
14886
16027
|
const url = req.url || "";
|
|
14887
16028
|
const pathname = url.split("?")[0];
|
|
14888
16029
|
const runtimeRoot = resolveRuntimeRootForRequestHost(req.headers.host);
|
|
@@ -14903,8 +16044,7 @@ function peachPlugin(options = {}) {
|
|
|
14903
16044
|
}
|
|
14904
16045
|
}
|
|
14905
16046
|
if (pathname === prefix2 || pathname === prefix2 + "/") {
|
|
14906
|
-
res
|
|
14907
|
-
res.end(buildShellHtml(runtimeRoot, requestOrigin(req)));
|
|
16047
|
+
sendShellHtml(res, buildShellHtml(runtimeRoot, requestOrigin(req)));
|
|
14908
16048
|
return;
|
|
14909
16049
|
}
|
|
14910
16050
|
if (pathname.startsWith(prefix2 + "/")) {
|
|
@@ -14916,10 +16056,9 @@ function peachPlugin(options = {}) {
|
|
|
14916
16056
|
serveRuntimeFile(req, res, fullPath);
|
|
14917
16057
|
return;
|
|
14918
16058
|
}
|
|
14919
|
-
const ext =
|
|
16059
|
+
const ext = import_path5.default.extname(pathname);
|
|
14920
16060
|
if (!ext) {
|
|
14921
|
-
res
|
|
14922
|
-
res.end(buildShellHtml(runtimeRoot, requestOrigin(req)));
|
|
16061
|
+
sendShellHtml(res, buildShellHtml(runtimeRoot, requestOrigin(req)));
|
|
14923
16062
|
return;
|
|
14924
16063
|
}
|
|
14925
16064
|
}
|
|
@@ -14943,24 +16082,24 @@ function peachPlugin(options = {}) {
|
|
|
14943
16082
|
|
|
14944
16083
|
// src/metro-plugin.ts
|
|
14945
16084
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
14946
|
-
var
|
|
16085
|
+
var import_fs7 = __toESM(require("fs"), 1);
|
|
14947
16086
|
var import_module2 = require("module");
|
|
14948
16087
|
var import_node_crypto8 = require("node:crypto");
|
|
14949
|
-
var
|
|
16088
|
+
var import_path6 = __toESM(require("path"), 1);
|
|
14950
16089
|
init_app_project();
|
|
14951
16090
|
|
|
14952
16091
|
// src/android-autolinking.ts
|
|
14953
16092
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
14954
16093
|
var import_node_child_process4 = require("node:child_process");
|
|
14955
|
-
var
|
|
16094
|
+
var import_node_fs14 = __toESM(require("node:fs"), 1);
|
|
14956
16095
|
var import_node_module3 = require("node:module");
|
|
14957
|
-
var
|
|
16096
|
+
var import_node_path13 = __toESM(require("node:path"), 1);
|
|
14958
16097
|
var import_node_util2 = require("node:util");
|
|
14959
16098
|
init_is_record();
|
|
14960
16099
|
var run2 = (0, import_node_util2.promisify)(import_node_child_process4.execFile);
|
|
14961
16100
|
var resolving = /* @__PURE__ */ new Map();
|
|
14962
16101
|
async function resolveExpoAndroidAutolinking(appRoot) {
|
|
14963
|
-
const root =
|
|
16102
|
+
const root = import_node_fs14.default.realpathSync(appRoot);
|
|
14964
16103
|
const existing = resolving.get(root);
|
|
14965
16104
|
if (existing) return existing;
|
|
14966
16105
|
const pending = resolveAndroidModules(root);
|
|
@@ -14974,7 +16113,7 @@ async function resolveExpoAndroidAutolinking(appRoot) {
|
|
|
14974
16113
|
async function resolveAndroidModules(appRoot) {
|
|
14975
16114
|
let autolinker;
|
|
14976
16115
|
try {
|
|
14977
|
-
autolinker = (0, import_node_module3.createRequire)(
|
|
16116
|
+
autolinker = (0, import_node_module3.createRequire)(import_node_path13.default.join(appRoot, "package.json")).resolve(
|
|
14978
16117
|
"expo-modules-autolinking/package.json"
|
|
14979
16118
|
);
|
|
14980
16119
|
} catch (error) {
|
|
@@ -14984,7 +16123,7 @@ async function resolveAndroidModules(appRoot) {
|
|
|
14984
16123
|
const { stdout } = await run2(
|
|
14985
16124
|
process.execPath,
|
|
14986
16125
|
[
|
|
14987
|
-
|
|
16126
|
+
import_node_path13.default.join(import_node_path13.default.dirname(autolinker), "bin/expo-modules-autolinking.js"),
|
|
14988
16127
|
"resolve",
|
|
14989
16128
|
"--platform",
|
|
14990
16129
|
"android",
|
|
@@ -15219,7 +16358,7 @@ function resolveNativeAppIconArtwork(resources, readText, resourceUri, icons, pr
|
|
|
15219
16358
|
isRecord(dictionary.CFBundleAlternateIcons) ? dictionary.CFBundleAlternateIcons : {}
|
|
15220
16359
|
).map(([name2, declaration]) => [resolveReference(name2), declaration])
|
|
15221
16360
|
);
|
|
15222
|
-
const
|
|
16361
|
+
const resolve5 = (declaration, defaultName) => {
|
|
15223
16362
|
const entry = isRecord(declaration) ? declaration : {};
|
|
15224
16363
|
const name2 = typeof entry.CFBundleIconName === "string" ? resolveReference(entry.CFBundleIconName) : resolveReference(defaultName);
|
|
15225
16364
|
const catalogs = resources.filter(
|
|
@@ -15270,12 +16409,12 @@ function resolveNativeAppIconArtwork(resources, readText, resourceUri, icons, pr
|
|
|
15270
16409
|
return uri ? [{ uri, scale }] : [];
|
|
15271
16410
|
}).sort((a, b) => a.scale - b.scale);
|
|
15272
16411
|
};
|
|
15273
|
-
const primary =
|
|
16412
|
+
const primary = resolve5(dictionary.CFBundlePrimaryIcon, primaryName);
|
|
15274
16413
|
return {
|
|
15275
16414
|
...primary.length ? { primary } : {},
|
|
15276
16415
|
alternates: Object.fromEntries(
|
|
15277
16416
|
alternateNames.flatMap((name2) => {
|
|
15278
|
-
const images =
|
|
16417
|
+
const images = resolve5(alternates[name2], name2);
|
|
15279
16418
|
return images.length ? [[name2, images]] : [];
|
|
15280
16419
|
})
|
|
15281
16420
|
)
|
|
@@ -15382,7 +16521,7 @@ function parseOpenStepPlist(text2) {
|
|
|
15382
16521
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
15383
16522
|
var NEVER_MEMBER = /(?:^|\/)(?:Info\.plist|[^/]+\.entitlements|[^/]+\.xcconfig|\.DS_Store)$/;
|
|
15384
16523
|
var BUNDLE_DIR = /\.(xcassets|bundle|lproj|xcdatamodeld|scnassets|spriteatlas|rcproject|storyboardc|icon)$/;
|
|
15385
|
-
function xcodePathResolver(objects, projectDir,
|
|
16524
|
+
function xcodePathResolver(objects, projectDir, join7) {
|
|
15386
16525
|
const parents = /* @__PURE__ */ new Map();
|
|
15387
16526
|
for (const [id, entry] of Object.entries(objects)) {
|
|
15388
16527
|
if (!isDict(entry)) continue;
|
|
@@ -15391,7 +16530,7 @@ function xcodePathResolver(objects, projectDir, join6) {
|
|
|
15391
16530
|
}
|
|
15392
16531
|
}
|
|
15393
16532
|
const paths = /* @__PURE__ */ new Map();
|
|
15394
|
-
const
|
|
16533
|
+
const resolve5 = (id) => {
|
|
15395
16534
|
if (paths.has(id)) return paths.get(id);
|
|
15396
16535
|
paths.set(id, null);
|
|
15397
16536
|
const entry = objects[id];
|
|
@@ -15400,19 +16539,19 @@ function xcodePathResolver(objects, projectDir, join6) {
|
|
|
15400
16539
|
const own = str(entry.path) ?? "";
|
|
15401
16540
|
const tree = str(entry.sourceTree) ?? "<group>";
|
|
15402
16541
|
if (tree === "<absolute>") result = own;
|
|
15403
|
-
else if (tree === "SOURCE_ROOT") result =
|
|
16542
|
+
else if (tree === "SOURCE_ROOT") result = join7(projectDir, own);
|
|
15404
16543
|
else if (tree === "<group>") {
|
|
15405
16544
|
const parent = parents.get(id);
|
|
15406
|
-
const base = parent ?
|
|
15407
|
-
if (base !== null) result =
|
|
16545
|
+
const base = parent ? resolve5(parent) : projectDir;
|
|
16546
|
+
if (base !== null) result = join7(base, own);
|
|
15408
16547
|
}
|
|
15409
16548
|
}
|
|
15410
16549
|
paths.set(id, result);
|
|
15411
16550
|
return result;
|
|
15412
16551
|
};
|
|
15413
|
-
return
|
|
16552
|
+
return resolve5;
|
|
15414
16553
|
}
|
|
15415
|
-
function visitXcodeTargetMembers(objects, targetId, resolvePath, filesUnder,
|
|
16554
|
+
function visitXcodeTargetMembers(objects, targetId, resolvePath, filesUnder, join7, visit3) {
|
|
15416
16555
|
const target = objects[targetId];
|
|
15417
16556
|
if (!isDict(target)) return;
|
|
15418
16557
|
for (const phaseId of list(target.buildPhases)) {
|
|
@@ -15448,7 +16587,7 @@ function visitXcodeTargetMembers(objects, targetId, resolvePath, filesUnder, joi
|
|
|
15448
16587
|
for (const relative3 of list(exception.membershipExceptions))
|
|
15449
16588
|
exceptions.add(relative3);
|
|
15450
16589
|
}
|
|
15451
|
-
const members = owned.has(groupId) ? filesUnder(folder) : [...exceptions].flatMap((relative3) => filesUnder(
|
|
16590
|
+
const members = owned.has(groupId) ? filesUnder(folder) : [...exceptions].flatMap((relative3) => filesUnder(join7(folder, relative3)));
|
|
15452
16591
|
for (const file of members) {
|
|
15453
16592
|
const relative3 = file.slice(prefix2.length);
|
|
15454
16593
|
const excepted = [...exceptions].some(
|
|
@@ -15602,10 +16741,10 @@ function appTargetReleaseSettings(pbxproj, targetName, infoPlistRelativePath) {
|
|
|
15602
16741
|
var APP_DELEGATE_PATH_RE = /(?:^|\/)ios\/([^/]+)\/AppDelegate\.(?:swift|mm|m)$/;
|
|
15603
16742
|
function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri) {
|
|
15604
16743
|
const pbxprojPath = Object.keys(files).find(
|
|
15605
|
-
(
|
|
16744
|
+
(path22) => /(?:^|\/)ios\/[^/]+\.xcodeproj\/project\.pbxproj$/.test(path22)
|
|
15606
16745
|
) ?? Object.keys(files).find(
|
|
15607
|
-
(
|
|
15608
|
-
) ?? Object.keys(files).find((
|
|
16746
|
+
(path22) => /(?:^|\/)[^/]+\.xcodeproj\/project\.pbxproj$/.test(path22)
|
|
16747
|
+
) ?? Object.keys(files).find((path22) => /(?:^|\/)project\.pbxproj$/.test(path22));
|
|
15609
16748
|
if (!pbxprojPath) return null;
|
|
15610
16749
|
const pbxproj = files[pbxprojPath];
|
|
15611
16750
|
let objects = {};
|
|
@@ -15647,7 +16786,7 @@ function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri)
|
|
|
15647
16786
|
} else if (applicationTargetNames.size === 1) {
|
|
15648
16787
|
targetName = [...applicationTargetNames][0];
|
|
15649
16788
|
} else if (applicationTargetNames.size > 1) {
|
|
15650
|
-
const delegateTargets = Object.keys(files).filter((
|
|
16789
|
+
const delegateTargets = Object.keys(files).filter((path22) => !path22.includes("/Pods/")).map((path22) => path22.match(APP_DELEGATE_PATH_RE)?.[1]).filter(
|
|
15651
16790
|
(name2) => typeof name2 === "string" && applicationTargetNames.has(name2)
|
|
15652
16791
|
);
|
|
15653
16792
|
if (delegateTargets.length === 1) {
|
|
@@ -15845,7 +16984,7 @@ function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri)
|
|
|
15845
16984
|
if (resourceUri) {
|
|
15846
16985
|
if (!selectedTarget)
|
|
15847
16986
|
throw new Error("native app icon target membership is unresolved");
|
|
15848
|
-
const
|
|
16987
|
+
const join7 = (base, own) => {
|
|
15849
16988
|
const segments = [];
|
|
15850
16989
|
for (const segment of `${base}/${own}`.split("/")) {
|
|
15851
16990
|
if (segment === "" || segment === ".") continue;
|
|
@@ -15858,7 +16997,7 @@ function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri)
|
|
|
15858
16997
|
const project = Object.values(objects).find(
|
|
15859
16998
|
(object2) => isRecord(object2) && object2.isa === "PBXProject"
|
|
15860
16999
|
);
|
|
15861
|
-
const projectDir =
|
|
17000
|
+
const projectDir = join7(
|
|
15862
17001
|
pbxprojPath.replace(/(?:^|\/)[^/]+\.xcodeproj\/project\.pbxproj$/, ""),
|
|
15863
17002
|
isRecord(project) && typeof project.projectDirPath === "string" ? project.projectDirPath : ""
|
|
15864
17003
|
);
|
|
@@ -15866,15 +17005,15 @@ function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri)
|
|
|
15866
17005
|
visitXcodeTargetMembers(
|
|
15867
17006
|
objects,
|
|
15868
17007
|
selectedTarget.id,
|
|
15869
|
-
xcodePathResolver(objects, projectDir,
|
|
17008
|
+
xcodePathResolver(objects, projectDir, join7),
|
|
15870
17009
|
(file) => {
|
|
15871
17010
|
if (Object.hasOwn(files, file)) return [file];
|
|
15872
17011
|
const prefix2 = file === "" ? "" : `${file.replace(/\/$/, "")}/`;
|
|
15873
17012
|
return paths.filter(
|
|
15874
|
-
(
|
|
17013
|
+
(path22) => path22.startsWith(prefix2) && !/(?:^|\/)\./.test(path22.slice(prefix2.length))
|
|
15875
17014
|
);
|
|
15876
17015
|
},
|
|
15877
|
-
|
|
17016
|
+
join7,
|
|
15878
17017
|
(file, kind) => {
|
|
15879
17018
|
if (kind === "resource") resources.add(file);
|
|
15880
17019
|
}
|
|
@@ -15882,7 +17021,7 @@ function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri)
|
|
|
15882
17021
|
}
|
|
15883
17022
|
const rootModuleName = readRootModuleName(
|
|
15884
17023
|
Object.entries(files).filter(
|
|
15885
|
-
([
|
|
17024
|
+
([path22]) => !path22.includes("/Pods/") && (/(?:^|\/)ios\/AppDelegate\.(?:swift|mm|m)$/.test(path22) || path22.match(APP_DELEGATE_PATH_RE)?.[1] === targetName)
|
|
15886
17025
|
).map(([, source]) => source)
|
|
15887
17026
|
);
|
|
15888
17027
|
return {
|
|
@@ -15968,29 +17107,72 @@ function extractNativeAppIdentityFromFiles(files, platform, parseInfoPlist, iosT
|
|
|
15968
17107
|
|
|
15969
17108
|
// src/native-app-identity-project.ts
|
|
15970
17109
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
15971
|
-
var
|
|
17110
|
+
var import_node_fs16 = __toESM(require("node:fs"), 1);
|
|
15972
17111
|
var import_node_module4 = require("node:module");
|
|
15973
|
-
var
|
|
17112
|
+
var import_node_path16 = __toESM(require("node:path"), 1);
|
|
15974
17113
|
init_is_record();
|
|
15975
17114
|
|
|
15976
|
-
// src/plist.ts
|
|
15977
|
-
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
15978
|
-
var import_plist = __toESM(require("plist"), 1);
|
|
15979
|
-
function parsePlistSource(source) {
|
|
15980
|
-
return import_plist.default.parse(source);
|
|
15981
|
-
}
|
|
15982
|
-
|
|
15983
17115
|
// src/xcode-project.ts
|
|
15984
17116
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
15985
17117
|
var import_node_child_process5 = require("node:child_process");
|
|
15986
17118
|
var import_node_crypto7 = require("node:crypto");
|
|
15987
|
-
var
|
|
15988
|
-
var
|
|
15989
|
-
var
|
|
17119
|
+
var import_node_fs15 = __toESM(require("node:fs"), 1);
|
|
17120
|
+
var import_node_path15 = __toESM(require("node:path"), 1);
|
|
17121
|
+
var import_plist3 = __toESM(require("plist"), 1);
|
|
17122
|
+
|
|
17123
|
+
// src/swift-coverage/xcode-assets.ts
|
|
17124
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
17125
|
+
var assetSymbolSettingKeys = [
|
|
17126
|
+
"ASSETCATALOG_COMPILER_GENERATE_ASSET_SYMBOLS",
|
|
17127
|
+
"ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS",
|
|
17128
|
+
"PRODUCT_BUNDLE_IDENTIFIER",
|
|
17129
|
+
"TARGETED_DEVICE_FAMILY",
|
|
17130
|
+
"ASSETCATALOG_COMPILER_GENERATE_ASSET_SYMBOL_FRAMEWORKS",
|
|
17131
|
+
"ASSETCATALOG_COMPILER_GENERATE_ASSET_SYMBOL_WARNINGS",
|
|
17132
|
+
"ASSETCATALOG_COMPILER_GENERATE_ASSET_SYMBOL_ERRORS",
|
|
17133
|
+
"ASSETCATALOG_COMPILER_GENERATE_ASSET_SYMBOL_BACKWARDS_DEPLOYMENT_SUPPORT",
|
|
17134
|
+
"ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOLS_PATH",
|
|
17135
|
+
"ASSETCATALOG_COMPILER_GENERATE_OBJC_ASSET_SYMBOLS_PATH",
|
|
17136
|
+
"ASSETCATALOG_COMPILER_GENERATE_ASSET_SYMBOL_INDEX_PATH",
|
|
17137
|
+
"ASSETCATALOG_COMPILER_BUNDLE_IDENTIFIER",
|
|
17138
|
+
"ASSETCATALOG_COMPILER_LIGHTWEIGHT_ASSET_RUNTIME_MODE",
|
|
17139
|
+
"ASSETCATALOG_OTHER_FLAGS"
|
|
17140
|
+
];
|
|
17141
|
+
var unprovenAssetSettings = assetSymbolSettingKeys.slice(4);
|
|
17142
|
+
|
|
17143
|
+
// src/swift-package.ts
|
|
17144
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
17145
|
+
var SWIFT_NATIVE_TRANSLATION_UNIT_EXTENSIONS = [
|
|
17146
|
+
".c",
|
|
17147
|
+
".cc",
|
|
17148
|
+
".cpp",
|
|
17149
|
+
".cxx",
|
|
17150
|
+
".m",
|
|
17151
|
+
".mm"
|
|
17152
|
+
];
|
|
17153
|
+
function isSwiftNativeTranslationUnit(file) {
|
|
17154
|
+
return SWIFT_NATIVE_TRANSLATION_UNIT_EXTENSIONS.some(
|
|
17155
|
+
(extension) => file.endsWith(extension)
|
|
17156
|
+
);
|
|
17157
|
+
}
|
|
17158
|
+
var SWIFT_NATIVE_SOURCE_EXTENSIONS = [
|
|
17159
|
+
...SWIFT_NATIVE_TRANSLATION_UNIT_EXTENSIONS,
|
|
17160
|
+
".h",
|
|
17161
|
+
".hh",
|
|
17162
|
+
".hpp",
|
|
17163
|
+
".hxx",
|
|
17164
|
+
".pch",
|
|
17165
|
+
".inc",
|
|
17166
|
+
".inl",
|
|
17167
|
+
".modulemap"
|
|
17168
|
+
];
|
|
17169
|
+
function moduleMapName(text2) {
|
|
17170
|
+
return /(?:^|\s)module\s+(\w+)/.exec(text2)?.[1];
|
|
17171
|
+
}
|
|
15990
17172
|
|
|
15991
17173
|
// src/xcode-json-project.ts
|
|
15992
17174
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
15993
|
-
var
|
|
17175
|
+
var import_node_path14 = __toESM(require("node:path"), 1);
|
|
15994
17176
|
var import_json52 = __toESM(require_lib(), 1);
|
|
15995
17177
|
var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
15996
17178
|
var text = (value) => typeof value === "string" ? value : void 0;
|
|
@@ -16006,7 +17188,7 @@ var PHASE_ISA = {
|
|
|
16006
17188
|
function readXcodeJsonProject(xcodeproj, source) {
|
|
16007
17189
|
const json = import_json52.default.parse(source);
|
|
16008
17190
|
if (!isJsonObject(json)) throw new Error(`${xcodeproj}/project.xcproj is not an object`);
|
|
16009
|
-
const projectDir =
|
|
17191
|
+
const projectDir = import_node_path14.default.dirname(xcodeproj);
|
|
16010
17192
|
const objects = {};
|
|
16011
17193
|
let next = 0;
|
|
16012
17194
|
const add = (entry, id) => {
|
|
@@ -16019,7 +17201,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
16019
17201
|
const base = /^<([A-Z]+)>\/(.*)$/.exec(raw);
|
|
16020
17202
|
if (base) {
|
|
16021
17203
|
if (base[1] === "PROJECT")
|
|
16022
|
-
return { sourceTree: "<absolute>", path:
|
|
17204
|
+
return { sourceTree: "<absolute>", path: import_node_path14.default.join(projectDir, base[2]) };
|
|
16023
17205
|
if (base[1] === "PRODUCTS")
|
|
16024
17206
|
return { sourceTree: "BUILT_PRODUCTS_DIR", path: base[2] };
|
|
16025
17207
|
return null;
|
|
@@ -16027,7 +17209,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
16027
17209
|
const unescaped = raw.replaceAll("\\<", "<");
|
|
16028
17210
|
if (unescaped.startsWith("/")) return { sourceTree: "<absolute>", path: unescaped };
|
|
16029
17211
|
if (unescaped.startsWith("~")) return null;
|
|
16030
|
-
return groupDir === null ? null : { sourceTree: "<absolute>", path:
|
|
17212
|
+
return groupDir === null ? null : { sourceTree: "<absolute>", path: import_node_path14.default.join(groupDir, unescaped) };
|
|
16031
17213
|
};
|
|
16032
17214
|
const memberships = [];
|
|
16033
17215
|
const folders = [];
|
|
@@ -16038,7 +17220,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
16038
17220
|
const kind = text(entry.kind) ?? "file-reference";
|
|
16039
17221
|
const raw = text(entry.path) ?? "";
|
|
16040
17222
|
const located = raw === "" ? null : locate(raw, parent.dir);
|
|
16041
|
-
const name2 = text(entry.name) ??
|
|
17223
|
+
const name2 = text(entry.name) ?? import_node_path14.default.basename(raw);
|
|
16042
17224
|
const node = { id: "", name: name2, dir: null, parent, children: [] };
|
|
16043
17225
|
if (kind === "group" || kind === "variant-group" || kind === "version-group") {
|
|
16044
17226
|
node.dir = raw === "" ? parent.dir : located?.sourceTree === "<absolute>" ? located.path : null;
|
|
@@ -16139,12 +17321,18 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
16139
17321
|
isa: "XCConfigurationList",
|
|
16140
17322
|
defaultConfigurationName: text(json["default-configuration"]) ?? "Debug",
|
|
16141
17323
|
buildConfigurations: configurations.map(({ name: name2, file }) => {
|
|
16142
|
-
const
|
|
17324
|
+
const reference = specialized.has(name2) ? specialized.get(name2) : file;
|
|
17325
|
+
const base = lookup(reference);
|
|
17326
|
+
const anchor = isObject(reference) ? lookupNode(reference.anchor, root)?.id : null;
|
|
17327
|
+
const relative3 = isObject(reference) ? text(reference["relative-path"]) : null;
|
|
16143
17328
|
return add({
|
|
16144
17329
|
isa: "XCBuildConfiguration",
|
|
16145
17330
|
name: name2,
|
|
16146
17331
|
buildSettings: settings,
|
|
16147
|
-
...base ? { baseConfigurationReference: base } : {
|
|
17332
|
+
...base ? { baseConfigurationReference: base } : anchor && relative3 ? {
|
|
17333
|
+
baseConfigurationReferenceAnchor: anchor,
|
|
17334
|
+
baseConfigurationReferenceRelativePath: relative3
|
|
17335
|
+
} : {}
|
|
16148
17336
|
});
|
|
16149
17337
|
})
|
|
16150
17338
|
});
|
|
@@ -16153,7 +17341,7 @@ function readXcodeJsonProject(xcodeproj, source) {
|
|
|
16153
17341
|
if (!isObject(entry)) continue;
|
|
16154
17342
|
const repository = text(entry.repository);
|
|
16155
17343
|
const local = text(entry.path);
|
|
16156
|
-
const name2 = local !== void 0 ?
|
|
17344
|
+
const name2 = local !== void 0 ? import_node_path14.default.basename(import_node_path14.default.resolve(import_node_path14.default.dirname(xcodeproj), local)) : import_node_path14.default.basename(repository ?? "").replace(/\.git$/, "");
|
|
16157
17345
|
const id = text(entry.kind) === "local" && local !== void 0 ? add({ isa: "XCLocalSwiftPackageReference", relativePath: local }) : add({ isa: "XCRemoteSwiftPackageReference", repositoryURL: repository ?? "" });
|
|
16158
17346
|
packageIds.set(name2.toLowerCase(), id);
|
|
16159
17347
|
}
|
|
@@ -16323,6 +17511,7 @@ function isJsonObject(value) {
|
|
|
16323
17511
|
}
|
|
16324
17512
|
|
|
16325
17513
|
// src/xcode-project.ts
|
|
17514
|
+
var XCODE_DEFAULT_IOS_DEPLOYMENT_TARGET = "27.0";
|
|
16326
17515
|
var APPLICATION = "com.apple.product-type.application";
|
|
16327
17516
|
var FRAMEWORK_PRODUCTS = /* @__PURE__ */ new Set([
|
|
16328
17517
|
"com.apple.product-type.framework",
|
|
@@ -16341,28 +17530,28 @@ var CONDITIONS = {
|
|
|
16341
17530
|
variant: "normal"
|
|
16342
17531
|
};
|
|
16343
17532
|
function walkFiles(dir) {
|
|
16344
|
-
if (!
|
|
17533
|
+
if (!import_node_fs15.default.existsSync(dir)) return [];
|
|
16345
17534
|
const out = [];
|
|
16346
|
-
for (const entry of
|
|
17535
|
+
for (const entry of import_node_fs15.default.readdirSync(dir, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
|
|
16347
17536
|
if (entry.name.startsWith(".")) continue;
|
|
16348
|
-
const full =
|
|
17537
|
+
const full = import_node_path15.default.join(dir, entry.name);
|
|
16349
17538
|
if (entry.isDirectory()) out.push(...walkFiles(full));
|
|
16350
17539
|
else if (entry.isFile()) out.push(full);
|
|
16351
17540
|
}
|
|
16352
17541
|
return out;
|
|
16353
17542
|
}
|
|
16354
|
-
var isDirectory = (dir) =>
|
|
17543
|
+
var isDirectory = (dir) => import_node_fs15.default.existsSync(dir) && import_node_fs15.default.statSync(dir).isDirectory();
|
|
16355
17544
|
function readXcconfig(file, read) {
|
|
16356
|
-
if (read.includes(file) || !
|
|
17545
|
+
if (read.includes(file) || !import_node_fs15.default.existsSync(file)) return {};
|
|
16357
17546
|
read.push(file);
|
|
16358
17547
|
const settings = {};
|
|
16359
|
-
for (const raw of
|
|
17548
|
+
for (const raw of import_node_fs15.default.readFileSync(file, "utf8").split("\n")) {
|
|
16360
17549
|
const line = raw.replace(/\/\/.*$/, "").trim();
|
|
16361
17550
|
const include = /^#include\??\s+"([^"]+)"/.exec(line);
|
|
16362
17551
|
if (include) {
|
|
16363
17552
|
Object.assign(
|
|
16364
17553
|
settings,
|
|
16365
|
-
readXcconfig(
|
|
17554
|
+
readXcconfig(import_node_path15.default.resolve(import_node_path15.default.dirname(file), include[1]), read)
|
|
16366
17555
|
);
|
|
16367
17556
|
continue;
|
|
16368
17557
|
}
|
|
@@ -16412,22 +17601,22 @@ function decodeXml(text2) {
|
|
|
16412
17601
|
return text2.replaceAll(""", '"').replaceAll("'", "'").replaceAll("<", "<").replaceAll(">", ">").replaceAll("&", "&");
|
|
16413
17602
|
}
|
|
16414
17603
|
function workspaceReferences(workspace) {
|
|
16415
|
-
const data =
|
|
16416
|
-
if (!
|
|
17604
|
+
const data = import_node_path15.default.join(workspace, "contents.xcworkspacedata");
|
|
17605
|
+
if (!import_node_fs15.default.existsSync(data))
|
|
16417
17606
|
throw new Error(`${workspace} has no contents.xcworkspacedata`);
|
|
16418
|
-
const container =
|
|
17607
|
+
const container = import_node_path15.default.dirname(workspace);
|
|
16419
17608
|
const locate = (location, base) => {
|
|
16420
17609
|
const colon = location.indexOf(":");
|
|
16421
17610
|
const kind = location.slice(0, colon);
|
|
16422
17611
|
const rest = location.slice(colon + 1);
|
|
16423
|
-
if (kind === "group") return
|
|
16424
|
-
if (kind === "container" || kind === "self") return
|
|
16425
|
-
if (kind === "absolute") return
|
|
16426
|
-
throw new Error(`${
|
|
17612
|
+
if (kind === "group") return import_node_path15.default.resolve(base, rest);
|
|
17613
|
+
if (kind === "container" || kind === "self") return import_node_path15.default.resolve(container, rest);
|
|
17614
|
+
if (kind === "absolute") return import_node_path15.default.resolve(rest);
|
|
17615
|
+
throw new Error(`${import_node_path15.default.basename(workspace)} has an unsupported location ${location}`);
|
|
16427
17616
|
};
|
|
16428
17617
|
const groups = [container];
|
|
16429
17618
|
const references = [];
|
|
16430
|
-
for (const [, closing, tag, attributes, selfClosing] of
|
|
17619
|
+
for (const [, closing, tag, attributes, selfClosing] of import_node_fs15.default.readFileSync(data, "utf8").matchAll(/<(\/?)(Group|FileRef)\b([^>]*?)(\/?)>/g)) {
|
|
16431
17620
|
if (closing) {
|
|
16432
17621
|
if (tag === "Group") groups.pop();
|
|
16433
17622
|
continue;
|
|
@@ -16443,8 +17632,8 @@ function workspaceReferences(workspace) {
|
|
|
16443
17632
|
var loaded2 = /* @__PURE__ */ new Map();
|
|
16444
17633
|
function xcodeProjectFile(xcodeproj) {
|
|
16445
17634
|
for (const name2 of ["project.pbxproj", "project.xcproj"]) {
|
|
16446
|
-
const file =
|
|
16447
|
-
if (
|
|
17635
|
+
const file = import_node_path15.default.join(xcodeproj, name2);
|
|
17636
|
+
if (import_node_fs15.default.existsSync(file)) return file;
|
|
16448
17637
|
}
|
|
16449
17638
|
return null;
|
|
16450
17639
|
}
|
|
@@ -16452,7 +17641,7 @@ function loadProject(xcodeproj) {
|
|
|
16452
17641
|
const projectFile = xcodeProjectFile(xcodeproj);
|
|
16453
17642
|
if (!projectFile)
|
|
16454
17643
|
throw new Error(`${xcodeproj} has no project.pbxproj or project.xcproj`);
|
|
16455
|
-
const source =
|
|
17644
|
+
const source = import_node_fs15.default.readFileSync(projectFile, "utf8");
|
|
16456
17645
|
const digest = (0, import_node_crypto7.createHash)("sha256").update(source).digest("hex");
|
|
16457
17646
|
const cached2 = loaded2.get(projectFile);
|
|
16458
17647
|
if (cached2?.digest === digest) return cached2.project;
|
|
@@ -16469,10 +17658,10 @@ function loadProject(xcodeproj) {
|
|
|
16469
17658
|
if (!project || project.isa !== "PBXProject") {
|
|
16470
17659
|
throw new Error(`${projectFile} has no PBXProject root`);
|
|
16471
17660
|
}
|
|
16472
|
-
const projectDir =
|
|
16473
|
-
|
|
17661
|
+
const projectDir = import_node_fs15.default.realpathSync(
|
|
17662
|
+
import_node_path15.default.resolve(import_node_path15.default.dirname(xcodeproj), str(project.projectDirPath) ?? "")
|
|
16474
17663
|
);
|
|
16475
|
-
const resolvePath = xcodePathResolver(objects, projectDir,
|
|
17664
|
+
const resolvePath = xcodePathResolver(objects, projectDir, import_node_path15.default.join);
|
|
16476
17665
|
const result = {
|
|
16477
17666
|
xcodeproj,
|
|
16478
17667
|
projectFile,
|
|
@@ -16506,8 +17695,8 @@ function targetSettings(ref, configuration, builtins, options = {}, overrides =
|
|
|
16506
17695
|
const relative3 = str(config.baseConfigurationReferenceRelativePath);
|
|
16507
17696
|
const own = isDict(config.buildSettings) ? config.buildSettings : {};
|
|
16508
17697
|
const directory = anchor ? project.resolvePath(anchor) : null;
|
|
16509
|
-
const baseFile = base ? project.resolvePath(base) : directory && relative3 ?
|
|
16510
|
-
if (options.requireSources !== false && (base || anchor || relative3) && (!baseFile || !
|
|
17698
|
+
const baseFile = base ? project.resolvePath(base) : directory && relative3 ? import_node_path15.default.resolve(directory, relative3) : null;
|
|
17699
|
+
if (options.requireSources !== false && (base || anchor || relative3) && (!baseFile || !import_node_fs15.default.existsSync(baseFile)))
|
|
16511
17700
|
throw new Error(
|
|
16512
17701
|
`Unable to open base configuration reference file '${baseFile ?? base ?? relative3 ?? anchor}'`
|
|
16513
17702
|
);
|
|
@@ -16543,34 +17732,34 @@ function targetSettings(ref, configuration, builtins, options = {}, overrides =
|
|
|
16543
17732
|
resolving2.add(marker);
|
|
16544
17733
|
const value = expand(
|
|
16545
17734
|
levels[at][key],
|
|
16546
|
-
(name2) => name2 === "inherited" ? valueAt(key, at - 1) : valueAt(name2, levels.length - 1)
|
|
17735
|
+
(name2) => name2 === "inherited" || name2 === key ? valueAt(key, at - 1) : valueAt(name2, levels.length - 1)
|
|
16547
17736
|
);
|
|
16548
17737
|
resolving2.delete(marker);
|
|
16549
17738
|
return value;
|
|
16550
17739
|
};
|
|
17740
|
+
const derivedSettings = {
|
|
17741
|
+
PRODUCT_NAME: () => get("TARGET_NAME"),
|
|
17742
|
+
PRODUCT_MODULE_NAME: () => applyOperator(get("PRODUCT_NAME"), "c99extidentifier"),
|
|
17743
|
+
EXECUTABLE_NAME: () => get("PRODUCT_NAME"),
|
|
17744
|
+
// the native default of CoreBuildSystem.xcspec
|
|
17745
|
+
EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES: () => "*.nib *.lproj *.framework *.gch *.xcode* *.xcassets *.icon (*) .DS_Store CVS .svn .git .hg *.pbproj *.pbxproj"
|
|
17746
|
+
};
|
|
17747
|
+
const get = (key) => valueAt(key, levels.length - 1);
|
|
17748
|
+
const teamPrefix = () => {
|
|
17749
|
+
const team = get("DEVELOPMENT_TEAM");
|
|
17750
|
+
return get("CODE_SIGNING_ALLOWED") !== "NO" && team ? `${team}.` : "";
|
|
17751
|
+
};
|
|
16551
17752
|
const derived = (key) => {
|
|
16552
|
-
|
|
16553
|
-
|
|
16554
|
-
|
|
16555
|
-
return get("TARGET_NAME");
|
|
16556
|
-
case "PRODUCT_MODULE_NAME":
|
|
16557
|
-
return applyOperator(get("PRODUCT_NAME"), "c99extidentifier");
|
|
16558
|
-
case "EXECUTABLE_NAME":
|
|
16559
|
-
return get("PRODUCT_NAME");
|
|
16560
|
-
// the native default of CoreBuildSystem.xcspec
|
|
16561
|
-
case "EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES":
|
|
16562
|
-
return "*.nib *.lproj *.framework *.gch *.xcode* *.xcassets *.icon (*) .DS_Store CVS .svn .git .hg *.pbproj *.pbxproj";
|
|
16563
|
-
case "AppIdentifierPrefix":
|
|
16564
|
-
case "TeamIdentifierPrefix": {
|
|
16565
|
-
const team = get("DEVELOPMENT_TEAM");
|
|
16566
|
-
return get("CODE_SIGNING_ALLOWED") !== "NO" && team ? `${team}.` : "";
|
|
16567
|
-
}
|
|
16568
|
-
}
|
|
16569
|
-
return "";
|
|
17753
|
+
if (key === "AppIdentifierPrefix" || key === "TeamIdentifierPrefix")
|
|
17754
|
+
return teamPrefix();
|
|
17755
|
+
return Object.hasOwn(derivedSettings, key) ? derivedSettings[key]() : process.env[key] ?? "";
|
|
16570
17756
|
};
|
|
16571
17757
|
return {
|
|
16572
|
-
get
|
|
16573
|
-
keys: new Set(
|
|
17758
|
+
get,
|
|
17759
|
+
keys: /* @__PURE__ */ new Set([
|
|
17760
|
+
...Object.keys(derivedSettings),
|
|
17761
|
+
...levels.flatMap((values) => Object.keys(values))
|
|
17762
|
+
]),
|
|
16574
17763
|
xcconfigs
|
|
16575
17764
|
};
|
|
16576
17765
|
}
|
|
@@ -16583,26 +17772,26 @@ function settingList(value) {
|
|
|
16583
17772
|
return items2;
|
|
16584
17773
|
}
|
|
16585
17774
|
function expandSearchPath(directory, rules) {
|
|
16586
|
-
if (
|
|
17775
|
+
if (import_node_path15.default.basename(directory) !== "**") return [directory];
|
|
16587
17776
|
const expanded = [];
|
|
16588
17777
|
const seen = /* @__PURE__ */ new Set();
|
|
16589
|
-
const queue = [
|
|
17778
|
+
const queue = [import_node_path15.default.dirname(directory)];
|
|
16590
17779
|
for (let at = 0; at < queue.length; at++) {
|
|
16591
17780
|
const current = queue[at];
|
|
16592
17781
|
let real;
|
|
16593
17782
|
try {
|
|
16594
|
-
real =
|
|
17783
|
+
real = import_node_fs15.default.realpathSync(current);
|
|
16595
17784
|
} catch {
|
|
16596
17785
|
continue;
|
|
16597
17786
|
}
|
|
16598
|
-
if (!
|
|
17787
|
+
if (!import_node_fs15.default.statSync(real).isDirectory() || seen.has(real)) continue;
|
|
16599
17788
|
seen.add(real);
|
|
16600
17789
|
expanded.push(current);
|
|
16601
|
-
for (const entry of
|
|
17790
|
+
for (const entry of import_node_fs15.default.readdirSync(real, { withFileTypes: true }).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0)) {
|
|
16602
17791
|
if (entry.isSymbolicLink() ? !rules.followLinks : !entry.isDirectory()) continue;
|
|
16603
17792
|
if (rules.excluded.some((pattern) => pattern.test(entry.name)) && !rules.included.some((pattern) => pattern.test(entry.name)))
|
|
16604
17793
|
continue;
|
|
16605
|
-
queue.push(
|
|
17794
|
+
queue.push(import_node_path15.default.join(current, entry.name));
|
|
16606
17795
|
}
|
|
16607
17796
|
}
|
|
16608
17797
|
return expanded;
|
|
@@ -16644,6 +17833,9 @@ function expand(value, lookup) {
|
|
|
16644
17833
|
);
|
|
16645
17834
|
}
|
|
16646
17835
|
var preparedSourcePhases = /* @__PURE__ */ new Map();
|
|
17836
|
+
function fileListEntries(file, absolute) {
|
|
17837
|
+
return import_node_fs15.default.readFileSync(file, "utf8").split(/\r?\n/).map((line) => line.trim()).filter((line) => line !== "" && !line.startsWith("#")).map(absolute);
|
|
17838
|
+
}
|
|
16647
17839
|
function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
16648
17840
|
const { project, target, id: targetId } = ref;
|
|
16649
17841
|
const targetName = str(target.name) ?? targetId;
|
|
@@ -16656,7 +17848,7 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
|
16656
17848
|
const phase = project.object(phaseId);
|
|
16657
17849
|
if (phase?.isa !== "PBXShellScriptBuildPhase") continue;
|
|
16658
17850
|
const script = str(phase.name) ?? phaseId;
|
|
16659
|
-
const absolute = (raw) =>
|
|
17851
|
+
const absolute = (raw) => import_node_path15.default.resolve(project.projectDir, expand(raw, settings));
|
|
16660
17852
|
const inputs = list(phase.inputPaths).map(absolute);
|
|
16661
17853
|
const outputs = list(phase.outputPaths).map(absolute);
|
|
16662
17854
|
const fileLists = /* @__PURE__ */ new Map();
|
|
@@ -16665,11 +17857,10 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
|
16665
17857
|
kind === "INPUT" ? phase.inputFileListPaths : phase.outputFileListPaths
|
|
16666
17858
|
).map((raw) => {
|
|
16667
17859
|
const file = absolute(raw);
|
|
16668
|
-
if (!
|
|
17860
|
+
if (!import_node_fs15.default.existsSync(file)) {
|
|
16669
17861
|
return { file, entries: [] };
|
|
16670
17862
|
}
|
|
16671
|
-
|
|
16672
|
-
return { file, entries };
|
|
17863
|
+
return { file, entries: fileListEntries(file, absolute) };
|
|
16673
17864
|
});
|
|
16674
17865
|
fileLists.set(kind, lists);
|
|
16675
17866
|
}
|
|
@@ -16686,13 +17877,13 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
|
16686
17877
|
...fileLists.get("OUTPUT").map((item) => item.file)
|
|
16687
17878
|
];
|
|
16688
17879
|
if (allOutputs.some((file) => file.endsWith(".swift"))) {
|
|
16689
|
-
for (const file of inputFiles) if (
|
|
17880
|
+
for (const file of inputFiles) if (import_node_fs15.default.existsSync(file)) projectInputs.add(file);
|
|
16690
17881
|
}
|
|
16691
17882
|
if (options.prepareGeneratedSources && options.requireSources !== false && allOutputs.some((file) => file.endsWith(".swift"))) {
|
|
16692
|
-
const phaseDir =
|
|
17883
|
+
const phaseDir = import_node_path15.default.join(settings("TARGET_TEMP_DIR"), `Script-${phaseId}`);
|
|
16693
17884
|
for (const lists of fileLists.values())
|
|
16694
17885
|
for (const { file } of lists)
|
|
16695
|
-
if (!
|
|
17886
|
+
if (!import_node_fs15.default.existsSync(file))
|
|
16696
17887
|
throw new Error(
|
|
16697
17888
|
`${targetName}: Run Script "${script}" missing file list ${file}`
|
|
16698
17889
|
);
|
|
@@ -16711,7 +17902,7 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
|
16711
17902
|
const lists = fileLists.get(kind);
|
|
16712
17903
|
env[`SCRIPT_${kind}_FILE_LIST_COUNT`] = String(lists.length);
|
|
16713
17904
|
lists.forEach((_item, index) => {
|
|
16714
|
-
env[`SCRIPT_${kind}_FILE_LIST_${index}`] =
|
|
17905
|
+
env[`SCRIPT_${kind}_FILE_LIST_${index}`] = import_node_path15.default.join(
|
|
16715
17906
|
phaseDir,
|
|
16716
17907
|
`${kind}-${index}.xcfilelist`
|
|
16717
17908
|
);
|
|
@@ -16722,21 +17913,23 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
|
|
|
16722
17913
|
);
|
|
16723
17914
|
for (const file of inputFiles) {
|
|
16724
17915
|
signature.update(file);
|
|
16725
|
-
if (
|
|
16726
|
-
const stat =
|
|
17916
|
+
if (import_node_fs15.default.existsSync(file)) {
|
|
17917
|
+
const stat = import_node_fs15.default.statSync(file);
|
|
16727
17918
|
signature.update(`${stat.mtimeMs}:${stat.ctimeMs}:${stat.size}`);
|
|
16728
17919
|
} else signature.update("missing");
|
|
16729
17920
|
}
|
|
16730
17921
|
const stamp = signature.digest("hex");
|
|
16731
17922
|
const key = `${project.projectFile}:${targetId}:${phaseId}:${settings("CONFIGURATION")}`;
|
|
16732
|
-
if (preparedSourcePhases.get(key) === stamp && allOutputs.every((file) =>
|
|
17923
|
+
if (preparedSourcePhases.get(key) === stamp && allOutputs.every((file) => import_node_fs15.default.existsSync(file)))
|
|
16733
17924
|
continue;
|
|
16734
|
-
|
|
16735
|
-
|
|
16736
|
-
|
|
17925
|
+
import_node_fs15.default.mkdirSync(phaseDir, { recursive: true });
|
|
17926
|
+
import_node_fs15.default.mkdirSync(settings("BUILT_PRODUCTS_DIR"), { recursive: true });
|
|
17927
|
+
import_node_fs15.default.mkdirSync(settings("DERIVED_FILE_DIR"), { recursive: true });
|
|
17928
|
+
for (const output of allOutputs)
|
|
17929
|
+
import_node_fs15.default.mkdirSync(import_node_path15.default.dirname(output), { recursive: true });
|
|
16737
17930
|
for (const [kind, lists] of fileLists)
|
|
16738
17931
|
lists.forEach((item, index) => {
|
|
16739
|
-
|
|
17932
|
+
import_node_fs15.default.writeFileSync(
|
|
16740
17933
|
env[`SCRIPT_${kind}_FILE_LIST_${index}`],
|
|
16741
17934
|
`${item.entries.join("\n")}
|
|
16742
17935
|
`
|
|
@@ -16762,7 +17955,7 @@ ${output}`
|
|
|
16762
17955
|
);
|
|
16763
17956
|
}
|
|
16764
17957
|
const missing = allOutputs.filter(
|
|
16765
|
-
(file) => file.endsWith(".swift") && !
|
|
17958
|
+
(file) => file.endsWith(".swift") && !import_node_fs15.default.existsSync(file)
|
|
16766
17959
|
);
|
|
16767
17960
|
if (missing.length > 0)
|
|
16768
17961
|
throw new Error(
|
|
@@ -16775,8 +17968,8 @@ ${output}`
|
|
|
16775
17968
|
project.objects,
|
|
16776
17969
|
targetId,
|
|
16777
17970
|
project.resolvePath,
|
|
16778
|
-
(file) => isDirectory(file) ? walkFiles(file) :
|
|
16779
|
-
|
|
17971
|
+
(file) => isDirectory(file) ? walkFiles(file) : import_node_fs15.default.existsSync(file) ? [file] : [],
|
|
17972
|
+
import_node_path15.default.join,
|
|
16780
17973
|
(file, kind) => {
|
|
16781
17974
|
if (kind === "header") {
|
|
16782
17975
|
headers.add(file);
|
|
@@ -16786,9 +17979,9 @@ ${output}`
|
|
|
16786
17979
|
resources.add(file);
|
|
16787
17980
|
return;
|
|
16788
17981
|
}
|
|
16789
|
-
if (!
|
|
17982
|
+
if (!import_node_fs15.default.existsSync(file)) {
|
|
16790
17983
|
if (options.requireSources === false) return;
|
|
16791
|
-
const script = scriptForOutput.get(
|
|
17984
|
+
const script = scriptForOutput.get(import_node_path15.default.normalize(file));
|
|
16792
17985
|
throw new Error(
|
|
16793
17986
|
script ? `${targetName}: missing generated source ${file} (Run Script "${script}" declares it in outputPaths; run the script or check in its output)` : `${targetName}: missing source ${file}`
|
|
16794
17987
|
);
|
|
@@ -16799,7 +17992,7 @@ ${output}`
|
|
|
16799
17992
|
);
|
|
16800
17993
|
for (const [file, script] of scriptForOutput) {
|
|
16801
17994
|
if (sources.has(file) || allSources.has(file)) continue;
|
|
16802
|
-
if (!
|
|
17995
|
+
if (!import_node_fs15.default.existsSync(file)) {
|
|
16803
17996
|
if (options.requireSources === false) continue;
|
|
16804
17997
|
throw new Error(
|
|
16805
17998
|
`${targetName}: missing generated source ${file} (Run Script "${script}" declares it in outputPaths; run the script or check in its output)`
|
|
@@ -16818,37 +18011,37 @@ ${output}`
|
|
|
16818
18011
|
function commonAncestor(dirs) {
|
|
16819
18012
|
let common = dirs[0];
|
|
16820
18013
|
for (const dir of dirs) {
|
|
16821
|
-
while (common !==
|
|
16822
|
-
common =
|
|
18014
|
+
while (common !== import_node_path15.default.dirname(common) && import_node_path15.default.relative(common, dir).startsWith(".."))
|
|
18015
|
+
common = import_node_path15.default.dirname(common);
|
|
16823
18016
|
}
|
|
16824
18017
|
return common;
|
|
16825
18018
|
}
|
|
16826
|
-
var isPodsProject = (xcodeproj) =>
|
|
18019
|
+
var isPodsProject = (xcodeproj) => import_node_path15.default.basename(xcodeproj) === "Pods.xcodeproj" && import_node_path15.default.basename(import_node_path15.default.dirname(xcodeproj)) === "Pods";
|
|
16827
18020
|
function installedPodsSandbox(pods) {
|
|
16828
|
-
const podfileLock =
|
|
16829
|
-
const manifestLock =
|
|
16830
|
-
if (!
|
|
18021
|
+
const podfileLock = import_node_path15.default.join(import_node_path15.default.dirname(pods), "Podfile.lock");
|
|
18022
|
+
const manifestLock = import_node_path15.default.join(pods, "Manifest.lock");
|
|
18023
|
+
if (!import_node_fs15.default.existsSync(podfileLock))
|
|
16831
18024
|
throw new Error(
|
|
16832
|
-
`${pods} has no ${podfileLock}: run \`pod install\` in ${
|
|
18025
|
+
`${pods} has no ${podfileLock}: run \`pod install\` in ${import_node_path15.default.dirname(pods)}`
|
|
16833
18026
|
);
|
|
16834
|
-
if (!
|
|
18027
|
+
if (!import_node_fs15.default.existsSync(manifestLock) || !import_node_fs15.default.readFileSync(manifestLock).equals(import_node_fs15.default.readFileSync(podfileLock)))
|
|
16835
18028
|
throw new Error(
|
|
16836
|
-
`The sandbox is not in sync with the Podfile.lock: ${manifestLock} differs from ${podfileLock}. Run \`pod install\` in ${
|
|
18029
|
+
`The sandbox is not in sync with the Podfile.lock: ${manifestLock} differs from ${podfileLock}. Run \`pod install\` in ${import_node_path15.default.dirname(pods)}`
|
|
16837
18030
|
);
|
|
16838
18031
|
const specChecksums = {};
|
|
16839
|
-
const lines =
|
|
18032
|
+
const lines = import_node_fs15.default.readFileSync(manifestLock, "utf8").split("\n");
|
|
16840
18033
|
const start = lines.indexOf("SPEC CHECKSUMS:");
|
|
16841
18034
|
for (const line of start === -1 ? [] : lines.slice(start + 1)) {
|
|
16842
18035
|
const entry = /^ {2}"?([^":]+)"?: ([0-9a-f]+)$/.exec(line);
|
|
16843
18036
|
if (!entry) break;
|
|
16844
18037
|
specChecksums[entry[1]] = entry[2];
|
|
16845
18038
|
}
|
|
16846
|
-
const specs =
|
|
18039
|
+
const specs = import_node_path15.default.join(pods, "Local Podspecs");
|
|
16847
18040
|
return {
|
|
16848
18041
|
podfileLock,
|
|
16849
18042
|
manifestLock,
|
|
16850
18043
|
specChecksums,
|
|
16851
|
-
localPodspecs: isDirectory(specs) ?
|
|
18044
|
+
localPodspecs: isDirectory(specs) ? import_node_fs15.default.readdirSync(specs).filter((name2) => name2.endsWith(".podspec.json")).sort().map((name2) => import_node_path15.default.join(specs, name2)) : []
|
|
16852
18045
|
};
|
|
16853
18046
|
}
|
|
16854
18047
|
function workspaceProjects(xcodeprojOrWorkspace, installedPods = false) {
|
|
@@ -16860,14 +18053,14 @@ function workspaceProjects(xcodeprojOrWorkspace, installedPods = false) {
|
|
|
16860
18053
|
if (!xcodeProjectFile(xcodeproj)) {
|
|
16861
18054
|
if (installedPods && isPodsProject(xcodeproj))
|
|
16862
18055
|
throw new Error(
|
|
16863
|
-
`${
|
|
18056
|
+
`${import_node_path15.default.basename(xcodeprojOrWorkspace)} builds ${xcodeproj}, which is not installed: run \`pod install\` in ${import_node_path15.default.dirname(import_node_path15.default.dirname(xcodeproj))}`
|
|
16864
18057
|
);
|
|
16865
18058
|
return;
|
|
16866
18059
|
}
|
|
16867
|
-
const key =
|
|
16868
|
-
if (projectAt.has(key) || !installedPods && key.split(
|
|
18060
|
+
const key = import_node_fs15.default.realpathSync(xcodeproj);
|
|
18061
|
+
if (projectAt.has(key) || !installedPods && key.split(import_node_path15.default.sep).includes("Pods"))
|
|
16869
18062
|
return;
|
|
16870
|
-
if (isPodsProject(key)) cocoapods = installedPodsSandbox(
|
|
18063
|
+
if (isPodsProject(key)) cocoapods = installedPodsSandbox(import_node_path15.default.dirname(key));
|
|
16871
18064
|
const project = loadProject(key);
|
|
16872
18065
|
projectAt.set(key, project);
|
|
16873
18066
|
projects.push(project);
|
|
@@ -16883,22 +18076,22 @@ function workspaceProjects(xcodeprojOrWorkspace, installedPods = false) {
|
|
|
16883
18076
|
for (const reference of listed)
|
|
16884
18077
|
if (reference.endsWith(".xcodeproj")) addProject(reference);
|
|
16885
18078
|
if (projects.length === 0) {
|
|
16886
|
-
throw new Error(`${
|
|
18079
|
+
throw new Error(`${import_node_path15.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
|
|
16887
18080
|
}
|
|
16888
|
-
const podfile =
|
|
16889
|
-
if (installedPods && !cocoapods &&
|
|
18081
|
+
const podfile = import_node_path15.default.join(import_node_path15.default.dirname(xcodeprojOrWorkspace), "Podfile");
|
|
18082
|
+
if (installedPods && !cocoapods && import_node_fs15.default.existsSync(podfile))
|
|
16890
18083
|
throw new Error(
|
|
16891
|
-
`${podfile} is not installed into ${
|
|
18084
|
+
`${podfile} is not installed into ${import_node_path15.default.basename(xcodeprojOrWorkspace)}: run \`pod install\` in ${import_node_path15.default.dirname(podfile)} and open the workspace it writes`
|
|
16892
18085
|
);
|
|
16893
18086
|
return { listed, projects, projectAt, cocoapods };
|
|
16894
18087
|
}
|
|
16895
18088
|
var targetRefs = /* @__PURE__ */ new WeakMap();
|
|
16896
|
-
function
|
|
18089
|
+
function projectTargets(project) {
|
|
16897
18090
|
let refs = targetRefs.get(project);
|
|
16898
18091
|
if (!refs) {
|
|
16899
18092
|
refs = list(project.project.targets).flatMap((id) => {
|
|
16900
18093
|
const target = project.object(id);
|
|
16901
|
-
return target?.isa === "PBXNativeTarget" ? [{ project, id, target }] : [];
|
|
18094
|
+
return target?.isa === "PBXNativeTarget" || target?.isa === "PBXAggregateTarget" ? [{ project, id, target }] : [];
|
|
16902
18095
|
});
|
|
16903
18096
|
targetRefs.set(project, refs);
|
|
16904
18097
|
}
|
|
@@ -16921,19 +18114,19 @@ function isIosPlatform(name2) {
|
|
|
16921
18114
|
return name2.startsWith("iphoneos") || name2.startsWith("iphonesimulator");
|
|
16922
18115
|
}
|
|
16923
18116
|
function listXcodeAppTargets(xcodeprojOrWorkspace, options = {}) {
|
|
16924
|
-
return workspaceProjects(xcodeprojOrWorkspace).projects.flatMap(
|
|
18117
|
+
return workspaceProjects(xcodeprojOrWorkspace).projects.flatMap(projectTargets).filter((ref) => isIosAppTarget(ref, options)).map((ref) => str(ref.target.name) ?? ref.id);
|
|
16925
18118
|
}
|
|
16926
18119
|
function readXcodeAppTarget(input, targetName, configurationName, options = {}) {
|
|
16927
|
-
const xcodeprojOrWorkspace =
|
|
18120
|
+
const xcodeprojOrWorkspace = import_node_fs15.default.realpathSync(input);
|
|
16928
18121
|
const workspace = xcodeprojOrWorkspace.endsWith(".xcworkspace") ? xcodeprojOrWorkspace : null;
|
|
16929
18122
|
const { listed, projects, projectAt, cocoapods } = workspaceProjects(
|
|
16930
18123
|
xcodeprojOrWorkspace,
|
|
16931
18124
|
options.installedPods
|
|
16932
18125
|
);
|
|
16933
|
-
const allTargets = projects.flatMap(
|
|
18126
|
+
const allTargets = projects.flatMap(projectTargets);
|
|
16934
18127
|
const appTargets = allTargets.filter((ref) => isIosAppTarget(ref, options));
|
|
16935
18128
|
const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
|
|
16936
|
-
const container =
|
|
18129
|
+
const container = import_node_path15.default.basename(xcodeprojOrWorkspace);
|
|
16937
18130
|
const named = targetName ? appTargets.filter((ref) => ref.target.name === targetName) : appTargets;
|
|
16938
18131
|
if (named.length !== 1) {
|
|
16939
18132
|
throw new Error(
|
|
@@ -16946,18 +18139,18 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
16946
18139
|
for (const ref of allTargets) {
|
|
16947
18140
|
const product = ref.project.object(str(ref.target.productReference));
|
|
16948
18141
|
const file = str(product?.path);
|
|
16949
|
-
if (file && !byProduct.has(
|
|
16950
|
-
byProduct.set(
|
|
18142
|
+
if (file && !byProduct.has(import_node_path15.default.basename(file)))
|
|
18143
|
+
byProduct.set(import_node_path15.default.basename(file), ref);
|
|
16951
18144
|
}
|
|
16952
18145
|
const proxied = (project, proxyId) => {
|
|
16953
18146
|
const proxy = project.object(proxyId);
|
|
16954
18147
|
if (proxy?.isa !== "PBXContainerItemProxy") return void 0;
|
|
16955
18148
|
const portal = str(proxy.containerPortal);
|
|
16956
18149
|
const portalPath = project.resolvePath(portal ?? "");
|
|
16957
|
-
const owner = project.object(portal)?.isa === "PBXProject" ? project : portalPath &&
|
|
18150
|
+
const owner = project.object(portal)?.isa === "PBXProject" ? project : portalPath && import_node_fs15.default.existsSync(portalPath) ? projectAt.get(import_node_fs15.default.realpathSync(portalPath)) : void 0;
|
|
16958
18151
|
const remote = str(proxy.remoteGlobalIDString);
|
|
16959
18152
|
if (!owner || !remote) return void 0;
|
|
16960
|
-
return
|
|
18153
|
+
return projectTargets(owner).find(
|
|
16961
18154
|
(ref) => ref.id === remote || str(ref.target.productReference) === remote
|
|
16962
18155
|
);
|
|
16963
18156
|
};
|
|
@@ -16967,7 +18160,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
16967
18160
|
for (const dependencyId of list(target.dependencies)) {
|
|
16968
18161
|
const dependency = project.object(dependencyId);
|
|
16969
18162
|
const direct = str(dependency?.target);
|
|
16970
|
-
const resolved = direct ?
|
|
18163
|
+
const resolved = direct ? projectTargets(project).find((candidate) => candidate.id === direct) : proxied(project, str(dependency?.targetProxy));
|
|
16971
18164
|
if (resolved) found.push(resolved);
|
|
16972
18165
|
}
|
|
16973
18166
|
for (const phaseId of list(target.buildPhases)) {
|
|
@@ -16975,12 +18168,12 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
16975
18168
|
if (phase?.isa !== "PBXFrameworksBuildPhase") continue;
|
|
16976
18169
|
for (const buildFileId of list(phase.files)) {
|
|
16977
18170
|
const file = project.object(str(project.object(buildFileId)?.fileRef));
|
|
16978
|
-
const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(
|
|
18171
|
+
const resolved = file?.isa === "PBXReferenceProxy" ? proxied(project, str(file.remoteRef)) : file && str(file.sourceTree) === "BUILT_PRODUCTS_DIR" ? byProduct.get(import_node_path15.default.basename(str(file.path) ?? "")) : void 0;
|
|
16979
18172
|
if (resolved) found.push(resolved);
|
|
16980
18173
|
}
|
|
16981
18174
|
}
|
|
16982
18175
|
return found.filter(
|
|
16983
|
-
(candidate) => MODULE_PRODUCTS.has(str(candidate.target.productType) ?? "")
|
|
18176
|
+
(candidate) => candidate.target.isa === "PBXAggregateTarget" || MODULE_PRODUCTS.has(str(candidate.target.productType) ?? "")
|
|
16984
18177
|
);
|
|
16985
18178
|
};
|
|
16986
18179
|
const order = [];
|
|
@@ -17019,11 +18212,11 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
17019
18212
|
const cached2 = projectHeaderMaps.get(project);
|
|
17020
18213
|
if (cached2) return cached2;
|
|
17021
18214
|
const entries = /* @__PURE__ */ new Map();
|
|
17022
|
-
for (const ref of
|
|
18215
|
+
for (const ref of projectTargets(project)) {
|
|
17023
18216
|
const framework = FRAMEWORK_PRODUCTS.has(str(ref.target.productType) ?? "");
|
|
17024
18217
|
const product = framework ? productName(ref) : "";
|
|
17025
18218
|
for (const { file, visibility } of headerPhase(ref)) {
|
|
17026
|
-
const name2 =
|
|
18219
|
+
const name2 = import_node_path15.default.basename(file);
|
|
17027
18220
|
if (!entries.has(name2))
|
|
17028
18221
|
entries.set(
|
|
17029
18222
|
name2,
|
|
@@ -17034,18 +18227,18 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
17034
18227
|
for (const id of Object.keys(project.objects)) {
|
|
17035
18228
|
if (project.object(id)?.isa !== "PBXFileReference") continue;
|
|
17036
18229
|
const file = project.resolvePath(id);
|
|
17037
|
-
if (file && HEADER_FILE.test(file) && !entries.has(
|
|
17038
|
-
entries.set(
|
|
18230
|
+
if (file && HEADER_FILE.test(file) && !entries.has(import_node_path15.default.basename(file)))
|
|
18231
|
+
entries.set(import_node_path15.default.basename(file), file);
|
|
17039
18232
|
}
|
|
17040
18233
|
const map2 = [...entries];
|
|
17041
18234
|
projectHeaderMaps.set(project, map2);
|
|
17042
18235
|
return map2;
|
|
17043
18236
|
};
|
|
17044
18237
|
const xcconfigs = /* @__PURE__ */ new Set();
|
|
17045
|
-
const buildDir = (project) =>
|
|
18238
|
+
const buildDir = (project) => import_node_path15.default.join(project.projectDir, ".build/peach-xcode/Build");
|
|
17046
18239
|
const podsBuild = {
|
|
17047
|
-
SYMROOT:
|
|
17048
|
-
OBJROOT:
|
|
18240
|
+
SYMROOT: import_node_path15.default.join(buildDir(app.project), "Products"),
|
|
18241
|
+
OBJROOT: import_node_path15.default.join(buildDir(app.project), "Intermediates.noindex")
|
|
17049
18242
|
};
|
|
17050
18243
|
const moduleTarget = (ref) => {
|
|
17051
18244
|
const name2 = str(ref.target.name) ?? ref.id;
|
|
@@ -17058,19 +18251,27 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
17058
18251
|
configuration,
|
|
17059
18252
|
{
|
|
17060
18253
|
TARGET_NAME: name2,
|
|
17061
|
-
|
|
18254
|
+
TARGETNAME: "$(TARGET_NAME)",
|
|
18255
|
+
PROJECT: "$(PROJECT_NAME)",
|
|
18256
|
+
PROJECT_NAME: import_node_path15.default.basename(ref.project.xcodeproj, ".xcodeproj"),
|
|
18257
|
+
PROJECT_FILE_PATH: ref.project.xcodeproj,
|
|
17062
18258
|
SRCROOT: ref.project.projectDir,
|
|
17063
18259
|
SOURCE_ROOT: ref.project.projectDir,
|
|
17064
18260
|
PROJECT_DIR: ref.project.projectDir,
|
|
17065
|
-
SYMROOT:
|
|
18261
|
+
SYMROOT: import_node_path15.default.join(buildDir(ref.project), "Products"),
|
|
17066
18262
|
BUILD_DIR: "$(SYMROOT)",
|
|
17067
|
-
|
|
18263
|
+
BUILD_ROOT: "$(SYMROOT)",
|
|
18264
|
+
OBJROOT: import_node_path15.default.join(buildDir(ref.project), "Intermediates.noindex"),
|
|
17068
18265
|
CONFIGURATION_BUILD_DIR: "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)",
|
|
17069
18266
|
BUILT_PRODUCTS_DIR: "$(CONFIGURATION_BUILD_DIR)",
|
|
17070
18267
|
TARGET_BUILD_DIR: "$(CONFIGURATION_BUILD_DIR)",
|
|
17071
18268
|
PROJECT_TEMP_DIR: "$(OBJROOT)/$(PROJECT_NAME).build",
|
|
17072
18269
|
CONFIGURATION_TEMP_DIR: "$(PROJECT_TEMP_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)",
|
|
17073
18270
|
TARGET_TEMP_DIR: "$(CONFIGURATION_TEMP_DIR)/$(TARGET_NAME).build",
|
|
18271
|
+
TEMP_DIR: "$(TARGET_TEMP_DIR)",
|
|
18272
|
+
TEMP_FILES_DIR: "$(TEMP_DIR)",
|
|
18273
|
+
TEMP_FILE_DIR: "$(TEMP_DIR)",
|
|
18274
|
+
TEMP_ROOT: "$(OBJROOT)",
|
|
17074
18275
|
DERIVED_FILE_DIR: "$(TARGET_TEMP_DIR)/DerivedSources",
|
|
17075
18276
|
DERIVED_FILES_DIR: "$(DERIVED_FILE_DIR)",
|
|
17076
18277
|
PLATFORM_NAME: "iphonesimulator",
|
|
@@ -17093,11 +18294,11 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
17093
18294
|
xcconfigs
|
|
17094
18295
|
);
|
|
17095
18296
|
const searchRules = recursiveSearchRules(settings2);
|
|
17096
|
-
const absolute = (file) =>
|
|
18297
|
+
const absolute = (file) => import_node_path15.default.resolve(ref.project.projectDir, file);
|
|
17097
18298
|
const framework = FRAMEWORK_PRODUCTS.has(str(ref.target.productType) ?? "");
|
|
17098
18299
|
const product = settings2("PRODUCT_NAME");
|
|
17099
18300
|
const building = options.prepareGeneratedSources && options.requireSources !== false;
|
|
17100
|
-
const versioning = building && allSources.length > 0 && settings2("VERSIONING_SYSTEM") === "apple-generic" ?
|
|
18301
|
+
const versioning = building && allSources.length > 0 && settings2("VERSIONING_SYSTEM") === "apple-generic" ? import_node_path15.default.join(settings2("DERIVED_FILE_DIR"), `${product}_vers.c`) : null;
|
|
17101
18302
|
if (versioning) {
|
|
17102
18303
|
const version = settings2("CURRENT_PROJECT_VERSION");
|
|
17103
18304
|
const custom = [
|
|
@@ -17108,27 +18309,28 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
17108
18309
|
"VERSION_INFO_PREFIX",
|
|
17109
18310
|
"VERSION_INFO_SUFFIX"
|
|
17110
18311
|
].filter((key) => settings2(key));
|
|
17111
|
-
if (
|
|
18312
|
+
if (custom.length)
|
|
17112
18313
|
throw new Error(
|
|
17113
|
-
`${name2}: Xcode generates ${
|
|
18314
|
+
`${name2}: Xcode generates ${import_node_path15.default.basename(versioning)} with ${custom.join(", ")}; peach does not model VERSION_INFO_* overrides`
|
|
17114
18315
|
);
|
|
18316
|
+
const symbol = product.replace(/^[^A-Za-z_]/, "_").replace(/[^A-Za-z0-9_]/g, "_");
|
|
18317
|
+
const [major, minor] = version.split(".");
|
|
18318
|
+
const number = `${major === "" ? "0" : major}.${minor !== void 0 && /^\d+$/.test(minor) ? minor.replace(/^0+(?=\d)/, "") : ""}`;
|
|
17115
18319
|
const unit = [
|
|
17116
|
-
` extern const unsigned char ${
|
|
17117
|
-
` extern const double ${
|
|
18320
|
+
` extern const unsigned char ${symbol}VersionString[];`,
|
|
18321
|
+
` extern const double ${symbol}VersionNumber;`,
|
|
17118
18322
|
"",
|
|
17119
|
-
` const unsigned char ${
|
|
17120
|
-
` const double ${
|
|
18323
|
+
` const unsigned char ${symbol}VersionString[] __attribute__ ((used)) = "@(#)PROGRAM:${product} PROJECT:${settings2("PROJECT_NAME")}-${version}" "\\n";`,
|
|
18324
|
+
` const double ${symbol}VersionNumber __attribute__ ((used)) = (double)${number};`,
|
|
17121
18325
|
""
|
|
17122
18326
|
].join("\n");
|
|
17123
|
-
if (!
|
|
17124
|
-
|
|
17125
|
-
|
|
18327
|
+
if (!import_node_fs15.default.existsSync(versioning) || import_node_fs15.default.readFileSync(versioning, "utf8") !== unit) {
|
|
18328
|
+
import_node_fs15.default.mkdirSync(import_node_path15.default.dirname(versioning), { recursive: true });
|
|
18329
|
+
import_node_fs15.default.writeFileSync(versioning, unit);
|
|
17126
18330
|
}
|
|
17127
18331
|
allSources.push(versioning);
|
|
17128
18332
|
}
|
|
17129
|
-
const implementations = allSources.filter(
|
|
17130
|
-
(file) => /\.(c|cc|cpp|cxx|m|mm)$/.test(file)
|
|
17131
|
-
);
|
|
18333
|
+
const implementations = allSources.filter(isSwiftNativeTranslationUnit);
|
|
17132
18334
|
const native = implementations.length > 0;
|
|
17133
18335
|
if (native && building) {
|
|
17134
18336
|
const generatedHeaders = list(ref.target.buildPhases).flatMap((phaseId) => {
|
|
@@ -17139,7 +18341,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
17139
18341
|
throw new Error(
|
|
17140
18342
|
`${name2}: Xcode's generated-files header map, which lists headers its build rules and Run Script phases generate (${generatedHeaders.join(", ") || "build rules"}), is not modeled`
|
|
17141
18343
|
);
|
|
17142
|
-
const nonFramework =
|
|
18344
|
+
const nonFramework = projectTargets(ref.project).find(
|
|
17143
18345
|
(other) => !FRAMEWORK_PRODUCTS.has(str(other.target.productType) ?? "") && headerPhase(other).length > 0
|
|
17144
18346
|
);
|
|
17145
18347
|
if (nonFramework && settings2("USE_HEADERMAP") !== "NO")
|
|
@@ -17154,14 +18356,14 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
17154
18356
|
const headerFiles = headerPhase(ref);
|
|
17155
18357
|
const ownHeaders = /* @__PURE__ */ new Map();
|
|
17156
18358
|
for (const { file, visibility } of headerFiles) {
|
|
17157
|
-
const name3 =
|
|
18359
|
+
const name3 = import_node_path15.default.basename(file);
|
|
17158
18360
|
const published = framework && visibility !== "Project";
|
|
17159
18361
|
if (!ownHeaders.has(name3))
|
|
17160
18362
|
ownHeaders.set(name3, published ? `${product}/${name3}` : file);
|
|
17161
18363
|
if (framework && !published && !ownHeaders.has(`${product}/${name3}`))
|
|
17162
18364
|
ownHeaders.set(`${product}/${name3}`, file);
|
|
17163
18365
|
}
|
|
17164
|
-
const wrapper =
|
|
18366
|
+
const wrapper = import_node_path15.default.join(settings2("BUILT_PRODUCTS_DIR"), `${product}.framework`);
|
|
17165
18367
|
const moduleMap = settings2("DEFINES_MODULE") === "YES" && settings2("MODULEMAP_FILE") ? absolute(settings2("MODULEMAP_FILE")) : null;
|
|
17166
18368
|
const fileFlags = {};
|
|
17167
18369
|
for (const phaseId of list(ref.target.buildPhases)) {
|
|
@@ -17191,6 +18393,14 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
17191
18393
|
mainActorIsolation: settings2("SWIFT_DEFAULT_ACTOR_ISOLATION") === "MainActor",
|
|
17192
18394
|
defines: compilationConditions(settings2),
|
|
17193
18395
|
iosDeploymentTarget: settings2("IPHONEOS_DEPLOYMENT_TARGET") || null,
|
|
18396
|
+
assetSettings: {
|
|
18397
|
+
IPHONEOS_DEPLOYMENT_TARGET: XCODE_DEFAULT_IOS_DEPLOYMENT_TARGET,
|
|
18398
|
+
...Object.fromEntries(
|
|
18399
|
+
["IPHONEOS_DEPLOYMENT_TARGET", ...assetSymbolSettingKeys].flatMap(
|
|
18400
|
+
(key) => settings2(key) ? [[key, settings2(key)]] : []
|
|
18401
|
+
)
|
|
18402
|
+
)
|
|
18403
|
+
},
|
|
17194
18404
|
...native ? {
|
|
17195
18405
|
objc: {
|
|
17196
18406
|
publicHeaders: headerFiles.flatMap(
|
|
@@ -17201,7 +18411,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
17201
18411
|
...headers,
|
|
17202
18412
|
...Object.keys(ref.project.objects).flatMap((id) => {
|
|
17203
18413
|
const file = ref.project.resolvePath(id);
|
|
17204
|
-
return file && HEADER_FILE.test(file) &&
|
|
18414
|
+
return file && HEADER_FILE.test(file) && import_node_fs15.default.existsSync(file) ? [file] : [];
|
|
17205
18415
|
})
|
|
17206
18416
|
])
|
|
17207
18417
|
],
|
|
@@ -17210,15 +18420,15 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
17210
18420
|
// xcode searches its products' include directory before
|
|
17211
18421
|
// HEADER_SEARCH_PATHS and the target's derived sources after.
|
|
17212
18422
|
headerSearchPaths: [
|
|
17213
|
-
|
|
18423
|
+
import_node_path15.default.join(settings2("BUILT_PRODUCTS_DIR"), "include"),
|
|
17214
18424
|
...settingList(settings2("HEADER_SEARCH_PATHS")).flatMap(
|
|
17215
18425
|
(raw) => expandSearchPath(absolute(raw), searchRules)
|
|
17216
18426
|
),
|
|
17217
|
-
|
|
18427
|
+
import_node_path15.default.join(
|
|
17218
18428
|
`${settings2("DERIVED_FILE_DIR")}-normal`,
|
|
17219
18429
|
settings2("CURRENT_ARCH")
|
|
17220
18430
|
),
|
|
17221
|
-
|
|
18431
|
+
import_node_path15.default.join(settings2("DERIVED_FILE_DIR"), settings2("CURRENT_ARCH")),
|
|
17222
18432
|
settings2("DERIVED_FILE_DIR")
|
|
17223
18433
|
],
|
|
17224
18434
|
userHeaderSearchPaths: settingList(
|
|
@@ -17257,27 +18467,28 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
17257
18467
|
...headerFiles.flatMap(
|
|
17258
18468
|
({ file, visibility }) => visibility === "Project" ? [] : [
|
|
17259
18469
|
[
|
|
17260
|
-
|
|
18470
|
+
import_node_path15.default.join(
|
|
17261
18471
|
wrapper,
|
|
17262
18472
|
visibility === "Public" ? "Headers" : "PrivateHeaders",
|
|
17263
|
-
|
|
18473
|
+
import_node_path15.default.basename(file)
|
|
17264
18474
|
),
|
|
17265
18475
|
file
|
|
17266
18476
|
]
|
|
17267
18477
|
]
|
|
17268
18478
|
),
|
|
17269
|
-
...moduleMap ? [[
|
|
18479
|
+
...moduleMap ? [[import_node_path15.default.join(wrapper, "Modules", "module.modulemap"), moduleMap]] : []
|
|
17270
18480
|
]) : {}
|
|
17271
18481
|
}
|
|
17272
18482
|
} : {}
|
|
17273
18483
|
}
|
|
17274
18484
|
};
|
|
17275
18485
|
};
|
|
17276
|
-
const
|
|
17277
|
-
const
|
|
18486
|
+
const builtTargets = order.map((ref) => ({ ref, ...moduleTarget(ref) }));
|
|
18487
|
+
const { settings, keys: settingKeys, module: module2 } = builtTargets.at(-1);
|
|
18488
|
+
const frameworkTargets = builtTargets.slice(0, -1).filter(({ ref }) => ref.target.isa === "PBXNativeTarget").map(({ ref, module: module3 }) => ({ ref, framework: module3 }));
|
|
17278
18489
|
const frameworks = frameworkTargets.map(({ framework }) => framework);
|
|
17279
18490
|
const podSourceDirs = frameworkTargets.flatMap(
|
|
17280
|
-
({ ref, framework }) => isPodsProject(ref.project.xcodeproj) ? [...framework.allSources, ...framework.objc?.headers ?? []].map((file) =>
|
|
18491
|
+
({ ref, framework }) => isPodsProject(ref.project.xcodeproj) ? [...framework.allSources, ...framework.objc?.headers ?? []].map((file) => import_node_path15.default.dirname(file)).filter((dir) => import_node_fs15.default.existsSync(dir)) : []
|
|
17281
18492
|
);
|
|
17282
18493
|
const expandValue = (value) => {
|
|
17283
18494
|
if (typeof value === "string") return expand(value, settings);
|
|
@@ -17289,8 +18500,8 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
17289
18500
|
}
|
|
17290
18501
|
return value;
|
|
17291
18502
|
};
|
|
17292
|
-
const infoPlistFile = settings("INFOPLIST_FILE") ?
|
|
17293
|
-
const sourceInfo = infoPlistFile ?
|
|
18503
|
+
const infoPlistFile = settings("INFOPLIST_FILE") ? import_node_path15.default.resolve(app.project.projectDir, settings("INFOPLIST_FILE")) : null;
|
|
18504
|
+
const sourceInfo = infoPlistFile ? import_plist3.default.parse(import_node_fs15.default.readFileSync(infoPlistFile, "utf8")) : {};
|
|
17294
18505
|
if (!sourceInfo || typeof sourceInfo !== "object" || Array.isArray(sourceInfo) || sourceInfo instanceof Date || Buffer.isBuffer(sourceInfo)) {
|
|
17295
18506
|
throw new Error(`${module2.name} Info.plist must contain a dictionary`);
|
|
17296
18507
|
}
|
|
@@ -17318,7 +18529,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
17318
18529
|
};
|
|
17319
18530
|
}
|
|
17320
18531
|
const localPackageDirs = [
|
|
17321
|
-
...listed.filter((reference) =>
|
|
18532
|
+
...listed.filter((reference) => import_node_fs15.default.existsSync(import_node_path15.default.join(reference, "Package.swift"))),
|
|
17322
18533
|
...projects.flatMap(
|
|
17323
18534
|
(project) => Object.entries(project.objects).flatMap(([id, entry]) => {
|
|
17324
18535
|
if (!isDict(entry)) return [];
|
|
@@ -17328,48 +18539,97 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
17328
18539
|
const packages = [];
|
|
17329
18540
|
while (pending.length > 0) {
|
|
17330
18541
|
const dir = pending.pop();
|
|
17331
|
-
if (
|
|
18542
|
+
if (import_node_fs15.default.existsSync(import_node_path15.default.join(dir, "Package.swift"))) {
|
|
17332
18543
|
packages.push(dir);
|
|
17333
18544
|
continue;
|
|
17334
18545
|
}
|
|
17335
18546
|
if (!isDirectory(dir)) continue;
|
|
17336
|
-
for (const child of
|
|
18547
|
+
for (const child of import_node_fs15.default.readdirSync(dir, { withFileTypes: true }))
|
|
17337
18548
|
if (child.isDirectory() && !child.name.startsWith("."))
|
|
17338
|
-
pending.push(
|
|
18549
|
+
pending.push(import_node_path15.default.join(dir, child.name));
|
|
17339
18550
|
}
|
|
17340
18551
|
return packages;
|
|
17341
18552
|
}
|
|
17342
|
-
const candidate = entry.isa === "XCLocalSwiftPackageReference" ?
|
|
17343
|
-
return candidate &&
|
|
18553
|
+
const candidate = entry.isa === "XCLocalSwiftPackageReference" ? import_node_path15.default.resolve(project.projectDir, str(entry.relativePath) ?? "") : entry.isa === "PBXFileReference" ? project.resolvePath(id) : null;
|
|
18554
|
+
return candidate && import_node_fs15.default.existsSync(import_node_path15.default.join(candidate, "Package.swift")) ? [candidate] : [];
|
|
17344
18555
|
})
|
|
17345
18556
|
)
|
|
17346
18557
|
];
|
|
18558
|
+
const remotePackageUrls = [
|
|
18559
|
+
...new Set(
|
|
18560
|
+
projects.flatMap(
|
|
18561
|
+
(project) => list(project.project.packageReferences).flatMap((id) => {
|
|
18562
|
+
const reference = project.object(id);
|
|
18563
|
+
const url = str(reference?.repositoryURL);
|
|
18564
|
+
return reference?.isa === "XCRemoteSwiftPackageReference" && url ? [url] : [];
|
|
18565
|
+
})
|
|
18566
|
+
)
|
|
18567
|
+
)
|
|
18568
|
+
];
|
|
17347
18569
|
const linkedProducts = [];
|
|
18570
|
+
const productReferences = [];
|
|
18571
|
+
const qualifiedProductKeys = /* @__PURE__ */ new Set();
|
|
18572
|
+
const linkedProductKeys = /* @__PURE__ */ new Set();
|
|
17348
18573
|
const binaryFrameworks = /* @__PURE__ */ new Map();
|
|
18574
|
+
for (const { ref, settings: settings2 } of builtTargets) {
|
|
18575
|
+
const absolute = (raw) => import_node_path15.default.resolve(ref.project.projectDir, expand(raw, settings2));
|
|
18576
|
+
for (const raw of settingList(settings2("SWIFT_INCLUDE_PATHS"))) {
|
|
18577
|
+
const dir = absolute(raw);
|
|
18578
|
+
const modulemap = import_node_path15.default.join(dir, "module.modulemap");
|
|
18579
|
+
if (!import_node_fs15.default.existsSync(modulemap)) continue;
|
|
18580
|
+
const name2 = moduleMapName(import_node_fs15.default.readFileSync(modulemap, "utf8"));
|
|
18581
|
+
if (name2 && !binaryFrameworks.has(name2)) binaryFrameworks.set(name2, dir);
|
|
18582
|
+
}
|
|
18583
|
+
for (const phaseId of list(ref.target.buildPhases)) {
|
|
18584
|
+
const phase = ref.project.object(phaseId);
|
|
18585
|
+
if (phase?.isa !== "PBXShellScriptBuildPhase") continue;
|
|
18586
|
+
const inputs = list(phase.inputPaths).map(absolute);
|
|
18587
|
+
for (const raw of list(phase.inputFileListPaths)) {
|
|
18588
|
+
const file = absolute(raw);
|
|
18589
|
+
if (!import_node_fs15.default.existsSync(file)) continue;
|
|
18590
|
+
xcconfigs.add(file);
|
|
18591
|
+
inputs.push(...fileListEntries(file, absolute));
|
|
18592
|
+
}
|
|
18593
|
+
for (const file of inputs) {
|
|
18594
|
+
const name2 = /([^/]+)\.xcframework$/.exec(file)?.[1];
|
|
18595
|
+
if (name2 && !binaryFrameworks.has(name2)) binaryFrameworks.set(name2, file);
|
|
18596
|
+
}
|
|
18597
|
+
}
|
|
18598
|
+
}
|
|
17349
18599
|
for (const { project, target } of order) {
|
|
18600
|
+
const productRef = (id) => {
|
|
18601
|
+
const ref = str(project.object(id)?.productRef);
|
|
18602
|
+
return ref ? [ref] : [];
|
|
18603
|
+
};
|
|
17350
18604
|
const productDependencies = [
|
|
17351
18605
|
...list(target.packageProductDependencies),
|
|
17352
|
-
...list(target.dependencies).flatMap(
|
|
17353
|
-
|
|
17354
|
-
|
|
18606
|
+
...list(target.dependencies).flatMap(productRef),
|
|
18607
|
+
...list(target.buildPhases).flatMap((id) => {
|
|
18608
|
+
const phase = project.object(id);
|
|
18609
|
+
return phase?.isa === "PBXFrameworksBuildPhase" ? list(phase.files).flatMap(productRef) : [];
|
|
17355
18610
|
})
|
|
17356
18611
|
];
|
|
17357
|
-
for (const dependencyId of productDependencies) {
|
|
18612
|
+
for (const dependencyId of new Set(productDependencies)) {
|
|
17358
18613
|
const dependency = project.object(dependencyId);
|
|
17359
18614
|
const product = str(dependency?.productName)?.replace(/^plugin:/, "");
|
|
17360
|
-
if (!dependency || !product
|
|
17361
|
-
|
|
18615
|
+
if (!dependency || !product)
|
|
18616
|
+
throw new Error(
|
|
18617
|
+
`${str(target.name) ?? "target"}: package product dependency ${dependencyId} has no productName in ${project.projectFile}`
|
|
18618
|
+
);
|
|
17362
18619
|
const reference = project.object(str(dependency.package));
|
|
17363
|
-
|
|
18620
|
+
const linked = {
|
|
17364
18621
|
product,
|
|
17365
18622
|
source: reference?.isa === "XCRemoteSwiftPackageReference" ? { kind: "remote", url: str(reference.repositoryURL) ?? "" } : reference?.isa === "XCLocalSwiftPackageReference" ? {
|
|
17366
18623
|
kind: "local",
|
|
17367
|
-
dir:
|
|
18624
|
+
dir: import_node_path15.default.resolve(
|
|
17368
18625
|
project.projectDir,
|
|
17369
18626
|
str(reference.relativePath) ?? ""
|
|
17370
18627
|
)
|
|
17371
|
-
} : { kind: "unnamed" }
|
|
17372
|
-
}
|
|
18628
|
+
} : { kind: "unnamed", remoteUrls: remotePackageUrls }
|
|
18629
|
+
};
|
|
18630
|
+
productReferences.push({ project: project.projectFile, linked });
|
|
18631
|
+
if (linked.source.kind !== "unnamed")
|
|
18632
|
+
qualifiedProductKeys.add(`${project.projectFile}\0${product}`);
|
|
17373
18633
|
}
|
|
17374
18634
|
for (const phaseId of list(target.buildPhases)) {
|
|
17375
18635
|
const phase = project.object(phaseId);
|
|
@@ -17387,26 +18647,34 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
17387
18647
|
}
|
|
17388
18648
|
}
|
|
17389
18649
|
}
|
|
17390
|
-
const
|
|
17391
|
-
|
|
18650
|
+
for (const { project, linked } of productReferences) {
|
|
18651
|
+
if (linked.source.kind === "unnamed" && qualifiedProductKeys.has(`${project}\0${linked.product}`))
|
|
18652
|
+
continue;
|
|
18653
|
+
const key = JSON.stringify(linked);
|
|
18654
|
+
if (linkedProductKeys.has(key)) continue;
|
|
18655
|
+
linkedProductKeys.add(key);
|
|
18656
|
+
linkedProducts.push(linked);
|
|
18657
|
+
}
|
|
18658
|
+
const resolvedFile = import_node_path15.default.join(
|
|
18659
|
+
workspace ?? import_node_path15.default.join(xcodeprojOrWorkspace, "project.xcworkspace"),
|
|
17392
18660
|
"xcshareddata",
|
|
17393
18661
|
"swiftpm",
|
|
17394
18662
|
"Package.resolved"
|
|
17395
18663
|
);
|
|
17396
|
-
const packageResolved =
|
|
18664
|
+
const packageResolved = import_node_fs15.default.existsSync(resolvedFile) ? [import_node_fs15.default.realpathSync(resolvedFile)] : [...new Set(localPackageDirs.map((dir) => import_node_path15.default.join(dir, "Package.resolved")))].filter((file) => import_node_fs15.default.existsSync(file)).map((file) => import_node_fs15.default.realpathSync(file)).sort();
|
|
17397
18665
|
const used = order.map((ref) => ref.project);
|
|
17398
18666
|
return {
|
|
17399
18667
|
...module2,
|
|
17400
18668
|
rootDir: commonAncestor(
|
|
17401
18669
|
[
|
|
17402
|
-
workspace ?
|
|
18670
|
+
workspace ? import_node_path15.default.dirname(workspace) : app.project.projectDir,
|
|
17403
18671
|
...used.map((project) => project.projectDir),
|
|
17404
18672
|
...localPackageDirs,
|
|
17405
18673
|
...linkedProducts.flatMap(
|
|
17406
|
-
({ source }) => source.kind === "local" &&
|
|
18674
|
+
({ source }) => source.kind === "local" && import_node_fs15.default.existsSync(source.dir) ? [source.dir] : []
|
|
17407
18675
|
),
|
|
17408
18676
|
...new Set(podSourceDirs)
|
|
17409
|
-
].map((dir) =>
|
|
18677
|
+
].map((dir) => import_node_fs15.default.realpathSync(dir))
|
|
17410
18678
|
),
|
|
17411
18679
|
projectFiles: [
|
|
17412
18680
|
.../* @__PURE__ */ new Set([
|
|
@@ -17415,13 +18683,14 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
17415
18683
|
...cocoapods ? [cocoapods.podfileLock, cocoapods.manifestLock, ...cocoapods.localPodspecs] : []
|
|
17416
18684
|
])
|
|
17417
18685
|
].sort(),
|
|
18686
|
+
projectDirs: [...new Set(used.map((project) => project.projectDir))].sort(),
|
|
17418
18687
|
appIconName: settings("ASSETCATALOG_COMPILER_APPICON_NAME"),
|
|
17419
|
-
infoPlist:
|
|
18688
|
+
infoPlist: import_plist3.default.build(info),
|
|
17420
18689
|
infoPlistFile,
|
|
17421
18690
|
frameworks,
|
|
17422
18691
|
linkedProducts,
|
|
17423
18692
|
localPackageDirs: [
|
|
17424
|
-
...new Set(localPackageDirs.map((dir) =>
|
|
18693
|
+
...new Set(localPackageDirs.map((dir) => import_node_fs15.default.realpathSync(dir)))
|
|
17425
18694
|
].sort(),
|
|
17426
18695
|
binaryFrameworks: [...binaryFrameworks].map(([name2, file]) => ({ name: name2, path: file })).sort((left, right) => left.name.localeCompare(right.name)),
|
|
17427
18696
|
packageResolved,
|
|
@@ -17496,7 +18765,7 @@ function readNativeAppIdentityFromXcodeTarget(app, parseInfoPlist = parsePlistSo
|
|
|
17496
18765
|
const rtcAppGroupIdentifier = nonEmptyString2(dictionary.RTCAppGroupIdentifier);
|
|
17497
18766
|
const screenShareExtensionBundleId = typeof dictionary.ScreenShareExtensionBundleId === "string" ? dictionary.ScreenShareExtensionBundleId : void 0;
|
|
17498
18767
|
const rootModuleName = readRootModuleName(
|
|
17499
|
-
app.allSources.filter((file) => /\.(?:swift|mm|m)$/.test(file) &&
|
|
18768
|
+
app.allSources.filter((file) => /\.(?:swift|mm|m)$/.test(file) && import_node_fs16.default.existsSync(file)).map((file) => import_node_fs16.default.readFileSync(file, "utf8"))
|
|
17500
18769
|
);
|
|
17501
18770
|
return {
|
|
17502
18771
|
applicationName,
|
|
@@ -17517,7 +18786,7 @@ function readNativeAppIdentityFromXcodeTarget(app, parseInfoPlist = parsePlistSo
|
|
|
17517
18786
|
googleSignIn: readGoogleSignInConfiguration(
|
|
17518
18787
|
dictionary,
|
|
17519
18788
|
Object.fromEntries(
|
|
17520
|
-
app.resources.filter((file) => file.endsWith(".plist")).map((file) => [file, parseInfoPlist(
|
|
18789
|
+
app.resources.filter((file) => file.endsWith(".plist")).map((file) => [file, parseInfoPlist(import_node_fs16.default.readFileSync(file, "utf8"))])
|
|
17521
18790
|
)
|
|
17522
18791
|
),
|
|
17523
18792
|
supportedInterfaceOrientations,
|
|
@@ -17526,11 +18795,11 @@ function readNativeAppIdentityFromXcodeTarget(app, parseInfoPlist = parsePlistSo
|
|
|
17526
18795
|
alternateIconNames: [...alternateIconNames],
|
|
17527
18796
|
appIconArtwork: resolveNativeAppIconArtwork(
|
|
17528
18797
|
app.resources,
|
|
17529
|
-
(file) =>
|
|
18798
|
+
(file) => import_node_fs16.default.readFileSync(file, "utf8"),
|
|
17530
18799
|
(file) => {
|
|
17531
|
-
const extension =
|
|
18800
|
+
const extension = import_node_path16.default.extname(file).toLowerCase();
|
|
17532
18801
|
const contentType = extension === ".jpg" || extension === ".jpeg" ? "image/jpeg" : extension === ".webp" ? "image/webp" : "image/png";
|
|
17533
|
-
return `data:${contentType};base64,${
|
|
18802
|
+
return `data:${contentType};base64,${import_node_fs16.default.readFileSync(file).toString("base64")}`;
|
|
17534
18803
|
},
|
|
17535
18804
|
icons,
|
|
17536
18805
|
app.appIconName,
|
|
@@ -17561,22 +18830,22 @@ function readNativeAppIdentityFromSources(projectRoot, platform, parseInfoPlist,
|
|
|
17561
18830
|
const read = selectNativeAppIdentityReader(platform, {
|
|
17562
18831
|
android: () => null,
|
|
17563
18832
|
ios: () => {
|
|
17564
|
-
const iosRoot =
|
|
17565
|
-
if (!
|
|
18833
|
+
const iosRoot = import_node_path16.default.join(projectRoot, "ios");
|
|
18834
|
+
if (!import_node_fs16.default.existsSync(iosRoot)) return null;
|
|
17566
18835
|
const files = {};
|
|
17567
|
-
for (const entry of
|
|
18836
|
+
for (const entry of import_node_fs16.default.readdirSync(iosRoot, { withFileTypes: true })) {
|
|
17568
18837
|
if (entry.name === "Pods") continue;
|
|
17569
18838
|
if (entry.isDirectory()) {
|
|
17570
18839
|
const names = entry.name.endsWith(".xcodeproj") ? ["project.pbxproj"] : ["Info.plist", "AppDelegate.swift", "AppDelegate.mm", "AppDelegate.m"];
|
|
17571
18840
|
for (const name2 of names) {
|
|
17572
18841
|
const relative3 = `ios/${entry.name}/${name2}`;
|
|
17573
|
-
const file =
|
|
17574
|
-
if (
|
|
18842
|
+
const file = import_node_path16.default.join(projectRoot, relative3);
|
|
18843
|
+
if (import_node_fs16.default.existsSync(file)) files[relative3] = import_node_fs16.default.readFileSync(file, "utf8");
|
|
17575
18844
|
}
|
|
17576
18845
|
} else if (/AppDelegate\.(?:swift|mm|m)$/.test(entry.name)) {
|
|
17577
18846
|
const relative3 = `ios/${entry.name}`;
|
|
17578
|
-
const file =
|
|
17579
|
-
if (
|
|
18847
|
+
const file = import_node_path16.default.join(projectRoot, relative3);
|
|
18848
|
+
if (import_node_fs16.default.existsSync(file)) files[relative3] = import_node_fs16.default.readFileSync(file, "utf8");
|
|
17580
18849
|
}
|
|
17581
18850
|
}
|
|
17582
18851
|
return extractNativeAppIdentityFromFiles(files, "ios", parseInfoPlist, iosTarget);
|
|
@@ -17587,41 +18856,41 @@ function readNativeAppIdentityFromSources(projectRoot, platform, parseInfoPlist,
|
|
|
17587
18856
|
function readAndroidNativeAppIdentity(projectRoot, androidMergedManifest) {
|
|
17588
18857
|
const files = {};
|
|
17589
18858
|
if (androidMergedManifest) {
|
|
17590
|
-
const file =
|
|
17591
|
-
if (!
|
|
17592
|
-
files[androidMergedManifest] =
|
|
18859
|
+
const file = import_node_path16.default.resolve(projectRoot, androidMergedManifest);
|
|
18860
|
+
if (!import_node_fs16.default.existsSync(file)) return null;
|
|
18861
|
+
files[androidMergedManifest] = import_node_fs16.default.readFileSync(file, "utf8");
|
|
17593
18862
|
} else {
|
|
17594
|
-
const androidRoot =
|
|
17595
|
-
if (!
|
|
18863
|
+
const androidRoot = import_node_path16.default.join(projectRoot, "android");
|
|
18864
|
+
if (!import_node_fs16.default.existsSync(androidRoot)) return null;
|
|
17596
18865
|
const collect = (directory) => {
|
|
17597
|
-
for (const entry of
|
|
17598
|
-
const file =
|
|
18866
|
+
for (const entry of import_node_fs16.default.readdirSync(directory, { withFileTypes: true })) {
|
|
18867
|
+
const file = import_node_path16.default.join(directory, entry.name);
|
|
17599
18868
|
if (entry.isDirectory()) collect(file);
|
|
17600
18869
|
else if (entry.isFile() && entry.name === "AndroidManifest.xml")
|
|
17601
|
-
files[
|
|
18870
|
+
files[import_node_path16.default.relative(projectRoot, file).split(import_node_path16.default.sep).join("/")] = import_node_fs16.default.readFileSync(file, "utf8");
|
|
17602
18871
|
}
|
|
17603
18872
|
};
|
|
17604
|
-
for (const module2 of
|
|
18873
|
+
for (const module2 of import_node_fs16.default.readdirSync(androidRoot, { withFileTypes: true })) {
|
|
17605
18874
|
if (!module2.isDirectory()) continue;
|
|
17606
|
-
const outputs =
|
|
18875
|
+
const outputs = import_node_path16.default.join(
|
|
17607
18876
|
androidRoot,
|
|
17608
18877
|
module2.name,
|
|
17609
18878
|
"build/intermediates/merged_manifests"
|
|
17610
18879
|
);
|
|
17611
|
-
if (
|
|
18880
|
+
if (import_node_fs16.default.existsSync(outputs)) collect(outputs);
|
|
17612
18881
|
}
|
|
17613
18882
|
}
|
|
17614
18883
|
for (const manifest of Object.keys(files)) {
|
|
17615
18884
|
const resourceDirectory = androidMergedResourceValuesDirectory(manifest);
|
|
17616
18885
|
if (!resourceDirectory) continue;
|
|
17617
|
-
const absolute =
|
|
17618
|
-
if (!
|
|
17619
|
-
for (const entry of
|
|
18886
|
+
const absolute = import_node_path16.default.resolve(projectRoot, resourceDirectory);
|
|
18887
|
+
if (!import_node_fs16.default.existsSync(absolute)) continue;
|
|
18888
|
+
for (const entry of import_node_fs16.default.readdirSync(absolute, { withFileTypes: true })) {
|
|
17620
18889
|
if (!entry.isDirectory() || !/^values(?:-|$)/.test(entry.name)) continue;
|
|
17621
|
-
for (const resource of
|
|
18890
|
+
for (const resource of import_node_fs16.default.readdirSync(import_node_path16.default.join(absolute, entry.name))) {
|
|
17622
18891
|
if (!resource.endsWith(".xml")) continue;
|
|
17623
18892
|
const file = `${resourceDirectory}/${entry.name}/${resource}`;
|
|
17624
|
-
files[file] =
|
|
18893
|
+
files[file] = import_node_fs16.default.readFileSync(import_node_path16.default.resolve(projectRoot, file), "utf8");
|
|
17625
18894
|
}
|
|
17626
18895
|
}
|
|
17627
18896
|
}
|
|
@@ -17638,7 +18907,7 @@ function readIosNativeAppIdentity(projectRoot, parseInfoPlist, iosTarget) {
|
|
|
17638
18907
|
const app = readIosAppTarget(projectRoot, iosTarget);
|
|
17639
18908
|
if (!app) return null;
|
|
17640
18909
|
const identity = readNativeAppIdentityFromXcodeTarget(app, parseInfoPlist);
|
|
17641
|
-
const projectManifestPath =
|
|
18910
|
+
const projectManifestPath = import_node_path16.default.join(projectRoot, "package.json");
|
|
17642
18911
|
const projectRequire = (0, import_node_module4.createRequire)(projectManifestPath);
|
|
17643
18912
|
let reanimatedManifestPath;
|
|
17644
18913
|
try {
|
|
@@ -17652,22 +18921,22 @@ function readIosNativeAppIdentity(projectRoot, parseInfoPlist, iosTarget) {
|
|
|
17652
18921
|
throw error;
|
|
17653
18922
|
}
|
|
17654
18923
|
const installedManifest = JSON.parse(
|
|
17655
|
-
|
|
18924
|
+
import_node_fs16.default.readFileSync(reanimatedManifestPath, "utf8")
|
|
17656
18925
|
);
|
|
17657
18926
|
const installedVersion = isRecord(installedManifest) ? nonEmptyString2(installedManifest.version) : void 0;
|
|
17658
18927
|
if (!installedVersion) throw new Error("Reanimated package version is malformed");
|
|
17659
18928
|
if (Number.parseInt(installedVersion, 10) < 4) return identity;
|
|
17660
18929
|
const defaults = JSON.parse(
|
|
17661
|
-
|
|
17662
|
-
|
|
17663
|
-
|
|
18930
|
+
import_node_fs16.default.readFileSync(
|
|
18931
|
+
import_node_path16.default.join(
|
|
18932
|
+
import_node_path16.default.dirname(reanimatedManifestPath),
|
|
17664
18933
|
"src/featureFlags/staticFlags.json"
|
|
17665
18934
|
),
|
|
17666
18935
|
"utf8"
|
|
17667
18936
|
)
|
|
17668
18937
|
);
|
|
17669
18938
|
if (!isRecord(defaults)) throw new Error("Reanimated static flags are malformed");
|
|
17670
|
-
const manifest = JSON.parse(
|
|
18939
|
+
const manifest = JSON.parse(import_node_fs16.default.readFileSync(projectManifestPath, "utf8"));
|
|
17671
18940
|
const reanimated = isRecord(manifest) ? manifest.reanimated : void 0;
|
|
17672
18941
|
const overrides = isRecord(reanimated) ? reanimated.staticFeatureFlags : void 0;
|
|
17673
18942
|
if (overrides !== void 0 && !isRecord(overrides)) {
|
|
@@ -17690,9 +18959,9 @@ function readIosNativeAppIdentity(projectRoot, parseInfoPlist, iosTarget) {
|
|
|
17690
18959
|
return { ...identity, reanimatedStaticFeatureFlags: flags };
|
|
17691
18960
|
}
|
|
17692
18961
|
function readIosAppTarget(projectRoot, iosTarget) {
|
|
17693
|
-
const iosRoot =
|
|
17694
|
-
if (!
|
|
17695
|
-
const projects =
|
|
18962
|
+
const iosRoot = import_node_path16.default.join(projectRoot, "ios");
|
|
18963
|
+
if (!import_node_fs16.default.existsSync(iosRoot)) return null;
|
|
18964
|
+
const projects = import_node_fs16.default.readdirSync(iosRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory() && entry.name.endsWith(".xcodeproj"));
|
|
17696
18965
|
if (projects.length === 0) return null;
|
|
17697
18966
|
if (projects.length > 1 && !iosTarget) {
|
|
17698
18967
|
throw new NativeAppTargetSelectionError(
|
|
@@ -17702,7 +18971,7 @@ function readIosAppTarget(projectRoot, iosTarget) {
|
|
|
17702
18971
|
let project = projects[0];
|
|
17703
18972
|
if (iosTarget && projects.length > 1) {
|
|
17704
18973
|
const matches = projects.filter(
|
|
17705
|
-
(entry) => listXcodeAppTargets(
|
|
18974
|
+
(entry) => listXcodeAppTargets(import_node_path16.default.join(iosRoot, entry.name), {
|
|
17706
18975
|
requireSources: false
|
|
17707
18976
|
}).includes(iosTarget)
|
|
17708
18977
|
);
|
|
@@ -17716,7 +18985,7 @@ function readIosAppTarget(projectRoot, iosTarget) {
|
|
|
17716
18985
|
}
|
|
17717
18986
|
project = matches[0];
|
|
17718
18987
|
}
|
|
17719
|
-
const xcodeproj =
|
|
18988
|
+
const xcodeproj = import_node_path16.default.join(iosRoot, project.name);
|
|
17720
18989
|
const appTargets = listXcodeAppTargets(xcodeproj, { requireSources: false });
|
|
17721
18990
|
if (!iosTarget && appTargets.length > 1) {
|
|
17722
18991
|
throw new NativeAppTargetSelectionError(
|
|
@@ -17731,9 +19000,9 @@ function readIosAppTarget(projectRoot, iosTarget) {
|
|
|
17731
19000
|
// src/native-firebase-config.ts
|
|
17732
19001
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
17733
19002
|
var import_node_child_process6 = require("node:child_process");
|
|
17734
|
-
var
|
|
17735
|
-
var
|
|
17736
|
-
var
|
|
19003
|
+
var import_node_fs17 = __toESM(require("node:fs"), 1);
|
|
19004
|
+
var import_node_os4 = __toESM(require("node:os"), 1);
|
|
19005
|
+
var import_node_path17 = __toESM(require("node:path"), 1);
|
|
17737
19006
|
init_is_record();
|
|
17738
19007
|
var EXPO_CONFIG_SCRIPT = `const { createRequire } = require('node:module');
|
|
17739
19008
|
const { writeFileSync } = require('node:fs');
|
|
@@ -17744,13 +19013,13 @@ const result = JSON.stringify(getConfig(root, { skipSDKVersionRequirement: true
|
|
|
17744
19013
|
if (Buffer.byteLength(result) > 1024 * 1024) throw new Error('Expo native configuration exceeds 1 MiB.');
|
|
17745
19014
|
writeFileSync(process.argv[2], result, { mode: 0o600 });`;
|
|
17746
19015
|
function hasExpoConfig(projectRoot) {
|
|
17747
|
-
const appJsonPath =
|
|
17748
|
-
const appJson =
|
|
19016
|
+
const appJsonPath = import_node_path17.default.join(projectRoot, "app.json");
|
|
19017
|
+
const appJson = import_node_fs17.default.existsSync(appJsonPath) ? JSON.parse(import_node_fs17.default.readFileSync(appJsonPath, "utf8")) : null;
|
|
17749
19018
|
const staticExpo = isRecord(appJson) && (isRecord(appJson.expo) || [appJson.ios, appJson.android].some(
|
|
17750
19019
|
(value) => isRecord(value) && typeof value.googleServicesFile === "string"
|
|
17751
19020
|
));
|
|
17752
19021
|
return staticExpo || ["app.config.js", "app.config.ts", "app.config.cjs", "app.config.mjs"].some(
|
|
17753
|
-
(name2) =>
|
|
19022
|
+
(name2) => import_node_fs17.default.existsSync(import_node_path17.default.join(projectRoot, name2))
|
|
17754
19023
|
);
|
|
17755
19024
|
}
|
|
17756
19025
|
function expoConfigArgs(projectRoot, resultPath) {
|
|
@@ -17758,22 +19027,22 @@ function expoConfigArgs(projectRoot, resultPath) {
|
|
|
17758
19027
|
"--input-type=commonjs",
|
|
17759
19028
|
"-e",
|
|
17760
19029
|
EXPO_CONFIG_SCRIPT,
|
|
17761
|
-
|
|
19030
|
+
import_node_path17.default.resolve(projectRoot),
|
|
17762
19031
|
resultPath
|
|
17763
19032
|
];
|
|
17764
19033
|
}
|
|
17765
19034
|
function readExpoConfigResult(resultPath, status, stderr) {
|
|
17766
19035
|
if (status !== 0)
|
|
17767
19036
|
throw new Error(stderr || "Expo native configuration evaluation failed.");
|
|
17768
|
-
const resolved = JSON.parse(
|
|
19037
|
+
const resolved = JSON.parse(import_node_fs17.default.readFileSync(resultPath, "utf8"));
|
|
17769
19038
|
if (!isRecord(resolved)) throw new Error("Expo native configuration is unavailable.");
|
|
17770
19039
|
return resolved;
|
|
17771
19040
|
}
|
|
17772
|
-
var resultDirectory = () =>
|
|
19041
|
+
var resultDirectory = () => import_node_fs17.default.mkdtempSync(import_node_path17.default.join(import_node_os4.default.tmpdir(), "peach-expo-config-"));
|
|
17773
19042
|
function readExpoConfig(projectRoot) {
|
|
17774
19043
|
if (!hasExpoConfig(projectRoot)) return {};
|
|
17775
19044
|
const directory = resultDirectory();
|
|
17776
|
-
const resultPath =
|
|
19045
|
+
const resultPath = import_node_path17.default.join(directory, "config.json");
|
|
17777
19046
|
try {
|
|
17778
19047
|
const child = (0, import_node_child_process6.spawnSync)("node", expoConfigArgs(projectRoot, resultPath), {
|
|
17779
19048
|
cwd: projectRoot,
|
|
@@ -17785,7 +19054,7 @@ function readExpoConfig(projectRoot) {
|
|
|
17785
19054
|
if (child.error) throw child.error;
|
|
17786
19055
|
return readExpoConfigResult(resultPath, child.status, child.stderr);
|
|
17787
19056
|
} finally {
|
|
17788
|
-
|
|
19057
|
+
import_node_fs17.default.rmSync(directory, { recursive: true, force: true });
|
|
17789
19058
|
}
|
|
17790
19059
|
}
|
|
17791
19060
|
function evaluateFirebaseGuard(header, resources) {
|
|
@@ -17807,7 +19076,7 @@ function evaluateFirebaseGuard(header, resources) {
|
|
|
17807
19076
|
}
|
|
17808
19077
|
clauses.push(condition.slice(start).trim());
|
|
17809
19078
|
const sources = resources.filter(
|
|
17810
|
-
(file) =>
|
|
19079
|
+
(file) => import_node_path17.default.basename(file) === "GoogleService-Info.plist"
|
|
17811
19080
|
);
|
|
17812
19081
|
const bound = /* @__PURE__ */ new Map();
|
|
17813
19082
|
for (const clause of clauses) {
|
|
@@ -17823,7 +19092,7 @@ function evaluateFirebaseGuard(header, resources) {
|
|
|
17823
19092
|
const dictionary = /^let\s+(\w+)\s*=\s*NSDictionary\s*\(\s*contentsOfFile:\s*(\w+)\s*\)$/.exec(clause);
|
|
17824
19093
|
if (dictionary && typeof bound.get(dictionary[2]) === "string") {
|
|
17825
19094
|
const parsed = parsePlistSource(
|
|
17826
|
-
|
|
19095
|
+
import_node_fs17.default.readFileSync(String(bound.get(dictionary[2])), "utf8")
|
|
17827
19096
|
);
|
|
17828
19097
|
if (!isRecord(parsed)) return false;
|
|
17829
19098
|
bound.set(dictionary[1], parsed);
|
|
@@ -17905,7 +19174,7 @@ function findDefaultConfigureCall(body, sources) {
|
|
|
17905
19174
|
const [, type, name2] = call;
|
|
17906
19175
|
for (const file of sources) {
|
|
17907
19176
|
if (!file.endsWith(".swift")) continue;
|
|
17908
|
-
const source = blankSwiftObjcLiterals(
|
|
19177
|
+
const source = blankSwiftObjcLiterals(import_node_fs17.default.readFileSync(file, "utf8"));
|
|
17909
19178
|
const declaration = new RegExp(
|
|
17910
19179
|
`\\b(?:enum|struct|class)\\s+${type}\\b[^{]*\\{`
|
|
17911
19180
|
).exec(source);
|
|
@@ -17926,10 +19195,10 @@ function readTargetGoogleServicesFile(projectRoot, xcodeproj, target) {
|
|
|
17926
19195
|
requireSources: false
|
|
17927
19196
|
});
|
|
17928
19197
|
const delegates = app.allSources.filter(
|
|
17929
|
-
(file) => /^AppDelegate\.(swift|mm|m)$/.test(
|
|
19198
|
+
(file) => /^AppDelegate\.(swift|mm|m)$/.test(import_node_path17.default.basename(file))
|
|
17930
19199
|
);
|
|
17931
19200
|
const defaultConfigured = delegates.some((file) => {
|
|
17932
|
-
const raw =
|
|
19201
|
+
const raw = import_node_fs17.default.readFileSync(file, "utf8");
|
|
17933
19202
|
const source = blankSwiftObjcLiterals(raw);
|
|
17934
19203
|
const launch = /(?:\bfunc\s+application\s*\([\s\S]*?didFinishLaunchingWithOptions[\s\S]*?\)\s*->\s*Bool|^-\s*\(BOOL\)\s*application\s*:[\s\S]*?didFinishLaunchingWithOptions[^{]*)\s*\{/m.exec(
|
|
17935
19204
|
source
|
|
@@ -17995,27 +19264,27 @@ function readTargetGoogleServicesFile(projectRoot, xcodeproj, target) {
|
|
|
17995
19264
|
});
|
|
17996
19265
|
if (!defaultConfigured) return null;
|
|
17997
19266
|
const resources = app.resources.filter(
|
|
17998
|
-
(file) => /^GoogleService-Info\.plist$/.test(
|
|
19267
|
+
(file) => /^GoogleService-Info\.plist$/.test(import_node_path17.default.basename(file))
|
|
17999
19268
|
);
|
|
18000
19269
|
if (resources.length !== 1)
|
|
18001
19270
|
throw new Error(
|
|
18002
19271
|
"native Firebase default initialization requires one GoogleService-Info.plist build resource"
|
|
18003
19272
|
);
|
|
18004
|
-
return
|
|
19273
|
+
return import_node_path17.default.relative(import_node_fs17.default.realpathSync(projectRoot), resources[0]);
|
|
18005
19274
|
}
|
|
18006
19275
|
function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"], iosTarget, config = readExpoConfig(projectRoot)) {
|
|
18007
19276
|
const result = {};
|
|
18008
19277
|
const ios = config.ios;
|
|
18009
19278
|
if (platforms.includes("ios") && (!isRecord(ios) || typeof ios.googleServicesFile !== "string")) {
|
|
18010
|
-
const iosRoot =
|
|
18011
|
-
if (
|
|
18012
|
-
const projects =
|
|
19279
|
+
const iosRoot = import_node_path17.default.join(projectRoot, "ios");
|
|
19280
|
+
if (import_node_fs17.default.existsSync(iosRoot)) {
|
|
19281
|
+
const projects = import_node_fs17.default.readdirSync(iosRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory() && entry.name.endsWith(".xcodeproj"));
|
|
18013
19282
|
if (projects.length > 1)
|
|
18014
19283
|
throw new Error(
|
|
18015
19284
|
`native Firebase configuration requires a selected Xcode project; set withPeach's iosTarget to an app target in one of: ${projects.map((entry) => entry.name).join(", ")}`
|
|
18016
19285
|
);
|
|
18017
19286
|
if (projects.length === 1) {
|
|
18018
|
-
const xcodeproj =
|
|
19287
|
+
const xcodeproj = import_node_path17.default.join(iosRoot, projects[0].name);
|
|
18019
19288
|
const appTargets = listXcodeAppTargets(xcodeproj, { requireSources: false });
|
|
18020
19289
|
const files = new Set(
|
|
18021
19290
|
(iosTarget ? [iosTarget] : appTargets).map(
|
|
@@ -18035,8 +19304,8 @@ function readNativeFirebaseConfig(projectRoot, platforms = ["ios", "android"], i
|
|
|
18035
19304
|
const native = config[platform];
|
|
18036
19305
|
if (!isRecord(native) || typeof native.googleServicesFile !== "string") continue;
|
|
18037
19306
|
try {
|
|
18038
|
-
const source =
|
|
18039
|
-
|
|
19307
|
+
const source = import_node_fs17.default.readFileSync(
|
|
19308
|
+
import_node_path17.default.resolve(projectRoot, native.googleServicesFile),
|
|
18040
19309
|
"utf8"
|
|
18041
19310
|
);
|
|
18042
19311
|
const parsed = platform === "ios" ? parsePlistSource(source) : JSON.parse(source);
|
|
@@ -18229,13 +19498,13 @@ function readCallableMetroExport(moduleValue, label) {
|
|
|
18229
19498
|
}
|
|
18230
19499
|
function createMetroDefaultSerializer(asyncRequireModulePath) {
|
|
18231
19500
|
const projectRequire = (0, import_module2.createRequire)(asyncRequireModulePath);
|
|
18232
|
-
const metroRoot =
|
|
19501
|
+
const metroRoot = import_path6.default.dirname(projectRequire.resolve("metro/package.json"));
|
|
18233
19502
|
const baseJSBundle = readCallableMetroExport(
|
|
18234
|
-
projectRequire(
|
|
19503
|
+
projectRequire(import_path6.default.join(metroRoot, "src/DeltaBundler/Serializers/baseJSBundle.js")),
|
|
18235
19504
|
"baseJSBundle"
|
|
18236
19505
|
);
|
|
18237
19506
|
const bundleToString = readCallableMetroExport(
|
|
18238
|
-
projectRequire(
|
|
19507
|
+
projectRequire(import_path6.default.join(metroRoot, "src/lib/bundleToString.js")),
|
|
18239
19508
|
"bundleToString"
|
|
18240
19509
|
);
|
|
18241
19510
|
return (entryPoint, preModules, graph, options) => {
|
|
@@ -18257,7 +19526,7 @@ async function appendRNXModulePaths(result, graph, options, projectRoot, emptyMo
|
|
|
18257
19526
|
}
|
|
18258
19527
|
const modulePaths = {};
|
|
18259
19528
|
for (const module2 of dependencies.values()) {
|
|
18260
|
-
modulePaths[String(createModuleId(module2.path))] =
|
|
19529
|
+
modulePaths[String(createModuleId(module2.path))] = import_path6.default.relative(projectRoot, module2.path).replaceAll(import_path6.default.sep, "/");
|
|
18261
19530
|
}
|
|
18262
19531
|
if (Object.keys(modulePaths).length !== dependencies.size) {
|
|
18263
19532
|
throw new Error("peachsim: bundle module IDs were not unique");
|
|
@@ -18347,8 +19616,8 @@ function withPeach(config, options = {}) {
|
|
|
18347
19616
|
graph,
|
|
18348
19617
|
serializerOptions,
|
|
18349
19618
|
cfgProjectRoot,
|
|
18350
|
-
configuredEmptyModulePath ??
|
|
18351
|
-
|
|
19619
|
+
configuredEmptyModulePath ?? import_path6.default.join(
|
|
19620
|
+
import_path6.default.dirname(serializerOptions.asyncRequireModulePath),
|
|
18352
19621
|
"empty-module.js"
|
|
18353
19622
|
)
|
|
18354
19623
|
);
|
|
@@ -18459,6 +19728,7 @@ function withPeach(config, options = {}) {
|
|
|
18459
19728
|
}
|
|
18460
19729
|
return;
|
|
18461
19730
|
}
|
|
19731
|
+
if (serveBrowserProxyRoute(req, res)) return;
|
|
18462
19732
|
const url = req.url || "";
|
|
18463
19733
|
const pathname = url.split("?")[0];
|
|
18464
19734
|
const runtimeRoot = resolveRuntimeRootForRequestHost(req.headers?.host);
|
|
@@ -18489,14 +19759,13 @@ function withPeach(config, options = {}) {
|
|
|
18489
19759
|
}
|
|
18490
19760
|
}
|
|
18491
19761
|
if (pathname === prefix || pathname === prefix + "/" || pathname.startsWith(prefix + "/")) {
|
|
18492
|
-
const ext =
|
|
19762
|
+
const ext = import_path6.default.extname(pathname);
|
|
18493
19763
|
if (!ext) {
|
|
18494
|
-
const htmlPath =
|
|
18495
|
-
let html =
|
|
19764
|
+
const htmlPath = import_path6.default.join(runtimeRoot, "index.html");
|
|
19765
|
+
let html = import_fs7.default.readFileSync(htmlPath, "utf8");
|
|
18496
19766
|
const script = `<script>(function(){var u=new URL(location.href);if(!u.searchParams.has('bundle'))u.searchParams.set('bundle',${JSON.stringify(bundleUrl)});history.replaceState(null,'','${prefix}/'+u.search)})()</script>`;
|
|
18497
19767
|
html = html.includes("</head>") ? html.replace("</head>", `${script}</head>`) : `${html}${script}`;
|
|
18498
|
-
res
|
|
18499
|
-
res.end(html);
|
|
19768
|
+
sendShellHtml(res, html);
|
|
18500
19769
|
return;
|
|
18501
19770
|
}
|
|
18502
19771
|
}
|
|
@@ -18528,13 +19797,13 @@ var metro_plugin_default = withPeach;
|
|
|
18528
19797
|
|
|
18529
19798
|
// src/jump-to-source-babel.ts
|
|
18530
19799
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
18531
|
-
function normalizeSourcePath(
|
|
18532
|
-
const queryStart =
|
|
18533
|
-
const clean = queryStart >= 0 ?
|
|
19800
|
+
function normalizeSourcePath(path22) {
|
|
19801
|
+
const queryStart = path22.indexOf("?");
|
|
19802
|
+
const clean = queryStart >= 0 ? path22.slice(0, queryStart) : path22;
|
|
18534
19803
|
return clean.replace(/\\/g, "/");
|
|
18535
19804
|
}
|
|
18536
|
-
function matchesPath(
|
|
18537
|
-
return typeof matcher === "string" ?
|
|
19805
|
+
function matchesPath(path22, matcher) {
|
|
19806
|
+
return typeof matcher === "string" ? path22.includes(matcher) : matcher.test(path22);
|
|
18538
19807
|
}
|
|
18539
19808
|
function shouldStampFile(filename, options) {
|
|
18540
19809
|
const normalized = normalizeSourcePath(filename);
|
|
@@ -18554,11 +19823,11 @@ function sootsimJumpToSourceBabelPlugin(api, options = {}) {
|
|
|
18554
19823
|
name: "sootsim-jump-to-source",
|
|
18555
19824
|
visitor: {
|
|
18556
19825
|
JSXElement: {
|
|
18557
|
-
exit(
|
|
19826
|
+
exit(path22, state) {
|
|
18558
19827
|
if (options.enabled === false) return;
|
|
18559
19828
|
const filename = state.filename;
|
|
18560
19829
|
if (!filename || !shouldStampFile(filename, options)) return;
|
|
18561
|
-
const node =
|
|
19830
|
+
const node = path22.node;
|
|
18562
19831
|
if (stamped.has(node)) return;
|
|
18563
19832
|
stamped.add(node);
|
|
18564
19833
|
const opening = node.openingElement;
|
|
@@ -18577,12 +19846,12 @@ function sootsimJumpToSourceBabelPlugin(api, options = {}) {
|
|
|
18577
19846
|
);
|
|
18578
19847
|
return;
|
|
18579
19848
|
}
|
|
18580
|
-
const fn =
|
|
19849
|
+
const fn = path22.getFunctionParent();
|
|
18581
19850
|
const parameterDefault = Boolean(
|
|
18582
19851
|
fn && opening.start != null && fn.node.body.start != null && opening.start < fn.node.body.start
|
|
18583
19852
|
);
|
|
18584
|
-
const type =
|
|
18585
|
-
if (!parameterDefault)
|
|
19853
|
+
const type = path22.scope.generateUidIdentifier("PeachSourceType");
|
|
19854
|
+
if (!parameterDefault) path22.scope.push({ id: type });
|
|
18586
19855
|
function expression(tag) {
|
|
18587
19856
|
return t.isJSXIdentifier(tag) ? t.identifier(tag.name) : t.memberExpression(
|
|
18588
19857
|
expression(tag.object),
|
|
@@ -18617,10 +19886,10 @@ function sootsimJumpToSourceBabelPlugin(api, options = {}) {
|
|
|
18617
19886
|
),
|
|
18618
19887
|
node
|
|
18619
19888
|
);
|
|
18620
|
-
if (
|
|
18621
|
-
|
|
19889
|
+
if (path22.parentPath.isJSXElement() || path22.parentPath.isJSXFragment()) {
|
|
19890
|
+
path22.replaceWith(t.jsxExpressionContainer(replacement));
|
|
18622
19891
|
} else {
|
|
18623
|
-
|
|
19892
|
+
path22.replaceWith(replacement);
|
|
18624
19893
|
}
|
|
18625
19894
|
}
|
|
18626
19895
|
}
|