peachsim 0.1.1654 → 0.1.1659
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/app-config.ts +4 -0
- package/cli/app-stubs.ts +43 -6
- package/cli/commands/inspect/shared.ts +5 -2
- package/cli/commands/inspect/url.ts +2 -1
- package/cli/commands/screenshot.ts +5 -5
- package/cli/commands/state.ts +9 -6
- package/cli/outbound-endpoints.ts +9 -1
- package/cli/output-redaction.ts +49 -0
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +11485 -1316
- 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 +29 -5
- package/dist-lib/config.mjs +29 -5
- package/dist-lib/detox/index.cjs +19 -5
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +9194 -327
- 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 +10137 -1043
- package/dist-lib/host/fetch-proxy-handler.cjs +260 -182
- 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 +653 -338
- 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 +443 -312
- 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 +548 -163
- package/dist-lib/native-app-identity-project.cjs +179 -33
- package/dist-lib/native-app-identity-project.mjs +179 -33
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +23 -23
- package/dist-lib/public-origins-lib.json +96 -63
- 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 +2 -2
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +10885 -1596
- package/dist-lib/swift-compile.cjs +9036 -331
- package/dist-lib/swift-compile.mjs +9036 -331
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -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 +9194 -327
- package/dist-lib/vite.cjs +149 -163
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-gesture-handler.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/app-font-registry.d.ts +14 -0
- package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +8 -0
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +21 -0
- package/dist-types/packages/peach-engine/src/render-worker/gesture-seam-protocol.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/render-worker/test-bridge-protocol.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/rolldown-bundle-inventory.d.ts +5 -0
- package/dist-types/packages/peach-globals/src/index.d.ts +25 -0
- package/kotlin/README.md +38 -23
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +2 -12
- package/runtime-companion.json +1 -1
- package/src/bundleGlobalFooter.ts +0 -2
- package/src/config.ts +54 -2
- package/src/configured-bundle-producer.ts +7 -1
- package/src/host/fetch-proxy-handler.ts +14 -33
- package/src/host/rolldown-bundle-forward.ts +71 -0
- package/src/installed-package-versions.ts +54 -2
- package/src/kotlin-host.ts +138 -285
- package/src/kotlin-module.ts +4 -7
- package/src/kotlin-sdk.ts +81 -0
- package/src/kotlin-toolchain.ts +152 -0
- package/src/kotlin-view-models.ts +1 -1
- package/src/kotlinSdkContract.ts +113 -0
- package/src/nitro-adapter.lock.json +3 -3
- package/src/nitro-bundle.ts +18 -4
- package/src/nitro-compile.ts +5 -1
- package/src/nitro-source.ts +112 -28
- package/src/nitroContract.ts +16 -4
- package/src/swift-compile.ts +295 -237
- package/src/swift-host.ts +2 -1
- package/src/swift-objc-compile.ts +117 -4
- package/src/swift-objc-sdk.ts +8792 -135
- package/src/swift-objc-standin.ts +1 -0
- package/src/swiftContract.ts +2 -0
- package/src/vite-plugin-one.ts +73 -134
- package/src/worker-system-chunks.ts +14 -4
- package/src/xcode-project.ts +261 -34
- package/kotlin/AndroidViewSources/android/content/Context.kt +0 -22
- package/kotlin/AndroidViewSources/android/content/res/Configuration.kt +0 -25
- package/kotlin/AndroidViewSources/android/content/res/Resources.kt +0 -72
- package/kotlin/AndroidViewSources/android/graphics/Canvas.kt +0 -22
- package/kotlin/AndroidViewSources/android/graphics/Color.kt +0 -13
- package/kotlin/AndroidViewSources/android/graphics/Paint.kt +0 -18
- package/kotlin/AndroidViewSources/android/util/DisplayMetrics.kt +0 -12
- package/kotlin/AndroidViewSources/android/view/View.kt +0 -211
- package/kotlin/AndroidViewSources/android/widget/FrameLayout.kt +0 -61
- package/kotlin/AndroidViewSources/android/widget/LinearLayout.kt +0 -49
- package/kotlin/AndroidViewSources/dev/peach/app/JavaFormat.kt +0 -272
- package/kotlin/AppSources/android/app/Activity.kt +0 -174
- package/kotlin/AppSources/android/app/Application.kt +0 -11
- package/kotlin/AppSources/android/app/UiModeManager.kt +0 -9
- package/kotlin/AppSources/android/content/Intent.kt +0 -16
- package/kotlin/AppSources/android/os/Bundle.kt +0 -11
- package/kotlin/AppSources/android/util/SuperNotCalledException.kt +0 -3
- package/kotlin/AppSources/android/view/Window.kt +0 -182
- package/kotlin/AppSources/android/view/WindowInsets.kt +0 -9
- package/kotlin/AppSources/android/view/WindowInsetsController.kt +0 -17
- package/kotlin/AppSources/android/view/WindowManager.kt +0 -16
- package/kotlin/AppSources/android/window/BackEvent.kt +0 -24
- package/kotlin/AppSources/android/window/OnBackAnimationCallback.kt +0 -7
- package/kotlin/AppSources/android/window/OnBackInvokedDispatcher.kt +0 -84
- package/kotlin/AppSources/androidx/activity/ActivityFlags.kt +0 -9
- package/kotlin/AppSources/androidx/activity/ActivityViewModelLazy.kt +0 -21
- package/kotlin/AppSources/androidx/activity/BackEventCompat.kt +0 -43
- package/kotlin/AppSources/androidx/activity/ComponentActivity.kt +0 -122
- package/kotlin/AppSources/androidx/activity/EdgeToEdge.kt +0 -75
- package/kotlin/AppSources/androidx/activity/ExperimentalActivityApi.kt +0 -6
- package/kotlin/AppSources/androidx/activity/OnBackPressedCallback.kt +0 -69
- package/kotlin/AppSources/androidx/activity/OnBackPressedDispatcher.kt +0 -144
- package/kotlin/AppSources/androidx/activity/OnBackPressedDispatcherOwner.kt +0 -7
- package/kotlin/AppSources/androidx/activity/compose/BackHandler.kt +0 -86
- package/kotlin/AppSources/androidx/activity/compose/ComponentActivity.kt +0 -29
- package/kotlin/AppSources/androidx/activity/compose/internal/BackHandlerCompat.kt +0 -38
- package/kotlin/AppSources/androidx/activity/compose/internal/BackHandlerDispatcherCompat.kt +0 -27
- package/kotlin/AppSources/androidx/compose/foundation/layout/WindowInsets.kt +0 -15
- package/kotlin/AppSources/androidx/compose/ui/platform/AndroidCompositionLocals.kt +0 -27
- package/kotlin/AppSources/androidx/compose/ui/platform/ComposeView.kt +0 -68
- package/kotlin/AppSources/androidx/compose/ui/res/ColorResources.kt +0 -16
- package/kotlin/AppSources/androidx/compose/ui/res/PainterResources.kt +0 -70
- package/kotlin/AppSources/androidx/compose/ui/res/StringResources.kt +0 -38
- package/kotlin/AppSources/androidx/core/view/WindowCompat.kt +0 -32
- package/kotlin/AppSources/androidx/lifecycle/AndroidViewModel.kt +0 -10
- package/kotlin/AppSources/dev/peach/app/PeachApp.kt +0 -388
- package/kotlin/AppSources/dev/peach/app/PeachDrawable.kt +0 -102
- package/kotlin/AppSources/dev/peach/app/PeachWindowHost.kt +0 -14
- package/kotlin/CompilerSources/META-INF/services/org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar +0 -1
- package/kotlin/CompilerSources/PeachJniIncoming.kt +0 -243
- package/kotlin/CompilerSources/PeachJniPlugin.kt +0 -116
- package/kotlin/ComposeSources/PeachComposeHost.kt +0 -724
- package/kotlin/ComposeSources/PeachMagnifier.kt +0 -185
- package/kotlin/ComposeSources/PeachSemantics.kt +0 -127
- package/kotlin/ExpoComposeSources/PeachAndroidView.kt +0 -103
- package/kotlin/ExpoComposeSources/PeachExpoViewMount.kt +0 -24
- package/kotlin/ExpoComposeSources/dev/peach/expo/PeachExpoCompose.kt +0 -28
- package/kotlin/ExpoComposeSources/expo/modules/kotlin/views/ExpoComposeView.kt +0 -70
- package/kotlin/ExpoSources/dev/peach/expo/PeachExpoRuntime.kt +0 -516
- package/kotlin/ExpoSources/dev/peach/expo/PeachExpoTypes.kt +0 -173
- package/kotlin/ExpoSources/expo/modules/kotlin/AppContext.kt +0 -20
- package/kotlin/ExpoSources/expo/modules/kotlin/Promise.kt +0 -19
- package/kotlin/ExpoSources/expo/modules/kotlin/classcomponent/ClassComponentBuilder.kt +0 -198
- package/kotlin/ExpoSources/expo/modules/kotlin/exception/CodedException.kt +0 -126
- package/kotlin/ExpoSources/expo/modules/kotlin/functions/Functions.kt +0 -132
- package/kotlin/ExpoSources/expo/modules/kotlin/jni/JavaScriptTypedArray.kt +0 -81
- package/kotlin/ExpoSources/expo/modules/kotlin/modules/Module.kt +0 -98
- package/kotlin/ExpoSources/expo/modules/kotlin/objects/ObjectDefinitionBuilder.kt +0 -236
- package/kotlin/ExpoSources/expo/modules/kotlin/records/Record.kt +0 -12
- package/kotlin/ExpoSources/expo/modules/kotlin/runtime/Runtime.kt +0 -9
- package/kotlin/ExpoSources/expo/modules/kotlin/sharedobjects/SharedObject.kt +0 -50
- package/kotlin/ExpoSources/expo/modules/kotlin/sharedobjects/SharedObjectRegistry.kt +0 -57
- package/kotlin/ExpoSources/expo/modules/kotlin/sharedobjects/SharedRef.kt +0 -19
- package/kotlin/ExpoSources/expo/modules/kotlin/typedarray/ConcreteTypedArrays.kt +0 -158
- package/kotlin/ExpoSources/expo/modules/kotlin/typedarray/GenericTypedArray.kt +0 -8
- package/kotlin/ExpoSources/expo/modules/kotlin/typedarray/TypedArray.kt +0 -29
- package/kotlin/ExpoSources/expo/modules/kotlin/typedarray/TypedArrayIterator.kt +0 -9
- package/kotlin/ExpoSources/expo/modules/kotlin/types/AnyType.kt +0 -155
- package/kotlin/ExpoSources/expo/modules/kotlin/types/Either.kt +0 -91
- package/kotlin/ExpoSources/expo/modules/kotlin/types/Enumerable.kt +0 -6
- package/kotlin/ExpoSources/expo/modules/kotlin/viewevent/ViewEvent.kt +0 -68
- package/kotlin/ExpoSources/expo/modules/kotlin/views/ExpoView.kt +0 -20
- package/kotlin/ExpoSources/expo/modules/kotlin/views/ViewDefinitionBuilder.kt +0 -72
- package/kotlin/ExpoSources/expo/modules/kotlin/views/ViewProps.kt +0 -36
- package/kotlin/JniPlatformSources/androidx/annotation/CallSuper.kt +0 -5
- package/kotlin/JniPlatformSources/com/facebook/proguard/annotations/DoNotStrip.kt +0 -5
- package/kotlin/JniPlatformSources/dalvik/annotation/optimization/FastNative.kt +0 -5
- package/kotlin/JniPlatformSources/kotlin/Synchronized.kt +0 -6
- package/kotlin/JniPlatformSources/kotlin/jvm/JvmField.kt +0 -5
- package/kotlin/JniPlatformSources/kotlin/jvm/JvmStatic.kt +0 -5
- package/kotlin/JniSources/com/facebook/jni/HybridData.kt +0 -66
- package/kotlin/JniSources/dev/peach/jni/IncomingBindings.kt +0 -157
- package/kotlin/JniSources/dev/peach/jni/NativeBindings.kt +0 -77
- package/kotlin/JniTransportSources/dev/peach/jni/integration/JniTransport.kt +0 -89
- package/kotlin/Sources/android/os/Build.kt +0 -17
- package/kotlin/Sources/android/os/Handler.kt +0 -35
- package/kotlin/Sources/android/os/Looper.kt +0 -17
- package/kotlin/Sources/android/os/MessageQueue.kt +0 -56
- package/kotlin/Sources/android/os/SystemClock.kt +0 -14
- package/kotlin/Sources/android/util/Log.kt +0 -64
- package/kotlin/Sources/androidx/annotation/DrawableRes.kt +0 -14
- package/kotlin/Sources/androidx/annotation/Keep.kt +0 -4
- package/kotlin/Sources/dev/onejs/one/OneNativeSourceDispatch.kt +0 -7
- package/kotlin/Sources/dev/onejs/one/OneNativeSourceViewDispatch.kt +0 -13
- package/kotlin/Sources/dev/onejs/one/source/OneModule.kt +0 -4
- package/kotlin/Sources/java/lang/Runnable.kt +0 -6
- package/kotlin/Sources/java/security/MessageDigest.kt +0 -114
- package/kotlin/Sources/java/util/IllegalFormatCodePointException.kt +0 -10
- package/kotlin/Sources/java/util/IllegalFormatException.kt +0 -5
- package/kotlin/Sources/kotlin/text/StringFormat.kt +0 -9
- package/kotlin/Sources/org/json/JSON.kt +0 -307
- package/kotlin/tools/abi-classes.main.kts +0 -41
- package/kotlin/tools/expo-types.main.kts +0 -127
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1659 | (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;
|
|
@@ -45,7 +45,7 @@ module.exports = __toCommonJS(fetch_proxy_handler_exports);
|
|
|
45
45
|
var import_http = __toESM(require("http"), 1);
|
|
46
46
|
var import_https = __toESM(require("https"), 1);
|
|
47
47
|
var import_node_http2 = require("node:http2");
|
|
48
|
-
var
|
|
48
|
+
var import_promises3 = require("stream/promises");
|
|
49
49
|
|
|
50
50
|
// src/backend-origin.ts
|
|
51
51
|
function normalizeHostname(hostname) {
|
|
@@ -76,143 +76,17 @@ function loopbackOriginOf(value) {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
// src/bundleGlobalFooter.ts
|
|
80
|
-
var ROLLDOWN_INVENTORY_HEADER = "X-Peach-Rolldown-Inventory";
|
|
81
|
-
|
|
82
|
-
// src/cli-runtime.ts
|
|
83
|
-
var import_node_crypto = require("node:crypto");
|
|
84
|
-
var import_node_fs2 = require("node:fs");
|
|
85
|
-
var import_node_module = require("node:module");
|
|
86
|
-
var import_node_path2 = require("node:path");
|
|
87
|
-
|
|
88
|
-
// runtime-companion.json
|
|
89
|
-
var runtime_companion_default = { abi: 1, sha256: "a1b49c57129dd06888a9cdfbb05051be3626e8233980236705a3efd52b651623", file: "node/cli-a1b49c57129dd06888a9cdfbb05051be3626e8233980236705a3efd52b651623.cjs" };
|
|
90
|
-
|
|
91
|
-
// src/runtime-assets.ts
|
|
92
|
-
var import_fs = __toESM(require("fs"), 1);
|
|
93
|
-
var import_path = __toESM(require("path"), 1);
|
|
94
|
-
var import_url = require("url");
|
|
95
|
-
|
|
96
|
-
// src/home-paths.ts
|
|
97
|
-
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
98
|
-
var import_node_os = require("node:os");
|
|
99
|
-
var import_node_path = __toESM(require("node:path"), 1);
|
|
100
|
-
var PEACH_HOME_ENV = "PEACH_HOME";
|
|
101
|
-
var ACTIVE_RUNTIME_FILE = "active";
|
|
102
|
-
function rnxHomeDir() {
|
|
103
|
-
const override = process.env[PEACH_HOME_ENV];
|
|
104
|
-
if (override && override.length > 0) return import_node_path.default.resolve(override);
|
|
105
|
-
return import_node_path.default.join((0, import_node_os.homedir)(), ".peach");
|
|
106
|
-
}
|
|
107
|
-
function runtimesDir() {
|
|
108
|
-
return import_node_path.default.join(rnxHomeDir(), "runtimes");
|
|
109
|
-
}
|
|
110
|
-
function runtimeDir(version) {
|
|
111
|
-
return import_node_path.default.join(runtimesDir(), version);
|
|
112
|
-
}
|
|
113
|
-
function activeRuntimeFile() {
|
|
114
|
-
return import_node_path.default.join(runtimesDir(), ACTIVE_RUNTIME_FILE);
|
|
115
|
-
}
|
|
116
|
-
function readActiveRuntime() {
|
|
117
|
-
try {
|
|
118
|
-
const value = import_node_fs.default.readFileSync(activeRuntimeFile(), "utf8").trim();
|
|
119
|
-
return value.length > 0 ? value : null;
|
|
120
|
-
} catch {
|
|
121
|
-
return null;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
var DAEMON_LOCKFILE_MAX_BYTES = 16 * 1024;
|
|
125
|
-
|
|
126
|
-
// src/runtime-assets.ts
|
|
127
|
-
var _monorepoRootCache;
|
|
128
|
-
function findMonorepoRoot() {
|
|
129
|
-
if (_monorepoRootCache !== void 0) return _monorepoRootCache;
|
|
130
|
-
let dir = import_path.default.dirname((0, import_url.fileURLToPath)(__sootsim_import_meta_url));
|
|
131
|
-
for (let i = 0; i < 12 && dir !== import_path.default.dirname(dir); i++) {
|
|
132
|
-
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"))) {
|
|
133
|
-
_monorepoRootCache = dir;
|
|
134
|
-
return dir;
|
|
135
|
-
}
|
|
136
|
-
dir = import_path.default.dirname(dir);
|
|
137
|
-
}
|
|
138
|
-
_monorepoRootCache = null;
|
|
139
|
-
return null;
|
|
140
|
-
}
|
|
141
|
-
function resolveDevCheckoutRuntimeAssetRoot() {
|
|
142
|
-
if (process.env.PEACH_HOME && readActiveRuntime()) return null;
|
|
143
|
-
const root = findMonorepoRoot();
|
|
144
|
-
if (!root) return null;
|
|
145
|
-
return import_path.default.join(root, "public/sootsim");
|
|
146
|
-
}
|
|
147
|
-
function resolveDevCheckoutRuntimeRoot() {
|
|
148
|
-
const devBuild = resolveDevCheckoutRuntimeAssetRoot();
|
|
149
|
-
if (!devBuild) return null;
|
|
150
|
-
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"))) {
|
|
151
|
-
return devBuild;
|
|
152
|
-
}
|
|
153
|
-
return null;
|
|
154
|
-
}
|
|
155
|
-
function resolveActiveRuntimeRoot() {
|
|
156
|
-
const devRoot = resolveDevCheckoutRuntimeRoot();
|
|
157
|
-
if (devRoot) return devRoot;
|
|
158
|
-
const active = readActiveRuntime();
|
|
159
|
-
if (!active) return null;
|
|
160
|
-
const dir = runtimeDir(active);
|
|
161
|
-
if (!import_fs.default.existsSync(import_path.default.join(dir, "index.html"))) return null;
|
|
162
|
-
return dir;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// src/cli-runtime.ts
|
|
166
|
-
var CLI_COMPANION_ABI = 1;
|
|
167
|
-
function cliCompanionPath() {
|
|
168
|
-
return `node/cli-${runtime_companion_default.sha256}.cjs`;
|
|
169
|
-
}
|
|
170
|
-
function verifyCliCompanion(root) {
|
|
171
|
-
const file = (0, import_node_path2.join)(root, cliCompanionPath());
|
|
172
|
-
let bytes;
|
|
173
|
-
try {
|
|
174
|
-
bytes = (0, import_node_fs2.readFileSync)(file);
|
|
175
|
-
} catch (cause) {
|
|
176
|
-
throw new Error(
|
|
177
|
-
"Peach runtime is missing the companion required by this CLI; run `peach runtime install`",
|
|
178
|
-
{ cause }
|
|
179
|
-
);
|
|
180
|
-
}
|
|
181
|
-
const hash = (0, import_node_crypto.createHash)("sha256").update(bytes).digest("hex");
|
|
182
|
-
if (hash !== runtime_companion_default.sha256) {
|
|
183
|
-
throw new Error(
|
|
184
|
-
"Peach runtime companion does not match this CLI; run `peach runtime install`"
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
var loaded;
|
|
189
|
-
function getCliRuntime() {
|
|
190
|
-
if (loaded) return loaded.runtime;
|
|
191
|
-
const root = resolveDevCheckoutRuntimeAssetRoot() ?? resolveActiveRuntimeRoot();
|
|
192
|
-
if (!root) throw new Error("No Peach runtime installed; run `peach runtime install`");
|
|
193
|
-
verifyCliCompanion(root);
|
|
194
|
-
const require2 = (0, import_node_module.createRequire)(__sootsim_import_meta_url);
|
|
195
|
-
const runtime = require2((0, import_node_path2.join)(root, cliCompanionPath()));
|
|
196
|
-
if (runtime.cliCompanionAbi !== CLI_COMPANION_ABI) {
|
|
197
|
-
throw new Error(
|
|
198
|
-
"Incompatible Peach runtime companion ABI; run `peach runtime install`"
|
|
199
|
-
);
|
|
200
|
-
}
|
|
201
|
-
loaded = { root, runtime };
|
|
202
|
-
return runtime;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
79
|
// src/packageVersionsContract.ts
|
|
206
80
|
var PACKAGE_VERSIONS_HEADER = "X-Peach-Package-Versions";
|
|
207
81
|
|
|
208
82
|
// src/host/dev-server-package-versions.ts
|
|
209
|
-
var import_fs3 = __toESM(require("fs"), 1);
|
|
210
|
-
var import_path3 = __toESM(require("path"), 1);
|
|
211
|
-
|
|
212
|
-
// src/installed-package-versions.ts
|
|
213
83
|
var import_fs2 = __toESM(require("fs"), 1);
|
|
214
84
|
var import_path2 = __toESM(require("path"), 1);
|
|
215
85
|
|
|
86
|
+
// src/installed-package-versions.ts
|
|
87
|
+
var import_fs = __toESM(require("fs"), 1);
|
|
88
|
+
var import_path = __toESM(require("path"), 1);
|
|
89
|
+
|
|
216
90
|
// ../peach-compat/src/lazy-stub-patterns.ts
|
|
217
91
|
var LAZY_STUB_PATTERNS = [
|
|
218
92
|
"@10play/tentap-editor",
|
|
@@ -3099,13 +2973,13 @@ function isMissing(error) {
|
|
|
3099
2973
|
}
|
|
3100
2974
|
async function answerAsync(step) {
|
|
3101
2975
|
if (step.op === "exists")
|
|
3102
|
-
return
|
|
2976
|
+
return import_fs.default.promises.access(step.path).then(
|
|
3103
2977
|
() => true,
|
|
3104
2978
|
() => false
|
|
3105
2979
|
);
|
|
3106
|
-
if (step.op === "realpath") return
|
|
2980
|
+
if (step.op === "realpath") return import_fs.default.promises.realpath(step.path);
|
|
3107
2981
|
try {
|
|
3108
|
-
return parseManifest(await
|
|
2982
|
+
return parseManifest(await import_fs.default.promises.readFile(step.path, "utf8"));
|
|
3109
2983
|
} catch (error) {
|
|
3110
2984
|
if (isMissing(error)) return null;
|
|
3111
2985
|
throw error;
|
|
@@ -3122,25 +2996,25 @@ function createInstalledPackageReader() {
|
|
|
3122
2996
|
const manifests = /* @__PURE__ */ new Map();
|
|
3123
2997
|
return function* readInstalledPackage(fromDir, name) {
|
|
3124
2998
|
for (let dir = fromDir; ; ) {
|
|
3125
|
-
if (
|
|
3126
|
-
const modules =
|
|
2999
|
+
if (import_path.default.basename(dir) !== "node_modules") {
|
|
3000
|
+
const modules = import_path.default.join(dir, "node_modules");
|
|
3127
3001
|
let present = hasModules.get(dir);
|
|
3128
3002
|
if (present === void 0) {
|
|
3129
3003
|
present = yield* exists(modules);
|
|
3130
3004
|
hasModules.set(dir, present);
|
|
3131
3005
|
}
|
|
3132
3006
|
if (present) {
|
|
3133
|
-
const root =
|
|
3007
|
+
const root = import_path.default.join(modules, name);
|
|
3134
3008
|
let installed = manifests.get(root);
|
|
3135
3009
|
if (installed === void 0) {
|
|
3136
|
-
const manifest = yield* readManifest(
|
|
3010
|
+
const manifest = yield* readManifest(import_path.default.join(root, "package.json"));
|
|
3137
3011
|
installed = manifest ? { root, manifest } : null;
|
|
3138
3012
|
manifests.set(root, installed);
|
|
3139
3013
|
}
|
|
3140
3014
|
if (installed) return installed;
|
|
3141
3015
|
}
|
|
3142
3016
|
}
|
|
3143
|
-
const parent =
|
|
3017
|
+
const parent = import_path.default.dirname(dir);
|
|
3144
3018
|
if (parent === dir) return null;
|
|
3145
3019
|
dir = parent;
|
|
3146
3020
|
}
|
|
@@ -3168,7 +3042,7 @@ function* nativePackageVersionsWalk(projectRoot) {
|
|
|
3168
3042
|
const name = extractPackageFromPath(`node_modules/${specifier}`);
|
|
3169
3043
|
if (name) nativeNames.add(name);
|
|
3170
3044
|
}
|
|
3171
|
-
const manifest = yield* readManifest(
|
|
3045
|
+
const manifest = yield* readManifest(import_path.default.join(appRoot, "package.json"));
|
|
3172
3046
|
if (!manifest) throw new Error("app package.json must contain an object");
|
|
3173
3047
|
const readInstalledPackage = createInstalledPackageReader();
|
|
3174
3048
|
const pending = [{ root: appRoot, manifest }];
|
|
@@ -3199,16 +3073,58 @@ function* nativePackageVersionsWalk(projectRoot) {
|
|
|
3199
3073
|
}
|
|
3200
3074
|
return yield* installedVersionsWalk(projectRoot, needed);
|
|
3201
3075
|
}
|
|
3202
|
-
|
|
3203
|
-
|
|
3076
|
+
var INSTALL_RECORD_FILES = [
|
|
3077
|
+
"package.json",
|
|
3078
|
+
"bun.lock",
|
|
3079
|
+
"bun.lockb",
|
|
3080
|
+
"package-lock.json",
|
|
3081
|
+
"yarn.lock",
|
|
3082
|
+
"pnpm-lock.yaml",
|
|
3083
|
+
"node_modules",
|
|
3084
|
+
"node_modules/.package-lock.json",
|
|
3085
|
+
"node_modules/.yarn-integrity",
|
|
3086
|
+
"node_modules/.modules.yaml"
|
|
3087
|
+
];
|
|
3088
|
+
async function installFingerprint(projectRoot) {
|
|
3089
|
+
const appRoot = await import_fs.default.promises.realpath(projectRoot);
|
|
3090
|
+
const targets = [];
|
|
3091
|
+
for (let dir = appRoot; ; ) {
|
|
3092
|
+
if (import_path.default.basename(dir) !== "node_modules")
|
|
3093
|
+
for (const file of INSTALL_RECORD_FILES) targets.push(import_path.default.join(dir, file));
|
|
3094
|
+
const parent = import_path.default.dirname(dir);
|
|
3095
|
+
if (parent === dir) break;
|
|
3096
|
+
dir = parent;
|
|
3097
|
+
}
|
|
3098
|
+
const stats = await Promise.all(
|
|
3099
|
+
targets.map(
|
|
3100
|
+
(target) => import_fs.default.promises.stat(target).then(
|
|
3101
|
+
(stat) => `${stat.ino}:${stat.size}:${stat.mtimeMs}`,
|
|
3102
|
+
() => ""
|
|
3103
|
+
)
|
|
3104
|
+
)
|
|
3105
|
+
);
|
|
3106
|
+
return `${appRoot}
|
|
3107
|
+
${stats.join("\n")}`;
|
|
3108
|
+
}
|
|
3109
|
+
var scans = /* @__PURE__ */ new Map();
|
|
3110
|
+
async function readInstalledNativePackageVersionsAsync(projectRoot) {
|
|
3111
|
+
const fingerprint = await installFingerprint(projectRoot);
|
|
3112
|
+
const cached = scans.get(projectRoot);
|
|
3113
|
+
if (cached?.fingerprint === fingerprint) return cached.versions;
|
|
3114
|
+
const versions = runAsync(nativePackageVersionsWalk(projectRoot));
|
|
3115
|
+
scans.set(projectRoot, { fingerprint, versions });
|
|
3116
|
+
versions.catch(() => {
|
|
3117
|
+
if (scans.get(projectRoot)?.versions === versions) scans.delete(projectRoot);
|
|
3118
|
+
});
|
|
3119
|
+
return versions;
|
|
3204
3120
|
}
|
|
3205
3121
|
|
|
3206
3122
|
// scripts/dev-server-scanner.ts
|
|
3207
3123
|
var import_child_process = require("child_process");
|
|
3208
3124
|
var import_promises = require("fs/promises");
|
|
3209
|
-
var
|
|
3210
|
-
var
|
|
3211
|
-
var
|
|
3125
|
+
var import_node_fs = require("node:fs");
|
|
3126
|
+
var import_node_os = require("node:os");
|
|
3127
|
+
var import_node_path = require("node:path");
|
|
3212
3128
|
|
|
3213
3129
|
// src/expo-manifest-body.ts
|
|
3214
3130
|
function parseExpoManifestBody(body) {
|
|
@@ -3229,8 +3145,8 @@ var MANIFEST_PROBE_TIMEOUT_MS = 3e4;
|
|
|
3229
3145
|
var import_plist = __toESM(require("plist"), 1);
|
|
3230
3146
|
|
|
3231
3147
|
// scripts/dev-server-scanner.ts
|
|
3232
|
-
var LISTENER_LOCK_PATH = (0,
|
|
3233
|
-
var LISTENER_RESULT_PATH = (0,
|
|
3148
|
+
var LISTENER_LOCK_PATH = (0, import_node_path.join)((0, import_node_os.tmpdir)(), "peach-listener-scan.lock");
|
|
3149
|
+
var LISTENER_RESULT_PATH = (0, import_node_path.join)((0, import_node_os.tmpdir)(), "peach-listener-scan.result");
|
|
3234
3150
|
var LISTENER_LOCK_STALE_MS = 25e3;
|
|
3235
3151
|
var LISTENER_LOCK_WAIT_MS = 8e3;
|
|
3236
3152
|
function sleep(ms) {
|
|
@@ -3248,8 +3164,8 @@ function pidIsAlive(pid) {
|
|
|
3248
3164
|
}
|
|
3249
3165
|
function readLockOwner() {
|
|
3250
3166
|
try {
|
|
3251
|
-
const raw = (0,
|
|
3252
|
-
const mtimeMs = (0,
|
|
3167
|
+
const raw = (0, import_node_fs.readFileSync)(LISTENER_LOCK_PATH, "utf8");
|
|
3168
|
+
const mtimeMs = (0, import_node_fs.statSync)(LISTENER_LOCK_PATH).mtimeMs;
|
|
3253
3169
|
const pid = Number(raw.split("-")[0]);
|
|
3254
3170
|
return { raw, pid: Number.isInteger(pid) ? pid : -1, mtimeMs };
|
|
3255
3171
|
} catch {
|
|
@@ -3262,15 +3178,15 @@ function lockIsAbandoned(owner) {
|
|
|
3262
3178
|
}
|
|
3263
3179
|
function clearLock(raw) {
|
|
3264
3180
|
try {
|
|
3265
|
-
if ((0,
|
|
3266
|
-
(0,
|
|
3181
|
+
if ((0, import_node_fs.readFileSync)(LISTENER_LOCK_PATH, "utf8") !== raw) return;
|
|
3182
|
+
(0, import_node_fs.unlinkSync)(LISTENER_LOCK_PATH);
|
|
3267
3183
|
} catch {
|
|
3268
3184
|
}
|
|
3269
3185
|
}
|
|
3270
3186
|
function readResult() {
|
|
3271
3187
|
try {
|
|
3272
3188
|
const parsed = JSON.parse(
|
|
3273
|
-
(0,
|
|
3189
|
+
(0, import_node_fs.readFileSync)(LISTENER_RESULT_PATH, "utf8")
|
|
3274
3190
|
);
|
|
3275
3191
|
if (!parsed || typeof parsed.token !== "string" || typeof parsed.key !== "string")
|
|
3276
3192
|
return null;
|
|
@@ -3281,8 +3197,8 @@ function readResult() {
|
|
|
3281
3197
|
}
|
|
3282
3198
|
function publishResult(payload) {
|
|
3283
3199
|
const tmp = `${LISTENER_RESULT_PATH}.${process.pid}.tmp`;
|
|
3284
|
-
(0,
|
|
3285
|
-
(0,
|
|
3200
|
+
(0, import_node_fs.writeFileSync)(tmp, JSON.stringify(payload));
|
|
3201
|
+
(0, import_node_fs.renameSync)(tmp, LISTENER_RESULT_PATH);
|
|
3286
3202
|
}
|
|
3287
3203
|
function throwPublished(payload) {
|
|
3288
3204
|
throw Object.assign(new Error(payload.message || "listener scan failed"), {
|
|
@@ -3325,7 +3241,7 @@ async function withListenerLock(key, body) {
|
|
|
3325
3241
|
for (; ; ) {
|
|
3326
3242
|
let fd = null;
|
|
3327
3243
|
try {
|
|
3328
|
-
fd = (0,
|
|
3244
|
+
fd = (0, import_node_fs.openSync)(LISTENER_LOCK_PATH, "wx");
|
|
3329
3245
|
} catch (error) {
|
|
3330
3246
|
const code = error instanceof Error && "code" in error ? error.code : "";
|
|
3331
3247
|
if (code !== "EEXIST") throw error;
|
|
@@ -3334,7 +3250,7 @@ async function withListenerLock(key, body) {
|
|
|
3334
3250
|
if (owner) clearLock(owner.raw);
|
|
3335
3251
|
else {
|
|
3336
3252
|
try {
|
|
3337
|
-
(0,
|
|
3253
|
+
(0, import_node_fs.unlinkSync)(LISTENER_LOCK_PATH);
|
|
3338
3254
|
} catch {
|
|
3339
3255
|
}
|
|
3340
3256
|
}
|
|
@@ -3350,7 +3266,7 @@ async function withListenerLock(key, body) {
|
|
|
3350
3266
|
}
|
|
3351
3267
|
if (fd === null) continue;
|
|
3352
3268
|
try {
|
|
3353
|
-
(0,
|
|
3269
|
+
(0, import_node_fs.writeSync)(fd, token);
|
|
3354
3270
|
try {
|
|
3355
3271
|
const value = await body();
|
|
3356
3272
|
publishResult({ token, key, ok: true, value });
|
|
@@ -3367,7 +3283,7 @@ async function withListenerLock(key, body) {
|
|
|
3367
3283
|
}
|
|
3368
3284
|
} finally {
|
|
3369
3285
|
try {
|
|
3370
|
-
(0,
|
|
3286
|
+
(0, import_node_fs.closeSync)(fd);
|
|
3371
3287
|
} catch {
|
|
3372
3288
|
}
|
|
3373
3289
|
clearLock(token);
|
|
@@ -3715,7 +3631,7 @@ async function readDevServerPackageVersions(bundleUrl) {
|
|
|
3715
3631
|
const projectRoot = await resolveMetroProjectRoot(bundleUrl.href);
|
|
3716
3632
|
if (!projectRoot) return null;
|
|
3717
3633
|
try {
|
|
3718
|
-
await
|
|
3634
|
+
await import_fs2.default.promises.access(import_path2.default.join(projectRoot, "package.json"));
|
|
3719
3635
|
} catch {
|
|
3720
3636
|
return null;
|
|
3721
3637
|
}
|
|
@@ -3855,6 +3771,180 @@ function projectLoopbackPort(hostname, port) {
|
|
|
3855
3771
|
return isLoopbackHost(hostname) ? LOOPBACK_PORTS.get(port) ?? port : port;
|
|
3856
3772
|
}
|
|
3857
3773
|
|
|
3774
|
+
// src/host/rolldown-bundle-forward.ts
|
|
3775
|
+
var import_stream = require("stream");
|
|
3776
|
+
var import_promises2 = require("stream/promises");
|
|
3777
|
+
|
|
3778
|
+
// src/cli-runtime.ts
|
|
3779
|
+
var import_node_crypto = require("node:crypto");
|
|
3780
|
+
var import_node_fs3 = require("node:fs");
|
|
3781
|
+
var import_node_module = require("node:module");
|
|
3782
|
+
var import_node_path3 = require("node:path");
|
|
3783
|
+
|
|
3784
|
+
// runtime-companion.json
|
|
3785
|
+
var runtime_companion_default = { abi: 1, sha256: "59277122bc52023de2774e83d48eb795f32324c06d15d9780c8d827791bea7c6", file: "node/cli-59277122bc52023de2774e83d48eb795f32324c06d15d9780c8d827791bea7c6.cjs" };
|
|
3786
|
+
|
|
3787
|
+
// src/runtime-assets.ts
|
|
3788
|
+
var import_fs3 = __toESM(require("fs"), 1);
|
|
3789
|
+
var import_path3 = __toESM(require("path"), 1);
|
|
3790
|
+
var import_url = require("url");
|
|
3791
|
+
|
|
3792
|
+
// src/home-paths.ts
|
|
3793
|
+
var import_node_fs2 = __toESM(require("node:fs"), 1);
|
|
3794
|
+
var import_node_os2 = require("node:os");
|
|
3795
|
+
var import_node_path2 = __toESM(require("node:path"), 1);
|
|
3796
|
+
var PEACH_HOME_ENV = "PEACH_HOME";
|
|
3797
|
+
var ACTIVE_RUNTIME_FILE = "active";
|
|
3798
|
+
function rnxHomeDir() {
|
|
3799
|
+
const override = process.env[PEACH_HOME_ENV];
|
|
3800
|
+
if (override && override.length > 0) return import_node_path2.default.resolve(override);
|
|
3801
|
+
return import_node_path2.default.join((0, import_node_os2.homedir)(), ".peach");
|
|
3802
|
+
}
|
|
3803
|
+
function runtimesDir() {
|
|
3804
|
+
return import_node_path2.default.join(rnxHomeDir(), "runtimes");
|
|
3805
|
+
}
|
|
3806
|
+
function runtimeDir(version) {
|
|
3807
|
+
return import_node_path2.default.join(runtimesDir(), version);
|
|
3808
|
+
}
|
|
3809
|
+
function activeRuntimeFile() {
|
|
3810
|
+
return import_node_path2.default.join(runtimesDir(), ACTIVE_RUNTIME_FILE);
|
|
3811
|
+
}
|
|
3812
|
+
function readActiveRuntime() {
|
|
3813
|
+
try {
|
|
3814
|
+
const value = import_node_fs2.default.readFileSync(activeRuntimeFile(), "utf8").trim();
|
|
3815
|
+
return value.length > 0 ? value : null;
|
|
3816
|
+
} catch {
|
|
3817
|
+
return null;
|
|
3818
|
+
}
|
|
3819
|
+
}
|
|
3820
|
+
var DAEMON_LOCKFILE_MAX_BYTES = 16 * 1024;
|
|
3821
|
+
|
|
3822
|
+
// src/runtime-assets.ts
|
|
3823
|
+
var _monorepoRootCache;
|
|
3824
|
+
function findMonorepoRoot() {
|
|
3825
|
+
if (_monorepoRootCache !== void 0) return _monorepoRootCache;
|
|
3826
|
+
let dir = import_path3.default.dirname((0, import_url.fileURLToPath)(__sootsim_import_meta_url));
|
|
3827
|
+
for (let i = 0; i < 12 && dir !== import_path3.default.dirname(dir); i++) {
|
|
3828
|
+
if (import_fs3.default.existsSync(import_path3.default.join(dir, "packages/peach-engine/package.json")) && import_fs3.default.existsSync(import_path3.default.join(dir, "public/sootsim"))) {
|
|
3829
|
+
_monorepoRootCache = dir;
|
|
3830
|
+
return dir;
|
|
3831
|
+
}
|
|
3832
|
+
dir = import_path3.default.dirname(dir);
|
|
3833
|
+
}
|
|
3834
|
+
_monorepoRootCache = null;
|
|
3835
|
+
return null;
|
|
3836
|
+
}
|
|
3837
|
+
function resolveDevCheckoutRuntimeAssetRoot() {
|
|
3838
|
+
if (process.env.PEACH_HOME && readActiveRuntime()) return null;
|
|
3839
|
+
const root = findMonorepoRoot();
|
|
3840
|
+
if (!root) return null;
|
|
3841
|
+
return import_path3.default.join(root, "public/sootsim");
|
|
3842
|
+
}
|
|
3843
|
+
function resolveDevCheckoutRuntimeRoot() {
|
|
3844
|
+
const devBuild = resolveDevCheckoutRuntimeAssetRoot();
|
|
3845
|
+
if (!devBuild) return null;
|
|
3846
|
+
if (import_fs3.default.existsSync(import_path3.default.join(devBuild, "index.html")) && import_fs3.default.existsSync(import_path3.default.join(devBuild, "engine/index.html")) && import_fs3.default.existsSync(import_path3.default.join(devBuild, "engine-tenant/worker.js")) && import_fs3.default.existsSync(import_path3.default.join(devBuild, "engine-tenant/worker.prod.js"))) {
|
|
3847
|
+
return devBuild;
|
|
3848
|
+
}
|
|
3849
|
+
return null;
|
|
3850
|
+
}
|
|
3851
|
+
function resolveActiveRuntimeRoot() {
|
|
3852
|
+
const devRoot = resolveDevCheckoutRuntimeRoot();
|
|
3853
|
+
if (devRoot) return devRoot;
|
|
3854
|
+
const active = readActiveRuntime();
|
|
3855
|
+
if (!active) return null;
|
|
3856
|
+
const dir = runtimeDir(active);
|
|
3857
|
+
if (!import_fs3.default.existsSync(import_path3.default.join(dir, "index.html"))) return null;
|
|
3858
|
+
return dir;
|
|
3859
|
+
}
|
|
3860
|
+
|
|
3861
|
+
// src/cli-runtime.ts
|
|
3862
|
+
var CLI_COMPANION_ABI = 1;
|
|
3863
|
+
function cliCompanionPath() {
|
|
3864
|
+
return `node/cli-${runtime_companion_default.sha256}.cjs`;
|
|
3865
|
+
}
|
|
3866
|
+
function verifyCliCompanion(root) {
|
|
3867
|
+
const file = (0, import_node_path3.join)(root, cliCompanionPath());
|
|
3868
|
+
let bytes;
|
|
3869
|
+
try {
|
|
3870
|
+
bytes = (0, import_node_fs3.readFileSync)(file);
|
|
3871
|
+
} catch (cause) {
|
|
3872
|
+
throw new Error(
|
|
3873
|
+
"Peach runtime is missing the companion required by this CLI; run `peach runtime install`",
|
|
3874
|
+
{ cause }
|
|
3875
|
+
);
|
|
3876
|
+
}
|
|
3877
|
+
const hash = (0, import_node_crypto.createHash)("sha256").update(bytes).digest("hex");
|
|
3878
|
+
if (hash !== runtime_companion_default.sha256) {
|
|
3879
|
+
throw new Error(
|
|
3880
|
+
"Peach runtime companion does not match this CLI; run `peach runtime install`"
|
|
3881
|
+
);
|
|
3882
|
+
}
|
|
3883
|
+
}
|
|
3884
|
+
var loaded;
|
|
3885
|
+
function getCliRuntime() {
|
|
3886
|
+
if (loaded) return loaded.runtime;
|
|
3887
|
+
const root = resolveDevCheckoutRuntimeAssetRoot() ?? resolveActiveRuntimeRoot();
|
|
3888
|
+
if (!root) throw new Error("No Peach runtime installed; run `peach runtime install`");
|
|
3889
|
+
verifyCliCompanion(root);
|
|
3890
|
+
const require2 = (0, import_node_module.createRequire)(__sootsim_import_meta_url);
|
|
3891
|
+
const runtime = require2((0, import_node_path3.join)(root, cliCompanionPath()));
|
|
3892
|
+
if (runtime.cliCompanionAbi !== CLI_COMPANION_ABI) {
|
|
3893
|
+
throw new Error(
|
|
3894
|
+
"Incompatible Peach runtime companion ABI; run `peach runtime install`"
|
|
3895
|
+
);
|
|
3896
|
+
}
|
|
3897
|
+
loaded = { root, runtime };
|
|
3898
|
+
return runtime;
|
|
3899
|
+
}
|
|
3900
|
+
|
|
3901
|
+
// src/host/rolldown-bundle-forward.ts
|
|
3902
|
+
var ROLLDOWN_INVENTORY_HEADER = "x-peach-rolldown-inventory";
|
|
3903
|
+
async function forwardRolldownBundleResponse(upstream, res) {
|
|
3904
|
+
res.setHeader(ROLLDOWN_INVENTORY_HEADER, "1");
|
|
3905
|
+
if (upstream.headers[ROLLDOWN_INVENTORY_HEADER] === "1") {
|
|
3906
|
+
await (0, import_promises2.pipeline)(upstream, res);
|
|
3907
|
+
return;
|
|
3908
|
+
}
|
|
3909
|
+
const contentType = typeof upstream.headers["content-type"] === "string" ? upstream.headers["content-type"] : "";
|
|
3910
|
+
const inventory = getCliRuntime().rolldown_bundle_inventory;
|
|
3911
|
+
res.removeHeader("content-length");
|
|
3912
|
+
const annotate = async function* () {
|
|
3913
|
+
const decoder = new TextDecoder();
|
|
3914
|
+
let payload = "";
|
|
3915
|
+
let sent = 0;
|
|
3916
|
+
let bundleStarted = false;
|
|
3917
|
+
for await (const chunk of upstream) {
|
|
3918
|
+
payload += decoder.decode(chunk, { stream: true });
|
|
3919
|
+
if (bundleStarted) continue;
|
|
3920
|
+
const releasable = inventory.releasableMultipartPrefix(payload, contentType);
|
|
3921
|
+
bundleStarted = releasable.bundleStarted;
|
|
3922
|
+
if (releasable.length > sent) {
|
|
3923
|
+
yield Buffer.from(payload.slice(sent, releasable.length), "utf8");
|
|
3924
|
+
sent = releasable.length;
|
|
3925
|
+
}
|
|
3926
|
+
}
|
|
3927
|
+
payload += decoder.decode();
|
|
3928
|
+
let annotated;
|
|
3929
|
+
try {
|
|
3930
|
+
annotated = await inventory.attachRolldownBundleHttpPayload(payload, contentType);
|
|
3931
|
+
} catch (error) {
|
|
3932
|
+
const message = `could not attach the rolldown bundle inventory: ${error instanceof Error ? error.message : String(error)}`;
|
|
3933
|
+
console.error(`[peach] ${message}`);
|
|
3934
|
+
if (contentType.toLowerCase().includes("multipart/mixed")) {
|
|
3935
|
+
yield Buffer.from(inventory.multipartFailurePart(contentType, message), "utf8");
|
|
3936
|
+
return;
|
|
3937
|
+
}
|
|
3938
|
+
res.statusCode = 500;
|
|
3939
|
+
res.setHeader("content-type", "application/json");
|
|
3940
|
+
yield Buffer.from(JSON.stringify({ message }), "utf8");
|
|
3941
|
+
return;
|
|
3942
|
+
}
|
|
3943
|
+
yield Buffer.from(annotated.slice(sent), "utf8");
|
|
3944
|
+
};
|
|
3945
|
+
await (0, import_promises2.pipeline)(import_stream.Readable.from(annotate(), { objectMode: false }), res);
|
|
3946
|
+
}
|
|
3947
|
+
|
|
3858
3948
|
// src/host/fetch-proxy-handler.ts
|
|
3859
3949
|
var fetchProxyHttpAgent = new import_http.default.Agent({ keepAlive: true, maxSockets: 256 });
|
|
3860
3950
|
var fetchProxyHttpsAgent = new import_https.default.Agent({ keepAlive: true, maxSockets: 256 });
|
|
@@ -3968,6 +4058,9 @@ async function handleFetchProxyRequest(req, res) {
|
|
|
3968
4058
|
res.end("invalid url param");
|
|
3969
4059
|
return;
|
|
3970
4060
|
}
|
|
4061
|
+
const packageVersionsRead = isBundleProxyRequestUrl(req.url) && req.method === "GET" ? readDevServerPackageVersions(upstreamUrl) : null;
|
|
4062
|
+
packageVersionsRead?.catch(() => {
|
|
4063
|
+
});
|
|
3971
4064
|
await proxyUpstream(req, res, upstreamUrl, params.has(FETCH_PROXY_FAILURE_PARAM), {
|
|
3972
4065
|
requestHeaders: (target) => buildFetchProxyHeaders(req.headers, target),
|
|
3973
4066
|
respond: async (upstream, setCookies) => {
|
|
@@ -3978,15 +4071,11 @@ async function handleFetchProxyRequest(req, res) {
|
|
|
3978
4071
|
}
|
|
3979
4072
|
res.setHeader(key, value);
|
|
3980
4073
|
}
|
|
3981
|
-
if (
|
|
3982
|
-
const packageVersions = await
|
|
4074
|
+
if (packageVersionsRead && upstream.statusCode === 200 && !res.hasHeader(PACKAGE_VERSIONS_HEADER)) {
|
|
4075
|
+
const packageVersions = await packageVersionsRead;
|
|
3983
4076
|
if (packageVersions)
|
|
3984
4077
|
res.setHeader(PACKAGE_VERSIONS_HEADER, JSON.stringify(packageVersions));
|
|
3985
4078
|
}
|
|
3986
|
-
if (isBundleProxyRequestUrl(req.url) && req.method === "GET" && upstream.statusCode === 200 && upstreamUrl.pathname.endsWith(".bundle") && upstream.headers["x-peach-rolldown-inventory"] !== "1") {
|
|
3987
|
-
res.setHeader(ROLLDOWN_INVENTORY_HEADER, "1");
|
|
3988
|
-
res.removeHeader("content-length");
|
|
3989
|
-
}
|
|
3990
4079
|
applyFetchProxyCors(req, res);
|
|
3991
4080
|
if (setCookies.length > 0)
|
|
3992
4081
|
res.setHeader("x-sootsim-set-cookie", setCookies.join(", "));
|
|
@@ -4126,7 +4215,7 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
4126
4215
|
await route.respond(proxyRes, hopCookies);
|
|
4127
4216
|
if (isNativeCookieRedirect(hop)) res.removeHeader("location");
|
|
4128
4217
|
res.statusCode = isNativeCookieRedirect(hop) ? 200 : status;
|
|
4129
|
-
await (0,
|
|
4218
|
+
await (0, import_promises3.pipeline)(proxyRes, res);
|
|
4130
4219
|
return;
|
|
4131
4220
|
}
|
|
4132
4221
|
if (location && (status === 301 || status === 302 || status === 303 || status === 307 || status === 308)) {
|
|
@@ -4137,7 +4226,7 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
4137
4226
|
const switchToGet = (status === 301 || status === 302) && method === "POST" || status === 303 && method !== "GET" && method !== "HEAD";
|
|
4138
4227
|
const redirectUrl = resolveRedirectUrl(location, targetUrl);
|
|
4139
4228
|
proxyRes.resume();
|
|
4140
|
-
await (0,
|
|
4229
|
+
await (0, import_promises3.finished)(proxyRes);
|
|
4141
4230
|
await proxy(
|
|
4142
4231
|
redirectUrl,
|
|
4143
4232
|
switchToGet ? "GET" : method,
|
|
@@ -4150,22 +4239,11 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
4150
4239
|
if (redirects > 0) res.setHeader(FETCH_PROXY_RESPONSE_URL_HEADER, targetUrl.href);
|
|
4151
4240
|
await route.respond(proxyRes, hopCookies);
|
|
4152
4241
|
res.statusCode = status;
|
|
4153
|
-
if (isBundleProxyRequestUrl(req.url) && method === "GET" && status === 200 && targetUrl.pathname.endsWith(".bundle")
|
|
4154
|
-
|
|
4155
|
-
for await (const chunk of proxyRes) {
|
|
4156
|
-
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
4157
|
-
}
|
|
4158
|
-
const payload = Buffer.concat(chunks).toString("utf8");
|
|
4159
|
-
const contentType = typeof proxyRes.headers["content-type"] === "string" ? proxyRes.headers["content-type"] : void 0;
|
|
4160
|
-
const annotated = await getCliRuntime().rolldown_bundle_inventory.attachRolldownBundleHttpPayload(
|
|
4161
|
-
payload,
|
|
4162
|
-
contentType
|
|
4163
|
-
);
|
|
4164
|
-
res.removeHeader("content-length");
|
|
4165
|
-
res.end(Buffer.from(annotated, "utf8"));
|
|
4242
|
+
if (isBundleProxyRequestUrl(req.url) && method === "GET" && status === 200 && targetUrl.pathname.endsWith(".bundle")) {
|
|
4243
|
+
await forwardRolldownBundleResponse(proxyRes, res);
|
|
4166
4244
|
return;
|
|
4167
4245
|
}
|
|
4168
|
-
await (0,
|
|
4246
|
+
await (0, import_promises3.pipeline)(proxyRes, res);
|
|
4169
4247
|
};
|
|
4170
4248
|
let body;
|
|
4171
4249
|
try {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1659 | (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 __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1659 | (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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1659 | (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 __defProp = Object.defineProperty;
|