peachsim 0.1.1653 → 0.1.1655
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-stubs.ts +97 -14
- package/cli/bridge-diagnostics.ts +10 -7
- package/cli/cloud-client.ts +11 -2
- package/cli/commands/doctor.ts +20 -10
- package/cli/commands/inspect/core.ts +2 -1
- package/cli/commands/inspect/shared.ts +2 -0
- package/cli/commands/inspect.ts +11 -2
- package/cli/output-redaction.ts +22 -6
- package/cli/pause-aware-timeout.ts +24 -10
- package/cli/ws-bridge.ts +17 -1
- 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 +277 -244
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +47 -12
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +276 -243
- 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 +320 -246
- package/dist-lib/host/fetch-proxy-handler.cjs +191 -31
- 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 +633 -373
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +62 -14
- package/dist-lib/native-app-identity-project.cjs +1 -1
- package/dist-lib/native-app-identity-project.mjs +1 -1
- 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 +62 -54
- 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 +1 -1
- package/dist-lib/sdk.cjs +2 -2
- package/dist-lib/sdk.mjs +2 -2
- package/dist-lib/skills.cjs +535 -380
- package/dist-lib/swift-compile.cjs +258 -197
- package/dist-lib/swift-compile.mjs +257 -197
- 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 +276 -243
- package/dist-lib/vite.cjs +385 -200
- 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-compat/src/stubs/screen-transition-math.d.ts +10 -7
- package/dist-types/packages/peach-engine/src/capture/browser-composite.d.ts +10 -0
- package/dist-types/packages/peach-engine/src/cli-companion.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +3 -1
- package/dist-types/packages/peach-engine/src/engine/scene-table.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/text-first-baseline.d.ts +23 -0
- package/dist-types/packages/peach-engine/src/engine/types.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/visible-frame.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/observability/types.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +38 -0
- package/dist-types/packages/peach-engine/src/rolldown-bundle-inventory.d.ts +9 -0
- package/package.json +5 -1
- package/runtime-companion.json +1 -1
- package/src/bridge-contract.ts +2 -0
- package/src/bundleGlobalFooter.ts +9 -0
- package/src/host/fetch-proxy-handler.ts +54 -0
- package/src/sfSymbolMetricsContract.ts +268 -0
- package/src/swift-compile.ts +302 -238
- package/src/swift-distribution.lock.json +20 -46
- package/src/swift-objc-metadata.ts +21 -7
- package/src/swift-objc-sdk.ts +13 -0
- package/src/swiftContract.ts +2 -0
- package/src/vite-plugin-one.ts +161 -16
- package/src/host/lease-owner.test.ts +0 -49
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1655 | (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,6 +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 import_stream = require("stream");
|
|
48
49
|
var import_promises2 = require("stream/promises");
|
|
49
50
|
|
|
50
51
|
// src/backend-origin.ts
|
|
@@ -76,16 +77,142 @@ function loopbackOriginOf(value) {
|
|
|
76
77
|
}
|
|
77
78
|
}
|
|
78
79
|
|
|
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
|
+
|
|
79
206
|
// src/packageVersionsContract.ts
|
|
80
207
|
var PACKAGE_VERSIONS_HEADER = "X-Peach-Package-Versions";
|
|
81
208
|
|
|
82
209
|
// src/host/dev-server-package-versions.ts
|
|
83
|
-
var
|
|
84
|
-
var
|
|
210
|
+
var import_fs3 = __toESM(require("fs"), 1);
|
|
211
|
+
var import_path3 = __toESM(require("path"), 1);
|
|
85
212
|
|
|
86
213
|
// src/installed-package-versions.ts
|
|
87
|
-
var
|
|
88
|
-
var
|
|
214
|
+
var import_fs2 = __toESM(require("fs"), 1);
|
|
215
|
+
var import_path2 = __toESM(require("path"), 1);
|
|
89
216
|
|
|
90
217
|
// ../peach-compat/src/lazy-stub-patterns.ts
|
|
91
218
|
var LAZY_STUB_PATTERNS = [
|
|
@@ -2973,13 +3100,13 @@ function isMissing(error) {
|
|
|
2973
3100
|
}
|
|
2974
3101
|
async function answerAsync(step) {
|
|
2975
3102
|
if (step.op === "exists")
|
|
2976
|
-
return
|
|
3103
|
+
return import_fs2.default.promises.access(step.path).then(
|
|
2977
3104
|
() => true,
|
|
2978
3105
|
() => false
|
|
2979
3106
|
);
|
|
2980
|
-
if (step.op === "realpath") return
|
|
3107
|
+
if (step.op === "realpath") return import_fs2.default.promises.realpath(step.path);
|
|
2981
3108
|
try {
|
|
2982
|
-
return parseManifest(await
|
|
3109
|
+
return parseManifest(await import_fs2.default.promises.readFile(step.path, "utf8"));
|
|
2983
3110
|
} catch (error) {
|
|
2984
3111
|
if (isMissing(error)) return null;
|
|
2985
3112
|
throw error;
|
|
@@ -2996,25 +3123,25 @@ function createInstalledPackageReader() {
|
|
|
2996
3123
|
const manifests = /* @__PURE__ */ new Map();
|
|
2997
3124
|
return function* readInstalledPackage(fromDir, name) {
|
|
2998
3125
|
for (let dir = fromDir; ; ) {
|
|
2999
|
-
if (
|
|
3000
|
-
const modules =
|
|
3126
|
+
if (import_path2.default.basename(dir) !== "node_modules") {
|
|
3127
|
+
const modules = import_path2.default.join(dir, "node_modules");
|
|
3001
3128
|
let present = hasModules.get(dir);
|
|
3002
3129
|
if (present === void 0) {
|
|
3003
3130
|
present = yield* exists(modules);
|
|
3004
3131
|
hasModules.set(dir, present);
|
|
3005
3132
|
}
|
|
3006
3133
|
if (present) {
|
|
3007
|
-
const root =
|
|
3134
|
+
const root = import_path2.default.join(modules, name);
|
|
3008
3135
|
let installed = manifests.get(root);
|
|
3009
3136
|
if (installed === void 0) {
|
|
3010
|
-
const manifest = yield* readManifest(
|
|
3137
|
+
const manifest = yield* readManifest(import_path2.default.join(root, "package.json"));
|
|
3011
3138
|
installed = manifest ? { root, manifest } : null;
|
|
3012
3139
|
manifests.set(root, installed);
|
|
3013
3140
|
}
|
|
3014
3141
|
if (installed) return installed;
|
|
3015
3142
|
}
|
|
3016
3143
|
}
|
|
3017
|
-
const parent =
|
|
3144
|
+
const parent = import_path2.default.dirname(dir);
|
|
3018
3145
|
if (parent === dir) return null;
|
|
3019
3146
|
dir = parent;
|
|
3020
3147
|
}
|
|
@@ -3042,7 +3169,7 @@ function* nativePackageVersionsWalk(projectRoot) {
|
|
|
3042
3169
|
const name = extractPackageFromPath(`node_modules/${specifier}`);
|
|
3043
3170
|
if (name) nativeNames.add(name);
|
|
3044
3171
|
}
|
|
3045
|
-
const manifest = yield* readManifest(
|
|
3172
|
+
const manifest = yield* readManifest(import_path2.default.join(appRoot, "package.json"));
|
|
3046
3173
|
if (!manifest) throw new Error("app package.json must contain an object");
|
|
3047
3174
|
const readInstalledPackage = createInstalledPackageReader();
|
|
3048
3175
|
const pending = [{ root: appRoot, manifest }];
|
|
@@ -3080,9 +3207,9 @@ function readInstalledNativePackageVersionsAsync(projectRoot) {
|
|
|
3080
3207
|
// scripts/dev-server-scanner.ts
|
|
3081
3208
|
var import_child_process = require("child_process");
|
|
3082
3209
|
var import_promises = require("fs/promises");
|
|
3083
|
-
var
|
|
3084
|
-
var
|
|
3085
|
-
var
|
|
3210
|
+
var import_node_fs3 = require("node:fs");
|
|
3211
|
+
var import_node_os2 = require("node:os");
|
|
3212
|
+
var import_node_path3 = require("node:path");
|
|
3086
3213
|
|
|
3087
3214
|
// src/expo-manifest-body.ts
|
|
3088
3215
|
function parseExpoManifestBody(body) {
|
|
@@ -3103,8 +3230,8 @@ var MANIFEST_PROBE_TIMEOUT_MS = 3e4;
|
|
|
3103
3230
|
var import_plist = __toESM(require("plist"), 1);
|
|
3104
3231
|
|
|
3105
3232
|
// scripts/dev-server-scanner.ts
|
|
3106
|
-
var LISTENER_LOCK_PATH = (0,
|
|
3107
|
-
var LISTENER_RESULT_PATH = (0,
|
|
3233
|
+
var LISTENER_LOCK_PATH = (0, import_node_path3.join)((0, import_node_os2.tmpdir)(), "peach-listener-scan.lock");
|
|
3234
|
+
var LISTENER_RESULT_PATH = (0, import_node_path3.join)((0, import_node_os2.tmpdir)(), "peach-listener-scan.result");
|
|
3108
3235
|
var LISTENER_LOCK_STALE_MS = 25e3;
|
|
3109
3236
|
var LISTENER_LOCK_WAIT_MS = 8e3;
|
|
3110
3237
|
function sleep(ms) {
|
|
@@ -3122,8 +3249,8 @@ function pidIsAlive(pid) {
|
|
|
3122
3249
|
}
|
|
3123
3250
|
function readLockOwner() {
|
|
3124
3251
|
try {
|
|
3125
|
-
const raw = (0,
|
|
3126
|
-
const mtimeMs = (0,
|
|
3252
|
+
const raw = (0, import_node_fs3.readFileSync)(LISTENER_LOCK_PATH, "utf8");
|
|
3253
|
+
const mtimeMs = (0, import_node_fs3.statSync)(LISTENER_LOCK_PATH).mtimeMs;
|
|
3127
3254
|
const pid = Number(raw.split("-")[0]);
|
|
3128
3255
|
return { raw, pid: Number.isInteger(pid) ? pid : -1, mtimeMs };
|
|
3129
3256
|
} catch {
|
|
@@ -3136,15 +3263,15 @@ function lockIsAbandoned(owner) {
|
|
|
3136
3263
|
}
|
|
3137
3264
|
function clearLock(raw) {
|
|
3138
3265
|
try {
|
|
3139
|
-
if ((0,
|
|
3140
|
-
(0,
|
|
3266
|
+
if ((0, import_node_fs3.readFileSync)(LISTENER_LOCK_PATH, "utf8") !== raw) return;
|
|
3267
|
+
(0, import_node_fs3.unlinkSync)(LISTENER_LOCK_PATH);
|
|
3141
3268
|
} catch {
|
|
3142
3269
|
}
|
|
3143
3270
|
}
|
|
3144
3271
|
function readResult() {
|
|
3145
3272
|
try {
|
|
3146
3273
|
const parsed = JSON.parse(
|
|
3147
|
-
(0,
|
|
3274
|
+
(0, import_node_fs3.readFileSync)(LISTENER_RESULT_PATH, "utf8")
|
|
3148
3275
|
);
|
|
3149
3276
|
if (!parsed || typeof parsed.token !== "string" || typeof parsed.key !== "string")
|
|
3150
3277
|
return null;
|
|
@@ -3155,8 +3282,8 @@ function readResult() {
|
|
|
3155
3282
|
}
|
|
3156
3283
|
function publishResult(payload) {
|
|
3157
3284
|
const tmp = `${LISTENER_RESULT_PATH}.${process.pid}.tmp`;
|
|
3158
|
-
(0,
|
|
3159
|
-
(0,
|
|
3285
|
+
(0, import_node_fs3.writeFileSync)(tmp, JSON.stringify(payload));
|
|
3286
|
+
(0, import_node_fs3.renameSync)(tmp, LISTENER_RESULT_PATH);
|
|
3160
3287
|
}
|
|
3161
3288
|
function throwPublished(payload) {
|
|
3162
3289
|
throw Object.assign(new Error(payload.message || "listener scan failed"), {
|
|
@@ -3199,7 +3326,7 @@ async function withListenerLock(key, body) {
|
|
|
3199
3326
|
for (; ; ) {
|
|
3200
3327
|
let fd = null;
|
|
3201
3328
|
try {
|
|
3202
|
-
fd = (0,
|
|
3329
|
+
fd = (0, import_node_fs3.openSync)(LISTENER_LOCK_PATH, "wx");
|
|
3203
3330
|
} catch (error) {
|
|
3204
3331
|
const code = error instanceof Error && "code" in error ? error.code : "";
|
|
3205
3332
|
if (code !== "EEXIST") throw error;
|
|
@@ -3208,7 +3335,7 @@ async function withListenerLock(key, body) {
|
|
|
3208
3335
|
if (owner) clearLock(owner.raw);
|
|
3209
3336
|
else {
|
|
3210
3337
|
try {
|
|
3211
|
-
(0,
|
|
3338
|
+
(0, import_node_fs3.unlinkSync)(LISTENER_LOCK_PATH);
|
|
3212
3339
|
} catch {
|
|
3213
3340
|
}
|
|
3214
3341
|
}
|
|
@@ -3224,7 +3351,7 @@ async function withListenerLock(key, body) {
|
|
|
3224
3351
|
}
|
|
3225
3352
|
if (fd === null) continue;
|
|
3226
3353
|
try {
|
|
3227
|
-
(0,
|
|
3354
|
+
(0, import_node_fs3.writeSync)(fd, token);
|
|
3228
3355
|
try {
|
|
3229
3356
|
const value = await body();
|
|
3230
3357
|
publishResult({ token, key, ok: true, value });
|
|
@@ -3241,7 +3368,7 @@ async function withListenerLock(key, body) {
|
|
|
3241
3368
|
}
|
|
3242
3369
|
} finally {
|
|
3243
3370
|
try {
|
|
3244
|
-
(0,
|
|
3371
|
+
(0, import_node_fs3.closeSync)(fd);
|
|
3245
3372
|
} catch {
|
|
3246
3373
|
}
|
|
3247
3374
|
clearLock(token);
|
|
@@ -3589,7 +3716,7 @@ async function readDevServerPackageVersions(bundleUrl) {
|
|
|
3589
3716
|
const projectRoot = await resolveMetroProjectRoot(bundleUrl.href);
|
|
3590
3717
|
if (!projectRoot) return null;
|
|
3591
3718
|
try {
|
|
3592
|
-
await
|
|
3719
|
+
await import_fs3.default.promises.access(import_path3.default.join(projectRoot, "package.json"));
|
|
3593
3720
|
} catch {
|
|
3594
3721
|
return null;
|
|
3595
3722
|
}
|
|
@@ -3857,6 +3984,10 @@ async function handleFetchProxyRequest(req, res) {
|
|
|
3857
3984
|
if (packageVersions)
|
|
3858
3985
|
res.setHeader(PACKAGE_VERSIONS_HEADER, JSON.stringify(packageVersions));
|
|
3859
3986
|
}
|
|
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
|
+
}
|
|
3860
3991
|
applyFetchProxyCors(req, res);
|
|
3861
3992
|
if (setCookies.length > 0)
|
|
3862
3993
|
res.setHeader("x-sootsim-set-cookie", setCookies.join(", "));
|
|
@@ -4020,6 +4151,35 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
4020
4151
|
if (redirects > 0) res.setHeader(FETCH_PROXY_RESPONSE_URL_HEADER, targetUrl.href);
|
|
4021
4152
|
await route.respond(proxyRes, hopCookies);
|
|
4022
4153
|
res.statusCode = status;
|
|
4154
|
+
if (isBundleProxyRequestUrl(req.url) && method === "GET" && status === 200 && targetUrl.pathname.endsWith(".bundle") && proxyRes.headers["x-peach-rolldown-inventory"] !== "1") {
|
|
4155
|
+
const contentType = typeof proxyRes.headers["content-type"] === "string" ? proxyRes.headers["content-type"] : "";
|
|
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);
|
|
4181
|
+
return;
|
|
4182
|
+
}
|
|
4023
4183
|
await (0, import_promises2.pipeline)(proxyRes, res);
|
|
4024
4184
|
};
|
|
4025
4185
|
let body;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1655 | (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.1655 | (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.1655 | (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;
|