peachsim 0.1.2210 → 0.1.2215
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 +31 -13
- 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 +29 -11
- 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 +1019 -819
- package/dist-lib/host/fetch-proxy-handler.cjs +8 -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 +1956 -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 +1796 -593
- package/dist-lib/native-app-identity-project.cjs +6 -3
- package/dist-lib/native-app-identity-project.mjs +6 -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 +73 -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 +1555 -1297
- package/dist-lib/swift-compile.cjs +2 -2
- package/dist-lib/swift-compile.mjs +2 -2
- 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 +21 -9
- package/dist-lib/vite.cjs +1520 -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/native-layout.d.ts +4 -0
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/scene-table.d.ts +4 -0
- package/dist-types/packages/peach-engine/src/engine/scroll.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/render-worker/shell-protocol.d.ts +42 -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/UIKit.framework/Headers/UIImage.h +1 -10
- package/sdk/ios/System/Library/Frameworks/UIKitTypes.framework/Headers/UIKitTypes.h +11 -0
- package/sdk/ios/wasm/include/fcntl.h +3 -0
- 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/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-package-manifest.ts +7 -2
- package/src/swift-shipped-binaries.ts +1 -1
- package/src/swift-standin-config.ts +4 -2
- package/src/swift-standin-emit.ts +1 -1
- package/src/swift-standins.ts +10 -3
- 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.2215 | (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": "
|
|
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": "29c2661be4b952101c9b9b8fd861560e6ce63b25dd4464f47475aaf72024f4fe", "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,565 @@ 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/named/",
|
|
1871
|
+
"engine/fonts/vector-icons/",
|
|
1872
|
+
"engine/fonts/webview/",
|
|
1873
|
+
"engine/kotlin/",
|
|
1874
|
+
"engine/material-symbols/",
|
|
1875
|
+
"engine/pdfjs/",
|
|
1876
|
+
"three-mode/"
|
|
1877
|
+
];
|
|
1878
|
+
var RUNTIME_MERGE_PACK_DIR = "engine-tenant/";
|
|
1879
|
+
var RUNTIME_MERGE_PACK_INSTALL = ".pack-prod";
|
|
1880
|
+
var RUNTIME_MERGE_PACK_MERGED = ".merged";
|
|
1881
|
+
|
|
1882
|
+
// ../contrast-runtime-delivery/src/index.ts
|
|
1883
|
+
var DEFAULT_LOCAL_RUNTIME_RETENTION_COUNT = 2;
|
|
1884
|
+
function createRuntimeDelivery(product) {
|
|
1885
|
+
function readConfig2() {
|
|
1886
|
+
try {
|
|
1887
|
+
const parsed = JSON.parse(
|
|
1888
|
+
import_node_fs4.default.readFileSync(product.configFile(), "utf8")
|
|
1889
|
+
);
|
|
1890
|
+
return parsed && typeof parsed === "object" ? parsed : {};
|
|
1891
|
+
} catch {
|
|
1892
|
+
return {};
|
|
1893
|
+
}
|
|
1894
|
+
}
|
|
1895
|
+
function resolveCdnOrigin(input) {
|
|
1896
|
+
const config = readConfig2();
|
|
1897
|
+
const value = input || process.env[product.env.cdnOrigin] || config.cdnOrigin || product.defaultCdnOrigin;
|
|
1898
|
+
return value.replace(/\/+$/, "");
|
|
1899
|
+
}
|
|
1900
|
+
function resolveChannel(input) {
|
|
1901
|
+
const config = readConfig2();
|
|
1902
|
+
return input || process.env[product.env.channel] || config.runtimeChannel || product.defaultChannel || "stable";
|
|
1903
|
+
}
|
|
1904
|
+
function resolvePin() {
|
|
1905
|
+
if (!product.env.pin) return null;
|
|
1906
|
+
const env = process.env[product.env.pin];
|
|
1907
|
+
if (env && env.trim()) return env.trim();
|
|
1908
|
+
const config = readConfig2();
|
|
1909
|
+
return typeof config.runtimeVersion === "string" && config.runtimeVersion.trim() ? config.runtimeVersion.trim() : null;
|
|
1910
|
+
}
|
|
1911
|
+
function manifestUrl(cdnOrigin) {
|
|
1912
|
+
const url = new URL(`${resolveCdnOrigin(cdnOrigin)}${product.manifestPath}`);
|
|
1913
|
+
url.searchParams.set("t", String(Date.now()));
|
|
1914
|
+
return url.toString();
|
|
1915
|
+
}
|
|
1916
|
+
function tarballUrl(version, cdnOrigin) {
|
|
1917
|
+
return `${resolveCdnOrigin(cdnOrigin)}${product.tarballPath(version)}`;
|
|
1918
|
+
}
|
|
1919
|
+
const UP_TO_DATE_CHECK_TIMEOUT_MS = 2e3;
|
|
1920
|
+
async function fetchManifest(cdnOrigin, timeoutMs) {
|
|
1921
|
+
const url = manifestUrl(cdnOrigin);
|
|
1922
|
+
const res = await fetch(url, {
|
|
1923
|
+
headers: { Accept: "application/json" },
|
|
1924
|
+
// an install is allowed to wait; a best-effort check is not. see
|
|
1925
|
+
// UP_TO_DATE_CHECK_TIMEOUT_MS.
|
|
1926
|
+
...timeoutMs ? { signal: AbortSignal.timeout(timeoutMs) } : {}
|
|
1927
|
+
});
|
|
1928
|
+
if (!res.ok) {
|
|
1929
|
+
throw new Error(`manifest fetch failed: ${res.status} ${res.statusText} (${url})`);
|
|
1930
|
+
}
|
|
1931
|
+
return await res.json();
|
|
1932
|
+
}
|
|
1933
|
+
function resolveVersion(manifest, opts = {}) {
|
|
1934
|
+
const channel = resolveChannel(opts.channel);
|
|
1935
|
+
const version = opts.version || resolvePin() || manifest.channels[channel]?.latest;
|
|
1936
|
+
if (!version) {
|
|
1937
|
+
throw new Error(
|
|
1938
|
+
`no version specified and channel '${channel}' has no latest entry in the manifest`
|
|
1939
|
+
);
|
|
1940
|
+
}
|
|
1941
|
+
if (!isValidRuntimeVersion(version)) {
|
|
1942
|
+
throw new Error(`invalid runtime version: ${version}`);
|
|
1943
|
+
}
|
|
1944
|
+
const entry = manifest.versions[version];
|
|
1945
|
+
if (!entry) {
|
|
1946
|
+
throw new Error(
|
|
1947
|
+
`version ${version} not found in manifest; available: ${Object.keys(manifest.versions).slice(-10).join(", ") || "(none)"}`
|
|
1948
|
+
);
|
|
1949
|
+
}
|
|
1950
|
+
return { version, channel, entry };
|
|
1951
|
+
}
|
|
1952
|
+
async function isVerifiedInstall(dir) {
|
|
1953
|
+
if (!import_node_fs4.default.existsSync(import_node_path3.default.join(dir, product.installedMarker))) return false;
|
|
1954
|
+
try {
|
|
1955
|
+
await product.verifyInstall?.(dir);
|
|
1956
|
+
return true;
|
|
1957
|
+
} catch {
|
|
1958
|
+
return false;
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
async function install(opts = {}) {
|
|
1962
|
+
product.ensureHome();
|
|
1963
|
+
const cdnOrigin = resolveCdnOrigin(opts.cdnOrigin);
|
|
1964
|
+
const manifest = await fetchManifest(cdnOrigin);
|
|
1965
|
+
const { version, channel, entry } = resolveVersion(manifest, opts);
|
|
1966
|
+
const destDir = product.runtimeDir(version);
|
|
1967
|
+
const setActive = opts.setActive !== false;
|
|
1968
|
+
const protectVersions = [version, ...opts.protectVersions ?? []];
|
|
1969
|
+
pruneLocalRetention({ protectVersions });
|
|
1970
|
+
if (!opts.force && await isVerifiedInstall(destDir)) {
|
|
1971
|
+
if (setActive) product.writeActiveRuntime(version);
|
|
1972
|
+
pruneLocalRetention({ protectVersions });
|
|
1973
|
+
return {
|
|
1974
|
+
version,
|
|
1975
|
+
channel,
|
|
1976
|
+
cdnOrigin,
|
|
1977
|
+
runtimeDir: destDir,
|
|
1978
|
+
installed: false,
|
|
1979
|
+
activated: setActive,
|
|
1980
|
+
manifest
|
|
1981
|
+
};
|
|
1982
|
+
}
|
|
1983
|
+
if (!opts.quiet)
|
|
1984
|
+
process.stderr.write(`${product.id}: downloading runtime ${version}\u2026
|
|
1985
|
+
`);
|
|
1986
|
+
await installVerifiedTarball({
|
|
1987
|
+
url: entry.base?.tarball || entry.tarball || tarballUrl(version, cdnOrigin),
|
|
1988
|
+
digest: {
|
|
1989
|
+
algorithm: "sha256",
|
|
1990
|
+
encoding: "hex",
|
|
1991
|
+
value: entry.base?.sha256 ?? entry.sha256
|
|
1992
|
+
},
|
|
1993
|
+
destDir,
|
|
1994
|
+
installedMarker: product.installedMarker,
|
|
1995
|
+
verify: product.verifyInstall,
|
|
1996
|
+
label: `runtime ${version}`
|
|
1997
|
+
});
|
|
1998
|
+
if (setActive) product.writeActiveRuntime(version);
|
|
1999
|
+
pruneLocalRetention({ protectVersions });
|
|
2000
|
+
return {
|
|
2001
|
+
version,
|
|
2002
|
+
channel,
|
|
2003
|
+
cdnOrigin,
|
|
2004
|
+
runtimeDir: destDir,
|
|
2005
|
+
installed: true,
|
|
2006
|
+
activated: setActive,
|
|
2007
|
+
manifest
|
|
2008
|
+
};
|
|
2009
|
+
}
|
|
2010
|
+
async function updateToLatest(opts = {}) {
|
|
2011
|
+
product.ensureHome();
|
|
2012
|
+
pruneLocalRetention({ protectVersions: opts.protectVersions });
|
|
2013
|
+
const cdnOrigin = resolveCdnOrigin(opts.cdnOrigin);
|
|
2014
|
+
const channel = resolveChannel(opts.channel);
|
|
2015
|
+
const pin = resolvePin();
|
|
2016
|
+
if (pin) {
|
|
2017
|
+
const activeVersion2 = product.readActiveRuntime();
|
|
2018
|
+
const pinInstalled = await isVerifiedInstall(product.runtimeDir(pin));
|
|
2019
|
+
if (activeVersion2 === pin && pinInstalled) {
|
|
2020
|
+
return {
|
|
2021
|
+
checked: true,
|
|
2022
|
+
updated: false,
|
|
2023
|
+
reason: `runtime is pinned to ${pin}`,
|
|
2024
|
+
activeVersion: activeVersion2,
|
|
2025
|
+
latestVersion: pin
|
|
2026
|
+
};
|
|
2027
|
+
}
|
|
2028
|
+
const installed2 = await install({
|
|
2029
|
+
version: pin,
|
|
2030
|
+
channel,
|
|
2031
|
+
cdnOrigin,
|
|
2032
|
+
setActive: false,
|
|
2033
|
+
protectVersions: opts.protectVersions
|
|
2034
|
+
});
|
|
2035
|
+
return {
|
|
2036
|
+
checked: true,
|
|
2037
|
+
updated: true,
|
|
2038
|
+
reason: `runtime is pinned to ${pin}`,
|
|
2039
|
+
activeVersion: pin,
|
|
2040
|
+
latestVersion: pin,
|
|
2041
|
+
install: installed2
|
|
2042
|
+
};
|
|
2043
|
+
}
|
|
2044
|
+
const manifest = await fetchManifest(cdnOrigin);
|
|
2045
|
+
const latestVersion = manifest.channels[channel]?.latest;
|
|
2046
|
+
if (!latestVersion) {
|
|
2047
|
+
return {
|
|
2048
|
+
checked: true,
|
|
2049
|
+
updated: false,
|
|
2050
|
+
reason: `channel '${channel}' has no latest runtime`,
|
|
2051
|
+
activeVersion: product.readActiveRuntime()
|
|
2052
|
+
};
|
|
2053
|
+
}
|
|
2054
|
+
const entry = manifest.versions[latestVersion];
|
|
2055
|
+
if (!entry) {
|
|
2056
|
+
return {
|
|
2057
|
+
checked: true,
|
|
2058
|
+
updated: false,
|
|
2059
|
+
reason: `manifest is missing version ${latestVersion}`,
|
|
2060
|
+
activeVersion: product.readActiveRuntime(),
|
|
2061
|
+
latestVersion
|
|
2062
|
+
};
|
|
2063
|
+
}
|
|
2064
|
+
const activeVersion = product.readActiveRuntime();
|
|
2065
|
+
const activeDir = activeVersion ? product.runtimeDir(activeVersion) : null;
|
|
2066
|
+
const activeInstalled = activeDir ? await isVerifiedInstall(activeDir) : false;
|
|
2067
|
+
const shouldInstall = !activeVersion || !activeInstalled || compareSemver(latestVersion, activeVersion) > 0;
|
|
2068
|
+
if (!shouldInstall) {
|
|
2069
|
+
return {
|
|
2070
|
+
checked: true,
|
|
2071
|
+
updated: false,
|
|
2072
|
+
reason: "active runtime is current",
|
|
2073
|
+
activeVersion,
|
|
2074
|
+
latestVersion
|
|
2075
|
+
};
|
|
2076
|
+
}
|
|
2077
|
+
const installed = await install({
|
|
2078
|
+
version: latestVersion,
|
|
2079
|
+
channel,
|
|
2080
|
+
cdnOrigin,
|
|
2081
|
+
setActive: false,
|
|
2082
|
+
protectVersions: opts.protectVersions
|
|
2083
|
+
});
|
|
2084
|
+
return {
|
|
2085
|
+
checked: true,
|
|
2086
|
+
updated: true,
|
|
2087
|
+
activeVersion: latestVersion,
|
|
2088
|
+
latestVersion,
|
|
2089
|
+
install: installed
|
|
2090
|
+
};
|
|
2091
|
+
}
|
|
2092
|
+
async function checkUpToDate(opts = {}) {
|
|
2093
|
+
const active = product.readActiveRuntime();
|
|
2094
|
+
const pinned = resolvePin();
|
|
2095
|
+
if (pinned) {
|
|
2096
|
+
return { active, latest: pinned, pinned, outdated: active !== pinned };
|
|
2097
|
+
}
|
|
2098
|
+
try {
|
|
2099
|
+
const manifest = await fetchManifest(
|
|
2100
|
+
resolveCdnOrigin(opts.cdnOrigin),
|
|
2101
|
+
UP_TO_DATE_CHECK_TIMEOUT_MS
|
|
2102
|
+
);
|
|
2103
|
+
const channel = resolveChannel(opts.channel);
|
|
2104
|
+
const latest = manifest.channels[channel]?.latest ?? null;
|
|
2105
|
+
const outdated = !!(latest && (!active || compareSemver(latest, active) > 0));
|
|
2106
|
+
return { active, latest, pinned: null, outdated };
|
|
2107
|
+
} catch {
|
|
2108
|
+
return { active, latest: null, pinned: null, outdated: false };
|
|
2109
|
+
}
|
|
2110
|
+
}
|
|
2111
|
+
function planLocalRetention(opts = {}) {
|
|
2112
|
+
product.ensureHome();
|
|
2113
|
+
const retainVersions = Math.max(
|
|
2114
|
+
1,
|
|
2115
|
+
Math.floor(opts.retainVersions ?? DEFAULT_LOCAL_RUNTIME_RETENTION_COUNT)
|
|
2116
|
+
);
|
|
2117
|
+
const installed = listInstalledRuntimes(product);
|
|
2118
|
+
const installedSet = new Set(installed);
|
|
2119
|
+
const activeVersion = product.readActiveRuntime();
|
|
2120
|
+
const pinnedVersion = resolvePin();
|
|
2121
|
+
const keep = /* @__PURE__ */ new Set();
|
|
2122
|
+
for (const version of [
|
|
2123
|
+
activeVersion,
|
|
2124
|
+
pinnedVersion,
|
|
2125
|
+
...opts.protectVersions ?? []
|
|
2126
|
+
]) {
|
|
2127
|
+
if (version && installedSet.has(version)) keep.add(version);
|
|
2128
|
+
}
|
|
2129
|
+
for (const version of [...installed].reverse()) {
|
|
2130
|
+
if (keep.size >= retainVersions) break;
|
|
2131
|
+
keep.add(version);
|
|
2132
|
+
}
|
|
2133
|
+
const cacheTemplateMarker = "__RUNTIME_VERSION__";
|
|
2134
|
+
const cacheTemplate = runtimeTarballCacheName(product, cacheTemplateMarker);
|
|
2135
|
+
const markerOffset = cacheTemplate.indexOf(cacheTemplateMarker);
|
|
2136
|
+
const cachePrefix = cacheTemplate.slice(0, markerOffset);
|
|
2137
|
+
const cacheSuffix = cacheTemplate.slice(markerOffset + cacheTemplateMarker.length);
|
|
2138
|
+
let removeCacheFiles = [];
|
|
2139
|
+
if (markerOffset >= 0) {
|
|
2140
|
+
try {
|
|
2141
|
+
removeCacheFiles = import_node_fs4.default.readdirSync(product.cacheDir(), { withFileTypes: true }).filter((entry) => {
|
|
2142
|
+
if (!entry.isFile()) return false;
|
|
2143
|
+
const complete = entry.name.startsWith(cachePrefix) && entry.name.endsWith(cacheSuffix);
|
|
2144
|
+
const partial = entry.name.startsWith(cachePrefix) && entry.name.endsWith(`${cacheSuffix}.partial`);
|
|
2145
|
+
return complete || partial;
|
|
2146
|
+
}).map((entry) => import_node_path3.default.join(product.cacheDir(), entry.name)).sort();
|
|
2147
|
+
} catch {
|
|
2148
|
+
}
|
|
2149
|
+
}
|
|
2150
|
+
return {
|
|
2151
|
+
activeVersion,
|
|
2152
|
+
pinnedVersion,
|
|
2153
|
+
keepVersions: installed.filter((version) => keep.has(version)),
|
|
2154
|
+
removeVersions: installed.filter((version) => !keep.has(version)),
|
|
2155
|
+
removeCacheFiles
|
|
2156
|
+
};
|
|
2157
|
+
}
|
|
2158
|
+
function pruneLocalRetention(opts = {}) {
|
|
2159
|
+
const plan = planLocalRetention(opts);
|
|
2160
|
+
for (const version of plan.removeVersions) {
|
|
2161
|
+
import_node_fs4.default.rmSync(product.runtimeDir(version), { recursive: true, force: true });
|
|
2162
|
+
}
|
|
2163
|
+
for (const cacheFile of plan.removeCacheFiles) {
|
|
2164
|
+
import_node_fs4.default.rmSync(cacheFile, { force: true });
|
|
2165
|
+
}
|
|
2166
|
+
return plan;
|
|
2167
|
+
}
|
|
2168
|
+
return {
|
|
2169
|
+
product,
|
|
2170
|
+
resolveCdnOrigin,
|
|
2171
|
+
resolveChannel,
|
|
2172
|
+
resolvePin,
|
|
2173
|
+
manifestUrl,
|
|
2174
|
+
tarballUrl,
|
|
2175
|
+
fetchManifest,
|
|
2176
|
+
resolveVersion,
|
|
2177
|
+
install,
|
|
2178
|
+
updateToLatest,
|
|
2179
|
+
checkUpToDate,
|
|
2180
|
+
planLocalRetention,
|
|
2181
|
+
pruneLocalRetention,
|
|
2182
|
+
listInstalled: () => listInstalledRuntimes(product)
|
|
2183
|
+
};
|
|
2184
|
+
}
|
|
2185
|
+
async function installVerifiedTarball(tarball) {
|
|
2186
|
+
const { destDir, installedMarker, signal } = tarball;
|
|
2187
|
+
import_node_fs4.default.mkdirSync(import_node_path3.default.dirname(destDir), { recursive: true });
|
|
2188
|
+
const presentAtStart = import_node_fs4.default.existsSync(import_node_path3.default.join(destDir, installedMarker));
|
|
2189
|
+
const lock = `${destDir}.lock`;
|
|
2190
|
+
for (; ; ) {
|
|
2191
|
+
signal?.throwIfAborted();
|
|
2192
|
+
try {
|
|
2193
|
+
import_node_fs4.default.writeFileSync(lock, String(process.pid), { flag: "wx" });
|
|
2194
|
+
break;
|
|
2195
|
+
} catch (err) {
|
|
2196
|
+
if (!isErrnoCode(err, "EEXIST")) throw err;
|
|
2197
|
+
if (lockOwnerGone(lock)) import_node_fs4.default.rmSync(lock, { force: true });
|
|
2198
|
+
else await new Promise((resolve3) => setTimeout(resolve3, 250));
|
|
2199
|
+
}
|
|
2200
|
+
}
|
|
2201
|
+
try {
|
|
2202
|
+
if (!presentAtStart && import_node_fs4.default.existsSync(import_node_path3.default.join(destDir, installedMarker))) {
|
|
2203
|
+
await tarball.verify?.(destDir);
|
|
2204
|
+
return;
|
|
2205
|
+
}
|
|
2206
|
+
await installVerifiedTarballLocked(tarball, presentAtStart);
|
|
2207
|
+
} finally {
|
|
2208
|
+
import_node_fs4.default.rmSync(lock, { force: true });
|
|
2209
|
+
}
|
|
2210
|
+
}
|
|
2211
|
+
function lockOwnerGone(lock) {
|
|
2212
|
+
try {
|
|
2213
|
+
process.kill(Number(import_node_fs4.default.readFileSync(lock, "utf8")), 0);
|
|
2214
|
+
return false;
|
|
2215
|
+
} catch (err) {
|
|
2216
|
+
return !isErrnoCode(err, "EPERM", "ENOENT");
|
|
2217
|
+
}
|
|
2218
|
+
}
|
|
2219
|
+
async function installVerifiedTarballLocked(tarball, presentAtStart) {
|
|
2220
|
+
const { url, digest, destDir, installedMarker, label, signal } = tarball;
|
|
2221
|
+
signal?.throwIfAborted();
|
|
2222
|
+
const downloadDir = import_node_fs4.default.mkdtempSync(import_node_path3.default.join(import_node_os3.default.tmpdir(), "runtime-delivery-download-"));
|
|
2223
|
+
const archivePath = import_node_path3.default.join(downloadDir, "archive");
|
|
2224
|
+
const tmpDir = import_node_fs4.default.mkdtempSync(
|
|
2225
|
+
import_node_path3.default.join(import_node_path3.default.dirname(destDir), `.installing-${import_node_path3.default.basename(destDir)}-`)
|
|
2226
|
+
);
|
|
2227
|
+
try {
|
|
2228
|
+
await downloadToFile(url, archivePath, signal);
|
|
2229
|
+
const actual = await digestFile(
|
|
2230
|
+
archivePath,
|
|
2231
|
+
digest.algorithm,
|
|
2232
|
+
digest.encoding,
|
|
2233
|
+
signal
|
|
2234
|
+
);
|
|
2235
|
+
if (actual !== digest.value) {
|
|
2236
|
+
throw new Error(
|
|
2237
|
+
`${digest.algorithm} mismatch for ${label}: expected ${digest.value}, actual ${actual}`
|
|
2238
|
+
);
|
|
2239
|
+
}
|
|
2240
|
+
const { pathname } = new URL(url);
|
|
2241
|
+
if (pathname.endsWith(".zip")) await extractZip(archivePath, tmpDir, signal);
|
|
2242
|
+
else
|
|
2243
|
+
await extractTarball(
|
|
2244
|
+
archivePath,
|
|
2245
|
+
pathname.endsWith(".tar.zst"),
|
|
2246
|
+
tmpDir,
|
|
2247
|
+
tarball.stripComponents ?? 0,
|
|
2248
|
+
signal
|
|
2249
|
+
);
|
|
2250
|
+
signal?.throwIfAborted();
|
|
2251
|
+
if (!import_node_fs4.default.existsSync(import_node_path3.default.join(tmpDir, installedMarker))) {
|
|
2252
|
+
throw new Error(`extracted tarball for ${label} is missing ${installedMarker}`);
|
|
2253
|
+
}
|
|
2254
|
+
await tarball.verify?.(tmpDir);
|
|
2255
|
+
signal?.throwIfAborted();
|
|
2256
|
+
try {
|
|
2257
|
+
import_node_fs4.default.renameSync(tmpDir, destDir);
|
|
2258
|
+
} catch (err) {
|
|
2259
|
+
if (!isErrnoCode(err, "ENOTEMPTY", "EEXIST")) throw err;
|
|
2260
|
+
if (!presentAtStart && import_node_fs4.default.existsSync(import_node_path3.default.join(destDir, installedMarker))) {
|
|
2261
|
+
await tarball.verify?.(destDir);
|
|
2262
|
+
return;
|
|
2263
|
+
}
|
|
2264
|
+
const aside = `${tmpDir}-replaced`;
|
|
2265
|
+
try {
|
|
2266
|
+
import_node_fs4.default.renameSync(destDir, aside);
|
|
2267
|
+
} catch (moveErr) {
|
|
2268
|
+
if (!isErrnoCode(moveErr, "ENOENT")) throw moveErr;
|
|
2269
|
+
}
|
|
2270
|
+
try {
|
|
2271
|
+
import_node_fs4.default.renameSync(tmpDir, destDir);
|
|
2272
|
+
} catch (landErr) {
|
|
2273
|
+
if (!isErrnoCode(landErr, "ENOTEMPTY", "EEXIST") || !import_node_fs4.default.existsSync(import_node_path3.default.join(destDir, installedMarker))) {
|
|
2274
|
+
throw landErr;
|
|
2275
|
+
}
|
|
2276
|
+
await tarball.verify?.(destDir);
|
|
2277
|
+
} finally {
|
|
2278
|
+
import_node_fs4.default.rmSync(aside, { recursive: true, force: true });
|
|
2279
|
+
}
|
|
2280
|
+
}
|
|
2281
|
+
} finally {
|
|
2282
|
+
import_node_fs4.default.rmSync(tmpDir, { recursive: true, force: true });
|
|
2283
|
+
import_node_fs4.default.rmSync(downloadDir, { recursive: true, force: true });
|
|
2284
|
+
}
|
|
2285
|
+
}
|
|
2286
|
+
function isErrnoCode(err, ...codes) {
|
|
2287
|
+
return err instanceof Error && "code" in err && codes.includes(String(err.code));
|
|
2288
|
+
}
|
|
2289
|
+
async function downloadToFile(url, destPath, signal) {
|
|
2290
|
+
const res = await fetch(url, { signal });
|
|
2291
|
+
if (!res.ok || !res.body) {
|
|
2292
|
+
throw new Error(`download failed: ${res.status} ${res.statusText} (${url})`);
|
|
2293
|
+
}
|
|
2294
|
+
import_node_fs4.default.mkdirSync(import_node_path3.default.dirname(destPath), { recursive: true });
|
|
2295
|
+
const tmp = `${destPath}.partial`;
|
|
2296
|
+
try {
|
|
2297
|
+
await (0, import_promises2.pipeline)(
|
|
2298
|
+
import_node_stream2.Readable.fromWeb(res.body),
|
|
2299
|
+
import_node_fs4.default.createWriteStream(tmp),
|
|
2300
|
+
{ signal }
|
|
2301
|
+
);
|
|
2302
|
+
signal?.throwIfAborted();
|
|
2303
|
+
import_node_fs4.default.renameSync(tmp, destPath);
|
|
2304
|
+
} catch (err) {
|
|
2305
|
+
try {
|
|
2306
|
+
import_node_fs4.default.unlinkSync(tmp);
|
|
2307
|
+
} catch {
|
|
2308
|
+
}
|
|
2309
|
+
throw err;
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
async function digestFile(filePath, algorithm, encoding, signal) {
|
|
2313
|
+
const hash = import_node_crypto.default.createHash(algorithm);
|
|
2314
|
+
await (0, import_promises2.pipeline)(import_node_fs4.default.createReadStream(filePath), hash, { signal });
|
|
2315
|
+
return hash.digest(encoding);
|
|
2316
|
+
}
|
|
2317
|
+
function extractZip(zipPath, destDir, signal) {
|
|
2318
|
+
return runExtractor("ditto", ["-x", "-k", zipPath, destDir], signal);
|
|
2319
|
+
}
|
|
2320
|
+
async function extractTarball(tarPath, zstd, destDir, stripComponents, signal) {
|
|
2321
|
+
const args = [zstd ? "-xf" : "-xzf", "-"];
|
|
2322
|
+
if (stripComponents > 0) args.push(`--strip-components=${stripComponents}`);
|
|
2323
|
+
if (zstd) {
|
|
2324
|
+
const decoder = import_node_zlib.default.createZstdDecompress({
|
|
2325
|
+
params: { [import_node_zlib.default.constants.ZSTD_d_windowLogMax]: 30 }
|
|
2326
|
+
});
|
|
2327
|
+
await runExtractor("tar", args, signal, {
|
|
2328
|
+
cwd: destDir,
|
|
2329
|
+
stdin: (stdin) => (0, import_promises2.pipeline)(import_node_fs4.default.createReadStream(tarPath), decoder, stdin, { signal })
|
|
2330
|
+
});
|
|
2331
|
+
return;
|
|
2332
|
+
}
|
|
2333
|
+
const archive = import_node_fs4.default.openSync(tarPath, "r");
|
|
2334
|
+
try {
|
|
2335
|
+
await runExtractor("tar", args, signal, { cwd: destDir, stdin: archive });
|
|
2336
|
+
} finally {
|
|
2337
|
+
import_node_fs4.default.closeSync(archive);
|
|
2338
|
+
}
|
|
2339
|
+
}
|
|
2340
|
+
async function runExtractor(command, args, signal, input) {
|
|
2341
|
+
signal?.throwIfAborted();
|
|
2342
|
+
const stdin = input?.stdin;
|
|
2343
|
+
const stdio = [
|
|
2344
|
+
typeof stdin === "function" ? "pipe" : stdin ?? "ignore",
|
|
2345
|
+
"inherit",
|
|
2346
|
+
"inherit"
|
|
2347
|
+
];
|
|
2348
|
+
const child = (0, import_node_child_process3.spawn)(command, args, {
|
|
2349
|
+
cwd: input?.cwd,
|
|
2350
|
+
stdio,
|
|
2351
|
+
detached: process.platform !== "win32"
|
|
2352
|
+
});
|
|
2353
|
+
const fed = typeof stdin === "function" && child.stdin ? stdin(child.stdin) : void 0;
|
|
2354
|
+
void fed?.catch(() => {
|
|
2355
|
+
});
|
|
2356
|
+
let stopping;
|
|
2357
|
+
const abort = () => {
|
|
2358
|
+
stopping ??= terminateProcessGroup(child, "SIGKILL", 0);
|
|
2359
|
+
void stopping.catch(() => {
|
|
2360
|
+
});
|
|
2361
|
+
};
|
|
2362
|
+
try {
|
|
2363
|
+
await new Promise((resolve3, reject) => {
|
|
2364
|
+
let failure;
|
|
2365
|
+
child.on("error", (error) => {
|
|
2366
|
+
failure = error;
|
|
2367
|
+
});
|
|
2368
|
+
child.on("close", (code) => {
|
|
2369
|
+
if (signal?.aborted) {
|
|
2370
|
+
const reason = signal.reason;
|
|
2371
|
+
reject(
|
|
2372
|
+
reason instanceof Error ? reason : new Error("Extraction canceled", { cause: reason })
|
|
2373
|
+
);
|
|
2374
|
+
} else if (failure) reject(failure);
|
|
2375
|
+
else if (code === 0) resolve3();
|
|
2376
|
+
else reject(new Error(`${command} exited with code ${code}`));
|
|
2377
|
+
});
|
|
2378
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
2379
|
+
if (signal?.aborted) abort();
|
|
2380
|
+
});
|
|
2381
|
+
await fed;
|
|
2382
|
+
} finally {
|
|
2383
|
+
signal?.removeEventListener("abort", abort);
|
|
2384
|
+
await stopping;
|
|
2385
|
+
}
|
|
2386
|
+
}
|
|
2387
|
+
|
|
1418
2388
|
// runtime-companion.json
|
|
1419
|
-
var runtime_companion_default = { abi: 1, sha256: "
|
|
2389
|
+
var runtime_companion_default = { abi: 1, sha256: "2e4d78c7cfb64a492abbe3734e69a59408c00041b36d1a05a2d7fdfcbf6adb7b", file: "node/cli-2e4d78c7cfb64a492abbe3734e69a59408c00041b36d1a05a2d7fdfcbf6adb7b.cjs" };
|
|
1420
2390
|
|
|
1421
2391
|
// src/answeredNativePackages.ts
|
|
1422
2392
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -1429,50 +2399,72 @@ var import_url = require("url");
|
|
|
1429
2399
|
|
|
1430
2400
|
// src/home-paths.ts
|
|
1431
2401
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
1432
|
-
var
|
|
1433
|
-
var
|
|
1434
|
-
var
|
|
2402
|
+
var import_node_fs5 = __toESM(require("node:fs"), 1);
|
|
2403
|
+
var import_node_os4 = require("node:os");
|
|
2404
|
+
var import_node_path4 = __toESM(require("node:path"), 1);
|
|
1435
2405
|
var PEACH_HOME_ENV = "PEACH_HOME";
|
|
1436
2406
|
var ACTIVE_RUNTIME_FILE = "active";
|
|
1437
2407
|
var DAEMON_LOCKFILE = "daemon.json";
|
|
2408
|
+
var CONFIG_FILE = "config.json";
|
|
1438
2409
|
var DAEMON_HEARTBEAT_STALE_MS = 3e4;
|
|
1439
2410
|
function ambientHomeDir() {
|
|
1440
|
-
return
|
|
2411
|
+
return import_node_path4.default.join((0, import_node_os4.homedir)(), ".peach");
|
|
1441
2412
|
}
|
|
1442
2413
|
function rnxHomeDir() {
|
|
1443
2414
|
const override = process.env[PEACH_HOME_ENV];
|
|
1444
|
-
return override && override.length > 0 ?
|
|
2415
|
+
return override && override.length > 0 ? import_node_path4.default.resolve(override) : ambientHomeDir();
|
|
1445
2416
|
}
|
|
1446
2417
|
function runtimesDir() {
|
|
1447
|
-
return
|
|
2418
|
+
return import_node_path4.default.join(rnxHomeDir(), "runtimes");
|
|
1448
2419
|
}
|
|
1449
2420
|
function runtimeDir(version) {
|
|
1450
|
-
return
|
|
2421
|
+
return import_node_path4.default.join(runtimesDir(), version);
|
|
1451
2422
|
}
|
|
1452
2423
|
function activeRuntimeFile() {
|
|
1453
|
-
return
|
|
2424
|
+
return import_node_path4.default.join(runtimesDir(), ACTIVE_RUNTIME_FILE);
|
|
2425
|
+
}
|
|
2426
|
+
function electronDir() {
|
|
2427
|
+
return import_node_path4.default.join(rnxHomeDir(), "electron");
|
|
2428
|
+
}
|
|
2429
|
+
function profilesDir() {
|
|
2430
|
+
return import_node_path4.default.join(rnxHomeDir(), "profiles");
|
|
1454
2431
|
}
|
|
1455
2432
|
function cacheDir() {
|
|
1456
|
-
return
|
|
2433
|
+
return import_node_path4.default.join(rnxHomeDir(), "cache");
|
|
1457
2434
|
}
|
|
1458
2435
|
function daemonLockfilePath() {
|
|
1459
|
-
return
|
|
2436
|
+
return import_node_path4.default.join(rnxHomeDir(), DAEMON_LOCKFILE);
|
|
2437
|
+
}
|
|
2438
|
+
function configFilePath() {
|
|
2439
|
+
return import_node_path4.default.join(rnxHomeDir(), CONFIG_FILE);
|
|
2440
|
+
}
|
|
2441
|
+
function ensureRnxHome() {
|
|
2442
|
+
import_node_fs5.default.mkdirSync(rnxHomeDir(), { recursive: true });
|
|
2443
|
+
import_node_fs5.default.mkdirSync(runtimesDir(), { recursive: true });
|
|
2444
|
+
import_node_fs5.default.mkdirSync(electronDir(), { recursive: true });
|
|
2445
|
+
import_node_fs5.default.mkdirSync(profilesDir(), { recursive: true });
|
|
2446
|
+
import_node_fs5.default.mkdirSync(cacheDir(), { recursive: true });
|
|
1460
2447
|
}
|
|
1461
2448
|
function readActiveRuntime() {
|
|
1462
2449
|
try {
|
|
1463
|
-
const value =
|
|
2450
|
+
const value = import_node_fs5.default.readFileSync(activeRuntimeFile(), "utf8").trim();
|
|
1464
2451
|
return value.length > 0 ? value : null;
|
|
1465
2452
|
} catch {
|
|
1466
2453
|
return null;
|
|
1467
2454
|
}
|
|
1468
2455
|
}
|
|
2456
|
+
function writeActiveRuntime(version) {
|
|
2457
|
+
import_node_fs5.default.mkdirSync(runtimesDir(), { recursive: true });
|
|
2458
|
+
import_node_fs5.default.writeFileSync(activeRuntimeFile(), `${version}
|
|
2459
|
+
`, "utf8");
|
|
2460
|
+
}
|
|
1469
2461
|
var DAEMON_LOCKFILE_MAX_BYTES = 16 * 1024;
|
|
1470
2462
|
function readDaemonLockfile() {
|
|
1471
2463
|
try {
|
|
1472
|
-
const fd =
|
|
2464
|
+
const fd = import_node_fs5.default.openSync(daemonLockfilePath(), "r");
|
|
1473
2465
|
try {
|
|
1474
2466
|
const buf = Buffer.alloc(DAEMON_LOCKFILE_MAX_BYTES);
|
|
1475
|
-
const bytesRead =
|
|
2467
|
+
const bytesRead = import_node_fs5.default.readSync(fd, buf, 0, DAEMON_LOCKFILE_MAX_BYTES, 0);
|
|
1476
2468
|
const raw = buf.subarray(0, bytesRead).toString("utf8");
|
|
1477
2469
|
const parsed = JSON.parse(raw);
|
|
1478
2470
|
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 +2472,7 @@ function readDaemonLockfile() {
|
|
|
1480
2472
|
}
|
|
1481
2473
|
return null;
|
|
1482
2474
|
} finally {
|
|
1483
|
-
|
|
2475
|
+
import_node_fs5.default.closeSync(fd);
|
|
1484
2476
|
}
|
|
1485
2477
|
} catch {
|
|
1486
2478
|
return null;
|
|
@@ -1560,7 +2552,6 @@ var ROOT_RUNTIME_PATHS = [
|
|
|
1560
2552
|
"/fonts/",
|
|
1561
2553
|
"/icons/",
|
|
1562
2554
|
"/sounds/",
|
|
1563
|
-
"/spike/",
|
|
1564
2555
|
"/test-wallpaper.jpg",
|
|
1565
2556
|
"/preview-sw.js",
|
|
1566
2557
|
"/preview/guest-bridge-host.js",
|
|
@@ -1715,12 +2706,12 @@ function cliCompanionPath() {
|
|
|
1715
2706
|
return `node/cli-${runtime_companion_default.sha256}.cjs`;
|
|
1716
2707
|
}
|
|
1717
2708
|
function verifyCliCompanion(root) {
|
|
1718
|
-
verifyCompanionFile((0,
|
|
2709
|
+
verifyCompanionFile((0, import_node_path5.join)(root, cliCompanionPath()));
|
|
1719
2710
|
}
|
|
1720
2711
|
function verifyCompanionFile(file) {
|
|
1721
2712
|
let bytes;
|
|
1722
2713
|
try {
|
|
1723
|
-
bytes = (0,
|
|
2714
|
+
bytes = (0, import_node_fs6.readFileSync)(file);
|
|
1724
2715
|
} catch (error) {
|
|
1725
2716
|
if (error instanceof Error) {
|
|
1726
2717
|
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 +2719,41 @@ function verifyCompanionFile(file) {
|
|
|
1728
2719
|
}
|
|
1729
2720
|
throw error;
|
|
1730
2721
|
}
|
|
1731
|
-
const hash = (0,
|
|
2722
|
+
const hash = (0, import_node_crypto2.createHash)("sha256").update(bytes).digest("hex");
|
|
1732
2723
|
if (hash !== runtime_companion_default.sha256) {
|
|
1733
2724
|
throw new Error(
|
|
1734
2725
|
"Peach runtime companion does not match this CLI; run `peach runtime install`"
|
|
1735
2726
|
);
|
|
1736
2727
|
}
|
|
1737
2728
|
}
|
|
2729
|
+
async function ensureCliCompanion(root) {
|
|
2730
|
+
const file = (0, import_node_path5.join)(root, cliCompanionPath());
|
|
2731
|
+
try {
|
|
2732
|
+
verifyCompanionFile(file);
|
|
2733
|
+
return;
|
|
2734
|
+
} catch (error) {
|
|
2735
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT"))
|
|
2736
|
+
throw error;
|
|
2737
|
+
}
|
|
2738
|
+
const staged = `${file}.${process.pid}`;
|
|
2739
|
+
try {
|
|
2740
|
+
await downloadToFile(
|
|
2741
|
+
`https://r2.rnxsim.com/rnx-cli/companions/cli-${runtime_companion_default.sha256}.cjs`,
|
|
2742
|
+
staged
|
|
2743
|
+
);
|
|
2744
|
+
verifyCompanionFile(staged);
|
|
2745
|
+
(0, import_node_fs6.renameSync)(staged, file);
|
|
2746
|
+
} finally {
|
|
2747
|
+
(0, import_node_fs6.rmSync)(staged, { force: true });
|
|
2748
|
+
}
|
|
2749
|
+
}
|
|
1738
2750
|
var loaded;
|
|
1739
2751
|
function getCliRuntime() {
|
|
1740
2752
|
if (loaded) return loaded.runtime;
|
|
1741
2753
|
const root = peachRuntimeRoot();
|
|
1742
2754
|
verifyCliCompanion(root);
|
|
1743
2755
|
const require2 = (0, import_node_module.createRequire)(__sootsim_import_meta_url);
|
|
1744
|
-
const runtime = require2((0,
|
|
2756
|
+
const runtime = require2((0, import_node_path5.join)(root, cliCompanionPath()));
|
|
1745
2757
|
if (runtime.cliCompanionAbi !== CLI_COMPANION_ABI) {
|
|
1746
2758
|
throw new Error(
|
|
1747
2759
|
"Incompatible Peach runtime companion ABI; run `peach runtime install`"
|
|
@@ -1753,10 +2765,10 @@ function getCliRuntime() {
|
|
|
1753
2765
|
|
|
1754
2766
|
// src/dev-server-open.ts
|
|
1755
2767
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
1756
|
-
var
|
|
1757
|
-
var
|
|
1758
|
-
var
|
|
1759
|
-
var
|
|
2768
|
+
var import_node_child_process4 = require("node:child_process");
|
|
2769
|
+
var import_node_crypto3 = require("node:crypto");
|
|
2770
|
+
var import_node_fs7 = __toESM(require("node:fs"), 1);
|
|
2771
|
+
var import_node_path6 = __toESM(require("node:path"), 1);
|
|
1760
2772
|
function resolveRnxDesktopAppName(open, projectRoot) {
|
|
1761
2773
|
if (!open) return null;
|
|
1762
2774
|
if (typeof open === "object") {
|
|
@@ -1764,8 +2776,8 @@ function resolveRnxDesktopAppName(open, projectRoot) {
|
|
|
1764
2776
|
if (!appName) throw new Error("peach: open.appName must not be empty");
|
|
1765
2777
|
return appName;
|
|
1766
2778
|
}
|
|
1767
|
-
const packageJsonPath =
|
|
1768
|
-
const packageJson = JSON.parse(
|
|
2779
|
+
const packageJsonPath = import_node_path6.default.join(projectRoot, "package.json");
|
|
2780
|
+
const packageJson = JSON.parse(import_node_fs7.default.readFileSync(packageJsonPath, "utf8"));
|
|
1769
2781
|
const packageName = packageJson && typeof packageJson === "object" ? Reflect.get(packageJson, "name") : void 0;
|
|
1770
2782
|
if (typeof packageName !== "string" || !packageName.trim()) {
|
|
1771
2783
|
throw new Error(`peach: ${packageJsonPath} must declare a package name`);
|
|
@@ -1779,7 +2791,7 @@ function tagRnxBundleForPlugin(bundleUrl, replacementOrigin, replacementToken, p
|
|
|
1779
2791
|
url.searchParams.set("rnxAppName", appName);
|
|
1780
2792
|
url.searchParams.set(
|
|
1781
2793
|
"rnxProjectId",
|
|
1782
|
-
(0,
|
|
2794
|
+
(0, import_node_crypto3.createHash)("sha256").update(import_node_fs7.default.realpathSync(projectRoot)).digest("hex").slice(0, 32)
|
|
1783
2795
|
);
|
|
1784
2796
|
}
|
|
1785
2797
|
url.searchParams.set("rnxReplacementOrigin", replacementOrigin);
|
|
@@ -1815,7 +2827,7 @@ function observeRnxDesktopLaunch(child, appName) {
|
|
|
1815
2827
|
}
|
|
1816
2828
|
function launchRnxDesktop(bundleUrl, appName) {
|
|
1817
2829
|
console.log(`[peach] opening ${appName} in the desktop simulator`);
|
|
1818
|
-
const child = (0,
|
|
2830
|
+
const child = (0, import_node_child_process4.spawn)("peach", buildRnxDesktopOpenArgs(bundleUrl), {
|
|
1819
2831
|
stdio: ["ignore", "ignore", "pipe"],
|
|
1820
2832
|
windowsHide: true
|
|
1821
2833
|
});
|
|
@@ -1827,7 +2839,7 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
1827
2839
|
var import_http = __toESM(require("http"), 1);
|
|
1828
2840
|
var import_https = __toESM(require("https"), 1);
|
|
1829
2841
|
var import_node_http2 = require("node:http2");
|
|
1830
|
-
var
|
|
2842
|
+
var import_promises6 = require("stream/promises");
|
|
1831
2843
|
|
|
1832
2844
|
// src/backend-origin.ts
|
|
1833
2845
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -1870,7 +2882,7 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
1870
2882
|
|
|
1871
2883
|
// src/expo-autolinking.ts
|
|
1872
2884
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
1873
|
-
var
|
|
2885
|
+
var import_node_child_process5 = require("node:child_process");
|
|
1874
2886
|
var import_node_util = require("node:util");
|
|
1875
2887
|
|
|
1876
2888
|
// src/forked-script-contract.ts
|
|
@@ -1878,7 +2890,7 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
1878
2890
|
var PEACH_FORKED_SCRIPT_ENV = "PEACH_RUNS_FORKED_SCRIPTS";
|
|
1879
2891
|
|
|
1880
2892
|
// src/expo-autolinking.ts
|
|
1881
|
-
var run = (0, import_node_util.promisify)(
|
|
2893
|
+
var run = (0, import_node_util.promisify)(import_node_child_process5.execFile);
|
|
1882
2894
|
|
|
1883
2895
|
// src/expo-native-prebuilt.ts
|
|
1884
2896
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -1895,21 +2907,21 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
1895
2907
|
|
|
1896
2908
|
// src/swift-objc-sdk-tree.ts
|
|
1897
2909
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
1898
|
-
var
|
|
1899
|
-
var
|
|
2910
|
+
var import_node_fs8 = require("node:fs");
|
|
2911
|
+
var import_node_path7 = __toESM(require("node:path"), 1);
|
|
1900
2912
|
function readIosSdkTree(root) {
|
|
1901
|
-
return (0,
|
|
1902
|
-
const file =
|
|
2913
|
+
return (0, import_node_fs8.readdirSync)(root, { recursive: true, withFileTypes: true }).filter((entry) => entry.isFile()).map((entry) => {
|
|
2914
|
+
const file = import_node_path7.default.join(entry.parentPath, entry.name);
|
|
1903
2915
|
return [
|
|
1904
|
-
|
|
1905
|
-
(0,
|
|
2916
|
+
import_node_path7.default.relative(root, file).split(import_node_path7.default.sep).join("/"),
|
|
2917
|
+
(0, import_node_fs8.readFileSync)(file, "utf8")
|
|
1906
2918
|
];
|
|
1907
2919
|
}).sort(([a], [b]) => a < b ? -1 : 1);
|
|
1908
2920
|
}
|
|
1909
2921
|
|
|
1910
2922
|
// src/swift-standin-digest.ts
|
|
1911
2923
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
1912
|
-
var STANDIN_SOURCE_DIGEST = true ? "
|
|
2924
|
+
var STANDIN_SOURCE_DIGEST = true ? "11f82a07cd8d59c1bfcf554927b6e5a2d9b01d6846fd7107ca7c0f6f30519538" : standinSourceDigest();
|
|
1913
2925
|
|
|
1914
2926
|
// src/expo-native-workspace.ts
|
|
1915
2927
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -1984,17 +2996,17 @@ function visit(node, visitor) {
|
|
|
1984
2996
|
visit.BREAK = BREAK;
|
|
1985
2997
|
visit.SKIP = SKIP;
|
|
1986
2998
|
visit.REMOVE = REMOVE;
|
|
1987
|
-
function visit_(key, node, visitor,
|
|
1988
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
2999
|
+
function visit_(key, node, visitor, path20) {
|
|
3000
|
+
const ctrl = callVisitor(key, node, visitor, path20);
|
|
1989
3001
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
1990
|
-
replaceNode(key,
|
|
1991
|
-
return visit_(key, ctrl, visitor,
|
|
3002
|
+
replaceNode(key, path20, ctrl);
|
|
3003
|
+
return visit_(key, ctrl, visitor, path20);
|
|
1992
3004
|
}
|
|
1993
3005
|
if (typeof ctrl !== "symbol") {
|
|
1994
3006
|
if (isCollection(node)) {
|
|
1995
|
-
|
|
3007
|
+
path20 = Object.freeze(path20.concat(node));
|
|
1996
3008
|
for (let i = 0; i < node.items.length; ++i) {
|
|
1997
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
3009
|
+
const ci = visit_(i, node.items[i], visitor, path20);
|
|
1998
3010
|
if (typeof ci === "number")
|
|
1999
3011
|
i = ci - 1;
|
|
2000
3012
|
else if (ci === BREAK)
|
|
@@ -2005,13 +3017,13 @@ function visit_(key, node, visitor, path17) {
|
|
|
2005
3017
|
}
|
|
2006
3018
|
}
|
|
2007
3019
|
} else if (isPair(node)) {
|
|
2008
|
-
|
|
2009
|
-
const ck = visit_("key", node.key, visitor,
|
|
3020
|
+
path20 = Object.freeze(path20.concat(node));
|
|
3021
|
+
const ck = visit_("key", node.key, visitor, path20);
|
|
2010
3022
|
if (ck === BREAK)
|
|
2011
3023
|
return BREAK;
|
|
2012
3024
|
else if (ck === REMOVE)
|
|
2013
3025
|
node.key = null;
|
|
2014
|
-
const cv = visit_("value", node.value, visitor,
|
|
3026
|
+
const cv = visit_("value", node.value, visitor, path20);
|
|
2015
3027
|
if (cv === BREAK)
|
|
2016
3028
|
return BREAK;
|
|
2017
3029
|
else if (cv === REMOVE)
|
|
@@ -2032,17 +3044,17 @@ async function visitAsync(node, visitor) {
|
|
|
2032
3044
|
visitAsync.BREAK = BREAK;
|
|
2033
3045
|
visitAsync.SKIP = SKIP;
|
|
2034
3046
|
visitAsync.REMOVE = REMOVE;
|
|
2035
|
-
async function visitAsync_(key, node, visitor,
|
|
2036
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
3047
|
+
async function visitAsync_(key, node, visitor, path20) {
|
|
3048
|
+
const ctrl = await callVisitor(key, node, visitor, path20);
|
|
2037
3049
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
2038
|
-
replaceNode(key,
|
|
2039
|
-
return visitAsync_(key, ctrl, visitor,
|
|
3050
|
+
replaceNode(key, path20, ctrl);
|
|
3051
|
+
return visitAsync_(key, ctrl, visitor, path20);
|
|
2040
3052
|
}
|
|
2041
3053
|
if (typeof ctrl !== "symbol") {
|
|
2042
3054
|
if (isCollection(node)) {
|
|
2043
|
-
|
|
3055
|
+
path20 = Object.freeze(path20.concat(node));
|
|
2044
3056
|
for (let i = 0; i < node.items.length; ++i) {
|
|
2045
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
3057
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path20);
|
|
2046
3058
|
if (typeof ci === "number")
|
|
2047
3059
|
i = ci - 1;
|
|
2048
3060
|
else if (ci === BREAK)
|
|
@@ -2053,13 +3065,13 @@ async function visitAsync_(key, node, visitor, path17) {
|
|
|
2053
3065
|
}
|
|
2054
3066
|
}
|
|
2055
3067
|
} else if (isPair(node)) {
|
|
2056
|
-
|
|
2057
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
3068
|
+
path20 = Object.freeze(path20.concat(node));
|
|
3069
|
+
const ck = await visitAsync_("key", node.key, visitor, path20);
|
|
2058
3070
|
if (ck === BREAK)
|
|
2059
3071
|
return BREAK;
|
|
2060
3072
|
else if (ck === REMOVE)
|
|
2061
3073
|
node.key = null;
|
|
2062
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
3074
|
+
const cv = await visitAsync_("value", node.value, visitor, path20);
|
|
2063
3075
|
if (cv === BREAK)
|
|
2064
3076
|
return BREAK;
|
|
2065
3077
|
else if (cv === REMOVE)
|
|
@@ -2086,23 +3098,23 @@ function initVisitor(visitor) {
|
|
|
2086
3098
|
}
|
|
2087
3099
|
return visitor;
|
|
2088
3100
|
}
|
|
2089
|
-
function callVisitor(key, node, visitor,
|
|
3101
|
+
function callVisitor(key, node, visitor, path20) {
|
|
2090
3102
|
if (typeof visitor === "function")
|
|
2091
|
-
return visitor(key, node,
|
|
3103
|
+
return visitor(key, node, path20);
|
|
2092
3104
|
if (isMap(node))
|
|
2093
|
-
return visitor.Map?.(key, node,
|
|
3105
|
+
return visitor.Map?.(key, node, path20);
|
|
2094
3106
|
if (isSeq(node))
|
|
2095
|
-
return visitor.Seq?.(key, node,
|
|
3107
|
+
return visitor.Seq?.(key, node, path20);
|
|
2096
3108
|
if (isPair(node))
|
|
2097
|
-
return visitor.Pair?.(key, node,
|
|
3109
|
+
return visitor.Pair?.(key, node, path20);
|
|
2098
3110
|
if (isScalar(node))
|
|
2099
|
-
return visitor.Scalar?.(key, node,
|
|
3111
|
+
return visitor.Scalar?.(key, node, path20);
|
|
2100
3112
|
if (isAlias(node))
|
|
2101
|
-
return visitor.Alias?.(key, node,
|
|
3113
|
+
return visitor.Alias?.(key, node, path20);
|
|
2102
3114
|
return void 0;
|
|
2103
3115
|
}
|
|
2104
|
-
function replaceNode(key,
|
|
2105
|
-
const parent =
|
|
3116
|
+
function replaceNode(key, path20, node) {
|
|
3117
|
+
const parent = path20[path20.length - 1];
|
|
2106
3118
|
if (isCollection(parent)) {
|
|
2107
3119
|
parent.items[key] = node;
|
|
2108
3120
|
} else if (isPair(parent)) {
|
|
@@ -2172,8 +3184,8 @@ var Directives = class _Directives {
|
|
|
2172
3184
|
this.atNextDocument = false;
|
|
2173
3185
|
}
|
|
2174
3186
|
const parts = line.trim().split(/[ \t]+/);
|
|
2175
|
-
const
|
|
2176
|
-
switch (
|
|
3187
|
+
const name2 = parts.shift();
|
|
3188
|
+
switch (name2) {
|
|
2177
3189
|
case "%TAG": {
|
|
2178
3190
|
if (parts.length !== 2) {
|
|
2179
3191
|
onError(0, "%TAG directive should contain exactly two parts");
|
|
@@ -2201,7 +3213,7 @@ var Directives = class _Directives {
|
|
|
2201
3213
|
}
|
|
2202
3214
|
}
|
|
2203
3215
|
default:
|
|
2204
|
-
onError(0, `Unknown directive ${
|
|
3216
|
+
onError(0, `Unknown directive ${name2}`, true);
|
|
2205
3217
|
return false;
|
|
2206
3218
|
}
|
|
2207
3219
|
}
|
|
@@ -2601,10 +3613,10 @@ function createNode(value, tagName, ctx) {
|
|
|
2601
3613
|
}
|
|
2602
3614
|
|
|
2603
3615
|
// ../../node_modules/yaml/browser/dist/nodes/Collection.js
|
|
2604
|
-
function collectionFromPath(schema4,
|
|
3616
|
+
function collectionFromPath(schema4, path20, value) {
|
|
2605
3617
|
let v6 = value;
|
|
2606
|
-
for (let i =
|
|
2607
|
-
const k =
|
|
3618
|
+
for (let i = path20.length - 1; i >= 0; --i) {
|
|
3619
|
+
const k = path20[i];
|
|
2608
3620
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
2609
3621
|
const a = [];
|
|
2610
3622
|
a[k] = v6;
|
|
@@ -2623,7 +3635,7 @@ function collectionFromPath(schema4, path17, value) {
|
|
|
2623
3635
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
2624
3636
|
});
|
|
2625
3637
|
}
|
|
2626
|
-
var isEmptyPath = (
|
|
3638
|
+
var isEmptyPath = (path20) => path20 == null || typeof path20 === "object" && !!path20[Symbol.iterator]().next().done;
|
|
2627
3639
|
var Collection = class extends NodeBase {
|
|
2628
3640
|
constructor(type, schema4) {
|
|
2629
3641
|
super(type);
|
|
@@ -2653,11 +3665,11 @@ var Collection = class extends NodeBase {
|
|
|
2653
3665
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
2654
3666
|
* that already exists in the map.
|
|
2655
3667
|
*/
|
|
2656
|
-
addIn(
|
|
2657
|
-
if (isEmptyPath(
|
|
3668
|
+
addIn(path20, value) {
|
|
3669
|
+
if (isEmptyPath(path20))
|
|
2658
3670
|
this.add(value);
|
|
2659
3671
|
else {
|
|
2660
|
-
const [key, ...rest] =
|
|
3672
|
+
const [key, ...rest] = path20;
|
|
2661
3673
|
const node = this.get(key, true);
|
|
2662
3674
|
if (isCollection(node))
|
|
2663
3675
|
node.addIn(rest, value);
|
|
@@ -2671,8 +3683,8 @@ var Collection = class extends NodeBase {
|
|
|
2671
3683
|
* Removes a value from the collection.
|
|
2672
3684
|
* @returns `true` if the item was found and removed.
|
|
2673
3685
|
*/
|
|
2674
|
-
deleteIn(
|
|
2675
|
-
const [key, ...rest] =
|
|
3686
|
+
deleteIn(path20) {
|
|
3687
|
+
const [key, ...rest] = path20;
|
|
2676
3688
|
if (rest.length === 0)
|
|
2677
3689
|
return this.delete(key);
|
|
2678
3690
|
const node = this.get(key, true);
|
|
@@ -2686,8 +3698,8 @@ var Collection = class extends NodeBase {
|
|
|
2686
3698
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
2687
3699
|
* `true` (collections are always returned intact).
|
|
2688
3700
|
*/
|
|
2689
|
-
getIn(
|
|
2690
|
-
const [key, ...rest] =
|
|
3701
|
+
getIn(path20, keepScalar) {
|
|
3702
|
+
const [key, ...rest] = path20;
|
|
2691
3703
|
const node = this.get(key, true);
|
|
2692
3704
|
if (rest.length === 0)
|
|
2693
3705
|
return !keepScalar && isScalar(node) ? node.value : node;
|
|
@@ -2705,8 +3717,8 @@ var Collection = class extends NodeBase {
|
|
|
2705
3717
|
/**
|
|
2706
3718
|
* Checks if the collection includes a value with the key `key`.
|
|
2707
3719
|
*/
|
|
2708
|
-
hasIn(
|
|
2709
|
-
const [key, ...rest] =
|
|
3720
|
+
hasIn(path20) {
|
|
3721
|
+
const [key, ...rest] = path20;
|
|
2710
3722
|
if (rest.length === 0)
|
|
2711
3723
|
return this.has(key);
|
|
2712
3724
|
const node = this.get(key, true);
|
|
@@ -2716,8 +3728,8 @@ var Collection = class extends NodeBase {
|
|
|
2716
3728
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
2717
3729
|
* boolean to add/remove the item from the set.
|
|
2718
3730
|
*/
|
|
2719
|
-
setIn(
|
|
2720
|
-
const [key, ...rest] =
|
|
3731
|
+
setIn(path20, value) {
|
|
3732
|
+
const [key, ...rest] = path20;
|
|
2721
3733
|
if (rest.length === 0) {
|
|
2722
3734
|
this.set(key, value);
|
|
2723
3735
|
} else {
|
|
@@ -3222,8 +4234,8 @@ function getTagObject(tags, item) {
|
|
|
3222
4234
|
tagObj = tags.find((t) => t.nodeClass && obj instanceof t.nodeClass);
|
|
3223
4235
|
}
|
|
3224
4236
|
if (!tagObj) {
|
|
3225
|
-
const
|
|
3226
|
-
throw new Error(`Tag not resolved for ${
|
|
4237
|
+
const name2 = obj?.constructor?.name ?? (obj === null ? "null" : typeof obj);
|
|
4238
|
+
throw new Error(`Tag not resolved for ${name2} value`);
|
|
3227
4239
|
}
|
|
3228
4240
|
return tagObj;
|
|
3229
4241
|
}
|
|
@@ -4306,9 +5318,9 @@ function visit2(cst, visitor) {
|
|
|
4306
5318
|
visit2.BREAK = BREAK2;
|
|
4307
5319
|
visit2.SKIP = SKIP2;
|
|
4308
5320
|
visit2.REMOVE = REMOVE2;
|
|
4309
|
-
visit2.itemAtPath = (cst,
|
|
5321
|
+
visit2.itemAtPath = (cst, path20) => {
|
|
4310
5322
|
let item = cst;
|
|
4311
|
-
for (const [field, index] of
|
|
5323
|
+
for (const [field, index] of path20) {
|
|
4312
5324
|
const tok = item?.[field];
|
|
4313
5325
|
if (tok && "items" in tok) {
|
|
4314
5326
|
item = tok.items[index];
|
|
@@ -4317,23 +5329,23 @@ visit2.itemAtPath = (cst, path17) => {
|
|
|
4317
5329
|
}
|
|
4318
5330
|
return item;
|
|
4319
5331
|
};
|
|
4320
|
-
visit2.parentCollection = (cst,
|
|
4321
|
-
const parent = visit2.itemAtPath(cst,
|
|
4322
|
-
const field =
|
|
5332
|
+
visit2.parentCollection = (cst, path20) => {
|
|
5333
|
+
const parent = visit2.itemAtPath(cst, path20.slice(0, -1));
|
|
5334
|
+
const field = path20[path20.length - 1][0];
|
|
4323
5335
|
const coll = parent?.[field];
|
|
4324
5336
|
if (coll && "items" in coll)
|
|
4325
5337
|
return coll;
|
|
4326
5338
|
throw new Error("Parent collection not found");
|
|
4327
5339
|
};
|
|
4328
|
-
function _visit(
|
|
4329
|
-
let ctrl = visitor(item,
|
|
5340
|
+
function _visit(path20, item, visitor) {
|
|
5341
|
+
let ctrl = visitor(item, path20);
|
|
4330
5342
|
if (typeof ctrl === "symbol")
|
|
4331
5343
|
return ctrl;
|
|
4332
5344
|
for (const field of ["key", "value"]) {
|
|
4333
5345
|
const token = item[field];
|
|
4334
5346
|
if (token && "items" in token) {
|
|
4335
5347
|
for (let i = 0; i < token.items.length; ++i) {
|
|
4336
|
-
const ci = _visit(Object.freeze(
|
|
5348
|
+
const ci = _visit(Object.freeze(path20.concat([[field, i]])), token.items[i], visitor);
|
|
4337
5349
|
if (typeof ci === "number")
|
|
4338
5350
|
i = ci - 1;
|
|
4339
5351
|
else if (ci === BREAK2)
|
|
@@ -4344,10 +5356,10 @@ function _visit(path17, item, visitor) {
|
|
|
4344
5356
|
}
|
|
4345
5357
|
}
|
|
4346
5358
|
if (typeof ctrl === "function" && field === "key")
|
|
4347
|
-
ctrl = ctrl(item,
|
|
5359
|
+
ctrl = ctrl(item, path20);
|
|
4348
5360
|
}
|
|
4349
5361
|
}
|
|
4350
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
5362
|
+
return typeof ctrl === "function" ? ctrl(item, path20) : ctrl;
|
|
4351
5363
|
}
|
|
4352
5364
|
|
|
4353
5365
|
// ../../node_modules/yaml/browser/dist/parse/lexer.js
|
|
@@ -4469,7 +5481,7 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
4469
5481
|
|
|
4470
5482
|
// src/swift-binary-modules.ts
|
|
4471
5483
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
4472
|
-
var
|
|
5484
|
+
var import_node_path8 = __toESM(require("node:path"), 1);
|
|
4473
5485
|
|
|
4474
5486
|
// src/swift-package.ts
|
|
4475
5487
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -4498,16 +5510,16 @@ var SWIFT_NATIVE_SOURCE_EXTENSIONS = [
|
|
|
4498
5510
|
];
|
|
4499
5511
|
|
|
4500
5512
|
// src/swift-binary-modules.ts
|
|
4501
|
-
var cacheDir2 =
|
|
5513
|
+
var cacheDir2 = import_node_path8.default.join(cacheDir(), "swift-binary-modules");
|
|
4502
5514
|
|
|
4503
5515
|
// src/swift-coverage/xcode-assets.ts
|
|
4504
5516
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
4505
5517
|
|
|
4506
5518
|
// src/swift-coverage/provenance.ts
|
|
4507
5519
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
4508
|
-
var
|
|
4509
|
-
var
|
|
4510
|
-
var
|
|
5520
|
+
var import_node_crypto4 = require("node:crypto");
|
|
5521
|
+
var import_node_fs9 = require("node:fs");
|
|
5522
|
+
var import_node_path9 = require("node:path");
|
|
4511
5523
|
var SWIFT_COVERAGE_DIGEST_SOURCES = [
|
|
4512
5524
|
"swift-coverage/indexdump.ts",
|
|
4513
5525
|
"swift-coverage/indexing.ts",
|
|
@@ -4537,11 +5549,11 @@ function swiftCoverageSourceDigests(srcDir) {
|
|
|
4537
5549
|
return Object.fromEntries(
|
|
4538
5550
|
SWIFT_COVERAGE_DIGEST_SOURCES.map((file) => [
|
|
4539
5551
|
file,
|
|
4540
|
-
(0,
|
|
5552
|
+
(0, import_node_crypto4.createHash)("sha256").update((0, import_node_fs9.readFileSync)((0, import_node_path9.join)(srcDir, file))).digest("hex")
|
|
4541
5553
|
])
|
|
4542
5554
|
);
|
|
4543
5555
|
}
|
|
4544
|
-
var swiftCoverageProvenance = typeof define_SWIFT_COVERAGE_SOURCE_DIGESTS_default === "object" ? define_SWIFT_COVERAGE_SOURCE_DIGESTS_default : swiftCoverageSourceDigests((0,
|
|
5556
|
+
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
5557
|
|
|
4546
5558
|
// src/swift-coverage/xcode-asset-symbols.ts
|
|
4547
5559
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -4727,8 +5739,8 @@ var assetSymbolSettingKeys = [
|
|
|
4727
5739
|
|
|
4728
5740
|
// src/swift-package-manifest.ts
|
|
4729
5741
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
4730
|
-
var
|
|
4731
|
-
var
|
|
5742
|
+
var import_node_child_process7 = require("node:child_process");
|
|
5743
|
+
var import_node_path12 = __toESM(require("node:path"), 1);
|
|
4732
5744
|
var import_node_util3 = require("node:util");
|
|
4733
5745
|
|
|
4734
5746
|
// src/swift-distribution.ts
|
|
@@ -4758,12 +5770,12 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
4758
5770
|
|
|
4759
5771
|
// src/swift-toolchain.ts
|
|
4760
5772
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
4761
|
-
var
|
|
4762
|
-
var
|
|
5773
|
+
var import_node_fs10 = __toESM(require("node:fs"), 1);
|
|
5774
|
+
var import_node_path10 = __toESM(require("node:path"), 1);
|
|
4763
5775
|
function peachsimPackageRoot() {
|
|
4764
5776
|
let dir = __sootsim_import_meta_dirname;
|
|
4765
|
-
while (!
|
|
4766
|
-
dir =
|
|
5777
|
+
while (!import_node_fs10.default.existsSync(import_node_path10.default.join(dir, "package.json")) && dir !== import_node_path10.default.dirname(dir))
|
|
5778
|
+
dir = import_node_path10.default.dirname(dir);
|
|
4767
5779
|
return dir;
|
|
4768
5780
|
}
|
|
4769
5781
|
var SWIFT_HOST_COMPILER_RELEASE = "swift-6.4.0-RELEASE-custom-81b2c791c27276bf";
|
|
@@ -4992,17 +6004,17 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
4992
6004
|
|
|
4993
6005
|
// src/swift-objc-standin.ts
|
|
4994
6006
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
4995
|
-
var
|
|
6007
|
+
var import_node_crypto5 = require("node:crypto");
|
|
4996
6008
|
|
|
4997
6009
|
// src/swift-interface-bodies.ts
|
|
4998
6010
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
4999
6011
|
|
|
5000
6012
|
// src/swift-objc-sdk.ts
|
|
5001
6013
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
5002
|
-
var
|
|
6014
|
+
var import_node_path11 = __toESM(require("node:path"), 1);
|
|
5003
6015
|
var IOS_SDK_TARGET = "arm64-apple-ios16.0-simulator";
|
|
5004
6016
|
var OVERLAY_PATH = /^usr\/lib\/swift\/([^/]+)\.swiftmodule\/arm64-apple-ios-simulator\.swiftinterface$/;
|
|
5005
|
-
var tree = typeof __PEACH_BUNDLED_IOS_SDK__ === "undefined" ? readIosSdkTree(
|
|
6017
|
+
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
6018
|
var IOS_SDK_HEADERS = {};
|
|
5007
6019
|
var IOS_SDK_OVERLAYS = {};
|
|
5008
6020
|
for (const [file, text] of tree) {
|
|
@@ -5029,7 +6041,7 @@ var WASI_EMULATION = [
|
|
|
5029
6041
|
"_WASI_EMULATED_MMAN",
|
|
5030
6042
|
"_WASI_EMULATED_PROCESS_CLOCKS"
|
|
5031
6043
|
];
|
|
5032
|
-
var WASI_EMULATION_FLAGS = WASI_EMULATION.map((
|
|
6044
|
+
var WASI_EMULATION_FLAGS = WASI_EMULATION.map((name2) => `-D${name2}`);
|
|
5033
6045
|
var NATIVE_GRAPH_INPUTS = {
|
|
5034
6046
|
sdk: NATIVE_GRAPH_SDK_VERSION,
|
|
5035
6047
|
settings: "e68503e5e534e9194af5efe8c636ca8b824e2d8237c5f38ec84aa4d155bc8418",
|
|
@@ -5037,7 +6049,7 @@ var NATIVE_GRAPH_INPUTS = {
|
|
|
5037
6049
|
compiler: "Apple Swift version 6.4 (swiftlang-6.4.0.34.1 clang-2100.3.34.1)",
|
|
5038
6050
|
target: IOS_SDK_TARGET
|
|
5039
6051
|
};
|
|
5040
|
-
var NATIVE_GRAPH_ID = (0,
|
|
6052
|
+
var NATIVE_GRAPH_ID = (0, import_node_crypto5.createHash)("sha256").update(JSON.stringify(NATIVE_GRAPH_INPUTS)).digest("hex");
|
|
5041
6053
|
|
|
5042
6054
|
// src/swift-shared-sdk.ts
|
|
5043
6055
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -5203,7 +6215,7 @@ var SWIFTUI_WRAPPER_HOST_PROTOCOLS = new Set(
|
|
|
5203
6215
|
"ToolbarContent",
|
|
5204
6216
|
"Commands",
|
|
5205
6217
|
"DynamicProperty"
|
|
5206
|
-
].map((
|
|
6218
|
+
].map((name2) => `$s7SwiftUI${name2.length}${name2}Mp`)
|
|
5207
6219
|
);
|
|
5208
6220
|
|
|
5209
6221
|
// src/swift-guest-link.ts
|
|
@@ -5284,9 +6296,9 @@ var WASM_OPTIMIZE_IDENTITY = `wasm-opt ${import_wasm_opt.BINARYEN_VERSION} -Oz $
|
|
|
5284
6296
|
|
|
5285
6297
|
// src/swift-icu.ts
|
|
5286
6298
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
5287
|
-
var
|
|
6299
|
+
var import_node_child_process6 = require("node:child_process");
|
|
5288
6300
|
var import_node_util2 = require("node:util");
|
|
5289
|
-
var
|
|
6301
|
+
var import_node_zlib2 = require("node:zlib");
|
|
5290
6302
|
|
|
5291
6303
|
// ../sootsim-swift/src/icuData.ts
|
|
5292
6304
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -5300,10 +6312,10 @@ var VERSION = 1;
|
|
|
5300
6312
|
var SWIFT_ICU_PACKED = `picu${VERSION}`;
|
|
5301
6313
|
|
|
5302
6314
|
// 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)(
|
|
6315
|
+
var run2 = (0, import_node_util2.promisify)(import_node_child_process6.execFile);
|
|
6316
|
+
var deflate = (0, import_node_util2.promisify)(import_node_zlib2.gzip);
|
|
6317
|
+
var compressBrotli = (0, import_node_util2.promisify)(import_node_zlib2.brotliCompress);
|
|
6318
|
+
var inflateGzip = (0, import_node_util2.promisify)(import_node_zlib2.gunzip);
|
|
5307
6319
|
|
|
5308
6320
|
// src/swift-link-roots.ts
|
|
5309
6321
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -5403,7 +6415,7 @@ var FOUNDATION_IMPLICIT_MODULES = [
|
|
|
5403
6415
|
var FOUNDATION_IMPLICIT_FLAGS = FOUNDATION_IMPLICIT_MODULES.map(
|
|
5404
6416
|
(module2) => `, "-Xfrontend", "-import-module", "-Xfrontend", "${module2}"`
|
|
5405
6417
|
).join("");
|
|
5406
|
-
var compilerSourceDigest = true ? "
|
|
6418
|
+
var compilerSourceDigest = true ? "94960e7e108c556e2184ef22baae1e061ca63c08c954c6ad0f677b524be5e117" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
|
|
5407
6419
|
var CORE_FOUNDATION_HANDLE_IMPORTS = [
|
|
5408
6420
|
"CFAllocator",
|
|
5409
6421
|
"CFArray",
|
|
@@ -5418,7 +6430,7 @@ var CORE_FOUNDATION_HANDLE_IMPORTS = [
|
|
|
5418
6430
|
"CFSet",
|
|
5419
6431
|
"CFString",
|
|
5420
6432
|
"CFURL"
|
|
5421
|
-
].map((
|
|
6433
|
+
].map((name2) => `import class CoreFoundation.${name2}`).concat([
|
|
5422
6434
|
"import typealias CoreFoundation.CFPropertyList",
|
|
5423
6435
|
"import typealias CoreFoundation.CFTypeRef",
|
|
5424
6436
|
"import CoreGraphics"
|
|
@@ -5451,8 +6463,8 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
5451
6463
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
5452
6464
|
|
|
5453
6465
|
// src/swift-package-manifest.ts
|
|
5454
|
-
var cacheDir3 =
|
|
5455
|
-
var execFileAsync = (0, import_node_util3.promisify)(
|
|
6466
|
+
var cacheDir3 = import_node_path12.default.join(cacheDir(), "swift-manifests");
|
|
6467
|
+
var execFileAsync = (0, import_node_util3.promisify)(import_node_child_process7.execFile);
|
|
5456
6468
|
|
|
5457
6469
|
// src/xcode-json-project.ts
|
|
5458
6470
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -5472,36 +6484,36 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
5472
6484
|
|
|
5473
6485
|
// src/nitro-dependencies.ts
|
|
5474
6486
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
5475
|
-
var
|
|
6487
|
+
var import_node_child_process9 = require("node:child_process");
|
|
5476
6488
|
var import_node_util5 = require("node:util");
|
|
5477
6489
|
|
|
5478
6490
|
// src/kotlin-toolchain.ts
|
|
5479
6491
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
5480
|
-
var
|
|
6492
|
+
var import_node_child_process8 = require("node:child_process");
|
|
5481
6493
|
var import_node_util4 = require("node:util");
|
|
5482
|
-
var run3 = (0, import_node_util4.promisify)(
|
|
6494
|
+
var run3 = (0, import_node_util4.promisify)(import_node_child_process8.execFile);
|
|
5483
6495
|
|
|
5484
6496
|
// src/swift-source-file.ts
|
|
5485
6497
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
5486
|
-
var
|
|
5487
|
-
var
|
|
6498
|
+
var import_node_fs11 = __toESM(require("node:fs"), 1);
|
|
6499
|
+
var import_node_path13 = __toESM(require("node:path"), 1);
|
|
5488
6500
|
function relativeInside(root, file) {
|
|
5489
|
-
const relative2 =
|
|
5490
|
-
return relative2 === ".." || relative2.startsWith(`..${
|
|
6501
|
+
const relative2 = import_node_path13.default.relative(root, file);
|
|
6502
|
+
return relative2 === ".." || relative2.startsWith(`..${import_node_path13.default.sep}`) || import_node_path13.default.isAbsolute(relative2) ? null : relative2;
|
|
5491
6503
|
}
|
|
5492
6504
|
function packageInputPath(canonicalRoot, file) {
|
|
5493
|
-
const canonicalFile =
|
|
6505
|
+
const canonicalFile = import_node_fs11.default.realpathSync(file);
|
|
5494
6506
|
if (relativeInside(canonicalRoot, canonicalFile) === null) {
|
|
5495
6507
|
throw new Error(`swift input escapes the selected package: ${file}`);
|
|
5496
6508
|
}
|
|
5497
6509
|
return canonicalFile;
|
|
5498
6510
|
}
|
|
5499
6511
|
function readPackageFile(root, file, maxBytes) {
|
|
5500
|
-
const canonicalFile = packageInputPath(
|
|
5501
|
-
const expected =
|
|
5502
|
-
const fd =
|
|
6512
|
+
const canonicalFile = packageInputPath(import_node_fs11.default.realpathSync(root), file);
|
|
6513
|
+
const expected = import_node_fs11.default.statSync(canonicalFile);
|
|
6514
|
+
const fd = import_node_fs11.default.openSync(canonicalFile, import_node_fs11.default.constants.O_RDONLY | import_node_fs11.default.constants.O_NOFOLLOW);
|
|
5503
6515
|
try {
|
|
5504
|
-
const stat =
|
|
6516
|
+
const stat = import_node_fs11.default.fstatSync(fd);
|
|
5505
6517
|
if (stat.dev !== expected.dev || stat.ino !== expected.ino) {
|
|
5506
6518
|
throw new Error(`swift input changed while opening: ${file}`);
|
|
5507
6519
|
}
|
|
@@ -5511,16 +6523,16 @@ function readPackageFile(root, file, maxBytes) {
|
|
|
5511
6523
|
const bytes = Buffer.alloc(stat.size + 1);
|
|
5512
6524
|
let offset = 0;
|
|
5513
6525
|
while (offset < bytes.length) {
|
|
5514
|
-
const count =
|
|
6526
|
+
const count = import_node_fs11.default.readSync(fd, bytes, offset, bytes.length - offset, null);
|
|
5515
6527
|
if (count === 0) break;
|
|
5516
6528
|
offset += count;
|
|
5517
6529
|
}
|
|
5518
|
-
if (offset !== stat.size ||
|
|
6530
|
+
if (offset !== stat.size || import_node_fs11.default.fstatSync(fd).size !== stat.size) {
|
|
5519
6531
|
throw new Error(`swift input changed while reading: ${file}`);
|
|
5520
6532
|
}
|
|
5521
6533
|
return bytes.subarray(0, offset);
|
|
5522
6534
|
} finally {
|
|
5523
|
-
|
|
6535
|
+
import_node_fs11.default.closeSync(fd);
|
|
5524
6536
|
}
|
|
5525
6537
|
}
|
|
5526
6538
|
|
|
@@ -5539,7 +6551,7 @@ var MAX_SWIFT_COMPILE_IMAGE_BYTES = 4 * 1024 * 1024;
|
|
|
5539
6551
|
var MAX_SWIFT_COMPILE_IMAGE_TOTAL_BYTES = 16 * 1024 * 1024;
|
|
5540
6552
|
|
|
5541
6553
|
// src/nitro-dependencies.ts
|
|
5542
|
-
var run4 = (0, import_node_util5.promisify)(
|
|
6554
|
+
var run4 = (0, import_node_util5.promisify)(import_node_child_process9.execFile);
|
|
5543
6555
|
var DOUBLE_CONVERSION_WASM32_BACKPORT = {
|
|
5544
6556
|
upstreamCommit: "8857767d5b2f5a035321e3712e8cd0008840ba6b",
|
|
5545
6557
|
originalSha256: "b495b11f7b61693486894f747add5b454894b8b3ca41aa1610d370ba16407ab7",
|
|
@@ -5617,9 +6629,9 @@ var RN_FMT_12_DEPENDENCIES = [
|
|
|
5617
6629
|
|
|
5618
6630
|
// src/react-native-autolinking.ts
|
|
5619
6631
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
5620
|
-
var
|
|
6632
|
+
var import_node_child_process10 = require("node:child_process");
|
|
5621
6633
|
var import_node_util6 = require("node:util");
|
|
5622
|
-
var run5 = (0, import_node_util6.promisify)(
|
|
6634
|
+
var run5 = (0, import_node_util6.promisify)(import_node_child_process10.execFile);
|
|
5623
6635
|
|
|
5624
6636
|
// src/workspace-root.ts
|
|
5625
6637
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -8686,8 +9698,8 @@ var COMPAT_STUBS = {
|
|
|
8686
9698
|
|
|
8687
9699
|
// src/installed-native-build-options.ts
|
|
8688
9700
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
8689
|
-
var
|
|
8690
|
-
var
|
|
9701
|
+
var import_node_fs12 = __toESM(require("node:fs"), 1);
|
|
9702
|
+
var import_node_path14 = __toESM(require("node:path"), 1);
|
|
8691
9703
|
var RIVE_PACKAGE = "@rive-app/react-native";
|
|
8692
9704
|
var RIVE_05 = [">=0.5.0 <0.6.0"];
|
|
8693
9705
|
function missing(error) {
|
|
@@ -8695,10 +9707,10 @@ function missing(error) {
|
|
|
8695
9707
|
}
|
|
8696
9708
|
function answerSync(step) {
|
|
8697
9709
|
try {
|
|
8698
|
-
if (step.type === "realpath") return
|
|
8699
|
-
if (step.type === "read") return
|
|
8700
|
-
if (step.type === "isDirectory") return
|
|
8701
|
-
return
|
|
9710
|
+
if (step.type === "realpath") return import_node_fs12.default.realpathSync(step.path);
|
|
9711
|
+
if (step.type === "read") return import_node_fs12.default.readFileSync(step.path, "utf8");
|
|
9712
|
+
if (step.type === "isDirectory") return import_node_fs12.default.statSync(step.path).isDirectory();
|
|
9713
|
+
return import_node_fs12.default.readdirSync(step.path, { withFileTypes: true }).map((entry) => ({
|
|
8702
9714
|
name: entry.name,
|
|
8703
9715
|
directory: entry.isDirectory(),
|
|
8704
9716
|
symbolicLink: entry.isSymbolicLink()
|
|
@@ -8710,11 +9722,11 @@ function answerSync(step) {
|
|
|
8710
9722
|
}
|
|
8711
9723
|
async function answerAsync(step) {
|
|
8712
9724
|
try {
|
|
8713
|
-
if (step.type === "realpath") return await
|
|
8714
|
-
if (step.type === "read") return await
|
|
9725
|
+
if (step.type === "realpath") return await import_node_fs12.default.promises.realpath(step.path);
|
|
9726
|
+
if (step.type === "read") return await import_node_fs12.default.promises.readFile(step.path, "utf8");
|
|
8715
9727
|
if (step.type === "isDirectory")
|
|
8716
|
-
return (await
|
|
8717
|
-
return (await
|
|
9728
|
+
return (await import_node_fs12.default.promises.stat(step.path)).isDirectory();
|
|
9729
|
+
return (await import_node_fs12.default.promises.readdir(step.path, { withFileTypes: true })).map(
|
|
8718
9730
|
(entry) => ({
|
|
8719
9731
|
name: entry.name,
|
|
8720
9732
|
directory: entry.isDirectory(),
|
|
@@ -8747,7 +9759,7 @@ function* rubyFiles(directory, seen, iosRoot = false) {
|
|
|
8747
9759
|
const files = [];
|
|
8748
9760
|
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
8749
9761
|
if (iosRoot && (entry.name === "Pods" || entry.name === "build")) continue;
|
|
8750
|
-
const target =
|
|
9762
|
+
const target = import_node_path14.default.join(directory, entry.name);
|
|
8751
9763
|
let isDirectory = entry.directory;
|
|
8752
9764
|
if (entry.symbolicLink)
|
|
8753
9765
|
isDirectory = (yield { type: "isDirectory", path: target }) === true;
|
|
@@ -8760,7 +9772,7 @@ function* nativeBuildOptionsWalk(projectRoot, versions, environment) {
|
|
|
8760
9772
|
let sensorOptions = {};
|
|
8761
9773
|
const sensors = versions["expo-sensors"];
|
|
8762
9774
|
if (sensors && resolveCompatVersionRange([">=58.0.4 <59.0.0"], sensors).status === "matched") {
|
|
8763
|
-
const file =
|
|
9775
|
+
const file = import_node_path14.default.join(projectRoot, "ios", "Podfile.properties.json");
|
|
8764
9776
|
const source = yield { type: "read", path: file };
|
|
8765
9777
|
if (source !== null && typeof source !== "string")
|
|
8766
9778
|
throw new Error(`cannot inspect ${file}`);
|
|
@@ -8776,8 +9788,8 @@ function* nativeBuildOptionsWalk(projectRoot, versions, environment) {
|
|
|
8776
9788
|
if (!needsRiveOptions(versions)) return sensorOptions;
|
|
8777
9789
|
if (environment.USE_RIVE_LEGACY === "1" || environment.USE_RIVE_LEGACY === "true")
|
|
8778
9790
|
return { ...sensorOptions, [RIVE_PACKAGE]: { USE_RIVE_LEGACY: true } };
|
|
8779
|
-
const ios =
|
|
8780
|
-
const podfile =
|
|
9791
|
+
const ios = import_node_path14.default.join(projectRoot, "ios");
|
|
9792
|
+
const podfile = import_node_path14.default.join(ios, "Podfile");
|
|
8781
9793
|
const files = [podfile, ...yield* rubyFiles(ios, /* @__PURE__ */ new Set(), true)];
|
|
8782
9794
|
let value = false;
|
|
8783
9795
|
let assigned = false;
|
|
@@ -8896,7 +9908,7 @@ async function runAsync(walk, inputs) {
|
|
|
8896
9908
|
function createInstalledPackageReader() {
|
|
8897
9909
|
const hasModules = /* @__PURE__ */ new Map();
|
|
8898
9910
|
const manifests = /* @__PURE__ */ new Map();
|
|
8899
|
-
return function* readInstalledPackage(fromDir,
|
|
9911
|
+
return function* readInstalledPackage(fromDir, name2) {
|
|
8900
9912
|
for (let dir = fromDir; ; ) {
|
|
8901
9913
|
if (import_path2.default.basename(dir) !== "node_modules") {
|
|
8902
9914
|
const modules = import_path2.default.join(dir, "node_modules");
|
|
@@ -8906,7 +9918,7 @@ function createInstalledPackageReader() {
|
|
|
8906
9918
|
hasModules.set(dir, present);
|
|
8907
9919
|
}
|
|
8908
9920
|
if (present) {
|
|
8909
|
-
const root = import_path2.default.join(modules,
|
|
9921
|
+
const root = import_path2.default.join(modules, name2);
|
|
8910
9922
|
let installed = manifests.get(root);
|
|
8911
9923
|
if (installed === void 0) {
|
|
8912
9924
|
const manifest = yield* readManifest(import_path2.default.join(root, "package.json"));
|
|
@@ -8925,11 +9937,11 @@ function createInstalledPackageReader() {
|
|
|
8925
9937
|
function* installedVersionsWalk(projectRoot, names, selectedPackages) {
|
|
8926
9938
|
const readInstalledPackage = createInstalledPackageReader();
|
|
8927
9939
|
const versions = {};
|
|
8928
|
-
for (const
|
|
8929
|
-
const installed = selectedPackages ? selectedPackages.get(
|
|
9940
|
+
for (const name2 of [...names].sort()) {
|
|
9941
|
+
const installed = selectedPackages ? selectedPackages.get(name2) : yield* readInstalledPackage(projectRoot, name2);
|
|
8930
9942
|
const version = installed && Reflect.get(installed.manifest, "version");
|
|
8931
|
-
if (typeof version === "string" && version.length > 0) versions[
|
|
8932
|
-
if (
|
|
9943
|
+
if (typeof version === "string" && version.length > 0) versions[name2] = version;
|
|
9944
|
+
if (name2 === "react-native-worklets" && installed) {
|
|
8933
9945
|
const defaults = yield* readManifest(
|
|
8934
9946
|
import_path2.default.join(installed.root, "src/featureFlags/staticFlags.json")
|
|
8935
9947
|
);
|
|
@@ -8951,8 +9963,8 @@ function* nativePackageVersionsWalk(projectRoot) {
|
|
|
8951
9963
|
...LAZY_STUB_PATTERNS,
|
|
8952
9964
|
...Object.values(COMPAT_STUBS).map((entry) => entry.specifier)
|
|
8953
9965
|
]) {
|
|
8954
|
-
const
|
|
8955
|
-
if (
|
|
9966
|
+
const name2 = extractPackageFromPath(`node_modules/${specifier}`);
|
|
9967
|
+
if (name2) nativeNames.add(name2);
|
|
8956
9968
|
}
|
|
8957
9969
|
const manifest = yield* readManifest(import_path2.default.join(appRoot, "package.json"));
|
|
8958
9970
|
if (!manifest) throw new Error("app package.json must contain an object");
|
|
@@ -8970,16 +9982,16 @@ function* nativePackageVersionsWalk(projectRoot) {
|
|
|
8970
9982
|
for (const field of fields) {
|
|
8971
9983
|
const dependencies = Reflect.get(next.manifest, field);
|
|
8972
9984
|
if (typeof dependencies !== "object" || dependencies === null) continue;
|
|
8973
|
-
for (const
|
|
9985
|
+
for (const name2 of Object.keys(dependencies)) {
|
|
8974
9986
|
if (field === "peerDependencies" && typeof peers === "object" && peers !== null) {
|
|
8975
|
-
const peer = Reflect.get(peers,
|
|
9987
|
+
const peer = Reflect.get(peers, name2);
|
|
8976
9988
|
if (typeof peer === "object" && peer !== null && Reflect.get(peer, "optional"))
|
|
8977
9989
|
continue;
|
|
8978
9990
|
}
|
|
8979
|
-
const installed = yield* readInstalledPackage(root,
|
|
9991
|
+
const installed = yield* readInstalledPackage(root, name2);
|
|
8980
9992
|
if (!installed) continue;
|
|
8981
|
-
if (nativeNames.has(
|
|
8982
|
-
needed.set(
|
|
9993
|
+
if (nativeNames.has(name2) && !needed.has(name2))
|
|
9994
|
+
needed.set(name2, (yield* readInstalledPackage(appRoot, name2)) ?? installed);
|
|
8983
9995
|
pending.push(installed);
|
|
8984
9996
|
}
|
|
8985
9997
|
}
|
|
@@ -9037,10 +10049,10 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
9037
10049
|
// scripts/dev-server-scanner.ts
|
|
9038
10050
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
9039
10051
|
var import_child_process = require("child_process");
|
|
9040
|
-
var
|
|
9041
|
-
var
|
|
9042
|
-
var
|
|
9043
|
-
var
|
|
10052
|
+
var import_promises3 = require("fs/promises");
|
|
10053
|
+
var import_node_fs13 = require("node:fs");
|
|
10054
|
+
var import_node_os5 = require("node:os");
|
|
10055
|
+
var import_node_path15 = require("node:path");
|
|
9044
10056
|
|
|
9045
10057
|
// src/config.ts
|
|
9046
10058
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -9190,11 +10202,11 @@ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
|
9190
10202
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
9191
10203
|
|
|
9192
10204
|
// scripts/dev-server-scanner.ts
|
|
9193
|
-
var LISTENER_LOCK_PATH = (0,
|
|
9194
|
-
var LISTENER_RESULT_PATH = (0,
|
|
10205
|
+
var LISTENER_LOCK_PATH = (0, import_node_path15.join)((0, import_node_os5.tmpdir)(), "peach-listener-scan.lock");
|
|
10206
|
+
var LISTENER_RESULT_PATH = (0, import_node_path15.join)((0, import_node_os5.tmpdir)(), "peach-listener-scan.result");
|
|
9195
10207
|
var LISTENER_LOCK_STALE_MS = 25e3;
|
|
9196
10208
|
var LISTENER_LOCK_WAIT_MS = 8e3;
|
|
9197
|
-
function
|
|
10209
|
+
function sleep2(ms) {
|
|
9198
10210
|
return new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
9199
10211
|
}
|
|
9200
10212
|
function pidIsAlive(pid) {
|
|
@@ -9209,8 +10221,8 @@ function pidIsAlive(pid) {
|
|
|
9209
10221
|
}
|
|
9210
10222
|
function readLockOwner() {
|
|
9211
10223
|
try {
|
|
9212
|
-
const raw = (0,
|
|
9213
|
-
const mtimeMs = (0,
|
|
10224
|
+
const raw = (0, import_node_fs13.readFileSync)(LISTENER_LOCK_PATH, "utf8");
|
|
10225
|
+
const mtimeMs = (0, import_node_fs13.statSync)(LISTENER_LOCK_PATH).mtimeMs;
|
|
9214
10226
|
const pid = Number(raw.split("-")[0]);
|
|
9215
10227
|
return { raw, pid: Number.isInteger(pid) ? pid : -1, mtimeMs };
|
|
9216
10228
|
} catch {
|
|
@@ -9223,15 +10235,15 @@ function lockIsAbandoned(owner) {
|
|
|
9223
10235
|
}
|
|
9224
10236
|
function clearLock(raw) {
|
|
9225
10237
|
try {
|
|
9226
|
-
if ((0,
|
|
9227
|
-
(0,
|
|
10238
|
+
if ((0, import_node_fs13.readFileSync)(LISTENER_LOCK_PATH, "utf8") !== raw) return;
|
|
10239
|
+
(0, import_node_fs13.unlinkSync)(LISTENER_LOCK_PATH);
|
|
9228
10240
|
} catch {
|
|
9229
10241
|
}
|
|
9230
10242
|
}
|
|
9231
10243
|
function readResult() {
|
|
9232
10244
|
try {
|
|
9233
10245
|
const parsed = JSON.parse(
|
|
9234
|
-
(0,
|
|
10246
|
+
(0, import_node_fs13.readFileSync)(LISTENER_RESULT_PATH, "utf8")
|
|
9235
10247
|
);
|
|
9236
10248
|
if (!parsed || typeof parsed.token !== "string" || typeof parsed.key !== "string")
|
|
9237
10249
|
return null;
|
|
@@ -9242,8 +10254,8 @@ function readResult() {
|
|
|
9242
10254
|
}
|
|
9243
10255
|
function publishResult(payload) {
|
|
9244
10256
|
const tmp = `${LISTENER_RESULT_PATH}.${process.pid}.tmp`;
|
|
9245
|
-
(0,
|
|
9246
|
-
(0,
|
|
10257
|
+
(0, import_node_fs13.writeFileSync)(tmp, JSON.stringify(payload));
|
|
10258
|
+
(0, import_node_fs13.renameSync)(tmp, LISTENER_RESULT_PATH);
|
|
9247
10259
|
}
|
|
9248
10260
|
function throwPublished(payload) {
|
|
9249
10261
|
throw Object.assign(new Error(payload.message || "listener scan failed"), {
|
|
@@ -9274,7 +10286,7 @@ async function waitForSharedResult(owner, key) {
|
|
|
9274
10286
|
clearLock(latest.raw);
|
|
9275
10287
|
return { kind: "retry" };
|
|
9276
10288
|
}
|
|
9277
|
-
await
|
|
10289
|
+
await sleep2(25);
|
|
9278
10290
|
}
|
|
9279
10291
|
throw Object.assign(new Error("listener scan lock was held past the wait"), {
|
|
9280
10292
|
killed: true
|
|
@@ -9286,7 +10298,7 @@ async function withListenerLock(key, body) {
|
|
|
9286
10298
|
for (; ; ) {
|
|
9287
10299
|
let fd = null;
|
|
9288
10300
|
try {
|
|
9289
|
-
fd = (0,
|
|
10301
|
+
fd = (0, import_node_fs13.openSync)(LISTENER_LOCK_PATH, "wx");
|
|
9290
10302
|
} catch (error) {
|
|
9291
10303
|
const code = error instanceof Error && "code" in error ? error.code : "";
|
|
9292
10304
|
if (code !== "EEXIST") throw error;
|
|
@@ -9295,7 +10307,7 @@ async function withListenerLock(key, body) {
|
|
|
9295
10307
|
if (owner) clearLock(owner.raw);
|
|
9296
10308
|
else {
|
|
9297
10309
|
try {
|
|
9298
|
-
(0,
|
|
10310
|
+
(0, import_node_fs13.unlinkSync)(LISTENER_LOCK_PATH);
|
|
9299
10311
|
} catch {
|
|
9300
10312
|
}
|
|
9301
10313
|
}
|
|
@@ -9306,12 +10318,12 @@ async function withListenerLock(key, body) {
|
|
|
9306
10318
|
if (shared.kind === "value") return shared.value;
|
|
9307
10319
|
continue;
|
|
9308
10320
|
}
|
|
9309
|
-
await
|
|
10321
|
+
await sleep2(25);
|
|
9310
10322
|
continue;
|
|
9311
10323
|
}
|
|
9312
10324
|
if (fd === null) continue;
|
|
9313
10325
|
try {
|
|
9314
|
-
(0,
|
|
10326
|
+
(0, import_node_fs13.writeSync)(fd, token);
|
|
9315
10327
|
try {
|
|
9316
10328
|
const value = await body();
|
|
9317
10329
|
publishResult({ token, key, ok: true, value });
|
|
@@ -9328,7 +10340,7 @@ async function withListenerLock(key, body) {
|
|
|
9328
10340
|
}
|
|
9329
10341
|
} finally {
|
|
9330
10342
|
try {
|
|
9331
|
-
(0,
|
|
10343
|
+
(0, import_node_fs13.closeSync)(fd);
|
|
9332
10344
|
} catch {
|
|
9333
10345
|
}
|
|
9334
10346
|
clearLock(token);
|
|
@@ -9577,7 +10589,7 @@ async function flushCwdQueue() {
|
|
|
9577
10589
|
const needLsof = [];
|
|
9578
10590
|
for (const pid of pending) {
|
|
9579
10591
|
try {
|
|
9580
|
-
const cwd = await (0,
|
|
10592
|
+
const cwd = await (0, import_promises3.readlink)(`/proc/${pid}/cwd`);
|
|
9581
10593
|
if (cwd) {
|
|
9582
10594
|
cwdByPid.set(pid, cwd);
|
|
9583
10595
|
continue;
|
|
@@ -9812,7 +10824,7 @@ function nodeRequestHeaderEntries(headers) {
|
|
|
9812
10824
|
|
|
9813
10825
|
// src/host/hostname-resolver.ts
|
|
9814
10826
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
9815
|
-
var
|
|
10827
|
+
var import_promises4 = require("node:dns/promises");
|
|
9816
10828
|
|
|
9817
10829
|
// src/dns-over-https.ts
|
|
9818
10830
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -9854,7 +10866,7 @@ function parseIpv6(text) {
|
|
|
9854
10866
|
|
|
9855
10867
|
// src/host/network-policy.ts
|
|
9856
10868
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
9857
|
-
var
|
|
10869
|
+
var import_node_path16 = require("node:path");
|
|
9858
10870
|
var import_node_url = require("node:url");
|
|
9859
10871
|
var NETWORK_POLICY_TIMEOUT_MS = 1e4;
|
|
9860
10872
|
var NetworkPolicyDeniedError = class extends Error {
|
|
@@ -9907,7 +10919,7 @@ function createNetworkAuthorizer(policy) {
|
|
|
9907
10919
|
};
|
|
9908
10920
|
}
|
|
9909
10921
|
async function loadNetworkPolicy(file) {
|
|
9910
|
-
if (!(0,
|
|
10922
|
+
if (!(0, import_node_path16.isAbsolute)(file)) {
|
|
9911
10923
|
throw new Error(`PEACH_NETWORK_POLICY must be an absolute path: ${file}`);
|
|
9912
10924
|
}
|
|
9913
10925
|
const loaded2 = await import(
|
|
@@ -9943,7 +10955,7 @@ async function handleHostnameResolutionRequest(req, res) {
|
|
|
9943
10955
|
}
|
|
9944
10956
|
let addresses;
|
|
9945
10957
|
try {
|
|
9946
|
-
addresses = (await (0,
|
|
10958
|
+
addresses = (await (0, import_promises4.lookup)(host2, { all: true })).map(({ address }) => {
|
|
9947
10959
|
const bytes = parseIpLiteral(address);
|
|
9948
10960
|
if (!bytes) throw new Error("system resolver returned an invalid address");
|
|
9949
10961
|
return bytes;
|
|
@@ -9995,12 +11007,12 @@ function projectLoopbackUrl(value) {
|
|
|
9995
11007
|
// src/host/rolldown-bundle-forward.ts
|
|
9996
11008
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
9997
11009
|
var import_stream = require("stream");
|
|
9998
|
-
var
|
|
11010
|
+
var import_promises5 = require("stream/promises");
|
|
9999
11011
|
var ROLLDOWN_INVENTORY_HEADER = "x-peach-rolldown-inventory";
|
|
10000
11012
|
async function forwardRolldownBundleResponse(upstream, res) {
|
|
10001
11013
|
res.setHeader(ROLLDOWN_INVENTORY_HEADER, "1");
|
|
10002
11014
|
if (upstream.headers[ROLLDOWN_INVENTORY_HEADER] === "1") {
|
|
10003
|
-
await (0,
|
|
11015
|
+
await (0, import_promises5.pipeline)(upstream, res);
|
|
10004
11016
|
return;
|
|
10005
11017
|
}
|
|
10006
11018
|
const contentType = typeof upstream.headers["content-type"] === "string" ? upstream.headers["content-type"] : "";
|
|
@@ -10042,7 +11054,7 @@ async function forwardRolldownBundleResponse(upstream, res) {
|
|
|
10042
11054
|
}
|
|
10043
11055
|
yield Buffer.from(annotated.slice(sent), "utf8");
|
|
10044
11056
|
};
|
|
10045
|
-
await (0,
|
|
11057
|
+
await (0, import_promises5.pipeline)(import_stream.Readable.from(annotate(), { objectMode: false }), res);
|
|
10046
11058
|
}
|
|
10047
11059
|
|
|
10048
11060
|
// src/host/fetch-proxy-handler.ts
|
|
@@ -10088,7 +11100,7 @@ function applyFetchProxyCors(req, res) {
|
|
|
10088
11100
|
"access-control-expose-headers",
|
|
10089
11101
|
[
|
|
10090
11102
|
...Object.keys(res.getHeaders()).filter(
|
|
10091
|
-
(
|
|
11103
|
+
(name2) => !name2.startsWith("access-control-")
|
|
10092
11104
|
),
|
|
10093
11105
|
"x-sootsim-set-cookie"
|
|
10094
11106
|
].join(", ")
|
|
@@ -10114,7 +11126,7 @@ function buildAppApiProxyHeaders(reqHeaders, targetUrl) {
|
|
|
10114
11126
|
if (typeof nativeCookie === "string" && nativeCookie)
|
|
10115
11127
|
headers.cookie = decodeURIComponent(nativeCookie);
|
|
10116
11128
|
headers.host = targetUrl.host;
|
|
10117
|
-
if (!Object.keys(headers).some((
|
|
11129
|
+
if (!Object.keys(headers).some((name2) => name2.toLowerCase() === "mobile-origin")) {
|
|
10118
11130
|
headers.origin = targetUrl.origin;
|
|
10119
11131
|
headers.referer = `${targetUrl.origin}/`;
|
|
10120
11132
|
}
|
|
@@ -10253,7 +11265,7 @@ function handleAppApiRequest(req, res) {
|
|
|
10253
11265
|
res.setHeader("access-control-allow-credentials", "true");
|
|
10254
11266
|
res.setHeader(
|
|
10255
11267
|
"access-control-expose-headers",
|
|
10256
|
-
Object.keys(res.getHeaders()).filter((
|
|
11268
|
+
Object.keys(res.getHeaders()).filter((name2) => !name2.startsWith("access-control-") && name2 !== "set-cookie").join(", ")
|
|
10257
11269
|
);
|
|
10258
11270
|
}
|
|
10259
11271
|
});
|
|
@@ -10373,7 +11385,7 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
10373
11385
|
await route.respond(proxyRes, hopCookies);
|
|
10374
11386
|
if (isNativeCookieRedirect(hop)) res.removeHeader("location");
|
|
10375
11387
|
res.statusCode = isNativeCookieRedirect(hop) ? 200 : status;
|
|
10376
|
-
await (0,
|
|
11388
|
+
await (0, import_promises6.pipeline)(proxyRes, res);
|
|
10377
11389
|
return;
|
|
10378
11390
|
}
|
|
10379
11391
|
if (location && (status === 301 || status === 302 || status === 303 || status === 307 || status === 308)) {
|
|
@@ -10384,7 +11396,7 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
10384
11396
|
const switchToGet = (status === 301 || status === 302) && method === "POST" || status === 303 && method !== "GET" && method !== "HEAD";
|
|
10385
11397
|
const redirectUrl = resolveRedirectUrl(location, targetUrl);
|
|
10386
11398
|
proxyRes.resume();
|
|
10387
|
-
await (0,
|
|
11399
|
+
await (0, import_promises6.finished)(proxyRes);
|
|
10388
11400
|
await proxy(
|
|
10389
11401
|
redirectUrl,
|
|
10390
11402
|
switchToGet ? "GET" : method,
|
|
@@ -10401,7 +11413,7 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
10401
11413
|
await forwardRolldownBundleResponse(proxyRes, res);
|
|
10402
11414
|
return;
|
|
10403
11415
|
}
|
|
10404
|
-
await (0,
|
|
11416
|
+
await (0, import_promises6.pipeline)(proxyRes, res);
|
|
10405
11417
|
};
|
|
10406
11418
|
let upstreamAnswered = false;
|
|
10407
11419
|
let body;
|
|
@@ -10459,9 +11471,9 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
|
|
|
10459
11471
|
|
|
10460
11472
|
// src/host/replacement-module-handler.ts
|
|
10461
11473
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
10462
|
-
var
|
|
10463
|
-
var
|
|
10464
|
-
var
|
|
11474
|
+
var import_node_fs14 = require("node:fs");
|
|
11475
|
+
var import_promises7 = __toESM(require("node:fs/promises"), 1);
|
|
11476
|
+
var import_node_path17 = __toESM(require("node:path"), 1);
|
|
10465
11477
|
|
|
10466
11478
|
// ../contrast-bundler/src/replacementModule.ts
|
|
10467
11479
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
@@ -10502,7 +11514,7 @@ function normalize(p) {
|
|
|
10502
11514
|
if (trailingSlash) joined += "/";
|
|
10503
11515
|
return absolute ? "/" + joined : joined;
|
|
10504
11516
|
}
|
|
10505
|
-
function
|
|
11517
|
+
function join5(...parts) {
|
|
10506
11518
|
const present = parts.filter((part) => part.length > 0);
|
|
10507
11519
|
if (present.length === 0) return ".";
|
|
10508
11520
|
return normalize(present.join("/"));
|
|
@@ -10559,7 +11571,7 @@ var posix = {
|
|
|
10559
11571
|
delimiter,
|
|
10560
11572
|
isAbsolute: isAbsolute2,
|
|
10561
11573
|
normalize,
|
|
10562
|
-
join:
|
|
11574
|
+
join: join5,
|
|
10563
11575
|
resolve: resolve2,
|
|
10564
11576
|
dirname,
|
|
10565
11577
|
basename,
|
|
@@ -10602,21 +11614,21 @@ function unsupportedSpecifier(specifier) {
|
|
|
10602
11614
|
`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.`
|
|
10603
11615
|
);
|
|
10604
11616
|
}
|
|
10605
|
-
function bridgeDeclaration(
|
|
11617
|
+
function bridgeDeclaration(name2, specifier) {
|
|
10606
11618
|
const notReady = (what) => JSON.stringify(`[peach] replacement ${what} bridge is not ready`);
|
|
10607
11619
|
if (specifier === "react") {
|
|
10608
|
-
return `const ${
|
|
11620
|
+
return `const ${name2} = ${REACT_BRIDGE}; if (!${name2}) throw new Error(${notReady("React")});`;
|
|
10609
11621
|
}
|
|
10610
11622
|
if (specifier === "react-native") {
|
|
10611
|
-
return `const ${
|
|
11623
|
+
return `const ${name2} = ${REACT_NATIVE_BRIDGE}; if (!${name2}) throw new Error(${notReady("React Native")});`;
|
|
10612
11624
|
}
|
|
10613
11625
|
if (isPeachKitSpecifier(specifier)) {
|
|
10614
|
-
return `const ${
|
|
11626
|
+
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`)});`;
|
|
10615
11627
|
}
|
|
10616
11628
|
if (JSX_RUNTIME_SPECIFIERS.has(specifier)) {
|
|
10617
|
-
return `const ${
|
|
11629
|
+
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 }; })();`;
|
|
10618
11630
|
}
|
|
10619
|
-
return `const ${
|
|
11631
|
+
return `const ${name2} = (${PACKAGE_BRIDGES} || {})[${JSON.stringify(specifier)}]; if (!${name2}) throw new Error(${JSON.stringify(`[peach] replacement package bridge ${specifier} is not ready`)});`;
|
|
10620
11632
|
}
|
|
10621
11633
|
var DEFAULT_INTEROP = "__rnxReplacementDefault";
|
|
10622
11634
|
var DEFAULT_INTEROP_DECLARATION = `const ${DEFAULT_INTEROP} = (bridge) => (bridge && bridge.__esModule ? bridge.default : bridge);`;
|
|
@@ -10648,10 +11660,10 @@ function compileReplacementModule(input) {
|
|
|
10648
11660
|
const bridgeFor = (specifier) => {
|
|
10649
11661
|
const existing = bridgeNames.get(specifier);
|
|
10650
11662
|
if (existing) return existing;
|
|
10651
|
-
const
|
|
10652
|
-
bridgeNames.set(specifier,
|
|
10653
|
-
declarations.push(bridgeDeclaration(
|
|
10654
|
-
return
|
|
11663
|
+
const name2 = `__rnxReplacementBridge${bridgeNames.size}`;
|
|
11664
|
+
bridgeNames.set(specifier, name2);
|
|
11665
|
+
declarations.push(bridgeDeclaration(name2, specifier));
|
|
11666
|
+
return name2;
|
|
10655
11667
|
};
|
|
10656
11668
|
const edits = [];
|
|
10657
11669
|
const pointAtLocalModule = (specifierToken, specifier) => {
|
|
@@ -10790,16 +11802,16 @@ function sendJavaScript(req, res, source) {
|
|
|
10790
11802
|
res.end(req.method === "HEAD" ? void 0 : source);
|
|
10791
11803
|
}
|
|
10792
11804
|
function resolveReplacementModuleFile(fromFile, specifier) {
|
|
10793
|
-
const base =
|
|
11805
|
+
const base = import_node_path17.default.resolve(import_node_path17.default.dirname(fromFile), specifier);
|
|
10794
11806
|
const candidates = [
|
|
10795
11807
|
...REPLACEMENT_MODULE_EXTENSIONS.some(
|
|
10796
|
-
(ext) => ext ===
|
|
11808
|
+
(ext) => ext === import_node_path17.default.extname(base).toLowerCase()
|
|
10797
11809
|
) ? [base] : [],
|
|
10798
11810
|
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => base + ext),
|
|
10799
|
-
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) =>
|
|
11811
|
+
...REPLACEMENT_MODULE_EXTENSIONS.map((ext) => import_node_path17.default.join(base, `index${ext}`))
|
|
10800
11812
|
];
|
|
10801
11813
|
const found = candidates.find(
|
|
10802
|
-
(candidate) => (0,
|
|
11814
|
+
(candidate) => (0, import_node_fs14.statSync)(candidate, { throwIfNoEntry: false })?.isFile()
|
|
10803
11815
|
);
|
|
10804
11816
|
if (!found) {
|
|
10805
11817
|
throw new Error(
|
|
@@ -10810,8 +11822,8 @@ function resolveReplacementModuleFile(fromFile, specifier) {
|
|
|
10810
11822
|
}
|
|
10811
11823
|
function isInsideAny(roots, file) {
|
|
10812
11824
|
return roots.some((root) => {
|
|
10813
|
-
const relative2 =
|
|
10814
|
-
return !relative2.startsWith("..") && !
|
|
11825
|
+
const relative2 = import_node_path17.default.relative(root, file);
|
|
11826
|
+
return !relative2.startsWith("..") && !import_node_path17.default.isAbsolute(relative2);
|
|
10815
11827
|
});
|
|
10816
11828
|
}
|
|
10817
11829
|
async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
@@ -10851,19 +11863,19 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
10851
11863
|
res.end("missing path param");
|
|
10852
11864
|
return true;
|
|
10853
11865
|
}
|
|
10854
|
-
const extension =
|
|
11866
|
+
const extension = import_node_path17.default.extname(targetPath).toLowerCase();
|
|
10855
11867
|
if (!REPLACEMENT_MODULE_EXTENSIONS.some((allowed) => allowed === extension)) {
|
|
10856
11868
|
res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
|
|
10857
11869
|
res.end(`replacement files must be ${REPLACEMENT_MODULE_EXTENSIONS.join(", ")}`);
|
|
10858
11870
|
return true;
|
|
10859
11871
|
}
|
|
10860
|
-
if (!
|
|
11872
|
+
if (!import_node_path17.default.isAbsolute(targetPath)) {
|
|
10861
11873
|
res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
|
|
10862
11874
|
res.end("replacement file path must be absolute");
|
|
10863
11875
|
return true;
|
|
10864
11876
|
}
|
|
10865
11877
|
const runtimePackages = new Set(url.searchParams.getAll("runtimePackage"));
|
|
10866
|
-
const servedRoots = options.servedRoots?.map((root) =>
|
|
11878
|
+
const servedRoots = options.servedRoots?.map((root) => import_node_path17.default.resolve(root));
|
|
10867
11879
|
if (servedRoots && !isInsideAny(servedRoots, targetPath)) {
|
|
10868
11880
|
res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
|
|
10869
11881
|
res.end("replacement file must be inside a folder the bundler serves");
|
|
@@ -10871,7 +11883,7 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
10871
11883
|
}
|
|
10872
11884
|
let resolvedTargetPath;
|
|
10873
11885
|
try {
|
|
10874
|
-
resolvedTargetPath = await
|
|
11886
|
+
resolvedTargetPath = await import_promises7.default.realpath(targetPath);
|
|
10875
11887
|
} catch (error) {
|
|
10876
11888
|
const message = error instanceof Error ? error.message : String(error);
|
|
10877
11889
|
res.writeHead(404, { "Content-Type": "text/plain; charset=utf-8" });
|
|
@@ -10879,7 +11891,7 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
10879
11891
|
return true;
|
|
10880
11892
|
}
|
|
10881
11893
|
if (servedRoots) {
|
|
10882
|
-
const realRoots = (await Promise.all(servedRoots.map((root) =>
|
|
11894
|
+
const realRoots = (await Promise.all(servedRoots.map((root) => import_promises7.default.realpath(root).catch(() => null)))).filter((root) => root !== null);
|
|
10883
11895
|
if (!isInsideAny(realRoots, resolvedTargetPath)) {
|
|
10884
11896
|
res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
|
|
10885
11897
|
res.end("replacement file must be inside a folder the bundler serves");
|
|
@@ -10889,7 +11901,7 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
10889
11901
|
try {
|
|
10890
11902
|
const compiled = compileReplacementModule({
|
|
10891
11903
|
filePath: resolvedTargetPath,
|
|
10892
|
-
source: await
|
|
11904
|
+
source: await import_promises7.default.readFile(resolvedTargetPath, "utf8"),
|
|
10893
11905
|
runtimePackages,
|
|
10894
11906
|
// the imported file's url is this request's with only its path changed,
|
|
10895
11907
|
// so the token, cache key and runtime packages carry over.
|
|
@@ -10918,7 +11930,7 @@ async function handleReplacementModuleRequest(req, res, options = {}) {
|
|
|
10918
11930
|
|
|
10919
11931
|
// src/one-native-app-catalog.ts
|
|
10920
11932
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
10921
|
-
var
|
|
11933
|
+
var import_node_path18 = __toESM(require("node:path"), 1);
|
|
10922
11934
|
var ONE_NATIVE_APP_CATALOG_ROUTE = "/__peach/native-app-catalog";
|
|
10923
11935
|
var HEX_COLOR = /^#[\da-f]{6}$/i;
|
|
10924
11936
|
function parseAccent(value) {
|
|
@@ -10930,7 +11942,7 @@ function parseAccent(value) {
|
|
|
10930
11942
|
function parseOneNativeAppCatalog(value) {
|
|
10931
11943
|
if (!isRecord(value)) return null;
|
|
10932
11944
|
const accentColor = parseAccent(value.accentColor);
|
|
10933
|
-
const assetCatalog = typeof value.assetCatalog === "string" &&
|
|
11945
|
+
const assetCatalog = typeof value.assetCatalog === "string" && import_node_path18.default.isAbsolute(value.assetCatalog) ? value.assetCatalog : null;
|
|
10934
11946
|
return accentColor || assetCatalog ? { accentColor, assetCatalog } : null;
|
|
10935
11947
|
}
|
|
10936
11948
|
function readOneNativeAppCatalog(entryConfig, root) {
|
|
@@ -10939,19 +11951,19 @@ function readOneNativeAppCatalog(entryConfig, root) {
|
|
|
10939
11951
|
if (!isRecord(ios)) return null;
|
|
10940
11952
|
return parseOneNativeAppCatalog({
|
|
10941
11953
|
accentColor: ios.accentColor,
|
|
10942
|
-
assetCatalog: typeof ios.assetCatalog === "string" ?
|
|
11954
|
+
assetCatalog: typeof ios.assetCatalog === "string" ? import_node_path18.default.resolve(root, ios.assetCatalog) : null
|
|
10943
11955
|
});
|
|
10944
11956
|
}
|
|
10945
11957
|
|
|
10946
11958
|
// src/one-widget-metadata.ts
|
|
10947
11959
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
10948
|
-
var
|
|
10949
|
-
var
|
|
10950
|
-
var
|
|
11960
|
+
var import_node_child_process11 = require("node:child_process");
|
|
11961
|
+
var import_node_crypto6 = require("node:crypto");
|
|
11962
|
+
var import_node_fs15 = __toESM(require("node:fs"), 1);
|
|
10951
11963
|
var import_node_module2 = require("node:module");
|
|
10952
|
-
var
|
|
11964
|
+
var import_node_path19 = __toESM(require("node:path"), 1);
|
|
10953
11965
|
var import_node_util7 = require("node:util");
|
|
10954
|
-
var run6 = (0, import_node_util7.promisify)(
|
|
11966
|
+
var run6 = (0, import_node_util7.promisify)(import_node_child_process11.execFile);
|
|
10955
11967
|
var configs = /* @__PURE__ */ new Map();
|
|
10956
11968
|
var reads = /* @__PURE__ */ new Map();
|
|
10957
11969
|
var CONFIG_CHILD = `
|
|
@@ -10971,8 +11983,8 @@ fs.writeFileSync(process.argv[2], JSON.stringify({
|
|
|
10971
11983
|
function configStamp(files) {
|
|
10972
11984
|
return JSON.stringify(
|
|
10973
11985
|
files.map((file) => {
|
|
10974
|
-
if (!
|
|
10975
|
-
const stat =
|
|
11986
|
+
if (!import_node_fs15.default.existsSync(file)) return [file, null];
|
|
11987
|
+
const stat = import_node_fs15.default.statSync(file);
|
|
10976
11988
|
return [file, stat.mtimeMs, stat.ctimeMs, stat.size];
|
|
10977
11989
|
})
|
|
10978
11990
|
);
|
|
@@ -10983,13 +11995,13 @@ async function readConfig(root) {
|
|
|
10983
11995
|
const reading = reads.get(root);
|
|
10984
11996
|
if (reading) return reading;
|
|
10985
11997
|
const promise = (async () => {
|
|
10986
|
-
(0, import_node_module2.createRequire)(
|
|
10987
|
-
const cache =
|
|
10988
|
-
|
|
10989
|
-
const directory =
|
|
10990
|
-
const script =
|
|
10991
|
-
const result =
|
|
10992
|
-
|
|
11998
|
+
(0, import_node_module2.createRequire)(import_node_path19.default.join(root, "package.json")).resolve("one/vite");
|
|
11999
|
+
const cache = import_node_path19.default.join(root, "node_modules/.cache/peach-widget-config");
|
|
12000
|
+
import_node_fs15.default.mkdirSync(cache, { recursive: true });
|
|
12001
|
+
const directory = import_node_fs15.default.mkdtempSync(import_node_path19.default.join(cache, "read-"));
|
|
12002
|
+
const script = import_node_path19.default.join(directory, "read.mjs");
|
|
12003
|
+
const result = import_node_path19.default.join(directory, "result.json");
|
|
12004
|
+
import_node_fs15.default.writeFileSync(script, CONFIG_CHILD);
|
|
10993
12005
|
try {
|
|
10994
12006
|
await run6(process.execPath, [script, result], {
|
|
10995
12007
|
cwd: root,
|
|
@@ -10997,7 +12009,7 @@ async function readConfig(root) {
|
|
|
10997
12009
|
timeout: 3e4,
|
|
10998
12010
|
maxBuffer: 1024 * 1024
|
|
10999
12011
|
});
|
|
11000
|
-
const value = JSON.parse(
|
|
12012
|
+
const value = JSON.parse(import_node_fs15.default.readFileSync(result, "utf8"));
|
|
11001
12013
|
if (!isRecord(value) || !Array.isArray(value.watched) || !value.watched.every((file) => typeof file === "string"))
|
|
11002
12014
|
throw new Error("One config loader returned invalid dependencies");
|
|
11003
12015
|
if (!Array.isArray(value.urlSchemes) || !value.urlSchemes.every(
|
|
@@ -11020,8 +12032,8 @@ async function readConfig(root) {
|
|
|
11020
12032
|
}
|
|
11021
12033
|
const watched = [
|
|
11022
12034
|
.../* @__PURE__ */ new Set([
|
|
11023
|
-
|
|
11024
|
-
...value.watched.map((file) =>
|
|
12035
|
+
import_node_path19.default.join(root, "package.json"),
|
|
12036
|
+
...value.watched.map((file) => import_node_path19.default.resolve(root, file))
|
|
11025
12037
|
])
|
|
11026
12038
|
];
|
|
11027
12039
|
const loaded2 = {
|
|
@@ -11033,7 +12045,7 @@ async function readConfig(root) {
|
|
|
11033
12045
|
configs.set(root, loaded2);
|
|
11034
12046
|
return loaded2;
|
|
11035
12047
|
} finally {
|
|
11036
|
-
|
|
12048
|
+
import_node_fs15.default.rmSync(directory, { recursive: true, force: true });
|
|
11037
12049
|
}
|
|
11038
12050
|
})();
|
|
11039
12051
|
reads.set(root, promise);
|
|
@@ -11054,13 +12066,13 @@ function declaredFamilies(source) {
|
|
|
11054
12066
|
return home;
|
|
11055
12067
|
}
|
|
11056
12068
|
async function readOneWidgetSources(appRoot) {
|
|
11057
|
-
const root =
|
|
12069
|
+
const root = import_node_fs15.default.realpathSync(appRoot);
|
|
11058
12070
|
const config = await readConfig(root);
|
|
11059
12071
|
if (!config.widget) return null;
|
|
11060
12072
|
const widget = config.widget;
|
|
11061
12073
|
const sourceFiles = {
|
|
11062
|
-
"OneWidget.swift":
|
|
11063
|
-
"OneWidgetContract.swift":
|
|
12074
|
+
"OneWidget.swift": import_node_path19.default.join(root, "ios/OneWidgets/OneWidget.swift"),
|
|
12075
|
+
"OneWidgetContract.swift": import_node_path19.default.join(
|
|
11064
12076
|
root,
|
|
11065
12077
|
"ios",
|
|
11066
12078
|
widget.appName,
|
|
@@ -11069,15 +12081,15 @@ async function readOneWidgetSources(appRoot) {
|
|
|
11069
12081
|
};
|
|
11070
12082
|
const files = /* @__PURE__ */ new Map();
|
|
11071
12083
|
const sources = {};
|
|
11072
|
-
for (const [
|
|
11073
|
-
if (!
|
|
12084
|
+
for (const [name2, file] of Object.entries(sourceFiles)) {
|
|
12085
|
+
if (!import_node_fs15.default.existsSync(file))
|
|
11074
12086
|
throw new Error(`missing One widget prebuild source ${file}; run one prebuild`);
|
|
11075
12087
|
const bytes = readPackageFile(root, file, MAX_SWIFT_COMPILE_SOURCE_BYTES);
|
|
11076
12088
|
const text = bytes.toString("utf8");
|
|
11077
12089
|
if (!Buffer.from(text).equals(bytes))
|
|
11078
12090
|
throw new Error(`One widget prebuild source is not UTF-8: ${file}`);
|
|
11079
|
-
files.set(
|
|
11080
|
-
sources[
|
|
12091
|
+
files.set(name2, text);
|
|
12092
|
+
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");
|
|
11081
12093
|
}
|
|
11082
12094
|
const contract = files.get("OneWidgetContract.swift") ?? "";
|
|
11083
12095
|
const source = files.get("OneWidget.swift") ?? "";
|
|
@@ -11101,13 +12113,217 @@ async function configuredOneWidget(appRoot, bundleUrl) {
|
|
|
11101
12113
|
return {
|
|
11102
12114
|
metadata: source.widget,
|
|
11103
12115
|
projectRoot: source.root,
|
|
11104
|
-
appIdentity: (0,
|
|
12116
|
+
appIdentity: (0, import_node_crypto6.createHash)("sha256").update(JSON.stringify([source.root, source.widget.bundleId])).digest("hex"),
|
|
11105
12117
|
bundleUrl,
|
|
11106
12118
|
packageUrl: new URL(`${SWIFT_PACKAGE_PATH}OneWidgets`, bundleUrl).href,
|
|
11107
12119
|
urlSchemes: source.urlSchemes
|
|
11108
12120
|
};
|
|
11109
12121
|
}
|
|
11110
12122
|
|
|
12123
|
+
// src/runtime-packs.ts
|
|
12124
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
12125
|
+
var import_node_fs16 = __toESM(require("node:fs"), 1);
|
|
12126
|
+
var import_node_path20 = __toESM(require("node:path"), 1);
|
|
12127
|
+
var import_node_timers = require("node:timers");
|
|
12128
|
+
|
|
12129
|
+
// src/runtime-delivery.ts
|
|
12130
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
12131
|
+
|
|
12132
|
+
// src/public-brand.ts
|
|
12133
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
12134
|
+
var name = "Peach";
|
|
12135
|
+
var peachPublicBrand = Object.freeze({
|
|
12136
|
+
name,
|
|
12137
|
+
packageName: "peachsim",
|
|
12138
|
+
commandName: "peach",
|
|
12139
|
+
domain: "peachsim.com",
|
|
12140
|
+
origin: "https://peachsim.com",
|
|
12141
|
+
boxOrigin: "https://rnx-box.contrast.dev"
|
|
12142
|
+
});
|
|
12143
|
+
|
|
12144
|
+
// src/runtime-delivery.ts
|
|
12145
|
+
var DEFAULT_RUNTIME_CDN_ORIGIN = peachPublicBrand.origin;
|
|
12146
|
+
var RNX_CHANGELOG_URL = `${peachPublicBrand.origin}/changelog`;
|
|
12147
|
+
var RNX_CHANGELOG_API_URL = `${peachPublicBrand.origin}/api/changelog/sootsim`;
|
|
12148
|
+
var RNX_RUNTIME_PRODUCT = {
|
|
12149
|
+
id: "peach",
|
|
12150
|
+
defaultCdnOrigin: DEFAULT_RUNTIME_CDN_ORIGIN,
|
|
12151
|
+
manifestPath: "/runtimes/manifest.json",
|
|
12152
|
+
tarballPath: (version) => `/runtimes/sootsim-runtime-${version}.tar.zst`,
|
|
12153
|
+
// the engine runtime is a static SPA: shell at the root, engine/ and
|
|
12154
|
+
// engine-tenant/ beneath it. index.html is what the daemon and the
|
|
12155
|
+
// vite/metro plugins serve, so its absence means the tarball is not one.
|
|
12156
|
+
installedMarker: "index.html",
|
|
12157
|
+
verifyInstall: ensureCliCompanion,
|
|
12158
|
+
env: {
|
|
12159
|
+
cdnOrigin: "PEACH_CDN_ORIGIN",
|
|
12160
|
+
channel: "PEACH_RUNTIME_CHANNEL"
|
|
12161
|
+
},
|
|
12162
|
+
ensureHome: ensureRnxHome,
|
|
12163
|
+
configFile: configFilePath,
|
|
12164
|
+
runtimesDir,
|
|
12165
|
+
runtimeDir,
|
|
12166
|
+
cacheDir,
|
|
12167
|
+
readActiveRuntime,
|
|
12168
|
+
writeActiveRuntime
|
|
12169
|
+
};
|
|
12170
|
+
var rnxRuntime = createRuntimeDelivery(RNX_RUNTIME_PRODUCT);
|
|
12171
|
+
|
|
12172
|
+
// src/runtime-packs.ts
|
|
12173
|
+
var inflight = /* @__PURE__ */ new Map();
|
|
12174
|
+
var packsByRoot = /* @__PURE__ */ new Map();
|
|
12175
|
+
var listedByRoot = /* @__PURE__ */ new Map();
|
|
12176
|
+
function listedFiles(runtimeRoot) {
|
|
12177
|
+
let listed = listedByRoot.get(runtimeRoot);
|
|
12178
|
+
if (listed) return listed;
|
|
12179
|
+
listed = /* @__PURE__ */ new Map();
|
|
12180
|
+
for (const [pack, entry] of Object.entries(readPacks(runtimeRoot) ?? {}))
|
|
12181
|
+
for (const file of entry.files ?? []) {
|
|
12182
|
+
const name2 = import_node_path20.default.posix.basename(file);
|
|
12183
|
+
listed.set(name2, [...listed.get(name2) ?? [], { file, pack }]);
|
|
12184
|
+
}
|
|
12185
|
+
listedByRoot.set(runtimeRoot, listed);
|
|
12186
|
+
return listed;
|
|
12187
|
+
}
|
|
12188
|
+
function readPacks(runtimeRoot) {
|
|
12189
|
+
const cached = packsByRoot.get(runtimeRoot);
|
|
12190
|
+
if (cached !== void 0) return cached;
|
|
12191
|
+
const file = import_node_path20.default.join(runtimeRoot, RUNTIME_PACKS_FILE);
|
|
12192
|
+
if (!import_node_fs16.default.existsSync(file)) {
|
|
12193
|
+
packsByRoot.set(runtimeRoot, null);
|
|
12194
|
+
return null;
|
|
12195
|
+
}
|
|
12196
|
+
const parsed = JSON.parse(import_node_fs16.default.readFileSync(file, "utf8"));
|
|
12197
|
+
const packs = {};
|
|
12198
|
+
if (typeof parsed !== "object" || parsed === null)
|
|
12199
|
+
throw new Error(`${file} is not an object`);
|
|
12200
|
+
for (const [prefix, entry] of Object.entries(parsed)) {
|
|
12201
|
+
if (typeof entry?.file !== "string" || typeof entry?.sha256 !== "string")
|
|
12202
|
+
throw new Error(`${file} entry ${prefix} lacks file and sha256`);
|
|
12203
|
+
const files = entry.files;
|
|
12204
|
+
if (files !== void 0 && !(Array.isArray(files) && files.every((f) => typeof f === "string")))
|
|
12205
|
+
throw new Error(`${file} entry ${prefix} has files that are not paths`);
|
|
12206
|
+
packs[prefix] = {
|
|
12207
|
+
file: entry.file,
|
|
12208
|
+
sha256: entry.sha256,
|
|
12209
|
+
...files ? { files } : {}
|
|
12210
|
+
};
|
|
12211
|
+
}
|
|
12212
|
+
packsByRoot.set(runtimeRoot, packs);
|
|
12213
|
+
return packs;
|
|
12214
|
+
}
|
|
12215
|
+
async function ensureRuntimePackFor(runtimeRoot, pathname) {
|
|
12216
|
+
warmRuntimePacks(runtimeRoot);
|
|
12217
|
+
const prefix = RUNTIME_PACK_PREFIXES.find(
|
|
12218
|
+
(candidate) => pathname.includes(`/${candidate}`)
|
|
12219
|
+
);
|
|
12220
|
+
if (prefix) {
|
|
12221
|
+
await installNamedPack(runtimeRoot, prefix);
|
|
12222
|
+
return;
|
|
12223
|
+
}
|
|
12224
|
+
const listed = listedFiles(runtimeRoot).get(import_node_path20.default.posix.basename(pathname))?.find(({ file }) => pathname.endsWith(`/${file}`));
|
|
12225
|
+
if (listed) {
|
|
12226
|
+
if (!import_node_fs16.default.existsSync(import_node_path20.default.join(runtimeRoot, listed.file)))
|
|
12227
|
+
await installNamedPack(runtimeRoot, listed.pack);
|
|
12228
|
+
return;
|
|
12229
|
+
}
|
|
12230
|
+
const at = pathname.indexOf(`/${RUNTIME_MERGE_PACK_DIR}`);
|
|
12231
|
+
if (at === -1) return;
|
|
12232
|
+
const tenantDir = import_node_path20.default.join(runtimeRoot, RUNTIME_MERGE_PACK_DIR);
|
|
12233
|
+
const rel = pathname.slice(at + RUNTIME_MERGE_PACK_DIR.length + 1);
|
|
12234
|
+
if (!/\.m?js$/.test(rel) || import_node_fs16.default.existsSync(import_node_path20.default.join(tenantDir, rel))) return;
|
|
12235
|
+
await installNamedPack(runtimeRoot, RUNTIME_MERGE_PACK_DIR);
|
|
12236
|
+
}
|
|
12237
|
+
function installNamedPack(runtimeRoot, name2) {
|
|
12238
|
+
if (name2 === RUNTIME_MERGE_PACK_DIR) {
|
|
12239
|
+
const tenantDir = import_node_path20.default.join(runtimeRoot, RUNTIME_MERGE_PACK_DIR);
|
|
12240
|
+
return mergePack(
|
|
12241
|
+
runtimeRoot,
|
|
12242
|
+
name2,
|
|
12243
|
+
import_node_path20.default.join(tenantDir, RUNTIME_MERGE_PACK_INSTALL),
|
|
12244
|
+
tenantDir
|
|
12245
|
+
);
|
|
12246
|
+
}
|
|
12247
|
+
if (readPacks(runtimeRoot)?.[name2]?.files)
|
|
12248
|
+
return mergePack(
|
|
12249
|
+
runtimeRoot,
|
|
12250
|
+
name2,
|
|
12251
|
+
import_node_path20.default.join(runtimeRoot, `.pack-${name2}`),
|
|
12252
|
+
runtimeRoot
|
|
12253
|
+
);
|
|
12254
|
+
return installPack(runtimeRoot, name2, import_node_path20.default.join(runtimeRoot, name2.slice(0, -1)));
|
|
12255
|
+
}
|
|
12256
|
+
var WARM_DELAY_MS = 3e4;
|
|
12257
|
+
var warming = /* @__PURE__ */ new Set();
|
|
12258
|
+
function warmRuntimePacks(runtimeRoot) {
|
|
12259
|
+
if (warming.has(runtimeRoot)) return;
|
|
12260
|
+
warming.add(runtimeRoot);
|
|
12261
|
+
const warm = async () => {
|
|
12262
|
+
for (const name2 of Object.keys(readPacks(runtimeRoot) ?? {}))
|
|
12263
|
+
if (!await installNamedPack(runtimeRoot, name2)) return;
|
|
12264
|
+
};
|
|
12265
|
+
const schedule = import_node_timers.setTimeout;
|
|
12266
|
+
schedule(() => void warm(), WARM_DELAY_MS).unref();
|
|
12267
|
+
}
|
|
12268
|
+
async function mergePack(runtimeRoot, name2, installDir, targetDir) {
|
|
12269
|
+
if (import_node_fs16.default.existsSync(import_node_path20.default.join(installDir, RUNTIME_MERGE_PACK_MERGED))) return true;
|
|
12270
|
+
if (!await installPack(runtimeRoot, name2, installDir)) return false;
|
|
12271
|
+
const link = (sub) => {
|
|
12272
|
+
for (const entry of import_node_fs16.default.readdirSync(import_node_path20.default.join(installDir, sub), {
|
|
12273
|
+
withFileTypes: true
|
|
12274
|
+
})) {
|
|
12275
|
+
const child = import_node_path20.default.join(sub, entry.name);
|
|
12276
|
+
if (entry.isDirectory()) {
|
|
12277
|
+
import_node_fs16.default.mkdirSync(import_node_path20.default.join(targetDir, child), { recursive: true });
|
|
12278
|
+
link(child);
|
|
12279
|
+
} else if (entry.name !== RUNTIME_PACK_MARKER) {
|
|
12280
|
+
try {
|
|
12281
|
+
import_node_fs16.default.linkSync(import_node_path20.default.join(installDir, child), import_node_path20.default.join(targetDir, child));
|
|
12282
|
+
} catch (error) {
|
|
12283
|
+
if (!(error instanceof Error && "code" in error && error.code === "EEXIST"))
|
|
12284
|
+
throw error;
|
|
12285
|
+
}
|
|
12286
|
+
}
|
|
12287
|
+
}
|
|
12288
|
+
};
|
|
12289
|
+
try {
|
|
12290
|
+
link("");
|
|
12291
|
+
import_node_fs16.default.writeFileSync(import_node_path20.default.join(installDir, RUNTIME_MERGE_PACK_MERGED), "");
|
|
12292
|
+
return true;
|
|
12293
|
+
} catch (error) {
|
|
12294
|
+
console.error(
|
|
12295
|
+
`[peach] ${name2} pack merge failed: ${error instanceof Error ? error.message : String(error)}`
|
|
12296
|
+
);
|
|
12297
|
+
return false;
|
|
12298
|
+
}
|
|
12299
|
+
}
|
|
12300
|
+
async function installPack(runtimeRoot, prefix, destDir) {
|
|
12301
|
+
const marker = import_node_path20.default.join(destDir, RUNTIME_PACK_MARKER);
|
|
12302
|
+
if (import_node_fs16.default.existsSync(marker)) return true;
|
|
12303
|
+
const pack = readPacks(runtimeRoot)?.[prefix];
|
|
12304
|
+
if (!pack) return true;
|
|
12305
|
+
let install = inflight.get(destDir);
|
|
12306
|
+
if (!install) {
|
|
12307
|
+
const version = import_node_path20.default.basename(runtimeRoot);
|
|
12308
|
+
const url = new URL(pack.file, rnxRuntime.tarballUrl(version));
|
|
12309
|
+
url.searchParams.set("sha256", pack.sha256);
|
|
12310
|
+
install = installVerifiedTarball({
|
|
12311
|
+
url: url.toString(),
|
|
12312
|
+
digest: { algorithm: "sha256", encoding: "hex", value: pack.sha256 },
|
|
12313
|
+
destDir,
|
|
12314
|
+
installedMarker: RUNTIME_PACK_MARKER,
|
|
12315
|
+
label: `peach runtime ${version} pack ${prefix}`
|
|
12316
|
+
}).catch((error) => {
|
|
12317
|
+
console.error(
|
|
12318
|
+
`[peach] ${prefix} pack download failed: ${error instanceof Error ? error.message : String(error)}`
|
|
12319
|
+
);
|
|
12320
|
+
}).finally(() => inflight.delete(destDir));
|
|
12321
|
+
inflight.set(destDir, install);
|
|
12322
|
+
}
|
|
12323
|
+
await install;
|
|
12324
|
+
return import_node_fs16.default.existsSync(marker);
|
|
12325
|
+
}
|
|
12326
|
+
|
|
11111
12327
|
// src/swift-vite-lifetime.ts
|
|
11112
12328
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
11113
12329
|
var LIFETIME = Symbol.for("peach.swift-vite-lifetime");
|
|
@@ -11145,11 +12361,11 @@ function requestAuthority(req) {
|
|
|
11145
12361
|
const authority = req.headers[":authority"];
|
|
11146
12362
|
return req.headers.host ?? (typeof authority === "string" ? authority : void 0);
|
|
11147
12363
|
}
|
|
11148
|
-
function exposeHeader(res,
|
|
12364
|
+
function exposeHeader(res, name2) {
|
|
11149
12365
|
const exposed = res.getHeader("access-control-expose-headers");
|
|
11150
12366
|
const names = typeof exposed === "string" && exposed ? exposed.split(/,\s*/) : [];
|
|
11151
|
-
if (!names.includes(
|
|
11152
|
-
res.setHeader("access-control-expose-headers", [...names,
|
|
12367
|
+
if (!names.includes(name2))
|
|
12368
|
+
res.setHeader("access-control-expose-headers", [...names, name2].join(", "));
|
|
11153
12369
|
}
|
|
11154
12370
|
var BUNDLE_SOURCE_REQUEST_HEADER = "x-peach-bundle-source";
|
|
11155
12371
|
var SWIFT_ROUTE_PREFIX = "/__peach/swift";
|
|
@@ -11245,7 +12461,7 @@ function peachPlugin(options = {}) {
|
|
|
11245
12461
|
}
|
|
11246
12462
|
res.setHeader(key, value);
|
|
11247
12463
|
}
|
|
11248
|
-
const forward = res.statusCode === 200 ? forwardRolldownBundleResponse(upstream, res) : (0,
|
|
12464
|
+
const forward = res.statusCode === 200 ? forwardRolldownBundleResponse(upstream, res) : (0, import_promises8.pipeline)(upstream, res);
|
|
11249
12465
|
forward.catch((error) => {
|
|
11250
12466
|
console.error("[peach] bundle forward failed", error);
|
|
11251
12467
|
const failure = error instanceof Error ? error : new Error(String(error));
|
|
@@ -11471,7 +12687,7 @@ function peachPlugin(options = {}) {
|
|
|
11471
12687
|
});
|
|
11472
12688
|
const bundleUrl = options.bundleUrl || "/node_modules/one/metro-entry.bundle?platform=ios&dev=true&minify=false";
|
|
11473
12689
|
const appName = resolveRnxDesktopAppName(options.open, server.config.root);
|
|
11474
|
-
const replacementToken = (0,
|
|
12690
|
+
const replacementToken = (0, import_node_crypto7.randomUUID)();
|
|
11475
12691
|
const bundleForOrigin = (origin) => {
|
|
11476
12692
|
const fullBundleUrl = new URL(bundleUrl, `${origin}/`).toString();
|
|
11477
12693
|
return tagRnxBundleForPlugin(
|
|
@@ -11559,7 +12775,7 @@ function peachPlugin(options = {}) {
|
|
|
11559
12775
|
if (!handled) next();
|
|
11560
12776
|
});
|
|
11561
12777
|
});
|
|
11562
|
-
server.middlewares.use((req, res, next) => {
|
|
12778
|
+
server.middlewares.use(async (req, res, next) => {
|
|
11563
12779
|
if (serveBrowserProxyRoute(req, res)) return;
|
|
11564
12780
|
const url = req.url || "";
|
|
11565
12781
|
const pathname = url.split("?")[0];
|
|
@@ -11573,6 +12789,7 @@ function peachPlugin(options = {}) {
|
|
|
11573
12789
|
next();
|
|
11574
12790
|
return;
|
|
11575
12791
|
}
|
|
12792
|
+
await ensureRuntimePackFor(runtimeRoot, pathname);
|
|
11576
12793
|
if (isRootRuntimeAssetPath(pathname)) {
|
|
11577
12794
|
const fullPath = resolveRuntimeFilePath(runtimeRoot, pathname);
|
|
11578
12795
|
if (fullPath) {
|