peachsim 0.1.1655 → 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 +11251 -1123
- 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 +8960 -134
- 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 +9769 -731
- package/dist-lib/host/fetch-proxy-handler.cjs +260 -197
- 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 +10651 -1418
- package/dist-lib/swift-compile.cjs +8802 -138
- package/dist-lib/swift-compile.mjs +8802 -138
- 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 +8960 -134
- 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 +1 -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 -50
- 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 +12 -3
- 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/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,8 +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
|
|
49
|
-
var import_promises2 = require("stream/promises");
|
|
48
|
+
var import_promises3 = require("stream/promises");
|
|
50
49
|
|
|
51
50
|
// src/backend-origin.ts
|
|
52
51
|
function normalizeHostname(hostname) {
|
|
@@ -77,143 +76,17 @@ function loopbackOriginOf(value) {
|
|
|
77
76
|
}
|
|
78
77
|
}
|
|
79
78
|
|
|
80
|
-
// src/bundleGlobalFooter.ts
|
|
81
|
-
var ROLLDOWN_INVENTORY_HEADER = "X-Peach-Rolldown-Inventory";
|
|
82
|
-
|
|
83
|
-
// src/cli-runtime.ts
|
|
84
|
-
var import_node_crypto = require("node:crypto");
|
|
85
|
-
var import_node_fs2 = require("node:fs");
|
|
86
|
-
var import_node_module = require("node:module");
|
|
87
|
-
var import_node_path2 = require("node:path");
|
|
88
|
-
|
|
89
|
-
// runtime-companion.json
|
|
90
|
-
var runtime_companion_default = { abi: 1, sha256: "6f6a55398d832d1703346a258bf9f81bf78fded8cf5d83cdf51e5e15ccd7a1ce", file: "node/cli-6f6a55398d832d1703346a258bf9f81bf78fded8cf5d83cdf51e5e15ccd7a1ce.cjs" };
|
|
91
|
-
|
|
92
|
-
// src/runtime-assets.ts
|
|
93
|
-
var import_fs = __toESM(require("fs"), 1);
|
|
94
|
-
var import_path = __toESM(require("path"), 1);
|
|
95
|
-
var import_url = require("url");
|
|
96
|
-
|
|
97
|
-
// src/home-paths.ts
|
|
98
|
-
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
99
|
-
var import_node_os = require("node:os");
|
|
100
|
-
var import_node_path = __toESM(require("node:path"), 1);
|
|
101
|
-
var PEACH_HOME_ENV = "PEACH_HOME";
|
|
102
|
-
var ACTIVE_RUNTIME_FILE = "active";
|
|
103
|
-
function rnxHomeDir() {
|
|
104
|
-
const override = process.env[PEACH_HOME_ENV];
|
|
105
|
-
if (override && override.length > 0) return import_node_path.default.resolve(override);
|
|
106
|
-
return import_node_path.default.join((0, import_node_os.homedir)(), ".peach");
|
|
107
|
-
}
|
|
108
|
-
function runtimesDir() {
|
|
109
|
-
return import_node_path.default.join(rnxHomeDir(), "runtimes");
|
|
110
|
-
}
|
|
111
|
-
function runtimeDir(version) {
|
|
112
|
-
return import_node_path.default.join(runtimesDir(), version);
|
|
113
|
-
}
|
|
114
|
-
function activeRuntimeFile() {
|
|
115
|
-
return import_node_path.default.join(runtimesDir(), ACTIVE_RUNTIME_FILE);
|
|
116
|
-
}
|
|
117
|
-
function readActiveRuntime() {
|
|
118
|
-
try {
|
|
119
|
-
const value = import_node_fs.default.readFileSync(activeRuntimeFile(), "utf8").trim();
|
|
120
|
-
return value.length > 0 ? value : null;
|
|
121
|
-
} catch {
|
|
122
|
-
return null;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
var DAEMON_LOCKFILE_MAX_BYTES = 16 * 1024;
|
|
126
|
-
|
|
127
|
-
// src/runtime-assets.ts
|
|
128
|
-
var _monorepoRootCache;
|
|
129
|
-
function findMonorepoRoot() {
|
|
130
|
-
if (_monorepoRootCache !== void 0) return _monorepoRootCache;
|
|
131
|
-
let dir = import_path.default.dirname((0, import_url.fileURLToPath)(__sootsim_import_meta_url));
|
|
132
|
-
for (let i = 0; i < 12 && dir !== import_path.default.dirname(dir); i++) {
|
|
133
|
-
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"))) {
|
|
134
|
-
_monorepoRootCache = dir;
|
|
135
|
-
return dir;
|
|
136
|
-
}
|
|
137
|
-
dir = import_path.default.dirname(dir);
|
|
138
|
-
}
|
|
139
|
-
_monorepoRootCache = null;
|
|
140
|
-
return null;
|
|
141
|
-
}
|
|
142
|
-
function resolveDevCheckoutRuntimeAssetRoot() {
|
|
143
|
-
if (process.env.PEACH_HOME && readActiveRuntime()) return null;
|
|
144
|
-
const root = findMonorepoRoot();
|
|
145
|
-
if (!root) return null;
|
|
146
|
-
return import_path.default.join(root, "public/sootsim");
|
|
147
|
-
}
|
|
148
|
-
function resolveDevCheckoutRuntimeRoot() {
|
|
149
|
-
const devBuild = resolveDevCheckoutRuntimeAssetRoot();
|
|
150
|
-
if (!devBuild) return null;
|
|
151
|
-
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"))) {
|
|
152
|
-
return devBuild;
|
|
153
|
-
}
|
|
154
|
-
return null;
|
|
155
|
-
}
|
|
156
|
-
function resolveActiveRuntimeRoot() {
|
|
157
|
-
const devRoot = resolveDevCheckoutRuntimeRoot();
|
|
158
|
-
if (devRoot) return devRoot;
|
|
159
|
-
const active = readActiveRuntime();
|
|
160
|
-
if (!active) return null;
|
|
161
|
-
const dir = runtimeDir(active);
|
|
162
|
-
if (!import_fs.default.existsSync(import_path.default.join(dir, "index.html"))) return null;
|
|
163
|
-
return dir;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// src/cli-runtime.ts
|
|
167
|
-
var CLI_COMPANION_ABI = 1;
|
|
168
|
-
function cliCompanionPath() {
|
|
169
|
-
return `node/cli-${runtime_companion_default.sha256}.cjs`;
|
|
170
|
-
}
|
|
171
|
-
function verifyCliCompanion(root) {
|
|
172
|
-
const file = (0, import_node_path2.join)(root, cliCompanionPath());
|
|
173
|
-
let bytes;
|
|
174
|
-
try {
|
|
175
|
-
bytes = (0, import_node_fs2.readFileSync)(file);
|
|
176
|
-
} catch (cause) {
|
|
177
|
-
throw new Error(
|
|
178
|
-
"Peach runtime is missing the companion required by this CLI; run `peach runtime install`",
|
|
179
|
-
{ cause }
|
|
180
|
-
);
|
|
181
|
-
}
|
|
182
|
-
const hash = (0, import_node_crypto.createHash)("sha256").update(bytes).digest("hex");
|
|
183
|
-
if (hash !== runtime_companion_default.sha256) {
|
|
184
|
-
throw new Error(
|
|
185
|
-
"Peach runtime companion does not match this CLI; run `peach runtime install`"
|
|
186
|
-
);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
var loaded;
|
|
190
|
-
function getCliRuntime() {
|
|
191
|
-
if (loaded) return loaded.runtime;
|
|
192
|
-
const root = resolveDevCheckoutRuntimeAssetRoot() ?? resolveActiveRuntimeRoot();
|
|
193
|
-
if (!root) throw new Error("No Peach runtime installed; run `peach runtime install`");
|
|
194
|
-
verifyCliCompanion(root);
|
|
195
|
-
const require2 = (0, import_node_module.createRequire)(__sootsim_import_meta_url);
|
|
196
|
-
const runtime = require2((0, import_node_path2.join)(root, cliCompanionPath()));
|
|
197
|
-
if (runtime.cliCompanionAbi !== CLI_COMPANION_ABI) {
|
|
198
|
-
throw new Error(
|
|
199
|
-
"Incompatible Peach runtime companion ABI; run `peach runtime install`"
|
|
200
|
-
);
|
|
201
|
-
}
|
|
202
|
-
loaded = { root, runtime };
|
|
203
|
-
return runtime;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
79
|
// src/packageVersionsContract.ts
|
|
207
80
|
var PACKAGE_VERSIONS_HEADER = "X-Peach-Package-Versions";
|
|
208
81
|
|
|
209
82
|
// src/host/dev-server-package-versions.ts
|
|
210
|
-
var import_fs3 = __toESM(require("fs"), 1);
|
|
211
|
-
var import_path3 = __toESM(require("path"), 1);
|
|
212
|
-
|
|
213
|
-
// src/installed-package-versions.ts
|
|
214
83
|
var import_fs2 = __toESM(require("fs"), 1);
|
|
215
84
|
var import_path2 = __toESM(require("path"), 1);
|
|
216
85
|
|
|
86
|
+
// src/installed-package-versions.ts
|
|
87
|
+
var import_fs = __toESM(require("fs"), 1);
|
|
88
|
+
var import_path = __toESM(require("path"), 1);
|
|
89
|
+
|
|
217
90
|
// ../peach-compat/src/lazy-stub-patterns.ts
|
|
218
91
|
var LAZY_STUB_PATTERNS = [
|
|
219
92
|
"@10play/tentap-editor",
|
|
@@ -3100,13 +2973,13 @@ function isMissing(error) {
|
|
|
3100
2973
|
}
|
|
3101
2974
|
async function answerAsync(step) {
|
|
3102
2975
|
if (step.op === "exists")
|
|
3103
|
-
return
|
|
2976
|
+
return import_fs.default.promises.access(step.path).then(
|
|
3104
2977
|
() => true,
|
|
3105
2978
|
() => false
|
|
3106
2979
|
);
|
|
3107
|
-
if (step.op === "realpath") return
|
|
2980
|
+
if (step.op === "realpath") return import_fs.default.promises.realpath(step.path);
|
|
3108
2981
|
try {
|
|
3109
|
-
return parseManifest(await
|
|
2982
|
+
return parseManifest(await import_fs.default.promises.readFile(step.path, "utf8"));
|
|
3110
2983
|
} catch (error) {
|
|
3111
2984
|
if (isMissing(error)) return null;
|
|
3112
2985
|
throw error;
|
|
@@ -3123,25 +2996,25 @@ function createInstalledPackageReader() {
|
|
|
3123
2996
|
const manifests = /* @__PURE__ */ new Map();
|
|
3124
2997
|
return function* readInstalledPackage(fromDir, name) {
|
|
3125
2998
|
for (let dir = fromDir; ; ) {
|
|
3126
|
-
if (
|
|
3127
|
-
const modules =
|
|
2999
|
+
if (import_path.default.basename(dir) !== "node_modules") {
|
|
3000
|
+
const modules = import_path.default.join(dir, "node_modules");
|
|
3128
3001
|
let present = hasModules.get(dir);
|
|
3129
3002
|
if (present === void 0) {
|
|
3130
3003
|
present = yield* exists(modules);
|
|
3131
3004
|
hasModules.set(dir, present);
|
|
3132
3005
|
}
|
|
3133
3006
|
if (present) {
|
|
3134
|
-
const root =
|
|
3007
|
+
const root = import_path.default.join(modules, name);
|
|
3135
3008
|
let installed = manifests.get(root);
|
|
3136
3009
|
if (installed === void 0) {
|
|
3137
|
-
const manifest = yield* readManifest(
|
|
3010
|
+
const manifest = yield* readManifest(import_path.default.join(root, "package.json"));
|
|
3138
3011
|
installed = manifest ? { root, manifest } : null;
|
|
3139
3012
|
manifests.set(root, installed);
|
|
3140
3013
|
}
|
|
3141
3014
|
if (installed) return installed;
|
|
3142
3015
|
}
|
|
3143
3016
|
}
|
|
3144
|
-
const parent =
|
|
3017
|
+
const parent = import_path.default.dirname(dir);
|
|
3145
3018
|
if (parent === dir) return null;
|
|
3146
3019
|
dir = parent;
|
|
3147
3020
|
}
|
|
@@ -3169,7 +3042,7 @@ function* nativePackageVersionsWalk(projectRoot) {
|
|
|
3169
3042
|
const name = extractPackageFromPath(`node_modules/${specifier}`);
|
|
3170
3043
|
if (name) nativeNames.add(name);
|
|
3171
3044
|
}
|
|
3172
|
-
const manifest = yield* readManifest(
|
|
3045
|
+
const manifest = yield* readManifest(import_path.default.join(appRoot, "package.json"));
|
|
3173
3046
|
if (!manifest) throw new Error("app package.json must contain an object");
|
|
3174
3047
|
const readInstalledPackage = createInstalledPackageReader();
|
|
3175
3048
|
const pending = [{ root: appRoot, manifest }];
|
|
@@ -3200,16 +3073,58 @@ function* nativePackageVersionsWalk(projectRoot) {
|
|
|
3200
3073
|
}
|
|
3201
3074
|
return yield* installedVersionsWalk(projectRoot, needed);
|
|
3202
3075
|
}
|
|
3203
|
-
|
|
3204
|
-
|
|
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;
|
|
3205
3120
|
}
|
|
3206
3121
|
|
|
3207
3122
|
// scripts/dev-server-scanner.ts
|
|
3208
3123
|
var import_child_process = require("child_process");
|
|
3209
3124
|
var import_promises = require("fs/promises");
|
|
3210
|
-
var
|
|
3211
|
-
var
|
|
3212
|
-
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");
|
|
3213
3128
|
|
|
3214
3129
|
// src/expo-manifest-body.ts
|
|
3215
3130
|
function parseExpoManifestBody(body) {
|
|
@@ -3230,8 +3145,8 @@ var MANIFEST_PROBE_TIMEOUT_MS = 3e4;
|
|
|
3230
3145
|
var import_plist = __toESM(require("plist"), 1);
|
|
3231
3146
|
|
|
3232
3147
|
// scripts/dev-server-scanner.ts
|
|
3233
|
-
var LISTENER_LOCK_PATH = (0,
|
|
3234
|
-
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");
|
|
3235
3150
|
var LISTENER_LOCK_STALE_MS = 25e3;
|
|
3236
3151
|
var LISTENER_LOCK_WAIT_MS = 8e3;
|
|
3237
3152
|
function sleep(ms) {
|
|
@@ -3249,8 +3164,8 @@ function pidIsAlive(pid) {
|
|
|
3249
3164
|
}
|
|
3250
3165
|
function readLockOwner() {
|
|
3251
3166
|
try {
|
|
3252
|
-
const raw = (0,
|
|
3253
|
-
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;
|
|
3254
3169
|
const pid = Number(raw.split("-")[0]);
|
|
3255
3170
|
return { raw, pid: Number.isInteger(pid) ? pid : -1, mtimeMs };
|
|
3256
3171
|
} catch {
|
|
@@ -3263,15 +3178,15 @@ function lockIsAbandoned(owner) {
|
|
|
3263
3178
|
}
|
|
3264
3179
|
function clearLock(raw) {
|
|
3265
3180
|
try {
|
|
3266
|
-
if ((0,
|
|
3267
|
-
(0,
|
|
3181
|
+
if ((0, import_node_fs.readFileSync)(LISTENER_LOCK_PATH, "utf8") !== raw) return;
|
|
3182
|
+
(0, import_node_fs.unlinkSync)(LISTENER_LOCK_PATH);
|
|
3268
3183
|
} catch {
|
|
3269
3184
|
}
|
|
3270
3185
|
}
|
|
3271
3186
|
function readResult() {
|
|
3272
3187
|
try {
|
|
3273
3188
|
const parsed = JSON.parse(
|
|
3274
|
-
(0,
|
|
3189
|
+
(0, import_node_fs.readFileSync)(LISTENER_RESULT_PATH, "utf8")
|
|
3275
3190
|
);
|
|
3276
3191
|
if (!parsed || typeof parsed.token !== "string" || typeof parsed.key !== "string")
|
|
3277
3192
|
return null;
|
|
@@ -3282,8 +3197,8 @@ function readResult() {
|
|
|
3282
3197
|
}
|
|
3283
3198
|
function publishResult(payload) {
|
|
3284
3199
|
const tmp = `${LISTENER_RESULT_PATH}.${process.pid}.tmp`;
|
|
3285
|
-
(0,
|
|
3286
|
-
(0,
|
|
3200
|
+
(0, import_node_fs.writeFileSync)(tmp, JSON.stringify(payload));
|
|
3201
|
+
(0, import_node_fs.renameSync)(tmp, LISTENER_RESULT_PATH);
|
|
3287
3202
|
}
|
|
3288
3203
|
function throwPublished(payload) {
|
|
3289
3204
|
throw Object.assign(new Error(payload.message || "listener scan failed"), {
|
|
@@ -3326,7 +3241,7 @@ async function withListenerLock(key, body) {
|
|
|
3326
3241
|
for (; ; ) {
|
|
3327
3242
|
let fd = null;
|
|
3328
3243
|
try {
|
|
3329
|
-
fd = (0,
|
|
3244
|
+
fd = (0, import_node_fs.openSync)(LISTENER_LOCK_PATH, "wx");
|
|
3330
3245
|
} catch (error) {
|
|
3331
3246
|
const code = error instanceof Error && "code" in error ? error.code : "";
|
|
3332
3247
|
if (code !== "EEXIST") throw error;
|
|
@@ -3335,7 +3250,7 @@ async function withListenerLock(key, body) {
|
|
|
3335
3250
|
if (owner) clearLock(owner.raw);
|
|
3336
3251
|
else {
|
|
3337
3252
|
try {
|
|
3338
|
-
(0,
|
|
3253
|
+
(0, import_node_fs.unlinkSync)(LISTENER_LOCK_PATH);
|
|
3339
3254
|
} catch {
|
|
3340
3255
|
}
|
|
3341
3256
|
}
|
|
@@ -3351,7 +3266,7 @@ async function withListenerLock(key, body) {
|
|
|
3351
3266
|
}
|
|
3352
3267
|
if (fd === null) continue;
|
|
3353
3268
|
try {
|
|
3354
|
-
(0,
|
|
3269
|
+
(0, import_node_fs.writeSync)(fd, token);
|
|
3355
3270
|
try {
|
|
3356
3271
|
const value = await body();
|
|
3357
3272
|
publishResult({ token, key, ok: true, value });
|
|
@@ -3368,7 +3283,7 @@ async function withListenerLock(key, body) {
|
|
|
3368
3283
|
}
|
|
3369
3284
|
} finally {
|
|
3370
3285
|
try {
|
|
3371
|
-
(0,
|
|
3286
|
+
(0, import_node_fs.closeSync)(fd);
|
|
3372
3287
|
} catch {
|
|
3373
3288
|
}
|
|
3374
3289
|
clearLock(token);
|
|
@@ -3716,7 +3631,7 @@ async function readDevServerPackageVersions(bundleUrl) {
|
|
|
3716
3631
|
const projectRoot = await resolveMetroProjectRoot(bundleUrl.href);
|
|
3717
3632
|
if (!projectRoot) return null;
|
|
3718
3633
|
try {
|
|
3719
|
-
await
|
|
3634
|
+
await import_fs2.default.promises.access(import_path2.default.join(projectRoot, "package.json"));
|
|
3720
3635
|
} catch {
|
|
3721
3636
|
return null;
|
|
3722
3637
|
}
|
|
@@ -3856,6 +3771,180 @@ function projectLoopbackPort(hostname, port) {
|
|
|
3856
3771
|
return isLoopbackHost(hostname) ? LOOPBACK_PORTS.get(port) ?? port : port;
|
|
3857
3772
|
}
|
|
3858
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
|
+
|
|
3859
3948
|
// src/host/fetch-proxy-handler.ts
|
|
3860
3949
|
var fetchProxyHttpAgent = new import_http.default.Agent({ keepAlive: true, maxSockets: 256 });
|
|
3861
3950
|
var fetchProxyHttpsAgent = new import_https.default.Agent({ keepAlive: true, maxSockets: 256 });
|
|
@@ -3969,6 +4058,9 @@ async function handleFetchProxyRequest(req, res) {
|
|
|
3969
4058
|
res.end("invalid url param");
|
|
3970
4059
|
return;
|
|
3971
4060
|
}
|
|
4061
|
+
const packageVersionsRead = isBundleProxyRequestUrl(req.url) && req.method === "GET" ? readDevServerPackageVersions(upstreamUrl) : null;
|
|
4062
|
+
packageVersionsRead?.catch(() => {
|
|
4063
|
+
});
|
|
3972
4064
|
await proxyUpstream(req, res, upstreamUrl, params.has(FETCH_PROXY_FAILURE_PARAM), {
|
|
3973
4065
|
requestHeaders: (target) => buildFetchProxyHeaders(req.headers, target),
|
|
3974
4066
|
respond: async (upstream, setCookies) => {
|
|
@@ -3979,15 +4071,11 @@ async function handleFetchProxyRequest(req, res) {
|
|
|
3979
4071
|
}
|
|
3980
4072
|
res.setHeader(key, value);
|
|
3981
4073
|
}
|
|
3982
|
-
if (
|
|
3983
|
-
const packageVersions = await
|
|
4074
|
+
if (packageVersionsRead && upstream.statusCode === 200 && !res.hasHeader(PACKAGE_VERSIONS_HEADER)) {
|
|
4075
|
+
const packageVersions = await packageVersionsRead;
|
|
3984
4076
|
if (packageVersions)
|
|
3985
4077
|
res.setHeader(PACKAGE_VERSIONS_HEADER, JSON.stringify(packageVersions));
|
|
3986
4078
|
}
|
|
3987
|
-
if (isBundleProxyRequestUrl(req.url) && req.method === "GET" && upstream.statusCode === 200 && upstreamUrl.pathname.endsWith(".bundle") && upstream.headers["x-peach-rolldown-inventory"] !== "1") {
|
|
3988
|
-
res.setHeader(ROLLDOWN_INVENTORY_HEADER, "1");
|
|
3989
|
-
res.removeHeader("content-length");
|
|
3990
|
-
}
|
|
3991
4079
|
applyFetchProxyCors(req, res);
|
|
3992
4080
|
if (setCookies.length > 0)
|
|
3993
4081
|
res.setHeader("x-sootsim-set-cookie", setCookies.join(", "));
|
|
@@ -4127,7 +4215,7 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
4127
4215
|
await route.respond(proxyRes, hopCookies);
|
|
4128
4216
|
if (isNativeCookieRedirect(hop)) res.removeHeader("location");
|
|
4129
4217
|
res.statusCode = isNativeCookieRedirect(hop) ? 200 : status;
|
|
4130
|
-
await (0,
|
|
4218
|
+
await (0, import_promises3.pipeline)(proxyRes, res);
|
|
4131
4219
|
return;
|
|
4132
4220
|
}
|
|
4133
4221
|
if (location && (status === 301 || status === 302 || status === 303 || status === 307 || status === 308)) {
|
|
@@ -4138,7 +4226,7 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
4138
4226
|
const switchToGet = (status === 301 || status === 302) && method === "POST" || status === 303 && method !== "GET" && method !== "HEAD";
|
|
4139
4227
|
const redirectUrl = resolveRedirectUrl(location, targetUrl);
|
|
4140
4228
|
proxyRes.resume();
|
|
4141
|
-
await (0,
|
|
4229
|
+
await (0, import_promises3.finished)(proxyRes);
|
|
4142
4230
|
await proxy(
|
|
4143
4231
|
redirectUrl,
|
|
4144
4232
|
switchToGet ? "GET" : method,
|
|
@@ -4151,36 +4239,11 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
4151
4239
|
if (redirects > 0) res.setHeader(FETCH_PROXY_RESPONSE_URL_HEADER, targetUrl.href);
|
|
4152
4240
|
await route.respond(proxyRes, hopCookies);
|
|
4153
4241
|
res.statusCode = status;
|
|
4154
|
-
if (isBundleProxyRequestUrl(req.url) && method === "GET" && status === 200 && targetUrl.pathname.endsWith(".bundle")
|
|
4155
|
-
|
|
4156
|
-
const inventory = getCliRuntime().rolldown_bundle_inventory;
|
|
4157
|
-
res.removeHeader("content-length");
|
|
4158
|
-
const annotate = async function* () {
|
|
4159
|
-
const decoder = new TextDecoder();
|
|
4160
|
-
let payload = "";
|
|
4161
|
-
let sent = 0;
|
|
4162
|
-
let bundleStarted = false;
|
|
4163
|
-
for await (const chunk of proxyRes) {
|
|
4164
|
-
payload += decoder.decode(chunk, { stream: true });
|
|
4165
|
-
if (bundleStarted) continue;
|
|
4166
|
-
const releasable = inventory.releasableMultipartPrefix(payload, contentType);
|
|
4167
|
-
bundleStarted = releasable.bundleStarted;
|
|
4168
|
-
if (releasable.length > sent) {
|
|
4169
|
-
yield Buffer.from(payload.slice(sent, releasable.length), "utf8");
|
|
4170
|
-
sent = releasable.length;
|
|
4171
|
-
}
|
|
4172
|
-
}
|
|
4173
|
-
payload += decoder.decode();
|
|
4174
|
-
const annotated = await inventory.attachRolldownBundleHttpPayload(
|
|
4175
|
-
payload,
|
|
4176
|
-
contentType
|
|
4177
|
-
);
|
|
4178
|
-
yield Buffer.from(annotated.slice(sent), "utf8");
|
|
4179
|
-
};
|
|
4180
|
-
await (0, import_promises2.pipeline)(import_stream.Readable.from(annotate(), { objectMode: false }), res);
|
|
4242
|
+
if (isBundleProxyRequestUrl(req.url) && method === "GET" && status === 200 && targetUrl.pathname.endsWith(".bundle")) {
|
|
4243
|
+
await forwardRolldownBundleResponse(proxyRes, res);
|
|
4181
4244
|
return;
|
|
4182
4245
|
}
|
|
4183
|
-
await (0,
|
|
4246
|
+
await (0, import_promises3.pipeline)(proxyRes, res);
|
|
4184
4247
|
};
|
|
4185
4248
|
let body;
|
|
4186
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;
|