peachsim 0.1.2209 → 0.1.2213
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/command-registry.ts +1 -0
- package/cli/commands/inspect/settling.ts +1 -1
- package/cli/commands/map.ts +576 -0
- package/cli/commands/runtime.ts +1 -1
- package/cli/main.ts +6 -0
- package/cli/outbound-endpoints.ts +11 -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 +282 -53
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +6 -3
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +280 -51
- 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 +1264 -856
- package/dist-lib/host/fetch-proxy-handler.cjs +21 -5
- 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 +1966 -752
- 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 +1806 -593
- package/dist-lib/native-app-identity-project.cjs +19 -3
- package/dist-lib/native-app-identity-project.mjs +19 -3
- 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/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.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 +25 -24
- package/dist-lib/public-origins-lib.json +83 -53
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/reap-browser.cjs +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 +1800 -1334
- package/dist-lib/swift-compile.cjs +58 -12
- package/dist-lib/swift-compile.mjs +57 -12
- 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 +257 -47
- package/dist-lib/vite.cjs +1530 -303
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/font-config.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +1 -0
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/CoreData.apinotes +35 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/CoreData.h +8 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSAttributeDescription.h +30 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSEntityDescription.h +14 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSExpressionDescription.h +10 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSFetchIndexDescription.h +13 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSFetchIndexElementDescription.h +18 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObject.h +11 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObjectContext.h +19 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObjectID.h +2 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObjectModel.h +3 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSMergePolicy.h +17 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSPersistentStore.h +8 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSPersistentStoreCoordinator.h +6 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSPropertyDescription.h +13 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSRelationshipDescription.h +21 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CoreAnimation.h +2 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIImage.h +1 -10
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes +21 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UINibLoading.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKitTypes.framework/Headers/UIKitTypes.h +11 -0
- package/sdk/ios/usr/lib/swift/Combine.swiftmodule/arm64-apple-ios-simulator.swiftinterface +18 -0
- package/sdk/ios/usr/lib/swift/Foundation.swiftmodule/arm64-apple-ios-simulator.swiftinterface +1 -0
- package/sdk/ios/usr/lib/swift/SwiftUI.swiftmodule/arm64-apple-ios-simulator.swiftinterface +19 -0
- package/sdk/ios/usr/lib/swift/SwiftUICore.swiftmodule/arm64-apple-ios-simulator.swiftinterface +4 -0
- package/sdk/ios/usr/lib/swift/UIKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +4 -0
- package/sdk/ios/wasm/include/pthread.h +1 -0
- package/sdk/ios/wasm/include/signal.h +2 -2
- package/sdk/native-hashes.json +3 -3
- package/skills/contrast/SKILL.md +1 -0
- package/src/home-paths.ts +1 -1
- package/src/host/bridge-host.ts +101 -97
- package/src/metro-plugin.ts +4 -1
- package/src/native-static-libraries.ts +7 -0
- package/src/react-native-coverage/native-source-ranges-file.ts +1 -1
- package/src/runtime-assets.ts +0 -1
- package/src/runtime-delivery.ts +1 -1
- package/src/runtime-packs.ts +212 -0
- package/src/swift-compile.ts +48 -10
- package/src/swift-host.ts +22 -3
- package/src/swift-objc-compile.ts +1 -1
- package/src/swift-objc-import.ts +32 -2
- package/src/swift-objc-standin.ts +1 -1
- package/src/swift-packages.ts +53 -28
- package/src/swift-pdf-raster.ts +60 -4
- package/src/swift-shipped-archives.json +44 -0
- package/src/swift-shipped-binaries.ts +12 -0
- package/src/swift-standin-config.ts +4 -2
- package/src/swift-standin-emit.ts +9 -3
- package/src/swift-standins.ts +75 -8
- package/src/vite-plugin-one.ts +4 -1
package/dist-lib/vite.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2213 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -14,8 +14,8 @@ var __commonJS = (cb, mod) => function __require() {
|
|
|
14
14
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
15
15
|
};
|
|
16
16
|
var __export = (target, all) => {
|
|
17
|
-
for (var
|
|
18
|
-
__defProp(target,
|
|
17
|
+
for (var name2 in all)
|
|
18
|
+
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
19
19
|
};
|
|
20
20
|
var __copyProps = (to, from, except, desc) => {
|
|
21
21
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -39,7 +39,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
39
39
|
var define_SWIFT_COVERAGE_SOURCE_DIGESTS_default;
|
|
40
40
|
var init_define_SWIFT_COVERAGE_SOURCE_DIGESTS = __esm({
|
|
41
41
|
"<define:__SWIFT_COVERAGE_SOURCE_DIGESTS__>"() {
|
|
42
|
-
define_SWIFT_COVERAGE_SOURCE_DIGESTS_default = { "swift-coverage/indexdump.ts": "0d82d8eeb96bf377f409ea7e33274c341a710c0e071f6b6e17571a23d8d92412", "swift-coverage/indexing.ts": "633ccf19eec1f382a8847d0ee1dca42a2792a3c60aafd43622ed5152b09b8272", "swift-coverage/types.ts": "bd8fae54ea6c53e110cd8a5d7b57c1d532dd0166e09fdaea63c4f270c3780dd1", "swift-coverage/source.ts": "c151758a9f67631bc61473c375df0dc017da6902a34533b2cf4fc4fd7d19b6ee", "swift-coverage/package.ts": "1f0068be7461fa7c5a7a891faf318f305cbed2e94c19667ba76627f7e5be260b", "swift-coverage/xcode.ts": "65a500b806ce1c3a496de27f2e0ad77287c0f6795c618342c08af647f92af1fa", "swift-coverage/xcode-assets.ts": "99e03b74c961d2449afd58c2cbc415ba91d1d469a4f89e461c137fd6c305b27c", "swift-coverage/xcode-asset-symbols.ts": "1b2a67733bc9d139b351466270205452a6172140bc25080d72619e2952c44671", "swift-coverage/xcode-bridging.ts": "33184be8c5daf6646aa5a1276a4e15531f1be27b7c26f56550e0fbb1fc678a11", "swift-coverage/xcode-packages.ts": "8e6020d17d24474150a5a50d042aca6261819ef75c79680a287a66f395909915", "swift-coverage/xcode-strings.ts": "f2dd4c7cd8ef77035184b0132909c2fa09fd20ed06b7757c2f1f960bfdde031c", "swift-coverage/reader.ts": "da559b67ecd1161dea70c980b5f98f2c55af3550f0714479100fa5e9e813625c", "swift-coverage/provenance.ts": "eb3b41ae8b58b48f6758f084800f188dfb1edb227e483abdd6b80cde66e849b9", "swift-package-manifest.ts": "4b7d4a715cdaf57468ead23f2ff9dce76d02c6a888d73d144d4baa2ae571ba3c", "swift-package.ts": "338cfef9a34a930206ac2e1a8a90b85c8d61f776d9a41e6445dc18e0c5385cdb", "swift-source-file.ts": "93fd659ed63a27b67f54a7c229a7ceb636dc9c59e68414920ba36cff1eda1f94", "swift-toolchain.ts": "25505683ca29a0b380413bf2a5026d4967eacf886e35bc11ece6e15317e5bb02", "home-paths.ts": "
|
|
42
|
+
define_SWIFT_COVERAGE_SOURCE_DIGESTS_default = { "swift-coverage/indexdump.ts": "0d82d8eeb96bf377f409ea7e33274c341a710c0e071f6b6e17571a23d8d92412", "swift-coverage/indexing.ts": "633ccf19eec1f382a8847d0ee1dca42a2792a3c60aafd43622ed5152b09b8272", "swift-coverage/types.ts": "bd8fae54ea6c53e110cd8a5d7b57c1d532dd0166e09fdaea63c4f270c3780dd1", "swift-coverage/source.ts": "c151758a9f67631bc61473c375df0dc017da6902a34533b2cf4fc4fd7d19b6ee", "swift-coverage/package.ts": "1f0068be7461fa7c5a7a891faf318f305cbed2e94c19667ba76627f7e5be260b", "swift-coverage/xcode.ts": "65a500b806ce1c3a496de27f2e0ad77287c0f6795c618342c08af647f92af1fa", "swift-coverage/xcode-assets.ts": "99e03b74c961d2449afd58c2cbc415ba91d1d469a4f89e461c137fd6c305b27c", "swift-coverage/xcode-asset-symbols.ts": "1b2a67733bc9d139b351466270205452a6172140bc25080d72619e2952c44671", "swift-coverage/xcode-bridging.ts": "33184be8c5daf6646aa5a1276a4e15531f1be27b7c26f56550e0fbb1fc678a11", "swift-coverage/xcode-packages.ts": "8e6020d17d24474150a5a50d042aca6261819ef75c79680a287a66f395909915", "swift-coverage/xcode-strings.ts": "f2dd4c7cd8ef77035184b0132909c2fa09fd20ed06b7757c2f1f960bfdde031c", "swift-coverage/reader.ts": "da559b67ecd1161dea70c980b5f98f2c55af3550f0714479100fa5e9e813625c", "swift-coverage/provenance.ts": "eb3b41ae8b58b48f6758f084800f188dfb1edb227e483abdd6b80cde66e849b9", "swift-package-manifest.ts": "4b7d4a715cdaf57468ead23f2ff9dce76d02c6a888d73d144d4baa2ae571ba3c", "swift-package.ts": "338cfef9a34a930206ac2e1a8a90b85c8d61f776d9a41e6445dc18e0c5385cdb", "swift-source-file.ts": "93fd659ed63a27b67f54a7c229a7ceb636dc9c59e68414920ba36cff1eda1f94", "swift-toolchain.ts": "25505683ca29a0b380413bf2a5026d4967eacf886e35bc11ece6e15317e5bb02", "home-paths.ts": "d1606390f0e8e50f0ff72544eadb3d49dfabf08e004c1218f2998c36fb8995dd", "xcode-header-search.ts": "f8c3d557b4eca5ddad32907545353eb7ad53b2ebd0969d9ed8f7275e109a13b1", "xcode-project.ts": "86f79e98323ec065e0e5195324c75ca608f490efbd95dcc25c53d5aa0b9aecc9", "xcode-target-members.ts": "ad7589132bffab265e8a10b64e24484fe88b4a2b1cc0ee19a97f151a002eca77", "xcode-json-project.ts": "41990ebbe4b488eef34e74c4608b4b48e5a5b299ba98ca7fbcfdfa0e77be63b6", "openstep-plist.ts": "74e6ce1dac80c9c318e0e9f5e3e8cd19a898a8820c36fc160609695bcb59dcd3" };
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
|
|
@@ -111,8 +111,8 @@ var require_parse = __commonJS({
|
|
|
111
111
|
}
|
|
112
112
|
return root;
|
|
113
113
|
};
|
|
114
|
-
function internalize(holder,
|
|
115
|
-
const value = holder[
|
|
114
|
+
function internalize(holder, name2, reviver) {
|
|
115
|
+
const value = holder[name2];
|
|
116
116
|
if (value != null && typeof value === "object") {
|
|
117
117
|
if (Array.isArray(value)) {
|
|
118
118
|
for (let i = 0; i < value.length; i++) {
|
|
@@ -145,7 +145,7 @@ var require_parse = __commonJS({
|
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
return reviver.call(holder,
|
|
148
|
+
return reviver.call(holder, name2, value);
|
|
149
149
|
}
|
|
150
150
|
var lexState;
|
|
151
151
|
var buffer;
|
|
@@ -1185,9 +1185,9 @@ function nodeHttpFetch(url, init = {}, redirects = 0) {
|
|
|
1185
1185
|
return;
|
|
1186
1186
|
}
|
|
1187
1187
|
const headers = new Headers();
|
|
1188
|
-
for (const [
|
|
1189
|
-
if (Array.isArray(value)) for (const entry of value) headers.append(
|
|
1190
|
-
else if (value !== void 0) headers.set(
|
|
1188
|
+
for (const [name2, value] of Object.entries(res.headers)) {
|
|
1189
|
+
if (Array.isArray(value)) for (const entry of value) headers.append(name2, entry);
|
|
1190
|
+
else if (value !== void 0) headers.set(name2, value);
|
|
1191
1191
|
}
|
|
1192
1192
|
if (BODYLESS_STATUS.has(status)) {
|
|
1193
1193
|
res.resume();
|
|
@@ -1199,13 +1199,13 @@ function nodeHttpFetch(url, init = {}, redirects = 0) {
|
|
|
1199
1199
|
if (codings.every((coding) => DECODABLE_CODINGS.has(coding))) {
|
|
1200
1200
|
for (const coding of codings.reverse()) {
|
|
1201
1201
|
let decoder;
|
|
1202
|
-
if (coding === "br") decoder =
|
|
1202
|
+
if (coding === "br") decoder = import_node_zlib3.default.createBrotliDecompress();
|
|
1203
1203
|
else if (coding === "deflate") {
|
|
1204
1204
|
let inner;
|
|
1205
|
-
decoder = new
|
|
1205
|
+
decoder = new import_node_stream3.Transform({
|
|
1206
1206
|
transform(chunk, _encoding, done) {
|
|
1207
1207
|
if (!inner) {
|
|
1208
|
-
inner = (chunk[0] & 15) === 8 ?
|
|
1208
|
+
inner = (chunk[0] & 15) === 8 ? import_node_zlib3.default.createInflate(TRUNCATION_TOLERANT) : import_node_zlib3.default.createInflateRaw(TRUNCATION_TOLERANT);
|
|
1209
1209
|
inner.on("data", (data) => decoder.push(data));
|
|
1210
1210
|
inner.on("error", (error) => decoder.destroy(error));
|
|
1211
1211
|
}
|
|
@@ -1221,8 +1221,8 @@ function nodeHttpFetch(url, init = {}, redirects = 0) {
|
|
|
1221
1221
|
done(error);
|
|
1222
1222
|
}
|
|
1223
1223
|
});
|
|
1224
|
-
} else decoder =
|
|
1225
|
-
source = (0,
|
|
1224
|
+
} else decoder = import_node_zlib3.default.createGunzip(TRUNCATION_TOLERANT);
|
|
1225
|
+
source = (0, import_node_stream3.pipeline)(source, decoder, () => {
|
|
1226
1226
|
});
|
|
1227
1227
|
}
|
|
1228
1228
|
}
|
|
@@ -1250,17 +1250,17 @@ function nodeHttpFetch(url, init = {}, redirects = 0) {
|
|
|
1250
1250
|
req.end();
|
|
1251
1251
|
});
|
|
1252
1252
|
}
|
|
1253
|
-
var import_node_http, import_node_https,
|
|
1253
|
+
var import_node_http, import_node_https, import_node_stream3, import_node_zlib3, BODYLESS_STATUS, TRUNCATION_TOLERANT, MAX_REDIRECTS, DECODABLE_CODINGS;
|
|
1254
1254
|
var init_node_http_fetch = __esm({
|
|
1255
1255
|
"src/node-http-fetch.ts"() {
|
|
1256
1256
|
"use strict";
|
|
1257
1257
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
1258
1258
|
import_node_http = __toESM(require("node:http"), 1);
|
|
1259
1259
|
import_node_https = __toESM(require("node:https"), 1);
|
|
1260
|
-
|
|
1261
|
-
|
|
1260
|
+
import_node_stream3 = require("node:stream");
|
|
1261
|
+
import_node_zlib3 = __toESM(require("node:zlib"), 1);
|
|
1262
1262
|
BODYLESS_STATUS = /* @__PURE__ */ new Set([101, 204, 205, 304]);
|
|
1263
|
-
TRUNCATION_TOLERANT = { finishFlush:
|
|
1263
|
+
TRUNCATION_TOLERANT = { finishFlush: import_node_zlib3.default.constants.Z_SYNC_FLUSH };
|
|
1264
1264
|
MAX_REDIRECTS = 5;
|
|
1265
1265
|
DECODABLE_CODINGS = /* @__PURE__ */ new Set(["gzip", "x-gzip", "deflate", "br"]);
|
|
1266
1266
|
}
|
|
@@ -1275,12 +1275,12 @@ __export(vite_plugin_one_exports, {
|
|
|
1275
1275
|
module.exports = __toCommonJS(vite_plugin_one_exports);
|
|
1276
1276
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
1277
1277
|
var import_fs4 = __toESM(require("fs"), 1);
|
|
1278
|
-
var
|
|
1278
|
+
var import_node_crypto7 = require("node:crypto");
|
|
1279
1279
|
var import_node_http3 = __toESM(require("node:http"), 1);
|
|
1280
1280
|
var import_node_https2 = __toESM(require("node:https"), 1);
|
|
1281
1281
|
var import_node_url2 = require("node:url");
|
|
1282
1282
|
var import_path4 = __toESM(require("path"), 1);
|
|
1283
|
-
var
|
|
1283
|
+
var import_promises8 = require("stream/promises");
|
|
1284
1284
|
|
|
1285
1285
|
// ../peach-globals/src/package-versions.ts
|
|
1286
1286
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -1302,30 +1302,30 @@ function findBundleFooter(source, prefix) {
|
|
|
1302
1302
|
function isFooterBlockLine(source, line, end) {
|
|
1303
1303
|
return line === end || source.startsWith("globalThis.", line) || source.startsWith("//", line);
|
|
1304
1304
|
}
|
|
1305
|
-
function readFooter(source, prefix, suffix,
|
|
1305
|
+
function readFooter(source, prefix, suffix, name2) {
|
|
1306
1306
|
const start = findBundleFooter(source, prefix);
|
|
1307
1307
|
if (start < 0) return null;
|
|
1308
1308
|
const end = source.indexOf("\n", start + 1);
|
|
1309
1309
|
const line = source.slice(start + 1, end < 0 ? void 0 : end);
|
|
1310
|
-
if (!line.endsWith(suffix)) throw new Error(`${
|
|
1310
|
+
if (!line.endsWith(suffix)) throw new Error(`${name2} footer is truncated`);
|
|
1311
1311
|
const value = JSON.parse(
|
|
1312
1312
|
line.slice(prefix.length, suffix ? -suffix.length : void 0)
|
|
1313
1313
|
);
|
|
1314
|
-
if (value === null) throw new Error(`${
|
|
1314
|
+
if (value === null) throw new Error(`${name2} footer has no metadata`);
|
|
1315
1315
|
return value;
|
|
1316
1316
|
}
|
|
1317
|
-
function detachFooter(source, prefix, suffix,
|
|
1317
|
+
function detachFooter(source, prefix, suffix, name2) {
|
|
1318
1318
|
const start = findBundleFooter(source, prefix);
|
|
1319
1319
|
if (start < 0) return { source, value: null };
|
|
1320
|
-
const value = readFooter(source, prefix, suffix,
|
|
1320
|
+
const value = readFooter(source, prefix, suffix, name2);
|
|
1321
1321
|
const end = source.indexOf("\n", start + 1);
|
|
1322
1322
|
return { source: source.slice(0, start) + (end < 0 ? "" : source.slice(end)), value };
|
|
1323
1323
|
}
|
|
1324
|
-
function insertBundleGlobalFooter(source,
|
|
1325
|
-
return insertFooter(source, `globalThis.${
|
|
1324
|
+
function insertBundleGlobalFooter(source, name2, value) {
|
|
1325
|
+
return insertFooter(source, `globalThis.${name2}=`, ";", name2, value);
|
|
1326
1326
|
}
|
|
1327
|
-
function insertFooter(source, prefix, suffix,
|
|
1328
|
-
source = detachFooter(source, prefix, suffix,
|
|
1327
|
+
function insertFooter(source, prefix, suffix, name2, value) {
|
|
1328
|
+
source = detachFooter(source, prefix, suffix, name2).source;
|
|
1329
1329
|
const json = JSON.stringify(value).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029").replace(/<\//g, "<\\/");
|
|
1330
1330
|
const footer = `
|
|
1331
1331
|
${prefix}${json}${suffix}`;
|
|
@@ -1342,11 +1342,11 @@ function readPackageVersions(value) {
|
|
|
1342
1342
|
throw new Error("invalid package versions");
|
|
1343
1343
|
}
|
|
1344
1344
|
const versions = {};
|
|
1345
|
-
for (const [
|
|
1346
|
-
if (
|
|
1345
|
+
for (const [name2, version] of Object.entries(value)) {
|
|
1346
|
+
if (name2.length === 0 || typeof version !== "string" || version.length === 0) {
|
|
1347
1347
|
throw new Error("invalid package versions");
|
|
1348
1348
|
}
|
|
1349
|
-
versions[
|
|
1349
|
+
versions[name2] = version;
|
|
1350
1350
|
}
|
|
1351
1351
|
return versions;
|
|
1352
1352
|
}
|
|
@@ -1365,8 +1365,8 @@ function resolveWorkletsStaticFlags(defaults, appManifest) {
|
|
|
1365
1365
|
throw new Error("Worklets static flag overrides are malformed");
|
|
1366
1366
|
}
|
|
1367
1367
|
const flags = {};
|
|
1368
|
-
for (const [
|
|
1369
|
-
flags[
|
|
1368
|
+
for (const [name2, value] of Object.entries({ ...defaults, ...overrides })) {
|
|
1369
|
+
flags[name2] = String(value) === "true";
|
|
1370
1370
|
}
|
|
1371
1371
|
return JSON.stringify(flags);
|
|
1372
1372
|
}
|
|
@@ -1392,22 +1392,435 @@ var AUTOMATION_SIM_IDLE_REAP_TTL_MS = 5 * 6e4;
|
|
|
1392
1392
|
|
|
1393
1393
|
// src/cli-runtime.ts
|
|
1394
1394
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
1395
|
-
var
|
|
1396
|
-
var
|
|
1395
|
+
var import_node_crypto2 = require("node:crypto");
|
|
1396
|
+
var import_node_fs6 = require("node:fs");
|
|
1397
1397
|
var import_node_module = require("node:module");
|
|
1398
|
-
var
|
|
1398
|
+
var import_node_path5 = require("node:path");
|
|
1399
1399
|
|
|
1400
1400
|
// ../contrast-runtime-delivery/src/index.ts
|
|
1401
1401
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
1402
|
+
var import_node_child_process3 = require("node:child_process");
|
|
1403
|
+
var import_node_crypto = __toESM(require("node:crypto"), 1);
|
|
1404
|
+
var import_node_fs4 = __toESM(require("node:fs"), 1);
|
|
1405
|
+
var import_node_os3 = __toESM(require("node:os"), 1);
|
|
1406
|
+
var import_node_path3 = __toESM(require("node:path"), 1);
|
|
1407
|
+
var import_node_stream2 = require("node:stream");
|
|
1408
|
+
var import_promises2 = require("node:stream/promises");
|
|
1409
|
+
var import_node_zlib = __toESM(require("node:zlib"), 1);
|
|
1402
1410
|
|
|
1403
1411
|
// src/process-group.ts
|
|
1404
1412
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
1413
|
+
var import_node_child_process2 = require("node:child_process");
|
|
1414
|
+
var import_node_fs2 = require("node:fs");
|
|
1415
|
+
var import_node_os2 = require("node:os");
|
|
1416
|
+
var import_node_path = require("node:path");
|
|
1417
|
+
var import_node_stream = require("node:stream");
|
|
1418
|
+
var import_promises = require("node:timers/promises");
|
|
1405
1419
|
|
|
1406
1420
|
// src/process-table.ts
|
|
1407
1421
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
1422
|
+
var import_node_child_process = require("node:child_process");
|
|
1423
|
+
var import_node_fs = require("node:fs");
|
|
1424
|
+
var import_node_os = require("node:os");
|
|
1425
|
+
function linuxClockTicks() {
|
|
1426
|
+
const auxv = (0, import_node_fs.readFileSync)("/proc/self/auxv");
|
|
1427
|
+
const word = (offset) => (0, import_node_os.endianness)() === "LE" ? auxv.readBigUInt64LE(offset) : auxv.readBigUInt64BE(offset);
|
|
1428
|
+
for (let offset = 0; offset + 16 <= auxv.length; offset += 16) {
|
|
1429
|
+
if (word(offset) !== 17n) continue;
|
|
1430
|
+
const ticks = Number(word(offset + 8));
|
|
1431
|
+
if (!Number.isSafeInteger(ticks) || ticks <= 0)
|
|
1432
|
+
throw new Error("unreadable process clock tick rate");
|
|
1433
|
+
return ticks;
|
|
1434
|
+
}
|
|
1435
|
+
throw new Error("missing process clock tick rate");
|
|
1436
|
+
}
|
|
1437
|
+
var clockTicks;
|
|
1438
|
+
function readProcessTable(timeoutMs = 1e4, pid) {
|
|
1439
|
+
if (process.platform === "linux") {
|
|
1440
|
+
clockTicks ??= linuxClockTicks();
|
|
1441
|
+
const boot = /^btime (\d+)$/m.exec((0, import_node_fs.readFileSync)("/proc/stat", "utf8"));
|
|
1442
|
+
if (!boot) throw new Error("unreadable process boot time");
|
|
1443
|
+
const bootMs = Number(boot[1]) * 1e3;
|
|
1444
|
+
const deadline = Date.now() + timeoutMs;
|
|
1445
|
+
const rows2 = [];
|
|
1446
|
+
const names = pid === void 0 ? (0, import_node_fs.readdirSync)("/proc") : [String(pid)];
|
|
1447
|
+
for (const name2 of names) {
|
|
1448
|
+
if (!/^\d+$/.test(name2)) continue;
|
|
1449
|
+
if (Date.now() >= deadline)
|
|
1450
|
+
throw new Error("process inspection exceeded its deadline");
|
|
1451
|
+
let stat;
|
|
1452
|
+
try {
|
|
1453
|
+
stat = (0, import_node_fs.readFileSync)(`/proc/${name2}/stat`, "utf8");
|
|
1454
|
+
} catch (error) {
|
|
1455
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") continue;
|
|
1456
|
+
throw error;
|
|
1457
|
+
}
|
|
1458
|
+
const fields = stat.slice(stat.lastIndexOf(")") + 2).trim().split(/\s+/);
|
|
1459
|
+
const pgid = Number(fields[2]);
|
|
1460
|
+
const ticks = Number(fields[19]);
|
|
1461
|
+
if (!fields[0] || !Number.isSafeInteger(pgid) || !Number.isSafeInteger(ticks))
|
|
1462
|
+
throw new Error(`unreadable process table row for ${name2}`);
|
|
1463
|
+
rows2.push({
|
|
1464
|
+
pid: Number(name2),
|
|
1465
|
+
pgid,
|
|
1466
|
+
zombie: fields[0] === "Z" || fields[0] === "X",
|
|
1467
|
+
start: bootMs + ticks * 1e3 / clockTicks
|
|
1468
|
+
});
|
|
1469
|
+
}
|
|
1470
|
+
return rows2;
|
|
1471
|
+
}
|
|
1472
|
+
const result = (0, import_node_child_process.spawnSync)(
|
|
1473
|
+
"ps",
|
|
1474
|
+
[
|
|
1475
|
+
...pid === void 0 ? ["-A"] : ["-p", String(pid)],
|
|
1476
|
+
"-o",
|
|
1477
|
+
"pid=,pgid=,stat=,lstart="
|
|
1478
|
+
],
|
|
1479
|
+
{
|
|
1480
|
+
encoding: "utf8",
|
|
1481
|
+
env: { ...process.env, LC_ALL: "C", TZ: "UTC" },
|
|
1482
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
1483
|
+
timeout: timeoutMs,
|
|
1484
|
+
killSignal: "SIGKILL"
|
|
1485
|
+
}
|
|
1486
|
+
);
|
|
1487
|
+
if (!result.error && pid !== void 0 && result.status === 1 && !result.stdout.trim() && !result.stderr.trim())
|
|
1488
|
+
return [];
|
|
1489
|
+
if (result.error || result.status !== 0)
|
|
1490
|
+
throw new Error(
|
|
1491
|
+
result.error?.message || result.stderr.trim() || `ps exited ${result.status}`
|
|
1492
|
+
);
|
|
1493
|
+
const rows = result.stdout.split("\n").filter((line) => line.trim()).map((line) => {
|
|
1494
|
+
const match = /^\s*(\d+)\s+(\d+)\s+(\S+)\s+(.+?)\s*$/.exec(line);
|
|
1495
|
+
if (!match) throw new Error(`unreadable process table row: ${line}`);
|
|
1496
|
+
const start = Date.parse(`${match[4]} UTC`);
|
|
1497
|
+
if (Number.isNaN(start))
|
|
1498
|
+
throw new Error(`unreadable process start time "${match[4]}"`);
|
|
1499
|
+
return {
|
|
1500
|
+
pid: Number(match[1]),
|
|
1501
|
+
pgid: Number(match[2]),
|
|
1502
|
+
zombie: match[3].startsWith("Z"),
|
|
1503
|
+
start
|
|
1504
|
+
};
|
|
1505
|
+
});
|
|
1506
|
+
return pid === void 0 ? rows : rows.filter((row) => row.pid === pid);
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1509
|
+
// src/process-group.ts
|
|
1510
|
+
var GRACEFUL_TIMEOUT_MS = 3e3;
|
|
1511
|
+
var FORCED_EXIT_TIMEOUT_MS = 1e3;
|
|
1512
|
+
var FREEZE_GUARD_NAME = "process-freeze-guard";
|
|
1513
|
+
function listProcessChildren(parents, timeoutMs = 3e3) {
|
|
1514
|
+
if (parents.some((pid) => !Number.isInteger(pid) || pid <= 1))
|
|
1515
|
+
throw new Error("process inspection requires valid parent pids");
|
|
1516
|
+
if (parents.length === 0) return [];
|
|
1517
|
+
const deadline = Date.now() + timeoutMs;
|
|
1518
|
+
let children;
|
|
1519
|
+
if (process.platform === "linux") {
|
|
1520
|
+
const lists = [];
|
|
1521
|
+
for (const parent of parents) {
|
|
1522
|
+
try {
|
|
1523
|
+
const tasks = `/proc/${parent}/task`;
|
|
1524
|
+
for (const thread of (0, import_node_fs2.readdirSync)(tasks)) {
|
|
1525
|
+
if (Date.now() >= deadline)
|
|
1526
|
+
throw new Error("process descendant inspection exceeded its deadline");
|
|
1527
|
+
try {
|
|
1528
|
+
lists.push((0, import_node_fs2.readFileSync)(`${tasks}/${thread}/children`, "utf8"));
|
|
1529
|
+
} catch (error) {
|
|
1530
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT"))
|
|
1531
|
+
throw error;
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
} catch (error) {
|
|
1535
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT"))
|
|
1536
|
+
throw error;
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
children = lists.join(" ");
|
|
1540
|
+
} else {
|
|
1541
|
+
const result = (0, import_node_child_process2.spawnSync)("pgrep", ["-P", parents.join(",")], {
|
|
1542
|
+
encoding: "utf8",
|
|
1543
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
1544
|
+
timeout: Math.max(1, timeoutMs),
|
|
1545
|
+
killSignal: "SIGKILL"
|
|
1546
|
+
});
|
|
1547
|
+
if (result.error || result.status !== 0 && result.status !== 1) {
|
|
1548
|
+
throw new Error(
|
|
1549
|
+
`could not inspect descendants of processes ${parents.join(",")}: ${result.error?.message || result.stderr.trim() || `pgrep exited ${result.status}`}`
|
|
1550
|
+
);
|
|
1551
|
+
}
|
|
1552
|
+
children = result.stdout;
|
|
1553
|
+
}
|
|
1554
|
+
return [...new Set(children.trim().split(/\s+/).map(Number))].filter(
|
|
1555
|
+
(pid) => Number.isInteger(pid) && pid > 1 && !parents.includes(pid)
|
|
1556
|
+
);
|
|
1557
|
+
}
|
|
1558
|
+
function signalProcessGroup(child, signal) {
|
|
1559
|
+
if (!child.pid) return;
|
|
1560
|
+
try {
|
|
1561
|
+
process.kill(-child.pid, signal);
|
|
1562
|
+
} catch {
|
|
1563
|
+
try {
|
|
1564
|
+
process.kill(child.pid, signal);
|
|
1565
|
+
} catch {
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
async function protectProcessFreeze(rootPid) {
|
|
1570
|
+
const directory = (0, import_node_fs2.mkdtempSync)((0, import_node_path.join)((0, import_node_os2.tmpdir)(), "peach-process-freeze-"));
|
|
1571
|
+
const journal = (0, import_node_path.join)(directory, "targets");
|
|
1572
|
+
(0, import_node_fs2.writeFileSync)(journal, `group ${rootPid}
|
|
1573
|
+
pid ${rootPid}
|
|
1574
|
+
`, { mode: 384 });
|
|
1575
|
+
const guard = (0, import_node_child_process2.spawn)(
|
|
1576
|
+
"/bin/sh",
|
|
1577
|
+
[
|
|
1578
|
+
"-c",
|
|
1579
|
+
`
|
|
1580
|
+
(
|
|
1581
|
+
journal=$1
|
|
1582
|
+
cleanup() {
|
|
1583
|
+
trap '' HUP INT TERM
|
|
1584
|
+
while read -r kind pid; do
|
|
1585
|
+
case $kind in
|
|
1586
|
+
group) target=-$pid ;;
|
|
1587
|
+
pid) target=$pid ;;
|
|
1588
|
+
*) continue ;;
|
|
1589
|
+
esac
|
|
1590
|
+
kill -TERM "$target" 2>/dev/null || :
|
|
1591
|
+
kill -CONT "$target" 2>/dev/null || :
|
|
1592
|
+
done < "$journal"
|
|
1593
|
+
}
|
|
1594
|
+
trap 'cleanup; exit 0' HUP INT TERM
|
|
1595
|
+
trap 'rm -f "$journal"; rmdir "\${journal%/*}"' EXIT
|
|
1596
|
+
printf 'ready
|
|
1597
|
+
'
|
|
1598
|
+
if ! IFS= read -r command <&3 || [ "$command" != disarm ]; then cleanup; fi
|
|
1599
|
+
) &
|
|
1600
|
+
`,
|
|
1601
|
+
FREEZE_GUARD_NAME,
|
|
1602
|
+
journal
|
|
1603
|
+
],
|
|
1604
|
+
{
|
|
1605
|
+
detached: true,
|
|
1606
|
+
// the launcher exits before capture, reparenting the guard outside any
|
|
1607
|
+
// nested target tree. fd 3 survives that exit, unlike child.stdin.
|
|
1608
|
+
stdio: ["ignore", "pipe", "ignore", "pipe"]
|
|
1609
|
+
}
|
|
1610
|
+
);
|
|
1611
|
+
let guardClosed = false;
|
|
1612
|
+
const closed = new Promise(
|
|
1613
|
+
(resolveClose) => guard.once("close", () => {
|
|
1614
|
+
guardClosed = true;
|
|
1615
|
+
resolveClose();
|
|
1616
|
+
})
|
|
1617
|
+
);
|
|
1618
|
+
const control = guard.stdio[3];
|
|
1619
|
+
const output = guard.stdout;
|
|
1620
|
+
if (!(control instanceof import_node_stream.Duplex) || !output) {
|
|
1621
|
+
guard.kill();
|
|
1622
|
+
await closed;
|
|
1623
|
+
(0, import_node_fs2.rmSync)(directory, { recursive: true, force: true });
|
|
1624
|
+
throw new Error("process freeze guard control pipe is unavailable");
|
|
1625
|
+
}
|
|
1626
|
+
control.on("error", () => {
|
|
1627
|
+
});
|
|
1628
|
+
try {
|
|
1629
|
+
await new Promise((resolveReady, reject) => {
|
|
1630
|
+
let readyOutput = "";
|
|
1631
|
+
let launcherExited = false;
|
|
1632
|
+
const ready = () => {
|
|
1633
|
+
if (launcherExited && readyOutput.includes("ready\n")) resolveReady();
|
|
1634
|
+
};
|
|
1635
|
+
output.on("data", (bytes) => {
|
|
1636
|
+
readyOutput += bytes.toString();
|
|
1637
|
+
ready();
|
|
1638
|
+
});
|
|
1639
|
+
guard.once("exit", (code, signal) => {
|
|
1640
|
+
if (code !== 0 || signal !== null) {
|
|
1641
|
+
reject(new Error("process freeze guard launcher failed"));
|
|
1642
|
+
return;
|
|
1643
|
+
}
|
|
1644
|
+
launcherExited = true;
|
|
1645
|
+
ready();
|
|
1646
|
+
});
|
|
1647
|
+
guard.once("error", reject);
|
|
1648
|
+
guard.once(
|
|
1649
|
+
"close",
|
|
1650
|
+
() => reject(new Error("process freeze guard exited before readiness"))
|
|
1651
|
+
);
|
|
1652
|
+
});
|
|
1653
|
+
} catch (error) {
|
|
1654
|
+
control.destroy();
|
|
1655
|
+
await closed;
|
|
1656
|
+
(0, import_node_fs2.rmSync)(directory, { recursive: true, force: true });
|
|
1657
|
+
throw error;
|
|
1658
|
+
}
|
|
1659
|
+
return {
|
|
1660
|
+
record(pid) {
|
|
1661
|
+
if (guardClosed || control.destroyed)
|
|
1662
|
+
throw new Error("process freeze guard exited during capture");
|
|
1663
|
+
(0, import_node_fs2.appendFileSync)(journal, `pid ${pid}
|
|
1664
|
+
`);
|
|
1665
|
+
},
|
|
1666
|
+
async release(disarm) {
|
|
1667
|
+
control.end(disarm ? "disarm\n" : void 0);
|
|
1668
|
+
await closed;
|
|
1669
|
+
(0, import_node_fs2.rmSync)(directory, { recursive: true, force: true });
|
|
1670
|
+
}
|
|
1671
|
+
};
|
|
1672
|
+
}
|
|
1673
|
+
function processesHaveExited(pids, pgid) {
|
|
1674
|
+
const mayExist = [-pgid, ...pids].some((target) => {
|
|
1675
|
+
try {
|
|
1676
|
+
process.kill(target, 0);
|
|
1677
|
+
return true;
|
|
1678
|
+
} catch (error) {
|
|
1679
|
+
return !(error instanceof Error && "code" in error && error.code === "ESRCH");
|
|
1680
|
+
}
|
|
1681
|
+
});
|
|
1682
|
+
if (!mayExist) return true;
|
|
1683
|
+
const knownPids = new Set(pids);
|
|
1684
|
+
try {
|
|
1685
|
+
return !readProcessTable(FORCED_EXIT_TIMEOUT_MS).some(
|
|
1686
|
+
(row) => (row.pgid === pgid || knownPids.has(row.pid)) && !row.zombie
|
|
1687
|
+
);
|
|
1688
|
+
} catch {
|
|
1689
|
+
return false;
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
function groupIsEmpty(pgid) {
|
|
1693
|
+
return processesHaveExited([], pgid);
|
|
1694
|
+
}
|
|
1695
|
+
async function waitForExit(pids, pgid, timeoutMs) {
|
|
1696
|
+
const deadline = Date.now() + timeoutMs;
|
|
1697
|
+
const gone = () => processesHaveExited(pids, pgid);
|
|
1698
|
+
while (Date.now() < deadline) {
|
|
1699
|
+
if (gone()) return true;
|
|
1700
|
+
await (0, import_promises.setTimeout)(50);
|
|
1701
|
+
}
|
|
1702
|
+
return gone();
|
|
1703
|
+
}
|
|
1704
|
+
async function terminateProcessGroup(child, signal = "SIGTERM", gracefulTimeoutMs = GRACEFUL_TIMEOUT_MS) {
|
|
1705
|
+
if (!child.pid) {
|
|
1706
|
+
try {
|
|
1707
|
+
child.kill(signal);
|
|
1708
|
+
} catch {
|
|
1709
|
+
}
|
|
1710
|
+
return;
|
|
1711
|
+
}
|
|
1712
|
+
if (child.exitCode !== null || child.signalCode !== null) {
|
|
1713
|
+
if (groupIsEmpty(child.pid)) return;
|
|
1714
|
+
}
|
|
1715
|
+
const freeze = await protectProcessFreeze(child.pid);
|
|
1716
|
+
const descendants = /* @__PURE__ */ new Set();
|
|
1717
|
+
let inspectionError = null;
|
|
1718
|
+
let signaled = false;
|
|
1719
|
+
let gracefulDeadline = 0;
|
|
1720
|
+
try {
|
|
1721
|
+
signalProcessGroup(child, "SIGSTOP");
|
|
1722
|
+
let parents = [child.pid];
|
|
1723
|
+
const inspectionDeadline = Date.now() + GRACEFUL_TIMEOUT_MS;
|
|
1724
|
+
while (parents.length > 0) {
|
|
1725
|
+
const remaining = inspectionDeadline - Date.now();
|
|
1726
|
+
if (remaining <= 0) {
|
|
1727
|
+
inspectionError = new Error("process descendant inspection exceeded its deadline");
|
|
1728
|
+
break;
|
|
1729
|
+
}
|
|
1730
|
+
let children;
|
|
1731
|
+
try {
|
|
1732
|
+
children = listProcessChildren(parents, remaining);
|
|
1733
|
+
} catch (error) {
|
|
1734
|
+
inspectionError = new Error(`could not inspect descendants: ${String(error)}`);
|
|
1735
|
+
break;
|
|
1736
|
+
}
|
|
1737
|
+
const next = [];
|
|
1738
|
+
for (const descendantPid of children) {
|
|
1739
|
+
if (!descendants.has(descendantPid)) {
|
|
1740
|
+
freeze.record(descendantPid);
|
|
1741
|
+
descendants.add(descendantPid);
|
|
1742
|
+
next.push(descendantPid);
|
|
1743
|
+
try {
|
|
1744
|
+
process.kill(descendantPid, "SIGSTOP");
|
|
1745
|
+
} catch {
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
}
|
|
1749
|
+
parents = next;
|
|
1750
|
+
}
|
|
1751
|
+
gracefulDeadline = Date.now() + gracefulTimeoutMs;
|
|
1752
|
+
try {
|
|
1753
|
+
process.kill(child.pid, signal);
|
|
1754
|
+
} catch {
|
|
1755
|
+
}
|
|
1756
|
+
signaled = true;
|
|
1757
|
+
} finally {
|
|
1758
|
+
signalProcessGroup(child, "SIGCONT");
|
|
1759
|
+
for (const pid of descendants) {
|
|
1760
|
+
try {
|
|
1761
|
+
process.kill(pid, "SIGCONT");
|
|
1762
|
+
} catch {
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
await freeze.release(signaled);
|
|
1766
|
+
}
|
|
1767
|
+
const pids = [child.pid, ...descendants];
|
|
1768
|
+
let rootExited = child.exitCode !== null || child.signalCode !== null;
|
|
1769
|
+
if (!rootExited) {
|
|
1770
|
+
rootExited = await new Promise((resolveExit) => {
|
|
1771
|
+
const onExit = () => {
|
|
1772
|
+
clearTimeout(deadlineTimer);
|
|
1773
|
+
resolveExit(true);
|
|
1774
|
+
};
|
|
1775
|
+
const deadlineTimer = setTimeout(
|
|
1776
|
+
() => {
|
|
1777
|
+
child.removeListener("exit", onExit);
|
|
1778
|
+
resolveExit(false);
|
|
1779
|
+
},
|
|
1780
|
+
Math.max(0, gracefulDeadline - Date.now())
|
|
1781
|
+
);
|
|
1782
|
+
child.once("exit", onExit);
|
|
1783
|
+
if (child.exitCode !== null || child.signalCode !== null) {
|
|
1784
|
+
child.removeListener("exit", onExit);
|
|
1785
|
+
onExit();
|
|
1786
|
+
}
|
|
1787
|
+
});
|
|
1788
|
+
}
|
|
1789
|
+
if (rootExited) {
|
|
1790
|
+
signalProcessGroup(child, signal);
|
|
1791
|
+
for (const pid of descendants) {
|
|
1792
|
+
try {
|
|
1793
|
+
process.kill(pid, signal);
|
|
1794
|
+
} catch {
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
if (await waitForExit(pids, child.pid, Math.max(0, gracefulDeadline - Date.now()))) {
|
|
1799
|
+
if (inspectionError) throw inspectionError;
|
|
1800
|
+
return;
|
|
1801
|
+
}
|
|
1802
|
+
for (const pid of pids) {
|
|
1803
|
+
try {
|
|
1804
|
+
process.kill(pid, "SIGKILL");
|
|
1805
|
+
} catch {
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
signalProcessGroup(child, "SIGKILL");
|
|
1809
|
+
const gone = await waitForExit(pids, child.pid, FORCED_EXIT_TIMEOUT_MS);
|
|
1810
|
+
if (!gone) {
|
|
1811
|
+
const survivors = new Error(
|
|
1812
|
+
`process group ${child.pid} exit could not be confirmed after SIGKILL`
|
|
1813
|
+
);
|
|
1814
|
+
if (!inspectionError) throw survivors;
|
|
1815
|
+
throw new Error(`${inspectionError.message}; ${survivors.message}`);
|
|
1816
|
+
}
|
|
1817
|
+
if (inspectionError) throw inspectionError;
|
|
1818
|
+
}
|
|
1408
1819
|
|
|
1409
1820
|
// ../contrast-runtime-delivery/src/product.ts
|
|
1410
1821
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
1822
|
+
var import_node_fs3 = __toESM(require("node:fs"), 1);
|
|
1823
|
+
var import_node_path2 = __toESM(require("node:path"), 1);
|
|
1411
1824
|
|
|
1412
1825
|
// ../contrast-runtime-delivery/src/version.ts
|
|
1413
1826
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -1415,8 +1828,562 @@ function isValidRuntimeVersion(value) {
|
|
|
1415
1828
|
return value.length <= 100 && /^[0-9A-Za-z][0-9A-Za-z._+-]*$/.test(value);
|
|
1416
1829
|
}
|
|
1417
1830
|
|
|
1831
|
+
// ../contrast-runtime-delivery/src/product.ts
|
|
1832
|
+
function listInstalledRuntimes(product) {
|
|
1833
|
+
try {
|
|
1834
|
+
return import_node_fs3.default.readdirSync(product.runtimesDir(), { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name).sort(compareSemver);
|
|
1835
|
+
} catch {
|
|
1836
|
+
return [];
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
function runtimeTarballCacheName(product, version) {
|
|
1840
|
+
return import_node_path2.default.posix.basename(product.tarballPath(version));
|
|
1841
|
+
}
|
|
1842
|
+
function compareSemver(a, b) {
|
|
1843
|
+
const parse7 = (v6) => {
|
|
1844
|
+
const hyphen = v6.indexOf("-");
|
|
1845
|
+
const core = hyphen >= 0 ? v6.slice(0, hyphen) : v6;
|
|
1846
|
+
const pre = hyphen >= 0 ? v6.slice(hyphen + 1) : "";
|
|
1847
|
+
const parts = core.split(".").map((n) => Number.parseInt(n, 10));
|
|
1848
|
+
if (parts.some((n) => !Number.isFinite(n))) return [[Number.POSITIVE_INFINITY], v6];
|
|
1849
|
+
return [parts, pre];
|
|
1850
|
+
};
|
|
1851
|
+
const [an, ap] = parse7(a);
|
|
1852
|
+
const [bn, bp] = parse7(b);
|
|
1853
|
+
for (let i = 0; i < Math.max(an.length, bn.length); i++) {
|
|
1854
|
+
const av = an[i] ?? 0;
|
|
1855
|
+
const bv = bn[i] ?? 0;
|
|
1856
|
+
if (av !== bv) return av - bv;
|
|
1857
|
+
}
|
|
1858
|
+
if (ap === bp) return 0;
|
|
1859
|
+
if (!ap) return 1;
|
|
1860
|
+
if (!bp) return -1;
|
|
1861
|
+
return ap < bp ? -1 : 1;
|
|
1862
|
+
}
|
|
1863
|
+
|
|
1864
|
+
// ../contrast-runtime-delivery/src/packs.ts
|
|
1865
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
1866
|
+
var RUNTIME_PACKS_FILE = "packs.json";
|
|
1867
|
+
var RUNTIME_PACK_MARKER = ".pack";
|
|
1868
|
+
var RUNTIME_PACK_PREFIXES = [
|
|
1869
|
+
"engine/fonts/emoji/",
|
|
1870
|
+
"engine/fonts/lang/",
|
|
1871
|
+
"engine/fonts/named/",
|
|
1872
|
+
"engine/fonts/vector-icons/",
|
|
1873
|
+
"engine/fonts/webview/",
|
|
1874
|
+
"engine/kotlin/",
|
|
1875
|
+
"engine/material-symbols/",
|
|
1876
|
+
"engine/pdfjs/",
|
|
1877
|
+
"three-mode/"
|
|
1878
|
+
];
|
|
1879
|
+
var RUNTIME_MERGE_PACK_DIR = "engine-tenant/";
|
|
1880
|
+
var RUNTIME_MERGE_PACK_INSTALL = ".pack-prod";
|
|
1881
|
+
var RUNTIME_MERGE_PACK_MERGED = ".merged";
|
|
1882
|
+
|
|
1883
|
+
// ../contrast-runtime-delivery/src/index.ts
|
|
1884
|
+
var DEFAULT_LOCAL_RUNTIME_RETENTION_COUNT = 2;
|
|
1885
|
+
function createRuntimeDelivery(product) {
|
|
1886
|
+
function readConfig2() {
|
|
1887
|
+
try {
|
|
1888
|
+
const parsed = JSON.parse(
|
|
1889
|
+
import_node_fs4.default.readFileSync(product.configFile(), "utf8")
|
|
1890
|
+
);
|
|
1891
|
+
return parsed && typeof parsed === "object" ? parsed : {};
|
|
1892
|
+
} catch {
|
|
1893
|
+
return {};
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
function resolveCdnOrigin(input) {
|
|
1897
|
+
const config = readConfig2();
|
|
1898
|
+
const value = input || process.env[product.env.cdnOrigin] || config.cdnOrigin || product.defaultCdnOrigin;
|
|
1899
|
+
return value.replace(/\/+$/, "");
|
|
1900
|
+
}
|
|
1901
|
+
function resolveChannel(input) {
|
|
1902
|
+
const config = readConfig2();
|
|
1903
|
+
return input || process.env[product.env.channel] || config.runtimeChannel || product.defaultChannel || "stable";
|
|
1904
|
+
}
|
|
1905
|
+
function resolvePin() {
|
|
1906
|
+
if (!product.env.pin) return null;
|
|
1907
|
+
const env = process.env[product.env.pin];
|
|
1908
|
+
if (env && env.trim()) return env.trim();
|
|
1909
|
+
const config = readConfig2();
|
|
1910
|
+
return typeof config.runtimeVersion === "string" && config.runtimeVersion.trim() ? config.runtimeVersion.trim() : null;
|
|
1911
|
+
}
|
|
1912
|
+
function manifestUrl(cdnOrigin) {
|
|
1913
|
+
const url = new URL(`${resolveCdnOrigin(cdnOrigin)}${product.manifestPath}`);
|
|
1914
|
+
url.searchParams.set("t", String(Date.now()));
|
|
1915
|
+
return url.toString();
|
|
1916
|
+
}
|
|
1917
|
+
function tarballUrl(version, cdnOrigin) {
|
|
1918
|
+
return `${resolveCdnOrigin(cdnOrigin)}${product.tarballPath(version)}`;
|
|
1919
|
+
}
|
|
1920
|
+
const UP_TO_DATE_CHECK_TIMEOUT_MS = 2e3;
|
|
1921
|
+
async function fetchManifest(cdnOrigin, timeoutMs) {
|
|
1922
|
+
const url = manifestUrl(cdnOrigin);
|
|
1923
|
+
const res = await fetch(url, {
|
|
1924
|
+
headers: { Accept: "application/json" },
|
|
1925
|
+
// an install is allowed to wait; a best-effort check is not. see
|
|
1926
|
+
// UP_TO_DATE_CHECK_TIMEOUT_MS.
|
|
1927
|
+
...timeoutMs ? { signal: AbortSignal.timeout(timeoutMs) } : {}
|
|
1928
|
+
});
|
|
1929
|
+
if (!res.ok) {
|
|
1930
|
+
throw new Error(`manifest fetch failed: ${res.status} ${res.statusText} (${url})`);
|
|
1931
|
+
}
|
|
1932
|
+
return await res.json();
|
|
1933
|
+
}
|
|
1934
|
+
function resolveVersion(manifest, opts = {}) {
|
|
1935
|
+
const channel = resolveChannel(opts.channel);
|
|
1936
|
+
const version = opts.version || resolvePin() || manifest.channels[channel]?.latest;
|
|
1937
|
+
if (!version) {
|
|
1938
|
+
throw new Error(
|
|
1939
|
+
`no version specified and channel '${channel}' has no latest entry in the manifest`
|
|
1940
|
+
);
|
|
1941
|
+
}
|
|
1942
|
+
if (!isValidRuntimeVersion(version)) {
|
|
1943
|
+
throw new Error(`invalid runtime version: ${version}`);
|
|
1944
|
+
}
|
|
1945
|
+
const entry = manifest.versions[version];
|
|
1946
|
+
if (!entry) {
|
|
1947
|
+
throw new Error(
|
|
1948
|
+
`version ${version} not found in manifest; available: ${Object.keys(manifest.versions).slice(-10).join(", ") || "(none)"}`
|
|
1949
|
+
);
|
|
1950
|
+
}
|
|
1951
|
+
return { version, channel, entry };
|
|
1952
|
+
}
|
|
1953
|
+
async function isVerifiedInstall(dir) {
|
|
1954
|
+
if (!import_node_fs4.default.existsSync(import_node_path3.default.join(dir, product.installedMarker))) return false;
|
|
1955
|
+
try {
|
|
1956
|
+
await product.verifyInstall?.(dir);
|
|
1957
|
+
return true;
|
|
1958
|
+
} catch {
|
|
1959
|
+
return false;
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1962
|
+
async function install(opts = {}) {
|
|
1963
|
+
product.ensureHome();
|
|
1964
|
+
const cdnOrigin = resolveCdnOrigin(opts.cdnOrigin);
|
|
1965
|
+
const manifest = await fetchManifest(cdnOrigin);
|
|
1966
|
+
const { version, channel, entry } = resolveVersion(manifest, opts);
|
|
1967
|
+
const destDir = product.runtimeDir(version);
|
|
1968
|
+
const setActive = opts.setActive !== false;
|
|
1969
|
+
const protectVersions = [version, ...opts.protectVersions ?? []];
|
|
1970
|
+
pruneLocalRetention({ protectVersions });
|
|
1971
|
+
if (!opts.force && await isVerifiedInstall(destDir)) {
|
|
1972
|
+
if (setActive) product.writeActiveRuntime(version);
|
|
1973
|
+
pruneLocalRetention({ protectVersions });
|
|
1974
|
+
return {
|
|
1975
|
+
version,
|
|
1976
|
+
channel,
|
|
1977
|
+
cdnOrigin,
|
|
1978
|
+
runtimeDir: destDir,
|
|
1979
|
+
installed: false,
|
|
1980
|
+
activated: setActive,
|
|
1981
|
+
manifest
|
|
1982
|
+
};
|
|
1983
|
+
}
|
|
1984
|
+
if (!opts.quiet)
|
|
1985
|
+
process.stderr.write(`${product.id}: downloading runtime ${version}\u2026
|
|
1986
|
+
`);
|
|
1987
|
+
await installVerifiedTarball({
|
|
1988
|
+
url: entry.tarball || tarballUrl(version, cdnOrigin),
|
|
1989
|
+
digest: { algorithm: "sha256", encoding: "hex", value: entry.sha256 },
|
|
1990
|
+
destDir,
|
|
1991
|
+
installedMarker: product.installedMarker,
|
|
1992
|
+
verify: product.verifyInstall,
|
|
1993
|
+
label: `runtime ${version}`
|
|
1994
|
+
});
|
|
1995
|
+
if (setActive) product.writeActiveRuntime(version);
|
|
1996
|
+
pruneLocalRetention({ protectVersions });
|
|
1997
|
+
return {
|
|
1998
|
+
version,
|
|
1999
|
+
channel,
|
|
2000
|
+
cdnOrigin,
|
|
2001
|
+
runtimeDir: destDir,
|
|
2002
|
+
installed: true,
|
|
2003
|
+
activated: setActive,
|
|
2004
|
+
manifest
|
|
2005
|
+
};
|
|
2006
|
+
}
|
|
2007
|
+
async function updateToLatest(opts = {}) {
|
|
2008
|
+
product.ensureHome();
|
|
2009
|
+
pruneLocalRetention({ protectVersions: opts.protectVersions });
|
|
2010
|
+
const cdnOrigin = resolveCdnOrigin(opts.cdnOrigin);
|
|
2011
|
+
const channel = resolveChannel(opts.channel);
|
|
2012
|
+
const pin = resolvePin();
|
|
2013
|
+
if (pin) {
|
|
2014
|
+
const activeVersion2 = product.readActiveRuntime();
|
|
2015
|
+
const pinInstalled = await isVerifiedInstall(product.runtimeDir(pin));
|
|
2016
|
+
if (activeVersion2 === pin && pinInstalled) {
|
|
2017
|
+
return {
|
|
2018
|
+
checked: true,
|
|
2019
|
+
updated: false,
|
|
2020
|
+
reason: `runtime is pinned to ${pin}`,
|
|
2021
|
+
activeVersion: activeVersion2,
|
|
2022
|
+
latestVersion: pin
|
|
2023
|
+
};
|
|
2024
|
+
}
|
|
2025
|
+
const installed2 = await install({
|
|
2026
|
+
version: pin,
|
|
2027
|
+
channel,
|
|
2028
|
+
cdnOrigin,
|
|
2029
|
+
setActive: false,
|
|
2030
|
+
protectVersions: opts.protectVersions
|
|
2031
|
+
});
|
|
2032
|
+
return {
|
|
2033
|
+
checked: true,
|
|
2034
|
+
updated: true,
|
|
2035
|
+
reason: `runtime is pinned to ${pin}`,
|
|
2036
|
+
activeVersion: pin,
|
|
2037
|
+
latestVersion: pin,
|
|
2038
|
+
install: installed2
|
|
2039
|
+
};
|
|
2040
|
+
}
|
|
2041
|
+
const manifest = await fetchManifest(cdnOrigin);
|
|
2042
|
+
const latestVersion = manifest.channels[channel]?.latest;
|
|
2043
|
+
if (!latestVersion) {
|
|
2044
|
+
return {
|
|
2045
|
+
checked: true,
|
|
2046
|
+
updated: false,
|
|
2047
|
+
reason: `channel '${channel}' has no latest runtime`,
|
|
2048
|
+
activeVersion: product.readActiveRuntime()
|
|
2049
|
+
};
|
|
2050
|
+
}
|
|
2051
|
+
const entry = manifest.versions[latestVersion];
|
|
2052
|
+
if (!entry) {
|
|
2053
|
+
return {
|
|
2054
|
+
checked: true,
|
|
2055
|
+
updated: false,
|
|
2056
|
+
reason: `manifest is missing version ${latestVersion}`,
|
|
2057
|
+
activeVersion: product.readActiveRuntime(),
|
|
2058
|
+
latestVersion
|
|
2059
|
+
};
|
|
2060
|
+
}
|
|
2061
|
+
const activeVersion = product.readActiveRuntime();
|
|
2062
|
+
const activeDir = activeVersion ? product.runtimeDir(activeVersion) : null;
|
|
2063
|
+
const activeInstalled = activeDir ? await isVerifiedInstall(activeDir) : false;
|
|
2064
|
+
const shouldInstall = !activeVersion || !activeInstalled || compareSemver(latestVersion, activeVersion) > 0;
|
|
2065
|
+
if (!shouldInstall) {
|
|
2066
|
+
return {
|
|
2067
|
+
checked: true,
|
|
2068
|
+
updated: false,
|
|
2069
|
+
reason: "active runtime is current",
|
|
2070
|
+
activeVersion,
|
|
2071
|
+
latestVersion
|
|
2072
|
+
};
|
|
2073
|
+
}
|
|
2074
|
+
const installed = await install({
|
|
2075
|
+
version: latestVersion,
|
|
2076
|
+
channel,
|
|
2077
|
+
cdnOrigin,
|
|
2078
|
+
setActive: false,
|
|
2079
|
+
protectVersions: opts.protectVersions
|
|
2080
|
+
});
|
|
2081
|
+
return {
|
|
2082
|
+
checked: true,
|
|
2083
|
+
updated: true,
|
|
2084
|
+
activeVersion: latestVersion,
|
|
2085
|
+
latestVersion,
|
|
2086
|
+
install: installed
|
|
2087
|
+
};
|
|
2088
|
+
}
|
|
2089
|
+
async function checkUpToDate(opts = {}) {
|
|
2090
|
+
const active = product.readActiveRuntime();
|
|
2091
|
+
const pinned = resolvePin();
|
|
2092
|
+
if (pinned) {
|
|
2093
|
+
return { active, latest: pinned, pinned, outdated: active !== pinned };
|
|
2094
|
+
}
|
|
2095
|
+
try {
|
|
2096
|
+
const manifest = await fetchManifest(
|
|
2097
|
+
resolveCdnOrigin(opts.cdnOrigin),
|
|
2098
|
+
UP_TO_DATE_CHECK_TIMEOUT_MS
|
|
2099
|
+
);
|
|
2100
|
+
const channel = resolveChannel(opts.channel);
|
|
2101
|
+
const latest = manifest.channels[channel]?.latest ?? null;
|
|
2102
|
+
const outdated = !!(latest && (!active || compareSemver(latest, active) > 0));
|
|
2103
|
+
return { active, latest, pinned: null, outdated };
|
|
2104
|
+
} catch {
|
|
2105
|
+
return { active, latest: null, pinned: null, outdated: false };
|
|
2106
|
+
}
|
|
2107
|
+
}
|
|
2108
|
+
function planLocalRetention(opts = {}) {
|
|
2109
|
+
product.ensureHome();
|
|
2110
|
+
const retainVersions = Math.max(
|
|
2111
|
+
1,
|
|
2112
|
+
Math.floor(opts.retainVersions ?? DEFAULT_LOCAL_RUNTIME_RETENTION_COUNT)
|
|
2113
|
+
);
|
|
2114
|
+
const installed = listInstalledRuntimes(product);
|
|
2115
|
+
const installedSet = new Set(installed);
|
|
2116
|
+
const activeVersion = product.readActiveRuntime();
|
|
2117
|
+
const pinnedVersion = resolvePin();
|
|
2118
|
+
const keep = /* @__PURE__ */ new Set();
|
|
2119
|
+
for (const version of [
|
|
2120
|
+
activeVersion,
|
|
2121
|
+
pinnedVersion,
|
|
2122
|
+
...opts.protectVersions ?? []
|
|
2123
|
+
]) {
|
|
2124
|
+
if (version && installedSet.has(version)) keep.add(version);
|
|
2125
|
+
}
|
|
2126
|
+
for (const version of [...installed].reverse()) {
|
|
2127
|
+
if (keep.size >= retainVersions) break;
|
|
2128
|
+
keep.add(version);
|
|
2129
|
+
}
|
|
2130
|
+
const cacheTemplateMarker = "__RUNTIME_VERSION__";
|
|
2131
|
+
const cacheTemplate = runtimeTarballCacheName(product, cacheTemplateMarker);
|
|
2132
|
+
const markerOffset = cacheTemplate.indexOf(cacheTemplateMarker);
|
|
2133
|
+
const cachePrefix = cacheTemplate.slice(0, markerOffset);
|
|
2134
|
+
const cacheSuffix = cacheTemplate.slice(markerOffset + cacheTemplateMarker.length);
|
|
2135
|
+
let removeCacheFiles = [];
|
|
2136
|
+
if (markerOffset >= 0) {
|
|
2137
|
+
try {
|
|
2138
|
+
removeCacheFiles = import_node_fs4.default.readdirSync(product.cacheDir(), { withFileTypes: true }).filter((entry) => {
|
|
2139
|
+
if (!entry.isFile()) return false;
|
|
2140
|
+
const complete = entry.name.startsWith(cachePrefix) && entry.name.endsWith(cacheSuffix);
|
|
2141
|
+
const partial = entry.name.startsWith(cachePrefix) && entry.name.endsWith(`${cacheSuffix}.partial`);
|
|
2142
|
+
return complete || partial;
|
|
2143
|
+
}).map((entry) => import_node_path3.default.join(product.cacheDir(), entry.name)).sort();
|
|
2144
|
+
} catch {
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
return {
|
|
2148
|
+
activeVersion,
|
|
2149
|
+
pinnedVersion,
|
|
2150
|
+
keepVersions: installed.filter((version) => keep.has(version)),
|
|
2151
|
+
removeVersions: installed.filter((version) => !keep.has(version)),
|
|
2152
|
+
removeCacheFiles
|
|
2153
|
+
};
|
|
2154
|
+
}
|
|
2155
|
+
function pruneLocalRetention(opts = {}) {
|
|
2156
|
+
const plan = planLocalRetention(opts);
|
|
2157
|
+
for (const version of plan.removeVersions) {
|
|
2158
|
+
import_node_fs4.default.rmSync(product.runtimeDir(version), { recursive: true, force: true });
|
|
2159
|
+
}
|
|
2160
|
+
for (const cacheFile of plan.removeCacheFiles) {
|
|
2161
|
+
import_node_fs4.default.rmSync(cacheFile, { force: true });
|
|
2162
|
+
}
|
|
2163
|
+
return plan;
|
|
2164
|
+
}
|
|
2165
|
+
return {
|
|
2166
|
+
product,
|
|
2167
|
+
resolveCdnOrigin,
|
|
2168
|
+
resolveChannel,
|
|
2169
|
+
resolvePin,
|
|
2170
|
+
manifestUrl,
|
|
2171
|
+
tarballUrl,
|
|
2172
|
+
fetchManifest,
|
|
2173
|
+
resolveVersion,
|
|
2174
|
+
install,
|
|
2175
|
+
updateToLatest,
|
|
2176
|
+
checkUpToDate,
|
|
2177
|
+
planLocalRetention,
|
|
2178
|
+
pruneLocalRetention,
|
|
2179
|
+
listInstalled: () => listInstalledRuntimes(product)
|
|
2180
|
+
};
|
|
2181
|
+
}
|
|
2182
|
+
async function installVerifiedTarball(tarball) {
|
|
2183
|
+
const { destDir, installedMarker, signal } = tarball;
|
|
2184
|
+
import_node_fs4.default.mkdirSync(import_node_path3.default.dirname(destDir), { recursive: true });
|
|
2185
|
+
const presentAtStart = import_node_fs4.default.existsSync(import_node_path3.default.join(destDir, installedMarker));
|
|
2186
|
+
const lock = `${destDir}.lock`;
|
|
2187
|
+
for (; ; ) {
|
|
2188
|
+
signal?.throwIfAborted();
|
|
2189
|
+
try {
|
|
2190
|
+
import_node_fs4.default.writeFileSync(lock, String(process.pid), { flag: "wx" });
|
|
2191
|
+
break;
|
|
2192
|
+
} catch (err) {
|
|
2193
|
+
if (!isErrnoCode(err, "EEXIST")) throw err;
|
|
2194
|
+
if (lockOwnerGone(lock)) import_node_fs4.default.rmSync(lock, { force: true });
|
|
2195
|
+
else await new Promise((resolve3) => setTimeout(resolve3, 250));
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
try {
|
|
2199
|
+
if (!presentAtStart && import_node_fs4.default.existsSync(import_node_path3.default.join(destDir, installedMarker))) {
|
|
2200
|
+
await tarball.verify?.(destDir);
|
|
2201
|
+
return;
|
|
2202
|
+
}
|
|
2203
|
+
await installVerifiedTarballLocked(tarball, presentAtStart);
|
|
2204
|
+
} finally {
|
|
2205
|
+
import_node_fs4.default.rmSync(lock, { force: true });
|
|
2206
|
+
}
|
|
2207
|
+
}
|
|
2208
|
+
function lockOwnerGone(lock) {
|
|
2209
|
+
try {
|
|
2210
|
+
process.kill(Number(import_node_fs4.default.readFileSync(lock, "utf8")), 0);
|
|
2211
|
+
return false;
|
|
2212
|
+
} catch (err) {
|
|
2213
|
+
return !isErrnoCode(err, "EPERM", "ENOENT");
|
|
2214
|
+
}
|
|
2215
|
+
}
|
|
2216
|
+
async function installVerifiedTarballLocked(tarball, presentAtStart) {
|
|
2217
|
+
const { url, digest, destDir, installedMarker, label, signal } = tarball;
|
|
2218
|
+
signal?.throwIfAborted();
|
|
2219
|
+
const downloadDir = import_node_fs4.default.mkdtempSync(import_node_path3.default.join(import_node_os3.default.tmpdir(), "runtime-delivery-download-"));
|
|
2220
|
+
const archivePath = import_node_path3.default.join(downloadDir, "archive");
|
|
2221
|
+
const tmpDir = import_node_fs4.default.mkdtempSync(
|
|
2222
|
+
import_node_path3.default.join(import_node_path3.default.dirname(destDir), `.installing-${import_node_path3.default.basename(destDir)}-`)
|
|
2223
|
+
);
|
|
2224
|
+
try {
|
|
2225
|
+
await downloadToFile(url, archivePath, signal);
|
|
2226
|
+
const actual = await digestFile(
|
|
2227
|
+
archivePath,
|
|
2228
|
+
digest.algorithm,
|
|
2229
|
+
digest.encoding,
|
|
2230
|
+
signal
|
|
2231
|
+
);
|
|
2232
|
+
if (actual !== digest.value) {
|
|
2233
|
+
throw new Error(
|
|
2234
|
+
`${digest.algorithm} mismatch for ${label}: expected ${digest.value}, actual ${actual}`
|
|
2235
|
+
);
|
|
2236
|
+
}
|
|
2237
|
+
const { pathname } = new URL(url);
|
|
2238
|
+
if (pathname.endsWith(".zip")) await extractZip(archivePath, tmpDir, signal);
|
|
2239
|
+
else
|
|
2240
|
+
await extractTarball(
|
|
2241
|
+
archivePath,
|
|
2242
|
+
pathname.endsWith(".tar.zst"),
|
|
2243
|
+
tmpDir,
|
|
2244
|
+
tarball.stripComponents ?? 0,
|
|
2245
|
+
signal
|
|
2246
|
+
);
|
|
2247
|
+
signal?.throwIfAborted();
|
|
2248
|
+
if (!import_node_fs4.default.existsSync(import_node_path3.default.join(tmpDir, installedMarker))) {
|
|
2249
|
+
throw new Error(`extracted tarball for ${label} is missing ${installedMarker}`);
|
|
2250
|
+
}
|
|
2251
|
+
await tarball.verify?.(tmpDir);
|
|
2252
|
+
signal?.throwIfAborted();
|
|
2253
|
+
try {
|
|
2254
|
+
import_node_fs4.default.renameSync(tmpDir, destDir);
|
|
2255
|
+
} catch (err) {
|
|
2256
|
+
if (!isErrnoCode(err, "ENOTEMPTY", "EEXIST")) throw err;
|
|
2257
|
+
if (!presentAtStart && import_node_fs4.default.existsSync(import_node_path3.default.join(destDir, installedMarker))) {
|
|
2258
|
+
await tarball.verify?.(destDir);
|
|
2259
|
+
return;
|
|
2260
|
+
}
|
|
2261
|
+
const aside = `${tmpDir}-replaced`;
|
|
2262
|
+
try {
|
|
2263
|
+
import_node_fs4.default.renameSync(destDir, aside);
|
|
2264
|
+
} catch (moveErr) {
|
|
2265
|
+
if (!isErrnoCode(moveErr, "ENOENT")) throw moveErr;
|
|
2266
|
+
}
|
|
2267
|
+
try {
|
|
2268
|
+
import_node_fs4.default.renameSync(tmpDir, destDir);
|
|
2269
|
+
} catch (landErr) {
|
|
2270
|
+
if (!isErrnoCode(landErr, "ENOTEMPTY", "EEXIST") || !import_node_fs4.default.existsSync(import_node_path3.default.join(destDir, installedMarker))) {
|
|
2271
|
+
throw landErr;
|
|
2272
|
+
}
|
|
2273
|
+
await tarball.verify?.(destDir);
|
|
2274
|
+
} finally {
|
|
2275
|
+
import_node_fs4.default.rmSync(aside, { recursive: true, force: true });
|
|
2276
|
+
}
|
|
2277
|
+
}
|
|
2278
|
+
} finally {
|
|
2279
|
+
import_node_fs4.default.rmSync(tmpDir, { recursive: true, force: true });
|
|
2280
|
+
import_node_fs4.default.rmSync(downloadDir, { recursive: true, force: true });
|
|
2281
|
+
}
|
|
2282
|
+
}
|
|
2283
|
+
function isErrnoCode(err, ...codes) {
|
|
2284
|
+
return err instanceof Error && "code" in err && codes.includes(String(err.code));
|
|
2285
|
+
}
|
|
2286
|
+
async function downloadToFile(url, destPath, signal) {
|
|
2287
|
+
const res = await fetch(url, { signal });
|
|
2288
|
+
if (!res.ok || !res.body) {
|
|
2289
|
+
throw new Error(`download failed: ${res.status} ${res.statusText} (${url})`);
|
|
2290
|
+
}
|
|
2291
|
+
import_node_fs4.default.mkdirSync(import_node_path3.default.dirname(destPath), { recursive: true });
|
|
2292
|
+
const tmp = `${destPath}.partial`;
|
|
2293
|
+
try {
|
|
2294
|
+
await (0, import_promises2.pipeline)(
|
|
2295
|
+
import_node_stream2.Readable.fromWeb(res.body),
|
|
2296
|
+
import_node_fs4.default.createWriteStream(tmp),
|
|
2297
|
+
{ signal }
|
|
2298
|
+
);
|
|
2299
|
+
signal?.throwIfAborted();
|
|
2300
|
+
import_node_fs4.default.renameSync(tmp, destPath);
|
|
2301
|
+
} catch (err) {
|
|
2302
|
+
try {
|
|
2303
|
+
import_node_fs4.default.unlinkSync(tmp);
|
|
2304
|
+
} catch {
|
|
2305
|
+
}
|
|
2306
|
+
throw err;
|
|
2307
|
+
}
|
|
2308
|
+
}
|
|
2309
|
+
async function digestFile(filePath, algorithm, encoding, signal) {
|
|
2310
|
+
const hash = import_node_crypto.default.createHash(algorithm);
|
|
2311
|
+
await (0, import_promises2.pipeline)(import_node_fs4.default.createReadStream(filePath), hash, { signal });
|
|
2312
|
+
return hash.digest(encoding);
|
|
2313
|
+
}
|
|
2314
|
+
function extractZip(zipPath, destDir, signal) {
|
|
2315
|
+
return runExtractor("ditto", ["-x", "-k", zipPath, destDir], signal);
|
|
2316
|
+
}
|
|
2317
|
+
async function extractTarball(tarPath, zstd, destDir, stripComponents, signal) {
|
|
2318
|
+
const args = [zstd ? "-xf" : "-xzf", "-"];
|
|
2319
|
+
if (stripComponents > 0) args.push(`--strip-components=${stripComponents}`);
|
|
2320
|
+
if (zstd) {
|
|
2321
|
+
const decoder = import_node_zlib.default.createZstdDecompress({
|
|
2322
|
+
params: { [import_node_zlib.default.constants.ZSTD_d_windowLogMax]: 30 }
|
|
2323
|
+
});
|
|
2324
|
+
await runExtractor("tar", args, signal, {
|
|
2325
|
+
cwd: destDir,
|
|
2326
|
+
stdin: (stdin) => (0, import_promises2.pipeline)(import_node_fs4.default.createReadStream(tarPath), decoder, stdin, { signal })
|
|
2327
|
+
});
|
|
2328
|
+
return;
|
|
2329
|
+
}
|
|
2330
|
+
const archive = import_node_fs4.default.openSync(tarPath, "r");
|
|
2331
|
+
try {
|
|
2332
|
+
await runExtractor("tar", args, signal, { cwd: destDir, stdin: archive });
|
|
2333
|
+
} finally {
|
|
2334
|
+
import_node_fs4.default.closeSync(archive);
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
async function runExtractor(command, args, signal, input) {
|
|
2338
|
+
signal?.throwIfAborted();
|
|
2339
|
+
const stdin = input?.stdin;
|
|
2340
|
+
const stdio = [
|
|
2341
|
+
typeof stdin === "function" ? "pipe" : stdin ?? "ignore",
|
|
2342
|
+
"inherit",
|
|
2343
|
+
"inherit"
|
|
2344
|
+
];
|
|
2345
|
+
const child = (0, import_node_child_process3.spawn)(command, args, {
|
|
2346
|
+
cwd: input?.cwd,
|
|
2347
|
+
stdio,
|
|
2348
|
+
detached: process.platform !== "win32"
|
|
2349
|
+
});
|
|
2350
|
+
const fed = typeof stdin === "function" && child.stdin ? stdin(child.stdin) : void 0;
|
|
2351
|
+
void fed?.catch(() => {
|
|
2352
|
+
});
|
|
2353
|
+
let stopping;
|
|
2354
|
+
const abort = () => {
|
|
2355
|
+
stopping ??= terminateProcessGroup(child, "SIGKILL", 0);
|
|
2356
|
+
void stopping.catch(() => {
|
|
2357
|
+
});
|
|
2358
|
+
};
|
|
2359
|
+
try {
|
|
2360
|
+
await new Promise((resolve3, reject) => {
|
|
2361
|
+
let failure;
|
|
2362
|
+
child.on("error", (error) => {
|
|
2363
|
+
failure = error;
|
|
2364
|
+
});
|
|
2365
|
+
child.on("close", (code) => {
|
|
2366
|
+
if (signal?.aborted) {
|
|
2367
|
+
const reason = signal.reason;
|
|
2368
|
+
reject(
|
|
2369
|
+
reason instanceof Error ? reason : new Error("Extraction canceled", { cause: reason })
|
|
2370
|
+
);
|
|
2371
|
+
} else if (failure) reject(failure);
|
|
2372
|
+
else if (code === 0) resolve3();
|
|
2373
|
+
else reject(new Error(`${command} exited with code ${code}`));
|
|
2374
|
+
});
|
|
2375
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
2376
|
+
if (signal?.aborted) abort();
|
|
2377
|
+
});
|
|
2378
|
+
await fed;
|
|
2379
|
+
} finally {
|
|
2380
|
+
signal?.removeEventListener("abort", abort);
|
|
2381
|
+
await stopping;
|
|
2382
|
+
}
|
|
2383
|
+
}
|
|
2384
|
+
|
|
1418
2385
|
// runtime-companion.json
|
|
1419
|
-
var runtime_companion_default = { abi: 1, sha256: "
|
|
2386
|
+
var runtime_companion_default = { abi: 1, sha256: "1c15d055a3e1e68a17d3f735cd1c592fdc418c85e781e44abf4f4aa0b1215b52", file: "node/cli-1c15d055a3e1e68a17d3f735cd1c592fdc418c85e781e44abf4f4aa0b1215b52.cjs" };
|
|
1420
2387
|
|
|
1421
2388
|
// src/answeredNativePackages.ts
|
|
1422
2389
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -1429,50 +2396,72 @@ var import_url = require("url");
|
|
|
1429
2396
|
|
|
1430
2397
|
// src/home-paths.ts
|
|
1431
2398
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
1432
|
-
var
|
|
1433
|
-
var
|
|
1434
|
-
var
|
|
2399
|
+
var import_node_fs5 = __toESM(require("node:fs"), 1);
|
|
2400
|
+
var import_node_os4 = require("node:os");
|
|
2401
|
+
var import_node_path4 = __toESM(require("node:path"), 1);
|
|
1435
2402
|
var PEACH_HOME_ENV = "PEACH_HOME";
|
|
1436
2403
|
var ACTIVE_RUNTIME_FILE = "active";
|
|
1437
2404
|
var DAEMON_LOCKFILE = "daemon.json";
|
|
2405
|
+
var CONFIG_FILE = "config.json";
|
|
1438
2406
|
var DAEMON_HEARTBEAT_STALE_MS = 3e4;
|
|
1439
2407
|
function ambientHomeDir() {
|
|
1440
|
-
return
|
|
2408
|
+
return import_node_path4.default.join((0, import_node_os4.homedir)(), ".peach");
|
|
1441
2409
|
}
|
|
1442
2410
|
function rnxHomeDir() {
|
|
1443
2411
|
const override = process.env[PEACH_HOME_ENV];
|
|
1444
|
-
return override && override.length > 0 ?
|
|
2412
|
+
return override && override.length > 0 ? import_node_path4.default.resolve(override) : ambientHomeDir();
|
|
1445
2413
|
}
|
|
1446
2414
|
function runtimesDir() {
|
|
1447
|
-
return
|
|
2415
|
+
return import_node_path4.default.join(rnxHomeDir(), "runtimes");
|
|
1448
2416
|
}
|
|
1449
2417
|
function runtimeDir(version) {
|
|
1450
|
-
return
|
|
2418
|
+
return import_node_path4.default.join(runtimesDir(), version);
|
|
1451
2419
|
}
|
|
1452
2420
|
function activeRuntimeFile() {
|
|
1453
|
-
return
|
|
2421
|
+
return import_node_path4.default.join(runtimesDir(), ACTIVE_RUNTIME_FILE);
|
|
2422
|
+
}
|
|
2423
|
+
function electronDir() {
|
|
2424
|
+
return import_node_path4.default.join(rnxHomeDir(), "electron");
|
|
2425
|
+
}
|
|
2426
|
+
function profilesDir() {
|
|
2427
|
+
return import_node_path4.default.join(rnxHomeDir(), "profiles");
|
|
1454
2428
|
}
|
|
1455
2429
|
function cacheDir() {
|
|
1456
|
-
return
|
|
2430
|
+
return import_node_path4.default.join(rnxHomeDir(), "cache");
|
|
1457
2431
|
}
|
|
1458
2432
|
function daemonLockfilePath() {
|
|
1459
|
-
return
|
|
2433
|
+
return import_node_path4.default.join(rnxHomeDir(), DAEMON_LOCKFILE);
|
|
2434
|
+
}
|
|
2435
|
+
function configFilePath() {
|
|
2436
|
+
return import_node_path4.default.join(rnxHomeDir(), CONFIG_FILE);
|
|
2437
|
+
}
|
|
2438
|
+
function ensureRnxHome() {
|
|
2439
|
+
import_node_fs5.default.mkdirSync(rnxHomeDir(), { recursive: true });
|
|
2440
|
+
import_node_fs5.default.mkdirSync(runtimesDir(), { recursive: true });
|
|
2441
|
+
import_node_fs5.default.mkdirSync(electronDir(), { recursive: true });
|
|
2442
|
+
import_node_fs5.default.mkdirSync(profilesDir(), { recursive: true });
|
|
2443
|
+
import_node_fs5.default.mkdirSync(cacheDir(), { recursive: true });
|
|
1460
2444
|
}
|
|
1461
2445
|
function readActiveRuntime() {
|
|
1462
2446
|
try {
|
|
1463
|
-
const value =
|
|
2447
|
+
const value = import_node_fs5.default.readFileSync(activeRuntimeFile(), "utf8").trim();
|
|
1464
2448
|
return value.length > 0 ? value : null;
|
|
1465
2449
|
} catch {
|
|
1466
2450
|
return null;
|
|
1467
2451
|
}
|
|
1468
2452
|
}
|
|
2453
|
+
function writeActiveRuntime(version) {
|
|
2454
|
+
import_node_fs5.default.mkdirSync(runtimesDir(), { recursive: true });
|
|
2455
|
+
import_node_fs5.default.writeFileSync(activeRuntimeFile(), `${version}
|
|
2456
|
+
`, "utf8");
|
|
2457
|
+
}
|
|
1469
2458
|
var DAEMON_LOCKFILE_MAX_BYTES = 16 * 1024;
|
|
1470
2459
|
function readDaemonLockfile() {
|
|
1471
2460
|
try {
|
|
1472
|
-
const fd =
|
|
2461
|
+
const fd = import_node_fs5.default.openSync(daemonLockfilePath(), "r");
|
|
1473
2462
|
try {
|
|
1474
2463
|
const buf = Buffer.alloc(DAEMON_LOCKFILE_MAX_BYTES);
|
|
1475
|
-
const bytesRead =
|
|
2464
|
+
const bytesRead = import_node_fs5.default.readSync(fd, buf, 0, DAEMON_LOCKFILE_MAX_BYTES, 0);
|
|
1476
2465
|
const raw = buf.subarray(0, bytesRead).toString("utf8");
|
|
1477
2466
|
const parsed = JSON.parse(raw);
|
|
1478
2467
|
if (parsed && parsed.schema === 1 && typeof parsed.pid === "number" && typeof parsed.bridgePort === "number" && typeof parsed.runtimePort === "number" && typeof parsed.startedAt === "number" && typeof parsed.heartbeatAt === "number" && (parsed.cliVersion === void 0 || typeof parsed.cliVersion === "string") && (parsed.servedRuntimes === void 0 || Array.isArray(parsed.servedRuntimes) && parsed.servedRuntimes.every((version) => typeof version === "string"))) {
|
|
@@ -1480,7 +2469,7 @@ function readDaemonLockfile() {
|
|
|
1480
2469
|
}
|
|
1481
2470
|
return null;
|
|
1482
2471
|
} finally {
|
|
1483
|
-
|
|
2472
|
+
import_node_fs5.default.closeSync(fd);
|
|
1484
2473
|
}
|
|
1485
2474
|
} catch {
|
|
1486
2475
|
return null;
|
|
@@ -1560,7 +2549,6 @@ var ROOT_RUNTIME_PATHS = [
|
|
|
1560
2549
|
"/fonts/",
|
|
1561
2550
|
"/icons/",
|
|
1562
2551
|
"/sounds/",
|
|
1563
|
-
"/spike/",
|
|
1564
2552
|
"/test-wallpaper.jpg",
|
|
1565
2553
|
"/preview-sw.js",
|
|
1566
2554
|
"/preview/guest-bridge-host.js",
|
|
@@ -1715,12 +2703,12 @@ function cliCompanionPath() {
|
|
|
1715
2703
|
return `node/cli-${runtime_companion_default.sha256}.cjs`;
|
|
1716
2704
|
}
|
|
1717
2705
|
function verifyCliCompanion(root) {
|
|
1718
|
-
verifyCompanionFile((0,
|
|
2706
|
+
verifyCompanionFile((0, import_node_path5.join)(root, cliCompanionPath()));
|
|
1719
2707
|
}
|
|
1720
2708
|
function verifyCompanionFile(file) {
|
|
1721
2709
|
let bytes;
|
|
1722
2710
|
try {
|
|
1723
|
-
bytes = (0,
|
|
2711
|
+
bytes = (0, import_node_fs6.readFileSync)(file);
|
|
1724
2712
|
} catch (error) {
|
|
1725
2713
|
if (error instanceof Error) {
|
|
1726
2714
|
const missing2 = "code" in error && error.code === "ENOENT" ? `; run \`peach runtime install\`, which fetches the companion this CLI published${process.platform === "win32" ? ", and check Windows Security protection history if it repeats" : ""}` : "";
|
|
@@ -1728,20 +2716,41 @@ function verifyCompanionFile(file) {
|
|
|
1728
2716
|
}
|
|
1729
2717
|
throw error;
|
|
1730
2718
|
}
|
|
1731
|
-
const hash = (0,
|
|
2719
|
+
const hash = (0, import_node_crypto2.createHash)("sha256").update(bytes).digest("hex");
|
|
1732
2720
|
if (hash !== runtime_companion_default.sha256) {
|
|
1733
2721
|
throw new Error(
|
|
1734
2722
|
"Peach runtime companion does not match this CLI; run `peach runtime install`"
|
|
1735
2723
|
);
|
|
1736
2724
|
}
|
|
1737
2725
|
}
|
|
2726
|
+
async function ensureCliCompanion(root) {
|
|
2727
|
+
const file = (0, import_node_path5.join)(root, cliCompanionPath());
|
|
2728
|
+
try {
|
|
2729
|
+
verifyCompanionFile(file);
|
|
2730
|
+
return;
|
|
2731
|
+
} catch (error) {
|
|
2732
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT"))
|
|
2733
|
+
throw error;
|
|
2734
|
+
}
|
|
2735
|
+
const staged = `${file}.${process.pid}`;
|
|
2736
|
+
try {
|
|
2737
|
+
await downloadToFile(
|
|
2738
|
+
`https://r2.rnxsim.com/rnx-cli/companions/cli-${runtime_companion_default.sha256}.cjs`,
|
|
2739
|
+
staged
|
|
2740
|
+
);
|
|
2741
|
+
verifyCompanionFile(staged);
|
|
2742
|
+
(0, import_node_fs6.renameSync)(staged, file);
|
|
2743
|
+
} finally {
|
|
2744
|
+
(0, import_node_fs6.rmSync)(staged, { force: true });
|
|
2745
|
+
}
|
|
2746
|
+
}
|
|
1738
2747
|
var loaded;
|
|
1739
2748
|
function getCliRuntime() {
|
|
1740
2749
|
if (loaded) return loaded.runtime;
|
|
1741
2750
|
const root = peachRuntimeRoot();
|
|
1742
2751
|
verifyCliCompanion(root);
|
|
1743
2752
|
const require2 = (0, import_node_module.createRequire)(__sootsim_import_meta_url);
|
|
1744
|
-
const runtime = require2((0,
|
|
2753
|
+
const runtime = require2((0, import_node_path5.join)(root, cliCompanionPath()));
|
|
1745
2754
|
if (runtime.cliCompanionAbi !== CLI_COMPANION_ABI) {
|
|
1746
2755
|
throw new Error(
|
|
1747
2756
|
"Incompatible Peach runtime companion ABI; run `peach runtime install`"
|
|
@@ -1753,10 +2762,10 @@ function getCliRuntime() {
|
|
|
1753
2762
|
|
|
1754
2763
|
// src/dev-server-open.ts
|
|
1755
2764
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
1756
|
-
var
|
|
1757
|
-
var
|
|
1758
|
-
var
|
|
1759
|
-
var
|
|
2765
|
+
var import_node_child_process4 = require("node:child_process");
|
|
2766
|
+
var import_node_crypto3 = require("node:crypto");
|
|
2767
|
+
var import_node_fs7 = __toESM(require("node:fs"), 1);
|
|
2768
|
+
var import_node_path6 = __toESM(require("node:path"), 1);
|
|
1760
2769
|
function resolveRnxDesktopAppName(open, projectRoot) {
|
|
1761
2770
|
if (!open) return null;
|
|
1762
2771
|
if (typeof open === "object") {
|
|
@@ -1764,8 +2773,8 @@ function resolveRnxDesktopAppName(open, projectRoot) {
|
|
|
1764
2773
|
if (!appName) throw new Error("peach: open.appName must not be empty");
|
|
1765
2774
|
return appName;
|
|
1766
2775
|
}
|
|
1767
|
-
const packageJsonPath =
|
|
1768
|
-
const packageJson = JSON.parse(
|
|
2776
|
+
const packageJsonPath = import_node_path6.default.join(projectRoot, "package.json");
|
|
2777
|
+
const packageJson = JSON.parse(import_node_fs7.default.readFileSync(packageJsonPath, "utf8"));
|
|
1769
2778
|
const packageName = packageJson && typeof packageJson === "object" ? Reflect.get(packageJson, "name") : void 0;
|
|
1770
2779
|
if (typeof packageName !== "string" || !packageName.trim()) {
|
|
1771
2780
|
throw new Error(`peach: ${packageJsonPath} must declare a package name`);
|
|
@@ -1779,7 +2788,7 @@ function tagRnxBundleForPlugin(bundleUrl, replacementOrigin, replacementToken, p
|
|
|
1779
2788
|
url.searchParams.set("rnxAppName", appName);
|
|
1780
2789
|
url.searchParams.set(
|
|
1781
2790
|
"rnxProjectId",
|
|
1782
|
-
(0,
|
|
2791
|
+
(0, import_node_crypto3.createHash)("sha256").update(import_node_fs7.default.realpathSync(projectRoot)).digest("hex").slice(0, 32)
|
|
1783
2792
|
);
|
|
1784
2793
|
}
|
|
1785
2794
|
url.searchParams.set("rnxReplacementOrigin", replacementOrigin);
|
|
@@ -1815,7 +2824,7 @@ function observeRnxDesktopLaunch(child, appName) {
|
|
|
1815
2824
|
}
|
|
1816
2825
|
function launchRnxDesktop(bundleUrl, appName) {
|
|
1817
2826
|
console.log(`[peach] opening ${appName} in the desktop simulator`);
|
|
1818
|
-
const child = (0,
|
|
2827
|
+
const child = (0, import_node_child_process4.spawn)("peach", buildRnxDesktopOpenArgs(bundleUrl), {
|
|
1819
2828
|
stdio: ["ignore", "ignore", "pipe"],
|
|
1820
2829
|
windowsHide: true
|
|
1821
2830
|
});
|
|
@@ -1827,7 +2836,7 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
1827
2836
|
var import_http = __toESM(require("http"), 1);
|
|
1828
2837
|
var import_https = __toESM(require("https"), 1);
|
|
1829
2838
|
var import_node_http2 = require("node:http2");
|
|
1830
|
-
var
|
|
2839
|
+
var import_promises6 = require("stream/promises");
|
|
1831
2840
|
|
|
1832
2841
|
// src/backend-origin.ts
|
|
1833
2842
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -1870,7 +2879,7 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
1870
2879
|
|
|
1871
2880
|
// src/expo-autolinking.ts
|
|
1872
2881
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
1873
|
-
var
|
|
2882
|
+
var import_node_child_process5 = require("node:child_process");
|
|
1874
2883
|
var import_node_util = require("node:util");
|
|
1875
2884
|
|
|
1876
2885
|
// src/forked-script-contract.ts
|
|
@@ -1878,7 +2887,7 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
1878
2887
|
var PEACH_FORKED_SCRIPT_ENV = "PEACH_RUNS_FORKED_SCRIPTS";
|
|
1879
2888
|
|
|
1880
2889
|
// src/expo-autolinking.ts
|
|
1881
|
-
var run = (0, import_node_util.promisify)(
|
|
2890
|
+
var run = (0, import_node_util.promisify)(import_node_child_process5.execFile);
|
|
1882
2891
|
|
|
1883
2892
|
// src/expo-native-prebuilt.ts
|
|
1884
2893
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -1895,21 +2904,21 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
1895
2904
|
|
|
1896
2905
|
// src/swift-objc-sdk-tree.ts
|
|
1897
2906
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
1898
|
-
var
|
|
1899
|
-
var
|
|
2907
|
+
var import_node_fs8 = require("node:fs");
|
|
2908
|
+
var import_node_path7 = __toESM(require("node:path"), 1);
|
|
1900
2909
|
function readIosSdkTree(root) {
|
|
1901
|
-
return (0,
|
|
1902
|
-
const file =
|
|
2910
|
+
return (0, import_node_fs8.readdirSync)(root, { recursive: true, withFileTypes: true }).filter((entry) => entry.isFile()).map((entry) => {
|
|
2911
|
+
const file = import_node_path7.default.join(entry.parentPath, entry.name);
|
|
1903
2912
|
return [
|
|
1904
|
-
|
|
1905
|
-
(0,
|
|
2913
|
+
import_node_path7.default.relative(root, file).split(import_node_path7.default.sep).join("/"),
|
|
2914
|
+
(0, import_node_fs8.readFileSync)(file, "utf8")
|
|
1906
2915
|
];
|
|
1907
2916
|
}).sort(([a], [b]) => a < b ? -1 : 1);
|
|
1908
2917
|
}
|
|
1909
2918
|
|
|
1910
2919
|
// src/swift-standin-digest.ts
|
|
1911
2920
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
1912
|
-
var STANDIN_SOURCE_DIGEST = true ? "
|
|
2921
|
+
var STANDIN_SOURCE_DIGEST = true ? "f077081111b09ca27482cd53be422dae6cd1bd3a5fd2b2bdef48a83a9c0d6ca8" : standinSourceDigest();
|
|
1913
2922
|
|
|
1914
2923
|
// src/expo-native-workspace.ts
|
|
1915
2924
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -1984,17 +2993,17 @@ function visit(node, visitor) {
|
|
|
1984
2993
|
visit.BREAK = BREAK;
|
|
1985
2994
|
visit.SKIP = SKIP;
|
|
1986
2995
|
visit.REMOVE = REMOVE;
|
|
1987
|
-
function visit_(key, node, visitor,
|
|
1988
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
2996
|
+
function visit_(key, node, visitor, path20) {
|
|
2997
|
+
const ctrl = callVisitor(key, node, visitor, path20);
|
|
1989
2998
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
1990
|
-
replaceNode(key,
|
|
1991
|
-
return visit_(key, ctrl, visitor,
|
|
2999
|
+
replaceNode(key, path20, ctrl);
|
|
3000
|
+
return visit_(key, ctrl, visitor, path20);
|
|
1992
3001
|
}
|
|
1993
3002
|
if (typeof ctrl !== "symbol") {
|
|
1994
3003
|
if (isCollection(node)) {
|
|
1995
|
-
|
|
3004
|
+
path20 = Object.freeze(path20.concat(node));
|
|
1996
3005
|
for (let i = 0; i < node.items.length; ++i) {
|
|
1997
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
3006
|
+
const ci = visit_(i, node.items[i], visitor, path20);
|
|
1998
3007
|
if (typeof ci === "number")
|
|
1999
3008
|
i = ci - 1;
|
|
2000
3009
|
else if (ci === BREAK)
|
|
@@ -2005,13 +3014,13 @@ function visit_(key, node, visitor, path17) {
|
|
|
2005
3014
|
}
|
|
2006
3015
|
}
|
|
2007
3016
|
} else if (isPair(node)) {
|
|
2008
|
-
|
|
2009
|
-
const ck = visit_("key", node.key, visitor,
|
|
3017
|
+
path20 = Object.freeze(path20.concat(node));
|
|
3018
|
+
const ck = visit_("key", node.key, visitor, path20);
|
|
2010
3019
|
if (ck === BREAK)
|
|
2011
3020
|
return BREAK;
|
|
2012
3021
|
else if (ck === REMOVE)
|
|
2013
3022
|
node.key = null;
|
|
2014
|
-
const cv = visit_("value", node.value, visitor,
|
|
3023
|
+
const cv = visit_("value", node.value, visitor, path20);
|
|
2015
3024
|
if (cv === BREAK)
|
|
2016
3025
|
return BREAK;
|
|
2017
3026
|
else if (cv === REMOVE)
|
|
@@ -2032,17 +3041,17 @@ async function visitAsync(node, visitor) {
|
|
|
2032
3041
|
visitAsync.BREAK = BREAK;
|
|
2033
3042
|
visitAsync.SKIP = SKIP;
|
|
2034
3043
|
visitAsync.REMOVE = REMOVE;
|
|
2035
|
-
async function visitAsync_(key, node, visitor,
|
|
2036
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
3044
|
+
async function visitAsync_(key, node, visitor, path20) {
|
|
3045
|
+
const ctrl = await callVisitor(key, node, visitor, path20);
|
|
2037
3046
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
2038
|
-
replaceNode(key,
|
|
2039
|
-
return visitAsync_(key, ctrl, visitor,
|
|
3047
|
+
replaceNode(key, path20, ctrl);
|
|
3048
|
+
return visitAsync_(key, ctrl, visitor, path20);
|
|
2040
3049
|
}
|
|
2041
3050
|
if (typeof ctrl !== "symbol") {
|
|
2042
3051
|
if (isCollection(node)) {
|
|
2043
|
-
|
|
3052
|
+
path20 = Object.freeze(path20.concat(node));
|
|
2044
3053
|
for (let i = 0; i < node.items.length; ++i) {
|
|
2045
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
3054
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path20);
|
|
2046
3055
|
if (typeof ci === "number")
|
|
2047
3056
|
i = ci - 1;
|
|
2048
3057
|
else if (ci === BREAK)
|
|
@@ -2053,13 +3062,13 @@ async function visitAsync_(key, node, visitor, path17) {
|
|
|
2053
3062
|
}
|
|
2054
3063
|
}
|
|
2055
3064
|
} else if (isPair(node)) {
|
|
2056
|
-
|
|
2057
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
3065
|
+
path20 = Object.freeze(path20.concat(node));
|
|
3066
|
+
const ck = await visitAsync_("key", node.key, visitor, path20);
|
|
2058
3067
|
if (ck === BREAK)
|
|
2059
3068
|
return BREAK;
|
|
2060
3069
|
else if (ck === REMOVE)
|
|
2061
3070
|
node.key = null;
|
|
2062
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
3071
|
+
const cv = await visitAsync_("value", node.value, visitor, path20);
|
|
2063
3072
|
if (cv === BREAK)
|
|
2064
3073
|
return BREAK;
|
|
2065
3074
|
else if (cv === REMOVE)
|
|
@@ -2086,23 +3095,23 @@ function initVisitor(visitor) {
|
|
|
2086
3095
|
}
|
|
2087
3096
|
return visitor;
|
|
2088
3097
|
}
|
|
2089
|
-
function callVisitor(key, node, visitor,
|
|
3098
|
+
function callVisitor(key, node, visitor, path20) {
|
|
2090
3099
|
if (typeof visitor === "function")
|
|
2091
|
-
return visitor(key, node,
|
|
3100
|
+
return visitor(key, node, path20);
|
|
2092
3101
|
if (isMap(node))
|
|
2093
|
-
return visitor.Map?.(key, node,
|
|
3102
|
+
return visitor.Map?.(key, node, path20);
|
|
2094
3103
|
if (isSeq(node))
|
|
2095
|
-
return visitor.Seq?.(key, node,
|
|
3104
|
+
return visitor.Seq?.(key, node, path20);
|
|
2096
3105
|
if (isPair(node))
|
|
2097
|
-
return visitor.Pair?.(key, node,
|
|
3106
|
+
return visitor.Pair?.(key, node, path20);
|
|
2098
3107
|
if (isScalar(node))
|
|
2099
|
-
return visitor.Scalar?.(key, node,
|
|
3108
|
+
return visitor.Scalar?.(key, node, path20);
|
|
2100
3109
|
if (isAlias(node))
|
|
2101
|
-
return visitor.Alias?.(key, node,
|
|
3110
|
+
return visitor.Alias?.(key, node, path20);
|
|
2102
3111
|
return void 0;
|
|
2103
3112
|
}
|
|
2104
|
-
function replaceNode(key,
|
|
2105
|
-
const parent =
|
|
3113
|
+
function replaceNode(key, path20, node) {
|
|
3114
|
+
const parent = path20[path20.length - 1];
|
|
2106
3115
|
if (isCollection(parent)) {
|
|
2107
3116
|
parent.items[key] = node;
|
|
2108
3117
|
} else if (isPair(parent)) {
|
|
@@ -2172,8 +3181,8 @@ var Directives = class _Directives {
|
|
|
2172
3181
|
this.atNextDocument = false;
|
|
2173
3182
|
}
|
|
2174
3183
|
const parts = line.trim().split(/[ \t]+/);
|
|
2175
|
-
const
|
|
2176
|
-
switch (
|
|
3184
|
+
const name2 = parts.shift();
|
|
3185
|
+
switch (name2) {
|
|
2177
3186
|
case "%TAG": {
|
|
2178
3187
|
if (parts.length !== 2) {
|
|
2179
3188
|
onError(0, "%TAG directive should contain exactly two parts");
|
|
@@ -2201,7 +3210,7 @@ var Directives = class _Directives {
|
|
|
2201
3210
|
}
|
|
2202
3211
|
}
|
|
2203
3212
|
default:
|
|
2204
|
-
onError(0, `Unknown directive ${
|
|
3213
|
+
onError(0, `Unknown directive ${name2}`, true);
|
|
2205
3214
|
return false;
|
|
2206
3215
|
}
|
|
2207
3216
|
}
|
|
@@ -2601,10 +3610,10 @@ function createNode(value, tagName, ctx) {
|
|
|
2601
3610
|
}
|
|
2602
3611
|
|
|
2603
3612
|
// ../../node_modules/yaml/browser/dist/nodes/Collection.js
|
|
2604
|
-
function collectionFromPath(schema4,
|
|
3613
|
+
function collectionFromPath(schema4, path20, value) {
|
|
2605
3614
|
let v6 = value;
|
|
2606
|
-
for (let i =
|
|
2607
|
-
const k =
|
|
3615
|
+
for (let i = path20.length - 1; i >= 0; --i) {
|
|
3616
|
+
const k = path20[i];
|
|
2608
3617
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
2609
3618
|
const a = [];
|
|
2610
3619
|
a[k] = v6;
|
|
@@ -2623,7 +3632,7 @@ function collectionFromPath(schema4, path17, value) {
|
|
|
2623
3632
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
2624
3633
|
});
|
|
2625
3634
|
}
|
|
2626
|
-
var isEmptyPath = (
|
|
3635
|
+
var isEmptyPath = (path20) => path20 == null || typeof path20 === "object" && !!path20[Symbol.iterator]().next().done;
|
|
2627
3636
|
var Collection = class extends NodeBase {
|
|
2628
3637
|
constructor(type, schema4) {
|
|
2629
3638
|
super(type);
|
|
@@ -2653,11 +3662,11 @@ var Collection = class extends NodeBase {
|
|
|
2653
3662
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
2654
3663
|
* that already exists in the map.
|
|
2655
3664
|
*/
|
|
2656
|
-
addIn(
|
|
2657
|
-
if (isEmptyPath(
|
|
3665
|
+
addIn(path20, value) {
|
|
3666
|
+
if (isEmptyPath(path20))
|
|
2658
3667
|
this.add(value);
|
|
2659
3668
|
else {
|
|
2660
|
-
const [key, ...rest] =
|
|
3669
|
+
const [key, ...rest] = path20;
|
|
2661
3670
|
const node = this.get(key, true);
|
|
2662
3671
|
if (isCollection(node))
|
|
2663
3672
|
node.addIn(rest, value);
|
|
@@ -2671,8 +3680,8 @@ var Collection = class extends NodeBase {
|
|
|
2671
3680
|
* Removes a value from the collection.
|
|
2672
3681
|
* @returns `true` if the item was found and removed.
|
|
2673
3682
|
*/
|
|
2674
|
-
deleteIn(
|
|
2675
|
-
const [key, ...rest] =
|
|
3683
|
+
deleteIn(path20) {
|
|
3684
|
+
const [key, ...rest] = path20;
|
|
2676
3685
|
if (rest.length === 0)
|
|
2677
3686
|
return this.delete(key);
|
|
2678
3687
|
const node = this.get(key, true);
|
|
@@ -2686,8 +3695,8 @@ var Collection = class extends NodeBase {
|
|
|
2686
3695
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
2687
3696
|
* `true` (collections are always returned intact).
|
|
2688
3697
|
*/
|
|
2689
|
-
getIn(
|
|
2690
|
-
const [key, ...rest] =
|
|
3698
|
+
getIn(path20, keepScalar) {
|
|
3699
|
+
const [key, ...rest] = path20;
|
|
2691
3700
|
const node = this.get(key, true);
|
|
2692
3701
|
if (rest.length === 0)
|
|
2693
3702
|
return !keepScalar && isScalar(node) ? node.value : node;
|
|
@@ -2705,8 +3714,8 @@ var Collection = class extends NodeBase {
|
|
|
2705
3714
|
/**
|
|
2706
3715
|
* Checks if the collection includes a value with the key `key`.
|
|
2707
3716
|
*/
|
|
2708
|
-
hasIn(
|
|
2709
|
-
const [key, ...rest] =
|
|
3717
|
+
hasIn(path20) {
|
|
3718
|
+
const [key, ...rest] = path20;
|
|
2710
3719
|
if (rest.length === 0)
|
|
2711
3720
|
return this.has(key);
|
|
2712
3721
|
const node = this.get(key, true);
|
|
@@ -2716,8 +3725,8 @@ var Collection = class extends NodeBase {
|
|
|
2716
3725
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
2717
3726
|
* boolean to add/remove the item from the set.
|
|
2718
3727
|
*/
|
|
2719
|
-
setIn(
|
|
2720
|
-
const [key, ...rest] =
|
|
3728
|
+
setIn(path20, value) {
|
|
3729
|
+
const [key, ...rest] = path20;
|
|
2721
3730
|
if (rest.length === 0) {
|
|
2722
3731
|
this.set(key, value);
|
|
2723
3732
|
} else {
|
|
@@ -3222,8 +4231,8 @@ function getTagObject(tags, item) {
|
|
|
3222
4231
|
tagObj = tags.find((t) => t.nodeClass && obj instanceof t.nodeClass);
|
|
3223
4232
|
}
|
|
3224
4233
|
if (!tagObj) {
|
|
3225
|
-
const
|
|
3226
|
-
throw new Error(`Tag not resolved for ${
|
|
4234
|
+
const name2 = obj?.constructor?.name ?? (obj === null ? "null" : typeof obj);
|
|
4235
|
+
throw new Error(`Tag not resolved for ${name2} value`);
|
|
3227
4236
|
}
|
|
3228
4237
|
return tagObj;
|
|
3229
4238
|
}
|
|
@@ -4306,9 +5315,9 @@ function visit2(cst, visitor) {
|
|
|
4306
5315
|
visit2.BREAK = BREAK2;
|
|
4307
5316
|
visit2.SKIP = SKIP2;
|
|
4308
5317
|
visit2.REMOVE = REMOVE2;
|
|
4309
|
-
visit2.itemAtPath = (cst,
|
|
5318
|
+
visit2.itemAtPath = (cst, path20) => {
|
|
4310
5319
|
let item = cst;
|
|
4311
|
-
for (const [field, index] of
|
|
5320
|
+
for (const [field, index] of path20) {
|
|
4312
5321
|
const tok = item?.[field];
|
|
4313
5322
|
if (tok && "items" in tok) {
|
|
4314
5323
|
item = tok.items[index];
|
|
@@ -4317,23 +5326,23 @@ visit2.itemAtPath = (cst, path17) => {
|
|
|
4317
5326
|
}
|
|
4318
5327
|
return item;
|
|
4319
5328
|
};
|
|
4320
|
-
visit2.parentCollection = (cst,
|
|
4321
|
-
const parent = visit2.itemAtPath(cst,
|
|
4322
|
-
const field =
|
|
5329
|
+
visit2.parentCollection = (cst, path20) => {
|
|
5330
|
+
const parent = visit2.itemAtPath(cst, path20.slice(0, -1));
|
|
5331
|
+
const field = path20[path20.length - 1][0];
|
|
4323
5332
|
const coll = parent?.[field];
|
|
4324
5333
|
if (coll && "items" in coll)
|
|
4325
5334
|
return coll;
|
|
4326
5335
|
throw new Error("Parent collection not found");
|
|
4327
5336
|
};
|
|
4328
|
-
function _visit(
|
|
4329
|
-
let ctrl = visitor(item,
|
|
5337
|
+
function _visit(path20, item, visitor) {
|
|
5338
|
+
let ctrl = visitor(item, path20);
|
|
4330
5339
|
if (typeof ctrl === "symbol")
|
|
4331
5340
|
return ctrl;
|
|
4332
5341
|
for (const field of ["key", "value"]) {
|
|
4333
5342
|
const token = item[field];
|
|
4334
5343
|
if (token && "items" in token) {
|
|
4335
5344
|
for (let i = 0; i < token.items.length; ++i) {
|
|
4336
|
-
const ci = _visit(Object.freeze(
|
|
5345
|
+
const ci = _visit(Object.freeze(path20.concat([[field, i]])), token.items[i], visitor);
|
|
4337
5346
|
if (typeof ci === "number")
|
|
4338
5347
|
i = ci - 1;
|
|
4339
5348
|
else if (ci === BREAK2)
|
|
@@ -4344,10 +5353,10 @@ function _visit(path17, item, visitor) {
|
|
|
4344
5353
|
}
|
|
4345
5354
|
}
|
|
4346
5355
|
if (typeof ctrl === "function" && field === "key")
|
|
4347
|
-
ctrl = ctrl(item,
|
|
5356
|
+
ctrl = ctrl(item, path20);
|
|
4348
5357
|
}
|
|
4349
5358
|
}
|
|
4350
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
5359
|
+
return typeof ctrl === "function" ? ctrl(item, path20) : ctrl;
|
|
4351
5360
|
}
|
|
4352
5361
|
|
|
4353
5362
|
// ../../node_modules/yaml/browser/dist/parse/lexer.js
|
|
@@ -4469,7 +5478,7 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
4469
5478
|
|
|
4470
5479
|
// src/swift-binary-modules.ts
|
|
4471
5480
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
4472
|
-
var
|
|
5481
|
+
var import_node_path8 = __toESM(require("node:path"), 1);
|
|
4473
5482
|
|
|
4474
5483
|
// src/swift-package.ts
|
|
4475
5484
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -4498,16 +5507,16 @@ var SWIFT_NATIVE_SOURCE_EXTENSIONS = [
|
|
|
4498
5507
|
];
|
|
4499
5508
|
|
|
4500
5509
|
// src/swift-binary-modules.ts
|
|
4501
|
-
var cacheDir2 =
|
|
5510
|
+
var cacheDir2 = import_node_path8.default.join(cacheDir(), "swift-binary-modules");
|
|
4502
5511
|
|
|
4503
5512
|
// src/swift-coverage/xcode-assets.ts
|
|
4504
5513
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
4505
5514
|
|
|
4506
5515
|
// src/swift-coverage/provenance.ts
|
|
4507
5516
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
4508
|
-
var
|
|
4509
|
-
var
|
|
4510
|
-
var
|
|
5517
|
+
var import_node_crypto4 = require("node:crypto");
|
|
5518
|
+
var import_node_fs9 = require("node:fs");
|
|
5519
|
+
var import_node_path9 = require("node:path");
|
|
4511
5520
|
var SWIFT_COVERAGE_DIGEST_SOURCES = [
|
|
4512
5521
|
"swift-coverage/indexdump.ts",
|
|
4513
5522
|
"swift-coverage/indexing.ts",
|
|
@@ -4537,11 +5546,11 @@ function swiftCoverageSourceDigests(srcDir) {
|
|
|
4537
5546
|
return Object.fromEntries(
|
|
4538
5547
|
SWIFT_COVERAGE_DIGEST_SOURCES.map((file) => [
|
|
4539
5548
|
file,
|
|
4540
|
-
(0,
|
|
5549
|
+
(0, import_node_crypto4.createHash)("sha256").update((0, import_node_fs9.readFileSync)((0, import_node_path9.join)(srcDir, file))).digest("hex")
|
|
4541
5550
|
])
|
|
4542
5551
|
);
|
|
4543
5552
|
}
|
|
4544
|
-
var swiftCoverageProvenance = typeof define_SWIFT_COVERAGE_SOURCE_DIGESTS_default === "object" ? define_SWIFT_COVERAGE_SOURCE_DIGESTS_default : swiftCoverageSourceDigests((0,
|
|
5553
|
+
var swiftCoverageProvenance = typeof define_SWIFT_COVERAGE_SOURCE_DIGESTS_default === "object" ? define_SWIFT_COVERAGE_SOURCE_DIGESTS_default : swiftCoverageSourceDigests((0, import_node_path9.join)(__sootsim_import_meta_dirname, ".."));
|
|
4545
5554
|
|
|
4546
5555
|
// src/swift-coverage/xcode-asset-symbols.ts
|
|
4547
5556
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -4727,8 +5736,8 @@ var assetSymbolSettingKeys = [
|
|
|
4727
5736
|
|
|
4728
5737
|
// src/swift-package-manifest.ts
|
|
4729
5738
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
4730
|
-
var
|
|
4731
|
-
var
|
|
5739
|
+
var import_node_child_process7 = require("node:child_process");
|
|
5740
|
+
var import_node_path12 = __toESM(require("node:path"), 1);
|
|
4732
5741
|
var import_node_util3 = require("node:util");
|
|
4733
5742
|
|
|
4734
5743
|
// src/swift-distribution.ts
|
|
@@ -4758,12 +5767,12 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
4758
5767
|
|
|
4759
5768
|
// src/swift-toolchain.ts
|
|
4760
5769
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
4761
|
-
var
|
|
4762
|
-
var
|
|
5770
|
+
var import_node_fs10 = __toESM(require("node:fs"), 1);
|
|
5771
|
+
var import_node_path10 = __toESM(require("node:path"), 1);
|
|
4763
5772
|
function peachsimPackageRoot() {
|
|
4764
5773
|
let dir = __sootsim_import_meta_dirname;
|
|
4765
|
-
while (!
|
|
4766
|
-
dir =
|
|
5774
|
+
while (!import_node_fs10.default.existsSync(import_node_path10.default.join(dir, "package.json")) && dir !== import_node_path10.default.dirname(dir))
|
|
5775
|
+
dir = import_node_path10.default.dirname(dir);
|
|
4767
5776
|
return dir;
|
|
4768
5777
|
}
|
|
4769
5778
|
var SWIFT_HOST_COMPILER_RELEASE = "swift-6.4.0-RELEASE-custom-81b2c791c27276bf";
|
|
@@ -4992,17 +6001,17 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
4992
6001
|
|
|
4993
6002
|
// src/swift-objc-standin.ts
|
|
4994
6003
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
4995
|
-
var
|
|
6004
|
+
var import_node_crypto5 = require("node:crypto");
|
|
4996
6005
|
|
|
4997
6006
|
// src/swift-interface-bodies.ts
|
|
4998
6007
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
4999
6008
|
|
|
5000
6009
|
// src/swift-objc-sdk.ts
|
|
5001
6010
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
5002
|
-
var
|
|
6011
|
+
var import_node_path11 = __toESM(require("node:path"), 1);
|
|
5003
6012
|
var IOS_SDK_TARGET = "arm64-apple-ios16.0-simulator";
|
|
5004
6013
|
var OVERLAY_PATH = /^usr\/lib\/swift\/([^/]+)\.swiftmodule\/arm64-apple-ios-simulator\.swiftinterface$/;
|
|
5005
|
-
var tree = typeof __PEACH_BUNDLED_IOS_SDK__ === "undefined" ? readIosSdkTree(
|
|
6014
|
+
var tree = typeof __PEACH_BUNDLED_IOS_SDK__ === "undefined" ? readIosSdkTree(import_node_path11.default.join(peachsimPackageRoot(), "sdk", "ios")) : Object.entries(__PEACH_BUNDLED_IOS_SDK__).sort(([a], [b]) => a < b ? -1 : 1);
|
|
5006
6015
|
var IOS_SDK_HEADERS = {};
|
|
5007
6016
|
var IOS_SDK_OVERLAYS = {};
|
|
5008
6017
|
for (const [file, text] of tree) {
|
|
@@ -5029,7 +6038,7 @@ var WASI_EMULATION = [
|
|
|
5029
6038
|
"_WASI_EMULATED_MMAN",
|
|
5030
6039
|
"_WASI_EMULATED_PROCESS_CLOCKS"
|
|
5031
6040
|
];
|
|
5032
|
-
var WASI_EMULATION_FLAGS = WASI_EMULATION.map((
|
|
6041
|
+
var WASI_EMULATION_FLAGS = WASI_EMULATION.map((name2) => `-D${name2}`);
|
|
5033
6042
|
var NATIVE_GRAPH_INPUTS = {
|
|
5034
6043
|
sdk: NATIVE_GRAPH_SDK_VERSION,
|
|
5035
6044
|
settings: "e68503e5e534e9194af5efe8c636ca8b824e2d8237c5f38ec84aa4d155bc8418",
|
|
@@ -5037,7 +6046,7 @@ var NATIVE_GRAPH_INPUTS = {
|
|
|
5037
6046
|
compiler: "Apple Swift version 6.4 (swiftlang-6.4.0.34.1 clang-2100.3.34.1)",
|
|
5038
6047
|
target: IOS_SDK_TARGET
|
|
5039
6048
|
};
|
|
5040
|
-
var NATIVE_GRAPH_ID = (0,
|
|
6049
|
+
var NATIVE_GRAPH_ID = (0, import_node_crypto5.createHash)("sha256").update(JSON.stringify(NATIVE_GRAPH_INPUTS)).digest("hex");
|
|
5041
6050
|
|
|
5042
6051
|
// src/swift-shared-sdk.ts
|
|
5043
6052
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -5203,7 +6212,7 @@ var SWIFTUI_WRAPPER_HOST_PROTOCOLS = new Set(
|
|
|
5203
6212
|
"ToolbarContent",
|
|
5204
6213
|
"Commands",
|
|
5205
6214
|
"DynamicProperty"
|
|
5206
|
-
].map((
|
|
6215
|
+
].map((name2) => `$s7SwiftUI${name2.length}${name2}Mp`)
|
|
5207
6216
|
);
|
|
5208
6217
|
|
|
5209
6218
|
// src/swift-guest-link.ts
|
|
@@ -5284,9 +6293,9 @@ var WASM_OPTIMIZE_IDENTITY = `wasm-opt ${import_wasm_opt.BINARYEN_VERSION} -Oz $
|
|
|
5284
6293
|
|
|
5285
6294
|
// src/swift-icu.ts
|
|
5286
6295
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
5287
|
-
var
|
|
6296
|
+
var import_node_child_process6 = require("node:child_process");
|
|
5288
6297
|
var import_node_util2 = require("node:util");
|
|
5289
|
-
var
|
|
6298
|
+
var import_node_zlib2 = require("node:zlib");
|
|
5290
6299
|
|
|
5291
6300
|
// ../sootsim-swift/src/icuData.ts
|
|
5292
6301
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -5300,10 +6309,10 @@ var VERSION = 1;
|
|
|
5300
6309
|
var SWIFT_ICU_PACKED = `picu${VERSION}`;
|
|
5301
6310
|
|
|
5302
6311
|
// src/swift-icu.ts
|
|
5303
|
-
var run2 = (0, import_node_util2.promisify)(
|
|
5304
|
-
var deflate = (0, import_node_util2.promisify)(
|
|
5305
|
-
var compressBrotli = (0, import_node_util2.promisify)(
|
|
5306
|
-
var inflateGzip = (0, import_node_util2.promisify)(
|
|
6312
|
+
var run2 = (0, import_node_util2.promisify)(import_node_child_process6.execFile);
|
|
6313
|
+
var deflate = (0, import_node_util2.promisify)(import_node_zlib2.gzip);
|
|
6314
|
+
var compressBrotli = (0, import_node_util2.promisify)(import_node_zlib2.brotliCompress);
|
|
6315
|
+
var inflateGzip = (0, import_node_util2.promisify)(import_node_zlib2.gunzip);
|
|
5307
6316
|
|
|
5308
6317
|
// src/swift-link-roots.ts
|
|
5309
6318
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -5403,7 +6412,7 @@ var FOUNDATION_IMPLICIT_MODULES = [
|
|
|
5403
6412
|
var FOUNDATION_IMPLICIT_FLAGS = FOUNDATION_IMPLICIT_MODULES.map(
|
|
5404
6413
|
(module2) => `, "-Xfrontend", "-import-module", "-Xfrontend", "${module2}"`
|
|
5405
6414
|
).join("");
|
|
5406
|
-
var compilerSourceDigest = true ? "
|
|
6415
|
+
var compilerSourceDigest = true ? "4646bbe2e0cd2e48e498f51fd3d0d5ea29ecd5e6163fdf3afe8d64d4368022d7" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
|
|
5407
6416
|
var CORE_FOUNDATION_HANDLE_IMPORTS = [
|
|
5408
6417
|
"CFAllocator",
|
|
5409
6418
|
"CFArray",
|
|
@@ -5418,11 +6427,24 @@ var CORE_FOUNDATION_HANDLE_IMPORTS = [
|
|
|
5418
6427
|
"CFSet",
|
|
5419
6428
|
"CFString",
|
|
5420
6429
|
"CFURL"
|
|
5421
|
-
].map((
|
|
6430
|
+
].map((name2) => `import class CoreFoundation.${name2}`).concat([
|
|
5422
6431
|
"import typealias CoreFoundation.CFPropertyList",
|
|
5423
6432
|
"import typealias CoreFoundation.CFTypeRef",
|
|
5424
6433
|
"import CoreGraphics"
|
|
5425
6434
|
]).join("; ");
|
|
6435
|
+
var emptyMacroEnvironment = {
|
|
6436
|
+
defines: /* @__PURE__ */ new Map(),
|
|
6437
|
+
predefines: /* @__PURE__ */ new Map(),
|
|
6438
|
+
targetDefined: /* @__PURE__ */ new Set()
|
|
6439
|
+
};
|
|
6440
|
+
var wasmMacroEnvironment = {
|
|
6441
|
+
...emptyMacroEnvironment,
|
|
6442
|
+
defines: /* @__PURE__ */ new Map([
|
|
6443
|
+
["__wasm__", "1"],
|
|
6444
|
+
["__wasm32__", "1"],
|
|
6445
|
+
["__wasi__", "1"]
|
|
6446
|
+
])
|
|
6447
|
+
};
|
|
5426
6448
|
var ROOT_LOCKS = Symbol.for("peachsim.swiftCompile.rootLocks");
|
|
5427
6449
|
var host = globalThis;
|
|
5428
6450
|
var rootLocks = host[ROOT_LOCKS] ??= /* @__PURE__ */ new Map();
|
|
@@ -5438,8 +6460,8 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
5438
6460
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
5439
6461
|
|
|
5440
6462
|
// src/swift-package-manifest.ts
|
|
5441
|
-
var cacheDir3 =
|
|
5442
|
-
var execFileAsync = (0, import_node_util3.promisify)(
|
|
6463
|
+
var cacheDir3 = import_node_path12.default.join(cacheDir(), "swift-manifests");
|
|
6464
|
+
var execFileAsync = (0, import_node_util3.promisify)(import_node_child_process7.execFile);
|
|
5443
6465
|
|
|
5444
6466
|
// src/xcode-json-project.ts
|
|
5445
6467
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -5459,36 +6481,36 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
5459
6481
|
|
|
5460
6482
|
// src/nitro-dependencies.ts
|
|
5461
6483
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
5462
|
-
var
|
|
6484
|
+
var import_node_child_process9 = require("node:child_process");
|
|
5463
6485
|
var import_node_util5 = require("node:util");
|
|
5464
6486
|
|
|
5465
6487
|
// src/kotlin-toolchain.ts
|
|
5466
6488
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
5467
|
-
var
|
|
6489
|
+
var import_node_child_process8 = require("node:child_process");
|
|
5468
6490
|
var import_node_util4 = require("node:util");
|
|
5469
|
-
var run3 = (0, import_node_util4.promisify)(
|
|
6491
|
+
var run3 = (0, import_node_util4.promisify)(import_node_child_process8.execFile);
|
|
5470
6492
|
|
|
5471
6493
|
// src/swift-source-file.ts
|
|
5472
6494
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
5473
|
-
var
|
|
5474
|
-
var
|
|
6495
|
+
var import_node_fs11 = __toESM(require("node:fs"), 1);
|
|
6496
|
+
var import_node_path13 = __toESM(require("node:path"), 1);
|
|
5475
6497
|
function relativeInside(root, file) {
|
|
5476
|
-
const relative2 =
|
|
5477
|
-
return relative2 === ".." || relative2.startsWith(`..${
|
|
6498
|
+
const relative2 = import_node_path13.default.relative(root, file);
|
|
6499
|
+
return relative2 === ".." || relative2.startsWith(`..${import_node_path13.default.sep}`) || import_node_path13.default.isAbsolute(relative2) ? null : relative2;
|
|
5478
6500
|
}
|
|
5479
6501
|
function packageInputPath(canonicalRoot, file) {
|
|
5480
|
-
const canonicalFile =
|
|
6502
|
+
const canonicalFile = import_node_fs11.default.realpathSync(file);
|
|
5481
6503
|
if (relativeInside(canonicalRoot, canonicalFile) === null) {
|
|
5482
6504
|
throw new Error(`swift input escapes the selected package: ${file}`);
|
|
5483
6505
|
}
|
|
5484
6506
|
return canonicalFile;
|
|
5485
6507
|
}
|
|
5486
6508
|
function readPackageFile(root, file, maxBytes) {
|
|
5487
|
-
const canonicalFile = packageInputPath(
|
|
5488
|
-
const expected =
|
|
5489
|
-
const fd =
|
|
6509
|
+
const canonicalFile = packageInputPath(import_node_fs11.default.realpathSync(root), file);
|
|
6510
|
+
const expected = import_node_fs11.default.statSync(canonicalFile);
|
|
6511
|
+
const fd = import_node_fs11.default.openSync(canonicalFile, import_node_fs11.default.constants.O_RDONLY | import_node_fs11.default.constants.O_NOFOLLOW);
|
|
5490
6512
|
try {
|
|
5491
|
-
const stat =
|
|
6513
|
+
const stat = import_node_fs11.default.fstatSync(fd);
|
|
5492
6514
|
if (stat.dev !== expected.dev || stat.ino !== expected.ino) {
|
|
5493
6515
|
throw new Error(`swift input changed while opening: ${file}`);
|
|
5494
6516
|
}
|
|
@@ -5498,16 +6520,16 @@ function readPackageFile(root, file, maxBytes) {
|
|
|
5498
6520
|
const bytes = Buffer.alloc(stat.size + 1);
|
|
5499
6521
|
let offset = 0;
|
|
5500
6522
|
while (offset < bytes.length) {
|
|
5501
|
-
const count =
|
|
6523
|
+
const count = import_node_fs11.default.readSync(fd, bytes, offset, bytes.length - offset, null);
|
|
5502
6524
|
if (count === 0) break;
|
|
5503
6525
|
offset += count;
|
|
5504
6526
|
}
|
|
5505
|
-
if (offset !== stat.size ||
|
|
6527
|
+
if (offset !== stat.size || import_node_fs11.default.fstatSync(fd).size !== stat.size) {
|
|
5506
6528
|
throw new Error(`swift input changed while reading: ${file}`);
|
|
5507
6529
|
}
|
|
5508
6530
|
return bytes.subarray(0, offset);
|
|
5509
6531
|
} finally {
|
|
5510
|
-
|
|
6532
|
+
import_node_fs11.default.closeSync(fd);
|
|
5511
6533
|
}
|
|
5512
6534
|
}
|
|
5513
6535
|
|
|
@@ -5526,7 +6548,7 @@ var MAX_SWIFT_COMPILE_IMAGE_BYTES = 4 * 1024 * 1024;
|
|
|
5526
6548
|
var MAX_SWIFT_COMPILE_IMAGE_TOTAL_BYTES = 16 * 1024 * 1024;
|
|
5527
6549
|
|
|
5528
6550
|
// src/nitro-dependencies.ts
|
|
5529
|
-
var run4 = (0, import_node_util5.promisify)(
|
|
6551
|
+
var run4 = (0, import_node_util5.promisify)(import_node_child_process9.execFile);
|
|
5530
6552
|
var DOUBLE_CONVERSION_WASM32_BACKPORT = {
|
|
5531
6553
|
upstreamCommit: "8857767d5b2f5a035321e3712e8cd0008840ba6b",
|
|
5532
6554
|
originalSha256: "b495b11f7b61693486894f747add5b454894b8b3ca41aa1610d370ba16407ab7",
|
|
@@ -5604,9 +6626,9 @@ var RN_FMT_12_DEPENDENCIES = [
|
|
|
5604
6626
|
|
|
5605
6627
|
// src/react-native-autolinking.ts
|
|
5606
6628
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
5607
|
-
var
|
|
6629
|
+
var import_node_child_process10 = require("node:child_process");
|
|
5608
6630
|
var import_node_util6 = require("node:util");
|
|
5609
|
-
var run5 = (0, import_node_util6.promisify)(
|
|
6631
|
+
var run5 = (0, import_node_util6.promisify)(import_node_child_process10.execFile);
|
|
5610
6632
|
|
|
5611
6633
|
// src/workspace-root.ts
|
|
5612
6634
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -8673,8 +9695,8 @@ var COMPAT_STUBS = {
|
|
|
8673
9695
|
|
|
8674
9696
|
// src/installed-native-build-options.ts
|
|
8675
9697
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
8676
|
-
var
|
|
8677
|
-
var
|
|
9698
|
+
var import_node_fs12 = __toESM(require("node:fs"), 1);
|
|
9699
|
+
var import_node_path14 = __toESM(require("node:path"), 1);
|
|
8678
9700
|
var RIVE_PACKAGE = "@rive-app/react-native";
|
|
8679
9701
|
var RIVE_05 = [">=0.5.0 <0.6.0"];
|
|
8680
9702
|
function missing(error) {
|
|
@@ -8682,10 +9704,10 @@ function missing(error) {
|
|
|
8682
9704
|
}
|
|
8683
9705
|
function answerSync(step) {
|
|
8684
9706
|
try {
|
|
8685
|
-
if (step.type === "realpath") return
|
|
8686
|
-
if (step.type === "read") return
|
|
8687
|
-
if (step.type === "isDirectory") return
|
|
8688
|
-
return
|
|
9707
|
+
if (step.type === "realpath") return import_node_fs12.default.realpathSync(step.path);
|
|
9708
|
+
if (step.type === "read") return import_node_fs12.default.readFileSync(step.path, "utf8");
|
|
9709
|
+
if (step.type === "isDirectory") return import_node_fs12.default.statSync(step.path).isDirectory();
|
|
9710
|
+
return import_node_fs12.default.readdirSync(step.path, { withFileTypes: true }).map((entry) => ({
|
|
8689
9711
|
name: entry.name,
|
|
8690
9712
|
directory: entry.isDirectory(),
|
|
8691
9713
|
symbolicLink: entry.isSymbolicLink()
|
|
@@ -8697,11 +9719,11 @@ function answerSync(step) {
|
|
|
8697
9719
|
}
|
|
8698
9720
|
async function answerAsync(step) {
|
|
8699
9721
|
try {
|
|
8700
|
-
if (step.type === "realpath") return await
|
|
8701
|
-
if (step.type === "read") return await
|
|
9722
|
+
if (step.type === "realpath") return await import_node_fs12.default.promises.realpath(step.path);
|
|
9723
|
+
if (step.type === "read") return await import_node_fs12.default.promises.readFile(step.path, "utf8");
|
|
8702
9724
|
if (step.type === "isDirectory")
|
|
8703
|
-
return (await
|
|
8704
|
-
return (await
|
|
9725
|
+
return (await import_node_fs12.default.promises.stat(step.path)).isDirectory();
|
|
9726
|
+
return (await import_node_fs12.default.promises.readdir(step.path, { withFileTypes: true })).map(
|
|
8705
9727
|
(entry) => ({
|
|
8706
9728
|
name: entry.name,
|
|
8707
9729
|
directory: entry.isDirectory(),
|
|
@@ -8734,7 +9756,7 @@ function* rubyFiles(directory, seen, iosRoot = false) {
|
|
|
8734
9756
|
const files = [];
|
|
8735
9757
|
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
8736
9758
|
if (iosRoot && (entry.name === "Pods" || entry.name === "build")) continue;
|
|
8737
|
-
const target =
|
|
9759
|
+
const target = import_node_path14.default.join(directory, entry.name);
|
|
8738
9760
|
let isDirectory = entry.directory;
|
|
8739
9761
|
if (entry.symbolicLink)
|
|
8740
9762
|
isDirectory = (yield { type: "isDirectory", path: target }) === true;
|
|
@@ -8747,7 +9769,7 @@ function* nativeBuildOptionsWalk(projectRoot, versions, environment) {
|
|
|
8747
9769
|
let sensorOptions = {};
|
|
8748
9770
|
const sensors = versions["expo-sensors"];
|
|
8749
9771
|
if (sensors && resolveCompatVersionRange([">=58.0.4 <59.0.0"], sensors).status === "matched") {
|
|
8750
|
-
const file =
|
|
9772
|
+
const file = import_node_path14.default.join(projectRoot, "ios", "Podfile.properties.json");
|
|
8751
9773
|
const source = yield { type: "read", path: file };
|
|
8752
9774
|
if (source !== null && typeof source !== "string")
|
|
8753
9775
|
throw new Error(`cannot inspect ${file}`);
|
|
@@ -8763,8 +9785,8 @@ function* nativeBuildOptionsWalk(projectRoot, versions, environment) {
|
|
|
8763
9785
|
if (!needsRiveOptions(versions)) return sensorOptions;
|
|
8764
9786
|
if (environment.USE_RIVE_LEGACY === "1" || environment.USE_RIVE_LEGACY === "true")
|
|
8765
9787
|
return { ...sensorOptions, [RIVE_PACKAGE]: { USE_RIVE_LEGACY: true } };
|
|
8766
|
-
const ios =
|
|
8767
|
-
const podfile =
|
|
9788
|
+
const ios = import_node_path14.default.join(projectRoot, "ios");
|
|
9789
|
+
const podfile = import_node_path14.default.join(ios, "Podfile");
|
|
8768
9790
|
const files = [podfile, ...yield* rubyFiles(ios, /* @__PURE__ */ new Set(), true)];
|
|
8769
9791
|
let value = false;
|
|
8770
9792
|
let assigned = false;
|
|
@@ -8883,7 +9905,7 @@ async function runAsync(walk, inputs) {
|
|
|
8883
9905
|
function createInstalledPackageReader() {
|
|
8884
9906
|
const hasModules = /* @__PURE__ */ new Map();
|
|
8885
9907
|
const manifests = /* @__PURE__ */ new Map();
|
|
8886
|
-
return function* readInstalledPackage(fromDir,
|
|
9908
|
+
return function* readInstalledPackage(fromDir, name2) {
|
|
8887
9909
|
for (let dir = fromDir; ; ) {
|
|
8888
9910
|
if (import_path2.default.basename(dir) !== "node_modules") {
|
|
8889
9911
|
const modules = import_path2.default.join(dir, "node_modules");
|
|
@@ -8893,7 +9915,7 @@ function createInstalledPackageReader() {
|
|
|
8893
9915
|
hasModules.set(dir, present);
|
|
8894
9916
|
}
|
|
8895
9917
|
if (present) {
|
|
8896
|
-
const root = import_path2.default.join(modules,
|
|
9918
|
+
const root = import_path2.default.join(modules, name2);
|
|
8897
9919
|
let installed = manifests.get(root);
|
|
8898
9920
|
if (installed === void 0) {
|
|
8899
9921
|
const manifest = yield* readManifest(import_path2.default.join(root, "package.json"));
|
|
@@ -8912,11 +9934,11 @@ function createInstalledPackageReader() {
|
|
|
8912
9934
|
function* installedVersionsWalk(projectRoot, names, selectedPackages) {
|
|
8913
9935
|
const readInstalledPackage = createInstalledPackageReader();
|
|
8914
9936
|
const versions = {};
|
|
8915
|
-
for (const
|
|
8916
|
-
const installed = selectedPackages ? selectedPackages.get(
|
|
9937
|
+
for (const name2 of [...names].sort()) {
|
|
9938
|
+
const installed = selectedPackages ? selectedPackages.get(name2) : yield* readInstalledPackage(projectRoot, name2);
|
|
8917
9939
|
const version = installed && Reflect.get(installed.manifest, "version");
|
|
8918
|
-
if (typeof version === "string" && version.length > 0) versions[
|
|
8919
|
-
if (
|
|
9940
|
+
if (typeof version === "string" && version.length > 0) versions[name2] = version;
|
|
9941
|
+
if (name2 === "react-native-worklets" && installed) {
|
|
8920
9942
|
const defaults = yield* readManifest(
|
|
8921
9943
|
import_path2.default.join(installed.root, "src/featureFlags/staticFlags.json")
|
|
8922
9944
|
);
|
|
@@ -8938,8 +9960,8 @@ function* nativePackageVersionsWalk(projectRoot) {
|
|
|
8938
9960
|
...LAZY_STUB_PATTERNS,
|
|
8939
9961
|
...Object.values(COMPAT_STUBS).map((entry) => entry.specifier)
|
|
8940
9962
|
]) {
|
|
8941
|
-
const
|
|
8942
|
-
if (
|
|
9963
|
+
const name2 = extractPackageFromPath(`node_modules/${specifier}`);
|
|
9964
|
+
if (name2) nativeNames.add(name2);
|
|
8943
9965
|
}
|
|
8944
9966
|
const manifest = yield* readManifest(import_path2.default.join(appRoot, "package.json"));
|
|
8945
9967
|
if (!manifest) throw new Error("app package.json must contain an object");
|
|
@@ -8957,16 +9979,16 @@ function* nativePackageVersionsWalk(projectRoot) {
|
|
|
8957
9979
|
for (const field of fields) {
|
|
8958
9980
|
const dependencies = Reflect.get(next.manifest, field);
|
|
8959
9981
|
if (typeof dependencies !== "object" || dependencies === null) continue;
|
|
8960
|
-
for (const
|
|
9982
|
+
for (const name2 of Object.keys(dependencies)) {
|
|
8961
9983
|
if (field === "peerDependencies" && typeof peers === "object" && peers !== null) {
|
|
8962
|
-
const peer = Reflect.get(peers,
|
|
9984
|
+
const peer = Reflect.get(peers, name2);
|
|
8963
9985
|
if (typeof peer === "object" && peer !== null && Reflect.get(peer, "optional"))
|
|
8964
9986
|
continue;
|
|
8965
9987
|
}
|
|
8966
|
-
const installed = yield* readInstalledPackage(root,
|
|
9988
|
+
const installed = yield* readInstalledPackage(root, name2);
|
|
8967
9989
|
if (!installed) continue;
|
|
8968
|
-
if (nativeNames.has(
|
|
8969
|
-
needed.set(
|
|
9990
|
+
if (nativeNames.has(name2) && !needed.has(name2))
|
|
9991
|
+
needed.set(name2, (yield* readInstalledPackage(appRoot, name2)) ?? installed);
|
|
8970
9992
|
pending.push(installed);
|
|
8971
9993
|
}
|
|
8972
9994
|
}
|
|
@@ -9024,10 +10046,10 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
9024
10046
|
// scripts/dev-server-scanner.ts
|
|
9025
10047
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
9026
10048
|
var import_child_process = require("child_process");
|
|
9027
|
-
var
|
|
9028
|
-
var
|
|
9029
|
-
var
|
|
9030
|
-
var
|
|
10049
|
+
var import_promises3 = require("fs/promises");
|
|
10050
|
+
var import_node_fs13 = require("node:fs");
|
|
10051
|
+
var import_node_os5 = require("node:os");
|
|
10052
|
+
var import_node_path15 = require("node:path");
|
|
9031
10053
|
|
|
9032
10054
|
// src/config.ts
|
|
9033
10055
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -9177,11 +10199,11 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
9177
10199
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
9178
10200
|
|
|
9179
10201
|
// scripts/dev-server-scanner.ts
|
|
9180
|
-
var LISTENER_LOCK_PATH = (0,
|
|
9181
|
-
var LISTENER_RESULT_PATH = (0,
|
|
10202
|
+
var LISTENER_LOCK_PATH = (0, import_node_path15.join)((0, import_node_os5.tmpdir)(), "peach-listener-scan.lock");
|
|
10203
|
+
var LISTENER_RESULT_PATH = (0, import_node_path15.join)((0, import_node_os5.tmpdir)(), "peach-listener-scan.result");
|
|
9182
10204
|
var LISTENER_LOCK_STALE_MS = 25e3;
|
|
9183
10205
|
var LISTENER_LOCK_WAIT_MS = 8e3;
|
|
9184
|
-
function
|
|
10206
|
+
function sleep2(ms) {
|
|
9185
10207
|
return new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
9186
10208
|
}
|
|
9187
10209
|
function pidIsAlive(pid) {
|
|
@@ -9196,8 +10218,8 @@ function pidIsAlive(pid) {
|
|
|
9196
10218
|
}
|
|
9197
10219
|
function readLockOwner() {
|
|
9198
10220
|
try {
|
|
9199
|
-
const raw = (0,
|
|
9200
|
-
const mtimeMs = (0,
|
|
10221
|
+
const raw = (0, import_node_fs13.readFileSync)(LISTENER_LOCK_PATH, "utf8");
|
|
10222
|
+
const mtimeMs = (0, import_node_fs13.statSync)(LISTENER_LOCK_PATH).mtimeMs;
|
|
9201
10223
|
const pid = Number(raw.split("-")[0]);
|
|
9202
10224
|
return { raw, pid: Number.isInteger(pid) ? pid : -1, mtimeMs };
|
|
9203
10225
|
} catch {
|
|
@@ -9210,15 +10232,15 @@ function lockIsAbandoned(owner) {
|
|
|
9210
10232
|
}
|
|
9211
10233
|
function clearLock(raw) {
|
|
9212
10234
|
try {
|
|
9213
|
-
if ((0,
|
|
9214
|
-
(0,
|
|
10235
|
+
if ((0, import_node_fs13.readFileSync)(LISTENER_LOCK_PATH, "utf8") !== raw) return;
|
|
10236
|
+
(0, import_node_fs13.unlinkSync)(LISTENER_LOCK_PATH);
|
|
9215
10237
|
} catch {
|
|
9216
10238
|
}
|
|
9217
10239
|
}
|
|
9218
10240
|
function readResult() {
|
|
9219
10241
|
try {
|
|
9220
10242
|
const parsed = JSON.parse(
|
|
9221
|
-
(0,
|
|
10243
|
+
(0, import_node_fs13.readFileSync)(LISTENER_RESULT_PATH, "utf8")
|
|
9222
10244
|
);
|
|
9223
10245
|
if (!parsed || typeof parsed.token !== "string" || typeof parsed.key !== "string")
|
|
9224
10246
|
return null;
|
|
@@ -9229,8 +10251,8 @@ function readResult() {
|
|
|
9229
10251
|
}
|
|
9230
10252
|
function publishResult(payload) {
|
|
9231
10253
|
const tmp = `${LISTENER_RESULT_PATH}.${process.pid}.tmp`;
|
|
9232
|
-
(0,
|
|
9233
|
-
(0,
|
|
10254
|
+
(0, import_node_fs13.writeFileSync)(tmp, JSON.stringify(payload));
|
|
10255
|
+
(0, import_node_fs13.renameSync)(tmp, LISTENER_RESULT_PATH);
|
|
9234
10256
|
}
|
|
9235
10257
|
function throwPublished(payload) {
|
|
9236
10258
|
throw Object.assign(new Error(payload.message || "listener scan failed"), {
|
|
@@ -9261,7 +10283,7 @@ async function waitForSharedResult(owner, key) {
|
|
|
9261
10283
|
clearLock(latest.raw);
|
|
9262
10284
|
return { kind: "retry" };
|
|
9263
10285
|
}
|
|
9264
|
-
await
|
|
10286
|
+
await sleep2(25);
|
|
9265
10287
|
}
|
|
9266
10288
|
throw Object.assign(new Error("listener scan lock was held past the wait"), {
|
|
9267
10289
|
killed: true
|
|
@@ -9273,7 +10295,7 @@ async function withListenerLock(key, body) {
|
|
|
9273
10295
|
for (; ; ) {
|
|
9274
10296
|
let fd = null;
|
|
9275
10297
|
try {
|
|
9276
|
-
fd = (0,
|
|
10298
|
+
fd = (0, import_node_fs13.openSync)(LISTENER_LOCK_PATH, "wx");
|
|
9277
10299
|
} catch (error) {
|
|
9278
10300
|
const code = error instanceof Error && "code" in error ? error.code : "";
|
|
9279
10301
|
if (code !== "EEXIST") throw error;
|
|
@@ -9282,7 +10304,7 @@ async function withListenerLock(key, body) {
|
|
|
9282
10304
|
if (owner) clearLock(owner.raw);
|
|
9283
10305
|
else {
|
|
9284
10306
|
try {
|
|
9285
|
-
(0,
|
|
10307
|
+
(0, import_node_fs13.unlinkSync)(LISTENER_LOCK_PATH);
|
|
9286
10308
|
} catch {
|
|
9287
10309
|
}
|
|
9288
10310
|
}
|
|
@@ -9293,12 +10315,12 @@ async function withListenerLock(key, body) {
|
|
|
9293
10315
|
if (shared.kind === "value") return shared.value;
|
|
9294
10316
|
continue;
|
|
9295
10317
|
}
|
|
9296
|
-
await
|
|
10318
|
+
await sleep2(25);
|
|
9297
10319
|
continue;
|
|
9298
10320
|
}
|
|
9299
10321
|
if (fd === null) continue;
|
|
9300
10322
|
try {
|
|
9301
|
-
(0,
|
|
10323
|
+
(0, import_node_fs13.writeSync)(fd, token);
|
|
9302
10324
|
try {
|
|
9303
10325
|
const value = await body();
|
|
9304
10326
|
publishResult({ token, key, ok: true, value });
|
|
@@ -9315,7 +10337,7 @@ async function withListenerLock(key, body) {
|
|
|
9315
10337
|
}
|
|
9316
10338
|
} finally {
|
|
9317
10339
|
try {
|
|
9318
|
-
(0,
|
|
10340
|
+
(0, import_node_fs13.closeSync)(fd);
|
|
9319
10341
|
} catch {
|
|
9320
10342
|
}
|
|
9321
10343
|
clearLock(token);
|
|
@@ -9564,7 +10586,7 @@ async function flushCwdQueue() {
|
|
|
9564
10586
|
const needLsof = [];
|
|
9565
10587
|
for (const pid of pending) {
|
|
9566
10588
|
try {
|
|
9567
|
-
const cwd = await (0,
|
|
10589
|
+
const cwd = await (0, import_promises3.readlink)(`/proc/${pid}/cwd`);
|
|
9568
10590
|
if (cwd) {
|
|
9569
10591
|
cwdByPid.set(pid, cwd);
|
|
9570
10592
|
continue;
|
|
@@ -9799,7 +10821,7 @@ function nodeRequestHeaderEntries(headers) {
|
|
|
9799
10821
|
|
|
9800
10822
|
// src/host/hostname-resolver.ts
|
|
9801
10823
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
9802
|
-
var
|
|
10824
|
+
var import_promises4 = require("node:dns/promises");
|
|
9803
10825
|
|
|
9804
10826
|
// src/dns-over-https.ts
|
|
9805
10827
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -9841,7 +10863,7 @@ function parseIpv6(text) {
|
|
|
9841
10863
|
|
|
9842
10864
|
// src/host/network-policy.ts
|
|
9843
10865
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
9844
|
-
var
|
|
10866
|
+
var import_node_path16 = require("node:path");
|
|
9845
10867
|
var import_node_url = require("node:url");
|
|
9846
10868
|
var NETWORK_POLICY_TIMEOUT_MS = 1e4;
|
|
9847
10869
|
var NetworkPolicyDeniedError = class extends Error {
|
|
@@ -9894,7 +10916,7 @@ function createNetworkAuthorizer(policy) {
|
|
|
9894
10916
|
};
|
|
9895
10917
|
}
|
|
9896
10918
|
async function loadNetworkPolicy(file) {
|
|
9897
|
-
if (!(0,
|
|
10919
|
+
if (!(0, import_node_path16.isAbsolute)(file)) {
|
|
9898
10920
|
throw new Error(`PEACH_NETWORK_POLICY must be an absolute path: ${file}`);
|
|
9899
10921
|
}
|
|
9900
10922
|
const loaded2 = await import(
|
|
@@ -9930,7 +10952,7 @@ async function handleHostnameResolutionRequest(req, res) {
|
|
|
9930
10952
|
}
|
|
9931
10953
|
let addresses;
|
|
9932
10954
|
try {
|
|
9933
|
-
addresses = (await (0,
|
|
10955
|
+
addresses = (await (0, import_promises4.lookup)(host2, { all: true })).map(({ address }) => {
|
|
9934
10956
|
const bytes = parseIpLiteral(address);
|
|
9935
10957
|
if (!bytes) throw new Error("system resolver returned an invalid address");
|
|
9936
10958
|
return bytes;
|
|
@@ -9982,12 +11004,12 @@ function projectLoopbackUrl(value) {
|
|
|
9982
11004
|
// src/host/rolldown-bundle-forward.ts
|
|
9983
11005
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
9984
11006
|
var import_stream = require("stream");
|
|
9985
|
-
var
|
|
11007
|
+
var import_promises5 = require("stream/promises");
|
|
9986
11008
|
var ROLLDOWN_INVENTORY_HEADER = "x-peach-rolldown-inventory";
|
|
9987
11009
|
async function forwardRolldownBundleResponse(upstream, res) {
|
|
9988
11010
|
res.setHeader(ROLLDOWN_INVENTORY_HEADER, "1");
|
|
9989
11011
|
if (upstream.headers[ROLLDOWN_INVENTORY_HEADER] === "1") {
|
|
9990
|
-
await (0,
|
|
11012
|
+
await (0, import_promises5.pipeline)(upstream, res);
|
|
9991
11013
|
return;
|
|
9992
11014
|
}
|
|
9993
11015
|
const contentType = typeof upstream.headers["content-type"] === "string" ? upstream.headers["content-type"] : "";
|
|
@@ -10029,7 +11051,7 @@ async function forwardRolldownBundleResponse(upstream, res) {
|
|
|
10029
11051
|
}
|
|
10030
11052
|
yield Buffer.from(annotated.slice(sent), "utf8");
|
|
10031
11053
|
};
|
|
10032
|
-
await (0,
|
|
11054
|
+
await (0, import_promises5.pipeline)(import_stream.Readable.from(annotate(), { objectMode: false }), res);
|
|
10033
11055
|
}
|
|
10034
11056
|
|
|
10035
11057
|
// src/host/fetch-proxy-handler.ts
|
|
@@ -10075,7 +11097,7 @@ function applyFetchProxyCors(req, res) {
|
|
|
10075
11097
|
"access-control-expose-headers",
|
|
10076
11098
|
[
|
|
10077
11099
|
...Object.keys(res.getHeaders()).filter(
|
|
10078
|
-
(
|
|
11100
|
+
(name2) => !name2.startsWith("access-control-")
|
|
10079
11101
|
),
|
|
10080
11102
|
"x-sootsim-set-cookie"
|
|
10081
11103
|
].join(", ")
|
|
@@ -10101,7 +11123,7 @@ function buildAppApiProxyHeaders(reqHeaders, targetUrl) {
|
|
|
10101
11123
|
if (typeof nativeCookie === "string" && nativeCookie)
|
|
10102
11124
|
headers.cookie = decodeURIComponent(nativeCookie);
|
|
10103
11125
|
headers.host = targetUrl.host;
|
|
10104
|
-
if (!Object.keys(headers).some((
|
|
11126
|
+
if (!Object.keys(headers).some((name2) => name2.toLowerCase() === "mobile-origin")) {
|
|
10105
11127
|
headers.origin = targetUrl.origin;
|
|
10106
11128
|
headers.referer = `${targetUrl.origin}/`;
|
|
10107
11129
|
}
|
|
@@ -10240,7 +11262,7 @@ function handleAppApiRequest(req, res) {
|
|
|
10240
11262
|
res.setHeader("access-control-allow-credentials", "true");
|
|
10241
11263
|
res.setHeader(
|
|
10242
11264
|
"access-control-expose-headers",
|
|
10243
|
-
Object.keys(res.getHeaders()).filter((
|
|
11265
|
+
Object.keys(res.getHeaders()).filter((name2) => !name2.startsWith("access-control-") && name2 !== "set-cookie").join(", ")
|
|
10244
11266
|
);
|
|
10245
11267
|
}
|
|
10246
11268
|
});
|
|
@@ -10360,7 +11382,7 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
10360
11382
|
await route.respond(proxyRes, hopCookies);
|
|
10361
11383
|
if (isNativeCookieRedirect(hop)) res.removeHeader("location");
|
|
10362
11384
|
res.statusCode = isNativeCookieRedirect(hop) ? 200 : status;
|
|
10363
|
-
await (0,
|
|
11385
|
+
await (0, import_promises6.pipeline)(proxyRes, res);
|
|
10364
11386
|
return;
|
|
10365
11387
|
}
|
|
10366
11388
|
if (location && (status === 301 || status === 302 || status === 303 || status === 307 || status === 308)) {
|
|
@@ -10371,7 +11393,7 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
10371
11393
|
const switchToGet = (status === 301 || status === 302) && method === "POST" || status === 303 && method !== "GET" && method !== "HEAD";
|
|
10372
11394
|
const redirectUrl = resolveRedirectUrl(location, targetUrl);
|
|
10373
11395
|
proxyRes.resume();
|
|
10374
|
-
await (0,
|
|
11396
|
+
await (0, import_promises6.finished)(proxyRes);
|
|
10375
11397
|
await proxy(
|
|
10376
11398
|
redirectUrl,
|
|
10377
11399
|
switchToGet ? "GET" : method,
|
|
@@ -10388,7 +11410,7 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
10388
11410
|
await forwardRolldownBundleResponse(proxyRes, res);
|
|
10389
11411
|
return;
|
|
10390
11412
|
}
|
|
10391
|
-
await (0,
|
|
11413
|
+
await (0, import_promises6.pipeline)(proxyRes, res);
|
|
10392
11414
|
};
|
|
10393
11415
|
let upstreamAnswered = false;
|
|
10394
11416
|
let body;
|
|
@@ -10446,9 +11468,9 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
10446
11468
|
|
|
10447
11469
|
// src/host/replacement-module-handler.ts
|
|
10448
11470
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
10449
|
-
var
|
|
10450
|
-
var
|
|
10451
|
-
var
|
|
11471
|
+
var import_node_fs14 = require("node:fs");
|
|
11472
|
+
var import_promises7 = __toESM(require("node:fs/promises"), 1);
|
|
11473
|
+
var import_node_path17 = __toESM(require("node:path"), 1);
|
|
10452
11474
|
|
|
10453
11475
|
// ../contrast-bundler/src/replacementModule.ts
|
|
10454
11476
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -10489,7 +11511,7 @@ function normalize(p) {
|
|
|
10489
11511
|
if (trailingSlash) joined += "/";
|
|
10490
11512
|
return absolute ? "/" + joined : joined;
|
|
10491
11513
|
}
|
|
10492
|
-
function
|
|
11514
|
+
function join5(...parts) {
|
|
10493
11515
|
const present = parts.filter((part) => part.length > 0);
|
|
10494
11516
|
if (present.length === 0) return ".";
|
|
10495
11517
|
return normalize(present.join("/"));
|
|
@@ -10546,7 +11568,7 @@ var posix = {
|
|
|
10546
11568
|
delimiter,
|
|
10547
11569
|
isAbsolute: isAbsolute2,
|
|
10548
11570
|
normalize,
|
|
10549
|
-
join:
|
|
11571
|
+
join: join5,
|
|
10550
11572
|
resolve: resolve2,
|
|
10551
11573
|
dirname,
|
|
10552
11574
|
basename,
|
|
@@ -10589,21 +11611,21 @@ function unsupportedSpecifier(specifier) {
|
|
|
10589
11611
|
`replacement modules may only import react, react-native, peach-kit, the packages rnx stubs for this app, and other project files by relative path; '${specifier}' is none of those. vendor the code into a project file, or add the package to peach.config so the simulator bridges it.`
|
|
10590
11612
|
);
|
|
10591
11613
|
}
|
|
10592
|
-
function bridgeDeclaration(
|
|
11614
|
+
function bridgeDeclaration(name2, specifier) {
|
|
10593
11615
|
const notReady = (what) => JSON.stringify(`[peach] replacement ${what} bridge is not ready`);
|
|
10594
11616
|
if (specifier === "react") {
|
|
10595
|
-
return `const ${
|
|
11617
|
+
return `const ${name2} = ${REACT_BRIDGE}; if (!${name2}) throw new Error(${notReady("React")});`;
|
|
10596
11618
|
}
|
|
10597
11619
|
if (specifier === "react-native") {
|
|
10598
|
-
return `const ${
|
|
11620
|
+
return `const ${name2} = ${REACT_NATIVE_BRIDGE}; if (!${name2}) throw new Error(${notReady("React Native")});`;
|
|
10599
11621
|
}
|
|
10600
11622
|
if (isPeachKitSpecifier(specifier)) {
|
|
10601
|
-
return `const ${
|
|
11623
|
+
return `const ${name2} = (globalThis.__peach_kit_modules && globalThis.__peach_kit_modules[${JSON.stringify(specifier)}]) || (${PACKAGE_BRIDGES} || {})[${JSON.stringify(specifier)}]; if (!${name2}) throw new Error(${JSON.stringify(`[peach] replacement package bridge ${specifier} is not ready`)});`;
|
|
10602
11624
|
}
|
|
10603
11625
|
if (JSX_RUNTIME_SPECIFIERS.has(specifier)) {
|
|
10604
|
-
return `const ${
|
|
11626
|
+
return `const ${name2} = (() => { const react = ${REACT_BRIDGE}; if (!react) throw new Error(${notReady("React")}); const jsx = (type, props, key) => react.createElement(type, key === undefined ? props : { ...props, key }); return { Fragment: react.Fragment, jsx, jsxs: jsx, jsxDEV: jsx }; })();`;
|
|
10605
11627
|
}
|
|
10606
|
-
return `const ${
|
|
11628
|
+
return `const ${name2} = (${PACKAGE_BRIDGES} || {})[${JSON.stringify(specifier)}]; if (!${name2}) throw new Error(${JSON.stringify(`[peach] replacement package bridge ${specifier} is not ready`)});`;
|
|
10607
11629
|
}
|
|
10608
11630
|
var DEFAULT_INTEROP = "__rnxReplacementDefault";
|
|
10609
11631
|
var DEFAULT_INTEROP_DECLARATION = `const ${DEFAULT_INTEROP} = (bridge) => (bridge && bridge.__esModule ? bridge.default : bridge);`;
|
|
@@ -10635,10 +11657,10 @@ function compileReplacementModule(input) {
|
|
|
10635
11657
|
const bridgeFor = (specifier) => {
|
|
10636
11658
|
const existing = bridgeNames.get(specifier);
|
|
10637
11659
|
if (existing) return existing;
|
|
10638
|
-
const
|
|
10639
|
-
bridgeNames.set(specifier,
|
|
10640
|
-
declarations.push(bridgeDeclaration(
|
|
10641
|
-
return
|
|
11660
|
+
const name2 = `__rnxReplacementBridge${bridgeNames.size}`;
|
|
11661
|
+
bridgeNames.set(specifier, name2);
|
|
11662
|
+
declarations.push(bridgeDeclaration(name2, specifier));
|
|
11663
|
+
return name2;
|
|
10642
11664
|
};
|
|
10643
11665
|
const edits = [];
|
|
10644
11666
|
const pointAtLocalModule = (specifierToken, specifier) => {
|
|
@@ -10777,16 +11799,16 @@ function sendJavaScript(req, res, source) {
|
|
|
10777
11799
|
res.end(req.method === "HEAD" ? void 0 : source);
|
|
10778
11800
|
}
|
|
10779
11801
|
function resolveReplacementModuleFile(fromFile, specifier) {
|
|
10780
|
-
const base =
|
|
11802
|
+
const base = import_node_path17.default.resolve(import_node_path17.default.dirname(fromFile), specifier);
|
|
10781
11803
|
const candidates = [
|
|
10782
11804
|
...REPLACEMENT_MODULE_EXTENSIONS.some(
|
|
10783
|
-
(ext) => ext ===
|
|
11805
|
+
(ext) => ext === import_node_path17.default.extname(base).toLowerCase()
|
|
10784
11806
|
) ? [base] : [],
|
|
10785
11807
|
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => base + ext),
|
|
10786
|
-
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) =>
|
|
11808
|
+
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => import_node_path17.default.join(base, `index${ext}`))
|
|
10787
11809
|
];
|
|
10788
11810
|
const found = candidates.find(
|
|
10789
|
-
(candidate) => (0,
|
|
11811
|
+
(candidate) => (0, import_node_fs14.statSync)(candidate, { throwIfNoEntry: false })?.isFile()
|
|
10790
11812
|
);
|
|
10791
11813
|
if (!found) {
|
|
10792
11814
|
throw new Error(
|
|
@@ -10797,8 +11819,8 @@ function resolveReplacementModuleFile(fromFile, specifier) {
|
|
|
10797
11819
|
}
|
|
10798
11820
|
function isInsideAny(roots, file) {
|
|
10799
11821
|
return roots.some((root) => {
|
|
10800
|
-
const relative2 =
|
|
10801
|
-
return !relative2.startsWith("..") && !
|
|
11822
|
+
const relative2 = import_node_path17.default.relative(root, file);
|
|
11823
|
+
return !relative2.startsWith("..") && !import_node_path17.default.isAbsolute(relative2);
|
|
10802
11824
|
});
|
|
10803
11825
|
}
|
|
10804
11826
|
async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
@@ -10838,19 +11860,19 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
10838
11860
|
res.end("missing path param");
|
|
10839
11861
|
return true;
|
|
10840
11862
|
}
|
|
10841
|
-
const extension =
|
|
11863
|
+
const extension = import_node_path17.default.extname(targetPath).toLowerCase();
|
|
10842
11864
|
if (!REPLACEMENT_MODULE_EXTENSIONS.some((allowed) => allowed === extension)) {
|
|
10843
11865
|
res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
|
|
10844
11866
|
res.end(`replacement files must be ${REPLACEMENT_MODULE_EXTENSIONS.join(", ")}`);
|
|
10845
11867
|
return true;
|
|
10846
11868
|
}
|
|
10847
|
-
if (!
|
|
11869
|
+
if (!import_node_path17.default.isAbsolute(targetPath)) {
|
|
10848
11870
|
res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
|
|
10849
11871
|
res.end("replacement file path must be absolute");
|
|
10850
11872
|
return true;
|
|
10851
11873
|
}
|
|
10852
11874
|
const runtimePackages = new Set(url.searchParams.getAll("runtimePackage"));
|
|
10853
|
-
const servedRoots = options.servedRoots?.map((root) =>
|
|
11875
|
+
const servedRoots = options.servedRoots?.map((root) => import_node_path17.default.resolve(root));
|
|
10854
11876
|
if (servedRoots && !isInsideAny(servedRoots, targetPath)) {
|
|
10855
11877
|
res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
|
|
10856
11878
|
res.end("replacement file must be inside a folder the bundler serves");
|
|
@@ -10858,7 +11880,7 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
10858
11880
|
}
|
|
10859
11881
|
let resolvedTargetPath;
|
|
10860
11882
|
try {
|
|
10861
|
-
resolvedTargetPath = await
|
|
11883
|
+
resolvedTargetPath = await import_promises7.default.realpath(targetPath);
|
|
10862
11884
|
} catch (error) {
|
|
10863
11885
|
const message = error instanceof Error ? error.message : String(error);
|
|
10864
11886
|
res.writeHead(404, { "Content-Type": "text/plain; charset=utf-8" });
|
|
@@ -10866,7 +11888,7 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
10866
11888
|
return true;
|
|
10867
11889
|
}
|
|
10868
11890
|
if (servedRoots) {
|
|
10869
|
-
const realRoots = (await Promise.all(servedRoots.map((root) =>
|
|
11891
|
+
const realRoots = (await Promise.all(servedRoots.map((root) => import_promises7.default.realpath(root).catch(() => null)))).filter((root) => root !== null);
|
|
10870
11892
|
if (!isInsideAny(realRoots, resolvedTargetPath)) {
|
|
10871
11893
|
res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
|
|
10872
11894
|
res.end("replacement file must be inside a folder the bundler serves");
|
|
@@ -10876,7 +11898,7 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
10876
11898
|
try {
|
|
10877
11899
|
const compiled = compileReplacementModule({
|
|
10878
11900
|
filePath: resolvedTargetPath,
|
|
10879
|
-
source: await
|
|
11901
|
+
source: await import_promises7.default.readFile(resolvedTargetPath, "utf8"),
|
|
10880
11902
|
runtimePackages,
|
|
10881
11903
|
// the imported file's url is this request's with only its path changed,
|
|
10882
11904
|
// so the token, cache key and runtime packages carry over.
|
|
@@ -10905,7 +11927,7 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
10905
11927
|
|
|
10906
11928
|
// src/one-native-app-catalog.ts
|
|
10907
11929
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
10908
|
-
var
|
|
11930
|
+
var import_node_path18 = __toESM(require("node:path"), 1);
|
|
10909
11931
|
var ONE_NATIVE_APP_CATALOG_ROUTE = "/__peach/native-app-catalog";
|
|
10910
11932
|
var HEX_COLOR = /^#[\da-f]{6}$/i;
|
|
10911
11933
|
function parseAccent(value) {
|
|
@@ -10917,7 +11939,7 @@ function parseAccent(value) {
|
|
|
10917
11939
|
function parseOneNativeAppCatalog(value) {
|
|
10918
11940
|
if (!isRecord(value)) return null;
|
|
10919
11941
|
const accentColor = parseAccent(value.accentColor);
|
|
10920
|
-
const assetCatalog = typeof value.assetCatalog === "string" &&
|
|
11942
|
+
const assetCatalog = typeof value.assetCatalog === "string" && import_node_path18.default.isAbsolute(value.assetCatalog) ? value.assetCatalog : null;
|
|
10921
11943
|
return accentColor || assetCatalog ? { accentColor, assetCatalog } : null;
|
|
10922
11944
|
}
|
|
10923
11945
|
function readOneNativeAppCatalog(entryConfig, root) {
|
|
@@ -10926,19 +11948,19 @@ function readOneNativeAppCatalog(entryConfig, root) {
|
|
|
10926
11948
|
if (!isRecord(ios)) return null;
|
|
10927
11949
|
return parseOneNativeAppCatalog({
|
|
10928
11950
|
accentColor: ios.accentColor,
|
|
10929
|
-
assetCatalog: typeof ios.assetCatalog === "string" ?
|
|
11951
|
+
assetCatalog: typeof ios.assetCatalog === "string" ? import_node_path18.default.resolve(root, ios.assetCatalog) : null
|
|
10930
11952
|
});
|
|
10931
11953
|
}
|
|
10932
11954
|
|
|
10933
11955
|
// src/one-widget-metadata.ts
|
|
10934
11956
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
10935
|
-
var
|
|
10936
|
-
var
|
|
10937
|
-
var
|
|
11957
|
+
var import_node_child_process11 = require("node:child_process");
|
|
11958
|
+
var import_node_crypto6 = require("node:crypto");
|
|
11959
|
+
var import_node_fs15 = __toESM(require("node:fs"), 1);
|
|
10938
11960
|
var import_node_module2 = require("node:module");
|
|
10939
|
-
var
|
|
11961
|
+
var import_node_path19 = __toESM(require("node:path"), 1);
|
|
10940
11962
|
var import_node_util7 = require("node:util");
|
|
10941
|
-
var run6 = (0, import_node_util7.promisify)(
|
|
11963
|
+
var run6 = (0, import_node_util7.promisify)(import_node_child_process11.execFile);
|
|
10942
11964
|
var configs = /* @__PURE__ */ new Map();
|
|
10943
11965
|
var reads = /* @__PURE__ */ new Map();
|
|
10944
11966
|
var CONFIG_CHILD = `
|
|
@@ -10958,8 +11980,8 @@ fs.writeFileSync(process.argv[2], JSON.stringify({
|
|
|
10958
11980
|
function configStamp(files) {
|
|
10959
11981
|
return JSON.stringify(
|
|
10960
11982
|
files.map((file) => {
|
|
10961
|
-
if (!
|
|
10962
|
-
const stat =
|
|
11983
|
+
if (!import_node_fs15.default.existsSync(file)) return [file, null];
|
|
11984
|
+
const stat = import_node_fs15.default.statSync(file);
|
|
10963
11985
|
return [file, stat.mtimeMs, stat.ctimeMs, stat.size];
|
|
10964
11986
|
})
|
|
10965
11987
|
);
|
|
@@ -10970,13 +11992,13 @@ async function readConfig(root) {
|
|
|
10970
11992
|
const reading = reads.get(root);
|
|
10971
11993
|
if (reading) return reading;
|
|
10972
11994
|
const promise = (async () => {
|
|
10973
|
-
(0, import_node_module2.createRequire)(
|
|
10974
|
-
const cache =
|
|
10975
|
-
|
|
10976
|
-
const directory =
|
|
10977
|
-
const script =
|
|
10978
|
-
const result =
|
|
10979
|
-
|
|
11995
|
+
(0, import_node_module2.createRequire)(import_node_path19.default.join(root, "package.json")).resolve("one/vite");
|
|
11996
|
+
const cache = import_node_path19.default.join(root, "node_modules/.cache/peach-widget-config");
|
|
11997
|
+
import_node_fs15.default.mkdirSync(cache, { recursive: true });
|
|
11998
|
+
const directory = import_node_fs15.default.mkdtempSync(import_node_path19.default.join(cache, "read-"));
|
|
11999
|
+
const script = import_node_path19.default.join(directory, "read.mjs");
|
|
12000
|
+
const result = import_node_path19.default.join(directory, "result.json");
|
|
12001
|
+
import_node_fs15.default.writeFileSync(script, CONFIG_CHILD);
|
|
10980
12002
|
try {
|
|
10981
12003
|
await run6(process.execPath, [script, result], {
|
|
10982
12004
|
cwd: root,
|
|
@@ -10984,7 +12006,7 @@ async function readConfig(root) {
|
|
|
10984
12006
|
timeout: 3e4,
|
|
10985
12007
|
maxBuffer: 1024 * 1024
|
|
10986
12008
|
});
|
|
10987
|
-
const value = JSON.parse(
|
|
12009
|
+
const value = JSON.parse(import_node_fs15.default.readFileSync(result, "utf8"));
|
|
10988
12010
|
if (!isRecord(value) || !Array.isArray(value.watched) || !value.watched.every((file) => typeof file === "string"))
|
|
10989
12011
|
throw new Error("One config loader returned invalid dependencies");
|
|
10990
12012
|
if (!Array.isArray(value.urlSchemes) || !value.urlSchemes.every(
|
|
@@ -11007,8 +12029,8 @@ async function readConfig(root) {
|
|
|
11007
12029
|
}
|
|
11008
12030
|
const watched = [
|
|
11009
12031
|
.../* @__PURE__ */ new Set([
|
|
11010
|
-
|
|
11011
|
-
...value.watched.map((file) =>
|
|
12032
|
+
import_node_path19.default.join(root, "package.json"),
|
|
12033
|
+
...value.watched.map((file) => import_node_path19.default.resolve(root, file))
|
|
11012
12034
|
])
|
|
11013
12035
|
];
|
|
11014
12036
|
const loaded2 = {
|
|
@@ -11020,7 +12042,7 @@ async function readConfig(root) {
|
|
|
11020
12042
|
configs.set(root, loaded2);
|
|
11021
12043
|
return loaded2;
|
|
11022
12044
|
} finally {
|
|
11023
|
-
|
|
12045
|
+
import_node_fs15.default.rmSync(directory, { recursive: true, force: true });
|
|
11024
12046
|
}
|
|
11025
12047
|
})();
|
|
11026
12048
|
reads.set(root, promise);
|
|
@@ -11041,13 +12063,13 @@ function declaredFamilies(source) {
|
|
|
11041
12063
|
return home;
|
|
11042
12064
|
}
|
|
11043
12065
|
async function readOneWidgetSources(appRoot) {
|
|
11044
|
-
const root =
|
|
12066
|
+
const root = import_node_fs15.default.realpathSync(appRoot);
|
|
11045
12067
|
const config = await readConfig(root);
|
|
11046
12068
|
if (!config.widget) return null;
|
|
11047
12069
|
const widget = config.widget;
|
|
11048
12070
|
const sourceFiles = {
|
|
11049
|
-
"OneWidget.swift":
|
|
11050
|
-
"OneWidgetContract.swift":
|
|
12071
|
+
"OneWidget.swift": import_node_path19.default.join(root, "ios/OneWidgets/OneWidget.swift"),
|
|
12072
|
+
"OneWidgetContract.swift": import_node_path19.default.join(
|
|
11051
12073
|
root,
|
|
11052
12074
|
"ios",
|
|
11053
12075
|
widget.appName,
|
|
@@ -11056,15 +12078,15 @@ async function readOneWidgetSources(appRoot) {
|
|
|
11056
12078
|
};
|
|
11057
12079
|
const files = /* @__PURE__ */ new Map();
|
|
11058
12080
|
const sources = {};
|
|
11059
|
-
for (const [
|
|
11060
|
-
if (!
|
|
12081
|
+
for (const [name2, file] of Object.entries(sourceFiles)) {
|
|
12082
|
+
if (!import_node_fs15.default.existsSync(file))
|
|
11061
12083
|
throw new Error(`missing One widget prebuild source ${file}; run one prebuild`);
|
|
11062
12084
|
const bytes = readPackageFile(root, file, MAX_SWIFT_COMPILE_SOURCE_BYTES);
|
|
11063
12085
|
const text = bytes.toString("utf8");
|
|
11064
12086
|
if (!Buffer.from(text).equals(bytes))
|
|
11065
12087
|
throw new Error(`One widget prebuild source is not UTF-8: ${file}`);
|
|
11066
|
-
files.set(
|
|
11067
|
-
sources[
|
|
12088
|
+
files.set(name2, text);
|
|
12089
|
+
sources[import_node_path19.default.relative(root, file).split(import_node_path19.default.sep).join("/")] = (0, import_node_crypto6.createHash)("sha256").update(bytes).digest("hex");
|
|
11068
12090
|
}
|
|
11069
12091
|
const contract = files.get("OneWidgetContract.swift") ?? "";
|
|
11070
12092
|
const source = files.get("OneWidget.swift") ?? "";
|
|
@@ -11088,13 +12110,217 @@ async function configuredOneWidget(appRoot, bundleUrl) {
|
|
|
11088
12110
|
return {
|
|
11089
12111
|
metadata: source.widget,
|
|
11090
12112
|
projectRoot: source.root,
|
|
11091
|
-
appIdentity: (0,
|
|
12113
|
+
appIdentity: (0, import_node_crypto6.createHash)("sha256").update(JSON.stringify([source.root, source.widget.bundleId])).digest("hex"),
|
|
11092
12114
|
bundleUrl,
|
|
11093
12115
|
packageUrl: new URL(`${SWIFT_PACKAGE_PATH}OneWidgets`, bundleUrl).href,
|
|
11094
12116
|
urlSchemes: source.urlSchemes
|
|
11095
12117
|
};
|
|
11096
12118
|
}
|
|
11097
12119
|
|
|
12120
|
+
// src/runtime-packs.ts
|
|
12121
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
12122
|
+
var import_node_fs16 = __toESM(require("node:fs"), 1);
|
|
12123
|
+
var import_node_path20 = __toESM(require("node:path"), 1);
|
|
12124
|
+
var import_node_timers = require("node:timers");
|
|
12125
|
+
|
|
12126
|
+
// src/runtime-delivery.ts
|
|
12127
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
12128
|
+
|
|
12129
|
+
// src/public-brand.ts
|
|
12130
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
12131
|
+
var name = "Peach";
|
|
12132
|
+
var peachPublicBrand = Object.freeze({
|
|
12133
|
+
name,
|
|
12134
|
+
packageName: "peachsim",
|
|
12135
|
+
commandName: "peach",
|
|
12136
|
+
domain: "peachsim.com",
|
|
12137
|
+
origin: "https://peachsim.com",
|
|
12138
|
+
boxOrigin: "https://rnx-box.contrast.dev"
|
|
12139
|
+
});
|
|
12140
|
+
|
|
12141
|
+
// src/runtime-delivery.ts
|
|
12142
|
+
var DEFAULT_RUNTIME_CDN_ORIGIN = peachPublicBrand.origin;
|
|
12143
|
+
var RNX_CHANGELOG_URL = `${peachPublicBrand.origin}/changelog`;
|
|
12144
|
+
var RNX_CHANGELOG_API_URL = `${peachPublicBrand.origin}/api/changelog/sootsim`;
|
|
12145
|
+
var RNX_RUNTIME_PRODUCT = {
|
|
12146
|
+
id: "peach",
|
|
12147
|
+
defaultCdnOrigin: DEFAULT_RUNTIME_CDN_ORIGIN,
|
|
12148
|
+
manifestPath: "/runtimes/manifest.json",
|
|
12149
|
+
tarballPath: (version) => `/runtimes/sootsim-runtime-${version}.tar.zst`,
|
|
12150
|
+
// the engine runtime is a static SPA: shell at the root, engine/ and
|
|
12151
|
+
// engine-tenant/ beneath it. index.html is what the daemon and the
|
|
12152
|
+
// vite/metro plugins serve, so its absence means the tarball is not one.
|
|
12153
|
+
installedMarker: "index.html",
|
|
12154
|
+
verifyInstall: ensureCliCompanion,
|
|
12155
|
+
env: {
|
|
12156
|
+
cdnOrigin: "PEACH_CDN_ORIGIN",
|
|
12157
|
+
channel: "PEACH_RUNTIME_CHANNEL"
|
|
12158
|
+
},
|
|
12159
|
+
ensureHome: ensureRnxHome,
|
|
12160
|
+
configFile: configFilePath,
|
|
12161
|
+
runtimesDir,
|
|
12162
|
+
runtimeDir,
|
|
12163
|
+
cacheDir,
|
|
12164
|
+
readActiveRuntime,
|
|
12165
|
+
writeActiveRuntime
|
|
12166
|
+
};
|
|
12167
|
+
var rnxRuntime = createRuntimeDelivery(RNX_RUNTIME_PRODUCT);
|
|
12168
|
+
|
|
12169
|
+
// src/runtime-packs.ts
|
|
12170
|
+
var inflight = /* @__PURE__ */ new Map();
|
|
12171
|
+
var packsByRoot = /* @__PURE__ */ new Map();
|
|
12172
|
+
var listedByRoot = /* @__PURE__ */ new Map();
|
|
12173
|
+
function listedFiles(runtimeRoot) {
|
|
12174
|
+
let listed = listedByRoot.get(runtimeRoot);
|
|
12175
|
+
if (listed) return listed;
|
|
12176
|
+
listed = /* @__PURE__ */ new Map();
|
|
12177
|
+
for (const [pack, entry] of Object.entries(readPacks(runtimeRoot) ?? {}))
|
|
12178
|
+
for (const file of entry.files ?? []) {
|
|
12179
|
+
const name2 = import_node_path20.default.posix.basename(file);
|
|
12180
|
+
listed.set(name2, [...listed.get(name2) ?? [], { file, pack }]);
|
|
12181
|
+
}
|
|
12182
|
+
listedByRoot.set(runtimeRoot, listed);
|
|
12183
|
+
return listed;
|
|
12184
|
+
}
|
|
12185
|
+
function readPacks(runtimeRoot) {
|
|
12186
|
+
const cached = packsByRoot.get(runtimeRoot);
|
|
12187
|
+
if (cached !== void 0) return cached;
|
|
12188
|
+
const file = import_node_path20.default.join(runtimeRoot, RUNTIME_PACKS_FILE);
|
|
12189
|
+
if (!import_node_fs16.default.existsSync(file)) {
|
|
12190
|
+
packsByRoot.set(runtimeRoot, null);
|
|
12191
|
+
return null;
|
|
12192
|
+
}
|
|
12193
|
+
const parsed = JSON.parse(import_node_fs16.default.readFileSync(file, "utf8"));
|
|
12194
|
+
const packs = {};
|
|
12195
|
+
if (typeof parsed !== "object" || parsed === null)
|
|
12196
|
+
throw new Error(`${file} is not an object`);
|
|
12197
|
+
for (const [prefix, entry] of Object.entries(parsed)) {
|
|
12198
|
+
if (typeof entry?.file !== "string" || typeof entry?.sha256 !== "string")
|
|
12199
|
+
throw new Error(`${file} entry ${prefix} lacks file and sha256`);
|
|
12200
|
+
const files = entry.files;
|
|
12201
|
+
if (files !== void 0 && !(Array.isArray(files) && files.every((f) => typeof f === "string")))
|
|
12202
|
+
throw new Error(`${file} entry ${prefix} has files that are not paths`);
|
|
12203
|
+
packs[prefix] = {
|
|
12204
|
+
file: entry.file,
|
|
12205
|
+
sha256: entry.sha256,
|
|
12206
|
+
...files ? { files } : {}
|
|
12207
|
+
};
|
|
12208
|
+
}
|
|
12209
|
+
packsByRoot.set(runtimeRoot, packs);
|
|
12210
|
+
return packs;
|
|
12211
|
+
}
|
|
12212
|
+
async function ensureRuntimePackFor(runtimeRoot, pathname) {
|
|
12213
|
+
warmRuntimePacks(runtimeRoot);
|
|
12214
|
+
const prefix = RUNTIME_PACK_PREFIXES.find(
|
|
12215
|
+
(candidate) => pathname.includes(`/${candidate}`)
|
|
12216
|
+
);
|
|
12217
|
+
if (prefix) {
|
|
12218
|
+
await installNamedPack(runtimeRoot, prefix);
|
|
12219
|
+
return;
|
|
12220
|
+
}
|
|
12221
|
+
const listed = listedFiles(runtimeRoot).get(import_node_path20.default.posix.basename(pathname))?.find(({ file }) => pathname.endsWith(`/${file}`));
|
|
12222
|
+
if (listed) {
|
|
12223
|
+
if (!import_node_fs16.default.existsSync(import_node_path20.default.join(runtimeRoot, listed.file)))
|
|
12224
|
+
await installNamedPack(runtimeRoot, listed.pack);
|
|
12225
|
+
return;
|
|
12226
|
+
}
|
|
12227
|
+
const at = pathname.indexOf(`/${RUNTIME_MERGE_PACK_DIR}`);
|
|
12228
|
+
if (at === -1) return;
|
|
12229
|
+
const tenantDir = import_node_path20.default.join(runtimeRoot, RUNTIME_MERGE_PACK_DIR);
|
|
12230
|
+
const rel = pathname.slice(at + RUNTIME_MERGE_PACK_DIR.length + 1);
|
|
12231
|
+
if (!/\.m?js$/.test(rel) || import_node_fs16.default.existsSync(import_node_path20.default.join(tenantDir, rel))) return;
|
|
12232
|
+
await installNamedPack(runtimeRoot, RUNTIME_MERGE_PACK_DIR);
|
|
12233
|
+
}
|
|
12234
|
+
function installNamedPack(runtimeRoot, name2) {
|
|
12235
|
+
if (name2 === RUNTIME_MERGE_PACK_DIR) {
|
|
12236
|
+
const tenantDir = import_node_path20.default.join(runtimeRoot, RUNTIME_MERGE_PACK_DIR);
|
|
12237
|
+
return mergePack(
|
|
12238
|
+
runtimeRoot,
|
|
12239
|
+
name2,
|
|
12240
|
+
import_node_path20.default.join(tenantDir, RUNTIME_MERGE_PACK_INSTALL),
|
|
12241
|
+
tenantDir
|
|
12242
|
+
);
|
|
12243
|
+
}
|
|
12244
|
+
if (readPacks(runtimeRoot)?.[name2]?.files)
|
|
12245
|
+
return mergePack(
|
|
12246
|
+
runtimeRoot,
|
|
12247
|
+
name2,
|
|
12248
|
+
import_node_path20.default.join(runtimeRoot, `.pack-${name2}`),
|
|
12249
|
+
runtimeRoot
|
|
12250
|
+
);
|
|
12251
|
+
return installPack(runtimeRoot, name2, import_node_path20.default.join(runtimeRoot, name2.slice(0, -1)));
|
|
12252
|
+
}
|
|
12253
|
+
var WARM_DELAY_MS = 3e4;
|
|
12254
|
+
var warming = /* @__PURE__ */ new Set();
|
|
12255
|
+
function warmRuntimePacks(runtimeRoot) {
|
|
12256
|
+
if (warming.has(runtimeRoot)) return;
|
|
12257
|
+
warming.add(runtimeRoot);
|
|
12258
|
+
const warm = async () => {
|
|
12259
|
+
for (const name2 of Object.keys(readPacks(runtimeRoot) ?? {}))
|
|
12260
|
+
if (!await installNamedPack(runtimeRoot, name2)) return;
|
|
12261
|
+
};
|
|
12262
|
+
const schedule = import_node_timers.setTimeout;
|
|
12263
|
+
schedule(() => void warm(), WARM_DELAY_MS).unref();
|
|
12264
|
+
}
|
|
12265
|
+
async function mergePack(runtimeRoot, name2, installDir, targetDir) {
|
|
12266
|
+
if (import_node_fs16.default.existsSync(import_node_path20.default.join(installDir, RUNTIME_MERGE_PACK_MERGED))) return true;
|
|
12267
|
+
if (!await installPack(runtimeRoot, name2, installDir)) return false;
|
|
12268
|
+
const link = (sub) => {
|
|
12269
|
+
for (const entry of import_node_fs16.default.readdirSync(import_node_path20.default.join(installDir, sub), {
|
|
12270
|
+
withFileTypes: true
|
|
12271
|
+
})) {
|
|
12272
|
+
const child = import_node_path20.default.join(sub, entry.name);
|
|
12273
|
+
if (entry.isDirectory()) {
|
|
12274
|
+
import_node_fs16.default.mkdirSync(import_node_path20.default.join(targetDir, child), { recursive: true });
|
|
12275
|
+
link(child);
|
|
12276
|
+
} else if (entry.name !== RUNTIME_PACK_MARKER) {
|
|
12277
|
+
try {
|
|
12278
|
+
import_node_fs16.default.linkSync(import_node_path20.default.join(installDir, child), import_node_path20.default.join(targetDir, child));
|
|
12279
|
+
} catch (error) {
|
|
12280
|
+
if (!(error instanceof Error && "code" in error && error.code === "EEXIST"))
|
|
12281
|
+
throw error;
|
|
12282
|
+
}
|
|
12283
|
+
}
|
|
12284
|
+
}
|
|
12285
|
+
};
|
|
12286
|
+
try {
|
|
12287
|
+
link("");
|
|
12288
|
+
import_node_fs16.default.writeFileSync(import_node_path20.default.join(installDir, RUNTIME_MERGE_PACK_MERGED), "");
|
|
12289
|
+
return true;
|
|
12290
|
+
} catch (error) {
|
|
12291
|
+
console.error(
|
|
12292
|
+
`[peach] ${name2} pack merge failed: ${error instanceof Error ? error.message : String(error)}`
|
|
12293
|
+
);
|
|
12294
|
+
return false;
|
|
12295
|
+
}
|
|
12296
|
+
}
|
|
12297
|
+
async function installPack(runtimeRoot, prefix, destDir) {
|
|
12298
|
+
const marker = import_node_path20.default.join(destDir, RUNTIME_PACK_MARKER);
|
|
12299
|
+
if (import_node_fs16.default.existsSync(marker)) return true;
|
|
12300
|
+
const pack = readPacks(runtimeRoot)?.[prefix];
|
|
12301
|
+
if (!pack) return true;
|
|
12302
|
+
let install = inflight.get(destDir);
|
|
12303
|
+
if (!install) {
|
|
12304
|
+
const version = import_node_path20.default.basename(runtimeRoot);
|
|
12305
|
+
const url = new URL(pack.file, rnxRuntime.tarballUrl(version));
|
|
12306
|
+
url.searchParams.set("sha256", pack.sha256);
|
|
12307
|
+
install = installVerifiedTarball({
|
|
12308
|
+
url: url.toString(),
|
|
12309
|
+
digest: { algorithm: "sha256", encoding: "hex", value: pack.sha256 },
|
|
12310
|
+
destDir,
|
|
12311
|
+
installedMarker: RUNTIME_PACK_MARKER,
|
|
12312
|
+
label: `peach runtime ${version} pack ${prefix}`
|
|
12313
|
+
}).catch((error) => {
|
|
12314
|
+
console.error(
|
|
12315
|
+
`[peach] ${prefix} pack download failed: ${error instanceof Error ? error.message : String(error)}`
|
|
12316
|
+
);
|
|
12317
|
+
}).finally(() => inflight.delete(destDir));
|
|
12318
|
+
inflight.set(destDir, install);
|
|
12319
|
+
}
|
|
12320
|
+
await install;
|
|
12321
|
+
return import_node_fs16.default.existsSync(marker);
|
|
12322
|
+
}
|
|
12323
|
+
|
|
11098
12324
|
// src/swift-vite-lifetime.ts
|
|
11099
12325
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
11100
12326
|
var LIFETIME = Symbol.for("peach.swift-vite-lifetime");
|
|
@@ -11132,11 +12358,11 @@ function requestAuthority(req) {
|
|
|
11132
12358
|
const authority = req.headers[":authority"];
|
|
11133
12359
|
return req.headers.host ?? (typeof authority === "string" ? authority : void 0);
|
|
11134
12360
|
}
|
|
11135
|
-
function exposeHeader(res,
|
|
12361
|
+
function exposeHeader(res, name2) {
|
|
11136
12362
|
const exposed = res.getHeader("access-control-expose-headers");
|
|
11137
12363
|
const names = typeof exposed === "string" && exposed ? exposed.split(/,\s*/) : [];
|
|
11138
|
-
if (!names.includes(
|
|
11139
|
-
res.setHeader("access-control-expose-headers", [...names,
|
|
12364
|
+
if (!names.includes(name2))
|
|
12365
|
+
res.setHeader("access-control-expose-headers", [...names, name2].join(", "));
|
|
11140
12366
|
}
|
|
11141
12367
|
var BUNDLE_SOURCE_REQUEST_HEADER = "x-peach-bundle-source";
|
|
11142
12368
|
var SWIFT_ROUTE_PREFIX = "/__peach/swift";
|
|
@@ -11232,7 +12458,7 @@ function peachPlugin(options = {}) {
|
|
|
11232
12458
|
}
|
|
11233
12459
|
res.setHeader(key, value);
|
|
11234
12460
|
}
|
|
11235
|
-
const forward = res.statusCode === 200 ? forwardRolldownBundleResponse(upstream, res) : (0,
|
|
12461
|
+
const forward = res.statusCode === 200 ? forwardRolldownBundleResponse(upstream, res) : (0, import_promises8.pipeline)(upstream, res);
|
|
11236
12462
|
forward.catch((error) => {
|
|
11237
12463
|
console.error("[peach] bundle forward failed", error);
|
|
11238
12464
|
const failure = error instanceof Error ? error : new Error(String(error));
|
|
@@ -11458,7 +12684,7 @@ function peachPlugin(options = {}) {
|
|
|
11458
12684
|
});
|
|
11459
12685
|
const bundleUrl = options.bundleUrl || "/node_modules/one/metro-entry.bundle?platform=ios&dev=true&minify=false";
|
|
11460
12686
|
const appName = resolveRnxDesktopAppName(options.open, server.config.root);
|
|
11461
|
-
const replacementToken = (0,
|
|
12687
|
+
const replacementToken = (0, import_node_crypto7.randomUUID)();
|
|
11462
12688
|
const bundleForOrigin = (origin) => {
|
|
11463
12689
|
const fullBundleUrl = new URL(bundleUrl, `${origin}/`).toString();
|
|
11464
12690
|
return tagRnxBundleForPlugin(
|
|
@@ -11546,7 +12772,7 @@ function peachPlugin(options = {}) {
|
|
|
11546
12772
|
if (!handled) next();
|
|
11547
12773
|
});
|
|
11548
12774
|
});
|
|
11549
|
-
server.middlewares.use((req, res, next) => {
|
|
12775
|
+
server.middlewares.use(async (req, res, next) => {
|
|
11550
12776
|
if (serveBrowserProxyRoute(req, res)) return;
|
|
11551
12777
|
const url = req.url || "";
|
|
11552
12778
|
const pathname = url.split("?")[0];
|
|
@@ -11560,6 +12786,7 @@ function peachPlugin(options = {}) {
|
|
|
11560
12786
|
next();
|
|
11561
12787
|
return;
|
|
11562
12788
|
}
|
|
12789
|
+
await ensureRuntimePackFor(runtimeRoot, pathname);
|
|
11563
12790
|
if (isRootRuntimeAssetPath(pathname)) {
|
|
11564
12791
|
const fullPath = resolveRuntimeFilePath(runtimeRoot, pathname);
|
|
11565
12792
|
if (fullPath) {
|