peachsim 0.1.1644 → 0.1.1654
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/cli/app-catalog.ts +1 -1
- package/cli/app-fonts.ts +11 -80
- package/cli/app-splash.ts +18 -12
- package/cli/app-stubs.ts +97 -14
- package/cli/bridge-diagnostics.ts +10 -7
- package/cli/bridge-flow-runner.ts +11 -7
- package/cli/cloud-client.ts +21 -15
- package/cli/command-registry.ts +13 -4
- package/cli/commands/box.ts +4 -4
- package/cli/commands/control.ts +93 -53
- package/cli/commands/coverage-parser.ts +67 -0
- package/cli/commands/coverage.ts +550 -0
- package/cli/commands/debug.ts +9 -18
- package/cli/commands/desktop.ts +19 -7
- package/cli/commands/device.ts +14 -9
- package/cli/commands/doctor.ts +20 -10
- package/cli/commands/guest-host.ts +6 -10
- package/cli/commands/inspect/core.ts +83 -18
- package/cli/commands/inspect/shared.ts +2 -0
- package/cli/commands/inspect.ts +24 -10
- package/cli/commands/kotlin.ts +2 -2
- package/cli/commands/maestro-compare.ts +1 -1
- package/cli/commands/platform.ts +20 -11
- package/cli/commands/preview.ts +16 -18
- package/cli/commands/runtime.ts +3 -2
- package/cli/commands/screenshot-layers.ts +1 -1
- package/cli/commands/screenshot.ts +1 -1
- package/cli/commands/serve.ts +5 -1
- package/cli/commands/support.ts +4 -4
- package/cli/commands/three-mode.ts +22 -15
- package/cli/commands/upload.ts +44 -45
- package/cli/current-sim.ts +38 -0
- package/cli/desktop-companion.ts +36 -8
- package/cli/device-option.ts +1 -1
- package/cli/drivers/playwright.ts +1 -0
- package/cli/drivers/types.ts +4 -0
- package/cli/help-core.ts +1 -1
- package/cli/internal-child.ts +2 -1
- package/cli/main.ts +9 -3
- package/cli/outbound-endpoints.ts +11 -3
- package/cli/output-redaction.ts +59 -18
- package/cli/pause-aware-timeout.ts +24 -10
- package/cli/remote-simulators.ts +4 -1
- package/cli/scene-video.ts +5 -2
- package/cli/send-to-box.ts +7 -10
- package/cli/telemetry.ts +1 -1
- package/cli/ws-bridge.ts +25 -2
- package/detox/attempt-events.cjs +3 -1
- package/detox/attempt-events.d.cts +1 -1
- package/detox/expectations.ts +108 -99
- package/detox/frame-offset.d.mts +6 -0
- package/detox/frame-offset.mjs +35 -0
- package/detox/gestures.ts +6 -18
- package/detox/index.ts +169 -101
- package/detox/jest-preset.cjs +1 -3
- package/detox/jest-transform.cjs +4 -0
- package/detox/matchers.ts +3 -0
- package/detox/motion-change.cjs +46 -114
- package/detox/motion-change.d.cts +5 -27
- 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 +65 -1
- package/dist-lib/bridge-contract-input.mjs +63 -1
- package/dist-lib/bridge-contract.cjs +19 -1
- package/dist-lib/bridge-contract.mjs +17 -1
- package/dist-lib/bundle-channel.cjs +38081 -14844
- 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 +5 -3
- package/dist-lib/detox/index.cjs +1277 -4507
- package/dist-lib/detox/jest-preset.cjs +1 -3
- package/dist-lib/detox/jest-transform.cjs +4 -0
- package/dist-lib/dev-bundle-resolution.cjs +28 -24
- package/dist-lib/expo-swift-bundle.cjs +35039 -13123
- 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 +45136 -63149
- package/dist-lib/host/fetch-proxy-handler.cjs +3689 -11
- 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 +7740 -7600
- 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 +2 -2
- 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 +441 -535
- package/dist-lib/native-app-identity-project.cjs +39 -252
- package/dist-lib/native-app-identity-project.mjs +1174 -11
- package/dist-lib/native-app-identity.cjs +8 -3
- package/dist-lib/native-app-identity.mjs +8 -3
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +2 -244
- 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 +290 -0
- package/dist-lib/public-origins-lib-static.json +1 -0
- package/dist-lib/public-origins-lib.json +1860 -0
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +14 -253
- package/dist-lib/sdk.cjs +84 -17
- package/dist-lib/sdk.mjs +82 -16
- package/dist-lib/skills.cjs +50663 -75116
- package/dist-lib/swift-compile.cjs +25912 -1065
- package/dist-lib/swift-compile.mjs +25901 -1049
- package/dist-lib/swift-package.cjs +79 -1
- package/dist-lib/swift-package.mjs +75 -1
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +34294 -12378
- package/dist-lib/vite.cjs +687 -427
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-compat/src/engine-config.d.ts +2 -0
- package/dist-types/packages/peach-compat/src/stubs/form-sheet-spring.d.ts +9 -0
- package/dist-types/packages/peach-compat/src/stubs/native-evaluation-lease.d.ts +47 -0
- package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-cookies.d.ts +113 -0
- package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-gesture-handler.d.ts +155 -0
- package/dist-types/packages/peach-compat/src/stubs/screen-transition-math.d.ts +759 -0
- package/dist-types/packages/peach-compat/src/stubs/transition-scalar.d.ts +25 -0
- package/dist-types/packages/peach-engine/src/billing/plans.d.ts +64 -0
- package/dist-types/packages/peach-engine/src/browser-page-target.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/bundle-platform-url.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/capture/browser-accessibility-host.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/capture/browser-composite.d.ts +65 -0
- package/dist-types/packages/peach-engine/src/capture/browserAccessibilityContract.d.ts +27 -0
- package/dist-types/packages/peach-engine/src/capture/nativeScreenCaptureContract.d.ts +22 -0
- package/dist-types/packages/peach-engine/src/cli-companion.d.ts +37 -0
- package/dist-types/packages/peach-engine/src/components/native-ui/webview-frame-bridge.d.ts +34 -0
- package/dist-types/packages/peach-engine/src/config.d.ts +5 -0
- package/dist-types/packages/peach-engine/src/engine/android-stretch-effect.d.ts +57 -0
- package/dist-types/packages/peach-engine/src/engine/animated-driven-style.d.ts +47 -0
- package/dist-types/packages/peach-engine/src/engine/animated-value.d.ts +5 -0
- package/dist-types/packages/peach-engine/src/engine/animated.d.ts +195 -0
- package/dist-types/packages/peach-engine/src/engine/animation-clockContract.d.ts +15 -0
- package/dist-types/packages/peach-engine/src/engine/animation-graph.d.ts +148 -0
- package/dist-types/packages/peach-engine/src/engine/app-catalog-wire.d.ts +10 -0
- package/dist-types/packages/peach-engine/src/engine/app-font-registry.d.ts +87 -0
- package/dist-types/packages/peach-engine/src/engine/attributed-paragraph-paint.d.ts +7 -0
- package/dist-types/packages/peach-engine/src/engine/attributed-paragraph.d.ts +123 -0
- package/dist-types/packages/peach-engine/src/engine/audioContract.d.ts +16 -0
- package/dist-types/packages/peach-engine/src/engine/canvaskit-api.d.ts +93 -0
- package/dist-types/packages/peach-engine/src/engine/canvaskit-renderer.d.ts +216 -0
- package/dist-types/packages/peach-engine/src/engine/config-plugin-fonts.d.ts +40 -0
- package/dist-types/packages/peach-engine/src/engine/config-plugin-splash.d.ts +25 -0
- package/dist-types/packages/peach-engine/src/engine/cull-visibility.d.ts +44 -0
- package/dist-types/packages/peach-engine/src/engine/damage-rect.d.ts +19 -0
- package/dist-types/packages/peach-engine/src/engine/engine-resource.d.ts +6 -0
- package/dist-types/packages/peach-engine/src/engine/expo-manifest.d.ts +5 -0
- package/dist-types/packages/peach-engine/src/engine/fiber-debug-metadata.d.ts +30 -0
- package/dist-types/packages/peach-engine/src/engine/font-config.d.ts +139 -0
- package/dist-types/packages/peach-engine/src/engine/generated/sf-pro-font.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/glass-material.d.ts +31 -0
- package/dist-types/packages/peach-engine/src/engine/host-composite.d.ts +100 -0
- package/dist-types/packages/peach-engine/src/engine/hosted-semantics.d.ts +49 -0
- package/dist-types/packages/peach-engine/src/engine/image-audit.d.ts +70 -0
- package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +350 -0
- package/dist-types/packages/peach-engine/src/engine/inspect-info.d.ts +27 -0
- package/dist-types/packages/peach-engine/src/engine/inspect-outline.d.ts +14 -0
- package/dist-types/packages/peach-engine/src/engine/inspect-visibility.d.ts +33 -0
- package/dist-types/packages/peach-engine/src/engine/ios-fast-scroll.d.ts +16 -0
- package/dist-types/packages/peach-engine/src/engine/layout-sab.d.ts +43 -0
- package/dist-types/packages/peach-engine/src/engine/liquid-glass-rect.d.ts +23 -0
- package/dist-types/packages/peach-engine/src/engine/liquid-glass-shaders.d.ts +9 -0
- package/dist-types/packages/peach-engine/src/engine/liquid-glass.d.ts +283 -0
- package/dist-types/packages/peach-engine/src/engine/live-object-counts.d.ts +6 -0
- package/dist-types/packages/peach-engine/src/engine/lottie-runtime.d.ts +32 -0
- package/dist-types/packages/peach-engine/src/engine/lottie-types.d.ts +138 -0
- package/dist-types/packages/peach-engine/src/engine/memory-counts.d.ts +27 -0
- package/dist-types/packages/peach-engine/src/engine/metalDirectContract.d.ts +108 -0
- package/dist-types/packages/peach-engine/src/engine/metalShaderContract.d.ts +217 -0
- package/dist-types/packages/peach-engine/src/engine/native-animation-driver.d.ts +112 -0
- package/dist-types/packages/peach-engine/src/engine/native-animation-graph.d.ts +62 -0
- package/dist-types/packages/peach-engine/src/engine/native-layout.d.ts +133 -0
- package/dist-types/packages/peach-engine/src/engine/native-resources.d.ts +26 -0
- package/dist-types/packages/peach-engine/src/engine/nativeReanimatedContract.d.ts +25 -0
- package/dist-types/packages/peach-engine/src/engine/nativeReplayContract.d.ts +64 -0
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +591 -0
- package/dist-types/packages/peach-engine/src/engine/paint-boundary-types.d.ts +112 -0
- package/dist-types/packages/peach-engine/src/engine/paint-boundary.d.ts +57 -0
- package/dist-types/packages/peach-engine/src/engine/portalContract.d.ts +21 -0
- package/dist-types/packages/peach-engine/src/engine/portals.d.ts +20 -0
- package/dist-types/packages/peach-engine/src/engine/render-damage.d.ts +107 -0
- package/dist-types/packages/peach-engine/src/engine/riveContract.d.ts +420 -0
- package/dist-types/packages/peach-engine/src/engine/rn-spring.d.ts +51 -0
- package/dist-types/packages/peach-engine/src/engine/scene-table.d.ts +379 -0
- package/dist-types/packages/peach-engine/src/engine/scroll-momentum-math.d.ts +152 -0
- package/dist-types/packages/peach-engine/src/engine/scroll-pan-contacts.d.ts +10 -0
- package/dist-types/packages/peach-engine/src/engine/scroll-platform.d.ts +75 -0
- package/dist-types/packages/peach-engine/src/engine/scroll-range.d.ts +14 -0
- package/dist-types/packages/peach-engine/src/engine/scroll-velocity.d.ts +14 -0
- package/dist-types/packages/peach-engine/src/engine/scroll.d.ts +320 -0
- package/dist-types/packages/peach-engine/src/engine/signal.d.ts +7 -0
- package/dist-types/packages/peach-engine/src/engine/snapshot-cache-policy.d.ts +6 -0
- package/dist-types/packages/peach-engine/src/engine/svg-geometry.d.ts +41 -0
- package/dist-types/packages/peach-engine/src/engine/text-attachment-paragraphs.d.ts +10 -0
- package/dist-types/packages/peach-engine/src/engine/text-decoration.d.ts +11 -0
- package/dist-types/packages/peach-engine/src/engine/text-first-baseline.d.ts +23 -0
- package/dist-types/packages/peach-engine/src/engine/text-line-break.d.ts +22 -0
- package/dist-types/packages/peach-engine/src/engine/text-paint-receipt.d.ts +98 -0
- package/dist-types/packages/peach-engine/src/engine/text-paragraph.d.ts +11 -0
- package/dist-types/packages/peach-engine/src/engine/text-paragraphContract.d.ts +34 -0
- package/dist-types/packages/peach-engine/src/engine/text-transform.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/types.d.ts +657 -0
- package/dist-types/packages/peach-engine/src/engine/visible-frame.d.ts +55 -0
- package/dist-types/packages/peach-engine/src/engine/webrtcContract.d.ts +74 -0
- package/dist-types/packages/peach-engine/src/graphite-stats-fields.d.ts +184 -0
- package/dist-types/packages/peach-engine/src/guest-import-meta.d.ts +12 -0
- package/dist-types/packages/peach-engine/src/guest-module-overrides.d.ts +7 -0
- package/dist-types/packages/peach-engine/src/ios/app-card-types.d.ts +7 -0
- package/dist-types/packages/peach-engine/src/ios/apps/canvas-map-data.d.ts +177 -0
- package/dist-types/packages/peach-engine/src/ios/aux-home-scene.d.ts +54 -0
- package/dist-types/packages/peach-engine/src/ios/chrome-metrics.d.ts +47 -0
- package/dist-types/packages/peach-engine/src/ios/constants.d.ts +21 -0
- package/dist-types/packages/peach-engine/src/ios/duo-housing.d.ts +37 -0
- package/dist-types/packages/peach-engine/src/ios/home/types.d.ts +29 -0
- package/dist-types/packages/peach-engine/src/ios/home-app-catalog.d.ts +43 -0
- package/dist-types/packages/peach-engine/src/ios/photo-store.d.ts +73 -0
- package/dist-types/packages/peach-engine/src/ios/photoLibraryContract.d.ts +166 -0
- package/dist-types/packages/peach-engine/src/ios/shell-controller-types.d.ts +21 -0
- package/dist-types/packages/peach-engine/src/ios/shell-transition-debug.d.ts +18 -0
- package/dist-types/packages/peach-engine/src/metro-asset-path.d.ts +21 -0
- package/dist-types/packages/peach-engine/src/metro-fingerprint-registry-client.d.ts +11 -0
- package/dist-types/packages/peach-engine/src/metro-fingerprint.d.ts +38 -0
- package/dist-types/packages/peach-engine/src/native-preview-bundle.d.ts +44 -0
- package/dist-types/packages/peach-engine/src/observability/types.d.ts +75 -0
- package/dist-types/packages/peach-engine/src/peach-warm-manifest.d.ts +32 -0
- package/dist-types/packages/peach-engine/src/permissions/app-settings-client.d.ts +25 -0
- package/dist-types/packages/peach-engine/src/permissions/system-permission-types.d.ts +20 -0
- package/dist-types/packages/peach-engine/src/platform/android-back-panel.d.ts +131 -0
- package/dist-types/packages/peach-engine/src/platform/android-gesture-exclusion.d.ts +28 -0
- package/dist-types/packages/peach-engine/src/platform/android-predictive-back.d.ts +33 -0
- package/dist-types/packages/peach-engine/src/platform/system-bars-state.d.ts +14 -0
- package/dist-types/packages/peach-engine/src/playwright-sim-host.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/preview/bundle-layout.d.ts +8 -0
- package/dist-types/packages/peach-engine/src/preview/bundle-variantContract.d.ts +24 -0
- package/dist-types/packages/peach-engine/src/preview/capture-bundle.d.ts +26 -0
- package/dist-types/packages/peach-engine/src/preview/compress-node.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/preview/compress.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/preview/presigned-upload.d.ts +60 -0
- package/dist-types/packages/peach-engine/src/preview/trace.d.ts +144 -0
- package/dist-types/packages/peach-engine/src/preview/upload-protocol.d.ts +152 -0
- package/dist-types/packages/peach-engine/src/profiler/animation-recording-loader.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/profiler/profile-trace.d.ts +4 -0
- package/dist-types/packages/peach-engine/src/react-bridge.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/react-native/AppState.d.ts +45 -0
- package/dist-types/packages/peach-engine/src/react-native/Appearance.d.ts +34 -0
- package/dist-types/packages/peach-engine/src/react-native/framework-colors-data.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/react-native/host-services.d.ts +42 -0
- package/dist-types/packages/peach-engine/src/react-native/layout-animation.d.ts +22 -0
- package/dist-types/packages/peach-engine/src/react-native/platform-colors.d.ts +17 -0
- package/dist-types/packages/peach-engine/src/remote-stream/client-config.d.ts +10 -0
- package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +58 -0
- package/dist-types/packages/peach-engine/src/remote-stream/scene-recording.d.ts +45 -0
- package/dist-types/packages/peach-engine/src/render-worker/animated-drive-output.d.ts +35 -0
- package/dist-types/packages/peach-engine/src/render-worker/app-load.d.ts +16 -0
- package/dist-types/packages/peach-engine/src/render-worker/aux-surface-types.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/render-worker/canvaskit-shared.d.ts +42 -0
- package/dist-types/packages/peach-engine/src/render-worker/canvaskit-webgpu.d.ts +434 -0
- package/dist-types/packages/peach-engine/src/render-worker/canvaskit-worker-init.d.ts +12 -0
- package/dist-types/packages/peach-engine/src/render-worker/compositor-backend.d.ts +31 -0
- package/dist-types/packages/peach-engine/src/render-worker/compositor-gpu.d.ts +202 -0
- package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +1983 -0
- package/dist-types/packages/peach-engine/src/render-worker/compositor-runtime/scroll-drag-resample.d.ts +44 -0
- package/dist-types/packages/peach-engine/src/render-worker/css-keyframes-drive.d.ts +36 -0
- package/dist-types/packages/peach-engine/src/render-worker/edit-menu-geometry.d.ts +8 -0
- package/dist-types/packages/peach-engine/src/render-worker/engine-resource-relay.d.ts +21 -0
- package/dist-types/packages/peach-engine/src/render-worker/expo-widgetContract.d.ts +16 -0
- package/dist-types/packages/peach-engine/src/render-worker/gesture-seam-protocol.d.ts +152 -0
- package/dist-types/packages/peach-engine/src/render-worker/graph-linked-value.d.ts +29 -0
- package/dist-types/packages/peach-engine/src/render-worker/graphite-pipeline-compiler-contract.d.ts +49 -0
- package/dist-types/packages/peach-engine/src/render-worker/graphite-pipeline-compiler.d.ts +12 -0
- package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +756 -0
- package/dist-types/packages/peach-engine/src/render-worker/image-lifecycle-event.d.ts +22 -0
- package/dist-types/packages/peach-engine/src/render-worker/image-pixel-contract.d.ts +48 -0
- package/dist-types/packages/peach-engine/src/render-worker/live-frame-mirror.d.ts +34 -0
- package/dist-types/packages/peach-engine/src/render-worker/map-command-channel.d.ts +189 -0
- package/dist-types/packages/peach-engine/src/render-worker/mapNativeContract.d.ts +101 -0
- package/dist-types/packages/peach-engine/src/render-worker/native-dynamic-synchronizable.d.ts +22 -0
- package/dist-types/packages/peach-engine/src/render-worker/native-menu-gesture.d.ts +9 -0
- package/dist-types/packages/peach-engine/src/render-worker/native-ui-commandContract.d.ts +23 -0
- package/dist-types/packages/peach-engine/src/render-worker/native-ui-protocol.d.ts +1087 -0
- package/dist-types/packages/peach-engine/src/render-worker/native-widgetContract.d.ts +100 -0
- package/dist-types/packages/peach-engine/src/render-worker/nativeAnimMirrorContract.d.ts +174 -0
- package/dist-types/packages/peach-engine/src/render-worker/nativeSyncReplyContract.d.ts +11 -0
- package/dist-types/packages/peach-engine/src/render-worker/one-native-contentContract.d.ts +54 -0
- package/dist-types/packages/peach-engine/src/render-worker/pointerSampleContract.d.ts +14 -0
- package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +880 -0
- package/dist-types/packages/peach-engine/src/render-worker/reanimated-css-contract.d.ts +63 -0
- package/dist-types/packages/peach-engine/src/render-worker/reanimated-readiness.d.ts +29 -0
- package/dist-types/packages/peach-engine/src/render-worker/resilient-frame-clock.d.ts +22 -0
- package/dist-types/packages/peach-engine/src/render-worker/retained-app-load.d.ts +20 -0
- package/dist-types/packages/peach-engine/src/render-worker/screen-edge-swipe-commit-protocol.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/render-worker/screen-form-sheet-commit-protocol.d.ts +26 -0
- package/dist-types/packages/peach-engine/src/render-worker/scroll-mirror-tenant.d.ts +37 -0
- package/dist-types/packages/peach-engine/src/render-worker/scroll-mirror.d.ts +164 -0
- package/dist-types/packages/peach-engine/src/render-worker/shell-event-registry.d.ts +119 -0
- package/dist-types/packages/peach-engine/src/render-worker/shell-gesture-regions.d.ts +41 -0
- package/dist-types/packages/peach-engine/src/render-worker/shell-protocol.d.ts +603 -0
- package/dist-types/packages/peach-engine/src/render-worker/shell-scene-schema.d.ts +101 -0
- package/dist-types/packages/peach-engine/src/render-worker/shell-tree-inline-sources.d.ts +13 -0
- package/dist-types/packages/peach-engine/src/render-worker/shell-tree-wire.d.ts +87 -0
- package/dist-types/packages/peach-engine/src/render-worker/test-bridge-protocol.d.ts +47 -0
- package/dist-types/packages/peach-engine/src/render-worker/text-inputContract.d.ts +93 -0
- package/dist-types/packages/peach-engine/src/render-worker/tree-sync-port.d.ts +102 -0
- package/dist-types/packages/peach-engine/src/render-worker/webgpu-frame-transaction.d.ts +292 -0
- package/dist-types/packages/peach-engine/src/render-worker/webgpu-readback-scheduler.d.ts +107 -0
- package/dist-types/packages/peach-engine/src/render-worker/webview-capture-protocol.d.ts +16 -0
- package/dist-types/packages/peach-engine/src/render-worker/worker-input-runtime.d.ts +211 -0
- package/dist-types/packages/peach-engine/src/render-worker/worker-storage.d.ts +33 -0
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +987 -0
- package/dist-types/packages/peach-engine/src/render-worker/worklet-sab.d.ts +24 -0
- package/dist-types/packages/peach-engine/src/rolldown-bundle-inventory.d.ts +89 -0
- package/dist-types/packages/peach-engine/src/rolldown-production-fingerprint.d.ts +31 -0
- package/dist-types/packages/peach-engine/src/screenshots/timeline-assets.d.ts +10 -0
- package/dist-types/packages/peach-engine/src/screenshots/tokens.d.ts +9 -0
- package/dist-types/packages/peach-engine/src/settings/devices.d.ts +70 -0
- package/dist-types/packages/peach-engine/src/settings/duo-fold-bus.d.ts +87 -0
- package/dist-types/packages/peach-engine/src/settings/interface-rotation.d.ts +30 -0
- package/dist-types/packages/peach-engine/src/settings/react-native-configuration.d.ts +12 -0
- package/dist-types/packages/peach-engine/src/settings/scene-geometryContract.d.ts +40 -0
- package/dist-types/packages/peach-engine/src/settings/store.d.ts +37 -0
- package/dist-types/packages/peach-engine/src/shell-events.d.ts +203 -0
- package/dist-types/packages/peach-engine/src/shell-intent.d.ts +68 -0
- package/dist-types/packages/peach-engine/src/sootsim-event.d.ts +35 -0
- package/dist-types/packages/peach-engine/src/top-overlay-state.d.ts +5 -0
- package/dist-types/packages/peach-engine/src/web-authentication-automation-host.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/webAuthenticationContract.d.ts +34 -0
- package/dist-types/packages/peach-engine/src/webview-automation-host.d.ts +180 -0
- package/dist-types/packages/peach-engine/src/wireframe-mode.d.ts +16 -0
- package/dist-types/packages/peach-globals/src/frameBreakdownContract.d.ts +16 -0
- package/dist-types/packages/peach-globals/src/index.d.ts +3311 -0
- package/dist-types/packages/peach-globals/src/nativeSurfaceContract.d.ts +76 -0
- package/dist-types/packages/peach-globals/src/pointerSourceEventContract.d.ts +8 -0
- package/dist-types/packages/peach-globals/src/profileTrace.d.ts +11 -0
- package/dist-types/packages/peach-globals/src/profilerContract.d.ts +223 -0
- package/dist-types/packages/peach-kit/src/capabilities.d.ts +721 -0
- package/dist-types/packages/peach-kit/src/internal.d.ts +4 -0
- package/dist-types/packages/peach-kit/src/materials/types.d.ts +27 -0
- package/dist-types/packages/peach-kit/src/materials/uikit-blur-material.d.ts +14 -0
- package/dist-types/packages/peach-kit/src/navigation-types.d.ts +11 -0
- package/dist-types/packages/peach-kit/src/react-bridge.d.ts +53 -0
- package/dist-types/packages/peach-kit/src/runtime.d.ts +26 -0
- package/dist-types/packages/peach-kit/src/ui/hosting-safe-area.d.ts +24 -0
- package/dist-types/packages/peach-kit/src/ui/popover-placement.d.ts +53 -0
- package/dist-types/packages/peach-kit/src/ui/presentationContract.d.ts +17 -0
- package/kotlin/ComposeSources/PeachComposeHost.kt +1 -1
- package/kotlin/JniSources/com/facebook/jni/HybridData.kt +0 -2
- package/kotlin/JniSources/dev/peach/jni/NativeBindings.kt +0 -2
- package/kotlin/JniTransportSources/dev/peach/jni/integration/JniTransport.kt +0 -2
- package/kotlin/README.md +6 -0
- package/package.json +26 -2
- package/runtime-companion.json +1 -0
- package/skills/contrast/SKILL.md +1 -0
- package/src/assetCatalogContract.ts +21 -0
- package/src/bridge-contract-input.ts +84 -0
- package/src/bridge-contract.ts +37 -3
- package/src/browser-launch-policy.ts +1 -0
- package/src/bundle-channel.mjs +4 -2
- package/src/bundleGlobalFooter.ts +9 -0
- package/src/cli-runtime.ts +55 -0
- package/src/crash-fingerprint.ts +26 -0
- package/src/dev-bundle-resolution.ts +50 -23
- package/src/device-catalog.ts +1159 -0
- package/src/host/bridge-host.ts +3 -26
- package/src/host/browser-pointer.ts +71 -0
- package/src/host/dev-server-package-versions.ts +23 -0
- package/src/host/fetch-proxy-handler.ts +54 -4
- package/src/installed-package-versions.ts +142 -38
- package/src/kotlin-host.ts +1 -1
- package/src/metro-plugin.ts +4 -4
- package/src/metro-project-root.ts +68 -0
- package/src/nitro-adapter.lock.json +26 -0
- package/src/nitro-adapter.ts +103 -0
- package/src/nitro-bundle.ts +24 -10
- package/src/nitro-compile.ts +33 -51
- package/src/nitro-source.ts +177 -96
- package/src/nitroAdapterContract.ts +217 -0
- package/src/nitroContract.ts +24 -11
- package/src/process-group.ts +41 -34
- package/src/react-bridge-importers.ts +28 -0
- package/src/reactNativeConfigurationContract.ts +36 -0
- package/src/runtime-assets.ts +7 -2
- package/src/runtime-delivery.ts +2 -0
- package/src/runtimePlatformContract.ts +70 -0
- package/src/screenshots/frame-compose.ts +42 -43
- package/src/screenshots/org-deck.ts +9 -4
- package/src/screenshots/preset-names.ts +29 -0
- package/src/screenshots/registry.ts +5 -5
- package/src/screenshots/schema.ts +1 -1
- package/src/screenshots/screenshotContract.ts +971 -0
- package/src/settings-flags.ts +107 -0
- package/src/settingsContract.ts +609 -0
- package/src/sfSymbolMetricsContract.ts +268 -0
- package/src/storageSnapshotContract.ts +344 -0
- package/src/stub-pattern-matcher.ts +550 -0
- package/src/swift-compile.ts +924 -41
- package/src/swift-compiler-digest.ts +13 -1
- package/src/swift-distribution.lock.json +12 -11
- package/src/swift-host.ts +167 -52
- package/src/swift-objc-compile.ts +54 -24
- package/src/swift-objc-export.ts +532 -0
- package/src/swift-objc-import.ts +769 -0
- package/src/swift-objc-metadata.ts +305 -16
- package/src/swift-objc-sdk.ts +13983 -158
- package/src/swift-objc-standin.ts +137 -1
- package/src/swift-package.ts +94 -0
- package/src/swift-packages.ts +5 -5
- package/src/swift-submit.ts +6 -0
- package/src/swiftContract.ts +99 -0
- package/src/target-matcher.ts +6 -1
- package/src/vite-plugin-one.ts +161 -16
- package/src/vite-plugin.ts +14 -40
- package/src/worker-system-chunks.ts +1 -1
- package/src/workerChunkContract.ts +5 -0
- package/src/worklets-babel.ts +24 -5
- package/src/xcode-project.ts +36 -7
- package/src/xcode-target-members.ts +10 -3
- package/cli/drivers/playwright-sim-host.ts +0 -825
- package/kotlin/fixtures/counter/Counter.d.kt.ts +0 -17
- package/kotlin/fixtures/counter/Counter.kt +0 -51
- package/kotlin/fixtures/counter/CounterApp.native.tsx +0 -61
- package/kotlin/fixtures/counter/CounterApp.tsx +0 -3
- package/kotlin/fixtures/counter/CounterScreen.d.kt.ts +0 -8
- package/kotlin/fixtures/counter/CounterScreen.kt +0 -56
- package/kotlin/fixtures/counter/app/_layout.tsx +0 -4
- package/kotlin/fixtures/counter/app/index+spa.tsx +0 -1
- package/kotlin/fixtures/counter/app/routes.d.ts +0 -18
- package/kotlin/fixtures/counter/package.json +0 -20
- package/kotlin/fixtures/counter/tsconfig.json +0 -19
- package/kotlin/fixtures/counter/vite.config.ts +0 -20
- package/kotlin/fixtures/headless-counter/Headless.kt +0 -234
- package/kotlin/fixtures/import-animation/Animation.d.kt.ts +0 -7
- package/kotlin/fixtures/import-animation/Animation.kt +0 -80
- package/kotlin/fixtures/import-animation/ImportAnimation.native.tsx +0 -13
- package/kotlin/fixtures/import-animation/README.md +0 -24
- package/kotlin/fixtures/import-animation/app/_layout.tsx +0 -4
- package/kotlin/fixtures/import-animation/app/index+spa.tsx +0 -1
- package/kotlin/fixtures/import-animation/app/routes.d.ts +0 -18
- package/kotlin/fixtures/import-animation/package.json +0 -23
- package/kotlin/fixtures/import-animation/tsconfig.json +0 -20
- package/kotlin/fixtures/import-animation/vite.config.ts +0 -20
- package/kotlin/fixtures/import-drawing/Drawing.d.kt.ts +0 -7
- package/kotlin/fixtures/import-drawing/Drawing.kt +0 -101
- package/kotlin/fixtures/import-drawing/ImportDrawing.native.tsx +0 -18
- package/kotlin/fixtures/import-drawing/README.md +0 -34
- package/kotlin/fixtures/import-drawing/app/_layout.tsx +0 -4
- package/kotlin/fixtures/import-drawing/app/index+spa.tsx +0 -1
- package/kotlin/fixtures/import-drawing/package.json +0 -23
- package/kotlin/fixtures/import-drawing/tsconfig.json +0 -20
- package/kotlin/fixtures/import-drawing/vite.config.ts +0 -20
- package/kotlin/fixtures/import-editor/Editor.d.kt.ts +0 -7
- package/kotlin/fixtures/import-editor/Editor.kt +0 -59
- package/kotlin/fixtures/import-editor/ImportEditor.native.tsx +0 -23
- package/kotlin/fixtures/import-editor/README.md +0 -27
- package/kotlin/fixtures/import-editor/app/_layout.tsx +0 -4
- package/kotlin/fixtures/import-editor/app/index+spa.tsx +0 -1
- package/kotlin/fixtures/import-editor/package.json +0 -23
- package/kotlin/fixtures/import-editor/tsconfig.json +0 -20
- package/kotlin/fixtures/import-editor/vite.config.ts +0 -20
- package/kotlin/fixtures/import-effects/Effects.d.kt.ts +0 -7
- package/kotlin/fixtures/import-effects/Effects.kt +0 -87
- package/kotlin/fixtures/import-effects/ImportEffects.native.tsx +0 -13
- package/kotlin/fixtures/import-effects/README.md +0 -19
- package/kotlin/fixtures/import-effects/app/_layout.tsx +0 -4
- package/kotlin/fixtures/import-effects/app/index+spa.tsx +0 -1
- package/kotlin/fixtures/import-effects/package.json +0 -23
- package/kotlin/fixtures/import-effects/tsconfig.json +0 -20
- package/kotlin/fixtures/import-effects/vite.config.ts +0 -20
- package/kotlin/fixtures/import-layout/ImportLayout.native.tsx +0 -13
- package/kotlin/fixtures/import-layout/Layout.d.kt.ts +0 -7
- package/kotlin/fixtures/import-layout/Layout.kt +0 -72
- package/kotlin/fixtures/import-layout/README.md +0 -24
- package/kotlin/fixtures/import-layout/app/_layout.tsx +0 -4
- package/kotlin/fixtures/import-layout/app/index+spa.tsx +0 -1
- package/kotlin/fixtures/import-layout/package.json +0 -23
- package/kotlin/fixtures/import-layout/tsconfig.json +0 -20
- package/kotlin/fixtures/import-layout/vite.config.ts +0 -20
- package/kotlin/fixtures/import-navigation/ImportNavigation.native.tsx +0 -18
- package/kotlin/fixtures/import-navigation/Navigation.d.kt.ts +0 -7
- package/kotlin/fixtures/import-navigation/Navigation.kt +0 -104
- package/kotlin/fixtures/import-navigation/README.md +0 -31
- package/kotlin/fixtures/import-navigation/app/_layout.tsx +0 -4
- package/kotlin/fixtures/import-navigation/app/index+spa.tsx +0 -1
- package/kotlin/fixtures/import-navigation/package.json +0 -23
- package/kotlin/fixtures/import-navigation/tsconfig.json +0 -20
- package/kotlin/fixtures/import-navigation/vite.config.ts +0 -20
- package/kotlin/fixtures/import-overlays/ImportOverlays.native.tsx +0 -29
- package/kotlin/fixtures/import-overlays/Overlays.d.kt.ts +0 -7
- package/kotlin/fixtures/import-overlays/Overlays.kt +0 -93
- package/kotlin/fixtures/import-overlays/README.md +0 -34
- package/kotlin/fixtures/import-overlays/app/_layout.tsx +0 -4
- package/kotlin/fixtures/import-overlays/app/index+spa.tsx +0 -1
- package/kotlin/fixtures/import-overlays/package.json +0 -23
- package/kotlin/fixtures/import-overlays/tsconfig.json +0 -20
- package/kotlin/fixtures/import-overlays/vite.config.ts +0 -20
- package/kotlin/fixtures/import-resources/ImportResources.native.tsx +0 -18
- package/kotlin/fixtures/import-resources/README.md +0 -26
- package/kotlin/fixtures/import-resources/Resources.d.kt.ts +0 -6
- package/kotlin/fixtures/import-resources/Resources.kt +0 -72
- package/kotlin/fixtures/import-resources/app/_layout.tsx +0 -4
- package/kotlin/fixtures/import-resources/app/index+spa.tsx +0 -1
- package/kotlin/fixtures/import-resources/package.json +0 -23
- package/kotlin/fixtures/import-resources/tsconfig.json +0 -20
- package/kotlin/fixtures/import-resources/vite.config.ts +0 -20
- package/kotlin/fixtures/import-scroll/ImportNested.native.tsx +0 -10
- package/kotlin/fixtures/import-scroll/ImportScroll.native.tsx +0 -13
- package/kotlin/fixtures/import-scroll/Nested.d.kt.ts +0 -4
- package/kotlin/fixtures/import-scroll/Nested.kt +0 -64
- package/kotlin/fixtures/import-scroll/README.md +0 -38
- package/kotlin/fixtures/import-scroll/Scroll.d.kt.ts +0 -7
- package/kotlin/fixtures/import-scroll/Scroll.kt +0 -91
- package/kotlin/fixtures/import-scroll/app/_layout.tsx +0 -4
- package/kotlin/fixtures/import-scroll/app/index+spa.tsx +0 -1
- package/kotlin/fixtures/import-scroll/app/nested+spa.tsx +0 -1
- package/kotlin/fixtures/import-scroll/package.json +0 -23
- package/kotlin/fixtures/import-scroll/tsconfig.json +0 -20
- package/kotlin/fixtures/import-scroll/vite.config.ts +0 -20
- package/kotlin/fixtures/import-selection/ImportSelection.native.tsx +0 -44
- package/kotlin/fixtures/import-selection/README.md +0 -32
- package/kotlin/fixtures/import-selection/Selection.d.kt.ts +0 -8
- package/kotlin/fixtures/import-selection/Selection.kt +0 -78
- package/kotlin/fixtures/import-selection/app/_layout.tsx +0 -4
- package/kotlin/fixtures/import-selection/app/index+spa.tsx +0 -1
- package/kotlin/fixtures/import-selection/package.json +0 -23
- package/kotlin/fixtures/import-selection/tsconfig.json +0 -20
- package/kotlin/fixtures/import-selection/vite.config.ts +0 -20
- package/kotlin/fixtures/import-surfaces/ImportSurfaces.native.tsx +0 -13
- package/kotlin/fixtures/import-surfaces/README.md +0 -22
- package/kotlin/fixtures/import-surfaces/Surfaces.d.kt.ts +0 -7
- package/kotlin/fixtures/import-surfaces/Surfaces.kt +0 -64
- package/kotlin/fixtures/import-surfaces/app/_layout.tsx +0 -4
- package/kotlin/fixtures/import-surfaces/app/index+spa.tsx +0 -1
- package/kotlin/fixtures/import-surfaces/package.json +0 -23
- package/kotlin/fixtures/import-surfaces/tsconfig.json +0 -20
- package/kotlin/fixtures/import-surfaces/vite.config.ts +0 -20
- package/kotlin/fixtures/import-values/ImportValues.native.tsx +0 -61
- package/kotlin/fixtures/import-values/README.md +0 -28
- package/kotlin/fixtures/import-values/Values.d.kt.ts +0 -15
- package/kotlin/fixtures/import-values/Values.kt +0 -84
- package/kotlin/fixtures/import-values/app/_layout.tsx +0 -4
- package/kotlin/fixtures/import-values/app/index+spa.tsx +0 -1
- package/kotlin/fixtures/import-values/package.json +0 -23
- package/kotlin/fixtures/import-values/tsconfig.json +0 -20
- package/kotlin/fixtures/import-values/vite.config.ts +0 -20
- package/kotlin/fixtures/kotlin-app/app/build.gradle.kts +0 -30
- package/kotlin/fixtures/kotlin-app/app/src/main/AndroidManifest.xml +0 -13
- package/kotlin/fixtures/kotlin-app/app/src/main/java/dev/contrast/kotlinapp/MainActivity.kt +0 -60
- package/kotlin/fixtures/kotlin-app/app/src/main/java/dev/contrast/kotlinapp/ProbeApplication.kt +0 -18
- package/kotlin/fixtures/kotlin-app/build.gradle.kts +0 -5
- package/kotlin/fixtures/kotlin-app/gradle.properties +0 -4
- package/kotlin/fixtures/kotlin-app/settings.gradle.kts +0 -4
- package/kotlin/fixtures/kotlin-app-variants/Anim.kt +0 -62
- package/kotlin/fixtures/kotlin-app-variants/BarBehavior.kt +0 -38
- package/kotlin/fixtures/kotlin-app-variants/BarVisibility.kt +0 -36
- package/kotlin/fixtures/kotlin-app-variants/Bitmaps.kt +0 -50
- package/kotlin/fixtures/kotlin-app-variants/Browse.kt +0 -73
- package/kotlin/fixtures/kotlin-app-variants/Colors.kt +0 -41
- package/kotlin/fixtures/kotlin-app-variants/Controls.kt +0 -62
- package/kotlin/fixtures/kotlin-app-variants/Drag.kt +0 -56
- package/kotlin/fixtures/kotlin-app-variants/Draw.kt +0 -74
- package/kotlin/fixtures/kotlin-app-variants/Drawables.kt +0 -53
- package/kotlin/fixtures/kotlin-app-variants/Focus.kt +0 -62
- package/kotlin/fixtures/kotlin-app-variants/Form.kt +0 -47
- package/kotlin/fixtures/kotlin-app-variants/Icons.kt +0 -59
- package/kotlin/fixtures/kotlin-app-variants/Ime.kt +0 -53
- package/kotlin/fixtures/kotlin-app-variants/Lists.kt +0 -57
- package/kotlin/fixtures/kotlin-app-variants/Nav.kt +0 -47
- package/kotlin/fixtures/kotlin-app-variants/Note.kt +0 -40
- package/kotlin/fixtures/kotlin-app-variants/Overlays.kt +0 -56
- package/kotlin/fixtures/kotlin-app-variants/Pan.kt +0 -38
- package/kotlin/fixtures/kotlin-app-variants/Pickers.kt +0 -44
- package/kotlin/fixtures/kotlin-app-variants/Press.kt +0 -43
- package/kotlin/fixtures/kotlin-app-variants/Scroll.kt +0 -63
- package/kotlin/fixtures/kotlin-app-variants/Sheet.kt +0 -43
- package/kotlin/fixtures/kotlin-app-variants/Strings.kt +0 -49
- package/kotlin/fixtures/kotlin-app-variants/Tabs.kt +0 -47
- package/kotlin/fixtures/kotlin-app-variants/TextWidth.kt +0 -45
- package/kotlin/fixtures/kotlin-app-variants/TransientInsets.kt +0 -50
- package/kotlin/fixtures/kotlin-app-variants/Transition.kt +0 -69
- package/kotlin/fixtures/kotlin-app-variants/ViewConfig.kt +0 -22
- package/kotlin/fixtures/kotlin-app-variants/Widgets.kt +0 -67
- package/kotlin/fixtures/runtime-state/RuntimeState.kt +0 -200
- package/kotlin/fork/README.md +0 -97
- package/kotlin/fork/build.sh +0 -176
- package/kotlin/fork/compose-worker-globals.patch +0 -1247
- package/kotlin/fork/fork.json +0 -46
- package/kotlin/fork/publish.ts +0 -99
- package/kotlin/fork/skia-android-shaping.patch +0 -189
- package/kotlin/fork/skiko-local.init.gradle +0 -10
- package/kotlin/fork/skiko-worker-clock.patch +0 -122
- package/src/host/lease-owner.test.ts +0 -49
package/dist-lib/vite.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1654 | (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;
|
|
@@ -32,6 +32,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
32
32
|
));
|
|
33
33
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
34
34
|
|
|
35
|
+
// runtime-companion.json
|
|
36
|
+
var runtime_companion_default;
|
|
37
|
+
var init_runtime_companion = __esm({
|
|
38
|
+
"runtime-companion.json"() {
|
|
39
|
+
runtime_companion_default = { abi: 1, sha256: "a1b49c57129dd06888a9cdfbb05051be3626e8233980236705a3efd52b651623", file: "node/cli-a1b49c57129dd06888a9cdfbb05051be3626e8233980236705a3efd52b651623.cjs" };
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
35
43
|
// src/process-group.ts
|
|
36
44
|
var init_process_group = __esm({
|
|
37
45
|
"src/process-group.ts"() {
|
|
@@ -39,6 +47,353 @@ var init_process_group = __esm({
|
|
|
39
47
|
}
|
|
40
48
|
});
|
|
41
49
|
|
|
50
|
+
// ../contrast-runtime-delivery/src/version.ts
|
|
51
|
+
function isValidRuntimeVersion(value) {
|
|
52
|
+
return value.length <= 100 && /^[0-9A-Za-z][0-9A-Za-z._+-]*$/.test(value);
|
|
53
|
+
}
|
|
54
|
+
var init_version = __esm({
|
|
55
|
+
"../contrast-runtime-delivery/src/version.ts"() {
|
|
56
|
+
"use strict";
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// ../contrast-runtime-delivery/src/product.ts
|
|
61
|
+
var init_product = __esm({
|
|
62
|
+
"../contrast-runtime-delivery/src/product.ts"() {
|
|
63
|
+
"use strict";
|
|
64
|
+
init_version();
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// ../contrast-runtime-delivery/src/index.ts
|
|
69
|
+
var init_src = __esm({
|
|
70
|
+
"../contrast-runtime-delivery/src/index.ts"() {
|
|
71
|
+
"use strict";
|
|
72
|
+
init_process_group();
|
|
73
|
+
init_product();
|
|
74
|
+
init_product();
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// src/home-paths.ts
|
|
79
|
+
function rnxHomeDir() {
|
|
80
|
+
const override = process.env[PEACH_HOME_ENV];
|
|
81
|
+
if (override && override.length > 0) return import_node_path.default.resolve(override);
|
|
82
|
+
return import_node_path.default.join((0, import_node_os.homedir)(), ".peach");
|
|
83
|
+
}
|
|
84
|
+
function runtimesDir() {
|
|
85
|
+
return import_node_path.default.join(rnxHomeDir(), "runtimes");
|
|
86
|
+
}
|
|
87
|
+
function runtimeDir(version) {
|
|
88
|
+
return import_node_path.default.join(runtimesDir(), version);
|
|
89
|
+
}
|
|
90
|
+
function activeRuntimeFile() {
|
|
91
|
+
return import_node_path.default.join(runtimesDir(), ACTIVE_RUNTIME_FILE);
|
|
92
|
+
}
|
|
93
|
+
function daemonLockfilePath() {
|
|
94
|
+
return import_node_path.default.join(rnxHomeDir(), DAEMON_LOCKFILE);
|
|
95
|
+
}
|
|
96
|
+
function readActiveRuntime() {
|
|
97
|
+
try {
|
|
98
|
+
const value = import_node_fs.default.readFileSync(activeRuntimeFile(), "utf8").trim();
|
|
99
|
+
return value.length > 0 ? value : null;
|
|
100
|
+
} catch {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function readDaemonLockfile() {
|
|
105
|
+
try {
|
|
106
|
+
const fd = import_node_fs.default.openSync(daemonLockfilePath(), "r");
|
|
107
|
+
try {
|
|
108
|
+
const buf = Buffer.alloc(DAEMON_LOCKFILE_MAX_BYTES);
|
|
109
|
+
const bytesRead = import_node_fs.default.readSync(fd, buf, 0, DAEMON_LOCKFILE_MAX_BYTES, 0);
|
|
110
|
+
const raw = buf.subarray(0, bytesRead).toString("utf8");
|
|
111
|
+
const parsed = JSON.parse(raw);
|
|
112
|
+
if (parsed && parsed.schema === 1 && typeof parsed.pid === "number" && typeof parsed.bridgePort === "number" && typeof parsed.runtimePort === "number" && typeof parsed.startedAt === "number" && typeof parsed.heartbeatAt === "number" && (parsed.servedRuntimes === void 0 || Array.isArray(parsed.servedRuntimes) && parsed.servedRuntimes.every((version) => typeof version === "string"))) {
|
|
113
|
+
return parsed;
|
|
114
|
+
}
|
|
115
|
+
return null;
|
|
116
|
+
} finally {
|
|
117
|
+
import_node_fs.default.closeSync(fd);
|
|
118
|
+
}
|
|
119
|
+
} catch {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function isDaemonLockfileFresh(lock, now = Date.now()) {
|
|
124
|
+
if (!lock) return false;
|
|
125
|
+
if (now - lock.heartbeatAt > DAEMON_HEARTBEAT_STALE_MS) return false;
|
|
126
|
+
try {
|
|
127
|
+
process.kill(lock.pid, 0);
|
|
128
|
+
return true;
|
|
129
|
+
} catch {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
var import_node_fs, import_node_os, import_node_path, PEACH_HOME_ENV, ACTIVE_RUNTIME_FILE, DAEMON_LOCKFILE, DAEMON_HEARTBEAT_STALE_MS, DAEMON_LOCKFILE_MAX_BYTES;
|
|
134
|
+
var init_home_paths = __esm({
|
|
135
|
+
"src/home-paths.ts"() {
|
|
136
|
+
"use strict";
|
|
137
|
+
import_node_fs = __toESM(require("node:fs"), 1);
|
|
138
|
+
import_node_os = require("node:os");
|
|
139
|
+
import_node_path = __toESM(require("node:path"), 1);
|
|
140
|
+
PEACH_HOME_ENV = "PEACH_HOME";
|
|
141
|
+
ACTIVE_RUNTIME_FILE = "active";
|
|
142
|
+
DAEMON_LOCKFILE = "daemon.json";
|
|
143
|
+
DAEMON_HEARTBEAT_STALE_MS = 3e4;
|
|
144
|
+
DAEMON_LOCKFILE_MAX_BYTES = 16 * 1024;
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
// src/runtime-assets.ts
|
|
149
|
+
function findMonorepoRoot() {
|
|
150
|
+
if (_monorepoRootCache !== void 0) return _monorepoRootCache;
|
|
151
|
+
let dir = import_path.default.dirname((0, import_url.fileURLToPath)(__sootsim_import_meta_url));
|
|
152
|
+
for (let i = 0; i < 12 && dir !== import_path.default.dirname(dir); i++) {
|
|
153
|
+
if (import_fs.default.existsSync(import_path.default.join(dir, "packages/peach-engine/package.json")) && import_fs.default.existsSync(import_path.default.join(dir, "public/sootsim"))) {
|
|
154
|
+
_monorepoRootCache = dir;
|
|
155
|
+
return dir;
|
|
156
|
+
}
|
|
157
|
+
dir = import_path.default.dirname(dir);
|
|
158
|
+
}
|
|
159
|
+
_monorepoRootCache = null;
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
function resolveDevCheckoutRuntimeAssetRoot() {
|
|
163
|
+
if (process.env.PEACH_HOME && readActiveRuntime()) return null;
|
|
164
|
+
const root = findMonorepoRoot();
|
|
165
|
+
if (!root) return null;
|
|
166
|
+
return import_path.default.join(root, "public/sootsim");
|
|
167
|
+
}
|
|
168
|
+
function resolveDevCheckoutRuntimeRoot() {
|
|
169
|
+
const devBuild = resolveDevCheckoutRuntimeAssetRoot();
|
|
170
|
+
if (!devBuild) return null;
|
|
171
|
+
if (import_fs.default.existsSync(import_path.default.join(devBuild, "index.html")) && import_fs.default.existsSync(import_path.default.join(devBuild, "engine/index.html")) && import_fs.default.existsSync(import_path.default.join(devBuild, "engine-tenant/worker.js")) && import_fs.default.existsSync(import_path.default.join(devBuild, "engine-tenant/worker.prod.js"))) {
|
|
172
|
+
return devBuild;
|
|
173
|
+
}
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
function resolveActiveRuntimeRoot() {
|
|
177
|
+
const devRoot = resolveDevCheckoutRuntimeRoot();
|
|
178
|
+
if (devRoot) return devRoot;
|
|
179
|
+
const active = readActiveRuntime();
|
|
180
|
+
if (!active) return null;
|
|
181
|
+
const dir = runtimeDir(active);
|
|
182
|
+
if (!import_fs.default.existsSync(import_path.default.join(dir, "index.html"))) return null;
|
|
183
|
+
return dir;
|
|
184
|
+
}
|
|
185
|
+
function isRuntimeVersionHostname(hostname) {
|
|
186
|
+
return hostname.toLowerCase().endsWith(RUNTIME_VERSION_HOSTNAME_SUFFIX);
|
|
187
|
+
}
|
|
188
|
+
function runtimeVersionFromHostname(hostname) {
|
|
189
|
+
if (!isRuntimeVersionHostname(hostname)) return null;
|
|
190
|
+
const labels = hostname.slice(0, -RUNTIME_VERSION_HOSTNAME_SUFFIX.length).split(".");
|
|
191
|
+
if (labels.length === 0 || labels.some((label) => !/^[0-9a-f]{1,60}$/i.test(label))) {
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
const encoded = labels.join("");
|
|
195
|
+
if (encoded.length % 2 !== 0) return null;
|
|
196
|
+
try {
|
|
197
|
+
const version = Buffer.from(encoded, "hex").toString("utf8");
|
|
198
|
+
return isValidRuntimeVersion(version) ? version : null;
|
|
199
|
+
} catch {
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
function resolveInstalledRuntimeRoot(version) {
|
|
204
|
+
const dir = runtimeDir(version);
|
|
205
|
+
if (!import_fs.default.existsSync(import_path.default.join(dir, "index.html"))) return null;
|
|
206
|
+
return dir;
|
|
207
|
+
}
|
|
208
|
+
function resolveRuntimeRootForHostname(hostname) {
|
|
209
|
+
if (!isRuntimeVersionHostname(hostname)) return resolveActiveRuntimeRoot();
|
|
210
|
+
const version = runtimeVersionFromHostname(hostname);
|
|
211
|
+
return version ? resolveInstalledRuntimeRoot(version) : null;
|
|
212
|
+
}
|
|
213
|
+
function resolveRuntimeRootForRequestHost(host) {
|
|
214
|
+
if (!host) return resolveActiveRuntimeRoot();
|
|
215
|
+
try {
|
|
216
|
+
return resolveRuntimeRootForHostname(new URL(`http://${host}`).hostname);
|
|
217
|
+
} catch {
|
|
218
|
+
return null;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
function isRootRuntimeAssetPath(pathname) {
|
|
222
|
+
return ROOT_RUNTIME_PATHS.some((p) => pathname === p || pathname.startsWith(p));
|
|
223
|
+
}
|
|
224
|
+
function resolveRuntimeFilePath(runtimeRoot, pathname) {
|
|
225
|
+
if (!pathname.startsWith("/")) return null;
|
|
226
|
+
if (pathname.includes("\0") || pathname.includes("\\")) return null;
|
|
227
|
+
for (const segment of pathname.split("/")) {
|
|
228
|
+
if (segment === "..") return null;
|
|
229
|
+
}
|
|
230
|
+
const normalized = pathname.startsWith("/sootsim/") ? pathname.slice("/sootsim".length) : pathname;
|
|
231
|
+
const fullPath = import_path.default.resolve(runtimeRoot, normalized.replace(/^\/+/, ""));
|
|
232
|
+
const rootWithSep = runtimeRoot.endsWith(import_path.default.sep) ? runtimeRoot : runtimeRoot + import_path.default.sep;
|
|
233
|
+
if (!fullPath.startsWith(rootWithSep) && fullPath !== runtimeRoot) return null;
|
|
234
|
+
if (!import_fs.default.existsSync(fullPath) || !import_fs.default.statSync(fullPath).isFile()) return null;
|
|
235
|
+
return fullPath;
|
|
236
|
+
}
|
|
237
|
+
function serveRuntimeFile(req, res, fullPath) {
|
|
238
|
+
const ext = import_path.default.extname(fullPath);
|
|
239
|
+
const stat = import_fs.default.statSync(fullPath);
|
|
240
|
+
const lastModified = stat.mtime.toUTCString();
|
|
241
|
+
res.setHeader("content-type", MIME_TYPES[ext] || "application/octet-stream");
|
|
242
|
+
if (/^canvaskit-graphite-pipelines-[0-9a-f]{8}\.bin$/.test(import_path.default.basename(fullPath))) {
|
|
243
|
+
res.setHeader("cache-control", "public, max-age=31536000, immutable");
|
|
244
|
+
import_fs.default.createReadStream(fullPath).pipe(res);
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
res.setHeader("cache-control", "no-cache");
|
|
248
|
+
res.setHeader("last-modified", lastModified);
|
|
249
|
+
if (req?.headers?.["if-modified-since"] === lastModified) {
|
|
250
|
+
res.statusCode = 304;
|
|
251
|
+
res.end();
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
sendFileWithRanges(req, res, fullPath, stat.size, {});
|
|
255
|
+
}
|
|
256
|
+
function sendFileWithRanges(req, res, filePath, total, headers) {
|
|
257
|
+
const head = (req?.method || "GET").toUpperCase() === "HEAD";
|
|
258
|
+
const range = /^bytes=(\d*)-(\d*)$/.exec(req?.headers?.range || "");
|
|
259
|
+
const invalid = range && range[1] && range[2] && Number(range[2]) < Number(range[1]);
|
|
260
|
+
if (range && (range[1] || range[2]) && !invalid) {
|
|
261
|
+
const [, startRaw, endRaw] = range;
|
|
262
|
+
const start = startRaw ? Number(startRaw) : Math.max(0, total - Number(endRaw));
|
|
263
|
+
const end = startRaw && endRaw ? Math.min(Number(endRaw), total - 1) : total - 1;
|
|
264
|
+
if (start > end || start >= total) {
|
|
265
|
+
res.writeHead(416, { ...headers, "Content-Range": `bytes */${total}` });
|
|
266
|
+
res.end();
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
res.writeHead(206, {
|
|
270
|
+
...headers,
|
|
271
|
+
"Content-Range": `bytes ${start}-${end}/${total}`,
|
|
272
|
+
"Accept-Ranges": "bytes",
|
|
273
|
+
"Content-Length": String(end - start + 1)
|
|
274
|
+
});
|
|
275
|
+
if (head) res.end();
|
|
276
|
+
else streamFile(res, import_fs.default.createReadStream(filePath, { start, end }));
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
res.writeHead(200, {
|
|
280
|
+
...headers,
|
|
281
|
+
"Accept-Ranges": "bytes",
|
|
282
|
+
"Content-Length": String(total)
|
|
283
|
+
});
|
|
284
|
+
if (head || total === 0) res.end();
|
|
285
|
+
else streamFile(res, import_fs.default.createReadStream(filePath, { start: 0, end: total - 1 }));
|
|
286
|
+
}
|
|
287
|
+
function streamFile(res, stream) {
|
|
288
|
+
stream.on("error", (error) => res.destroy(error));
|
|
289
|
+
stream.pipe(res);
|
|
290
|
+
}
|
|
291
|
+
var import_fs, import_path, import_url, SOOTSIM_RUNTIME_MISSING_MESSAGE, _monorepoRootCache, MIME_TYPES, ROOT_RUNTIME_PATHS, RUNTIME_VERSION_HOSTNAME_SUFFIX;
|
|
292
|
+
var init_runtime_assets = __esm({
|
|
293
|
+
"src/runtime-assets.ts"() {
|
|
294
|
+
"use strict";
|
|
295
|
+
import_fs = __toESM(require("fs"), 1);
|
|
296
|
+
import_path = __toESM(require("path"), 1);
|
|
297
|
+
import_url = require("url");
|
|
298
|
+
init_src();
|
|
299
|
+
init_home_paths();
|
|
300
|
+
SOOTSIM_RUNTIME_MISSING_MESSAGE = "[peach] no engine runtime installed. run `peach runtime install`";
|
|
301
|
+
MIME_TYPES = {
|
|
302
|
+
".js": "application/javascript",
|
|
303
|
+
".mjs": "application/javascript",
|
|
304
|
+
".css": "text/css",
|
|
305
|
+
".html": "text/html",
|
|
306
|
+
".wasm": "application/wasm",
|
|
307
|
+
".json": "application/json",
|
|
308
|
+
".jpg": "image/jpeg",
|
|
309
|
+
".jpeg": "image/jpeg",
|
|
310
|
+
".png": "image/png",
|
|
311
|
+
".svg": "image/svg+xml",
|
|
312
|
+
".webp": "image/webp",
|
|
313
|
+
".glb": "model/gltf-binary",
|
|
314
|
+
".ttf": "font/ttf",
|
|
315
|
+
".otf": "font/otf",
|
|
316
|
+
".woff": "font/woff",
|
|
317
|
+
".woff2": "font/woff2",
|
|
318
|
+
".mp3": "audio/mpeg",
|
|
319
|
+
".wav": "audio/wav",
|
|
320
|
+
".mp4": "video/mp4",
|
|
321
|
+
".m4v": "video/mp4",
|
|
322
|
+
".mov": "video/quicktime",
|
|
323
|
+
".webm": "video/webm"
|
|
324
|
+
};
|
|
325
|
+
ROOT_RUNTIME_PATHS = [
|
|
326
|
+
"/assets/",
|
|
327
|
+
"/engine/",
|
|
328
|
+
"/engine-tenant/",
|
|
329
|
+
"/photos/",
|
|
330
|
+
"/three-mode/",
|
|
331
|
+
"/fonts/",
|
|
332
|
+
"/icons/",
|
|
333
|
+
"/sounds/",
|
|
334
|
+
"/spike/",
|
|
335
|
+
"/test-wallpaper.jpg",
|
|
336
|
+
"/preview-sw.js",
|
|
337
|
+
"/peach.svg",
|
|
338
|
+
"/bedrock-sqlite.wasm",
|
|
339
|
+
"/bedrock-sqlite.js",
|
|
340
|
+
"/sootsim/"
|
|
341
|
+
];
|
|
342
|
+
RUNTIME_VERSION_HOSTNAME_SUFFIX = ".runtime.localhost";
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
// src/cli-runtime.ts
|
|
347
|
+
function cliCompanionPath() {
|
|
348
|
+
return `node/cli-${runtime_companion_default.sha256}.cjs`;
|
|
349
|
+
}
|
|
350
|
+
function verifyCliCompanion(root) {
|
|
351
|
+
const file = (0, import_node_path2.join)(root, cliCompanionPath());
|
|
352
|
+
let bytes;
|
|
353
|
+
try {
|
|
354
|
+
bytes = (0, import_node_fs2.readFileSync)(file);
|
|
355
|
+
} catch (cause) {
|
|
356
|
+
throw new Error(
|
|
357
|
+
"Peach runtime is missing the companion required by this CLI; run `peach runtime install`",
|
|
358
|
+
{ cause }
|
|
359
|
+
);
|
|
360
|
+
}
|
|
361
|
+
const hash = (0, import_node_crypto.createHash)("sha256").update(bytes).digest("hex");
|
|
362
|
+
if (hash !== runtime_companion_default.sha256) {
|
|
363
|
+
throw new Error(
|
|
364
|
+
"Peach runtime companion does not match this CLI; run `peach runtime install`"
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
function getCliRuntime() {
|
|
369
|
+
if (loaded) return loaded.runtime;
|
|
370
|
+
const root = resolveDevCheckoutRuntimeAssetRoot() ?? resolveActiveRuntimeRoot();
|
|
371
|
+
if (!root) throw new Error("No Peach runtime installed; run `peach runtime install`");
|
|
372
|
+
verifyCliCompanion(root);
|
|
373
|
+
const require2 = (0, import_node_module.createRequire)(__sootsim_import_meta_url);
|
|
374
|
+
const runtime = require2((0, import_node_path2.join)(root, cliCompanionPath()));
|
|
375
|
+
if (runtime.cliCompanionAbi !== CLI_COMPANION_ABI) {
|
|
376
|
+
throw new Error(
|
|
377
|
+
"Incompatible Peach runtime companion ABI; run `peach runtime install`"
|
|
378
|
+
);
|
|
379
|
+
}
|
|
380
|
+
loaded = { root, runtime };
|
|
381
|
+
return runtime;
|
|
382
|
+
}
|
|
383
|
+
var import_node_crypto, import_node_fs2, import_node_module, import_node_path2, CLI_COMPANION_ABI, loaded;
|
|
384
|
+
var init_cli_runtime = __esm({
|
|
385
|
+
"src/cli-runtime.ts"() {
|
|
386
|
+
"use strict";
|
|
387
|
+
import_node_crypto = require("node:crypto");
|
|
388
|
+
import_node_fs2 = require("node:fs");
|
|
389
|
+
import_node_module = require("node:module");
|
|
390
|
+
import_node_path2 = require("node:path");
|
|
391
|
+
init_runtime_companion();
|
|
392
|
+
init_runtime_assets();
|
|
393
|
+
CLI_COMPANION_ABI = 1;
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
|
|
42
397
|
// src/vite-plugin-one.ts
|
|
43
398
|
var vite_plugin_one_exports = {};
|
|
44
399
|
__export(vite_plugin_one_exports, {
|
|
@@ -47,7 +402,7 @@ __export(vite_plugin_one_exports, {
|
|
|
47
402
|
});
|
|
48
403
|
module.exports = __toCommonJS(vite_plugin_one_exports);
|
|
49
404
|
var import_fs3 = __toESM(require("fs"), 1);
|
|
50
|
-
var
|
|
405
|
+
var import_node_crypto4 = require("node:crypto");
|
|
51
406
|
var import_node_url = require("node:url");
|
|
52
407
|
var import_path3 = __toESM(require("path"), 1);
|
|
53
408
|
var import_ws = require("ws");
|
|
@@ -64,11 +419,62 @@ var DEFAULT_SOOTSIM_BRIDGE_URL = `http://localhost:${DEFAULT_SOOTSIM_BRIDGE_PORT
|
|
|
64
419
|
var HOSTED_SHELL_PATH = new RegExp(`^(?:${PEACH_SIMULATOR_PATH}|/sootsim)(?:/|$)`);
|
|
65
420
|
var AUTOMATION_SIM_IDLE_REAP_TTL_MS = 5 * 6e4;
|
|
66
421
|
|
|
422
|
+
// src/bundleGlobalFooter.ts
|
|
423
|
+
function findBundleFooter(source, prefix) {
|
|
424
|
+
let end = source.length;
|
|
425
|
+
while (end > 0) {
|
|
426
|
+
const newline = source.lastIndexOf("\n", end - 1);
|
|
427
|
+
if (newline < 0) return -1;
|
|
428
|
+
const line = newline + 1;
|
|
429
|
+
if (source.startsWith(prefix, line)) return newline;
|
|
430
|
+
if (!isFooterBlockLine(source, line, end)) return -1;
|
|
431
|
+
end = newline;
|
|
432
|
+
}
|
|
433
|
+
return -1;
|
|
434
|
+
}
|
|
435
|
+
function isFooterBlockLine(source, line, end) {
|
|
436
|
+
return line === end || source.startsWith("globalThis.", line) || source.startsWith("//", line);
|
|
437
|
+
}
|
|
438
|
+
function readFooter(source, prefix, suffix, name) {
|
|
439
|
+
const start = findBundleFooter(source, prefix);
|
|
440
|
+
if (start < 0) return null;
|
|
441
|
+
const end = source.indexOf("\n", start + 1);
|
|
442
|
+
const line = source.slice(start + 1, end < 0 ? void 0 : end);
|
|
443
|
+
if (!line.endsWith(suffix)) throw new Error(`${name} footer is truncated`);
|
|
444
|
+
const value = JSON.parse(
|
|
445
|
+
line.slice(prefix.length, suffix ? -suffix.length : void 0)
|
|
446
|
+
);
|
|
447
|
+
if (value === null) throw new Error(`${name} footer has no metadata`);
|
|
448
|
+
return value;
|
|
449
|
+
}
|
|
450
|
+
var ROLLDOWN_INVENTORY_HEADER = "X-Peach-Rolldown-Inventory";
|
|
451
|
+
function detachFooter(source, prefix, suffix, name) {
|
|
452
|
+
const start = findBundleFooter(source, prefix);
|
|
453
|
+
if (start < 0) return { source, value: null };
|
|
454
|
+
const value = readFooter(source, prefix, suffix, name);
|
|
455
|
+
const end = source.indexOf("\n", start + 1);
|
|
456
|
+
return { source: source.slice(0, start) + (end < 0 ? "" : source.slice(end)), value };
|
|
457
|
+
}
|
|
458
|
+
function insertBundleGlobalFooter(source, name, value) {
|
|
459
|
+
return insertFooter(source, `globalThis.${name}=`, ";", name, value);
|
|
460
|
+
}
|
|
461
|
+
function insertFooter(source, prefix, suffix, name, value) {
|
|
462
|
+
source = detachFooter(source, prefix, suffix, name).source;
|
|
463
|
+
const json = JSON.stringify(value).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029").replace(/<\//g, "<\\/");
|
|
464
|
+
const footer = `
|
|
465
|
+
${prefix}${json}${suffix}`;
|
|
466
|
+
const identity = findBundleFooter(source, "globalThis.__sootsimModulePaths=");
|
|
467
|
+
return identity < 0 ? source + footer : source.slice(0, identity) + footer + source.slice(identity);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
// src/vite-plugin-one.ts
|
|
471
|
+
init_cli_runtime();
|
|
472
|
+
|
|
67
473
|
// src/dev-server-open.ts
|
|
68
474
|
var import_node_child_process = require("node:child_process");
|
|
69
|
-
var
|
|
70
|
-
var
|
|
71
|
-
var
|
|
475
|
+
var import_node_crypto2 = require("node:crypto");
|
|
476
|
+
var import_node_fs3 = __toESM(require("node:fs"), 1);
|
|
477
|
+
var import_node_path3 = __toESM(require("node:path"), 1);
|
|
72
478
|
function resolveRnxDesktopAppName(open, projectRoot) {
|
|
73
479
|
if (!open) return null;
|
|
74
480
|
if (typeof open === "object") {
|
|
@@ -76,8 +482,8 @@ function resolveRnxDesktopAppName(open, projectRoot) {
|
|
|
76
482
|
if (!appName) throw new Error("peach: open.appName must not be empty");
|
|
77
483
|
return appName;
|
|
78
484
|
}
|
|
79
|
-
const packageJsonPath =
|
|
80
|
-
const packageJson = JSON.parse(
|
|
485
|
+
const packageJsonPath = import_node_path3.default.join(projectRoot, "package.json");
|
|
486
|
+
const packageJson = JSON.parse(import_node_fs3.default.readFileSync(packageJsonPath, "utf8"));
|
|
81
487
|
const packageName = packageJson && typeof packageJson === "object" ? Reflect.get(packageJson, "name") : void 0;
|
|
82
488
|
if (typeof packageName !== "string" || !packageName.trim()) {
|
|
83
489
|
throw new Error(`peach: ${packageJsonPath} must declare a package name`);
|
|
@@ -91,7 +497,7 @@ function tagRnxBundleForPlugin(bundleUrl, replacementOrigin, replacementToken, p
|
|
|
91
497
|
url.searchParams.set("rnxAppName", appName);
|
|
92
498
|
url.searchParams.set(
|
|
93
499
|
"rnxProjectId",
|
|
94
|
-
(0,
|
|
500
|
+
(0, import_node_crypto2.createHash)("sha256").update(import_node_fs3.default.realpathSync(projectRoot)).digest("hex").slice(0, 32)
|
|
95
501
|
);
|
|
96
502
|
}
|
|
97
503
|
url.searchParams.set("rnxReplacementOrigin", replacementOrigin);
|
|
@@ -127,81 +533,20 @@ function observeRnxDesktopLaunch(child, appName) {
|
|
|
127
533
|
}
|
|
128
534
|
function launchRnxDesktop(bundleUrl, appName) {
|
|
129
535
|
console.log(`[peach] opening ${appName} in the desktop simulator`);
|
|
130
|
-
const child = (0, import_node_child_process.spawn)("peach", buildRnxDesktopOpenArgs(bundleUrl), {
|
|
131
|
-
stdio: ["ignore", "ignore", "pipe"],
|
|
132
|
-
windowsHide: true
|
|
133
|
-
});
|
|
134
|
-
observeRnxDesktopLaunch(child, appName);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// src/home-paths.ts
|
|
138
|
-
var import_node_fs2 = __toESM(require("node:fs"), 1);
|
|
139
|
-
var import_node_os = require("node:os");
|
|
140
|
-
var import_node_path2 = __toESM(require("node:path"), 1);
|
|
141
|
-
var PEACH_HOME_ENV = "PEACH_HOME";
|
|
142
|
-
var ACTIVE_RUNTIME_FILE = "active";
|
|
143
|
-
var DAEMON_LOCKFILE = "daemon.json";
|
|
144
|
-
var DAEMON_HEARTBEAT_STALE_MS = 3e4;
|
|
145
|
-
function rnxHomeDir() {
|
|
146
|
-
const override = process.env[PEACH_HOME_ENV];
|
|
147
|
-
if (override && override.length > 0) return import_node_path2.default.resolve(override);
|
|
148
|
-
return import_node_path2.default.join((0, import_node_os.homedir)(), ".peach");
|
|
149
|
-
}
|
|
150
|
-
function runtimesDir() {
|
|
151
|
-
return import_node_path2.default.join(rnxHomeDir(), "runtimes");
|
|
152
|
-
}
|
|
153
|
-
function runtimeDir(version) {
|
|
154
|
-
return import_node_path2.default.join(runtimesDir(), version);
|
|
155
|
-
}
|
|
156
|
-
function activeRuntimeFile() {
|
|
157
|
-
return import_node_path2.default.join(runtimesDir(), ACTIVE_RUNTIME_FILE);
|
|
158
|
-
}
|
|
159
|
-
function daemonLockfilePath() {
|
|
160
|
-
return import_node_path2.default.join(rnxHomeDir(), DAEMON_LOCKFILE);
|
|
161
|
-
}
|
|
162
|
-
function readActiveRuntime() {
|
|
163
|
-
try {
|
|
164
|
-
const value = import_node_fs2.default.readFileSync(activeRuntimeFile(), "utf8").trim();
|
|
165
|
-
return value.length > 0 ? value : null;
|
|
166
|
-
} catch {
|
|
167
|
-
return null;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
var DAEMON_LOCKFILE_MAX_BYTES = 16 * 1024;
|
|
171
|
-
function readDaemonLockfile() {
|
|
172
|
-
try {
|
|
173
|
-
const fd = import_node_fs2.default.openSync(daemonLockfilePath(), "r");
|
|
174
|
-
try {
|
|
175
|
-
const buf = Buffer.alloc(DAEMON_LOCKFILE_MAX_BYTES);
|
|
176
|
-
const bytesRead = import_node_fs2.default.readSync(fd, buf, 0, DAEMON_LOCKFILE_MAX_BYTES, 0);
|
|
177
|
-
const raw = buf.subarray(0, bytesRead).toString("utf8");
|
|
178
|
-
const parsed = JSON.parse(raw);
|
|
179
|
-
if (parsed && parsed.schema === 1 && typeof parsed.pid === "number" && typeof parsed.bridgePort === "number" && typeof parsed.runtimePort === "number" && typeof parsed.startedAt === "number" && typeof parsed.heartbeatAt === "number" && (parsed.servedRuntimes === void 0 || Array.isArray(parsed.servedRuntimes) && parsed.servedRuntimes.every((version) => typeof version === "string"))) {
|
|
180
|
-
return parsed;
|
|
181
|
-
}
|
|
182
|
-
return null;
|
|
183
|
-
} finally {
|
|
184
|
-
import_node_fs2.default.closeSync(fd);
|
|
185
|
-
}
|
|
186
|
-
} catch {
|
|
187
|
-
return null;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
function isDaemonLockfileFresh(lock, now = Date.now()) {
|
|
191
|
-
if (!lock) return false;
|
|
192
|
-
if (now - lock.heartbeatAt > DAEMON_HEARTBEAT_STALE_MS) return false;
|
|
193
|
-
try {
|
|
194
|
-
process.kill(lock.pid, 0);
|
|
195
|
-
return true;
|
|
196
|
-
} catch {
|
|
197
|
-
return false;
|
|
198
|
-
}
|
|
536
|
+
const child = (0, import_node_child_process.spawn)("peach", buildRnxDesktopOpenArgs(bundleUrl), {
|
|
537
|
+
stdio: ["ignore", "ignore", "pipe"],
|
|
538
|
+
windowsHide: true
|
|
539
|
+
});
|
|
540
|
+
observeRnxDesktopLaunch(child, appName);
|
|
199
541
|
}
|
|
200
542
|
|
|
543
|
+
// src/vite-plugin-one.ts
|
|
544
|
+
init_home_paths();
|
|
545
|
+
|
|
201
546
|
// src/host/replacement-module-handler.ts
|
|
202
|
-
var
|
|
547
|
+
var import_node_fs4 = require("node:fs");
|
|
203
548
|
var import_promises = __toESM(require("node:fs/promises"), 1);
|
|
204
|
-
var
|
|
549
|
+
var import_node_path4 = __toESM(require("node:path"), 1);
|
|
205
550
|
|
|
206
551
|
// ../contrast-bundler/src/replacementModule.ts
|
|
207
552
|
var import_dist = require("sucrase/dist/index.js");
|
|
@@ -240,7 +585,7 @@ function normalize(p) {
|
|
|
240
585
|
if (trailingSlash) joined += "/";
|
|
241
586
|
return absolute ? "/" + joined : joined;
|
|
242
587
|
}
|
|
243
|
-
function
|
|
588
|
+
function join2(...parts) {
|
|
244
589
|
const present = parts.filter((part) => part.length > 0);
|
|
245
590
|
if (present.length === 0) return ".";
|
|
246
591
|
return normalize(present.join("/"));
|
|
@@ -297,7 +642,7 @@ var posix = {
|
|
|
297
642
|
delimiter,
|
|
298
643
|
isAbsolute,
|
|
299
644
|
normalize,
|
|
300
|
-
join,
|
|
645
|
+
join: join2,
|
|
301
646
|
resolve,
|
|
302
647
|
dirname,
|
|
303
648
|
basename,
|
|
@@ -537,16 +882,16 @@ function sendJavaScript(req, res, source) {
|
|
|
537
882
|
res.end(req.method === "HEAD" ? void 0 : source);
|
|
538
883
|
}
|
|
539
884
|
function resolveReplacementModuleFile(fromFile, specifier) {
|
|
540
|
-
const base =
|
|
885
|
+
const base = import_node_path4.default.resolve(import_node_path4.default.dirname(fromFile), specifier);
|
|
541
886
|
const candidates = [
|
|
542
887
|
...REPLACEMENT_MODULE_EXTENSIONS.some(
|
|
543
|
-
(ext) => ext ===
|
|
888
|
+
(ext) => ext === import_node_path4.default.extname(base).toLowerCase()
|
|
544
889
|
) ? [base] : [],
|
|
545
890
|
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => base + ext),
|
|
546
|
-
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) =>
|
|
891
|
+
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => import_node_path4.default.join(base, `index${ext}`))
|
|
547
892
|
];
|
|
548
893
|
const found = candidates.find(
|
|
549
|
-
(candidate) => (0,
|
|
894
|
+
(candidate) => (0, import_node_fs4.statSync)(candidate, { throwIfNoEntry: false })?.isFile()
|
|
550
895
|
);
|
|
551
896
|
if (!found) {
|
|
552
897
|
throw new Error(
|
|
@@ -557,8 +902,8 @@ function resolveReplacementModuleFile(fromFile, specifier) {
|
|
|
557
902
|
}
|
|
558
903
|
function isInsideAny(roots, file) {
|
|
559
904
|
return roots.some((root) => {
|
|
560
|
-
const relative2 =
|
|
561
|
-
return !relative2.startsWith("..") && !
|
|
905
|
+
const relative2 = import_node_path4.default.relative(root, file);
|
|
906
|
+
return !relative2.startsWith("..") && !import_node_path4.default.isAbsolute(relative2);
|
|
562
907
|
});
|
|
563
908
|
}
|
|
564
909
|
async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
@@ -598,19 +943,19 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
598
943
|
res.end("missing path param");
|
|
599
944
|
return true;
|
|
600
945
|
}
|
|
601
|
-
const extension =
|
|
946
|
+
const extension = import_node_path4.default.extname(targetPath).toLowerCase();
|
|
602
947
|
if (!REPLACEMENT_MODULE_EXTENSIONS.some((allowed) => allowed === extension)) {
|
|
603
948
|
res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
|
|
604
949
|
res.end(`replacement files must be ${REPLACEMENT_MODULE_EXTENSIONS.join(", ")}`);
|
|
605
950
|
return true;
|
|
606
951
|
}
|
|
607
|
-
if (!
|
|
952
|
+
if (!import_node_path4.default.isAbsolute(targetPath)) {
|
|
608
953
|
res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
|
|
609
954
|
res.end("replacement file path must be absolute");
|
|
610
955
|
return true;
|
|
611
956
|
}
|
|
612
957
|
const runtimePackages = new Set(url.searchParams.getAll("runtimePackage"));
|
|
613
|
-
const servedRoots = options.servedRoots?.map((root) =>
|
|
958
|
+
const servedRoots = options.servedRoots?.map((root) => import_node_path4.default.resolve(root));
|
|
614
959
|
if (servedRoots && !isInsideAny(servedRoots, targetPath)) {
|
|
615
960
|
res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
|
|
616
961
|
res.end("replacement file must be inside a folder the bundler serves");
|
|
@@ -664,8 +1009,8 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
664
1009
|
}
|
|
665
1010
|
|
|
666
1011
|
// src/installed-package-versions.ts
|
|
667
|
-
var
|
|
668
|
-
var
|
|
1012
|
+
var import_fs2 = __toESM(require("fs"), 1);
|
|
1013
|
+
var import_path2 = __toESM(require("path"), 1);
|
|
669
1014
|
|
|
670
1015
|
// ../peach-compat/src/lazy-stub-patterns.ts
|
|
671
1016
|
var LAZY_STUB_PATTERNS = [
|
|
@@ -692,7 +1037,6 @@ var LAZY_STUB_PATTERNS = [
|
|
|
692
1037
|
"@giphy/react-native-sdk",
|
|
693
1038
|
"@google/react-native-make-payment",
|
|
694
1039
|
"@googlemaps/react-native-navigation-sdk",
|
|
695
|
-
"@invertase/react-native-apple-authentication",
|
|
696
1040
|
"@iterable/expo-plugin",
|
|
697
1041
|
"@kingstinct/react-native-healthkit",
|
|
698
1042
|
"@livekit/react-native",
|
|
@@ -3511,7 +3855,7 @@ var COMPAT_STUBS = {
|
|
|
3511
3855
|
}
|
|
3512
3856
|
};
|
|
3513
3857
|
|
|
3514
|
-
//
|
|
3858
|
+
// src/stub-pattern-matcher.ts
|
|
3515
3859
|
function extractPackageFromPath(modulePath) {
|
|
3516
3860
|
let nodeModulesIndex = modulePath.lastIndexOf("/node_modules/");
|
|
3517
3861
|
let prefixLength = "/node_modules/".length;
|
|
@@ -3533,42 +3877,82 @@ function packageNameAt(modulePath, start) {
|
|
|
3533
3877
|
}
|
|
3534
3878
|
|
|
3535
3879
|
// src/installed-package-versions.ts
|
|
3536
|
-
function
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3880
|
+
function* exists(target) {
|
|
3881
|
+
return (yield { op: "exists", path: target }) === true;
|
|
3882
|
+
}
|
|
3883
|
+
function* realpath(target) {
|
|
3884
|
+
const resolved = yield { op: "realpath", path: target };
|
|
3885
|
+
if (typeof resolved !== "string") throw new Error(`could not resolve ${target}`);
|
|
3886
|
+
return resolved;
|
|
3887
|
+
}
|
|
3888
|
+
function* readManifest(target) {
|
|
3889
|
+
const manifest = yield { op: "manifest", path: target };
|
|
3890
|
+
return typeof manifest === "object" ? manifest : null;
|
|
3891
|
+
}
|
|
3892
|
+
function parseManifest(source) {
|
|
3893
|
+
const manifest = JSON.parse(source);
|
|
3894
|
+
return typeof manifest === "object" && manifest !== null ? manifest : null;
|
|
3895
|
+
}
|
|
3896
|
+
function isMissing(error) {
|
|
3897
|
+
return error instanceof Error && "code" in error && error.code === "ENOENT";
|
|
3898
|
+
}
|
|
3899
|
+
function answerSync(step) {
|
|
3900
|
+
if (step.op === "exists") return import_fs2.default.existsSync(step.path);
|
|
3901
|
+
if (step.op === "realpath") return import_fs2.default.realpathSync(step.path);
|
|
3902
|
+
try {
|
|
3903
|
+
return parseManifest(import_fs2.default.readFileSync(step.path, "utf8"));
|
|
3904
|
+
} catch (error) {
|
|
3905
|
+
if (isMissing(error)) return null;
|
|
3906
|
+
throw error;
|
|
3907
|
+
}
|
|
3908
|
+
}
|
|
3909
|
+
function runSync(walk) {
|
|
3910
|
+
for (let step = walk.next(); ; ) {
|
|
3911
|
+
if (step.done) return step.value;
|
|
3912
|
+
step = walk.next(answerSync(step.value));
|
|
3913
|
+
}
|
|
3914
|
+
}
|
|
3915
|
+
function createInstalledPackageReader() {
|
|
3916
|
+
const hasModules = /* @__PURE__ */ new Map();
|
|
3917
|
+
const manifests = /* @__PURE__ */ new Map();
|
|
3918
|
+
return function* readInstalledPackage(fromDir, name) {
|
|
3919
|
+
for (let dir = fromDir; ; ) {
|
|
3920
|
+
if (import_path2.default.basename(dir) !== "node_modules") {
|
|
3921
|
+
const modules = import_path2.default.join(dir, "node_modules");
|
|
3922
|
+
let present = hasModules.get(dir);
|
|
3923
|
+
if (present === void 0) {
|
|
3924
|
+
present = yield* exists(modules);
|
|
3925
|
+
hasModules.set(dir, present);
|
|
3926
|
+
}
|
|
3927
|
+
if (present) {
|
|
3928
|
+
const root = import_path2.default.join(modules, name);
|
|
3929
|
+
let installed = manifests.get(root);
|
|
3930
|
+
if (installed === void 0) {
|
|
3931
|
+
const manifest = yield* readManifest(import_path2.default.join(root, "package.json"));
|
|
3932
|
+
installed = manifest ? { root, manifest } : null;
|
|
3933
|
+
manifests.set(root, installed);
|
|
3934
|
+
}
|
|
3935
|
+
if (installed) return installed;
|
|
3936
|
+
}
|
|
3547
3937
|
}
|
|
3548
|
-
const parent =
|
|
3938
|
+
const parent = import_path2.default.dirname(dir);
|
|
3549
3939
|
if (parent === dir) return null;
|
|
3550
3940
|
dir = parent;
|
|
3551
|
-
continue;
|
|
3552
3941
|
}
|
|
3553
|
-
|
|
3554
|
-
}
|
|
3942
|
+
};
|
|
3555
3943
|
}
|
|
3556
|
-
function
|
|
3557
|
-
const
|
|
3558
|
-
for (const modulePath of modulePaths) {
|
|
3559
|
-
const name = extractPackageFromPath(modulePath.replaceAll(import_path.default.sep, "/"));
|
|
3560
|
-
if (name) names.add(name);
|
|
3561
|
-
}
|
|
3944
|
+
function* installedVersionsWalk(projectRoot, names) {
|
|
3945
|
+
const readInstalledPackage = createInstalledPackageReader();
|
|
3562
3946
|
const versions = {};
|
|
3563
3947
|
for (const name of [...names].sort()) {
|
|
3564
|
-
const installed = readInstalledPackage(projectRoot, name);
|
|
3948
|
+
const installed = yield* readInstalledPackage(projectRoot, name);
|
|
3565
3949
|
const version = installed && Reflect.get(installed.manifest, "version");
|
|
3566
3950
|
if (typeof version === "string" && version.length > 0) versions[name] = version;
|
|
3567
3951
|
}
|
|
3568
3952
|
return versions;
|
|
3569
3953
|
}
|
|
3570
|
-
function
|
|
3571
|
-
const appRoot =
|
|
3954
|
+
function* nativePackageVersionsWalk(projectRoot) {
|
|
3955
|
+
const appRoot = yield* realpath(projectRoot);
|
|
3572
3956
|
const nativeNames = /* @__PURE__ */ new Set();
|
|
3573
3957
|
for (const specifier of [
|
|
3574
3958
|
"react-native",
|
|
@@ -3579,17 +3963,14 @@ function readInstalledNativePackageVersions(projectRoot) {
|
|
|
3579
3963
|
const name = extractPackageFromPath(`node_modules/${specifier}`);
|
|
3580
3964
|
if (name) nativeNames.add(name);
|
|
3581
3965
|
}
|
|
3582
|
-
const manifest =
|
|
3583
|
-
|
|
3584
|
-
);
|
|
3585
|
-
if (typeof manifest !== "object" || manifest === null) {
|
|
3586
|
-
throw new Error("app package.json must contain an object");
|
|
3587
|
-
}
|
|
3966
|
+
const manifest = yield* readManifest(import_path2.default.join(appRoot, "package.json"));
|
|
3967
|
+
if (!manifest) throw new Error("app package.json must contain an object");
|
|
3968
|
+
const readInstalledPackage = createInstalledPackageReader();
|
|
3588
3969
|
const pending = [{ root: appRoot, manifest }];
|
|
3589
3970
|
const visited = /* @__PURE__ */ new Set();
|
|
3590
3971
|
const needed = /* @__PURE__ */ new Set();
|
|
3591
3972
|
for (let next = pending.pop(); next; next = pending.pop()) {
|
|
3592
|
-
const root =
|
|
3973
|
+
const root = yield* realpath(next.root);
|
|
3593
3974
|
if (visited.has(root)) continue;
|
|
3594
3975
|
visited.add(root);
|
|
3595
3976
|
const fields = ["dependencies", "optionalDependencies", "peerDependencies"];
|
|
@@ -3604,25 +3985,25 @@ function readInstalledNativePackageVersions(projectRoot) {
|
|
|
3604
3985
|
if (typeof peer === "object" && peer !== null && Reflect.get(peer, "optional"))
|
|
3605
3986
|
continue;
|
|
3606
3987
|
}
|
|
3607
|
-
const installed = readInstalledPackage(root, name);
|
|
3988
|
+
const installed = yield* readInstalledPackage(root, name);
|
|
3608
3989
|
if (!installed) continue;
|
|
3609
3990
|
if (nativeNames.has(name)) needed.add(name);
|
|
3610
3991
|
pending.push(installed);
|
|
3611
3992
|
}
|
|
3612
3993
|
}
|
|
3613
3994
|
}
|
|
3614
|
-
return
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
);
|
|
3995
|
+
return yield* installedVersionsWalk(projectRoot, needed);
|
|
3996
|
+
}
|
|
3997
|
+
function readInstalledNativePackageVersions(projectRoot) {
|
|
3998
|
+
return runSync(nativePackageVersionsWalk(projectRoot));
|
|
3618
3999
|
}
|
|
3619
4000
|
|
|
3620
4001
|
// src/one-widget-metadata.ts
|
|
3621
4002
|
var import_node_child_process2 = require("node:child_process");
|
|
3622
|
-
var
|
|
3623
|
-
var
|
|
3624
|
-
var
|
|
3625
|
-
var
|
|
4003
|
+
var import_node_crypto3 = require("node:crypto");
|
|
4004
|
+
var import_node_fs6 = __toESM(require("node:fs"), 1);
|
|
4005
|
+
var import_node_module2 = require("node:module");
|
|
4006
|
+
var import_node_path6 = __toESM(require("node:path"), 1);
|
|
3626
4007
|
var import_node_util = require("node:util");
|
|
3627
4008
|
|
|
3628
4009
|
// cli/internal-child.ts
|
|
@@ -3645,28 +4026,28 @@ function isHomeWidgetFamily(value) {
|
|
|
3645
4026
|
}
|
|
3646
4027
|
|
|
3647
4028
|
// src/swift-source-file.ts
|
|
3648
|
-
var
|
|
3649
|
-
var
|
|
4029
|
+
var import_node_fs5 = __toESM(require("node:fs"), 1);
|
|
4030
|
+
var import_node_path5 = __toESM(require("node:path"), 1);
|
|
3650
4031
|
function readPackageFile(root, file, maxBytes) {
|
|
3651
|
-
const canonicalRoot =
|
|
3652
|
-
const relative2 =
|
|
3653
|
-
if (relative2 === ".." || relative2.startsWith(`..${
|
|
4032
|
+
const canonicalRoot = import_node_fs5.default.realpathSync(root);
|
|
4033
|
+
const relative2 = import_node_path5.default.relative(canonicalRoot, import_node_fs5.default.realpathSync(file));
|
|
4034
|
+
if (relative2 === ".." || relative2.startsWith(`..${import_node_path5.default.sep}`) || import_node_path5.default.isAbsolute(relative2)) {
|
|
3654
4035
|
throw new Error(`swift input escapes the selected package: ${file}`);
|
|
3655
4036
|
}
|
|
3656
|
-
let ancestor =
|
|
4037
|
+
let ancestor = import_node_path5.default.resolve(file);
|
|
3657
4038
|
while (ancestor !== canonicalRoot) {
|
|
3658
|
-
if (
|
|
4039
|
+
if (import_node_fs5.default.lstatSync(ancestor).isSymbolicLink()) {
|
|
3659
4040
|
throw new Error(`swift input is a symlink: ${ancestor}`);
|
|
3660
4041
|
}
|
|
3661
|
-
const parent =
|
|
4042
|
+
const parent = import_node_path5.default.dirname(ancestor);
|
|
3662
4043
|
if (parent === ancestor)
|
|
3663
4044
|
throw new Error(`swift input escapes the selected package: ${file}`);
|
|
3664
4045
|
ancestor = parent;
|
|
3665
4046
|
}
|
|
3666
|
-
const expected =
|
|
3667
|
-
const fd =
|
|
4047
|
+
const expected = import_node_fs5.default.statSync(file);
|
|
4048
|
+
const fd = import_node_fs5.default.openSync(file, import_node_fs5.default.constants.O_RDONLY | import_node_fs5.default.constants.O_NOFOLLOW);
|
|
3668
4049
|
try {
|
|
3669
|
-
const stat =
|
|
4050
|
+
const stat = import_node_fs5.default.fstatSync(fd);
|
|
3670
4051
|
if (stat.dev !== expected.dev || stat.ino !== expected.ino) {
|
|
3671
4052
|
throw new Error(`swift input changed while opening: ${file}`);
|
|
3672
4053
|
}
|
|
@@ -3676,16 +4057,16 @@ function readPackageFile(root, file, maxBytes) {
|
|
|
3676
4057
|
const bytes = Buffer.alloc(stat.size + 1);
|
|
3677
4058
|
let offset = 0;
|
|
3678
4059
|
while (offset < bytes.length) {
|
|
3679
|
-
const count =
|
|
4060
|
+
const count = import_node_fs5.default.readSync(fd, bytes, offset, bytes.length - offset, null);
|
|
3680
4061
|
if (count === 0) break;
|
|
3681
4062
|
offset += count;
|
|
3682
4063
|
}
|
|
3683
|
-
if (offset !== stat.size ||
|
|
4064
|
+
if (offset !== stat.size || import_node_fs5.default.fstatSync(fd).size !== stat.size) {
|
|
3684
4065
|
throw new Error(`swift input changed while reading: ${file}`);
|
|
3685
4066
|
}
|
|
3686
4067
|
return bytes.subarray(0, offset);
|
|
3687
4068
|
} finally {
|
|
3688
|
-
|
|
4069
|
+
import_node_fs5.default.closeSync(fd);
|
|
3689
4070
|
}
|
|
3690
4071
|
}
|
|
3691
4072
|
|
|
@@ -3723,8 +4104,8 @@ fs.writeFileSync(process.argv[2], JSON.stringify({
|
|
|
3723
4104
|
function configStamp(files) {
|
|
3724
4105
|
return JSON.stringify(
|
|
3725
4106
|
files.map((file) => {
|
|
3726
|
-
if (!
|
|
3727
|
-
const stat =
|
|
4107
|
+
if (!import_node_fs6.default.existsSync(file)) return [file, null];
|
|
4108
|
+
const stat = import_node_fs6.default.statSync(file);
|
|
3728
4109
|
return [file, stat.mtimeMs, stat.ctimeMs, stat.size];
|
|
3729
4110
|
})
|
|
3730
4111
|
);
|
|
@@ -3735,13 +4116,13 @@ async function readConfig(root) {
|
|
|
3735
4116
|
const reading = reads.get(root);
|
|
3736
4117
|
if (reading) return reading;
|
|
3737
4118
|
const promise = (async () => {
|
|
3738
|
-
(0,
|
|
3739
|
-
const cache =
|
|
3740
|
-
|
|
3741
|
-
const directory =
|
|
3742
|
-
const script =
|
|
3743
|
-
const result =
|
|
3744
|
-
|
|
4119
|
+
(0, import_node_module2.createRequire)(import_node_path6.default.join(root, "package.json")).resolve("one/vite");
|
|
4120
|
+
const cache = import_node_path6.default.join(root, "node_modules/.cache/peach-widget-config");
|
|
4121
|
+
import_node_fs6.default.mkdirSync(cache, { recursive: true });
|
|
4122
|
+
const directory = import_node_fs6.default.mkdtempSync(import_node_path6.default.join(cache, "read-"));
|
|
4123
|
+
const script = import_node_path6.default.join(directory, "read.mjs");
|
|
4124
|
+
const result = import_node_path6.default.join(directory, "result.json");
|
|
4125
|
+
import_node_fs6.default.writeFileSync(script, CONFIG_CHILD);
|
|
3745
4126
|
try {
|
|
3746
4127
|
await run(process.execPath, [script, result], {
|
|
3747
4128
|
cwd: root,
|
|
@@ -3749,7 +4130,7 @@ async function readConfig(root) {
|
|
|
3749
4130
|
timeout: 3e4,
|
|
3750
4131
|
maxBuffer: 1024 * 1024
|
|
3751
4132
|
});
|
|
3752
|
-
const value = JSON.parse(
|
|
4133
|
+
const value = JSON.parse(import_node_fs6.default.readFileSync(result, "utf8"));
|
|
3753
4134
|
if (!isRecord(value) || !Array.isArray(value.watched) || !value.watched.every((file) => typeof file === "string"))
|
|
3754
4135
|
throw new Error("One config loader returned invalid dependencies");
|
|
3755
4136
|
if (!Array.isArray(value.urlSchemes) || !value.urlSchemes.every(
|
|
@@ -3772,20 +4153,20 @@ async function readConfig(root) {
|
|
|
3772
4153
|
}
|
|
3773
4154
|
const watched = [
|
|
3774
4155
|
.../* @__PURE__ */ new Set([
|
|
3775
|
-
|
|
3776
|
-
...value.watched.map((file) =>
|
|
4156
|
+
import_node_path6.default.join(root, "package.json"),
|
|
4157
|
+
...value.watched.map((file) => import_node_path6.default.resolve(root, file))
|
|
3777
4158
|
])
|
|
3778
4159
|
];
|
|
3779
|
-
const
|
|
4160
|
+
const loaded2 = {
|
|
3780
4161
|
widget,
|
|
3781
4162
|
urlSchemes: value.urlSchemes,
|
|
3782
4163
|
watched,
|
|
3783
4164
|
stamp: configStamp(watched)
|
|
3784
4165
|
};
|
|
3785
|
-
configs.set(root,
|
|
3786
|
-
return
|
|
4166
|
+
configs.set(root, loaded2);
|
|
4167
|
+
return loaded2;
|
|
3787
4168
|
} finally {
|
|
3788
|
-
|
|
4169
|
+
import_node_fs6.default.rmSync(directory, { recursive: true, force: true });
|
|
3789
4170
|
}
|
|
3790
4171
|
})();
|
|
3791
4172
|
reads.set(root, promise);
|
|
@@ -3806,13 +4187,13 @@ function declaredFamilies(source) {
|
|
|
3806
4187
|
return home;
|
|
3807
4188
|
}
|
|
3808
4189
|
async function readOneWidgetSources(appRoot) {
|
|
3809
|
-
const root =
|
|
4190
|
+
const root = import_node_fs6.default.realpathSync(appRoot);
|
|
3810
4191
|
const config = await readConfig(root);
|
|
3811
4192
|
if (!config.widget) return null;
|
|
3812
4193
|
const widget = config.widget;
|
|
3813
4194
|
const sourceFiles = {
|
|
3814
|
-
"OneWidget.swift":
|
|
3815
|
-
"OneWidgetContract.swift":
|
|
4195
|
+
"OneWidget.swift": import_node_path6.default.join(root, "ios/OneWidgets/OneWidget.swift"),
|
|
4196
|
+
"OneWidgetContract.swift": import_node_path6.default.join(
|
|
3816
4197
|
root,
|
|
3817
4198
|
"ios",
|
|
3818
4199
|
widget.appName,
|
|
@@ -3822,14 +4203,14 @@ async function readOneWidgetSources(appRoot) {
|
|
|
3822
4203
|
const files = /* @__PURE__ */ new Map();
|
|
3823
4204
|
const sources = {};
|
|
3824
4205
|
for (const [name, file] of Object.entries(sourceFiles)) {
|
|
3825
|
-
if (!
|
|
4206
|
+
if (!import_node_fs6.default.existsSync(file))
|
|
3826
4207
|
throw new Error(`missing One widget prebuild source ${file}; run one prebuild`);
|
|
3827
4208
|
const bytes = readPackageFile(root, file, MAX_SWIFT_COMPILE_SOURCE_BYTES);
|
|
3828
4209
|
const text = bytes.toString("utf8");
|
|
3829
4210
|
if (!Buffer.from(text).equals(bytes))
|
|
3830
4211
|
throw new Error(`One widget prebuild source is not UTF-8: ${file}`);
|
|
3831
4212
|
files.set(name, text);
|
|
3832
|
-
sources[
|
|
4213
|
+
sources[import_node_path6.default.relative(root, file).split(import_node_path6.default.sep).join("/")] = (0, import_node_crypto3.createHash)("sha256").update(bytes).digest("hex");
|
|
3833
4214
|
}
|
|
3834
4215
|
const contract = files.get("OneWidgetContract.swift") ?? "";
|
|
3835
4216
|
const source = files.get("OneWidget.swift") ?? "";
|
|
@@ -3853,60 +4234,13 @@ async function configuredOneWidget(appRoot, bundleUrl) {
|
|
|
3853
4234
|
return {
|
|
3854
4235
|
metadata: source.widget,
|
|
3855
4236
|
projectRoot: source.root,
|
|
3856
|
-
appIdentity: (0,
|
|
4237
|
+
appIdentity: (0, import_node_crypto3.createHash)("sha256").update(JSON.stringify([source.root, source.widget.bundleId])).digest("hex"),
|
|
3857
4238
|
bundleUrl,
|
|
3858
4239
|
packageUrl: new URL(`${SWIFT_PACKAGE_PATH}OneWidgets`, bundleUrl).href,
|
|
3859
4240
|
urlSchemes: source.urlSchemes
|
|
3860
4241
|
};
|
|
3861
4242
|
}
|
|
3862
4243
|
|
|
3863
|
-
// src/bundleGlobalFooter.ts
|
|
3864
|
-
function findBundleFooter(source, prefix) {
|
|
3865
|
-
let end = source.length;
|
|
3866
|
-
while (end > 0) {
|
|
3867
|
-
const newline = source.lastIndexOf("\n", end - 1);
|
|
3868
|
-
if (newline < 0) return -1;
|
|
3869
|
-
const line = newline + 1;
|
|
3870
|
-
if (source.startsWith(prefix, line)) return newline;
|
|
3871
|
-
if (!isFooterBlockLine(source, line, end)) return -1;
|
|
3872
|
-
end = newline;
|
|
3873
|
-
}
|
|
3874
|
-
return -1;
|
|
3875
|
-
}
|
|
3876
|
-
function isFooterBlockLine(source, line, end) {
|
|
3877
|
-
return line === end || source.startsWith("globalThis.", line) || source.startsWith("//", line);
|
|
3878
|
-
}
|
|
3879
|
-
function readFooter(source, prefix, suffix, name) {
|
|
3880
|
-
const start = findBundleFooter(source, prefix);
|
|
3881
|
-
if (start < 0) return null;
|
|
3882
|
-
const end = source.indexOf("\n", start + 1);
|
|
3883
|
-
const line = source.slice(start + 1, end < 0 ? void 0 : end);
|
|
3884
|
-
if (!line.endsWith(suffix)) throw new Error(`${name} footer is truncated`);
|
|
3885
|
-
const value = JSON.parse(
|
|
3886
|
-
line.slice(prefix.length, suffix ? -suffix.length : void 0)
|
|
3887
|
-
);
|
|
3888
|
-
if (value === null) throw new Error(`${name} footer has no metadata`);
|
|
3889
|
-
return value;
|
|
3890
|
-
}
|
|
3891
|
-
function detachFooter(source, prefix, suffix, name) {
|
|
3892
|
-
const start = findBundleFooter(source, prefix);
|
|
3893
|
-
if (start < 0) return { source, value: null };
|
|
3894
|
-
const value = readFooter(source, prefix, suffix, name);
|
|
3895
|
-
const end = source.indexOf("\n", start + 1);
|
|
3896
|
-
return { source: source.slice(0, start) + (end < 0 ? "" : source.slice(end)), value };
|
|
3897
|
-
}
|
|
3898
|
-
function insertBundleGlobalFooter(source, name, value) {
|
|
3899
|
-
return insertFooter(source, `globalThis.${name}=`, ";", name, value);
|
|
3900
|
-
}
|
|
3901
|
-
function insertFooter(source, prefix, suffix, name, value) {
|
|
3902
|
-
source = detachFooter(source, prefix, suffix, name).source;
|
|
3903
|
-
const json = JSON.stringify(value).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029").replace(/<\//g, "<\\/");
|
|
3904
|
-
const footer = `
|
|
3905
|
-
${prefix}${json}${suffix}`;
|
|
3906
|
-
const identity = findBundleFooter(source, "globalThis.__sootsimModulePaths=");
|
|
3907
|
-
return identity < 0 ? source + footer : source.slice(0, identity) + footer + source.slice(identity);
|
|
3908
|
-
}
|
|
3909
|
-
|
|
3910
4244
|
// src/packageVersionsContract.ts
|
|
3911
4245
|
var PACKAGE_VERSIONS_HEADER = "X-Peach-Package-Versions";
|
|
3912
4246
|
var FOOTER = "__peachPackageVersions";
|
|
@@ -3927,204 +4261,8 @@ function insertPackageVersionsFooter(source, versions) {
|
|
|
3927
4261
|
return insertBundleGlobalFooter(source, FOOTER, readPackageVersions(versions));
|
|
3928
4262
|
}
|
|
3929
4263
|
|
|
3930
|
-
// src/runtime-assets.ts
|
|
3931
|
-
var import_fs2 = __toESM(require("fs"), 1);
|
|
3932
|
-
var import_path2 = __toESM(require("path"), 1);
|
|
3933
|
-
var import_url = require("url");
|
|
3934
|
-
|
|
3935
|
-
// ../contrast-runtime-delivery/src/index.ts
|
|
3936
|
-
init_process_group();
|
|
3937
|
-
|
|
3938
|
-
// ../contrast-runtime-delivery/src/version.ts
|
|
3939
|
-
function isValidRuntimeVersion(value) {
|
|
3940
|
-
return value.length <= 100 && /^[0-9A-Za-z][0-9A-Za-z._+-]*$/.test(value);
|
|
3941
|
-
}
|
|
3942
|
-
|
|
3943
|
-
// src/runtime-assets.ts
|
|
3944
|
-
var SOOTSIM_RUNTIME_MISSING_MESSAGE = "[peach] no engine runtime installed. run `peach runtime install`";
|
|
3945
|
-
var _monorepoRootCache;
|
|
3946
|
-
function findMonorepoRoot() {
|
|
3947
|
-
if (_monorepoRootCache !== void 0) return _monorepoRootCache;
|
|
3948
|
-
let dir = import_path2.default.dirname((0, import_url.fileURLToPath)(__sootsim_import_meta_url));
|
|
3949
|
-
for (let i = 0; i < 12 && dir !== import_path2.default.dirname(dir); i++) {
|
|
3950
|
-
if (import_fs2.default.existsSync(import_path2.default.join(dir, "packages/peach-engine/package.json")) && import_fs2.default.existsSync(import_path2.default.join(dir, "public/sootsim"))) {
|
|
3951
|
-
_monorepoRootCache = dir;
|
|
3952
|
-
return dir;
|
|
3953
|
-
}
|
|
3954
|
-
dir = import_path2.default.dirname(dir);
|
|
3955
|
-
}
|
|
3956
|
-
_monorepoRootCache = null;
|
|
3957
|
-
return null;
|
|
3958
|
-
}
|
|
3959
|
-
function resolveDevCheckoutRuntimeRoot() {
|
|
3960
|
-
if (process.env.PEACH_HOME && readActiveRuntime()) return null;
|
|
3961
|
-
const root = findMonorepoRoot();
|
|
3962
|
-
if (!root) return null;
|
|
3963
|
-
const devBuild = import_path2.default.join(root, "public/sootsim");
|
|
3964
|
-
if (import_fs2.default.existsSync(import_path2.default.join(devBuild, "index.html")) && import_fs2.default.existsSync(import_path2.default.join(devBuild, "engine/index.html")) && import_fs2.default.existsSync(import_path2.default.join(devBuild, "engine-tenant/worker.js")) && import_fs2.default.existsSync(import_path2.default.join(devBuild, "engine-tenant/worker.prod.js"))) {
|
|
3965
|
-
return devBuild;
|
|
3966
|
-
}
|
|
3967
|
-
return null;
|
|
3968
|
-
}
|
|
3969
|
-
var MIME_TYPES = {
|
|
3970
|
-
".js": "application/javascript",
|
|
3971
|
-
".mjs": "application/javascript",
|
|
3972
|
-
".css": "text/css",
|
|
3973
|
-
".html": "text/html",
|
|
3974
|
-
".wasm": "application/wasm",
|
|
3975
|
-
".json": "application/json",
|
|
3976
|
-
".jpg": "image/jpeg",
|
|
3977
|
-
".jpeg": "image/jpeg",
|
|
3978
|
-
".png": "image/png",
|
|
3979
|
-
".svg": "image/svg+xml",
|
|
3980
|
-
".webp": "image/webp",
|
|
3981
|
-
".glb": "model/gltf-binary",
|
|
3982
|
-
".ttf": "font/ttf",
|
|
3983
|
-
".otf": "font/otf",
|
|
3984
|
-
".woff": "font/woff",
|
|
3985
|
-
".woff2": "font/woff2",
|
|
3986
|
-
".mp3": "audio/mpeg",
|
|
3987
|
-
".wav": "audio/wav",
|
|
3988
|
-
".mp4": "video/mp4",
|
|
3989
|
-
".m4v": "video/mp4",
|
|
3990
|
-
".mov": "video/quicktime",
|
|
3991
|
-
".webm": "video/webm"
|
|
3992
|
-
};
|
|
3993
|
-
var ROOT_RUNTIME_PATHS = [
|
|
3994
|
-
"/assets/",
|
|
3995
|
-
"/engine/",
|
|
3996
|
-
"/engine-tenant/",
|
|
3997
|
-
"/photos/",
|
|
3998
|
-
"/three-mode/",
|
|
3999
|
-
"/fonts/",
|
|
4000
|
-
"/icons/",
|
|
4001
|
-
"/sounds/",
|
|
4002
|
-
"/spike/",
|
|
4003
|
-
"/test-wallpaper.jpg",
|
|
4004
|
-
"/preview-sw.js",
|
|
4005
|
-
"/peach.svg",
|
|
4006
|
-
"/bedrock-sqlite.wasm",
|
|
4007
|
-
"/bedrock-sqlite.js",
|
|
4008
|
-
"/sootsim/"
|
|
4009
|
-
];
|
|
4010
|
-
function resolveActiveRuntimeRoot() {
|
|
4011
|
-
const devRoot = resolveDevCheckoutRuntimeRoot();
|
|
4012
|
-
if (devRoot) return devRoot;
|
|
4013
|
-
const active = readActiveRuntime();
|
|
4014
|
-
if (!active) return null;
|
|
4015
|
-
const dir = runtimeDir(active);
|
|
4016
|
-
if (!import_fs2.default.existsSync(import_path2.default.join(dir, "index.html"))) return null;
|
|
4017
|
-
return dir;
|
|
4018
|
-
}
|
|
4019
|
-
var RUNTIME_VERSION_HOSTNAME_SUFFIX = ".runtime.localhost";
|
|
4020
|
-
function isRuntimeVersionHostname(hostname) {
|
|
4021
|
-
return hostname.toLowerCase().endsWith(RUNTIME_VERSION_HOSTNAME_SUFFIX);
|
|
4022
|
-
}
|
|
4023
|
-
function runtimeVersionFromHostname(hostname) {
|
|
4024
|
-
if (!isRuntimeVersionHostname(hostname)) return null;
|
|
4025
|
-
const labels = hostname.slice(0, -RUNTIME_VERSION_HOSTNAME_SUFFIX.length).split(".");
|
|
4026
|
-
if (labels.length === 0 || labels.some((label) => !/^[0-9a-f]{1,60}$/i.test(label))) {
|
|
4027
|
-
return null;
|
|
4028
|
-
}
|
|
4029
|
-
const encoded = labels.join("");
|
|
4030
|
-
if (encoded.length % 2 !== 0) return null;
|
|
4031
|
-
try {
|
|
4032
|
-
const version = Buffer.from(encoded, "hex").toString("utf8");
|
|
4033
|
-
return isValidRuntimeVersion(version) ? version : null;
|
|
4034
|
-
} catch {
|
|
4035
|
-
return null;
|
|
4036
|
-
}
|
|
4037
|
-
}
|
|
4038
|
-
function resolveInstalledRuntimeRoot(version) {
|
|
4039
|
-
const dir = runtimeDir(version);
|
|
4040
|
-
if (!import_fs2.default.existsSync(import_path2.default.join(dir, "index.html"))) return null;
|
|
4041
|
-
return dir;
|
|
4042
|
-
}
|
|
4043
|
-
function resolveRuntimeRootForHostname(hostname) {
|
|
4044
|
-
if (!isRuntimeVersionHostname(hostname)) return resolveActiveRuntimeRoot();
|
|
4045
|
-
const version = runtimeVersionFromHostname(hostname);
|
|
4046
|
-
return version ? resolveInstalledRuntimeRoot(version) : null;
|
|
4047
|
-
}
|
|
4048
|
-
function resolveRuntimeRootForRequestHost(host) {
|
|
4049
|
-
if (!host) return resolveActiveRuntimeRoot();
|
|
4050
|
-
try {
|
|
4051
|
-
return resolveRuntimeRootForHostname(new URL(`http://${host}`).hostname);
|
|
4052
|
-
} catch {
|
|
4053
|
-
return null;
|
|
4054
|
-
}
|
|
4055
|
-
}
|
|
4056
|
-
function isRootRuntimeAssetPath(pathname) {
|
|
4057
|
-
return ROOT_RUNTIME_PATHS.some((p) => pathname === p || pathname.startsWith(p));
|
|
4058
|
-
}
|
|
4059
|
-
function resolveRuntimeFilePath(runtimeRoot, pathname) {
|
|
4060
|
-
if (!pathname.startsWith("/")) return null;
|
|
4061
|
-
if (pathname.includes("\0") || pathname.includes("\\")) return null;
|
|
4062
|
-
for (const segment of pathname.split("/")) {
|
|
4063
|
-
if (segment === "..") return null;
|
|
4064
|
-
}
|
|
4065
|
-
const normalized = pathname.startsWith("/sootsim/") ? pathname.slice("/sootsim".length) : pathname;
|
|
4066
|
-
const fullPath = import_path2.default.resolve(runtimeRoot, normalized.replace(/^\/+/, ""));
|
|
4067
|
-
const rootWithSep = runtimeRoot.endsWith(import_path2.default.sep) ? runtimeRoot : runtimeRoot + import_path2.default.sep;
|
|
4068
|
-
if (!fullPath.startsWith(rootWithSep) && fullPath !== runtimeRoot) return null;
|
|
4069
|
-
if (!import_fs2.default.existsSync(fullPath) || !import_fs2.default.statSync(fullPath).isFile()) return null;
|
|
4070
|
-
return fullPath;
|
|
4071
|
-
}
|
|
4072
|
-
function serveRuntimeFile(req, res, fullPath) {
|
|
4073
|
-
const ext = import_path2.default.extname(fullPath);
|
|
4074
|
-
const stat = import_fs2.default.statSync(fullPath);
|
|
4075
|
-
const lastModified = stat.mtime.toUTCString();
|
|
4076
|
-
res.setHeader("content-type", MIME_TYPES[ext] || "application/octet-stream");
|
|
4077
|
-
if (/^canvaskit-graphite-pipelines-[0-9a-f]{8}\.bin$/.test(import_path2.default.basename(fullPath))) {
|
|
4078
|
-
res.setHeader("cache-control", "public, max-age=31536000, immutable");
|
|
4079
|
-
import_fs2.default.createReadStream(fullPath).pipe(res);
|
|
4080
|
-
return;
|
|
4081
|
-
}
|
|
4082
|
-
res.setHeader("cache-control", "no-cache");
|
|
4083
|
-
res.setHeader("last-modified", lastModified);
|
|
4084
|
-
if (req?.headers?.["if-modified-since"] === lastModified) {
|
|
4085
|
-
res.statusCode = 304;
|
|
4086
|
-
res.end();
|
|
4087
|
-
return;
|
|
4088
|
-
}
|
|
4089
|
-
sendFileWithRanges(req, res, fullPath, stat.size, {});
|
|
4090
|
-
}
|
|
4091
|
-
function sendFileWithRanges(req, res, filePath, total, headers) {
|
|
4092
|
-
const head = (req?.method || "GET").toUpperCase() === "HEAD";
|
|
4093
|
-
const range = /^bytes=(\d*)-(\d*)$/.exec(req?.headers?.range || "");
|
|
4094
|
-
const invalid = range && range[1] && range[2] && Number(range[2]) < Number(range[1]);
|
|
4095
|
-
if (range && (range[1] || range[2]) && !invalid) {
|
|
4096
|
-
const [, startRaw, endRaw] = range;
|
|
4097
|
-
const start = startRaw ? Number(startRaw) : Math.max(0, total - Number(endRaw));
|
|
4098
|
-
const end = startRaw && endRaw ? Math.min(Number(endRaw), total - 1) : total - 1;
|
|
4099
|
-
if (start > end || start >= total) {
|
|
4100
|
-
res.writeHead(416, { ...headers, "Content-Range": `bytes */${total}` });
|
|
4101
|
-
res.end();
|
|
4102
|
-
return;
|
|
4103
|
-
}
|
|
4104
|
-
res.writeHead(206, {
|
|
4105
|
-
...headers,
|
|
4106
|
-
"Content-Range": `bytes ${start}-${end}/${total}`,
|
|
4107
|
-
"Accept-Ranges": "bytes",
|
|
4108
|
-
"Content-Length": String(end - start + 1)
|
|
4109
|
-
});
|
|
4110
|
-
if (head) res.end();
|
|
4111
|
-
else streamFile(res, import_fs2.default.createReadStream(filePath, { start, end }));
|
|
4112
|
-
return;
|
|
4113
|
-
}
|
|
4114
|
-
res.writeHead(200, {
|
|
4115
|
-
...headers,
|
|
4116
|
-
"Accept-Ranges": "bytes",
|
|
4117
|
-
"Content-Length": String(total)
|
|
4118
|
-
});
|
|
4119
|
-
if (head || total === 0) res.end();
|
|
4120
|
-
else streamFile(res, import_fs2.default.createReadStream(filePath, { start: 0, end: total - 1 }));
|
|
4121
|
-
}
|
|
4122
|
-
function streamFile(res, stream) {
|
|
4123
|
-
stream.on("error", (error) => res.destroy(error));
|
|
4124
|
-
stream.pipe(res);
|
|
4125
|
-
}
|
|
4126
|
-
|
|
4127
4264
|
// src/vite-plugin-one.ts
|
|
4265
|
+
init_runtime_assets();
|
|
4128
4266
|
function exposeHeader(res, name) {
|
|
4129
4267
|
const exposed = res.getHeader("access-control-expose-headers");
|
|
4130
4268
|
const names = typeof exposed === "string" && exposed ? exposed.split(/,\s*/) : [];
|
|
@@ -4145,12 +4283,15 @@ function peachPlugin(options = {}) {
|
|
|
4145
4283
|
vxrnNative({ root, dev }) {
|
|
4146
4284
|
return {
|
|
4147
4285
|
name: "peach:package-versions",
|
|
4148
|
-
generateBundle(_options, bundle) {
|
|
4286
|
+
async generateBundle(_options, bundle) {
|
|
4149
4287
|
if (options.enabled === false || dev) return;
|
|
4150
4288
|
const versions = readInstalledNativePackageVersions(root);
|
|
4289
|
+
const { attachRolldownBundleInventory } = getCliRuntime().rolldown_bundle_inventory;
|
|
4151
4290
|
for (const output of Object.values(bundle)) {
|
|
4152
4291
|
if (output.type !== "chunk") continue;
|
|
4153
|
-
output.code =
|
|
4292
|
+
output.code = await attachRolldownBundleInventory(
|
|
4293
|
+
insertPackageVersionsFooter(output.code, versions)
|
|
4294
|
+
);
|
|
4154
4295
|
}
|
|
4155
4296
|
}
|
|
4156
4297
|
};
|
|
@@ -4169,6 +4310,135 @@ function peachPlugin(options = {}) {
|
|
|
4169
4310
|
},
|
|
4170
4311
|
async configureServer(server) {
|
|
4171
4312
|
if (options.enabled === false) return;
|
|
4313
|
+
server.middlewares.use((req, res, next) => {
|
|
4314
|
+
if (!(req.url ?? "").split("?")[0].endsWith(".bundle")) {
|
|
4315
|
+
next();
|
|
4316
|
+
return;
|
|
4317
|
+
}
|
|
4318
|
+
res.setHeader(
|
|
4319
|
+
PACKAGE_VERSIONS_HEADER,
|
|
4320
|
+
JSON.stringify(readInstalledNativePackageVersions(server.config.root))
|
|
4321
|
+
);
|
|
4322
|
+
exposeHeader(res, PACKAGE_VERSIONS_HEADER);
|
|
4323
|
+
res.setHeader(ROLLDOWN_INVENTORY_HEADER, "1");
|
|
4324
|
+
exposeHeader(res, ROLLDOWN_INVENTORY_HEADER);
|
|
4325
|
+
const origWriteHead = res.writeHead.bind(res);
|
|
4326
|
+
const origWrite = res.write.bind(res);
|
|
4327
|
+
const origEnd = res.end.bind(res);
|
|
4328
|
+
let pendingStatus;
|
|
4329
|
+
let pendingMessage;
|
|
4330
|
+
const flushHead = () => {
|
|
4331
|
+
if (pendingStatus !== void 0 && !res.headersSent) {
|
|
4332
|
+
const code = pendingStatus;
|
|
4333
|
+
const msg = pendingMessage;
|
|
4334
|
+
pendingStatus = void 0;
|
|
4335
|
+
pendingMessage = void 0;
|
|
4336
|
+
if (typeof msg === "string") origWriteHead(code, msg);
|
|
4337
|
+
else origWriteHead(code);
|
|
4338
|
+
}
|
|
4339
|
+
};
|
|
4340
|
+
Reflect.set(
|
|
4341
|
+
res,
|
|
4342
|
+
"writeHead",
|
|
4343
|
+
function(statusCode, statusMessage, headers) {
|
|
4344
|
+
pendingStatus = statusCode;
|
|
4345
|
+
res.statusCode = statusCode;
|
|
4346
|
+
if (typeof statusMessage === "string") pendingMessage = statusMessage;
|
|
4347
|
+
const hdrs = typeof statusMessage === "object" && statusMessage !== null ? statusMessage : headers;
|
|
4348
|
+
if (hdrs && typeof hdrs === "object" && !Array.isArray(hdrs)) {
|
|
4349
|
+
for (const [key, value] of Object.entries(hdrs)) {
|
|
4350
|
+
if (key.toLowerCase() === "content-length") continue;
|
|
4351
|
+
if (typeof value === "string" || typeof value === "number" || Array.isArray(value)) {
|
|
4352
|
+
res.setHeader(key, value);
|
|
4353
|
+
}
|
|
4354
|
+
}
|
|
4355
|
+
}
|
|
4356
|
+
res.removeHeader("content-length");
|
|
4357
|
+
if (statusCode !== 200) res.removeHeader(ROLLDOWN_INVENTORY_HEADER);
|
|
4358
|
+
return res;
|
|
4359
|
+
}
|
|
4360
|
+
);
|
|
4361
|
+
const chunks = [];
|
|
4362
|
+
let buffering = false;
|
|
4363
|
+
const isBufferEncoding = (value) => typeof value === "string" && Buffer.isEncoding(value);
|
|
4364
|
+
const toBuffer = (chunk, encoding) => {
|
|
4365
|
+
if (chunk === void 0 || chunk === null || typeof chunk === "function")
|
|
4366
|
+
return null;
|
|
4367
|
+
if (Buffer.isBuffer(chunk)) return chunk;
|
|
4368
|
+
if (chunk instanceof Uint8Array) return Buffer.from(chunk);
|
|
4369
|
+
if (typeof chunk === "string")
|
|
4370
|
+
return Buffer.from(chunk, isBufferEncoding(encoding) ? encoding : "utf8");
|
|
4371
|
+
return null;
|
|
4372
|
+
};
|
|
4373
|
+
Reflect.set(res, "write", function(chunk, arg1) {
|
|
4374
|
+
const buf = toBuffer(chunk, arg1);
|
|
4375
|
+
if (!buf) {
|
|
4376
|
+
flushHead();
|
|
4377
|
+
return origWrite("");
|
|
4378
|
+
}
|
|
4379
|
+
if (!buffering) {
|
|
4380
|
+
const lower = buf.toString("utf8").toLowerCase();
|
|
4381
|
+
const contentType = String(res.getHeader("content-type") ?? "").toLowerCase();
|
|
4382
|
+
if (!contentType.includes("multipart/mixed") || lower.includes("content-type: text/javascript") || lower.includes("content-type: application/javascript")) {
|
|
4383
|
+
buffering = true;
|
|
4384
|
+
}
|
|
4385
|
+
}
|
|
4386
|
+
if (buffering) {
|
|
4387
|
+
chunks.push(buf);
|
|
4388
|
+
return true;
|
|
4389
|
+
}
|
|
4390
|
+
flushHead();
|
|
4391
|
+
return origWrite(buf);
|
|
4392
|
+
});
|
|
4393
|
+
Reflect.set(
|
|
4394
|
+
res,
|
|
4395
|
+
"end",
|
|
4396
|
+
function(chunk, arg1, arg2) {
|
|
4397
|
+
const callback = typeof chunk === "function" ? chunk : typeof arg1 === "function" ? arg1 : typeof arg2 === "function" ? arg2 : void 0;
|
|
4398
|
+
const finish = () => {
|
|
4399
|
+
flushHead();
|
|
4400
|
+
if (typeof callback === "function") {
|
|
4401
|
+
return origEnd(() => {
|
|
4402
|
+
Reflect.apply(callback, res, []);
|
|
4403
|
+
});
|
|
4404
|
+
}
|
|
4405
|
+
return origEnd();
|
|
4406
|
+
};
|
|
4407
|
+
const buf = toBuffer(chunk, arg1);
|
|
4408
|
+
if (buf) chunks.push(buf);
|
|
4409
|
+
if (chunks.length === 0 || res.statusCode && res.statusCode !== 200) {
|
|
4410
|
+
if (!res.headersSent) res.removeHeader(ROLLDOWN_INVENTORY_HEADER);
|
|
4411
|
+
flushHead();
|
|
4412
|
+
for (const queued of chunks) origWrite(queued);
|
|
4413
|
+
return finish();
|
|
4414
|
+
}
|
|
4415
|
+
const payload = Buffer.concat(chunks).toString("utf8");
|
|
4416
|
+
const contentType = String(res.getHeader("content-type") ?? "");
|
|
4417
|
+
void getCliRuntime().rolldown_bundle_inventory.attachRolldownBundleHttpPayload(
|
|
4418
|
+
payload,
|
|
4419
|
+
contentType
|
|
4420
|
+
).then((annotated) => {
|
|
4421
|
+
if (!res.headersSent) res.removeHeader("content-length");
|
|
4422
|
+
flushHead();
|
|
4423
|
+
origWrite(Buffer.from(annotated, "utf8"));
|
|
4424
|
+
finish();
|
|
4425
|
+
}).catch((error) => {
|
|
4426
|
+
console.error("[peach] failed to attach rolldown bundle inventory", error);
|
|
4427
|
+
if (!res.headersSent) {
|
|
4428
|
+
res.removeHeader("content-length");
|
|
4429
|
+
res.removeHeader(ROLLDOWN_INVENTORY_HEADER);
|
|
4430
|
+
}
|
|
4431
|
+
flushHead();
|
|
4432
|
+
origWrite(Buffer.from(payload, "utf8"));
|
|
4433
|
+
finish();
|
|
4434
|
+
});
|
|
4435
|
+
return res;
|
|
4436
|
+
}
|
|
4437
|
+
);
|
|
4438
|
+
next();
|
|
4439
|
+
});
|
|
4440
|
+
const bundleLayer = server.middlewares.stack.pop();
|
|
4441
|
+
if (bundleLayer) server.middlewares.stack.unshift(bundleLayer);
|
|
4172
4442
|
const { swiftPackageDirectories } = await import("vxrn");
|
|
4173
4443
|
let swiftPackages;
|
|
4174
4444
|
let swiftModuleRoot;
|
|
@@ -4356,7 +4626,7 @@ function peachPlugin(options = {}) {
|
|
|
4356
4626
|
});
|
|
4357
4627
|
const bundleUrl = options.bundleUrl || "/node_modules/one/metro-entry.bundle?platform=ios&dev=true&minify=false";
|
|
4358
4628
|
const appName = resolveRnxDesktopAppName(options.open, server.config.root);
|
|
4359
|
-
const replacementToken = (0,
|
|
4629
|
+
const replacementToken = (0, import_node_crypto4.randomUUID)();
|
|
4360
4630
|
const bundleForOrigin = (origin) => {
|
|
4361
4631
|
const fullBundleUrl = new URL(bundleUrl, `${origin}/`).toString();
|
|
4362
4632
|
return tagRnxBundleForPlugin(
|
|
@@ -4390,16 +4660,6 @@ function peachPlugin(options = {}) {
|
|
|
4390
4660
|
};
|
|
4391
4661
|
next();
|
|
4392
4662
|
});
|
|
4393
|
-
server.middlewares.use((req, res, next) => {
|
|
4394
|
-
if ((req.url ?? "").split("?")[0].endsWith(".bundle")) {
|
|
4395
|
-
res.setHeader(
|
|
4396
|
-
PACKAGE_VERSIONS_HEADER,
|
|
4397
|
-
JSON.stringify(readInstalledNativePackageVersions(server.config.root))
|
|
4398
|
-
);
|
|
4399
|
-
exposeHeader(res, PACKAGE_VERSIONS_HEADER);
|
|
4400
|
-
}
|
|
4401
|
-
next();
|
|
4402
|
-
});
|
|
4403
4663
|
server.middlewares.use(async (req, res, next) => {
|
|
4404
4664
|
if ((req.url || "").split("?")[0] !== "/__server-scan") return next();
|
|
4405
4665
|
const scanPort = listeningPort();
|